:root {
    --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --bg: #0b1020;
    --bg-2: #0f172a;
    --surface: rgba(15, 23, 42, 0.78);
    --surface-solid: #111827;
    --surface-soft: rgba(30, 41, 59, 0.72);
    --surface-muted: rgba(15, 23, 42, 0.58);

    --card: rgba(15, 23, 42, 0.88);
    --card-2: rgba(17, 24, 39, 0.9);
    --line: rgba(148, 163, 184, 0.18);
    --line-strong: rgba(148, 163, 184, 0.28);

    --text: #f8fafc;
    --text-soft: #cbd5e1;
    --text-muted: #94a3b8;
    --text-faint: #64748b;

    --primary: #3b82f6;
    --primary-rgb: 59, 130, 246;
    --primary-strong: #2563eb;
    --primary-soft: rgba(var(--primary-rgb), 0.16);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #38bdf8;

    --success-soft: rgba(34, 197, 94, 0.16);
    --warning-soft: rgba(245, 158, 11, 0.16);
    --danger-soft: rgba(239, 68, 68, 0.16);
    --info-soft: rgba(56, 189, 248, 0.16);

    --shadow-sm: 0 14px 36px rgba(2, 6, 23, 0.14);
    --shadow-md: 0 22px 60px rgba(2, 6, 23, 0.24);
    --shadow-xl: 0 38px 90px rgba(2, 6, 23, 0.34);

    --radius-xs: 10px;
    --radius-sm: 14px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-xl: 30px;

    --sidebar-width: 300px;
    --topbar-height: 84px;
    --dock-height: 84px;

    --input-height: 52px;
    --input-radius: 16px;
    --control-ring: 0 0 0 4px rgba(var(--primary-rgb), .12);

    --primary-soft-bg: rgba(var(--primary-rgb), .10);
    --primary-soft-line: rgba(var(--primary-rgb), .18);
    --primary-soft-strong: rgba(var(--primary-rgb), .24);
    --primary-glow: rgba(var(--primary-rgb), .22);

    --nav-surface-light: linear-gradient(135deg, rgba(var(--primary-rgb), .20), rgba(255,255,255,.84));
    --nav-surface-dark: linear-gradient(135deg, rgba(var(--primary-rgb), .26), rgba(8,15,35,.90));
    --nav-pill-light: rgba(255,255,255,.72);
    --nav-pill-dark: rgba(var(--primary-rgb), .08);

    --theme-glass-light: linear-gradient(135deg, rgba(var(--primary-rgb), .18), rgba(255,255,255,.86));
    --theme-glass-dark: linear-gradient(135deg, rgba(var(--primary-rgb), .24), rgba(8,15,35,.88));
    --theme-border: rgba(var(--primary-rgb), .28);
    --theme-soft-bg: rgba(var(--primary-rgb), .12);
    --theme-soft-bg-strong: rgba(var(--primary-rgb), .18);
    --theme-shadow: 0 18px 42px rgba(var(--primary-rgb), .18);
}

html[data-appearance="light"] {
    --bg: #eef4ff;
    --bg-2: #f8fbff;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-solid: #ffffff;
    --surface-soft: rgba(255, 255, 255, 0.86);
    --surface-muted: rgba(255, 255, 255, 0.7);

    --card: rgba(255, 255, 255, 0.92);
    --card-2: rgba(255, 255, 255, 0.98);
    --line: rgba(15, 23, 42, 0.08);
    --line-strong: rgba(15, 23, 42, 0.12);

    --text: #0f172a;
    --text-soft: #334155;
    --text-muted: #64748b;
    --text-faint: #94a3b8;

    --shadow-sm: 0 14px 30px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 20px 50px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 30px 70px rgba(15, 23, 42, 0.15);
}

html[data-theme="blue"] {
    --primary: #3b82f6;
    --primary-rgb: 59, 130, 246;
    --primary-strong: #2563eb;
}
html[data-theme="emerald"] {
    --primary: #10b981;
    --primary-rgb: 16, 185, 129;
    --primary-strong: #059669;
}
html[data-theme="violet"] {
    --primary: #8b5cf6;
    --primary-rgb: 139, 92, 246;
    --primary-strong: #7c3aed;
}
html[data-theme="rose"] {
    --primary: #f43f5e;
    --primary-rgb: 244, 63, 94;
    --primary-strong: #e11d48;
}
html[data-theme="amber"] {
    --primary: #f59e0b;
    --primary-rgb: 245, 158, 11;
    --primary-strong: #d97706;
}
html[data-theme="slate"] {
    --primary: #64748b;
    --primary-rgb: 100, 116, 139;
    --primary-strong: #475569;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; color-scheme: dark; }
html[data-appearance="light"] { color-scheme: light; }

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(var(--primary-rgb), 0.18), transparent 24%),
        radial-gradient(circle at top right, rgba(var(--primary-rgb), 0.13), transparent 18%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

body,
p,
span,
small,
label,
input,
select,
textarea,
button,
.table,
.btn {
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6,
.section-title,
.page-meta__title,
.metric-value,
.mini-value,
.brand-title {
    letter-spacing: -0.04em;
}

::selection {
    background: rgba(var(--primary-rgb), .24);
    color: var(--text);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--primary-rgb), .55) transparent;
}
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), .28);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), .42);
    background-clip: padding-box;
}

.app-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.app-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(90px);
    opacity: .5;
}
.app-orb-a {
    width: 360px;
    height: 360px;
    background: rgba(var(--primary-rgb), 0.18);
    left: -80px;
    top: -80px;
}
.app-orb-b {
    width: 300px;
    height: 300px;
    background: rgba(139, 92, 246, 0.12);
    right: -80px;
    top: 6%;
}
.app-orb-c {
    width: 320px;
    height: 320px;
    background: rgba(16, 185, 129, 0.08);
    left: 20%;
    bottom: -120px;
}
.app-grid {
    position: absolute;
    inset: 0;
    opacity: .06;
    background-image:
        linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(180deg, rgba(255,255,255,.65), transparent 92%);
}

