:root {
    --bg: #030305;
    --bg-elevated: #0a0a0f;
    --bg-card: rgba(255,255,255,0.035);
    --bg-card-solid: #0e0e14;
    --bg-hover: rgba(255,255,255,0.05);
    --glass: rgba(255,255,255,0.04);
    --border: rgba(255,255,255,0.06);
    --border-strong: rgba(255,255,255,0.11);
    --text: #fafafa;
    --text-muted: #94949e;
    --text-dim: #48484f;
    --accent: #7c83ff;
    --accent-bright: #a8aeff;
    --accent-glow: rgba(124,131,255,0.4);
    --accent-soft: rgba(124,131,255,0.1);
    --cyan: #22d3ee;
    --success: #34d399;
    --success-soft: rgba(52,211,153,0.1);
    --danger: #fb7185;
    --danger-soft: rgba(251,113,133,0.1);
    --warn: #fbbf24;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --nav-h: 72px;
    --top-h: 56px;
    --font: 'Vazirmatn', system-ui, sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.mesh-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
}

/* Ambient background */
.ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.orb-a {
    width: 320px;
    height: 320px;
    background: rgba(99,102,241,0.18);
    top: -80px;
    left: -60px;
    animation: floatA 18s ease-in-out infinite;
}

.orb-b {
    width: 280px;
    height: 280px;
    background: rgba(168,85,247,0.1);
    bottom: 120px;
    right: -80px;
    animation: floatB 22s ease-in-out infinite;
}

.orb-c {
    width: 200px;
    height: 200px;
    background: rgba(34,211,238,0.08);
    top: 40%;
    left: 50%;
    animation: floatA 26s ease-in-out infinite reverse;
}

@keyframes floatA {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(40px, 30px); }
}

@keyframes floatB {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, -20px); }
}

.app-shell {
    position: relative;
    z-index: 1;
    min-height: 100dvh;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

/* Top bar */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(5,5,8,0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    height: var(--top-h);
}

.top-bar-inner {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.brand-mark {
    width: 36px;
    height: 36px;
    background: var(--accent-soft);
    border: 1px solid rgba(129,140,248,0.25);
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: var(--accent-bright);
}

.brand-text { font-weight: 700; font-size: 16px; letter-spacing: -0.03em; }
.brand-accent { color: var(--accent-bright); font-weight: 800; }

/* Main */
.main-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 20px 32px;
}

.main-content > * {
    animation: fadeUp 0.5s var(--ease) backwards;
}

.main-content > *:nth-child(1) { animation-delay: 0.02s; }
.main-content > *:nth-child(2) { animation-delay: 0.06s; }
.main-content > *:nth-child(3) { animation-delay: 0.1s; }
.main-content > *:nth-child(4) { animation-delay: 0.14s; }
.main-content > *:nth-child(5) { animation-delay: 0.18s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

.page-header { margin-bottom: 28px; }
.eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-bright);
    margin-bottom: 8px;
    opacity: 0.85;
}
.page-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.15;
}
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 12px;
}

.section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 32px 0 14px;
    padding-right: 4px;
}

/* Hero dashboard */
.hero-card {
    position: relative;
    padding: 28px 24px;
    border-radius: var(--radius-xl);
    background: var(--bg-card-solid);
    border: 1px solid var(--border-strong);
    margin-bottom: 20px;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}

.hero-glow {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 140px;
    height: 140px;
    background: var(--accent-glow);
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0.4;
}

.hero-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.hero-value {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent-bright) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-meta {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.hero-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.hero-chip strong { color: var(--text); }

/* Cards */
.card {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color 0.25s, transform 0.25s var(--ease);
}

.card.glass {
    background: linear-gradient(145deg, rgba(14,14,20,0.95), rgba(14,14,20,0.7));
    backdrop-filter: blur(12px);
}

.card:hover { border-color: var(--border-strong); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }

/* Stats */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    position: relative;
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    overflow: hidden;
    transition: transform 0.25s var(--ease), border-color 0.25s;
}

.stat-card:active { transform: scale(0.97); }

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: var(--accent-soft);
    border-radius: 50%;
    filter: blur(30px);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::after { opacity: 1; }

.stat-card.accent {
    border-color: rgba(129,140,248,0.3);
    background: linear-gradient(145deg, var(--bg-card-solid) 0%, rgba(129,140,248,0.06) 100%);
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--accent-soft);
    display: grid;
    place-items: center;
    margin-bottom: 12px;
    color: var(--accent-bright);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

/* Pills */
.pill {
    display: inline-flex;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }

/* Pass bar */
.pass-bar {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--bg-hover);
    margin-bottom: 12px;
}
.pass-segment { transition: width 0.8s var(--ease); }
.pass-segment.pass { background: var(--success); }
.pass-segment.fail { background: var(--danger); }
.pass-legend { display: flex; gap: 20px; font-size: 13px; color: var(--text-muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.dot.pass { background: var(--success); }
.dot.fail { background: var(--danger); }

/* Charts */
.chart-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.chart-label { width: 44px; font-size: 11px; color: var(--text-dim); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-track { flex: 1; height: 8px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; }
.chart-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-bright));
    border-radius: 999px;
    transition: width 0.9s var(--ease);
    box-shadow: 0 0 12px var(--accent-glow);
}
.chart-count { width: 28px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Lists */
.list { list-style: none; }
.list-item { border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 4px;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-sm);
    transition: background 0.2s, transform 0.15s;
}
.list-link:active { transform: scale(0.99); background: var(--bg-hover); }
.list-main { flex: 1; min-width: 0; }
.list-main strong { display: block; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.list-main small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.rank {
    width: 32px;
    height: 32px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    flex-shrink: 0;
}

.list-item:nth-child(1) .rank { background: rgba(251,191,36,0.15); color: var(--warn); border-color: rgba(251,191,36,0.3); }
.list-item:nth-child(2) .rank { background: rgba(161,161,170,0.12); color: #d4d4d8; }
.list-item:nth-child(3) .rank { background: rgba(180,83,9,0.12); color: #fb923c; }

.score-badge {
    font-size: 15px;
    font-weight: 800;
    color: var(--accent-bright);
    font-variant-numeric: tabular-nums;
    padding: 4px 10px;
    background: var(--accent-soft);
    border-radius: 8px;
}

.chevron { width: 16px; height: 16px; fill: var(--text-dim); flex-shrink: 0; }
.empty-state { padding: 32px 16px; text-align: center; color: var(--text-dim); font-size: 14px; }

/* Forms */
.input, .select {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus, .select:focus {
    border-color: rgba(129,140,248,0.5);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-sm { padding: 10px 12px; font-size: 14px; width: 88px; }

.search-bar, .filter-bar, .add-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s var(--ease), opacity 0.15s, box-shadow 0.2s;
    white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 6px 28px var(--accent-glow); }
.btn-glass {
    background: var(--glass);
    color: var(--text-muted);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-sm { padding: 9px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.link-sm { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 600; }

/* Upload */
.upload-grid { display: grid; gap: 14px; margin-bottom: 8px; }
.upload-card {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    border-top: 2px solid var(--accent, var(--accent));
    transition: border-color 0.25s, transform 0.2s;
}
.upload-card:active { transform: scale(0.99); }
.upload-card-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.upload-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: block; }
.drop-zone {
    display: block;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center;
    margin: 16px 0;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    background: var(--bg-hover);
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.drop-text { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.hint { font-size: 12px; color: var(--text-dim); margin: 8px 0 12px; line-height: 1.6; }

/* Profile */
.grade-hero {
    text-align: center;
    padding: 36px 24px;
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card-solid);
    position: relative;
    overflow: hidden;
}
.grade-hero.passed { border-color: rgba(74,222,128,0.25); }
.grade-hero.failed { border-color: rgba(248,113,113,0.25); }
.grade-hero-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.grade-hero-value {
    display: block;
    font-size: 64px;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
    background: linear-gradient(180deg, var(--text), var(--accent-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.grade-hero-max { display: block; font-size: 15px; color: var(--text-dim); margin: 6px 0 16px; }

.summary-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.summary-chip {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
}
.summary-chip span { display: block; font-size: 10px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.summary-chip strong { display: block; font-size: 20px; font-weight: 800; margin: 4px 0; font-variant-numeric: tabular-nums; }
.summary-chip small { font-size: 10px; color: var(--text-dim); }

.progress-card {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 10px;
}
.progress-card-lg { padding: 20px; }
.progress-head { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.progress-score { color: var(--text-muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.progress-track { height: 8px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-bright));
    border-radius: 999px;
    transition: width 1s var(--ease);
    box-shadow: 0 0 16px var(--accent-glow);
}
.progress-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); font-weight: 600; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: right;
    padding: 12px 10px;
    color: var(--text-dim);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
.data-table a { color: var(--accent-bright); text-decoration: none; font-weight: 600; }
.data-table .num { font-variant-numeric: tabular-nums; font-weight: 700; }
.data-table .danger { color: var(--danger); }

/* Canvas / Automate / Babysit */
.canvas-grid { display: grid; gap: 16px; }
.canvas-panel {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.canvas-panel.full { grid-column: 1 / -1; }
.panel-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.panel-caption { font-size: 11px; color: var(--text-dim); margin-bottom: 16px; }
.canvas-chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; }
.canvas-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.canvas-bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(180deg, var(--accent-bright), var(--accent));
    border-radius: 8px 8px 4px 4px;
    min-height: 4px;
    transition: height 0.8s var(--ease);
    box-shadow: 0 0 20px var(--accent-glow);
}
.canvas-bar-label { font-size: 9px; color: var(--text-dim); font-weight: 600; }

.compare-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 13px; }
.compare-row span:first-child { width: 100px; color: var(--text-muted); font-weight: 600; }
.compare-track { flex: 1; height: 10px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; }
.compare-fill { height: 100%; background: var(--text-dim); border-radius: 999px; transition: width 0.8s var(--ease); }
.compare-fill.accent { background: linear-gradient(90deg, var(--accent), var(--accent-bright)); box-shadow: 0 0 12px var(--accent-glow); }

.coverage-grid { display: grid; gap: 12px; }
.coverage-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.coverage-name { font-size: 13px; font-weight: 700; }
.coverage-val { font-size: 15px; font-weight: 800; color: var(--accent-bright); }
.coverage-bar { grid-column: 1 / -1; height: 5px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; }
.coverage-bar div { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.8s var(--ease); }

.formula-block p { font-size: 13px; color: var(--text-muted); padding: 8px 0; border-bottom: 1px solid var(--border); }
.formula-total { font-weight: 800; color: var(--text) !important; border: none !important; margin-top: 8px; }

.automate-grid { display: grid; gap: 14px; margin-bottom: 20px; }
.automate-card {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: border-color 0.25s;
}
.automate-card:hover { border-color: rgba(129,140,248,0.3); }
.automate-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.automate-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.6; }

.log-list, .check-list { list-style: none; }
.log-item, .check-item {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.log-time { color: var(--text-dim); font-size: 11px; font-weight: 600; }
.log-action { font-weight: 700; color: var(--accent-bright); }
.log-detail { color: var(--text-muted); flex: 1; min-width: 100%; font-size: 12px; }

.check-item { align-items: flex-start; gap: 14px; }
.check-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.level-ok .check-dot { background: var(--success); box-shadow: 0 0 8px rgba(74,222,128,0.5); }
.level-warn .check-dot { background: var(--warn); }
.level-error .check-dot { background: var(--danger); box-shadow: 0 0 8px rgba(248,113,113,0.5); }
.level-info .check-dot { background: var(--accent); }
.check-body strong { display: block; font-size: 14px; font-weight: 700; }
.check-body span { font-size: 12px; color: var(--text-muted); }

.health-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
}
.health-hero.healthy { border-color: rgba(74,222,128,0.25); }
.health-hero.degraded { border-color: rgba(251,191,36,0.25); }
.health-hero.critical { border-color: rgba(248,113,113,0.25); }

.health-score-ring {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 3px solid var(--bg-hover);
    border-top-color: var(--accent);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    animation: spinSlow 8s linear infinite;
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
.health-score { font-size: 26px; font-weight: 800; }
.health-max { font-size: 11px; color: var(--text-dim); }
.health-status { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.health-time { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.quick-actions { display: grid; gap: 10px; margin-top: 8px; }
.action-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    transition: all 0.25s var(--ease);
}
.action-card::after { content: '←'; color: var(--text-dim); font-size: 16px; }
.action-card:active { transform: scale(0.98); border-color: var(--accent); background: var(--accent-soft); }

.exam-mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.exam-mini {
    padding: 12px 14px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    border-right: 3px solid var(--accent, var(--accent));
    transition: transform 0.2s;
}
.exam-mini:active { transform: scale(0.98); }
.exam-mini-name { display: block; font-size: 12px; font-weight: 700; }
.exam-mini-stat { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.add-student-card { margin-bottom: 16px; }

/* Bottom nav — floating dock */
.bottom-nav {
    position: fixed;
    bottom: calc(12px + var(--safe-bottom));
    left: 16px;
    right: 16px;
    max-width: 420px;
    margin: 0 auto;
    height: var(--nav-h);
    background: rgba(12,12,16,0.88);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border-strong);
    border-radius: 22px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.nav-pill {
    position: absolute;
    top: 8px;
    height: calc(100% - 16px);
    background: var(--accent-soft);
    border: 1px solid rgba(129,140,248,0.2);
    border-radius: 16px;
    transition: transform 0.35s var(--ease-spring), width 0.35s var(--ease-spring);
    pointer-events: none;
    z-index: 0;
}

.nav-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 16px;
    transition: color 0.25s;
    flex: 1;
    min-width: 0;
}

.nav-item.active { color: var(--accent-bright); }
.nav-icon-wrap { display: grid; place-items: center; width: 28px; height: 28px; }
.nav-icon { width: 22px; height: 22px; fill: currentColor; transition: transform 0.25s var(--ease-spring); }
.nav-item.active .nav-icon { transform: scale(1.1); }
.nav-label { letter-spacing: -0.01em; }

/* Tools dock */
.tools-dock {
    display: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 28px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card-solid);
    border: 1px solid var(--border-strong);
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    z-index: 200;
    opacity: 0;
    transition: transform 0.4s var(--ease-spring), opacity 0.3s;
    pointer-events: none;
    max-width: calc(100vw - 40px);
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.list.compact .list-link { padding: 10px 4px; }

/* Empty state */
.empty-hero {
    text-align: center;
    padding: 48px 24px 40px;
    margin-bottom: 24px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(124,131,255,0.06) 0%, var(--bg-card-solid) 60%);
    position: relative;
    overflow: hidden;
}

.empty-orbit {
    width: 88px;
    height: 88px;
    margin: 0 auto 28px;
    position: relative;
}

.orbit-ring {
    position: absolute;
    inset: 0;
    border: 1.5px solid var(--border-strong);
    border-radius: 50%;
    animation: orbitSpin 12s linear infinite;
}

.orbit-ring::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--accent-bright);
    border-radius: 50%;
    box-shadow: 0 0 16px var(--accent-glow);
    transform: translateX(-50%);
}

.orbit-core {
    position: absolute;
    inset: 28px;
    background: var(--accent-soft);
    border: 1px solid rgba(124,131,255,0.3);
    border-radius: 50%;
}

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

.empty-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
}

.empty-desc {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 320px;
    margin: 0 auto 28px;
    line-height: 1.7;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 15px;
    border-radius: 14px;
}

/* Bento grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.bento-grid.bento-compact { grid-template-columns: repeat(3, 1fr); }

.bento {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 16px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: all 0.25s var(--ease);
    min-height: 100px;
}

.bento:active { transform: scale(0.98); }
.bento:hover { border-color: rgba(124,131,255,0.35); background: rgba(124,131,255,0.04); }

.bento-accent {
    border-color: rgba(124,131,255,0.25);
    background: linear-gradient(145deg, var(--bg-card-solid), rgba(124,131,255,0.08));
}

.bento-wide { grid-column: 1 / -1; }

.bento-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-bright);
}

.bento strong { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.bento-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.hero-grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(124,131,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124,131,255,0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.5;
    pointer-events: none;
}

.hero-chip span { color: var(--text-dim); font-weight: 600; margin-left: 4px; }

/* Upload v2 */
.upload-bento { grid-template-columns: repeat(2, 1fr); }

.upload-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 4px;
}

.upload-badge {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
}

.upload-badge.lg { width: 44px; height: 44px; font-size: 16px; border-radius: 13px; }

.upload-card.has-data { border-color: rgba(52,211,153,0.25); }
.upload-card.has-data::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(52,211,153,0.6);
}

.upload-card { position: relative; }

.upload-card-main { padding: 22px; }

.drop-icon { color: var(--text-dim); margin-bottom: 8px; transition: color 0.2s, transform 0.3s var(--ease-spring); }
.drop-zone:hover .drop-icon { color: var(--accent-bright); transform: translateY(-3px); }
.drop-hint { display: block; font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.drop-zone-lg { padding: 36px 20px; }

@media (min-width: 640px) {
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .upload-bento { grid-template-columns: repeat(3, 1fr); }
    .bento-grid { grid-template-columns: repeat(2, 1fr); }
    .search-bar, .filter-bar { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .search-bar .input, .filter-bar .input { flex: 1; min-width: 180px; }
    .search-bar .select, .filter-bar .select { width: auto; min-width: 150px; }
    .add-form { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .add-form .input, .add-form .select { flex: 1; min-width: 120px; }
    .canvas-grid { grid-template-columns: repeat(2, 1fr); }
    .automate-grid { grid-template-columns: repeat(3, 1fr); }
    .bottom-nav { max-width: 480px; }
}

@media (min-width: 900px) {
    .main-content { max-width: 720px; padding-top: 32px; }
    .app-shell { padding-right: 72px; }
    .tools-dock {
        display: flex;
        flex-direction: column;
        gap: 6px;
        position: fixed;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 90;
        padding: 8px;
        background: rgba(12,12,16,0.8);
        backdrop-filter: blur(16px);
        border: 1px solid var(--border);
        border-radius: 16px;
    }
    .dock-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 14px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--text-dim);
        text-decoration: none;
        border-radius: 10px;
        transition: all 0.2s;
    }
    .dock-btn:hover, .dock-btn.active {
        color: var(--accent-bright);
        background: var(--accent-soft);
    }
    .dock-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--text-dim);
    }
    .dock-btn.active .dock-dot {
        background: var(--accent-bright);
        box-shadow: 0 0 8px var(--accent-glow);
    }
}

/* Student portal */
.mode-student .app-shell {
    padding-bottom: calc(var(--safe-bottom) + 24px);
}

.mode-student .main-content {
    max-width: 520px;
    padding: 24px 20px 32px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bos-link {
    font-weight: 700;
    letter-spacing: 0.06em;
}

.student-hero {
    text-align: center;
    padding: 28px 0 32px;
}

/* Portal home */
.portal-hero {
    position: relative;
    text-align: center;
    padding: 8px 0 28px;
    overflow: hidden;
}

.portal-hero-glow {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    height: 160px;
    background: radial-gradient(ellipse, rgba(124,131,255,0.25) 0%, transparent 70%);
    pointer-events: none;
}

.portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-bright);
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--accent-soft);
    border: 1px solid rgba(124,131,255,0.2);
    margin-bottom: 16px;
}

