/* ═══════════════════════════════════════════════════════════
   NSTP-IMS · NEMSU Institutional Design System
   Blue & Gold · Floating glass · Bento layout
   ═══════════════════════════════════════════════════════════ */

:root {
    --primary: #163a7a;
    --primary-light: #2b55a8;
    --primary-dark: #0a1f4d;
    --accent: #c9a227;
    --accent-light: #e4c04a;
    --accent-dark: #9a7b15;
    --rotc: #4a5d23;
    --rotc-light: #6b7f3a;
    --cwts: #1e6bb8;
    --cwts-light: #3d8fd4;
    --lts: #0f2d5c;
    --lts-light: #1a4080;
    --success: #1a7a52;
    --warning: #c9a227;
    --danger: #c42b2b;
    --info: #2563b8;
    --chart-1: #2b55a8;      /* single-series chart mark, validated on --bg-elevated */

    --bg: #d4dae4;
    --bg-elevated: #eef1f6;
    --bg-glass: rgba(238, 241, 246, 0.82);
    --bg-glass-strong: rgba(238, 241, 246, 0.94);
    --bg-gradient: linear-gradient(165deg, #f8f9fc 0%, #eef2f7 48%, #e4eaf2 100%);
    --bg-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
    --text: #0f1a33;
    --text-muted: #5c6b88;
    --text-soft: #8b97ad;
    --border: rgba(22, 58, 122, 0.1);
    --border-strong: rgba(22, 58, 122, 0.18);

    --shadow-xs: 0 1px 2px rgba(10, 31, 77, 0.04);
    --shadow-sm: 0 2px 8px rgba(10, 31, 77, 0.06), 0 1px 2px rgba(10, 31, 77, 0.04);
    --shadow-md: 0 8px 24px rgba(10, 31, 77, 0.08), 0 2px 6px rgba(10, 31, 77, 0.04);
    --shadow-lg: 0 20px 48px rgba(10, 31, 77, 0.12), 0 8px 16px rgba(10, 31, 77, 0.06);
    --shadow-glow: 0 0 0 1px rgba(201, 162, 39, 0.2), 0 8px 32px rgba(201, 162, 39, 0.12);

    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;

    --sidebar-width: 272px;
    --topbar-height: 68px;
    --content-max: 1280px;

    --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;
    --space-16: 64px;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition: 0.35s var(--ease-out);
    --font: 'DM Sans', system-ui, sans-serif;
    --font-display: 'Outfit', var(--font);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }
.theme-toggle .theme-icon { width: 18px; height: 18px; }
[data-theme="light"] .theme-icon-moon,
[data-theme="dark"] .theme-icon-sun { display: none; }

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

/* Prevent inline SVGs from blowing up when a scoped rule fails to load */
svg { display: block; flex-shrink: 0; overflow: hidden; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--bg);
    background-image: var(--bg-grain), var(--bg-gradient);
    background-size: 180px 180px, 100% 100%;
    background-attachment: fixed, fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ── Background mesh ── */
.bg-mesh {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.bg-orb {
    position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.22;
    will-change: transform;
}
.bg-orb-1 {
    width: 520px; height: 520px; top: -120px; right: -80px;
    background: radial-gradient(circle, rgba(43, 85, 168, 0.18) 0%, transparent 70%);
}
.bg-orb-2 {
    width: 400px; height: 400px; bottom: 10%; left: -100px;
    background: radial-gradient(circle, rgba(201, 162, 39, 0.1) 0%, transparent 70%);
}
.bg-orb-3 {
    width: 300px; height: 300px; top: 40%; right: 20%;
    background: radial-gradient(circle, rgba(22, 58, 122, 0.08) 0%, transparent 70%);
}

/* ── Accessibility ── */
.skip-link {
    position: absolute; top: -100%; left: var(--space-4); z-index: 9999;
    padding: var(--space-3) var(--space-5); background: var(--primary); color: #fff;
    border-radius: var(--radius-sm); text-decoration: none; font-weight: 600;
    transition: top var(--transition);
}
.skip-link:focus { top: var(--space-4); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-24px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes scanLine { 0% { top: 8%; } 100% { top: 92%; } }
@keyframes fingerprintPulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.08); opacity: 1; }
}
@keyframes barGrow {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.reveal {
    opacity: 1;
    transform: none;
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
html.js .reveal:not(.is-visible) {
    opacity: 0;
    transform: translateY(24px);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

.reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}
html.js .reveal-stagger:not(.is-visible) > * {
    opacity: 0;
    transform: translateY(20px);
}
.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0.04s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 0.08s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 0.12s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 0.16s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 0.20s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 0.24s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(7) { transition-delay: 0.28s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(8) { transition-delay: 0.32s; opacity: 1; transform: none; }

.animate-fade-in { animation: fadeIn 0.5s var(--ease-out) forwards; }
.animate-fade-in-up { animation: fadeUp 0.65s var(--ease-out) forwards; }
.animate-scale-in { animation: scaleIn 0.55s var(--ease-out) forwards; }

.stagger-1 { animation: fadeUp 0.6s var(--ease-out) 0.05s forwards; opacity: 0; }
.stagger-2 { animation: fadeUp 0.6s var(--ease-out) 0.1s forwards; opacity: 0; }
.stagger-3 { animation: fadeUp 0.6s var(--ease-out) 0.15s forwards; opacity: 0; }
.stagger-4 { animation: fadeUp 0.6s var(--ease-out) 0.2s forwards; opacity: 0; }
.stagger-5 { animation: fadeUp 0.6s var(--ease-out) 0.25s forwards; opacity: 0; }
.stagger-6 { animation: fadeUp 0.6s var(--ease-out) 0.3s forwards; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important; transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal, .reveal-stagger > *, .page-enter { opacity: 1; transform: none; }
}

/* ═══ APP SHELL ═══ */
.app-shell {
    display: flex; min-height: 100vh; position: relative; z-index: 1;
    padding: var(--space-4);
    gap: var(--space-4);
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width); flex-shrink: 0;
    position: fixed; top: var(--space-4); left: var(--space-4); bottom: var(--space-4);
    z-index: 1000; transition: transform var(--transition);
}
.sidebar-inner {
    height: 100%; display: flex; flex-direction: column;
    background: linear-gradient(165deg, var(--primary-dark) 0%, var(--primary) 55%, #1a3270 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.08);
    overflow: hidden; position: relative;
}
.sidebar-inner::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-light), var(--accent), transparent);
}
.sidebar-inner::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M0 0h20v20H0zM20 20h20v20H20z'/%3E%3C/g%3E%3C/svg%3E");
}

.sidebar-brand {
    padding: var(--space-6) var(--space-5) var(--space-4);
    display: flex; align-items: flex-start; justify-content: space-between;
    position: relative; z-index: 1;
}
.logo { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: #fff; }
.logo-img {
    width: 52px; height: 52px; object-fit: contain;
    background: transparent; padding: 0; border: none; border-radius: 0;
    box-shadow: none;
    transition: transform 0.4s var(--ease-spring);
}
.logo:hover .logo-img { transform: scale(1.04); }
.logo-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; display: block; letter-spacing: -0.02em; }
.logo-subtitle { font-size: 0.68rem; color: var(--accent-light); opacity: 0.9; display: block; margin-top: 2px; letter-spacing: 0.04em; text-transform: uppercase; }

.sidebar-close { display: none; background: rgba(255,255,255,0.1); border: none; color: #fff; cursor: pointer; padding: var(--space-2); border-radius: var(--radius-xs); }
.sidebar-close svg { width: 20px; height: 20px; }

.sidebar-nav {
    flex: 1; padding: var(--space-2) var(--space-3); overflow-y: auto;
    overflow-x: hidden; position: relative; z-index: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.nav-section-label {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
    color: rgba(255,255,255,0.35); padding: var(--space-3) var(--space-3) var(--space-1); margin: 0;
}
.nav-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: rgba(255,255,255,0.72); text-decoration: none;
    border-radius: var(--radius-sm); margin-bottom: 2px;
    font-weight: 500; font-size: 0.875rem;
    transition: all 0.25s var(--ease-out); position: relative;
}
.nav-icon {
    width: 34px; height: 34px; min-width: 34px; max-width: 34px;
    min-height: 34px; max-height: 34px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-xs); background: rgba(255,255,255,0.06);
    transition: all 0.25s var(--ease-out); overflow: hidden;
}
.nav-icon svg { width: 18px !important; height: 18px !important; max-width: 18px; max-height: 18px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-item:hover .nav-icon { background: rgba(255,255,255,0.12); }
.nav-item.active {
    color: #fff; background: rgba(255,255,255,0.12);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}
.nav-item.active .nav-icon {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--primary-dark); box-shadow: 0 2px 8px rgba(201,162,39,0.35);
}
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 60%; background: var(--accent); border-radius: 0 3px 3px 0;
}

.sidebar-user {
    padding: var(--space-4); border-top: 1px solid rgba(255,255,255,0.08);
    position: relative; z-index: 1;
}
.user-chip { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); margin-bottom: var(--space-2); }
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-light), var(--accent-dark));
    color: var(--primary-dark); font-weight: 700; font-size: 0.8rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.user-name { display: block; font-weight: 600; font-size: 0.85rem; color: #fff; }
.user-role { display: block; font-size: 0.7rem; color: rgba(255,255,255,0.5); }
.nav-signout { color: rgba(255,255,255,0.5) !important; }
.nav-signout:hover { color: #fca5a5 !important; background: rgba(252,165,165,0.08) !important; }

.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(10,31,77,0.5);
    z-index: 999; backdrop-filter: blur(6px);
}
.sidebar-overlay.active { display: block; }

/* ── Main wrap ── */
.main-wrap {
    flex: 1;
    margin-left: calc(var(--sidebar-width) + var(--space-8));
    display: flex; flex-direction: column;
    min-height: calc(100vh - var(--space-8));
    min-width: 0; overflow-x: hidden;
}

.page-content {
    flex: 1; padding: var(--space-6) var(--space-2) var(--space-8);
    max-width: var(--content-max); width: 100%;
    margin: 0 auto; overflow-x: hidden;
}

.topbar {
    height: var(--topbar-height); display: flex; align-items: center;
    padding: 0 var(--space-6); gap: var(--space-4);
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: sticky; top: var(--space-4); z-index: 100;
}
.menu-toggle {
    display: none; background: var(--bg); border: 1px solid var(--border);
    cursor: pointer; padding: var(--space-2); border-radius: var(--radius-xs); color: var(--text);
}
.menu-toggle svg { width: 22px; height: 22px; }
.topbar-context { flex: 1; min-width: 0; }
.topbar-eyebrow {
    display: block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--accent-dark); margin-bottom: 2px;
}
.topbar-heading {
    font-family: var(--font-display); font-size: 1.2rem; font-weight: 700;
    color: var(--primary-dark); letter-spacing: -0.02em; line-height: 1.2;
}
.topbar-actions { display: flex; align-items: center; gap: var(--space-4); }
.topbar-date { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.topbar-seal {
    width: 42px; height: 42px; object-fit: contain;
    background: transparent; border: none; border-radius: 0; box-shadow: none;
}

.app-footer {
    padding: var(--space-6); text-align: center;
    font-size: 0.78rem; color: var(--text-soft);
    margin-top: var(--space-4);
}
.footer-logo { width: 36px; height: 36px; object-fit: contain; margin: 0 auto var(--space-2); opacity: 1; border: none; box-shadow: none; border-radius: 0; }
.footer-note { margin-top: var(--space-1); color: var(--primary); font-weight: 500; }

/* ═══ PAGE HERO ═══ */
.page-hero {
    display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-8);
    padding: var(--space-8) var(--space-8) var(--space-10);
    margin-bottom: var(--space-8);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 70%, #1e4080 100%);
    border-radius: var(--radius-lg);
    color: #fff; position: relative; overflow: hidden;
    box-shadow: var(--shadow-md);
}
.page-hero::before {
    content: ''; position: absolute; top: -50%; right: -10%; width: 60%; height: 200%;
    background: radial-gradient(ellipse, rgba(201,162,39,0.15) 0%, transparent 60%);
    pointer-events: none;
}
.page-hero::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--accent));
}
.page-hero-content { position: relative; z-index: 1; max-width: 560px; }
.page-hero-eyebrow {
    font-size: 0.8rem; font-weight: 600; color: var(--accent-light);
    text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--space-2);
}
.page-hero-title {
    font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; margin-bottom: var(--space-3);
}
.page-hero-desc { font-size: 0.95rem; opacity: 0.82; line-height: 1.6; }
.page-hero-actions {
    display: flex; gap: var(--space-3); flex-shrink: 0; position: relative; z-index: 1;
    flex-wrap: wrap;
}

