/* ========================================================
   Sakvex Auth Experience : Swiss Editorial Split Layout
   Built strictly on Sakvex Design System tokens (app.css)
   ======================================================== */

.auth-body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    min-height: 100vh;
    min-height: 100dvh;
}

/* ========================================================
   Left Column: Editorial Storytelling & Relay Topology
   ======================================================== */
.auth-story-panel {
    position: relative;
    background-color: var(--brand-subtle);
    border-right: 1px solid var(--border-color);
    padding: 2.25rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

/* Subtle architectural grid overlay */
.auth-story-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(54, 92, 141, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(54, 92, 141, 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

.auth-story-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.9;
}

.auth-story-content {
    position: relative;
    z-index: 2;
    max-width: 540px;
}

.auth-topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.auth-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text-primary);
}

.auth-brand-link img {
    height: 36px;
    width: auto;
    display: block;
}

.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-primary);
    background-color: var(--surface-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 0.35rem 0.85rem;
    box-shadow: var(--shadow-xs);
}

.auth-eyebrow-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--color-success);
    display: inline-block;
}

.auth-story-headline {
    font-size: clamp(1.85rem, 2.6vw, 2.55rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text-primary);
    margin: 1.35rem 0 1rem;
}

.auth-story-lead {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 48ch;
}

/* Editorial Pillar List (border-left architectural rules, not generic rounded cards) */
.auth-pillars {
    display: grid;
    gap: 1.1rem;
    margin-bottom: 2rem;
}

.auth-pillar {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--brand-primary);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1.1rem;
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.auth-pillar:hover {
    transform: translateX(3px);
    border-left-color: var(--brand-hover);
}

.auth-pillar-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-pillar-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0;
}

