/* ================================================
   BioAuth v2.0 — Enterprise SaaS Design System
   Inspired by Stripe, Vercel, Linear
   ================================================ */

/* ---- CSS Custom Properties (Design Tokens) ---- */
:root {
    /* Color Palette — Light Theme (Default) */
    --color-bg-primary: #f8fafc;
    --color-bg-secondary: #f1f5f9;
    --color-bg-card: rgba(255, 255, 255, 0.88);
    --color-bg-card-hover: rgba(248, 250, 252, 0.95);
    --color-bg-input: rgba(241, 245, 249, 0.8);
    --color-bg-input-focus: #ffffff;
    --color-bg-header: rgba(255, 255, 255, 0.82);
    --color-bg-sidebar: rgba(255, 255, 255, 0.92);
    --color-bg-overlay: rgba(15, 23, 42, 0.4);
    --color-bg-table-head: rgba(241, 245, 249, 0.9);

    --color-border: rgba(148, 163, 184, 0.25);
    --color-border-focus: rgba(14, 165, 233, 0.5);
    --color-border-subtle: rgba(148, 163, 184, 0.12);

    --color-text-primary: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;
    --color-text-accent: #0ea5e9;

    --color-accent: #0ea5e9;
    --color-accent-hover: #0284c7;
    --color-accent-glow: rgba(14, 165, 233, 0.2);
    --color-accent-subtle: rgba(14, 165, 233, 0.08);

    --color-blue: #3b82f6;
    --color-blue-subtle: rgba(59, 130, 246, 0.1);
    --color-green: #10b981;
    --color-green-subtle: rgba(16, 185, 129, 0.1);
    --color-red: #ef4444;
    --color-red-subtle: rgba(239, 68, 68, 0.1);
    --color-yellow: #f59e0b;
    --color-yellow-subtle: rgba(245, 158, 11, 0.1);

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.8rem;
    --font-size-base: 0.875rem;
    --font-size-md: 0.95rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.35rem;
    --font-size-2xl: 1.6rem;
    --font-size-3xl: 2rem;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px var(--color-accent-glow);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index scale */
    --z-base: 1;
    --z-sidebar: 40;
    --z-header: 50;
    --z-overlay: 60;
    --z-modal: 70;
    --z-toast: 100;

    /* Layout */
    --header-height: 60px;
    --sidebar-width: 260px;

    /* Chart.js adaptive colors */
    --chart-text-color: #475569;
    --chart-grid-color: rgba(148, 163, 184, 0.15);
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
    --color-bg-primary: #0b0f1a;
    --color-bg-secondary: #111827;
    --color-bg-card: rgba(23, 30, 48, 0.75);
    --color-bg-card-hover: rgba(30, 41, 59, 0.8);
    --color-bg-input: rgba(15, 23, 42, 0.7);
    --color-bg-input-focus: rgba(30, 41, 59, 0.9);
    --color-bg-header: rgba(11, 15, 26, 0.88);
    --color-bg-sidebar: rgba(15, 20, 35, 0.95);
    --color-bg-overlay: rgba(0, 0, 0, 0.6);
    --color-bg-table-head: rgba(15, 23, 42, 0.6);

    --color-border: rgba(148, 163, 184, 0.12);
    --color-border-focus: rgba(14, 165, 233, 0.4);
    --color-border-subtle: rgba(100, 116, 139, 0.08);

    --color-text-primary: #f1f5f9;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-text-accent: #38bdf8;

    --color-accent: #0ea5e9;
    --color-accent-hover: #38bdf8;
    --color-accent-glow: rgba(14, 165, 233, 0.25);
    --color-accent-subtle: rgba(56, 189, 248, 0.1);

    --color-blue-subtle: rgba(59, 130, 246, 0.12);
    --color-green-subtle: rgba(16, 185, 129, 0.12);
    --color-red-subtle: rgba(239, 68, 68, 0.12);
    --color-yellow-subtle: rgba(245, 158, 11, 0.12);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);

    --chart-text-color: #94a3b8;
    --chart-grid-color: rgba(148, 163, 184, 0.08);
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);
}


.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(100, 120, 180, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100, 120, 180, 0.025) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
}

.bg-glow--1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.12), transparent 70%);
    top: -200px;
    right: -100px;
    animation: floatGlow 25s ease-in-out infinite;
}