/* ═══ BENTO GRID ═══ */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(120px, auto);
    gap: var(--space-4);
    margin-bottom: var(--space-8);
    width: 100%;
}
.bento-item {
    --bento-accent: var(--primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
    overflow: hidden; position: relative;
    min-width: 0;
}
.bento-inner {
    padding: var(--space-5);
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    z-index: 2;
}
.bento-featured { grid-column: span 2; grid-row: span 2; --bento-accent: var(--primary); }
.bento-wide { grid-column: span 2; }
.bento-featured .bento-inner { padding: var(--space-6); }
.bento-item::before,
.bento-item::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    pointer-events: none;
    z-index: 1;
}
.bento-item::before {
    width: 34px;
    height: 34px;
    background: var(--bento-accent);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
    border-top-right-radius: calc(var(--radius) - 2px);
    opacity: 0.9;
    transition: opacity 0.35s var(--ease-out);
}
.bento-item::after {
    width: 12px;
    height: 12px;
    margin-top: 2px;
    margin-right: 2px;
    background: color-mix(in srgb, var(--bento-accent) 45%, white);
    clip-path: polygon(100% 0, 100% 100%, 0 0);
    opacity: 0.65;
}
.bento-item:hover {
    transform: translateY(-4px);
    box-shadow:
        0 16px 40px rgba(22, 58, 122, 0.13),
        0 6px 16px rgba(22, 58, 122, 0.07);
}
.bento-item:hover::before { opacity: 1; }
.bento-item.rotc { --bento-accent: var(--rotc); }
.bento-item.cwts { --bento-accent: var(--cwts); }
.bento-item.lts { --bento-accent: var(--lts); }
.bento-item.accent { --bento-accent: var(--accent); }

.bento-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}
.bento-label::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bento-accent, var(--primary));
    flex-shrink: 0;
}
.bento-value {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary-dark);
    letter-spacing: -0.04em;
    line-height: 1;
}
.bento-value.sm { font-size: 2rem; }
.bento-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: var(--space-2);
}
.bento-item.bento-featured .bento-label { color: var(--primary-dark); font-size: 0.78rem; }
.bento-item.bento-featured .bento-meta { color: var(--primary); opacity: 0.85; font-weight: 500; }
.bento-item.rotc .bento-label { color: var(--text-muted); }
.bento-item.rotc .bento-meta { color: #3d4f1c; opacity: 0.9; }
.bento-item.rotc .bento-value { color: var(--rotc); }
.bento-item.cwts .bento-label { color: var(--text-muted); }
.bento-item.cwts .bento-meta { color: #155a8a; opacity: 0.9; }
.bento-item.cwts .bento-value { color: var(--cwts); }
.bento-item.lts .bento-label { color: var(--text-muted); }
.bento-item.lts .bento-meta { color: #0a2247; opacity: 0.9; }
.bento-item.lts .bento-value { color: var(--lts); }
.bento-item.accent .bento-label { color: var(--text-muted); }
.bento-item.accent .bento-meta { color: #7a6210; opacity: 0.9; }
.bento-item.accent .bento-value { color: var(--primary-dark); }
.bento-item:not(.rotc):not(.cwts):not(.lts):not(.accent):not(.bento-featured) .bento-label {
    color: var(--text-muted);
}
.bento-item:not(.rotc):not(.cwts):not(.lts):not(.accent):not(.bento-featured) .bento-value {
    color: var(--primary-dark);
}
.bento-icon {
    width: 40px; height: 40px; min-width: 40px; max-width: 40px;
    min-height: 40px; max-height: 40px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px; margin-bottom: var(--space-3);
    background: color-mix(in srgb, var(--primary) 12%, white);
    color: var(--primary);
    overflow: hidden;
}
.bento-icon svg { width: 20px !important; height: 20px !important; max-width: 20px; max-height: 20px; }
.bento-item.rotc .bento-icon { background: color-mix(in srgb, var(--rotc) 12%, white); color: var(--rotc); }
.bento-item.cwts .bento-icon { background: color-mix(in srgb, var(--cwts) 12%, white); color: var(--cwts); }
.bento-item.lts .bento-icon { background: color-mix(in srgb, var(--lts) 12%, white); color: var(--lts); }

.bento-sparkline {
    display: flex; align-items: flex-end; gap: 6px; height: 48px;
    margin-top: auto; padding-top: var(--space-6);
}
.bento-sparkline span {
    flex: 1; background: linear-gradient(180deg, var(--accent-light), var(--primary-light));
    border-radius: 4px 4px 0 0; height: var(--h);
    transform-origin: bottom; animation: barGrow 0.8s var(--ease-out) backwards;
}
.bento-sparkline span:nth-child(1) { animation-delay: 0.1s; }
.bento-sparkline span:nth-child(2) { animation-delay: 0.15s; }
.bento-sparkline span:nth-child(3) { animation-delay: 0.2s; }
.bento-sparkline span:nth-child(4) { animation-delay: 0.25s; }
.bento-sparkline span:nth-child(5) { animation-delay: 0.3s; }
.bento-sparkline span:nth-child(6) { animation-delay: 0.35s; }

.bento-progress {
    height: 6px; background: var(--bg); border-radius: 3px;
    margin-top: var(--space-3); overflow: hidden;
}
.bento-progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px; transition: width 1.2s var(--ease-out);
}

/* ═══ CONTENT GRID / PANELS ═══ */
.content-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6);
}
.panel, .card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.35s var(--ease-out);
}
.panel:hover, .card:hover { box-shadow: var(--shadow-md); }
.panel-header, .card-header {
    padding: var(--space-4) var(--space-5) var(--space-3);
    display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
    border-bottom: 1px solid var(--border);
}
.panel-title, .card-header h2, .card-header h3 {
    font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
    color: var(--primary-dark); letter-spacing: -0.02em;
}
.panel-desc {
    font-size: 0.88rem; color: var(--primary); margin-top: var(--space-1);
    font-weight: 500; opacity: 0.9;
}
.panel-body, .card-body { padding: var(--space-4) var(--space-5); }
.panel-body.flush, .card-body.flush { padding: 0; }
.card-body.compact { padding: var(--space-3) var(--space-4); }
.card-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); }

/* Data list (replaces plain tables on dashboard) */
.data-list { display: flex; flex-direction: column; }
.data-list-item {
    display: flex; align-items: center; gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}
.data-list-item:last-child { border-bottom: none; }
.data-list-item:hover { background: rgba(22,58,122,0.03); }
.data-list-date {
    width: 48px; text-align: center; flex-shrink: 0;
    background: var(--bg); border-radius: var(--radius-xs); padding: var(--space-2);
}
.data-list-day { display: block; font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--primary); line-height: 1; }
.data-list-month { display: block; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; color: var(--text-soft); }
.data-list-avatar {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent-dark));
    color: #fff; font-size: 0.78rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.data-list-content { flex: 1; min-width: 0; }
.data-list-title { display: block; font-weight: 600; font-size: 0.9rem; color: var(--text); }
.data-list-sub { display: block; font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.data-list-end { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); }
.data-list-time { font-size: 0.72rem; color: var(--text-soft); }

.announcement-list { display: flex; flex-direction: column; gap: var(--space-6); }
.announcement-item h3 { font-size: 1rem; font-weight: 600; margin: var(--space-2) 0; }
.announcement-item p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.announcement-item footer { font-size: 0.78rem; color: var(--text-soft); margin-top: var(--space-3); }

/* Legacy stats grid (other pages) */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4); margin-bottom: var(--space-8);
}
.stat-card {
    background: var(--bg-elevated); border-radius: var(--radius);
    padding: var(--space-6); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
    transition: transform 0.35s var(--ease-out), box-shadow 0.35s;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--primary);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card.rotc::before { background: var(--rotc); }
.stat-card.cwts::before { background: var(--cwts); }
.stat-card.lts::before { background: var(--lts); }
.stat-card.accent::before { background: var(--accent); }
.stat-icon {
    width: 44px; height: 44px; border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: var(--space-4); background: rgba(22,58,122,0.08); color: var(--primary);
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--primary-dark); letter-spacing: -0.03em; }
.stat-label { font-size: 0.88rem; color: var(--primary); margin-top: var(--space-1); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-6); }

/* ═══ TABLES ═══ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead { background: rgba(22,58,122,0.04); }
th {
    text-align: left; padding: var(--space-4) var(--space-5);
    font-size: 0.72rem; font-weight: 700; color: var(--text-soft);
    text-transform: uppercase; letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
td {
    padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
    font-size: 0.88rem; vertical-align: middle;
}
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(22,58,122,0.03); }

/* ═══ BADGES ═══ */
.badge {
    display: inline-flex; align-items: center; padding: 4px 10px;
    border-radius: 100px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em;
}
.badge-rotc { background: rgba(74, 93, 35, 0.14); color: var(--rotc); }
.badge-cwts { background: rgba(30, 107, 184, 0.14); color: var(--cwts); }
.badge-lts { background: rgba(15, 45, 92, 0.14); color: var(--lts); }
.badge-success { background: rgba(26,122,82,0.1); color: var(--success); }
.badge-warning { background: rgba(201,162,39,0.15); color: var(--accent-dark); }
.badge-danger { background: rgba(196,43,43,0.1); color: var(--danger); }
.badge-info { background: rgba(37,99,184,0.1); color: var(--info); }
.badge-default { background: var(--bg); color: var(--text-muted); }

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: 11px 22px; border: none; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 0.875rem; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: all 0.3s var(--ease-out);
    white-space: nowrap; position: relative; overflow: hidden;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff; box-shadow: 0 2px 8px rgba(22,58,122,0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(22,58,122,0.3); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--border); }