.portal-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(52,211,153,0.6);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

.portal-title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.portal-title-accent {
    display: block;
    background: linear-gradient(135deg, var(--accent-bright), #c084fc, var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.05em;
    margin-top: 4px;
}

.portal-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.75;
    max-width: 340px;
    margin: 0 auto 18px;
}

.portal-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.portal-feature {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.portal-search-card {
    padding: 22px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.portal-search-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.portal-search-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-soft), rgba(168,85,247,0.12));
    color: var(--accent-bright);
    border: 1px solid rgba(124,131,255,0.15);
    flex-shrink: 0;
}

.portal-search-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.portal-search-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.portal-search-card .student-search-form {
    margin-bottom: 0;
}

.portal-contact {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px dashed var(--border);
    text-align: center;
}

.portal-contact-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(52,211,153,0.15);
}

.portal-contact-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 10px;
}

.portal-contact-text strong {
    color: var(--text);
    font-weight: 700;
}

.portal-contact-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--success);
    text-decoration: none;
    letter-spacing: 0.06em;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    background: var(--success-soft);
    border: 1px solid rgba(52,211,153,0.2);
    transition: transform 0.2s var(--ease), box-shadow 0.2s;
    direction: ltr;
}

.portal-contact-phone:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(52,211,153,0.15);
}