.bg-glow--2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.08), transparent 70%);
    bottom: -200px;
    left: -100px;
    animation: floatGlow 30s ease-in-out infinite reverse;
}

@keyframes floatGlow {

    0%,
    100% {
        transform: translate(0, 0);
    }

    33% {
        transform: translate(30px, -30px);
    }

    66% {
        transform: translate(-20px, 20px);
    }
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-weight: 500;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    padding: 10px 20px;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::after {
    opacity: 1;
}

.btn--primary {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    box-shadow: 0 2px 8px var(--color-accent-glow), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn--primary:hover {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    box-shadow: 0 4px 16px var(--color-accent-glow), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.btn--primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px var(--color-accent-glow);
}

.btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn--ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.btn--ghost:hover {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    border-color: var(--color-border-focus);
    transform: translateY(-1px);
}

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

.btn--danger-ghost {
    background: transparent;
    color: var(--color-red);
    border: 1px solid var(--color-border);
}

.btn--danger-ghost:hover {
    background: var(--color-red-subtle);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn--sm {
    padding: 6px 14px;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-sm);
}

.btn--full {
    width: 100%;
    padding: 13px 20px;
    font-size: var(--font-size-md);
}

.btn--icon-only {
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-secondary);
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.btn--icon-only:hover {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    border-color: var(--color-border-focus);
}

/* ---- Header ---- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
    height: var(--header-height);
    background: var(--color-bg-header);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-base);
}

.header__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header__logo {
    display: flex;
}

.header__title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--color-text-primary);
}

.header__version {
    font-size: var(--font-size-xs);
    font-weight: 500;
    margin-left: 6px;
    padding: 2px 6px;
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    border-radius: var(--radius-full);
    vertical-align: middle;
}

.header__nav {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header__status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot--online {
    background: var(--color-green);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Burger Menu Toggle */
.burger-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-base);
}

.burger-toggle:hover {
    background: var(--color-accent-subtle);
    border-color: var(--color-border-focus);
}

.burger-toggle span {
    display: block;
    height: 2px;
    background: var(--color-text-secondary);
    border-radius: 1px;
    transition: all var(--transition-base);
}

/* ---- Main ---- */
.main {
    position: relative;
    z-index: var(--z-base);
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* ---- Auth Section ---- */
.auth-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height));
    padding: var(--space-8);
}

.auth-container {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 0;
    max-width: 1060px;
    width: 100%;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ---- Left Panel: Auth Form ---- */
.auth-form-panel {
    border-right: 1px solid var(--color-border);
    padding: var(--space-10) 36px;
    display: flex;
    flex-direction: column;
}

.auth-form-panel__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Tabs */
.tab-switcher {
    display: flex;
    position: relative;
    background: var(--color-bg-input);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: var(--space-8);
    border: 1px solid var(--color-border-subtle);
}

.tab-switcher__btn {
    flex: 1;
    padding: 9px 16px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    border-radius: calc(var(--radius-md) - 3px);
    position: relative;
    z-index: 2;
    transition: color var(--transition-base);
}

.tab-switcher__btn:hover {
    color: var(--color-text-secondary);
}

.tab-switcher__btn--active {
    color: var(--color-text-primary);
}

.tab-switcher__indicator {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: var(--color-bg-card);
    border-radius: calc(var(--radius-md) - 3px);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition-slow);
    z-index: 1;
}

.tab-switcher__indicator--right {
    transform: translateX(100%);
}

/* Form */
.auth-form__title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-2);
    color: var(--color-text-primary);
}

.auth-form__subtitle {
    font-size: var(--font-size-base);
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
}

/* Separator */
.auth-separator {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin: var(--space-5) 0;
}

.auth-separator::before,
.auth-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--color-border);
}

.auth-separator span {
    padding: 0 14px;
}

/* Input Groups */
.input-group {
    margin-bottom: var(--space-5);
}

.input-group__label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.input-group__wrapper {
    display: flex;
    align-items: center;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0 14px;
    transition: all var(--transition-base);
}

.input-group__wrapper:focus-within {
    border-color: var(--color-border-focus);
    background: var(--color-bg-input-focus);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.input-group__icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: color var(--transition-base);
    display: flex;
}