.public-shell,
.admin-shell-wrap,
.auth-shell {
    position: relative;
    z-index: 2;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.brand-icon {
    width: 50px;
    height: 50px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: rgba(var(--primary-rgb), .18);
    border: 1px solid rgba(var(--primary-rgb), .28);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.16),
        0 10px 24px rgba(var(--primary-rgb), .10);
}
.brand-icon img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}
.brand-copy {
    min-width: 0;
}
.brand-title {
    font-weight: 800;
    line-height: 1.1;
}
.brand-subtitle {
    font-size: .9rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.public-shell {
    width: min(1240px, calc(100vw - 28px));
    margin: 0 auto;
    padding: 24px 0 42px;
}

.public-topbar {
    position: relative;
    top: auto;
    z-index: 20;
    padding: 18px 0 10px;
    background: transparent !important;
    backdrop-filter: none !important;
}
.public-topbar__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 18px;
    min-height: 72px;
    border-radius: 24px;
    border: 1px solid rgba(var(--primary-rgb), .24) !important;
    background: linear-gradient(
        135deg,
        rgba(var(--primary-rgb), .24),
        rgba(255,255,255,.84)
    ) !important;
    box-shadow:
        0 18px 40px rgba(var(--primary-rgb), .10),
        0 10px 24px rgba(15, 23, 42, .08),
        inset 0 1px 0 rgba(255,255,255,.38) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    transition: border-color .22s ease, background .22s ease, box-shadow .22s ease;
}
html[data-appearance="dark"] .public-topbar__inner {
    background: linear-gradient(
        135deg,
        rgba(var(--primary-rgb), .26),
        rgba(8, 15, 35, .90)
    ) !important;
    box-shadow:
        0 20px 42px rgba(var(--primary-rgb), .16),
        0 14px 28px rgba(0, 0, 0, .34),
        inset 0 1px 0 rgba(255,255,255,.05) !important;
}
.public-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.public-main {
    padding-top: 8px;
}

.public-topbar__inner,
.admin-topbar,
.admin-sidebar,
.page-card,
.surface-card,
.public-card,
.panel-card,
.metric-card,
.auth-card,
.ui-alert,
.capture-stage,
.capture-review-card,
.camera-actions,
.auth-shell,
.sidebar-link,
.ui-mini-btn,
.topbar-pill,
.logout-btn {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.topbar-pill,
.ui-mini-btn,
.logout-btn {
    border: 1px solid var(--primary-soft-line);
    background: var(--nav-pill-light);
    color: var(--text);
    border-radius: 16px;
    min-height: 46px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    font-weight: 600;
    transition: .22s ease;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}
html[data-appearance="dark"] .topbar-pill,
html[data-appearance="dark"] .ui-mini-btn,
html[data-appearance="dark"] .logout-btn {
    background: rgba(var(--primary-rgb), .08);
    border-color: rgba(var(--primary-rgb), .20);
    box-shadow: 0 8px 20px rgba(0,0,0,.18);
}
.topbar-pill:hover,
.ui-mini-btn:hover,
.logout-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--primary-rgb), 0.35);
    box-shadow: var(--shadow-sm);
}
.topbar-pill.is-primary,
.btn-primary,
.logout-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong)) !important;
    color: #fff;
    border-color: transparent;
}
.logout-btn {
    width: 100%;
}

.topbar-theme-wrap {
    display: none !important;
}

[data-toggle-appearance] {
    display: none !important;
}

.public-topbar .topbar-pill[data-open-theme-sheet],
.admin-topbar .topbar-pill[data-open-theme-sheet] {
    border: 1px solid rgba(var(--primary-rgb), .22) !important;
    background: linear-gradient(
        135deg,
        rgba(var(--primary-rgb), .14),
        rgba(255,255,255,.76)
    ) !important;
    box-shadow:
        0 10px 22px rgba(var(--primary-rgb), .08),
        inset 0 1px 0 rgba(255,255,255,.35) !important;
}

html[data-appearance="dark"] .public-topbar .topbar-pill[data-open-theme-sheet],
html[data-appearance="dark"] .admin-topbar .topbar-pill[data-open-theme-sheet] {
    background: linear-gradient(
        135deg,
        rgba(var(--primary-rgb), .16),
        rgba(255,255,255,.04)
    ) !important;
    border-color: rgba(var(--primary-rgb), .20) !important;
    box-shadow:
        0 10px 20px rgba(0,0,0,.18),
        inset 0 1px 0 rgba(255,255,255,.04) !important;
}

.public-topbar .topbar-pill[data-open-theme-sheet]:hover,
.admin-topbar .topbar-pill[data-open-theme-sheet]:hover {
    border-color: rgba(var(--primary-rgb), .30) !important;
    box-shadow:
        0 12px 26px rgba(var(--primary-rgb), .10),
        0 8px 18px rgba(15, 23, 42, .06) !important;
}

.public-topbar .topbar-pill,
.admin-topbar .topbar-pill {
    border: 1px solid rgba(var(--primary-rgb), .22) !important;
    background: rgba(255,255,255,.72) !important;
    box-shadow:
        0 8px 18px rgba(var(--primary-rgb), .06),
        inset 0 1px 0 rgba(255,255,255,.35) !important;
}
html[data-appearance="dark"] .public-topbar .topbar-pill,
html[data-appearance="dark"] .admin-topbar .topbar-pill {
    background: rgba(var(--primary-rgb), .08) !important;
    border-color: rgba(var(--primary-rgb), .20) !important;
    box-shadow:
        0 10px 18px rgba(0,0,0,.18),
        inset 0 1px 0 rgba(255,255,255,.04) !important;
}
.public-topbar .topbar-pill.is-primary,
.admin-topbar .topbar-pill.is-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong)) !important;
    border-color: rgba(var(--primary-rgb), .30) !important;
    box-shadow:
        0 14px 28px rgba(var(--primary-rgb), .28),
        inset 0 1px 0 rgba(255,255,255,.18) !important;
}

.admin-shell-wrap {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar {
    width: var(--sidebar-width);
    position: fixed;
    inset: 0 auto 0 0;
    padding: 22px 18px;
    background: rgba(8, 13, 24, 0.72);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 34;
}
html[data-appearance="light"] .admin-sidebar {
    background: rgba(255, 255, 255, 0.78);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.sidebar-close,
.mobile-menu-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
    display: inline-grid;
    place-items: center;
}
.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sidebar-caption,
.sidebar-panel__label,
.page-meta__eyebrow,
.mini-label,
.section-subtitle,
.metric-label {
    color: var(--text-muted);
}
.sidebar-caption {
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0 8px;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-link {
    min-height: 54px;
    padding: 12px 14px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid transparent;
    color: var(--text-soft);
    transition: .22s ease;
    background: transparent;
}
.sidebar-link:hover {
    background: rgba(255,255,255,.04);
    color: var(--text);
    border-color: var(--line);
}
.sidebar-link.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), .18), rgba(var(--primary-rgb), .08));
    border-color: rgba(var(--primary-rgb), .24);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