/* Telemetry / Plan Strip at bottom of story panel */
.auth-telemetry-strip {
    position: relative;
    z-index: 2;
    background: var(--surface-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.auth-telemetry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.auth-stat-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.auth-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ========================================================
   Right Column: Focused Auth Form Surface
   ======================================================== */
.auth-form-panel {
    background-color: var(--surface-main);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.25rem 2.75rem;
}

.auth-form-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.auth-mobile-brand {
    display: none;
}

.auth-form-container {
    width: 100%;
    max-width: 440px;
    margin: auto;
    padding: 1.5rem 0;
}

.auth-form-container--wide {
    max-width: 490px;
}

.auth-form-title {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.auth-form-subtitle {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

/* OAuth Button */
.auth-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    min-height: 46px;
    padding: 0.6rem 1rem;
    background-color: var(--surface-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.92rem;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-xs);
}

.auth-oauth-btn:hover {
    background-color: var(--surface-hover);
    border-color: #CBD2DC;
    color: var(--text-primary);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 1.35rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

/* Form Controls */
.auth-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.auth-input {
    min-height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--surface-main);
    color: var(--text-primary);
    font-size: 0.93rem;
    padding: 0.55rem 0.85rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(54, 92, 141, 0.14);
    outline: none;
}

.auth-input-group .auth-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.auth-pwd-toggle {
    min-height: 44px;
    min-width: 44px;
    border: 1px solid var(--border-color);
    border-left: 0;
    background-color: var(--surface-muted);
    color: var(--text-secondary);
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.auth-pwd-toggle:hover {
    background-color: var(--surface-active);
    color: var(--text-primary);
}

/* Primary CTA */
.auth-submit-btn {
    min-height: 46px;
    background-color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
    color: #FFFFFF !important;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.auth-submit-btn:hover,
.auth-submit-btn:focus-visible {
    background-color: var(--brand-hover);
    border-color: var(--brand-hover);
    color: #FFFFFF !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-submit-btn:active {
    background-color: var(--brand-active);
    border-color: var(--brand-active);
    transform: translateY(0);
}

/* Workspace Slug Preview */
.auth-slug-bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.auth-slug-pill {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--brand-primary);
    background-color: var(--brand-subtle);
    border: 1px solid rgba(54, 92, 141, 0.2);
    border-radius: var(--radius-xs);
    padding: 0.15rem 0.5rem;
    word-break: break-all;
}

/* Password Strength Meter */
.auth-pwd-meter {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 0.45rem;
}

.auth-pwd-bar {
    height: 4px;
    border-radius: var(--radius-pill);
    background-color: var(--border-color);
    transition: background-color 0.2s ease;
}

.auth-pwd-bar.is-weak { background-color: var(--color-error); }
.auth-pwd-bar.is-fair { background-color: var(--color-warning); }
.auth-pwd-bar.is-strong { background-color: var(--color-success); }

/* Starter Plan Banner inside Signup */
.auth-plan-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.auth-footer {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

.auth-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.auth-footer a:hover {
    color: var(--brand-primary);
    text-decoration: underline;
}

/* ========================================================
   Responsive Breakpoints (Tablet & Mobile)
   ======================================================== */
@media (max-width: 991.98px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-story-panel {
        display: none;
    }

    .auth-form-panel {
        padding: 1.5rem 1.25rem;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .auth-form-nav {
        justify-content: space-between;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--border-subtle);
    }

    .auth-mobile-brand {
        display: inline-flex;
        align-items: center;
        text-decoration: none;
    }

    .auth-mobile-brand img {
        height: 30px;
        width: auto;
    }

    .auth-form-container {
        padding: 1.75rem 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-pillar,
    .auth-submit-btn,
    .auth-oauth-btn {
        transition: none !important;
        transform: none !important;
    }
    .auth-story-canvas {
        display: none;
    }
}

/* ========================================================
   Sakvex Error Pages : Swiss Editorial Architectural Layout
   ======================================================== */
.err-body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.err-header {
    background-color: var(--surface-main);
    border-bottom: 1px solid var(--border-color);
    padding: 0.9rem 1.75rem;
}

.err-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.err-main {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.25rem;
    position: relative;
    background-image:
        linear-gradient(to right, rgba(54, 92, 141, 0.045) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(54, 92, 141, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
}

.err-panel {
    width: 100%;
    max-width: 680px;
    background-color: var(--surface-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.err-panel-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.err-panel-body {
    padding: 2.5rem 2.5rem 2.25rem;
}

.err-code-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.err-code-display {
    font-family: var(--font-mono);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--brand-primary);
}

.err-code-display--danger { color: var(--color-error); }
.err-code-display--warning { color: var(--color-warning); }

.err-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.err-icon-badge--primary {
    background-color: var(--brand-subtle);
    color: var(--brand-primary);
    border: 1px solid rgba(54, 92, 141, 0.22);
}

.err-icon-badge--danger {
    background-color: var(--color-error-subtle);
    color: var(--color-error);
    border: 1px solid rgba(181, 71, 71, 0.22);
}

.err-icon-badge--warning {
    background-color: var(--color-warning-subtle);
    color: var(--color-warning);
    border: 1px solid rgba(166, 106, 22, 0.22);
}

.err-title {
    font-size: clamp(1.4rem, 2.2vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 0.65rem;
}

.err-message {
    font-size: 0.96rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 56ch;
}

.err-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.err-actions .btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-weight: 500;
}

.err-footer {
    background-color: var(--surface-main);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.err-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.err-footer a:hover {
    color: var(--brand-primary);
    text-decoration: underline;
}

@media (max-width: 575.98px) {
    .err-header {
        padding: 0.75rem 1rem;
    }
    .err-panel-body {
        padding: 1.75rem 1.25rem;
    }
    .err-actions {
        flex-direction: column;
    }
    .err-actions .btn {
        width: 100%;
    }
}

/* ========================================================
   Workspace Switcher & Invitation Context Utilities
   ======================================================== */
.auth-invite-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background-color: var(--brand-subtle);
    border: 1px solid rgba(54, 92, 141, 0.22);
    border-left: 3px solid var(--brand-primary);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.auth-ws-panel {
    max-width: 680px;
}

.auth-ws-list {
    display: grid;
    gap: 0.75rem;
}

.auth-ws-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.85rem;
    padding: 1rem 1.15rem;
    background-color: var(--surface-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-ws-item:hover {
    border-color: #CBD4E0;
    box-shadow: var(--shadow-xs);
}

.auth-ws-item.is-active {
    border-color: var(--brand-primary);
    background-color: var(--brand-subtle);
}

.auth-ws-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    background-color: var(--surface-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.auth-ws-item.is-active .auth-ws-avatar {
    background-color: var(--brand-primary);
    color: #FFFFFF;
    border-color: var(--brand-primary);
}

@media (max-width: 575.98px) {
    .auth-ws-item form,
    .auth-ws-item form button {
        width: 100%;
        min-height: 42px;
    }
}

/* ========================================================
   Sakvex Super Admin Control Plane Auth Theme
   Deep Slate (#0F172A) story column + crisp white form
   ======================================================== */
.admin-auth-story {
    background-color: #0F172A;
    border-right: 1px solid #1E293B;
    color: #F8FAFC;
}

.admin-auth-story::before {
    background-image:
        linear-gradient(to right, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
}

.admin-auth-story .auth-eyebrow {
    background-color: rgba(30, 41, 59, 0.9);
    border-color: rgba(148, 163, 184, 0.25);
    color: #E2E8F0;
}

.admin-auth-story .auth-story-headline {
    color: #FFFFFF;
}

.admin-auth-story .auth-story-lead {
    color: #94A3B8;
}

.admin-auth-story .auth-pillar {
    background-color: rgba(30, 41, 59, 0.72);
    border-color: rgba(148, 163, 184, 0.18);
    border-left-color: var(--brand-primary);
}

.admin-auth-story .auth-pillar-title {
    color: #F8FAFC;
}

.admin-auth-story .auth-pillar-desc {
    color: #94A3B8;
}

.admin-auth-story .auth-telemetry-strip {
    background-color: rgba(15, 23, 42, 0.9);
    border-color: rgba(148, 163, 184, 0.2);
}

.admin-auth-story .auth-stat-label {
    color: #94A3B8;
}

.admin-auth-story .auth-stat-value {
    color: #F8FAFC;
}

.admin-otp-input {
    font-family: var(--font-mono);
    font-size: 1.55rem;
    letter-spacing: 0.38em;
    text-align: center;
    font-weight: 600;
    min-height: 54px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.admin-otp-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(54, 92, 141, 0.16);
    outline: none;
}

.admin-qr-frame {
    background: #FFFFFF;
    display: inline-block;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

#qrcode canvas {
    display: none !important;
}

#qrcode img {
    display: block !important;
    margin: 0 auto;
}

.admin-secret-box {
    font-family: var(--font-mono);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    font-size: 0.92rem;
    color: var(--text-primary);
    letter-spacing: 0.08em;
    word-break: break-all;
}

.admin-backup-chip {
    font-family: var(--font-mono);
    background-color: var(--surface-muted);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
    font-weight: 500;
}