.portal-footer {
    text-align: center;
    padding: 20px 0 8px;
    font-size: 0.72rem;
    color: var(--text-dim);
}

.portal-result-wrap {
    margin-bottom: 16px;
}

.portal-result-wrap[hidden] {
    display: none !important;
}

.portal-result-enter {
    animation: portalSlideIn 0.45s var(--ease) both;
}

@keyframes portalSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.portal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.portal-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-bright);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.student-btn .btn-label {
    display: inline;
}

.student-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.brand-student {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.brand-student-main {
    font-size: 0.9rem;
    font-weight: 800;
}

.brand-student-sub {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.student-hero-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border: 1px solid rgba(124,131,255,0.2);
    border-radius: 20px;
    color: var(--accent-bright);
}

.student-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.student-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 320px;
    margin: 0 auto;
}

.student-search-form {
    margin-bottom: 24px;
}

.student-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.student-input-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.student-input {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 16px 20px;
}

.student-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
}

.student-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.student-alert-error {
    background: var(--danger-soft);
    border: 1px solid rgba(251,113,133,0.25);
    color: var(--danger);
}

.student-result {
    animation: fadeUp 0.4s var(--ease) both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.student-card {
    padding: 20px;
    margin-bottom: 20px;
}

.student-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.student-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.student-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.student-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.student-section {
    margin-bottom: 20px;
}

.student-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 700;
}

.student-section-head.present { color: var(--success); }
.student-section-head.absent { color: var(--danger); }

.student-section-head h3 {
    flex: 1;
    font-size: inherit;
    font-weight: inherit;
}

.student-count {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.exam-chip-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.exam-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.exam-chip.present {
    border-color: rgba(52,211,153,0.2);
    background: var(--success-soft);
}

.exam-chip.absent {
    border-color: rgba(251,113,133,0.15);
    background: var(--danger-soft);
    color: var(--text-muted);
}

.exam-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.exam-chip.present .exam-chip-dot {
    background: var(--success);
    box-shadow: 0 0 6px rgba(52,211,153,0.5);
}

.exam-chip.present[style*="--chip-color"] .exam-chip-dot {
    background: var(--chip-color);
    box-shadow: 0 0 6px color-mix(in srgb, var(--chip-color) 50%, transparent);
}

.exam-chip.absent .exam-chip-dot {
    background: var(--danger);
    opacity: 0.6;
}

.student-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.6;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.student-note svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.progress-absent {
    opacity: 0.65;
    border-style: dashed;
}

.absent-tag {
    font-size: 0.7rem;
    color: var(--danger);
    font-weight: 600;
}

@media (min-width: 480px) {
    .student-input-row {
        flex-direction: row;
    }
    .student-input {
        flex: 1;
        text-align: right;
    }
    .student-btn {
        width: auto;
        min-width: 120px;
    }
    .exam-chip-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 640px) {
    .mode-student .main-content {
        padding-top: 40px;
    }
    .portal-title {
        font-size: 1.65rem;
    }
    .portal-subtitle {
        font-size: 0.95rem;
    }
    .student-title {
        font-size: 1.75rem;
    }
    .exam-chip-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Login */
.mode-login .app-shell {
    padding-bottom: 0;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-login .main-content {
    width: 100%;
    max-width: 400px;
    padding: 24px 20px;
}

.login-wrap {
    width: 100%;
}

.login-card {
    padding: 32px 24px;
    text-align: center;
}

.login-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border-radius: 16px;
    color: var(--accent-bright);
}

.login-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.login-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.login-error {
    background: var(--danger-soft);
    border: 1px solid rgba(251,113,133,0.25);
    color: var(--danger);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.login-form {
    text-align: right;
}

.login-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.login-form .input {
    width: 100%;
    margin-bottom: 14px;
}

.login-submit {
    width: 100%;
    margin-top: 8px;
}

.logout-btn {
    color: var(--danger) !important;
}

/* Search history */
.history-list {
    list-style: none;
}

.history-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.history-name {
    font-size: 0.9rem;
}

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-time {
    font-size: 0.72rem;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
    direction: ltr;
}

.history-list-compact .history-item {
    padding: 12px 20px;
}

.empty-state-card {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-muted);
}

/* History page — timeline */
.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.history-stat-card {
    padding: 16px 12px;
    text-align: center;
    border-radius: var(--radius-sm);
}

.history-stat-card.accent {
    border-color: rgba(124,131,255,0.2);
    background: var(--accent-soft);
}

.history-stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.history-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.history-empty {
    padding: 48px 24px;
    text-align: center;
    border-radius: var(--radius);
}

.history-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.history-empty h2 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.history-empty p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 20px;
}

.history-card {
    display: flex;
    gap: 14px;
    position: relative;
}

.history-card-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
    padding-top: 22px;
}