.btn-accent {
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    color: var(--primary-dark); box-shadow: var(--shadow-glow);
}
.btn-accent:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-glass {
    background: rgba(255,255,255,0.15); color: #fff;
    border: 1px solid rgba(255,255,255,0.25); backdrop-filter: blur(8px);
}
.btn-glass:hover { background: rgba(255,255,255,0.25); }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(22,58,122,0.05); border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning {
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    color: var(--primary-dark); box-shadow: 0 2px 8px rgba(201,162,39,0.25);
}
.btn-warning:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(201,162,39,0.35); }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn-group { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ═══ FORMS ═══ */
.form-group { margin-bottom: var(--space-4); }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .required { color: var(--danger); }
.form-hint { font-size: 0.75rem; color: var(--text-soft); margin-top: 4px; line-height: 1.4; }
.form-control {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-xs); font-family: var(--font); font-size: 0.875rem;
    color: var(--text); background: var(--bg-elevated);
    transition: border-color 0.25s, box-shadow 0.25s;
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22,58,122,0.1);
}
.form-control::placeholder { color: var(--text-soft); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 88px; }
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.form-row .form-group { margin-bottom: 0; }
.form-row:last-child { margin-bottom: 0; }
.form-check { display: flex; align-items: center; gap: var(--space-3); cursor: pointer; }
.form-check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* Compact forms inside modals & filter cards */
.modal .form-group { margin-bottom: var(--space-3); }
.modal .form-row {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.modal .form-control { padding: 8px 12px; font-size: 0.84rem; }
.modal .form-label { font-size: 0.76rem; margin-bottom: 4px; color: var(--primary-dark); }
.modal .form-hint { font-size: 0.72rem; margin-top: 3px; }
.modal textarea.form-control { min-height: 72px; }

.filter-bar .form-label { font-size: 0.72rem; margin-bottom: 4px; color: var(--primary-dark); }
.filter-bar .form-control { padding: 8px 12px; font-size: 0.84rem; }

.card-body .form-row,
.panel-body .form-row,
.info-callout + form .form-row { margin-bottom: 0; }

/* Form section divider (long modals) */
.form-section {
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px dashed var(--border);
}
.form-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.form-section-title {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--primary); margin-bottom: var(--space-3);
}

/* ═══ ALERTS ═══ */
.alert {
    padding: var(--space-4) var(--space-5); border-radius: var(--radius-sm);
    margin-bottom: var(--space-5); display: flex; align-items: center;
    justify-content: space-between; gap: var(--space-3); font-size: 0.88rem; font-weight: 500;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; opacity: 0.5; }

/* ═══ AUTH PAGE ═══ */
.auth-page {
    min-height: 100vh; display: flex; position: relative; overflow: hidden;
    background: var(--primary-dark);
}
.auth-page::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 80%, rgba(201,162,39,0.18) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 80% 20%, rgba(43,85,168,0.4) 0%, transparent 50%),
        linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 50%, #1a3270 100%);
}
.auth-page::after {
    content: ''; position: absolute; inset: 0; opacity: 0.4;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-container {
    display: grid; grid-template-columns: minmax(0, 1fr) 420px;
    width: 100%; max-width: 1200px; margin: auto;
    padding: var(--space-8); gap: var(--space-10);
    position: relative; z-index: 1; align-items: center;
}

/* Login-style pages have branding + card; single-card pages (e.g. sign-up) only have a card */
.auth-container--single {
    grid-template-columns: minmax(0, 1fr);
    max-width: 520px;
    justify-items: stretch;
}

.auth-container--single .auth-card {
    width: 100%;
    min-width: 0;
}

.auth-branding {
    color: #fff; animation: fadeUp 0.9s var(--ease-out) forwards;
    min-width: 0; overflow: hidden;
}
.auth-logo-wrap { margin-bottom: var(--space-6); }
.auth-logo {
    width: 128px; height: 128px; object-fit: contain;
    background: transparent; padding: 0; border: none; border-radius: 0;
    box-shadow: none;
    animation: float 5s ease-in-out infinite;
}
.auth-university {
    font-size: 0.78rem !important; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.14em; color: var(--accent-light) !important;
    margin-bottom: var(--space-3) !important; max-width: none !important; opacity: 1 !important;
}
.auth-branding h1 {
    font-family: var(--font-display); font-size: clamp(1.75rem, 4vw, 2.4rem);
    font-weight: 800; line-height: 1.15; letter-spacing: -0.03em; margin-bottom: var(--space-4);
}
.auth-branding > p { font-size: 1rem; opacity: 0.85; line-height: 1.7; max-width: 460px; }
.auth-features {
    margin-top: var(--space-8); display: flex; flex-direction: column;
    gap: var(--space-4); max-width: 440px;
}
.auth-feature {
    display: flex; align-items: center; gap: var(--space-4);
    font-size: 0.9rem; max-width: 100%;
    opacity: 0; animation: slideInLeft 0.55s var(--ease-out) forwards;
}
.auth-feature:nth-child(1) { animation-delay: 0.35s; }
.auth-feature:nth-child(2) { animation-delay: 0.5s; }
.auth-feature:nth-child(3) { animation-delay: 0.65s; }
.auth-feature-icon {
    width: 42px; height: 42px; min-width: 42px; max-width: 42px;
    min-height: 42px; max-height: 42px; flex-shrink: 0;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12); border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.auth-feature-icon svg { width: 20px !important; height: 20px !important; max-width: 20px; max-height: 20px; }
.program-pills { display: flex; gap: var(--space-2); margin-top: var(--space-8); flex-wrap: wrap; }
.program-pill {
    padding: 6px 16px; border-radius: 100px; font-size: 0.72rem; font-weight: 700;
    background: rgba(201,162,39,0.2); color: var(--accent-light);
    border: 1px solid rgba(201,162,39,0.35); letter-spacing: 0.04em;
}

.auth-card {
    background: var(--bg-glass-strong); backdrop-filter: blur(24px) saturate(1.5);
    border: 1px solid rgba(255,255,255,0.2); border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-6);
    box-shadow: var(--shadow-lg); animation: scaleIn 0.7s var(--ease-out) forwards;
}
.auth-card-logo { text-align: center; margin-bottom: var(--space-4); }
.auth-card-logo img {
    width: 72px; height: 72px; object-fit: contain;
    padding: 0; background: transparent; border: none; border-radius: 0; box-shadow: none;
}
.auth-card h2 {
    font-family: var(--font-display); font-size: 1.5rem; font-weight: 800;
    color: var(--primary-dark); letter-spacing: -0.02em; margin-bottom: var(--space-2);
}
.auth-card .auth-subtitle { color: var(--text-muted); margin-bottom: var(--space-5); font-size: 0.85rem; }

/* ═══ ATTENDANCE PAGE ═══ */
.session-picker { margin-bottom: var(--space-6); }
.session-picker-form .form-label {
    margin-bottom: var(--space-3); font-size: 0.72rem; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-soft); font-weight: 700;
}
.session-picker-row { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.session-picker-row .form-control { flex: 1; min-width: 260px; }
.session-live-badge {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-4); background: #ecfdf5; color: #065f46;
    border-radius: 100px; font-size: 0.78rem; font-weight: 700;
}
.live-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; animation: pulse 1.5s infinite; }

.session-banner {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-6);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary) 60%, #1e4080);
    color: #fff; border-radius: var(--radius-lg); padding: var(--space-6) var(--space-8);
    margin-bottom: var(--space-6); box-shadow: var(--shadow-md); flex-wrap: wrap;
    border-left: 4px solid var(--accent); position: relative; overflow: hidden;
}
.session-banner::after {
    content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(201,162,39,0.12) 0%, transparent 70%);
}
.session-banner-main { display: flex; align-items: flex-start; gap: var(--space-5); flex: 1; min-width: 280px; position: relative; z-index: 1; }
.session-banner-icon {
    width: 52px; height: 52px; background: rgba(255,255,255,0.1);
    border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
}
.session-banner-icon svg { width: 26px; height: 26px; color: var(--accent-light); }
.session-banner-tags { display: flex; gap: var(--space-2); margin-bottom: var(--space-2); flex-wrap: wrap; }
.session-banner-tags .badge-default { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.9); }
.session-banner-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: var(--space-3); }
.session-banner-meta { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: 0.82rem; opacity: 0.85; }
.session-banner-meta span { display: inline-flex; align-items: center; gap: 6px; }
.session-banner-meta svg { width: 14px; height: 14px; }
.session-banner-stats { display: flex; gap: var(--space-5); position: relative; z-index: 1; }
.mini-stat { text-align: center; padding: 0 var(--space-4); border-left: 1px solid rgba(255,255,255,0.12); }
.mini-stat:first-child { border-left: none; }
.mini-stat-value { display: block; font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }
.mini-stat-label { display: block; font-size: 0.7rem; opacity: 0.65; margin-top: 2px; }

.attendance-workspace { display: grid; grid-template-columns: 1fr 380px; gap: var(--space-6); align-items: start; }
.attendance-workspace--view { grid-template-columns: 1fr; }
.scanner-card-header { flex-direction: column; align-items: flex-start !important; gap: var(--space-4) !important; }
.scanner-card-body { padding: var(--space-8) !important; }
.scanner-method-tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: var(--radius-sm); width: 100%; }
.scanner-tab {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: 10px 16px; border: none; background: transparent; border-radius: var(--radius-xs);
    font-family: var(--font); font-size: 0.85rem; font-weight: 600; color: var(--text-muted); cursor: pointer;
    transition: all 0.25s;
}
.scanner-tab svg { width: 17px; height: 17px; }
.scanner-tab.active { background: var(--bg-elevated); color: var(--primary); box-shadow: var(--shadow-xs); }
.scanner-tab-panel { display: none; }
.scanner-tab-panel.active { display: block; animation: fadeIn 0.35s; }