html[data-appearance="light"] .sidebar-link.active {
    color: var(--primary-strong);
}
.sidebar-link__icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.06);
    flex: 0 0 34px;
}
.sidebar-link__label {
    flex: 1;
    min-width: 0;
    font-weight: 600;
}
.sidebar-chip {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    font-size: .78rem;
    font-weight: 700;
}
.sidebar-chip.is-danger {
    background: var(--danger-soft);
    color: #fecaca;
}
.sidebar-chip.is-success {
    background: var(--success-soft);
    color: #bbf7d0;
}
html[data-appearance="light"] .sidebar-chip.is-danger { color: #b91c1c; }
html[data-appearance="light"] .sidebar-chip.is-success { color: #166534; }

.sidebar-panel,
.sidebar-panel__label {
    display: none !important;
}

.theme-palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.theme-dot {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,.24);
    box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0);
    transition: .2s ease;
}
.theme-sheet__palette .theme-dot {
    width: 44px;
    height: 44px;
    border-width: 2px;
    cursor: pointer;
}
.theme-dot.active,
.theme-sheet .theme-dot.active {
    transform: scale(1.08);
    box-shadow:
        0 0 0 4px rgba(var(--primary-rgb), .16),
        0 8px 18px rgba(var(--primary-rgb), .16);
}
.theme-dot.is-blue { background: #3b82f6; }
.theme-dot.is-emerald { background: #10b981; }
.theme-dot.is-violet { background: #8b5cf6; }
.theme-dot.is-rose { background: #f43f5e; }
.theme-dot.is-amber { background: #f59e0b; }
.theme-dot.is-slate { background: #64748b; }

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}
.admin-topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 28px 0;
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(180deg, rgba(11,16,32,.88) 0%, rgba(11,16,32,.62) 72%, transparent 100%);
}
html[data-appearance="light"] .admin-topbar {
    background: linear-gradient(180deg, rgba(238,244,255,.92) 0%, rgba(238,244,255,.66) 72%, transparent 100%);
}
.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-meta__eyebrow {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
    margin-bottom: 2px;
}
.page-meta__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
}
.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-soft);
}
.topbar-user__avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    font-weight: 800;
}
.topbar-user__copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar-user__copy strong {
    font-size: .92rem;
    white-space: nowrap;
}
.topbar-user__copy span {
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.admin-content {
    padding: 18px 28px 110px;
}
.page-card,
.surface-card,
.public-card,
.panel-card,
.metric-card,
.auth-card {
    border: 1px solid var(--line);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
}
.page-card,
.surface-card,
.public-card,
.panel-card {
    overflow: hidden;
}
.hero-card,
.public-hero,
.auth-side {
    background:
        radial-gradient(circle at top left, rgba(var(--primary-rgb), .18), transparent 34%),
        linear-gradient(135deg, rgba(15,23,42,.98), rgba(30,41,59,.92));
    border-radius: calc(var(--radius-lg) - 4px);
    color: #fff;
    border: 1px solid rgba(255,255,255,.08);
}
html[data-appearance="light"] .hero-card,
html[data-appearance="light"] .public-hero,
html[data-appearance="light"] .auth-side {
    background:
        radial-gradient(circle at top left, rgba(var(--primary-rgb), .16), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,.98), rgba(241,245,249,.96));
    color: var(--text);
}
.hero-card,
.public-hero {
    padding: 28px;
}
.auth-shell {
    width: min(1120px, calc(100vw - 28px));
    margin: 0 auto;
    min-height: 100vh;
    padding: 24px 0;
}
.auth-main {
    padding: 32px;
}

.section-title,
.display-6,
h1, h2, h3, h4, h5 {
    font-weight: 800;
    line-height: 1.05;
}
.section-title {
    font-size: clamp(1.45rem, 2vw, 2rem);
}
.section-subtitle {
    font-size: .96rem;
    line-height: 1.7;
}
.metric-card {
    padding: 18px;
    height: 100%;
}
.metric-label {
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 6px;
}
.metric-value,
.mini-value {
    font-size: 1.28rem;
    font-weight: 800;
}
.mini-metric {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px 16px;
    background: var(--surface-soft);
}
.mini-label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 6px;
}

.page-card,
.surface-card,
.public-card,
.panel-card,
.metric-card,
.auth-card,
.mini-metric,
.table-responsive,
.ui-alert {
    position: relative;
    isolation: isolate;
}
.page-card::before,
.surface-card::before,
.public-card::before,
.panel-card::before,
.metric-card::before,
.auth-card::before,
.mini-metric::before,
.table-responsive::before,
.ui-alert::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    opacity: .6;
}

.surface-card,
.metric-card,
.mini-metric,
.page-card {
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
}
.surface-card:hover,
.metric-card:hover,
.mini-metric:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--primary-rgb), .18);
}

.btn {
    border-radius: 16px !important;
    min-height: 48px;
    font-weight: 700;
    box-shadow: none !important;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
}
.btn-lg {
    min-height: 54px;
    padding-left: 18px;
    padding-right: 18px;
}
.btn:active,
.topbar-pill:active,
.ui-mini-btn:active,
.logout-btn:active {
    transform: translateY(1px) scale(.995);
}
.btn-primary:hover,
.logout-btn:hover,
.topbar-pill.is-primary:hover {
    filter: brightness(1.03);
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong)) !important;
    border-color: transparent !important;
}
.btn-outline-secondary,
.btn-outline-primary {
    border-color: var(--line-strong) !important;
    color: var(--text) !important;
    background: var(--surface-soft) !important;
}
.btn-outline-secondary:hover,
.btn-outline-primary:hover {
    border-color: rgba(var(--primary-rgb), .34) !important;
    background: rgba(var(--primary-rgb), .08) !important;
}
.btn-soft {
    min-height: 46px;
}

.form-control,
.form-select,
textarea.form-control {
    min-height: var(--input-height);
    border-radius: var(--input-radius);
    border: 1px solid var(--line) !important;
    background: var(--surface-soft) !important;
    color: var(--text) !important;
    box-shadow: none !important;
    padding-left: 16px;
    padding-right: 16px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .2s ease, color .2s ease;
    -webkit-text-fill-color: currentColor;
}

html[data-appearance="dark"] .form-control,
html[data-appearance="dark"] .form-select,
html[data-appearance="dark"] textarea.form-control {
    background: rgba(255,255,255,.055) !important;
    border-color: rgba(255,255,255,.09) !important;
    color: #e7edf7 !important;
}