.input-group__wrapper:focus-within .input-group__icon {
    color: var(--color-accent);
}

.input-group__input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    padding: 13px 12px;
    outline: none;
}

.input-group__input::placeholder {
    color: var(--color-text-muted);
}

.input-group__toggle {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: color var(--transition-fast);
    border-radius: 4px;
}

.input-group__toggle:hover {
    color: var(--color-text-secondary);
}

/* OTP inputs */
.otp-inputs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.otp-input {
    width: 44px;
    height: 52px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: all var(--transition-base);
    caret-color: var(--color-accent);
}

.otp-input:focus {
    border-color: var(--color-border-focus);
    background: var(--color-bg-input-focus);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.otp-separator {
    color: var(--color-text-muted);
    font-size: 1rem;
    user-select: none;
}

/* Form Footer */
.auth-form__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: auto;
    padding-top: var(--space-6);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* ---- Right Panel: Biometrics ---- */
.biometric-panel {
    padding: var(--space-8);
    display: flex;
    flex-direction: column;
    background: var(--color-bg-secondary);
}

.biometric-panel__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.biometric-panel__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-5);
    color: var(--color-text-primary);
}



.feature-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    transition: transform var(--transition-base), background var(--transition-base), border-color var(--transition-base);
}

[data-theme="dark"] .feature-card {
    background: rgba(15, 23, 42, 0.3);
}

.feature-card:hover {
    transform: translateY(-2px);
    background: var(--color-bg-input);
    border-color: var(--color-border);
}

.feature-card__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.feature-card__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Verification Steps */
.verification-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: var(--space-6);
    margin-top: var(--space-5);
}

.v-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    transition: all var(--transition-base);
}

.v-step--active {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
}

.v-step--active .v-step__icon {
    color: var(--color-accent);
}

.v-step--active .v-step__label {
    color: var(--color-accent);
}

.v-step--done {
    border-color: var(--color-green);
    background: var(--color-green-subtle);
}

.v-step--done .v-step__icon {
    color: var(--color-green);
}

.v-step--done .v-step__label {
    color: var(--color-green);
}

.v-step__icon {
    color: var(--color-text-muted);
    display: flex;
    transition: color var(--transition-base);
}

.v-step__label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-muted);
    transition: color var(--transition-base);
}

.v-step__connector {
    width: 20px;
    height: 2px;
    background: var(--color-border);
    flex-shrink: 0;
}

/* Video/Biometric Container */
.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-container__placeholder {
    text-align: center;
    animation: pulse 2s infinite;
}

.video-container__placeholder svg {
    margin-bottom: var(--space-4);
}

.video-container__placeholder p {
    color: var(--color-accent);
    font-size: var(--font-size-base);
    line-height: 1.5;
}

#webcam-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    display: none;
}

#webcam-video.active {
    display: block;
}

.face-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    pointer-events: none;
}

.snapshot-canvas {
    display: none;
}

/* Video overlay */
.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.video-overlay.hidden {
    display: none;
}

.video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text-muted);
    font-size: var(--font-size-base);
    text-align: center;
    line-height: 1.5;
}

/* Scan frame */
.scan-frame {
    position: absolute;
    inset: 20%;
    z-index: 3;
    display: none;
}

.scan-frame.active {
    display: block;
}

.scan-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--color-accent);
    border-style: solid;
    border-width: 0;
}

.scan-corner--tl {
    top: 0;
    left: 0;
    border-top-width: 3px;
    border-left-width: 3px;
    border-top-left-radius: 8px;
}

.scan-corner--tr {
    top: 0;
    right: 0;
    border-top-width: 3px;
    border-right-width: 3px;
    border-top-right-radius: 8px;
}

.scan-corner--bl {
    bottom: 0;
    left: 0;
    border-bottom-width: 3px;
    border-left-width: 3px;
    border-bottom-left-radius: 8px;
}

.scan-corner--br {
    bottom: 0;
    right: 0;
    border-bottom-width: 3px;
    border-right-width: 3px;
    border-bottom-right-radius: 8px;
}

.scan-frame.active .scan-corner {
    animation: scanPulse 2s ease-in-out infinite;
}