.scanner-viewport {
    position: relative; width: 100%; max-width: 380px; margin: 0 auto var(--space-6);
    aspect-ratio: 1; background: #080e1a; border-radius: var(--radius);
    overflow: hidden; border: 2px solid var(--border-strong);
}
.scanner-viewport video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-idle {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: var(--space-3); color: rgba(255,255,255,0.35);
}
.scanner-idle svg { width: 44px; height: 44px; }
.scanner-viewport.camera-active .scanner-idle { opacity: 0; pointer-events: none; }
.scanner-frame { position: absolute; inset: 15%; pointer-events: none; }
.scanner-frame .corner { position: absolute; width: 22px; height: 22px; border-color: var(--accent); border-style: solid; }
.scanner-frame .corner.tl { top: 0; left: 0; border-width: 3px 0 0 3px; }
.scanner-frame .corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; }
.scanner-frame .corner.bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; }
.scanner-frame .corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; }
.scanner-line {
    position: absolute; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 12px var(--accent); animation: scanLine 2.5s ease-in-out infinite;
}
.scanner-status {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 10px;
    background: rgba(0,0,0,0.75); color: #fff; font-size: 0.78rem; text-align: center;
}
.biometric-device {
    max-width: 318px; margin: 0 auto var(--space-6); position: relative; overflow: hidden;
    background: linear-gradient(145deg, #35405a 0%, #151b2a 46%, #090d15 100%);
    border: 1px solid rgba(193, 220, 255, 0.23); border-radius: 22px; padding: 12px;
    box-shadow: 0 20px 42px rgba(12, 20, 39, 0.3), inset 0 1px 0 rgba(255,255,255,0.3), inset 0 -2px 7px rgba(0,0,0,0.55);
}
.biometric-device::before { content: ''; position: absolute; inset: 1px 1px auto; height: 42%; border-radius: 21px 21px 45% 45%; background: linear-gradient(130deg, rgba(255,255,255,0.2), transparent 44%); pointer-events: none; }
.biometric-device-screen {
    position: relative; overflow: hidden; background: radial-gradient(circle at 50% 35%, #173866 0%, #0b1c37 43%, #050b17 100%);
    border-radius: 14px; padding: 34px var(--space-5) 28px; text-align: center;
    border: 1px solid rgba(176, 218, 255, 0.25); box-shadow: inset 0 0 26px rgba(0,0,0,0.6), 0 1px 2px rgba(255,255,255,0.12);
}
.biometric-device-screen::before { content: ''; position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(rgba(104,190,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(104,190,255,.35) 1px, transparent 1px); background-size: 15px 15px; mask-image: linear-gradient(to bottom, transparent, #000 24%, transparent 90%); pointer-events: none; }
.biometric-sensor { width: 128px; height: 128px; margin: 0 auto var(--space-4); position: relative; display: flex; align-items: center; justify-content: center; border-radius: 50%; isolation: isolate; }
.biometric-sensor-glass { position: absolute; inset: 9px; z-index: 0; border-radius: 50%; background: radial-gradient(circle at 36% 28%, rgba(126,222,255,.42), rgba(38,118,198,.24) 31%, rgba(4,16,37,.92) 72%); border: 1px solid rgba(154,224,255,.55); box-shadow: inset 0 0 15px rgba(0,0,0,.82), 0 0 0 7px rgba(17,51,92,.55), 0 0 20px rgba(72,169,255,.28); }
.biometric-fingerprint-mark { width: 87px; height: 87px; position: relative; z-index: 2; filter: drop-shadow(0 0 7px rgba(111,210,255,.58)); }
.biometric-scan-beam { position: absolute; z-index: 3; width: 78px; height: 2px; left: 25px; top: 29px; opacity: .72; background: linear-gradient(90deg, transparent, #d8f7ff, transparent); box-shadow: 0 0 11px #55cfff; animation: biometricBeam 3s ease-in-out infinite; }
@keyframes biometricBeam { 0%, 100% { transform: translateY(0); opacity: .15; } 45% { opacity: .9; } 50% { transform: translateY(66px); opacity: .95; } 55% { opacity: .2; } }
.biometric-ring {
    position: absolute; inset: 0; z-index: 4; border-radius: 50%; pointer-events: none;
    border: 1px solid rgba(101,191,255,0.58); box-shadow: 0 0 0 4px rgba(41,109,193,.16), 0 0 18px rgba(56,154,255,.25); animation: fingerprintPulse 2.5s infinite;
}
.biometric-device.scanning .biometric-ring { border-color: var(--accent); animation: fingerprintPulse 0.6s infinite; }
.biometric-device.scanning .biometric-fingerprint-mark { filter: drop-shadow(0 0 11px rgba(255,207,48,.9)); }
.biometric-device.scanning .biometric-scan-beam { animation-duration: .75s; background: linear-gradient(90deg, transparent, #ffe995, transparent); box-shadow: 0 0 13px #ffd036; }
.biometric-device.success .biometric-fingerprint-mark { filter: hue-rotate(82deg) drop-shadow(0 0 11px rgba(74,222,128,.9)); }
.biometric-prompt { color: rgba(255,255,255,0.55); font-size: 0.82rem; }
.biometric-progress { margin-top: var(--space-3); height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.biometric-progress-bar { height: 100%; background: var(--accent); width: 0; transition: width 0.1s linear; }
.biometric-device-label { text-align: center; margin-top: var(--space-3); font-size: 0.65rem; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.12em; }
.scanner-actions { display: flex; justify-content: center; gap: var(--space-3); margin-bottom: var(--space-6); flex-wrap: wrap; }
.scanner-manual-divider { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); color: var(--text-soft); font-size: 0.78rem; }
.scanner-manual-divider::before, .scanner-manual-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.scanner-manual-row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.scanner-manual-row .form-control { flex: 1; min-width: 160px; }
.scan-result {
    padding: var(--space-4) var(--space-5); border-radius: var(--radius-sm); margin-top: var(--space-4);
    font-weight: 500; font-size: 0.88rem; display: none; border-left: 3px solid transparent;
}
.scan-result.show { display: flex; align-items: center; gap: var(--space-3); animation: fadeIn 0.4s; }
.scan-result.success { background: #ecfdf5; color: #065f46; border-left-color: var(--success); }
.scan-result.error { background: #fef2f2; color: #991b1b; border-left-color: var(--danger); }

.roster-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff; border-radius: 100px; font-size: 0.82rem; font-weight: 700;
}
.roster-summary { display: flex; gap: var(--space-3); padding: 0 var(--space-5) var(--space-4); border-bottom: 1px solid var(--border); }
.roster-pill { flex: 1; text-align: center; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--bg); }
.roster-pill.present { border-left: 3px solid var(--success); }
.roster-pill.late { border-left: 3px solid var(--accent); }
.roster-pill-value { display: block; font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; color: var(--primary-dark); }
.roster-pill-label { display: block; font-size: 0.72rem; color: var(--text-soft); }
.roster-list { max-height: 520px; overflow-y: auto; }
.roster-empty { text-align: center; padding: var(--space-12) var(--space-6); color: var(--text-muted); }
.roster-empty svg { width: 44px; height: 44px; margin-bottom: var(--space-3); opacity: 0.3; }
.roster-items { list-style: none; }
.roster-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}
.roster-item:hover { background: rgba(22,58,122,0.03); }
.roster-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent-dark));
    color: #fff; font-size: 0.78rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.roster-info { flex: 1; min-width: 0; }
.roster-name { display: block; font-weight: 600; font-size: 0.88rem; }
.roster-meta { display: block; font-size: 0.72rem; color: var(--text-soft); }
.roster-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.method-tag { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.method-tag.method-qr { color: var(--info); }
.method-tag.method-fingerprint { color: var(--primary); }

.checkin-toast {
    position: fixed; bottom: var(--space-8); right: var(--space-8); z-index: 3000;
    display: flex; align-items: center; gap: var(--space-4);
    background: var(--bg-glass-strong); backdrop-filter: blur(16px);
    border-radius: var(--radius); padding: var(--space-4) var(--space-5);
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    transform: translateY(120%); transition: transform 0.45s var(--ease-spring), opacity 0.3s ease;
    max-width: 360px;
}
.checkin-toast[hidden] { display: none; }
.checkin-toast:not(.show) { opacity: 0; pointer-events: none; }
.checkin-toast.show { transform: translateY(0); opacity: 1; }
.checkin-toast-icon {
    width: 40px; height: 40px; border-radius: 50%; background: #ecfdf5;
    color: #065f46; display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 700;
}

/* ═══ MODAL ═══ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(10,31,77,0.55);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    padding: var(--space-6); opacity: 0; visibility: hidden;
    transition: all 0.35s var(--ease-out); backdrop-filter: blur(8px);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-elevated); border-radius: var(--radius-lg);
    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
    transform: scale(0.94) translateY(16px); transition: transform 0.4s var(--ease-spring);
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.modal.modal-lg { max-width: 680px; }
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
    padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(22, 58, 122, 0.03);
}
.modal-header h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--primary-dark); }
.modal-close { background: none; border: none; font-size: 1.35rem; cursor: pointer; color: var(--text-soft); line-height: 1; }
.modal-body { padding: var(--space-4) var(--space-5); }
.modal-footer {
    padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: var(--space-2);
    background: rgba(22, 58, 122, 0.02);
}

/* ═══ MISC ═══ */
.empty-state { text-align: center; padding: var(--space-12) var(--space-6); color: var(--text-muted); }
.empty-state.compact { padding: var(--space-8) var(--space-6); }
.empty-state svg { width: 56px; height: 56px; margin-bottom: var(--space-4); opacity: 0.3; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: var(--space-2); }

.pagination { display: flex; align-items: center; justify-content: center; gap: var(--space-2); margin-top: var(--space-6); }
.pagination a, .pagination span {
    padding: var(--space-2) var(--space-4); border-radius: var(--radius-xs);
    font-size: 0.82rem; font-weight: 600; text-decoration: none; color: var(--text);
    border: 1px solid var(--border); transition: all 0.2s;
}
.pagination a:hover, .pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

.tabs { display: flex; gap: var(--space-1); border-bottom: 2px solid var(--border); margin-bottom: var(--space-6); overflow-x: auto; }
.tab {
    padding: var(--space-3) var(--space-5); font-size: 0.88rem; font-weight: 600;
    color: var(--text-muted); text-decoration: none;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; white-space: nowrap;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--accent); }

.progress-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 4px; transition: width 1s var(--ease-out); }

.qr-display {
    width: 180px; height: 180px; margin: 0 auto; background: #fff;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    padding: 8px; position: relative; overflow: hidden;
}
.qr-display canvas,
.qr-display img {
    display: block;
    max-width: 100%;
    max-height: 100%;
}
.qr-display-label {
    font-family: monospace;
    font-size: 0.72rem;
    word-break: break-all;
    text-align: center;
    margin-top: var(--space-3);
    color: var(--text-muted);
}
.qr-actions {
    margin-top: var(--space-3);
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.content-area { flex: 1; padding: var(--space-6); }

/* Legacy compat */
.app-layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; }
.topbar-title h1 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--primary-dark); }
.topbar-subtitle { font-size: 0.82rem; color: var(--text-muted); }
.current-date { font-size: 0.8rem; color: var(--text-muted); }
.topbar-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 50%; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1200px) {
    .bento-grid { grid-template-columns: repeat(3, 1fr); }
    .bento-featured { grid-column: span 2; grid-row: span 1; }
    .bento-wide { grid-column: span 1; }
    .bento-value { font-size: 2.2rem; }
}

@media (max-width: 1100px) {
    .attendance-workspace { grid-template-columns: 1fr; }
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    .auth-container { grid-template-columns: 1fr; max-width: 480px; }
    .auth-branding { text-align: center; }
    .auth-branding > p { margin: 0 auto; }
    .auth-features { align-items: center; }
    .auth-logo { margin: 0 auto; }
    .session-banner { flex-direction: column; align-items: flex-start; }
    .session-banner-stats { width: 100%; justify-content: space-around; padding-top: var(--space-4); border-top: 1px solid rgba(255,255,255,0.1); }
}

@media (max-width: 900px) {
    .app-shell { padding: 0; }
    .sidebar {
        top: 0; left: 0; bottom: 0; border-radius: 0;
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: flex; }
    .main-wrap { margin-left: 0; }
    .topbar { border-radius: 0; top: 0; position: sticky; }
    .menu-toggle { display: flex; }
    .topbar-date { display: none; }
    .page-content { padding: var(--space-4); }
    .page-hero { flex-direction: column; align-items: flex-start; padding: var(--space-6); }
    .bento-grid { grid-template-columns: repeat(2, 1fr); }
    .bento-featured { grid-column: span 2; }
}

@media (max-width: 600px) {
    .bento-grid { grid-template-columns: 1fr; }
    .bento-featured { grid-column: span 1; }
    .bento-wide { grid-column: span 1; }
    .stats-grid { grid-template-columns: 1fr; }
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; }
    .scanner-manual-row { flex-direction: column; }
    .checkin-toast { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); }
}

