@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&display=swap');

:root {
    --bg: linear-gradient(135deg, #e7f6ff 0%, #d3ecff 40%, #c1e4ff 70%, #e5f5ff 100%);
    --bg-overlay: radial-gradient(circle at 25% 20%, rgba(73, 188, 255, 0.28), rgba(73, 188, 255, 0) 45%),
        radial-gradient(circle at 80% 10%, rgba(46, 178, 221, 0.22), rgba(46, 178, 221, 0) 42%);
    --surface: #f6fbff;
    --surface-border: #dcebf7;
    --text: #0f2942;
    --muted: #5f7896;
    --primary: #0f63b1;
    --primary-soft: #1da5d9;
    --accent: #1dc88c;
    --accent-2: #1fb071;
    --card-border: #d7e8f6;
    --card-shadow: 0 18px 60px rgba(25, 90, 140, 0.14);
    --btn-shadow: 0 12px 30px rgba(28, 172, 109, 0.35);
    --ghost-border: rgba(15, 99, 177, 0.2);
    --info-gradient: linear-gradient(115deg, #14b5d9, #0ea5e9 55%, #14d4d9);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg), var(--bg-overlay);
    color: var(--text);
    min-height: 100vh;
}

.auth-mode .wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 18px;
}

a {
    color: inherit;
    text-decoration: none;
}

.wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 18px 64px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.brand-left {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f8fbff;
    display: grid;
    place-items: center;
    box-shadow: 0 16px 40px rgba(15, 99, 177, 0.18);
    overflow: hidden;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-title {
    font-weight: 800;
    font-size: 22px;
    color: var(--primary);
}

.brand-sub {
    color: var(--muted);
    font-size: 13px;
}

.session-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--ghost-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--primary);
    flex-wrap: wrap;
}

.back-btn {
    border: 1px solid var(--ghost-border);
    background: linear-gradient(120deg, #ffffff, #e9f5ff);
    color: var(--primary);
    padding: 8px 14px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(15, 99, 177, 0.18);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-btn::before {
    content: '←';
    font-weight: 800;
}

.ghost-btn {
    border: 1px solid var(--ghost-border);
    background: rgba(15, 99, 177, 0.08);
    color: var(--primary);
    padding: 8px 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.ghost-link {
    color: var(--primary);
    font-weight: 700;
}

.surface {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 18px;
    box-shadow: 0 18px 60px rgba(15, 88, 150, 0.12);
    padding: 20px 22px 26px;
}

.surface-head {
    margin-bottom: 16px;
}

.surface-head h1 {
    margin: 0 0 6px;
    font-size: 32px;
    color: #0c2c4c;
}

.surface-head p {
    margin: 0;
    color: var(--muted);
}

.info-banner {
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--info-gradient);
    color: #f8fbff;
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 12px 40px rgba(14, 165, 233, 0.22);
    margin-bottom: 18px;
}

.info-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 18px;
}

.info-title {
    font-weight: 800;
    font-size: 20px;
    margin-bottom: 2px;
}

.info-sub {
    color: rgba(248, 251, 255, 0.85);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.card {
    background: #ffffff;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--card-shadow);
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 50px rgba(15, 88, 150, 0.18);
}

.card-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.card-icon {
    min-width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1fb071, #19c084);
    color: #f5fffa;
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 800;
}

.card-title-wrap h3 {
    margin: 0 0 4px;
    font-size: 18px;
    color: #0f2942;
}

.card-sub {
    margin: 0;
    color: #6a7c92;
    font-weight: 600;
    letter-spacing: 0.15px;
    text-transform: uppercase;
    font-size: 13px;
}

.primary-btn {
    margin-top: auto;
    border: none;
    border-radius: 12px;
    padding: 12px 14px;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #f7fffb;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--btn-shadow);
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(30, 183, 120, 0.45);
}

.viewer-surface {
    margin-top: 8px;
}

.viewer-shell {
    background: #ffffff;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.viewer-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.viewer-title {
    margin: 0;
    color: #0f2942;
}

.viewer-label {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #0f63b1;
    text-transform: uppercase;
}

.viewer-actions {
    display: flex;
    gap: 10px;
}

.viewer-actions a {
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(15, 99, 177, 0.08);
    border: 1px solid var(--ghost-border);
    color: var(--primary);
    font-weight: 700;
}

iframe.viewer-frame {
    width: 100%;
    height: 78vh;
    border: none;
    background: #f2f7fb;
}

.empty {
    padding: 20px;
    border: 1px dashed var(--surface-border);
    border-radius: 12px;
    text-align: center;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.8);
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .session-chip {
        width: 100%;
        justify-content: flex-start;
    }

    .brand-mark {
        width: 56px;
        height: 56px;
    }
}

/* Auth UI */
.auth-card {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--surface-border);
    border-radius: 22px;
    box-shadow: 0 25px 80px rgba(15, 88, 150, 0.16);
    padding: 36px 32px 28px;
    width: 420px;
    max-width: 90vw;
    aspect-ratio: 1;
    margin: 48px auto;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.auth-card.loading {
    text-align: center;
}

.auth-card h2 {
    margin: 0 0 4px;
    letter-spacing: 0.2px;
    color: #0f2942;
    font-size: 1.25rem;
}

.auth-card p {
    margin: 0 0 4px;
    color: var(--muted);
    line-height: 1.4;
    font-size: 0.82rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.auth-field label {
    font-weight: 700;
    color: #0f2942;
    font-size: 14px;
    letter-spacing: 0.2px;
}

.auth-field input {
    border-radius: 10px;
    border: 1px solid rgba(15, 99, 177, 0.18);
    padding: 10px 12px;
    background: rgba(248, 252, 255, 0.92);
    color: #0f2942;
    font-size: 0.88rem;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.auth-field input:focus {
    outline: none;
    border-color: rgba(15, 99, 177, 0.55);
    box-shadow:
        0 0 0 4px rgba(14, 165, 233, 0.16),
        0 10px 24px rgba(15, 99, 177, 0.10);
}

.auth-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 2px;
}

.auth-submit {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #f7fffb;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: var(--btn-shadow);
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(30, 183, 120, 0.45);
}

.auth-submit:active {
    transform: translateY(0px) scale(0.99);
}

.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-org {
    margin: 0;
    font-size: 0.82rem;
    font-style: normal;
    color: rgba(15, 41, 66, 0.62);
    letter-spacing: 0.2px;
}

.error-text {
    color: #e03131;
    font-weight: 700;
    font-size: 12px;
    margin-top: 2px;
    text-align: center;
    min-height: 16px;
}

.subtle {
    color: var(--muted);
    font-size: 14px;
}

.hidden {
    display: none !important;
}

.auth-hero {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
    align-items: center;
    text-align: center;
}

.auth-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: #ffffff;
    display: grid;
    place-items: center;
    box-shadow: 0 14px 30px rgba(15, 99, 177, 0.22);
    margin: -58px auto 4px;
    border: 6px solid #eef6ff;
    overflow: hidden;
}

.auth-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.auth-pill {
    width: fit-content;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.12);
    color: var(--accent-2);
    font-weight: 800;
    letter-spacing: 0.3px;
    font-size: 11px;
}

.auth-lead {
    margin: 0;
    color: rgba(15, 41, 66, 0.72);
    line-height: 1.5;
    font-weight: 600;
}