@keyframes scanPulse {

    0%,
    100% {
        border-color: var(--color-accent);
        opacity: 1;
    }

    50% {
        border-color: rgba(14, 165, 233, 0.3);
        opacity: 0.6;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Instruction Block */
.instruction-block {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 14px 18px;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    transition: all var(--transition-base);
}

.instruction-block--success {
    border-color: rgba(16, 185, 129, 0.35);
    background: var(--color-green-subtle);
}

.instruction-block--success .instruction-block__icon {
    color: var(--color-green);
}

.instruction-block--warning {
    border-color: rgba(245, 158, 11, 0.35);
    background: var(--color-yellow-subtle);
}

.instruction-block--warning .instruction-block__icon {
    color: var(--color-yellow);
}

.instruction-block__icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
    display: flex;
    transition: color var(--transition-base);
}

.instruction-block__text {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: 1.4;
}

/* Progress Bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--color-bg-input);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--color-border-subtle);
}

.progress-bar__fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent), #38bdf8);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px var(--color-accent-glow);
}

.progress-bar__label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    min-width: 36px;
    text-align: right;
    font-family: var(--font-mono);
}

/* ---- Device Cards (Dashboard) ---- */
.device-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.device-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.device-card:hover {
    background: var(--color-bg-card-hover);
    border-color: var(--color-border-focus);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.device-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.device-meta {
    display: flex;
    flex-direction: column;
}

.device-name {
    font-weight: 500;
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
}

.device-date {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

/* ---- Success Section ---- */
.success-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height));
    padding: var(--space-8);
}

.success-card {
    max-width: 460px;
    width: 100%;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-12) var(--space-10);
    text-align: center;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow-xl);
    animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-card__icon {
    color: var(--color-green);
    margin-bottom: var(--space-5);
    animation: checkmarkDraw 0.6s ease-out 0.2s both;
}

@keyframes checkmarkDraw {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.success-card__title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--space-1);
    letter-spacing: -0.02em;
}

.success-card__subtitle {
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
}

.success-card__details {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--color-bg-input);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
}

.detail-row span:first-child {
    color: var(--color-text-muted);
}

.badge {
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.badge--success {
    background: var(--color-green-subtle);
    color: var(--color-green);
}

/* Biometric Setup Buttons */
.biometrics-setup-actions {
    margin-bottom: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.biometrics-setup-actions .btn {
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

/* ---- Promo Modal ---- */
.promo-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 480px;
    margin: 40px auto;
    padding: 2.5rem;
    background: var(--color-bg-card);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

.promo-modal__icon {
    background: var(--color-green-subtle);
    color: var(--color-green);
    padding: 1rem;
    border-radius: 50%;
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.promo-modal__title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.02em;
}

.promo-modal__text {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
    line-height: 1.6;
    font-size: var(--font-size-base);
}

.promo-modal__actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.promo-modal__actions .btn--ghost {
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.promo-modal__actions .btn--skip {
    color: var(--color-text-muted);
    border: none;
    margin-top: var(--space-1);
}

/* ---- Dashboard Section ---- */
.dashboard-section {
    padding: var(--space-6);
    padding-top: calc(var(--header-height) + var(--space-6));
    min-height: 100vh;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: var(--space-6);
    align-items: start;
    max-width: 1280px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease-out;
}

/* ---- Dashboard Sidebar ---- */
.dashboard-sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-6));
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.sidebar-label {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-3);
    padding-left: var(--space-4);
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-4);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    cursor: pointer;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background: var(--color-accent-subtle);
    color: var(--color-text-primary);
}

.sidebar-link--active {
    background: var(--color-accent-subtle);
    color: var(--color-accent) !important;
    border-color: var(--color-border-focus);
}

.sidebar-link__icon {
    font-size: 1.1rem;
    line-height: 1;
    width: 22px;
    text-align: center;
}

.sidebar-link__badge {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    display: block;
    margin-top: 1px;
}

.sidebar-divider {
    margin: var(--space-3) 0;
    border-top: 1px solid var(--color-border);
}

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--color-bg-overlay);
    z-index: var(--z-overlay);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ---- Dashboard Content ---- */