html[data-appearance="light"] .form-control,
html[data-appearance="light"] .form-select,
html[data-appearance="light"] textarea.form-control {
    background: #eef2ff !important;
    border-color: rgba(15,23,42,.08) !important;
    color: #0f172a !important;
}

.form-control::placeholder,
textarea.form-control::placeholder {
    color: var(--text-faint);
    opacity: 1;
}

html[data-appearance="dark"] .form-control::placeholder,
html[data-appearance="dark"] textarea.form-control::placeholder {
    color: rgba(231,237,247,.38) !important;
}

html[data-appearance="light"] .form-control::placeholder,
html[data-appearance="light"] textarea.form-control::placeholder {
    color: rgba(15,23,42,.38) !important;
}

.form-control:hover,
.form-select:hover,
textarea.form-control:hover {
    border-color: rgba(var(--primary-rgb), .2) !important;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: rgba(var(--primary-rgb), .44) !important;
    box-shadow: var(--control-ring) !important;
    transform: translateY(-1px);
}

html[data-appearance="dark"] .form-control:focus,
html[data-appearance="dark"] .form-select:focus,
html[data-appearance="dark"] textarea.form-control:focus {
    background: rgba(255,255,255,.075) !important;
    color: #f8fafc !important;
}

html[data-appearance="light"] .form-control:focus,
html[data-appearance="light"] .form-select:focus,
html[data-appearance="light"] textarea.form-control:focus {
    background: #ffffff !important;
    color: #0f172a !important;
}
.form-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .92rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 10px;
}

.form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 8px !important;
    border: 1px solid var(--line-strong);
    background-color: var(--surface-soft);
    box-shadow: none !important;
    cursor: pointer;
}
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}
.form-check-input:focus {
    box-shadow: var(--control-ring) !important;
    border-color: rgba(var(--primary-rgb), .45);
}

.invalid-feedback,
.text-danger.small,
.text-danger {
    color: #fca5a5 !important;
}
html[data-appearance="light"] .invalid-feedback,
html[data-appearance="light"] .text-danger.small,
html[data-appearance="light"] .text-danger {
    color: #b91c1c !important;
}

.is-invalid.form-control,
.is-invalid.form-select,
.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
    border-color: rgba(239,68,68,.62) !important;
    background-image: none !important;
}
.is-invalid.form-control:focus,
.is-invalid.form-select:focus,
.was-validated .form-control:invalid:focus,
.was-validated .form-select:invalid:focus {
    box-shadow: 0 0 0 4px rgba(239,68,68,.12) !important;
}

.table {
    color: var(--text);
    margin-bottom: 0;
}
.table > :not(caption) > * > * {
    border-bottom-color: var(--line) !important;
    background: transparent !important;
    padding-top: 14px;
    padding-bottom: 14px;
}
.table thead th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 800;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--card-2) !important;
    backdrop-filter: blur(12px);
}
.table-responsive {
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    overflow: auto;
}
.table tbody tr {
    transition: background .18s ease, transform .18s ease;
}
.table tbody tr:hover td {
    background: rgba(var(--primary-rgb), .04) !important;
}

.badge-soft,
.soft-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: .84rem;
    font-weight: 700;
    border: 1px solid transparent;
}
.soft-badge.soft-info,
.badge-soft.info {
    background: var(--info-soft);
    color: #bae6fd;
}
.soft-badge.soft-success,
.badge-soft.success {
    background: var(--success-soft);
    color: #bbf7d0;
}
.soft-badge.soft-warning,
.badge-soft.warning {
    background: var(--warning-soft);
    color: #fde68a;
}
.soft-badge.soft-danger,
.badge-soft.danger {
    background: var(--danger-soft);
    color: #fecaca;
}
.soft-badge.soft-secondary,
.badge-soft.secondary {
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-soft);
}
html[data-appearance="light"] .soft-badge.soft-info,
html[data-appearance="light"] .badge-soft.info { color: #075985; }
html[data-appearance="light"] .soft-badge.soft-success,
html[data-appearance="light"] .badge-soft.success { color: #166534; }
html[data-appearance="light"] .soft-badge.soft-warning,
html[data-appearance="light"] .badge-soft.warning { color: #92400e; }
html[data-appearance="light"] .soft-badge.soft-danger,
html[data-appearance="light"] .badge-soft.danger { color: #b91c1c; }

.empty-box {
    min-height: 120px;
    display: grid;
    place-items: center;
    line-height: 1.7;
    border: 1px dashed var(--line-strong);
    border-radius: 18px;
    padding: 18px;
    color: var(--text-muted);
    background: rgba(255,255,255,.02);
    text-align: center;
}

.ui-alert {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}
.ui-alert__icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    font-size: 1rem;
}
.ui-alert__title {
    font-weight: 800;
    margin-bottom: 4px;
}
.ui-alert__text {
    color: var(--text-soft);
    line-height: 1.65;
}
.ui-alert__text ul {
    margin-top: 0;
    margin-bottom: 0;
}
.ui-alert--success .ui-alert__icon {
    background: var(--success-soft);
    color: #bbf7d0;
}
.ui-alert--info .ui-alert__icon {
    background: var(--info-soft);
    color: #bae6fd;
}
.ui-alert--danger .ui-alert__icon {
    background: var(--danger-soft);
    color: #fecaca;
}

.capture-shell .capture-stage {
    position: relative;
    min-height: 420px;
    background: #020617;
    border-radius: 26px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.capture-shell video,
.capture-shell canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 420px;
    border-radius: 26px;
}
.capture-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(2,6,23,.16) 0%, rgba(2,6,23,.04) 35%, rgba(2,6,23,.22) 100%);
}
.capture-guides {
    position: absolute;
    inset: 18px;
    border-radius: 24px;
    border: 2px solid rgba(255,255,255,.16);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.capture-statusbar,
.capture-review-card,
.camera-actions {
    display: grid;
    gap: 12px;
}
.camera-actions {
    grid-template-columns: repeat(4, minmax(0,1fr));
}
.capture-review-card img,
.preview-thumb,
.avatar-ref,
.report-detail-photo,
img[data-preview="photo"] {
    cursor: zoom-in;
    border-radius: 18px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.capture-review-card img:hover,
.preview-thumb:hover,
.avatar-ref:hover,
.report-detail-photo:hover,
img[data-preview="photo"]:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--primary-rgb), .28);
}