.history-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    flex-shrink: 0;
    z-index: 1;
}

.history-card.is-found .history-dot {
    background: var(--success);
    box-shadow: 0 0 12px rgba(52,211,153,0.5);
}

.history-card.is-miss .history-dot {
    background: var(--danger);
    box-shadow: 0 0 12px rgba(251,113,133,0.4);
}

.history-line {
    width: 2px;
    flex: 1;
    min-height: 20px;
    background: linear-gradient(to bottom, var(--border-strong), transparent);
    margin-top: 4px;
}

.history-card-body {
    flex: 1;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: border-color 0.2s, transform 0.2s var(--ease);
}

.history-card-body:hover {
    border-color: var(--border-strong);
    transform: translateX(-2px);
}

.history-card.is-found .history-card-body {
    border-color: rgba(52,211,153,0.12);
}

.history-card.is-miss .history-card-body {
    border-color: rgba(251,113,133,0.1);
}

.history-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.history-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.history-card.is-miss .history-avatar {
    background: linear-gradient(135deg, #64748b, #475569);
}

.history-card-info {
    flex: 1;
    min-width: 0;
}

.history-card-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-card-uid {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.history-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 20px;
    flex-shrink: 0;
}

.history-status.ok {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(52,211,153,0.2);
}

.history-status.fail {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(251,113,133,0.2);
}

.history-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.history-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.history-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.history-datetime {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-bright);
    white-space: nowrap;
    padding: 5px 12px;
    background: var(--accent-soft);
    border-radius: 20px;
    border: 1px solid rgba(124,131,255,0.15);
}

.history-pagination {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: calc(var(--nav-h) + 12px);
    position: relative;
    z-index: 2;
}

.history-page-info {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.history-page-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.history-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 90px;
    justify-content: center;
    min-height: 42px;
    font-size: 0.85rem;
}

.history-page-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.history-page-current {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    padding: 0 8px;
    white-space: nowrap;
}

@media (min-width: 480px) {
    .history-card-bottom {
        flex-wrap: nowrap;
    }
    .history-pagination {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .history-page-info {
        text-align: right;
    }
}

/* ========== Profile v2 — modern grade output ========== */
.profile-header { margin-bottom: 20px; }
.profile-identity {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
}
.profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(124,131,255,0.3);
}
.profile-name { margin: 0 0 6px; font-size: 1.35rem; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.grade-hero-v2 {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 24px;
    border-radius: var(--radius-xl);
    margin-bottom: 16px;
    border: 1px solid var(--border);
    background: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    position: relative;
    overflow: hidden;
}
.grade-hero-v2.is-passed { border-color: rgba(52,211,153,0.28); }
.grade-hero-v2.is-failed { border-color: rgba(251,113,133,0.28); }
.grade-hero-glow {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.35;
    pointer-events: none;
    top: -40px;
    left: -20px;
}
.grade-hero-v2.is-passed .grade-hero-glow { background: rgba(52,211,153,0.35); }
.grade-hero-v2.is-failed .grade-hero-glow { background: rgba(251,113,133,0.3); }

.grade-ring-wrap {
    position: relative;
    width: 132px;
    height: 132px;
    flex-shrink: 0;
}
.grade-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.grade-ring-track {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 8;
}
.grade-ring-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.2s var(--ease);
}
.grade-hero-v2.is-passed .grade-ring-progress {
    stroke: url(#grad) #34d399;
    stroke: #34d399;
    filter: drop-shadow(0 0 8px rgba(52,211,153,0.5));
}
.grade-hero-v2.is-failed .grade-ring-progress {
    stroke: #fb7185;
    filter: drop-shadow(0 0 8px rgba(251,113,133,0.45));
}
.grade-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.grade-hero-v2 .grade-hero-value {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    background: linear-gradient(180deg, #fff, var(--accent-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.grade-hero-v2 .grade-hero-max {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 4px;
    font-weight: 600;
}
.grade-hero-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 1;
    min-width: 0;
}
.grade-hero-v2 .grade-hero-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}
.status-pass {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(52,211,153,0.25);
}
.status-fail {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(251,113,133,0.25);
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}
.grade-hero-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0;
    max-width: 220px;
}

.summary-row-v2 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.summary-row-v2 .summary-chip {
    position: relative;
    padding: 16px 12px 14px;
    overflow: hidden;
    transition: transform 0.2s var(--ease), border-color 0.2s;
}
.summary-row-v2 .summary-chip:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}
.summary-chip-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(52,211,153,0.2);
}
.summary-chip-icon.warn {
    background: rgba(251,191,36,0.1);
    color: var(--warn);
    border-color: rgba(251,191,36,0.2);
}
.summary-chip-icon.violet {
    background: rgba(168,85,247,0.12);
    color: #c4b5fd;
    border-color: rgba(168,85,247,0.25);
}
.summary-chip-quiz {
    border-color: rgba(52,211,153,0.3) !important;
    background: linear-gradient(160deg, rgba(52,211,153,0.08), transparent) !important;
}
.summary-chip-quiz strong { color: var(--success); }

/* Quiz full-credit gift card */
.quiz-gift-card {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(52,211,153,0.25);
    background:
        radial-gradient(ellipse 80% 60% at 100% 0%, rgba(52,211,153,0.12), transparent 55%),
        linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.quiz-gift-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}
.quiz-gift-badge {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(52,211,153,0.12);
    border: 1px solid rgba(52,211,153,0.3);
    color: var(--success);
    flex-shrink: 0;
}
.quiz-gift-title {
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}
.quiz-gift-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin: 0;
    max-width: 420px;
}
.quiz-gift-desc strong { color: var(--success); font-weight: 700; }
.quiz-gift-score {
    margin-right: auto;
    text-align: left;
    direction: ltr;
    padding: 8px 14px;
    border-radius: 14px;
    background: rgba(52,211,153,0.1);
    border: 1px solid rgba(52,211,153,0.25);
}
.quiz-gift-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--success);
    letter-spacing: -0.03em;
}
.quiz-gift-of {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 600;
}

