:root {
    --bg-0: #0a1628;
    --panel: rgba(15, 30, 55, 0.85);
    --line: rgba(56, 120, 200, 0.22);
    --cyan: #38bdf8;
    --blue: #1e88e5;
    --blue-dark: #1565c0;
    --ink: #eaf2ff;
    --ink-dim: #94a8c8;
    --ink-dimmer: #5a6f8f;
    --right-bg: #e8f0fa;
    --card-bg: #ffffff;
    --card-ink: #1e293b;
    --card-muted: #64748b;
    --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body.login-ai-page {
    width: 100vw;
    height: 100dvh;
    font-family: 'Inter', 'Space Grotesk', system-ui, sans-serif;
    color: var(--ink);
    overflow: hidden;
    background: var(--bg-0);
}

/* ===== FULL SCREEN SPLIT ===== */
.login-wrap {
    width: 100vw;
    height: 100dvh;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    overflow: hidden;
}

/* ===== LEFT STAGE ===== */
.stage {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: clamp(1.75rem, 3.5vh, 2.75rem) clamp(2rem, 4vw, 3.5rem);
    background:
        linear-gradient(145deg, rgba(8, 18, 36, 0.97) 0%, rgba(12, 28, 52, 0.94) 55%, rgba(15, 38, 72, 0.9) 100%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 60L30 0L60 60Z' fill='%23ffffff' fill-opacity='0.018'/%3E%3C/svg%3E");
    border-right: 1px solid var(--line);
    position: relative;
    overflow: hidden;
}

#netCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.5;
    pointer-events: none;
}

.stage > *:not(#netCanvas) { position: relative; z-index: 1; }

.brandrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center !important;
    gap: 1.25rem 2rem;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand img {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    object-fit: contain;
    background: #fff;
    padding: 5px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.brand h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1rem, 1.7vw, 1.28rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    margin: 0;
    color: #fff;
    line-height: 1.25;
}

.brand p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.divider-x {
    width: 1px;
    height: 48px;
    background: var(--line);
}

.stage-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    max-width: 44rem;
    margin: 0 auto;
    padding: 1.25rem 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px 9px 13px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.28);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    color: var(--cyan);
    margin-bottom: 1.5rem;
}

.badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 10px 2px rgba(52, 211, 153, 0.6);
    animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

.headline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 6.8vw, 4.75rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin: 0 0 1.15rem;
    color: #fff;
}

.headline .accent {
    background: linear-gradient(90deg, var(--cyan), #60a5fa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.sub {
    font-size: clamp(1.05rem, 1.9vw, 1.3rem);
    line-height: 1.55;
    color: var(--ink-dim);
    max-width: 32rem;
    margin: 0 0 1.75rem;
}

.clockrow { margin-bottom: 1.15rem; }

.datepill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 22px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    font-size: 1.05rem;
    color: var(--ink-dim);
    backdrop-filter: blur(8px);
}

.datepill svg { color: var(--cyan); flex-shrink: 0; width: 18px; height: 18px; }

.clockcard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 1.35rem 1.85rem;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.5);
    width: min(100%, 420px);
    margin: 0 auto;
    backdrop-filter: blur(10px);
}

.clockicon {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    flex: none;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan);
}

.clockicon svg { width: 26px; height: 26px; }

.clocktime {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.35rem, 4.8vw, 3.15rem);
    letter-spacing: 0.01em;
    line-height: 1;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.clocktime #heroTimeSec {
    font-size: 0.72em;
    opacity: 0.9;
    margin-left: 0.05em;
}

.clocktime #heroTimeAmpm {
    font-size: 0.48em;
    margin-left: 0.3em;
    font-weight: 600;
    vertical-align: baseline;
}

.clocksub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--cyan);
    letter-spacing: 0.1em;
    margin-top: 8px;
}

.hero-greeting-note {
    margin-top: 1.15rem;
    font-size: 1.08rem;
    color: var(--ink-dim);
    line-height: 1.45;
}