.dashboard-content {
    max-width: 100%;
    min-width: 0;
    /* prevent overflow in grid */
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.dashboard-header__title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--font-size-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dashboard-header__actions {
    display: flex;
    gap: var(--space-2);
}

/* Section titles */
.section-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

/* Device section */
.devices-section {
    margin-bottom: var(--space-8);
}

.devices-actions {
    margin-top: var(--space-5);
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.stat-card:hover {
    border-color: var(--color-border-focus);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card__icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.stat-card__icon--blue {
    background: var(--color-blue-subtle);
    color: var(--color-blue);
}

.stat-card__icon--green {
    background: var(--color-green-subtle);
    color: var(--color-green);
}

.stat-card__icon--red {
    background: var(--color-red-subtle);
    color: var(--color-red);
}

.stat-card__icon--yellow {
    background: var(--color-yellow-subtle);
    color: var(--color-yellow);
}

.stat-card__data {
    display: flex;
    flex-direction: column;
}

.stat-card__value {
    font-size: var(--font-size-xl);
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1.2;
}

.stat-card__label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

/* ---- Admin Panel Tabs ---- */
.admin-tabs {
    margin-bottom: var(--space-6);
    max-width: 400px;
}

.admin-tabs .tab-switcher__btn {
    font-size: var(--font-size-base);
}

/* Admin section titles */
.admin-section-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

/* Chart container */
.chart-container {
    background: var(--color-bg-card);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-xs);
}

/* ---- Tables ---- */
.logs-table-wrapper {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-xs);
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

.logs-table thead {
    background: var(--color-bg-table-head);
}

.logs-table th {
    padding: var(--space-3) var(--space-5);
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}

.logs-table td {
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--color-border-subtle);
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
}

.logs-table tr:last-child td {
    border-bottom: none;
}

.logs-table tr {
    transition: background var(--transition-fast);
}

.logs-table tbody tr:hover {
    background: var(--color-bg-card-hover);
}

/* Log badges */
.log-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    font-family: var(--font-main);
}

.log-badge--success {
    background: var(--color-green-subtle);
    color: var(--color-green);
}

.log-badge--fail {
    background: var(--color-red-subtle);
    color: var(--color-red);
}

.log-badge--warning {
    background: var(--color-yellow-subtle);
    color: var(--color-yellow);
}

.log-event {
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
}

/* ---- Empty States ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-6);
    text-align: center;
    color: var(--color-text-muted);
}

.empty-state__icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-input);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    color: var(--color-text-muted);
}

.empty-state__title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.empty-state__text {
    font-size: var(--font-size-base);
    max-width: 280px;
    line-height: 1.5;
}

/* ---- Skeleton Loaders ---- */
.skeleton {
    background: linear-gradient(90deg,
            var(--color-bg-input) 0%,
            var(--color-bg-card-hover) 50%,
            var(--color-bg-input) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-row {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-subtle);
}

.skeleton-row:last-child {
    border-bottom: none;
}

.skeleton-cell {
    height: 14px;
    border-radius: 4px;
}

.skeleton-cell--sm {
    width: 60px;
}

.skeleton-cell--md {
    width: 120px;
}

.skeleton-cell--lg {
    width: 180px;
}

.skeleton-cell--xl {
    width: 50%;
}

.skeleton-card {
    height: 64px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

/* ---- Notifications / Toasts ---- */
.notifications-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-3);
    max-width: 400px;
}

.notification {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid;
    animation: notifSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.notification::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    animation: notifProgress 5s linear forwards;
}

@keyframes notifProgress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

@keyframes notifSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.notification--exiting {
    animation: notifSlideOut 0.3s forwards;
}

@keyframes notifSlideOut {
    to {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
}

.notification--success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.25);
    color: var(--color-green);
}

.notification--success::after {
    background: var(--color-green);
}

.notification--error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--color-red);
}

.notification--error::after {
    background: var(--color-red);
}

.notification--info {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
    color: var(--color-blue);
}

.notification--info::after {
    background: var(--color-blue);
}

.notification--warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.25);
    color: var(--color-yellow);
}

.notification--warning::after {
    background: var(--color-yellow);
}

.notification__icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.notification__body {
    flex: 1;
    min-width: 0;
}

.notification__title {
    font-weight: 600;
    font-size: var(--font-size-base);
    margin-bottom: 2px;
}

.notification__message {
    font-size: var(--font-size-sm);
    opacity: 0.85;
    line-height: 1.4;
}