.photo-modal {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: none;
}
.photo-modal.active {
    display: block;
}
.photo-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.74);
    backdrop-filter: blur(8px);
}
.photo-modal__dialog {
    position: relative;
    z-index: 2;
    width: min(92vw, 920px);
    margin: 4vh auto;
    padding: 18px;
    border-radius: 26px;
    border: 1px solid var(--line);
    background: var(--card-2);
    box-shadow: var(--shadow-xl);
}
.photo-modal__dialog img {
    width: 100%;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 18px;
}
.photo-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    background: rgba(15,23,42,.86);
    color: #fff;
}

.boot-splash,
#appLoader {
    position: fixed;
    inset: 0;
    z-index: 2400;
    display: grid;
    place-items: center;
}
.boot-splash {
    background:
        radial-gradient(circle at top, rgba(var(--primary-rgb), .18), transparent 26%),
        linear-gradient(180deg, rgba(2,6,23,.96), rgba(15,23,42,.98));
    transition: opacity .35s ease, visibility .35s ease;
}
.boot-splash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.boot-splash__card,
.loader-card {
    width: min(92vw, 400px);
    padding: 28px 24px;
    border-radius: 28px;
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.86);
    box-shadow: var(--shadow-xl);
    text-align: center;
}
html[data-appearance="light"] .boot-splash__card,
html[data-appearance="light"] .loader-card {
    background: rgba(255, 255, 255, 0.9);
}
.boot-splash__logoWrap,
.loader-logoWrap {
    width: 84px;
    height: 84px;
    margin: 0 auto 16px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--line);
}
.boot-splash__logo,
.loader-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
}
.boot-splash__title,
.loader-title {
    font-size: 1.2rem;
    font-weight: 800;
}
.boot-splash__subtitle,
.loader-text {
    margin-top: 8px;
    color: var(--text-muted);
}
.boot-line,
.loader-bar {
    height: 6px;
    margin-top: 20px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,.08);
}
.boot-line span,
.loader-bar span {
    display: block;
    width: 38%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--primary-strong));
    animation: uiLoaderSlide 1.35s ease-in-out infinite;
}
#appLoader {
    display: none;
    background: rgba(2, 6, 23, 0.42);
    backdrop-filter: blur(10px);
}
#appLoader.is-visible {
    display: grid;
}
.global-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    z-index: 2600;
    background: linear-gradient(90deg, var(--primary), #fff);
    box-shadow: 0 0 16px rgba(var(--primary-rgb), .55);
    transition: width .22s ease, opacity .22s ease;
    opacity: 0;
}

.mobile-admin-dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    height: 72px;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: rgba(15,23,42,.86);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
    display: flex;
    z-index: 45;
}
.mobile-admin-link {
    flex: 1;
    display: grid;
    place-items: center;
    text-align: center;
    font-size: .72rem;
    color: var(--text-muted);
    gap: 3px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
}
.mobile-admin-link i {
    font-size: 1.1rem;
}
.mobile-admin-link.active {
    color: var(--primary);
    font-weight: 700;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2,6,23,.42);
    backdrop-filter: blur(4px);
    z-index: 33;
    display: none;
}
.sidebar-backdrop.active {
    display: block;
}

.card,
.modal-content,
.dropdown-menu {
    background: var(--card-2);
    border-color: var(--line);
    color: var(--text);
}
.modal-content {
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
}
.modal-header,
.modal-footer {
    border-color: var(--line) !important;
}
.dropdown-menu {
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    padding: 8px;
}
.dropdown-item {
    border-radius: 12px;
    min-height: 40px;
    display: flex;
    align-items: center;
}
.dropdown-item:hover {
    background: rgba(var(--primary-rgb), .08);
}
.text-secondary,
.text-muted {
    color: var(--text-muted) !important;
}
.border-bottom,
.border-top,
.border-start,
.border-end {
    border-color: var(--line) !important;
}
.bg-light-subtle {
    background: rgba(255,255,255,.04) !important;
}
html[data-appearance="light"] .bg-light-subtle {
    background: rgba(15,23,42,.03) !important;
}

.progress,
.hero-progress {
    background: rgba(148, 163, 184, 0.12) !important;
    border-radius: 999px !important;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.08);
}
.progress-bar,
.hero-progress .progress-bar {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong)) !important;
    border-radius: 999px !important;
    box-shadow: 0 0 24px rgba(var(--primary-rgb), .28);
}
html[data-appearance="light"] .progress,
html[data-appearance="light"] .hero-progress {
    background: rgba(15, 23, 42, 0.08) !important;
}

.panel-credit {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: .86rem;
    line-height: 1.7;
}
.panel-credit strong {
    color: var(--text);
    font-weight: 800;
}

.status-tabs,
.student-panel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.student-panel-tabs {
    margin-bottom: 22px;
}
.status-tab,
.student-panel-tab {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    transition: .2s ease;
    cursor: pointer;
}
.student-panel-tab {
    min-height: 46px;
    padding: 0 16px;
    gap: 10px;
}
.status-tab:hover,
.student-panel-tab:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--primary-rgb), .24);
    box-shadow: var(--shadow-sm);
}
.status-tab.active,
.student-panel-tab.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), .22), rgba(var(--primary-rgb), .08));
    border-color: rgba(var(--primary-rgb), .28);
    color: #fff;
}
html[data-appearance="light"] .status-tab.active,
html[data-appearance="light"] .student-panel-tab.active {
    color: var(--primary-strong);
}

.student-panel {
    display: none;
}
.student-panel.active {
    display: block;
}

.bulk-student-box,
.student-candidate-box {
    max-height: 300px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-soft);
    padding: 12px;
}
.bulk-student-box {
    max-height: 280px;
}
.bulk-student-item,
.student-candidate-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    transition: .18s ease;
}
.student-candidate-item {
    gap: 12px;
}
.bulk-student-item:hover,
.student-candidate-item:hover {
    background: rgba(var(--primary-rgb), .06);
}
.bulk-student-item + .bulk-student-item,
.student-candidate-item + .student-candidate-item {
    border-top: 1px solid var(--line);
}
.bulk-student-copy,
.student-candidate-copy {
    min-width: 0;
    flex: 1;
}
.bulk-student-copy strong,
.student-candidate-copy strong {
    display: block;
    color: var(--text);
}
.bulk-student-copy span,
.student-candidate-copy span {
    display: block;
    color: var(--text-muted);
    font-size: .9rem;
}
.student-candidate-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.student-candidate-empty {
    padding: 18px;
    border-radius: 16px;
    border: 1px dashed var(--line-strong);
    color: var(--text-muted);
    text-align: center;
}
.student-summary-gate {
    border: 1px dashed var(--line-strong);
    border-radius: 22px;
    padding: 22px;
    background: rgba(255,255,255,.02);
    color: var(--text-muted);
}
.summary-scroll {
    max-height: 720px;
    overflow: auto;
}