/* NEMSU dashboard treatment */
.dashboard-page {
    --dashboard-ink: #13275d;
    --dashboard-royal: #234b9b;
    --dashboard-gold: #d4af37;
    background:
        radial-gradient(ellipse 70% 45% at 96% 0%, rgba(35, 75, 155, .12), transparent 70%),
        radial-gradient(ellipse 60% 40% at 0% 100%, rgba(212, 175, 55, .08), transparent 70%),
        #e9eef6;
}
.dashboard-page .page-content { max-width: 1420px; }
.dashboard-page .page-hero {
    min-height: 228px; padding: 42px 48px 46px; margin-bottom: 34px;
    background:
        radial-gradient(circle at 84% 12%, rgba(103, 139, 220, .38), transparent 32%),
        linear-gradient(120deg, #0f2055 0%, #182e70 52%, #2a4b98 100%);
    border: 1px solid rgba(255,255,255,.18); border-radius: 26px;
    box-shadow: 0 22px 50px rgba(19,39,93,.22), inset 0 1px 0 rgba(255,255,255,.16);
}
.dashboard-page .page-hero::before { right: 7%; width: 36%; opacity: .7; background: radial-gradient(ellipse, rgba(212,175,55,.22), transparent 64%); }
.dashboard-page .page-hero::after { height: 4px; background: linear-gradient(90deg, transparent 0%, var(--dashboard-gold) 15%, #f4d675 50%, var(--dashboard-gold) 85%, transparent 100%); }
.dashboard-page .page-hero-content { max-width: 650px; }
.dashboard-page .page-hero-eyebrow { display: flex; align-items: center; gap: 9px; color: #f0d875; font-size: .73rem; letter-spacing: .14em; }
.dashboard-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #7ce2ac; box-shadow: 0 0 0 5px rgba(124,226,172,.14), 0 0 13px rgba(124,226,172,.8); }
.dashboard-page .page-hero-title { font-size: clamp(2rem, 3.5vw, 3.05rem); letter-spacing: -.045em; line-height: 1.05; text-wrap: balance; }
.dashboard-page .page-hero-desc { color: rgba(244,248,255,.78); max-width: 570px; }
.dashboard-page .page-hero-actions { align-self: center; }
.dashboard-page .btn-accent { background: linear-gradient(135deg, #e4c451, #bd951e); border: 1px solid rgba(255,242,177,.55); color: #152557; box-shadow: 0 8px 18px rgba(0,0,0,.16); }
.dashboard-page .btn-accent:hover { background: linear-gradient(135deg, #f1d670, #caa52c); transform: translateY(-2px); }
.dashboard-page .btn-glass { background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.34); color: #fff; backdrop-filter: blur(10px); }
.dashboard-page .btn-glass:hover { background: rgba(255,255,255,.22); }
.dashboard-page .bento-grid { gap: 18px; margin-bottom: 34px; }
.dashboard-page .bento-item {
    background: linear-gradient(145deg, rgba(255,255,255,.97), rgba(241,245,251,.96));
    border-color: rgba(35,75,155,.12);
    border-radius: 20px;
    box-shadow: 0 8px 22px rgba(21,42,91,.08), inset 0 1px 0 #fff;
}
.dashboard-page .bento-item:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 44px rgba(22, 58, 122, 0.16),
        0 8px 20px rgba(22, 58, 122, 0.08),
        inset 0 1px 0 #fff;
}
.dashboard-page .bento-featured .bento-inner { padding: 30px; }
.dashboard-stat-seal { position: absolute; right: 25px; top: 22px; width: 54px; height: 54px; object-fit: contain; opacity: .75; filter: drop-shadow(0 4px 8px rgba(35,75,155,.18)); }
.dashboard-page .bento-label { color: var(--text-muted); font-size: .72rem; letter-spacing: .02em; font-weight: 600; text-transform: none; }
.dashboard-page .bento-value { color: var(--dashboard-ink); font-size: 3.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dashboard-page .bento-meta { color: #536481; font-size: .82rem; font-weight: 500; }
.dashboard-page .bento-item.rotc .bento-value { color: #53662b; }
.dashboard-page .bento-item.cwts .bento-value { color: #2867b4; }
.dashboard-page .bento-item.lts .bento-value { color: #2c4380; }
.dashboard-page .bento-item.accent .bento-value { color: var(--dashboard-ink); }
.dashboard-page .bento-sparkline span { background: linear-gradient(180deg, #e8c955, #3157a3); box-shadow: 0 2px 4px rgba(35,75,155,.16); }
.dashboard-page .content-grid { gap: 18px; }
.dashboard-page .panel { background: rgba(255,255,255,.82); border-color: rgba(35,75,155,.12); border-radius: 20px; box-shadow: 0 8px 22px rgba(21,42,91,.07), inset 0 1px 0 #fff; }
.dashboard-page .panel-header { padding: 22px 24px 16px; }
.dashboard-page .panel-title { letter-spacing: -.025em; }
.dashboard-page .panel-desc { color: #71809a; }
.dashboard-page .data-list-item { padding: 18px 24px; border-color: rgba(35,75,155,.10); }
.dashboard-page .data-list-item:hover { background: rgba(35,75,155,.035); }
.dashboard-page .data-list-day { color: var(--dashboard-royal); }
.dashboard-page .data-list-date { background: linear-gradient(145deg, #e8eef8, #d8e1f1); border: 1px solid rgba(35,75,155,.12); }
.dashboard-page .data-list-title { color: #1b2d5f; font-weight: 700; }
.dashboard-page .data-list-sub { color: #71809a; }
.dashboard-page .bento-progress { background: #dce5f2; }
.dashboard-page .bento-progress-fill { background: linear-gradient(90deg, #274d9a, #d4af37); }

.dash-analytics {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}
.dash-analytics-chart .session-chart { height: 184px; }
.rate-bar-label { font-size: 0.78rem; font-weight: 600; min-width: 0; }

/* Dashboard analytics toolbar: one filter row that governs every figure below it. */
.dash-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px 20px; margin: 4px 0 18px;
}
.dash-toolbar-title { font-size: 1.05rem; font-weight: 700; color: var(--dashboard-ink, var(--text)); margin: 0; }
.dash-toolbar-desc { font-size: 0.8rem; color: var(--text-muted); margin: 2px 0 0; }
.dash-range {
    display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px;
    background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.dash-range a {
    padding: 7px 14px; border-radius: 9px; font-size: 0.8rem; font-weight: 600;
    color: var(--text-muted); text-decoration: none; transition: background 0.15s, color 0.15s;
}
.dash-range a:hover { color: var(--text); background: rgba(127, 140, 170, 0.1); }
.dash-range a.active { background: var(--chart-1); color: #fff; }

.dash-facts {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
    margin-top: auto; padding-top: 18px;
}
.dash-fact {
    display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
    border: 1px solid rgba(35, 75, 155, 0.12); border-radius: 12px;
    background: rgba(35, 75, 155, 0.035); color: inherit; text-decoration: none;
    transition: background 0.2s ease;
}
a.dash-fact:hover { background: rgba(35, 75, 155, 0.08); }
.dash-fact.has-alert {
    border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
    background: color-mix(in srgb, var(--danger) 7%, transparent);
}
.dash-fact-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.dash-fact strong {
    font-size: 1.15rem; font-weight: 700; line-height: 1.2;
    color: var(--dashboard-ink, var(--primary-dark)); font-variant-numeric: tabular-nums;
}
.dash-fact small, .rate-bar-value small, .dash-snap-legend small { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }

.dash-delta { display: inline-block; margin-top: 6px; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.dash-delta.up { color: var(--success); }
.dash-delta.down { color: var(--danger); }

.dash-trend.dense .session-chart-cols { gap: 3px; }
.dash-target-track { position: relative; overflow: visible; }
.dash-target-track::after {
    content: ""; position: absolute; left: var(--target); top: -3px; bottom: -3px;
    width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); opacity: 0.55;
}

.dash-session-list { list-style: none; margin: 0; padding: 0; }
.dash-session-list li + li { border-top: 1px solid var(--border); }
.dash-session-list a {
    display: flex; align-items: center; gap: 14px; padding: 14px 24px;
    color: inherit; text-decoration: none;
}
.dash-session-list a:hover { background: rgba(35, 75, 155, 0.035); }
.dash-session-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dash-session-title { font-weight: 700; color: var(--dashboard-ink, var(--text)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-session-sub { font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dash-session-main .rate-bar-track { height: 6px; }
.dash-session-end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dash-session-end strong { font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--text); }

.dash-stack { display: flex; gap: 2px; height: 14px; }
.dash-stack span { display: block; min-width: 4px; }
.dash-stack span:first-child { border-radius: 4px 0 0 4px; }
.dash-stack span:last-child { border-radius: 0 4px 4px 0; }
.dash-stack span:only-child { border-radius: 4px; }
.dash-stack .present, .dash-snap-legend i.present { background: var(--success); }
.dash-stack .late, .dash-snap-legend i.late { background: var(--warning); }
.dash-stack .excused, .dash-snap-legend i.excused { background: var(--text-soft); }
.dash-stack .absent, .dash-snap-legend i.absent { background: var(--danger); }

.dash-subhead {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--border);
    font-size: 0.85rem; font-weight: 700; color: var(--text);
}
.dash-subhead span { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); }
.dash-method { gap: var(--space-3); }
.dash-method .rate-bar-row { grid-template-columns: 96px minmax(0, 1fr) 64px; }
.dash-snap-bar {
    display: flex;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: #dce5f2;
}
.dash-snap-bar span { display: block; height: 100%; min-width: 2px; }
.dash-snap-bar .ok { background: var(--success); }
.dash-snap-bar .mid { background: var(--warning); }
.dash-snap-bar .risk { background: var(--danger); }
.dash-snap-bar .none { background: var(--text-soft); }
.dash-snap-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}
.dash-snap-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.dash-snap-legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-snap-legend i.ok { background: var(--success); }
.dash-snap-legend i.mid { background: var(--warning); }
.dash-snap-legend i.risk { background: var(--danger); }
.dash-snap-legend i.none { background: var(--text-soft); }
.dash-snap-legend strong {
    margin-left: auto;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
    .dash-analytics { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .dash-facts,
    .dash-snap-legend { grid-template-columns: 1fr; }
    .dash-session-list a { padding: 12px 16px; }
}

@media (max-width: 780px) {
    .dashboard-page .page-hero { padding: 30px 26px 34px; }
    .dashboard-page .page-hero-content { position: relative; z-index: 2; }
    .dashboard-page .page-hero-actions { align-self: flex-start; }
}

@media print {
    .sidebar, .topbar, .app-footer, .btn, .menu-toggle, .bg-mesh { display: none !important; }
    .main-wrap { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .panel, .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ═══════════════════════════════════════════════════════════
   v1.2 — Enhanced layout, components & progressive motion
   ═══════════════════════════════════════════════════════════ */

html { color-scheme: light; }

body.app-body {
    background:
        radial-gradient(ellipse 120% 80% at 100% -20%, rgba(43, 85, 168, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse 80% 60% at 0% 100%, rgba(201, 162, 39, 0.03) 0%, transparent 45%),
        var(--bg);
}

/* Page enter transition */
.page-enter {
    opacity: 1;
    transform: none;
    transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}
html.js .page-enter:not(.is-entered) {
    opacity: 0;
    transform: translateY(12px);
}
.page-enter.is-entered { opacity: 1; transform: none; }

.page-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Topbar enhancements */
.topbar-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.35;
    max-width: 520px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar.is-scrolled {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    background: rgba(238, 241, 246, 0.97);
}

/* Compact page banner (inner pages) */
.page-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    padding: var(--space-5) var(--space-6);
    margin-bottom: var(--space-6);
    background: linear-gradient(135deg, rgba(22, 58, 122, 0.06) 0%, rgba(201, 162, 39, 0.05) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow-xs);
    flex-wrap: wrap;
}
.page-banner-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-dark);
    margin-bottom: var(--space-1);
}
.page-banner-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.page-banner-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Reveal scale variant */
.reveal-scale {
    opacity: 1;
    transform: none;
    transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-spring);
}
html.js .reveal-scale:not(.is-visible) {
    opacity: 0;
    transform: scale(0.96) translateY(16px);
}
.reveal-scale.is-visible { opacity: 1; transform: none; }

/* Extended stagger (up to 12 children) */
.reveal-stagger.is-visible > *:nth-child(9)  { transition-delay: 0.36s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(10) { transition-delay: 0.40s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(11) { transition-delay: 0.44s; opacity: 1; transform: none; }
.reveal-stagger.is-visible > *:nth-child(12) { transition-delay: 0.48s; opacity: 1; transform: none; }

/* Table row progressive reveal */
.table-row-reveal {
    opacity: 1;
    transform: none;
    transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
    transition-delay: var(--row-delay, 0s);
}
html.js .table-row-reveal:not(.is-visible) {
    opacity: 0;
    transform: translateX(-8px);
}
.table-row-reveal.is-visible { opacity: 1; transform: none; }

/* Enhanced cards & panels */
.panel, .card {
    position: relative;
    overflow: hidden;
}
.panel::after, .card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.panel:hover, .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.panel, .card { transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out); }

.card-header h2, .panel-header h2 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-dark);
}

/* Filter / toolbar bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    background: rgba(22, 58, 122, 0.03);
    border-bottom: 1px solid var(--border);
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }
.filter-bar .form-group.actions { 
    flex: 0; 
    min-width: auto; 
    display: flex; 
    gap: var(--space-3); 
    align-items: center;
}

/* Data table wrapper */
.data-table .table-responsive { border-radius: 0; }
.data-table table tbody tr:last-child td { border-bottom: none; }

/* Detail list (profile pages) */
.detail-list { display: flex; flex-direction: column; gap: 0; }
.detail-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    align-items: baseline;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}
.detail-value { color: var(--text); word-break: break-word; }

/* Profile card */
.profile-card .card-body { padding-top: var(--space-4); }
.profile-header {
    text-align: center;
    padding: var(--space-4) var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(22, 58, 122, 0.04) 0%, transparent 100%);
}
.profile-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin: 0 auto var(--space-3);
    font-size: 1.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--accent-dark));
    color: #fff;
    box-shadow: 0 8px 24px rgba(22, 58, 122, 0.25);
    border: 3px solid #fff;
}
.profile-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: var(--space-1);
}
.profile-id {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Unit list (ranks page) */
.unit-list { display: flex; flex-direction: column; }
.unit-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}
.unit-list-item:last-child { border-bottom: none; }
.unit-list-item:hover { background: rgba(22, 58, 122, 0.02); margin: 0 calc(var(--space-6) * -1); padding-left: var(--space-6); padding-right: var(--space-6); }

/* Metrics row (enhanced stats) */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
.metric-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5) var(--space-6);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform 0.35s var(--ease-out), box-shadow 0.35s;
}
.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary);
}
.metric-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.metric-card.success::before { background: var(--success); }
.metric-card.accent::before { background: var(--accent); }
.metric-card.rotc::before { background: var(--rotc); }
.metric-card.cwts::before { background: var(--cwts); }
.metric-card.lts::before { background: var(--lts); }
.metric-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.03em;
    line-height: 1;
}
.metric-label {
    font-size: 0.88rem;
    color: var(--primary);
    margin-top: var(--space-2);
    font-weight: 600;
}

/* Info callout */
.info-callout {
    padding: var(--space-3) var(--space-4);
    background: rgba(37, 99, 184, 0.06);
    border: 1px solid rgba(37, 99, 184, 0.12);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.55;
    margin-bottom: var(--space-3);
}
.info-callout p { margin-bottom: var(--space-3); }
.info-callout p:last-child { margin-bottom: 0; }

/* Centered card content */
.card-body.centered { text-align: center; }
.card-body.divider-top { border-top: 1px solid var(--border); }

/* Fingerprint display */
.fingerprint-display {
    width: 96px;
    height: 96px;
    margin: var(--space-5) auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(22, 58, 122, 0.06);
    color: var(--primary);
    border: 2px dashed var(--border-strong);
}
.fingerprint-display svg { width: 52px; height: 52px; }

.biometric-enrolled-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid rgba(26, 122, 82, .25);
    border-left: 4px solid var(--success);
    border-radius: var(--radius-sm);
    background: #ecfdf5;
    color: #065f46;
}
.biometric-enrolled-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(26, 122, 82, .12);
    color: var(--success);
}
.biometric-enrolled-icon svg { width: 27px; height: 27px; }
.biometric-enrolled-card strong,
.biometric-enrolled-card span { display: block; }
.biometric-enrolled-card span { margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; letter-spacing: .05em; }

/* Enhanced tabs */
.tabs {
    position: relative;
    background: rgba(22, 58, 122, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-1);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-6);
    gap: var(--space-1);
}
.tab {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-xs);
    border-bottom: none;
    margin-bottom: 0;
    transition: all 0.25s var(--ease-out);
}
.tab:hover { background: rgba(238, 241, 246, 0.7); color: var(--primary); }
.tab.active {
    background: var(--bg-elevated);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
    border-bottom: none;
}

/* Button press feedback */
.btn.is-pressed { transform: scale(0.97); }

/* Sidebar nav micro-interaction */
.nav-item {
    transform: translateX(0);
}
.nav-item:hover { transform: translateX(3px); }
.nav-item.active { transform: translateX(0); }

/* Official NEMSU seal */
.logo-img, .topbar-seal, .footer-logo, .auth-logo {
    background: transparent;
    object-fit: contain;
}
.footer-logo { opacity: 1; }

/* Enhanced empty state */
.empty-state {
    padding: var(--space-12) var(--space-8);
}
.empty-state-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(22, 58, 122, 0.06);
    color: var(--text-soft);
}
.empty-state-icon svg { width: 36px; height: 36px; opacity: 0.5; }

/* Auth page enhancements */
.auth-page .bg-mesh-auth {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.auth-page .bg-orb { opacity: 0.35; }
.auth-card {
    position: relative;
    z-index: 1;
}
.auth-branding { position: relative; z-index: 1; }

/* Session banner motion */
.session-banner.reveal.is-visible,
.session-banner { animation: none; }
html.js .session-banner:not(.is-visible) {
    opacity: 0;
    transform: translateY(16px);
}
.session-banner.is-visible {
    opacity: 1;
    transform: none;
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

/* Footer enhancement */
.app-footer {
    border-top: 1px solid var(--border);
    background: rgba(228, 233, 240, 0.65);
    border-radius: var(--radius);
    margin: var(--space-4) 0 0;
}

/* Form invalid state */
.form-control.is-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 4px rgba(196, 43, 43, 0.1) !important;
}

/* Live20R verified state: use NEMSU green for a successful fingerprint match. */
.biometric-device.success .biometric-sensor-glass {
    border-color: rgba(94, 234, 155, .9);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, .82),
        0 0 0 7px rgba(26, 122, 82, .28),
        0 0 28px rgba(74, 222, 128, .55);
}
.biometric-device.success .biometric-fingerprint-mark g {
    stroke: #4ade80 !important;
}
.biometric-device.success .biometric-ring {
    border-color: #4ade80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, .2),
        0 0 22px rgba(74, 222, 128, .7);
    animation: biometricVerifiedPulse 1.2s ease-out infinite;
}
.biometric-device.success .biometric-scan-beam {
    background: linear-gradient(90deg, transparent, #86efac, transparent);
    box-shadow: 0 0 14px #4ade80;
    animation: none;
    opacity: .95;
}
.biometric-device.success .biometric-prompt {
    color: #86efac;
    font-weight: 700;
}
@keyframes biometricVerifiedPulse {
    0%, 100% { transform: scale(1); opacity: .8; }
    50% { transform: scale(1.07); opacity: 1; }
}

/* Responsive additions */
@media (max-width: 900px) {
    .topbar-subtitle { display: none; }
    .page-banner { flex-direction: column; align-items: flex-start; }
    .detail-row { grid-template-columns: 1fr; gap: var(--space-1); }
    .nav-item:hover { transform: none; }
}


@media (max-width: 600px) {
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .form-group { min-width: 100%; }
    .page-banner-title { font-size: 1.15rem; }
}

/* ═══════════════════════════════════════════════════════════
   FLOATING MESSAGE WIDGET
   ═══════════════════════════════════════════════════════════ */
.msg-widget {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-3);
}

.msg-toggle {
    width: 58px; height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    box-shadow: 0 6px 24px rgba(22,58,122,0.35), 0 2px 8px rgba(22,58,122,0.2);
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-out);
}
.msg-toggle:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 10px 32px rgba(22,58,122,0.42), 0 4px 12px rgba(22,58,122,0.2);
}
.msg-toggle:active { transform: scale(0.96); }

.msg-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    padding: 0 4px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg);
    line-height: 1;
    animation: badgePop 0.3s var(--ease-spring);
}
@keyframes badgePop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

.msg-panel {
    width: 360px;
    max-height: 540px;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.3) inset;
    display: flex; flex-direction: column;
    overflow: hidden;
    animation: msgPanelIn 0.3s var(--ease-spring);
    transform-origin: bottom right;
}
@keyframes msgPanelIn {
    from { opacity: 0; transform: scale(0.88) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.msg-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-4);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    gap: var(--space-3);
}
.msg-panel-header-left { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.msg-panel-avatar {
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}
.msg-panel-title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.msg-panel-sub   { font-size: 11px; opacity: 0.75; line-height: 1.2; }
.msg-panel-header-actions { display: flex; gap: var(--space-1); flex-shrink: 0; }
.msg-icon-btn {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}
.msg-icon-btn:hover { background: rgba(255,255,255,0.22); }

.msg-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.msg-search-wrap {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}
.msg-search {
    flex: 1; border: none; background: transparent;
    font-size: 13px; color: var(--text);
    outline: none; font-family: var(--font);
}
.msg-search::placeholder { color: var(--text-soft); }

.msg-tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}
.msg-tab {
    flex: 1; padding: var(--space-2) var(--space-3);
    background: none; border: none; cursor: pointer;
    font-size: 13px; font-weight: 500; color: var(--text-muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.msg-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.msg-list {
    flex: 1; overflow-y: auto;
    max-height: 300px;
}
.msg-conv-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.msg-conv-item:hover { background: rgba(22,58,122,0.04); }
.msg-conv-item.unread { background: rgba(22,58,122,0.05); }
.msg-conv-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff; font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.msg-conv-info { flex: 1; min-width: 0; }
.msg-conv-name { font-size: 13px; font-weight: 600; color: var(--text); }
.msg-conv-role { font-size: 10px; color: var(--text-soft); font-weight: 400; }
.msg-conv-preview {
    font-size: 12px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 160px;
}
.msg-conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.msg-conv-time { font-size: 10px; color: var(--text-soft); }
.msg-unread-dot {
    background: var(--primary); color: #fff;
    font-size: 10px; font-weight: 700;
    min-width: 16px; height: 16px; border-radius: 8px;
    padding: 0 4px; display: flex; align-items: center; justify-content: center;
}

.msg-thread-wrap {
    flex: 1; overflow-y: auto;
    padding: var(--space-3) var(--space-4);
    display: flex; flex-direction: column;
    gap: var(--space-2);
    min-height: 220px; max-height: 320px;
}

.msg-bubble-wrap {
    display: flex; align-items: flex-end; gap: var(--space-2);
}
.msg-bubble-wrap.self { flex-direction: row-reverse; }
.msg-bubble-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--rotc-light), var(--rotc));
    color: #fff; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.msg-bubble {
    max-width: 75%;
}
.msg-bubble-text {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    font-size: 13px; line-height: 1.5; word-break: break-word;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
}
.self .msg-bubble-text {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff; border: none;
    border-radius: var(--radius) var(--radius-xs) var(--radius) var(--radius);
}
.other .msg-bubble-text {
    border-radius: var(--radius-xs) var(--radius) var(--radius) var(--radius);
}
.msg-bubble-time { font-size: 10px; color: var(--text-soft); margin-top: 3px; padding: 0 4px; }
.self .msg-bubble-time { text-align: right; }