.foot {
    font-size: 0.88rem;
    color: var(--ink-dimmer);
    text-align: center;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.foot span { color: var(--ink-dim); }

/* ===== RIGHT PANEL ===== */
.panelside {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: clamp(1.5rem, 3vh, 2.5rem);
    background:
        var(--right-bg)
        url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 60L30 0L60 60Z' fill='%231e88e5' fill-opacity='0.04'/%3E%3C/svg%3E");
}

.card {
    width: 100%;
    max-width: 460px;
    background: var(--card-bg);
    border: 1px solid rgba(30, 136, 229, 0.12);
    border-radius: 24px;
    padding: clamp(1.75rem, 3vh, 2.5rem);
    box-shadow: 0 24px 64px -20px rgba(30, 64, 120, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.bot-stage {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}

.bot-stage svg {
    width: 110px;
    height: 110px;
}

.cardhead { text-align: center; margin-bottom: 6px; }

.cardhead-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.cardhead h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0;
    color: var(--blue);
}

.mini-logos {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.mini-logos img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: contain;
    background: #fff;
    padding: 4px;
    border: 1px solid rgba(30, 136, 229, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cardhead p {
    font-size: 0.92rem;
    color: var(--card-muted);
    margin: 0 auto;
    max-width: 340px;
    line-height: 1.55;
}

.form { margin-top: 1.35rem; }

.field { margin-bottom: 18px; }

.field label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--card-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.inputwrap { position: relative; }

.inputwrap input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--card-ink);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.inputwrap input::placeholder { color: #94a3b8; }

.inputwrap input:focus {
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.12);
}

.inputwrap .icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.2s;
}

.inputwrap.pw .icon {
    cursor: pointer;
    pointer-events: auto;
}

.inputwrap input:focus + .icon { color: var(--blue); }

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 22px;
    font-size: 0.88rem;
    flex-wrap: wrap;
    gap: 8px;
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--card-muted);
    cursor: pointer;
}

.remember input {
    appearance: none;
    width: 17px;
    height: 17px;
    border-radius: 5px;
    border: 1px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
    position: relative;
}

.remember input:checked {
    background: var(--blue);
    border-color: var(--blue);
}

.remember input:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot {
    background: none;
    border: none;
    color: var(--blue);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
}

.forgot:hover { text-decoration: underline; }

.btn-primary {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
    box-shadow: 0 10px 24px -8px rgba(30, 136, 229, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -8px rgba(30, 136, 229, 0.65);
}

.btn-primary:active { transform: translateY(0); }

.divider {
    display: none;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: #94a3b8;
    font-size: 0.78rem;
}

.divider.is-visible { display: flex; }

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.btn-ghost {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--card-ink);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.btn-ghost.is-visible { display: flex; }

.btn-ghost:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: #eff6ff;
}

.note {
    font-size: 0.8rem;
    color: var(--card-muted);
    text-align: center;
    line-height: 1.55;
    margin-top: 14px;
}

.note b { color: #475569; font-weight: 600; }

.legal {
    font-size: 0.78rem;
    color: #94a3b8;
    text-align: center;
    margin-top: 14px;
}

.login-alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 0.92rem;
}

#forgotMsg {
    display: none;
    margin-top: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.88rem;
}

/* Mobile */
.hero-mobile-strip {
    display: none;
    text-align: center;
    padding-bottom: 1rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.hero-mobile-logos {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}

.hero-mobile-logos img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fff;
    padding: 3px;
    object-fit: contain;
    border: 1px solid #e2e8f0;
}

.hero-mobile-strip .headline {
    font-size: 1.75rem;
    color: var(--card-ink);
}

.hero-mobile-strip .hero-greeting-note {
    color: var(--card-muted);
    font-size: 0.9rem;
}

/* Face modal */
.face-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10, 22, 40, 0.88);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.face-modal-backdrop.is-open { display: flex; }

.face-modal {
    width: 100%;
    max-width: 420px;
    background: #0d1524;
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    color: #eaf2ff;
}

.face-modal-head {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.face-modal-head h4 { margin: 0; font-size: 1.1rem; }

.face-modal-close {
    background: none;
    border: none;
    color: #94a8c8;
    font-size: 1.4rem;
    cursor: pointer;
}

.face-modal-body { padding: 20px; text-align: center; }

.face-video-wrap {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
    margin-bottom: 14px;
    border: 2px solid rgba(56, 189, 248, 0.35);
}

.face-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.face-scan-line {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    animation: scanLine 2s ease-in-out infinite;
    pointer-events: none;
}

.face-status {
    font-size: 0.88rem;
    color: #94a8c8;
    min-height: 1.4em;
    margin-bottom: 12px;
}

.face-modal-actions { display: flex; gap: 10px; }

.face-modal-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.face-btn-scan {
    background: linear-gradient(90deg, var(--blue-dark), var(--blue));
    color: #fff;
}

.face-btn-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #eaf2ff;
}

@keyframes scanLine {
    0%, 100% { top: 15%; opacity: 0.3; }
    50% { top: 80%; opacity: 1; }
}

@media (max-width: 980px) {
    html, body { overflow: auto; }
    body.login-ai-page { height: auto; overflow-x: hidden; overflow-y: auto; }
    .login-wrap {
        width: 100%;
        height: auto;
        min-height: 100dvh;
        grid-template-columns: 1fr;
    }
    .stage { display: none; }
    .panelside {
        min-height: 100dvh;
        padding: 1.5rem 1.25rem;
    }
    .hero-mobile-strip { display: block; }
}

@media (max-width: 480px) {
    .mini-logos img { width: 36px; height: 36px; }
    .bot-stage svg { width: 90px; height: 90px; }
}