.landing-credit {
    border: 1px solid var(--line);
    background: var(--surface-soft);
    border-radius: 24px;
    padding: 22px;
}
.landing-credit strong {
    color: var(--text);
}
.landing-brand-strip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(var(--primary-rgb), .10);
    border: 1px solid rgba(var(--primary-rgb), .18);
    color: var(--text);
    font-weight: 700;
}

/* =========================
   THEME SHEET FINAL
   desktop popover + mobile bottom sheet
   ========================= */

.theme-sheet {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: none;
}

.theme-sheet.is-open {
    display: block;
}

.theme-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .16);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition: opacity .24s ease;
}

html[data-appearance="dark"] .theme-sheet__backdrop {
    background: rgba(2, 6, 23, .24);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.theme-sheet__panel {
    position: absolute;
    background:
        linear-gradient(180deg, rgba(var(--primary-rgb), .10), var(--card)) !important;
    border: 1px solid rgba(var(--primary-rgb), .16) !important;
    box-shadow:
        0 18px 46px rgba(15, 23, 42, .18),
        0 0 0 1px rgba(255,255,255,.04);
    transition: transform .24s ease, opacity .24s ease;
    opacity: 0;
    overflow: hidden;
}

html[data-appearance="dark"] .theme-sheet__panel {
    background:
        linear-gradient(180deg, rgba(var(--primary-rgb), .14), rgba(7, 13, 28, .98)) !important;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, .34),
        0 0 0 1px rgba(255,255,255,.03);
}

/* MOBILE */
@media (max-width: 767.98px) {
    .theme-sheet__panel {
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 28px 28px 0 0;
        padding: 12px 16px calc(22px + env(safe-area-inset-bottom));
        transform: translateY(110%);
    }

    .theme-sheet.is-open .theme-sheet__panel {
        transform: translateY(0);
        opacity: 1;
    }

    .theme-sheet__handle {
        width: 54px;
        height: 6px;
        border-radius: 999px;
        background: var(--line-strong);
        margin: 0 auto 14px;
    }
}

/* DESKTOP */
@media (min-width: 768px) {
    .theme-sheet__panel {
        top: 88px;
        right: 28px;
        left: auto;
        bottom: auto;
        width: 360px;
        max-width: calc(100vw - 48px);
        border-radius: 24px;
        padding: 16px;
        transform: translateY(-8px) scale(.985);
    }

    .theme-sheet.is-open .theme-sheet__panel {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    .theme-sheet__handle {
        display: none;
    }
}

.theme-sheet__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.theme-sheet__header h3 {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.theme-sheet__header p {
    margin: 4px 0 0;
    color: var(--text-muted);
    line-height: 1.55;
    font-size: .88rem;
}

.theme-sheet__close {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    border: 1px solid rgba(var(--primary-rgb), .12) !important;
    background: var(--surface-soft);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .2s ease;
    flex: 0 0 38px;
}

.theme-sheet__close:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--primary-rgb), .22) !important;
    box-shadow: var(--shadow-sm);
}

.theme-sheet__body {
    display: grid;
    gap: 16px;
}

.theme-sheet__group {
    display: grid;
    gap: 10px;
}

.theme-sheet__label {
    font-size: .9rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
}

.theme-sheet__palette {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-sheet__palette .theme-dot {
    width: 40px;
    height: 40px;
    border-width: 2px;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.18),
        0 6px 16px rgba(15, 23, 42, .08);
}

.theme-sheet .theme-dot.active {
    transform: scale(1.06);
    box-shadow:
        0 0 0 4px rgba(var(--primary-rgb), .14),
        0 8px 18px rgba(var(--primary-rgb), .16);
}

.theme-sheet__mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.theme-mode-card {
    min-height: 76px;
    border-radius: 18px;
    border: 1px solid rgba(var(--primary-rgb), .12) !important;
    background: var(--surface-soft);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 800;
    transition: .2s ease;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.theme-mode-card i {
    font-size: 1.15rem;
    line-height: 1;
}

.theme-mode-card span {
    font-size: .96rem;
    font-weight: 800;
    line-height: 1;
}

.theme-mode-card:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--primary-rgb), .22) !important;
    box-shadow: var(--shadow-sm);
}

.theme-mode-card.is-active {
    border-color: rgba(var(--primary-rgb), .28) !important;
    background: rgba(var(--primary-rgb), .10);
    box-shadow:
        0 0 0 4px rgba(var(--primary-rgb), .07),
        0 10px 20px rgba(var(--primary-rgb), .10);
}

.public-mobile-nav {
    display: none;
}

html,
body,
.admin-main,
.admin-content,
.public-main,
.page-card,
.surface-card,
.panel-card,
.metric-card,
.mini-metric,
.table,
.table td,
.table th,
.table thead th,
.table tbody td,
.table tbody th,
.form-label,
.form-text,
.small,
.text-dark,
.text-black,
.text-body,
.text-body-secondary,
.card,
.card-body,
.modal-content,
.dropdown-menu,
.dropdown-item,
.list-group-item,
.nav-link,
.tab-content,
.tab-pane {
    color: var(--text) !important;
}