.quiz-status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
@media (min-width: 520px) {
    .quiz-status-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) {
    .quiz-status-grid { grid-template-columns: repeat(6, 1fr); }
}
.quiz-status-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}
.quiz-status-item::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: var(--accent, var(--accent));
    opacity: 0.7;
}
.quiz-status-item.is-present {
    border-color: rgba(52,211,153,0.18);
}
.quiz-status-item.is-absent {
    border-color: rgba(255,255,255,0.05);
    opacity: 0.85;
}
.quiz-status-num {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 0.06em;
}
.quiz-status-label {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quiz-status-flag {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-dim);
}
.quiz-status-item.is-present .quiz-status-flag { color: var(--success); }
.quiz-status-item.is-absent .quiz-status-flag { color: var(--danger); opacity: 0.85; }
.quiz-status-credit {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--success);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}
.quiz-gift-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.quiz-gift-foot-ok { color: var(--success); }

.section-label-v2 {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 12px;
}
.section-label-v2 small {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
}

.progress-card-v2 {
    border-radius: var(--radius-lg);
    padding: 18px 18px 16px;
    transition: border-color 0.2s, transform 0.2s var(--ease);
}
.progress-card-v2:hover {
    border-color: var(--border-strong);
}
.progress-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 10px currentColor;
}
.progress-track-v2 {
    height: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
}
.progress-card-v2 .progress-score {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
}
.progress-card-v2 .progress-score small {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
}
.progress-card-v2 .progress-foot {
    font-size: 0.72rem;
    gap: 12px;
}
.progress-card-v2 .progress-foot strong {
    color: var(--text);
    font-weight: 800;
}
.progress-absent-msg {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 600;
    padding: 8px 0 2px;
}
.note-tag {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-bright);
    background: var(--accent-soft);
    border: 1px solid rgba(124,131,255,0.2);
}

@media (max-width: 520px) {
    .grade-hero-v2 {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding: 24px 18px;
    }
    .grade-hero-side { align-items: center; }
    .grade-hero-hint { max-width: none; }
    .quiz-gift-score { margin: 0; width: 100%; text-align: center; }
    .summary-row-v2 .summary-chip strong { font-size: 1.05rem; }
}

/* ========== Student portal result v2 ========== */
.student-result-v2 {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.student-card-v2 {
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
    position: relative;
}
.student-card-v2::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #a855f7, var(--cyan));
    opacity: 0.85;
}
.student-card-v2 .student-card-head {
    padding: 22px 20px 18px;
}
.student-avatar-v2 {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), #a855f7 60%, var(--cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 10px 28px rgba(124,131,255,0.35);
}
.student-name-v2 {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}
.student-meta-v2 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.student-meta-v2 .dot-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-dim);
}

.student-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border-top: 1px solid var(--border);
}
.student-stat {
    background: rgba(0,0,0,0.25);
    padding: 14px 10px;
    text-align: center;
}
.student-stat-val {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.student-stat-val.ok { color: var(--success); }
.student-stat-val.bad { color: var(--danger); }
.student-stat-val.neutral { color: var(--accent-bright); }
.student-stat-lbl {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-dim);
    margin-top: 4px;
    letter-spacing: 0.02em;
}

.student-section-v2 {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card-solid);
    overflow: hidden;
}
.student-section-v2 .student-section-head {
    margin: 0;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}
.student-section-v2 .exam-chip-grid {
    padding: 12px;
    gap: 8px;
}
.exam-chip-v2 {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border);
    transition: transform 0.15s var(--ease), border-color 0.15s;
}
.exam-chip-v2:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
}
.exam-chip-v2.present {
    border-color: rgba(52,211,153,0.22);
    background: linear-gradient(135deg, rgba(52,211,153,0.1), transparent 70%);
}
.exam-chip-v2.absent {
    border-color: rgba(251,113,133,0.15);
    background: linear-gradient(135deg, rgba(251,113,133,0.06), transparent 70%);
    color: var(--text-muted);
}
.exam-chip-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.exam-chip-v2.present .exam-chip-icon {
    background: rgba(52,211,153,0.15);
    color: var(--success);
}
.exam-chip-v2.absent .exam-chip-icon {
    background: rgba(251,113,133,0.12);
    color: var(--danger);
}
.exam-chip-text { flex: 1; min-width: 0; }
.exam-chip-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.exam-chip-sub {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-top: 2px;
}
.exam-chip-v2.present .exam-chip-sub { color: rgba(52,211,153,0.85); }
.exam-chip-v2.absent .exam-chip-sub { color: rgba(251,113,133,0.75); }

.student-quiz-notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(52,211,153,0.25);
    background:
        radial-gradient(ellipse 70% 80% at 0% 50%, rgba(52,211,153,0.12), transparent 60%),
        rgba(52,211,153,0.04);
}
.student-quiz-notice-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(52,211,153,0.12);
    border: 1px solid rgba(52,211,153,0.25);
    color: var(--success);
    flex-shrink: 0;
}
.student-quiz-notice h4 {
    margin: 0 0 4px;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--success);
}
.student-quiz-notice p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.student-note-v2 {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.76rem;
    color: var(--text-dim);
    line-height: 1.65;
    padding: 14px 16px;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}
.student-note-v2 svg {
    flex-shrink: 0;
    margin-top: 2px;
    opacity: 0.7;
}

.student-alert-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 36px 24px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(251,113,133,0.2);
    background: linear-gradient(160deg, rgba(251,113,133,0.08), transparent);
}
.student-alert-v2 .alert-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(251,113,133,0.25);
}
.student-alert-v2 h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}
.student-alert-v2 p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 280px;
    line-height: 1.6;
}

.portal-loading-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px 20px;
    text-align: center;
}
.portal-loading-v2 p {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}
.portal-loading-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--accent-bright);
    border-right-color: #a855f7;
    animation: spin 0.75s linear infinite;
}