.msg-compose {
    display: flex; align-items: flex-end; gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}
.msg-input {
    flex: 1;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    font-family: var(--font);
    font-size: 13px; color: var(--text);
    background: var(--bg-glass-strong);
    resize: none; outline: none;
    line-height: 1.5; min-height: 36px; max-height: 120px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.msg-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(43,85,168,0.12);
}
.msg-input::placeholder { color: var(--text-soft); }
.msg-send-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s var(--ease-spring), box-shadow 0.15s;
}
.msg-send-btn:hover { transform: scale(1.1); box-shadow: 0 4px 12px rgba(22,58,122,0.3); }
.msg-send-btn:active { transform: scale(0.95); }

.msg-loading { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-5) var(--space-4); color: var(--text-muted); font-size: 13px; }
.msg-spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.msg-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--space-3); padding: var(--space-8) var(--space-4);
    text-align: center; color: var(--text-muted); font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════
   COMPLETION TRACKER
   ═══════════════════════════════════════════════════════════ */
.completion-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}
.completion-stat-card {
    background: var(--bg-glass-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex; align-items: center; gap: var(--space-4);
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
}
.completion-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.csc-icon {
    width: 48px; height: 48px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.csc-icon svg { width: 22px; height: 22px; }
.csc-blue   { background: rgba(22,58,122,0.1); color: var(--primary); }
.csc-green  { background: rgba(26,122,82,0.1); color: var(--success); }
.csc-amber  { background: rgba(201,162,39,0.12); color: var(--warning); }
.csc-purple { background: rgba(107,59,168,0.1); color: #6b3ba8; }
.csc-content { flex: 1; }
.csc-value { display: block; font-size: 2rem; font-weight: 800; font-family: var(--font-display); line-height: 1; color: var(--text); }
.csc-label { font-size: 12px; color: var(--text-muted); }

.csc-ring-wrap { position: absolute; right: var(--space-4); top: 50%; transform: translateY(-50%); opacity: 0.18; }
.csc-ring { width: 64px; height: 64px; transform: rotate(-90deg); }
.csc-ring-bg   { fill: none; stroke: var(--border-strong); stroke-width: 3; }
.csc-ring-fill { fill: none; stroke: #6b3ba8; stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray 1s var(--ease-out); }

.completion-pills {
    display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.completion-pill {
    padding: var(--space-1) var(--space-3);
    border-radius: 20px;
    font-size: 12px; font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-muted); text-decoration: none;
    transition: all 0.15s;
}
.completion-pill:hover, .completion-pill.active { border-color: var(--primary); color: var(--primary); background: rgba(22,58,122,0.06); }
.pill-green.active  { border-color: var(--success); color: var(--success); background: rgba(26,122,82,0.07); }
.pill-amber.active  { border-color: var(--warning); color: var(--accent-dark); background: rgba(201,162,39,0.08); }
.pill-red.active    { border-color: var(--danger); color: var(--danger); background: rgba(196,43,43,0.07); }

.completion-bar-wrap { display: flex; align-items: center; gap: var(--space-2); }
.completion-bar {
    flex: 1; height: 8px; background: var(--border);
    border-radius: 4px; overflow: hidden; min-width: 100px;
}
.completion-bar-fill { height: 100%; border-radius: 4px; transition: width 0.8s var(--ease-out); }
.completion-pct { font-size: 13px; font-weight: 700; min-width: 36px; text-align: right; }

.student-cell { display: flex; align-items: center; gap: var(--space-3); }
.student-avatar-sm {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   AUDIT LOG
   ═══════════════════════════════════════════════════════════ */
.audit-stats {
    display: flex; align-items: center;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-4);
    gap: 0;
    flex-wrap: wrap;
}
.audit-stat { flex: 1; min-width: 120px; text-align: center; padding: var(--space-2) var(--space-4); }
.audit-stat-sep { width: 1px; height: 40px; background: var(--border-strong); }
.audit-stat-val { display: block; font-size: 1.8rem; font-weight: 800; font-family: var(--font-display); color: var(--text); }
.audit-stat-label { font-size: 12px; color: var(--text-muted); }

.audit-timeline { display: flex; flex-direction: column; gap: 0; }
.audit-date-marker {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-4) 0 var(--space-2);
    color: var(--text-muted); font-size: 12px; font-weight: 600;
    letter-spacing: 0.06em; text-transform: uppercase;
}
.audit-date-marker::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.audit-entry {
    display: flex; gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius);
    margin-bottom: var(--space-2);
    border-left: 3px solid var(--border);
    background: var(--bg-glass);
    transition: box-shadow 0.15s, transform 0.15s;
}
.audit-entry:hover { box-shadow: var(--shadow-sm); transform: translateX(2px); }
.audit-cat-create { border-left-color: var(--success); background: rgba(26,122,82,0.04); }
.audit-cat-delete { border-left-color: var(--danger);  background: rgba(196,43,43,0.04); }
.audit-cat-update { border-left-color: var(--warning); background: rgba(201,162,39,0.04); }
.audit-cat-auth   { border-left-color: var(--info);    background: rgba(37,99,184,0.04); }
.audit-cat-read   { border-left-color: var(--text-soft); }

.audit-icon {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; color: var(--text-muted);
    border: 1px solid var(--border);
}
.audit-icon svg { width: 16px; height: 16px; }
.audit-cat-create .audit-icon { background: rgba(26,122,82,0.1); color: var(--success); }
.audit-cat-delete .audit-icon { background: rgba(196,43,43,0.1); color: var(--danger); }
.audit-cat-update .audit-icon { background: rgba(201,162,39,0.1); color: var(--accent-dark); }
.audit-cat-auth   .audit-icon { background: rgba(37,99,184,0.1); color: var(--info); }

.audit-body { flex: 1; min-width: 0; }
.audit-meta { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: 4px; }
.audit-action { font-size: 14px; font-weight: 600; color: var(--text); }
.audit-user { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }
.audit-role { color: var(--text-soft); }
.audit-entity { display: flex; align-items: center; }
.audit-details { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 6px; }
.audit-footer { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.audit-time, .audit-ip {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--text-soft);
}

/* ═══════════════════════════════════════════════════════════
   BULK IMPORT
   ═══════════════════════════════════════════════════════════ */
.import-layout { display: grid; grid-template-columns: 1fr 340px; gap: var(--space-5); align-items: start; }
@media (max-width: 900px) { .import-layout { grid-template-columns: 1fr; } }

.import-dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-12) var(--space-8);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: rgba(22,58,122,0.02);
    display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
}
.import-dropzone:hover, .import-dropzone.drag-over {
    border-color: var(--primary-light);
    background: rgba(22,58,122,0.05);
}
.import-dropzone.has-file { border-color: var(--success); background: rgba(26,122,82,0.04); }
.dropzone-icon { color: var(--text-soft); }
.import-dropzone h3 { font-size: 16px; font-weight: 600; color: var(--text); }
.import-dropzone p  { font-size: 13px; color: var(--text-muted); }
.dropzone-selected {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: 13px; color: var(--success); font-weight: 500;
    background: rgba(26,122,82,0.08); padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
}