html[data-appearance="dark"] input,
html[data-appearance="dark"] select,
html[data-appearance="dark"] textarea,
html[data-appearance="dark"] option,
html[data-appearance="dark"] .form-control,
html[data-appearance="dark"] .form-select,
html[data-appearance="dark"] .form-control:focus,
html[data-appearance="dark"] .form-select:focus {
    color: var(--text) !important;
    -webkit-text-fill-color: var(--text) !important;
}
html[data-appearance="dark"] option {
    background: #172033 !important;
    color: #f8fafc !important;
}
html[data-appearance="dark"] input::placeholder,
html[data-appearance="dark"] textarea::placeholder {
    color: var(--text-faint) !important;
    opacity: 1;
}
html[data-appearance="dark"] .table tbody tr td,
html[data-appearance="dark"] .table tbody tr th,
html[data-appearance="dark"] .fw-semibold,
html[data-appearance="dark"] .fw-bold,
html[data-appearance="dark"] strong,
html[data-appearance="dark"] b {
    color: var(--text) !important;
}
html[data-appearance="dark"] .section-subtitle,
html[data-appearance="dark"] .mini-label,
html[data-appearance="dark"] .metric-label,
html[data-appearance="dark"] .text-secondary,
html[data-appearance="dark"] .text-muted,
html[data-appearance="dark"] .small,
html[data-appearance="dark"] .form-text {
    color: var(--text-muted) !important;
}
html[data-appearance="dark"] .table tbody tr:hover td {
    color: var(--text) !important;
}
html[data-appearance="dark"] input[type="file"] {
    color: var(--text) !important;
}
html[data-appearance="dark"] input[type="file"]::file-selector-button {
    background: rgba(255,255,255,.08);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    margin-right: 12px;
}
html[data-appearance="dark"] .pagination .page-link,
html[data-appearance="dark"] .topbar-pill,
html[data-appearance="dark"] .btn-outline-secondary,
html[data-appearance="dark"] .btn-outline-primary {
    color: var(--text) !important;
}
html[data-appearance="dark"] .table td a,
html[data-appearance="dark"] .table th a,
html[data-appearance="dark"] .surface-card a,
html[data-appearance="dark"] .page-card a {
    color: inherit;
}

@keyframes uiLoaderSlide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(330%); }
}