.notification__close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 2px;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
    flex-shrink: 0;
    display: flex;
}

.notification__close:hover {
    opacity: 1;
}

/* ---- Utilities ---- */
.hidden {
    display: none !important;
}

/* ---- Spinner ---- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner--dark {
    border-color: var(--color-border);
    border-top-color: var(--color-accent);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Face Detection Active ---- */
.video-container--face-detected {
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 20px var(--color-accent-glow);
}

/* ---- Section Transitions ---- */
.section-enter {
    animation: sectionEnter 0.4s ease-out;
}

@keyframes sectionEnter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.camera-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    animation: fadeIn 0.3s ease-out;
}

.camera-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 2px solid var(--color-border);
    background: #000;
    aspect-ratio: 4/3;
}

.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-lg);
    transform: scaleX(-1);
    /* Mirror for selfie */
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    z-index: 2;
    background: var(--color-bg-secondary);
}

.camera-placeholder svg {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.otp-section {
    animation: fadeIn 0.3s ease-out;
}

.otp-section h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.security-info-block__main-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
}

/* ---- Scanner Overlay — биометрический сканер поверх камеры ---- */
.scanner-overlay {
    position: absolute;
    inset: 8%;
    z-index: 5;
    pointer-events: none;
    border-radius: var(--radius-md);
}

/* Угловые маркеры сканера */
.scanner-corners {
    position: absolute;
    inset: 0;
}

.scanner-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    border-color: rgba(14, 165, 233, 0.7);
    border-style: solid;
    border-width: 0;
    transition: border-color 0.3s ease;
}

.scanner-corner--tl {
    top: 0; left: 0;
    border-top-width: 3px;
    border-left-width: 3px;
    border-top-left-radius: 8px;
}

.scanner-corner--tr {
    top: 0; right: 0;
    border-top-width: 3px;
    border-right-width: 3px;
    border-top-right-radius: 8px;
}

.scanner-corner--bl {
    bottom: 0; left: 0;
    border-bottom-width: 3px;
    border-left-width: 3px;
    border-bottom-left-radius: 8px;
}

.scanner-corner--br {
    bottom: 0; right: 0;
    border-bottom-width: 3px;
    border-right-width: 3px;
    border-bottom-right-radius: 8px;
}

/* Сканирующая линия */
.scanner-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(14, 165, 233, 0.3) 15%,
        rgba(14, 165, 233, 0.9) 50%,
        rgba(14, 165, 233, 0.3) 85%,
        transparent 100%
    );
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.5), 0 0 24px rgba(14, 165, 233, 0.2);
    opacity: 0;
    transform: translateY(0);
    transition: opacity 0.3s ease;
}

/* Активное состояние — запуск анимации */
.scanner-overlay--active .scanner-corner {
    border-color: rgba(14, 165, 233, 1);
    filter: drop-shadow(0 0 4px rgba(14, 165, 233, 0.5));
}

.scanner-overlay--active .scanner-line {
    opacity: 1;
    animation: scanLine 1.8s ease-in-out infinite;
}