/* ========== Bulk lookup — refined layout ========== */
.bulk-hero {
    position: relative;
    overflow: hidden;
    margin: 0 0 20px;
    padding: 22px 22px 18px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(34,211,238,0.08), transparent 55%),
        radial-gradient(90% 70% at 0% 100%, rgba(124,131,255,0.1), transparent 50%),
        linear-gradient(160deg, rgba(14,14,20,0.95), rgba(8,8,12,0.9));
}
.bulk-hero-glow {
    position: absolute; inset: auto -20% -40% 40%;
    height: 180px; border-radius: 50%;
    background: rgba(34,211,238,0.18); filter: blur(60px);
    pointer-events: none; animation: bulkPulse 6s ease-in-out infinite;
}
@keyframes bulkPulse {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.08); }
}
.bulk-hero-top {
    position: relative; z-index: 1;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.bulk-kicker {
    margin: 0 0 6px; font-size: 0.72rem; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--cyan); font-weight: 700;
}
.bulk-title {
    margin: 0; font-size: clamp(1.45rem, 4vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em;
}
.bulk-lead {
    margin: 8px 0 0; max-width: 36ch; font-size: 0.88rem; color: var(--text-muted); line-height: 1.6;
}
.bulk-hero-pill {
    display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
    padding: 8px 14px; border-radius: 999px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
}
.bulk-hero-pill-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--success);
    box-shadow: 0 0 0 4px rgba(52,211,153,0.15); animation: bulkBlink 2.4s ease-in-out infinite;
}
@keyframes bulkBlink {
    0%, 100% { opacity: 1; } 50% { opacity: 0.45; }
}
.bulk-hero-metrics {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px;
}
@media (min-width: 640px) {
    .bulk-hero-metrics { grid-template-columns: repeat(4, 1fr); }
}
.bulk-metric {
    padding: 12px 14px; border-radius: 16px;
    background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.05);
}
.bulk-metric strong {
    display: block; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em;
}
.bulk-metric span { font-size: 0.72rem; color: var(--text-muted); }
.bulk-metric.miss strong { color: var(--danger); }
.bulk-metric.final strong { color: var(--warn); }

.bulk-shell {
    display: grid; gap: 16px; align-items: start;
    margin-bottom: calc(var(--nav-h) + 24px);
}
@media (min-width: 980px) {
    .bulk-shell { grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.15fr); gap: 18px; }
}

.bulk-composer {
    padding: 18px; border-radius: 22px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
@media (min-width: 980px) {
    .bulk-composer { position: sticky; top: calc(var(--top-h) + 12px); }
}
.bulk-composer-head {
    display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.bulk-composer-icon {
    width: 42px; height: 42px; border-radius: 14px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(34,211,238,0.16), rgba(124,131,255,0.16));
    color: var(--cyan);
}
.bulk-composer-head h2 { margin: 0; font-size: 0.98rem; }
.bulk-composer-head p { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-muted); }

.bulk-editor {
    position: relative;
    border-radius: 18px; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    background: #07070b;
}
.bulk-editor-rail {
    position: absolute; top: 0; bottom: 0; right: 0; width: 4px;
    display: flex; flex-direction: column;
}
.bulk-editor-rail span { flex: 1; }
.bulk-editor-rail span:nth-child(1) { background: var(--cyan); }
.bulk-editor-rail span:nth-child(2) { background: var(--accent); }
.bulk-editor-rail span:nth-child(3) { background: var(--warn); }

.bulk-textarea {
    width: 100%; min-height: 280px; resize: vertical; border: 0;
    background: transparent; color: #e8eef7; padding: 16px 18px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem; line-height: 1.75; direction: ltr; text-align: left;
}
.bulk-textarea:focus { outline: none; }
.bulk-textarea::placeholder { color: #3d4454; }

.bulk-actions {
    display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center;
}
.bulk-actions .btn { display: inline-flex; align-items: center; gap: 8px; }
.bulk-go {
    min-height: 46px; padding-inline: 22px; font-weight: 800;
    box-shadow: 0 10px 30px rgba(124,131,255,0.25);
}
.bulk-export-inline { margin-right: auto; }

.bulk-side {
    border-radius: 22px; border: 1px solid var(--border);
    background: rgba(255,255,255,0.025); overflow: hidden;
    min-height: 420px; display: flex; flex-direction: column;
}
.bulk-tabs {
    display: flex; gap: 4px; padding: 10px;
    border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.25);
}
.bulk-tab {
    flex: 1; border: 0; cursor: pointer; appearance: none;
    background: transparent; color: var(--text-muted);
    font-family: inherit; font-size: 0.82rem; font-weight: 700;
    padding: 11px 10px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.bulk-tab em {
    font-style: normal; font-size: 0.7rem; font-weight: 800;
    padding: 2px 7px; border-radius: 999px;
    background: rgba(255,255,255,0.06); color: var(--text-muted);
}
.bulk-tab.active {
    background: rgba(124,131,255,0.14); color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(124,131,255,0.2);
}
.bulk-tab.active em { background: rgba(124,131,255,0.25); color: var(--accent-bright); }
.bulk-tab:active { transform: scale(0.98); }

.bulk-tab-panels { flex: 1; min-height: 0; }
.bulk-panel-pane {
    display: none; padding: 14px; animation: bulkFade 0.28s var(--ease);
}
.bulk-panel-pane.active { display: block; }
@keyframes bulkFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.bulk-summary {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px;
}
@media (min-width: 560px) {
    .bulk-summary { grid-template-columns: repeat(4, 1fr); }
}
.bulk-stat {
    padding: 12px 10px; text-align: center; border-radius: 14px;
    background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.05);
}
.bulk-stat strong { display: block; font-size: 1.2rem; font-weight: 800; }
.bulk-stat span { font-size: 0.7rem; color: var(--text-muted); }
.bulk-stat.found strong { color: var(--success); }
.bulk-stat.miss strong { color: var(--danger); }
.bulk-stat.final strong { color: var(--warn); }

.bulk-results {
    display: flex; flex-direction: column; gap: 10px;
    max-height: min(62vh, 720px); overflow: auto; padding-left: 2px;
}
.bulk-placeholder {
    text-align: center; padding: 48px 20px; color: var(--text-muted);
}
.bulk-placeholder.slim { padding: 36px 16px; }
.bulk-placeholder h3 { margin: 0 0 8px; color: var(--text); font-size: 1rem; }
.bulk-placeholder p { margin: 0 auto; max-width: 32ch; font-size: 0.82rem; line-height: 1.6; }
.bulk-placeholder-ring {
    width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 50%;
    border: 2px dashed rgba(34,211,238,0.35);
    box-shadow: inset 0 0 0 10px rgba(34,211,238,0.05);
    animation: bulkSpinSoft 10s linear infinite;
}
@keyframes bulkSpinSoft { to { transform: rotate(360deg); } }