@media (max-width: 1199.98px) {
    .camera-actions {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .admin-sidebar.is-open {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
    .admin-topbar {
        padding: 18px 16px 0;
    }
    .admin-content {
        padding: 16px 16px calc(118px + env(safe-area-inset-bottom));
    }
    .public-shell,
    .auth-shell {
        width: min(100vw - 16px, 100%);
    }
    .public-topbar__inner {
        padding: 12px 14px;
    }
    body.admin-shell {
        padding-bottom: calc(var(--dock-height) + env(safe-area-inset-bottom) + 18px);
    }
    .page-card,
    .surface-card,
    .panel-card,
    .metric-card,
    .mini-metric {
        border-radius: 22px;
    }
}

@media (max-width: 768px) {
    header,
    .topbar,
    .app-header {
        position: static !important;
    }

    .app-header {
        display: none;
    }

    .public-topbar {
        display: none !important;
    }

    .public-main {
        padding-bottom: calc(108px + env(safe-area-inset-bottom));
    }

    .public-mobile-nav {
        position: fixed;
        left: 14px;
        right: 14px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        z-index: 1300;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: end;
        gap: 12px;
        pointer-events: none;
    }

    .public-mobile-nav__side,
    .public-mobile-nav__center {
        pointer-events: auto;
    }

    .public-mobile-nav__side {
        min-height: 66px;
        border-radius: 24px;
        border: 1px solid rgba(var(--primary-rgb), .24) !important;
        background: linear-gradient(135deg, rgba(var(--primary-rgb), .16), rgba(255,255,255,.84)) !important;
        backdrop-filter: blur(24px) saturate(1.15);
        -webkit-backdrop-filter: blur(24px) saturate(1.15);
        box-shadow:
            0 12px 34px rgba(15, 23, 42, 0.14),
            inset 0 1px 0 rgba(255,255,255,.35);
        padding: 8px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    html[data-appearance="dark"] .public-mobile-nav__side {
        background: linear-gradient(135deg, rgba(var(--primary-rgb), .24), rgba(10,16,32,.86)) !important;
        border-color: rgba(var(--primary-rgb), .18);
        box-shadow:
            0 14px 36px rgba(0, 0, 0, 0.34),
            inset 0 1px 0 rgba(255,255,255,.05);
    }

    .public-mobile-nav__center {
        display: flex;
        justify-content: center;
        align-items: center;
        padding-bottom: 8px;
    }

    .public-mobile-link {
        width: 100%;
        min-height: 50px;
        border-radius: 18px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        text-decoration: none;
        color: var(--text);
        border: 1px solid transparent;
        transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
    }

    .public-mobile-link:hover,
    .public-mobile-link:active,
    .public-mobile-link.is-active,
    .public-mobile-theme-btn:hover,
    .public-mobile-theme-btn:active {
        background: rgba(var(--primary-rgb), .14) !important;
        border-color: rgba(var(--primary-rgb), .18) !important;
        color: var(--text);
        transform: translateY(-1px);
    }

    .public-mobile-link i {
        font-size: 1.05rem;
        line-height: 1;
    }

    .public-mobile-link span {
        font-size: .73rem;
        font-weight: 800;
        line-height: 1;
        letter-spacing: -0.01em;
    }

    .public-mobile-fab {
        width: 74px;
        height: 74px;
        border-radius: 999px;
        border: 1px solid rgba(var(--primary-rgb), .18);
        background: linear-gradient(180deg, var(--primary), var(--primary-strong));
        color: #fff;
        box-shadow:
            0 20px 38px rgba(var(--primary-rgb), .38),
            0 8px 16px rgba(var(--primary-rgb), .22),
            inset 0 1px 0 rgba(255,255,255,.18) !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        text-decoration: none;
        transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
        position: relative;
    }

    .public-mobile-fab::after {
        content: "";
        position: absolute;
        inset: -6px;
        border-radius: inherit;
        background: radial-gradient(circle, rgba(var(--primary-rgb), .20), transparent 70%);
        z-index: -1;
        pointer-events: none;
    }

    .public-mobile-fab:hover,
    .public-mobile-fab:active {
        color: #fff;
        transform: translateY(-2px) scale(1.03);
        filter: brightness(1.02);
        box-shadow:
            0 20px 36px rgba(var(--primary-rgb), .38),
            0 8px 14px rgba(var(--primary-rgb), .22),
            inset 0 1px 0 rgba(255,255,255,.18);
    }

    .public-mobile-fab i {
        font-size: 1.18rem;
        line-height: 1;
    }

    .public-mobile-fab span {
        font-size: .75rem;
        font-weight: 800;
        line-height: 1;
        letter-spacing: -0.01em;
    }

    .public-mobile-theme-btn {
        width: 100%;
        min-height: 50px;
        border-radius: 18px;
        border: 0;
        background: transparent;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        cursor: pointer;
        color: var(--text);
        transition: transform .2s ease, background .2s ease, border-color .2s ease;
    }

    .public-mobile-theme-btn i {
        font-size: 1.05rem;
        line-height: 1;
    }

    .public-mobile-theme-btn span {
        font-size: .73rem;
        font-weight: 800;
        line-height: 1;
        letter-spacing: -0.01em;
    }
}

@media (max-width: 767.98px) {
    .theme-sheet {
        display: none;
    }

    .theme-sheet.is-open {
        display: block;
    }

    .btn,
    .topbar-pill,
    .ui-mini-btn,
    .logout-btn {
        min-height: 48px;
    }

    .metric-value {
        font-size: 1.2rem;
    }

    .mini-value {
        font-size: 1rem;
    }

    .table > :not(caption) > * > * {
        white-space: nowrap;
    }

    .table-responsive {
        border-radius: 20px;
    }

    .photo-modal__dialog {
        width: min(96vw, 920px);
        margin: 2vh auto;
        padding: 12px;
        border-radius: 22px;
    }

    .student-panel-tabs {
        gap: 8px;
    }

    .student-panel-tab {
        width: 100%;
        justify-content: center;
    }

    .student-candidate-box,
    .bulk-student-box {
        max-height: 220px;
    }

    .school-landing > *:last-child {
        margin-bottom: 10px;
    }
}

@media (max-width: 575.98px) {
    .public-actions > * {
        flex: 1 1 100%;
    }

    .brand-lockup {
        gap: 10px;
    }

    .brand-icon {
        width: 44px;
        height: 44px;
        border-radius: 15px;
    }

    .brand-icon img {
        width: 28px;
        height: 28px;
    }

    .metric-card,
    .mini-metric,
    .surface-card,
    .page-card,
    .public-hero {
        border-radius: 20px !important;
    }

    .admin-topbar {
        min-height: 76px;
    }

    .page-meta__title {
        line-height: 1.15;
    }

    .public-topbar__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .public-actions {
        justify-content: stretch;
    }

    .mobile-admin-dock {
        left: 8px;
        right: 8px;
    }
}

/* =========================
   FINAL OVERRIDES — layout app + public dock + theme trigger
   ========================= */
body {
    padding-bottom: 0;
}

.brand-lockup img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 14px;
}

.theme-trigger__swatch {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex: 0 0 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    box-shadow:
        0 0 0 4px rgba(var(--primary-rgb), .14),
        0 6px 14px rgba(var(--primary-rgb), .30);
}

.topbar-pill[data-install-app] {
    display: none;
}

.topbar-pill,
.logout-btn {
    white-space: nowrap;
}

.topbar-user {
    min-height: 50px;
}

.page-meta {
    min-width: 0;
}

.page-meta__title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-content > *:last-child,
.public-main > *:last-child {
    margin-bottom: 0;
}

.mobile-public-dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    height: 76px;
    padding: 8px 10px;
    border-radius: 26px;
    border: 1px solid rgba(255,255,255,.08);
    background: linear-gradient(180deg, rgba(23, 56, 124, .94), rgba(9, 23, 58, .96));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 18px 40px rgba(2, 6, 23, .32),
        inset 0 1px 0 rgba(255,255,255,.08);
    display: none;
    align-items: stretch;
    justify-content: space-between;
    gap: 8px;
    z-index: 45;
}
.mobile-public-link {
    position: relative;
    flex: 1;
    min-width: 0;
    border: 0;
    border-radius: 20px;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: .76rem;
    line-height: 1.05;
    font-weight: 700;
    color: rgba(255,255,255,.78);
    gap: 6px;
    transition: transform .22s ease, color .22s ease, background .22s ease, box-shadow .22s ease;
}
.mobile-public-link i {
    font-size: 1.06rem;
}
.mobile-public-link span {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mobile-public-link:hover {
    color: #fff;
    transform: translateY(-1px);
}
.mobile-public-link.active {
    color: #fff;
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.mobile-public-link:nth-child(2) {
    margin-top: -22px;
    align-self: center;
    width: 74px;
    max-width: 74px;
    min-height: 74px;
    border-radius: 999px;
    background: linear-gradient(180deg, #59a0ff, #2f6fff);
    color: #fff;
    box-shadow:
        0 18px 34px rgba(47,111,255,.42),
        inset 0 2px 8px rgba(255,255,255,.24);
}
.mobile-public-link:nth-child(2) i {
    font-size: 1.18rem;
}
.mobile-public-link:nth-child(2) span {
    font-size: .78rem;
}
.mobile-public-link:nth-child(2):hover,
.mobile-public-link:nth-child(2).active {
    color: #fff;
    background: linear-gradient(180deg, #6aabff, #2f6fff);
    transform: translateY(-2px);
}
.mobile-public-link:not(:nth-child(2)).active {
    color: #fff;
}
.mobile-safe-bottom {
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
}

.install-sheet {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    padding: 14px 16px;
    border-radius: 22px;
    border: 1px solid rgba(var(--primary-rgb), .18);
    background: linear-gradient(135deg, rgba(var(--primary-rgb), .24), rgba(15,23,42,.94));
    color: #fff;
    box-shadow: var(--shadow-xl);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 1200;
}
.install-sheet.is-visible {
    display: flex;
}
html[data-appearance="light"] .install-sheet {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), .14), rgba(255,255,255,.96));
    color: var(--text);
}
html[data-appearance="light"] .install-sheet .text-white-50 {
    color: var(--text-muted) !important;
}

@media (max-width: 991.98px) {
    .admin-main {
        margin-left: 0;
    }

    .admin-sidebar {
        transform: translateX(-108%);
        transition: transform .24s ease;
        width: min(88vw, 320px);
        max-width: 320px;
    }

    .admin-sidebar.is-open {
        transform: translateX(0);
    }

    .admin-topbar {
        padding: 16px 14px 0;
    }

    .admin-content {
        padding: 16px 14px 104px;
    }
}

@media (max-width: 767.98px) {
    .public-shell {
        width: min(100vw - 20px, 1240px);
        padding: 18px 0 104px;
    }

    .public-topbar {
        padding: 12px 0 8px;
    }

    .public-topbar__inner {
        padding: 0 14px;
        min-height: 68px;
        border-radius: 22px;
    }

    .brand-lockup {
        gap: 12px;
    }

    .brand-title {
        font-size: .98rem;
    }

    .brand-subtitle {
        font-size: .78rem;
    }

    .mobile-public-dock {
        display: flex;
    }

    .install-sheet {
        bottom: calc(94px + env(safe-area-inset-bottom));
    }

    .theme-sheet__panel {
        max-height: min(82vh, 560px);
        overflow-y: auto;
    }
}

@media (min-width: 768px) {
    .theme-sheet__backdrop {
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    html[data-appearance="dark"] .theme-sheet__backdrop {
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}