@keyframes scanLine {
    0%   { top: 0;    opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* ---- Сообщение об ошибке над камерой ---- */
.camera-error-msg {
    padding: 10px 16px;
    margin-top: var(--space-3);
    background: var(--color-red-subtle);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: var(--color-red);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-align: center;
    animation: shakeIn 0.4s ease-out;
}

@keyframes shakeIn {
    0%   { opacity: 0; transform: translateX(-8px); }
    25%  { transform: translateX(6px); }
    50%  { transform: translateX(-4px); }
    75%  { transform: translateX(2px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ---- Плавное скрытие камеры (используется из JS) ---- */
.camera-section--fade-out {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ---- Кнопка в состоянии сканирования ---- */
.btn--scanning {
    position: relative;
    overflow: hidden;
}

.btn--scanning::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%
    );
    animation: btnScanShimmer 1.5s ease-in-out infinite;
}

@keyframes btnScanShimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ---- Liveness Detection Overlay ---- */
.liveness-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 16px;
    pointer-events: none;
    border-radius: var(--radius-lg);
}

.liveness-overlay__status {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    transition: all 0.3s ease;
    text-align: center;
    max-width: 90%;
}

/* Состояния liveness */
.liveness-overlay--waiting .liveness-overlay__status {
    background: rgba(14, 165, 233, 0.7);
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.3);
}

.liveness-overlay--tracking .liveness-overlay__status {
    background: rgba(245, 158, 11, 0.7);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
}

.liveness-overlay--no-face .liveness-overlay__status {
    background: rgba(239, 68, 68, 0.7);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
}

.liveness-overlay--success .liveness-overlay__status {
    background: rgba(16, 185, 129, 0.85);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    font-weight: 600;
}

/* Зелёная обводка камеры при успешном моргании */
.camera-container--liveness-ok {
    border-color: #10b981 !important;
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.4), inset 0 0 12px rgba(16, 185, 129, 0.1);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Пульсация зелёной обводки */
.camera-container--liveness-ok::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: calc(var(--radius-lg) + 3px);
    border: 2px solid rgba(16, 185, 129, 0.5);
    animation: livenessPulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes livenessPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%      { opacity: 0.8; transform: scale(1.01); }
}

/* Жёлтая предупреждающая обводка камеры (фаза «Смотрите в камеру», 800ms задержка) */
.camera-container--preparing {
    border-color: #f59e0b !important;
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.45), inset 0 0 12px rgba(245, 158, 11, 0.12);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.camera-container--preparing::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: calc(var(--radius-lg) + 3px);
    border: 2px solid rgba(245, 158, 11, 0.5);
    animation: preparingPulse 0.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes preparingPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.01); }
}

/* Состояние warning для liveness overlay (жёлтый бейдж) */
.liveness-overlay--warning .liveness-overlay__status {
    background: rgba(245, 158, 11, 0.85);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
    font-weight: 600;
}

/* Визуальный эффект «вспышки» при авто-снимке */
.capture-flash {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.75);
    border-radius: var(--radius-lg);
    pointer-events: none;
    animation: flashFade 100ms ease-out forwards;
}

@keyframes flashFade {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* =========================================
   Responsive & Mobile Optimization 
   ========================================= */

@media (max-width: 1024px) {
    .auth-container, .dashboard-layout {
        grid-template-columns: 1fr;
        max-width: 600px;
        margin: 0 auto;
    }
    
    .dashboard-sidebar {
        display: none; /* Mobile menu should be toggled by JS */
    }

    .auth-form-panel {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
}

@media (max-width: 768px) {
    /* Layout & Container Padding */
    .auth-section, .dashboard-section {
        padding: var(--space-4);
        min-height: auto;
    }
    
    .auth-form-panel {
        padding: var(--space-6) var(--space-4);
    }

    .biometric-panel {
        padding: var(--space-6) var(--space-4);
    }

    /* Touch-Friendly Targets (Apple HIG >= 44px) */
    .btn,
    .input-group__input,
    .otp-input,
    .tab-switcher__btn {
        min-height: 44px;
    }

    /* Stack buttons that might be in a row */
    .promo-modal__actions {
        flex-direction: column;
        width: 100%;
        gap: var(--space-3);
        display: flex;
    }
    
    /* Typography Scaling */
    h1, .auth-form__title, .security-info-block__main-title {
        font-size: var(--font-size-xl);
    }
    
    /* Camera Container & Canvas Scaling */
    .camera-container {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        aspect-ratio: 4/3; /* or padding-bottom hack */
        border-radius: var(--radius-md);
        display: block;
    }

    .camera-container video,
    .camera-container canvas {
        width: 100%;
        height: 100%;
        object-fit: cover !important;
        position: absolute;
        top: 0;
        left: 0;
    }

    /* Toasts / Notifications Mobile Alignment */
    .notifications-container {
        bottom: 20px !important;
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 90% !important;
        max-width: 400px;
        align-items: center;
        flex-direction: column-reverse; 
    }

    .notification {
        width: 100% !important;
    }
    
    /* Stats grid into 2 columns on mobile */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    /* Further adjustment for very small screens */
    body {
        font-size: var(--font-size-sm);
    }

    .header__title {
        font-size: var(--font-size-md);
    }

    .auth-form-panel, .biometric-panel {
        padding: var(--space-5) var(--space-3);
    }

    .otp-inputs {
        gap: var(--space-1);
    }
    
    .otp-input {
        width: 40px;
        height: 48px;
        font-size: 1.1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}