.bulk-row {
    position: relative;
    padding: 14px 14px 14px 14px; padding-right: 50px;
    border-radius: 18px; border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
    transition: border-color 0.2s, transform 0.2s var(--ease);
    animation: bulkFade 0.35s var(--ease) both;
}
.bulk-row:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.bulk-row.is-found { border-color: rgba(52,211,153,0.18); }
.bulk-row.is-miss { border-color: rgba(251,113,133,0.2); }
.bulk-row.is-final-absent { border-color: rgba(251,191,36,0.28); }
.bulk-idx {
    position: absolute; right: 12px; top: 12px;
    width: 30px; height: 30px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(124,131,255,0.12); color: var(--accent-bright);
    font-size: 0.72rem; font-weight: 800;
}
.bulk-row-main {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.bulk-name { font-size: 0.98rem; font-weight: 800; display: block; }
.bulk-uid { font-family: ui-monospace, monospace; font-size: 0.95rem; }
.bulk-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; display: block; }
.bulk-grades { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.bulk-total { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.bulk-total.ok { color: var(--success); }
.bulk-total.fail { color: var(--danger); }
.bulk-badge {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: 999px; font-size: 0.7rem; font-weight: 700; white-space: nowrap;
}
.bulk-badge.ok { background: var(--success-soft); color: var(--success); }
.bulk-badge.fail, .bulk-badge.miss { background: var(--danger-soft); color: var(--danger); }
.bulk-badge.final { background: rgba(251,191,36,0.12); color: var(--warn); }
.bulk-score-line {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.bulk-score-line span {
    font-size: 0.72rem; color: var(--text-muted);
    padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,0.03);
}
.bulk-exams { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bulk-exam {
    font-size: 0.68rem; padding: 3px 8px; border-radius: 8px; font-weight: 600;
}
.bulk-exam.present { background: var(--success-soft); color: var(--success); }
.bulk-exam.absent { background: var(--danger-soft); color: var(--danger); }
.bulk-row-empty { margin: 8px 0 0; font-size: 0.8rem; color: var(--text-muted); }
.bulk-profile-link {
    display: inline-flex; margin-top: 10px; font-size: 0.78rem;
    color: var(--accent-bright); font-weight: 700;
}

.bulk-pane-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.bulk-pane-toolbar p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.bulk-pane-toolbar strong { color: var(--text); font-weight: 700; }

.bulk-watch-list, .bulk-log-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: min(58vh, 680px); overflow: auto;
}
.bulk-watch-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 4px 12px; align-items: center;
    padding: 12px; border-radius: 16px;
    border: 1px solid var(--border); background: rgba(0,0,0,0.22);
}
.bulk-watch-item.is-miss { border-color: rgba(251,113,133,0.2); }
.bulk-watch-item.is-final { border-color: rgba(251,191,36,0.25); }
.bulk-watch-avatar {
    width: 40px; height: 40px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(124,131,255,0.25), rgba(34,211,238,0.15));
    font-weight: 800; font-size: 0.95rem;
}
.bulk-watch-main { min-width: 0; }
.bulk-watch-main strong {
    display: block; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bulk-watch-time {
    grid-column: 2 / -1; font-size: 0.7rem; color: var(--text-muted);
}

.bulk-log-item {
    display: grid; grid-template-columns: 12px 1fr; gap: 12px;
    padding: 12px 14px; border-radius: 16px;
    border: 1px solid var(--border); background: rgba(0,0,0,0.22);
}
.bulk-log-dot {
    width: 10px; height: 10px; margin-top: 6px; border-radius: 50%;
    background: var(--cyan); box-shadow: 0 0 0 4px rgba(34,211,238,0.12);
}
.bulk-log-body time { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; }
.bulk-log-nums { display: flex; flex-wrap: wrap; gap: 6px; }
.bulk-log-nums .n {
    font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
    background: rgba(255,255,255,0.04);
}
.bulk-log-nums .n.found { color: var(--success); background: var(--success-soft); }
.bulk-log-nums .n.miss { color: var(--danger); background: var(--danger-soft); }
.bulk-log-nums .n.final { color: var(--warn); background: rgba(251,191,36,0.12); }

@media (max-width: 720px) {
    .bulk-hero-top { flex-direction: column; }
    .bulk-export-inline { margin-right: 0; width: 100%; justify-content: center; }
    .bulk-go { flex: 1; justify-content: center; }
    .bulk-row-main { flex-direction: column; }
    .bulk-grades { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
}

/* ========== Export page ========== */
.export-hero {
    display: flex; align-items: center; gap: 16px;
    padding: 20px; border-radius: var(--radius-sm); margin-bottom: 16px;
}
.export-hero-icon {
    width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(86,211,100,0.18), rgba(124,131,255,0.18));
    color: #56d364;
}
.export-hero-title { margin: 0 0 4px; font-size: 1.05rem; }
.export-hero-sub { margin: 0; font-size: 0.82rem; color: var(--text-muted); }
.export-form { padding: 18px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.export-label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 8px; }
.export-field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.export-select { flex: 1; min-width: 180px; }
.export-download-btn { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.export-features {
    margin: 16px 0 0; padding: 0; list-style: none;
    display: flex; flex-direction: column; gap: 8px;
}
.export-features li {
    font-size: 0.82rem; color: var(--text-muted);
    padding-right: 14px; position: relative;
}
.export-features li::before {
    content: ''; position: absolute; right: 0; top: 0.45em;
    width: 6px; height: 6px; border-radius: 50%; background: var(--accent-bright);
}
.export-inst-grid { margin-bottom: 28px; }
.export-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.export-chip {
    display: inline-flex; align-items: center; padding: 8px 14px;
    border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text); font-size: 0.8rem; font-weight: 600;
    transition: border-color 0.2s, background 0.2s;
}
.export-chip:hover { border-color: rgba(124,131,255,0.4); background: var(--accent-soft); }
.export-chip.all { border-color: rgba(86,211,100,0.35); color: #56d364; }

@media (max-width: 520px) {
    .export-field-row { flex-direction: column; }
    .export-download-btn { width: 100%; justify-content: center; }
}