.import-rules {
    margin: var(--space-5) 0;
    padding: var(--space-4) var(--space-5);
    background: rgba(22,58,122,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.import-rules h4 { font-size: 13px; font-weight: 600; margin-bottom: var(--space-2); }
.import-rules ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.import-rules li { font-size: 13px; color: var(--text-muted); padding-left: 16px; position: relative; }
.import-rules li::before { content: '✓'; position: absolute; left: 0; color: var(--success); font-weight: 700; }

.import-actions { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-5); flex-wrap: wrap; }
.import-confirm-form { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }

.import-result-cards { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.import-result-card {
    flex: 1; min-width: 160px;
    padding: var(--space-5);
    border-radius: var(--radius);
    display: flex; align-items: center; gap: var(--space-4);
    border: 1px solid transparent;
}
.irc-green { background: rgba(26,122,82,0.1); border-color: rgba(26,122,82,0.2); }
.irc-amber { background: rgba(201,162,39,0.1); border-color: rgba(201,162,39,0.2); }
.irc-icon  { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.irc-green .irc-icon { color: var(--success); }
.irc-amber .irc-icon { color: var(--accent-dark); }
.irc-val   { display: block; font-size: 2rem; font-weight: 800; font-family: var(--font-display); }
.irc-label { font-size: 12px; color: var(--text-muted); }

.import-errors {
    background: rgba(196,43,43,0.05);
    border: 1px solid rgba(196,43,43,0.15);
    border-radius: var(--radius); padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-5);
}
.import-errors h4 { font-size: 13px; font-weight: 600; color: var(--danger); margin-bottom: var(--space-2); }
.import-errors ul { list-style: disc; padding-left: var(--space-5); }
.import-errors li { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }

.column-ref-list { display: flex; flex-direction: column; gap: 6px; }
.col-ref-item {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 5px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.col-ref-item:last-child { border-bottom: none; }
.col-ref-item code { font-size: 11px; background: rgba(22,58,122,0.07); padding: 1px 5px; border-radius: 4px; color: var(--primary-dark); font-family: monospace; flex-shrink: 0; }
.col-ref-desc { flex: 1; font-size: 12px; color: var(--text-muted); min-width: 80px; }

/* ═══════════════════════════════════════════════════════════
   STUDENTS AUTO-FLAG + AT-RISK STATES
   ═══════════════════════════════════════════════════════════ */
.flag-result-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius); padding: var(--space-4) var(--space-5);
    margin-top: var(--space-4); max-height: 300px; overflow-y: auto;
}
.flag-result-item {
    display: flex; align-items: flex-start; gap: var(--space-3);
    padding: var(--space-3) 0; border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.flag-result-item:last-child { border-bottom: none; }
.flag-icon { color: var(--danger); flex-shrink: 0; margin-top: 2px; }
.flag-detail { flex: 1; }
.flag-name   { font-weight: 600; }
.flag-reason { color: var(--text-muted); font-size: 12px; }

.badge-dropped  { background: rgba(196,43,43,0.12); color: var(--danger); }
.badge-at-risk  { background: rgba(201,162,39,0.12); color: var(--accent-dark); }
.badge-completed { background: rgba(26,122,82,0.12); color: var(--success); }

/* Auto-flag loader overlay */
.flag-loading-overlay {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(15,26,51,0.5);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
}
.flag-loading-box {
    background: var(--bg-glass-strong); border-radius: var(--radius-lg);
    padding: var(--space-10); text-align: center;
    box-shadow: var(--shadow-lg); min-width: 280px;
}
.flag-loading-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border-strong);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-4);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   MISC HELPER CLASSES
   ═══════════════════════════════════════════════════════════ */
.d-block { display: block; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.header-actions { display: flex; align-items: center; gap: var(--space-2); }

@media (max-width: 600px) {
    .msg-panel { width: calc(100vw - 32px); }
    .completion-summary-grid { grid-template-columns: 1fr 1fr; }
    .audit-stats { flex-direction: column; gap: var(--space-2); }
    .audit-stat-sep { width: 100%; height: 1px; }
}

/* Sidebar count badge (e.g. pending trainee registrations) */
.nav-count {
    margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px;
    background: var(--danger); color: #fff; font-size: 0.7rem; font-weight: 700; text-align: center;
}

/* A–Z jump bar (Personnel directory) */
.letter-jump {
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: var(--space-3) var(--space-6);
}
.letter-jump a {
    min-width: 28px; padding: 3px 6px; border-radius: 6px; text-align: center;
    font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-decoration: none;
}
.letter-jump a:hover { background: var(--bg); color: var(--primary); }
.letter-jump a.active { background: var(--primary); color: #fff; }

/* Export menu (Reports) */
.export-menu { position: relative; }
.export-menu > summary { list-style: none; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu-list {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 210px;
    display: flex; flex-direction: column; padding: 6px;
    background: var(--bg-elevated); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
.export-menu-list a,
.export-menu-list button {
    display: block; width: 100%; padding: 9px 12px; border: none; border-radius: var(--radius-xs);
    background: none; color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 500;
    text-align: left; text-decoration: none; cursor: pointer;
}
.export-menu-list a:hover,
.export-menu-list button:hover { background: var(--border); }
/* Keep the open menu above the report cards that follow the filter card. */
.card:has(.export-menu) { position: relative; z-index: 20; overflow: visible; }
.card:has(.export-menu) .filter-bar { overflow: visible; }

/* ── Report charts ── */
.metric-card.danger::before { background: var(--danger); }
.rate-bars { display: flex; flex-direction: column; gap: var(--space-4); }
.rate-bar-row {
    display: grid; grid-template-columns: 64px minmax(0, 1fr) 52px; align-items: center;
    column-gap: var(--space-3); row-gap: 2px;
}
.rate-bar-row.compact { grid-template-columns: minmax(0, 1fr) 52px; }
.rate-bar-track { height: 10px; background: var(--border); border-radius: 0 4px 4px 0; overflow: hidden; }
.rate-bar-fill { display: block; height: 100%; background: var(--chart-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.rate-bar-value { font-weight: 700; font-size: 0.9rem; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.rate-bar-meta { grid-column: 2 / 4; font-size: 0.75rem; color: var(--text-muted); }

.session-chart { position: relative; height: 200px; padding: 0 0 24px 40px; }
.session-chart-grid {
    position: absolute; inset: 0 0 24px 40px; display: flex; flex-direction: column; justify-content: space-between;
    pointer-events: none;
}
.session-chart-grid span { position: relative; display: block; height: 0; border-top: 1px solid var(--border); }
.session-chart-grid em {
    position: absolute; right: calc(100% + 8px); top: -8px;
    font-size: 0.68rem; font-style: normal; color: var(--text-soft); font-variant-numeric: tabular-nums;
}
.session-chart-cols { position: relative; height: 100%; display: flex; align-items: flex-end; gap: 6px; }
.session-chart-col {
    position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center;
    text-decoration: none; border-radius: 4px; outline-offset: 2px;
}
.session-chart-col:hover { background: rgba(127, 140, 170, 0.08); }
.session-chart-bar { width: 100%; max-width: 24px; background: var(--chart-1); border-radius: 4px 4px 0 0; }
.session-chart-x {
    position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%);
    font-size: 0.66rem; color: var(--text-soft); white-space: nowrap;
}
.session-chart-col::after {
    content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    padding: 6px 10px; border-radius: var(--radius-xs); background: var(--text); color: var(--bg-elevated);
    font-size: 0.72rem; font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none;
    transition: opacity 0.15s; z-index: 5;
}
.session-chart-col:hover::after,
.session-chart-col:focus-visible::after { opacity: 1; }
.session-chart-cols .session-chart-col:first-child::after { left: 0; transform: none; }
.session-chart-cols .session-chart-col:last-child::after { left: auto; right: 0; transform: none; }

.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li + li { border-top: 1px solid var(--border); }
.attention-list a {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-5);
    color: inherit; text-decoration: none;
}
.attention-list a:hover { background: rgba(127, 140, 170, 0.06); }
.attention-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.attention-name small { color: var(--text-muted); font-size: 0.75rem; }
.attention-meta { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

@media print {
    .session-chart-col::after { display: none; }
}

/* Shown in place of the reply box when a trainee opens a thread they cannot answer. */
.msg-readonly-note {
    margin: 0; padding: 12px 16px; border-top: 1px solid var(--border);
    font-size: 0.78rem; color: var(--text-muted); text-align: center; background: var(--bg-elevated);
}
.msg-readonly-note[hidden] { display: none; }

/* ═══ Layout polish: one spacing rhythm and consistent button arrangement ═══ */

/* overflow-x: hidden made .main-wrap a scroll container, so the sticky topbar
   offset itself inside it (overlapping the page) instead of pinning to the window. */
.main-wrap { overflow-x: clip; }

/* Sections in a page stack are spaced only by the stack's gap. */
.page-stack.page-stack > * { margin-top: 0; margin-bottom: 0; } /* doubled class outranks later per-component margins (features.css) */
.page-stack > .modal-overlay { margin: 0; }

/* Card headers: title left, actions right, same-size buttons with even gaps. */
.card-header, .panel-header { gap: var(--space-3); flex-wrap: wrap; }
.card-header > div:last-child:not(:first-child),
.panel-header > div:last-child:not(:first-child) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.card-header .btn, .panel-header .btn { min-height: 36px; padding: 0 14px; font-size: 0.8rem; }
.card-header .btn svg, .panel-header .btn svg { width: 15px; height: 15px; }

/* Filter bars: inputs, selects and buttons share one height. */
.filter-bar { gap: var(--space-3); padding: var(--space-4) var(--space-5); align-items: flex-end; }
.filter-bar .form-control { height: 40px; padding-top: 0; padding-bottom: 0; }
.filter-bar .btn { height: 40px; padding: 0 18px; flex-shrink: 0; }
.filter-bar > .btn, .filter-bar > a.btn { align-self: flex-end; }

/* Table rows: action buttons stay on one line with even spacing. */
td:has(> .btn), td:has(> form > .btn) { white-space: nowrap; }
td > .btn + .btn, td > .btn + form, td > form + .btn, td > form + form { margin-left: 6px; }
td > form { display: inline-flex; vertical-align: middle; }
td .btn-sm { min-height: 32px; padding: 0 12px; }

/* Short labels never break mid-word. */
.badge { white-space: nowrap; }
td > strong:only-child { white-space: nowrap; }

/* Pill filters under a filter bar get the same side padding as the bar. */
.completion-pills, .filter-pills { gap: var(--space-2); }

/* Form actions: a right-aligned row separated from the fields. */
.form-actions {
    grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center;
    gap: var(--space-3); margin-top: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--border);
}
.form-actions .form-hint { margin: 0 auto 0 0; }
.modal-footer { gap: var(--space-3); }

/* Sidebar: tighter rows so every section fits without scrolling on a laptop screen. */
.nav-item { padding: 7px 12px; gap: 10px; margin-bottom: 2px; }
.nav-icon { width: 30px; height: 30px; min-width: 30px; max-width: 30px; min-height: 30px; max-height: 30px; }
.nav-icon svg { width: 16px !important; height: 16px !important; }
.nav-section-label { padding: var(--space-4) var(--space-3) var(--space-2); }
.sidebar-nav > .nav-section-label:first-child { padding-top: var(--space-2); }

@media (max-width: 600px) {
    .filter-bar .form-group { min-width: 100%; }
    .filter-bar .btn { flex: 1; }
    .card-header > div:last-child:not(:first-child),
    .panel-header > div:last-child:not(:first-child) { width: 100%; }
    .form-actions .btn { flex: 1; }
}

.settings-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-1) var(--space-6); max-width: 880px; }
.settings-form .form-group { margin-bottom: var(--space-3); }

/* Tables: slightly tighter columns so rows with badges and action buttons fit without scrolling. */
th, td { padding-left: 14px; padding-right: 14px; }
th:first-child, td:first-child { padding-left: var(--space-5); }
th:last-child, td:last-child { padding-right: var(--space-5); }
@media (max-width: 600px) {
    .filter-bar .form-group.actions { min-width: 100%; flex: 1 1 100%; }
    .filter-bar .form-group.actions .btn { flex: 1; }
}

/* Consecutive two-column rows need the same gap between them as within them. */
.content-grid:not(:last-child) { margin-bottom: var(--space-6); }
.dashboard-page .content-grid:not(:last-child) { margin-bottom: 18px; }
.dashboard-page .dashboard-hero { margin-bottom: 24px; }
.dashboard-page .dash-toolbar { margin-top: 0; }
.dashboard-page .bento-grid { margin-bottom: 18px; }

/* Past-session attendance record: status filter tabs + search above the full trainee list. */
.record-filter-bar { align-items: center; justify-content: space-between; }
.record-filter-bar .completion-pills { margin: 0; padding: 0; border: 0; background: none; flex-wrap: wrap; }
button.completion-pill { font: inherit; font-size: 0.8rem; cursor: pointer; }
.record-search { flex: 0 1 280px; min-width: 200px; }
.record-pill-attended.active { border-color: var(--success); color: var(--success); background: color-mix(in srgb, var(--success) 10%, transparent); }
.record-pill-late.active { border-color: var(--warning); color: #8a6d12; background: color-mix(in srgb, var(--warning) 14%, transparent); }
.record-pill-absent.active { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.attendance-record tr[data-status="absent"] td { background: color-mix(in srgb, var(--danger) 3%, transparent); }
.record-name { color: inherit; font-weight: 600; text-decoration: none; }
.record-name:hover { color: var(--primary); text-decoration: underline; }
.attendance-record tbody tr[hidden] { display: none; }
button.completion-pill:not(.active) { background: transparent; }
