/* QA Hub Student Portal — design system. No external dependencies (works offline / strict CSP). */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --border: #e4e7f1;
  --border-strong: #d3d8e8;
  --text: #1c2033;
  --text-2: #4a5068;
  --muted: #7a809a;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef0ff;
  --primary-100: #e0e3ff;
  --sidebar: #17153b;
  --sidebar-2: #221f52;
  --sidebar-text: #c9c8ea;
  --green: #059669; --green-bg: #e7f8f1;
  --red: #dc2626; --red-bg: #fdecec;
  --amber: #b45309; --amber-bg: #fdf3e2;
  --blue: #2563eb; --blue-bg: #e8f0fe;
  --violet: #7c3aed; --violet-bg: #f1ebfe;
  --cyan: #0e7490; --cyan-bg: #e2f6fa;
  --orange: #c2410c; --orange-bg: #fdeee5;
  --gray: #5b6178; --gray-bg: #eef0f5;
  --shadow-sm: 0 1px 2px rgba(23, 21, 59, .06);
  --shadow: 0 1px 3px rgba(23, 21, 59, .06), 0 6px 18px rgba(23, 21, 59, .05);
  --shadow-lg: 0 20px 50px rgba(23, 21, 59, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1020; --surface: #171a2e; --surface-2: #1d2038; --border: #2a2e4b; --border-strong: #363b5e;
  --text: #e8e9f5; --text-2: #b9bcd6; --muted: #8b8fae; --primary: #7c74ff; --primary-600: #8f88ff;
  --primary-50: #23244a; --primary-100: #2c2d5c; --sidebar: #0b0c19; --sidebar-2: #15162c;
  --green-bg: #0f2e25; --red-bg: #3a1618; --amber-bg: #34260f; --blue-bg: #14264a; --violet-bg: #29184a;
  --cyan-bg: #0f2d35; --orange-bg: #3a1f12; --gray-bg: #23263d;
  --green: #34d399; --red: #f87171; --amber: #fbbf24; --blue: #60a5fa; --violet: #a78bfa; --cyan: #22d3ee; --orange: #fb923c; --gray: #a1a6c3;
  --shadow: 0 1px 3px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0f1020; --surface: #171a2e; --surface-2: #1d2038; --border: #2a2e4b; --border-strong: #363b5e;
    --text: #e8e9f5; --text-2: #b9bcd6; --muted: #8b8fae; --primary: #7c74ff; --primary-600: #8f88ff;
    --primary-50: #23244a; --primary-100: #2c2d5c; --sidebar: #0b0c19; --sidebar-2: #15162c;
    --green-bg: #0f2e25; --red-bg: #3a1618; --amber-bg: #34260f; --blue-bg: #14264a; --violet-bg: #29184a;
    --cyan-bg: #0f2d35; --orange-bg: #3a1f12; --gray-bg: #23263d;
    --green: #34d399; --red: #f87171; --amber: #fbbf24; --blue: #60a5fa; --violet: #a78bfa; --cyan: #22d3ee; --orange: #fb923c; --gray: #a1a6c3;
    --shadow: 0 1px 3px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; } h4 { font-size: .92rem; }
p { margin: 0 0 .75rem; }
code, pre { font-family: var(--mono); font-size: .86em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -3px; }
.icon.lg { width: 22px; height: 22px; } .icon.xl { width: 30px; height: 30px; } .icon.sm { width: 15px; height: 15px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 262px; flex: 0 0 262px; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2)); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 16px; color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #8b80ff, #4f46e5 55%, #22d3ee); display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: .02em; color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.45); }
.brand-name { font-weight: 750; font-size: 15.5px; line-height: 1.15; }
.brand-sub { font-size: 11.5px; color: #9d9bd0; font-weight: 500; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; scrollbar-width: thin; scrollbar-color: #3a3780 transparent; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #7d7bb5; font-weight: 700; padding: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; margin: 1px 0; border-radius: 10px; color: var(--sidebar-text); font-weight: 520; font-size: 14px; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(139,128,255,.18); color: #fff; box-shadow: inset 3px 0 0 #8b80ff; }
.nav a .icon { opacity: .85; }
.nav .count { margin-left: auto; background: #f43f5e; color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.sidebar-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12px; color: #8a88bf; display: flex; justify-content: space-between; align-items: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 26px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar .spacer { flex: 1; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; border-radius: 99px; background: #f43f5e; color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--surface); }
.menu-toggle { display: none; }
.content { padding: 26px; max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.page-head .sub { color: var(--muted); margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 12px; border: 1px solid transparent; background: none; color: inherit; cursor: pointer; font: inherit; }
.user-chip:hover { background: var(--surface-2); border-color: var(--border); }
.user-chip .meta { text-align: left; line-height: 1.2; }
.user-chip .meta b { display: block; font-size: 13.5px; }
.user-chip .meta span { font-size: 11.5px; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); flex: 0 0 auto; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; animation: pop .14s ease-out; }
.dropdown-menu a, .dropdown-menu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--text); font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 6px 0; }
.notif-menu { width: 370px; padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 400px; overflow: auto; }
.notif-item { display: block; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.unread { background: color-mix(in srgb, var(--primary-50) 70%, transparent); }
.notif-item b { display: block; font-size: 13.5px; font-weight: 600; }
.notif-item span { font-size: 12.5px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Cards, grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .hint { font-size: 12.5px; color: var(--muted); }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stack > * + * { margin-top: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .strong { font-weight: 650; } .nowrap { white-space: nowrap; }
.text-right { text-align: right; } .center { text-align: center; } .w-100 { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* KPI tiles */
.kpi { color: var(--text); padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.kpi .kpi-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 auto; }
.kpi .kpi-icon .icon { width: 22px; height: 22px; }
.kpi .kpi-value { font-size: 1.6rem; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; }
.kpi .kpi-label { color: var(--muted); font-size: 13px; font-weight: 520; }
.kpi a { color: inherit; }
.tone-indigo { background: var(--primary-50); color: var(--primary); }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-blue { background: var(--blue-bg); color: var(--blue); }
.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tone-cyan { background: var(--cyan-bg); color: var(--cyan); }
.tone-gray { background: var(--gray-bg); color: var(--gray); }

.hero { background: linear-gradient(120deg, #312e81, #4f46e5 55%, #0891b2); color: #fff; border-radius: 18px; padding: 26px 28px; position: relative; overflow: hidden; box-shadow: 0 12px 30px rgba(79,70,229,.25); }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.hero h1 { color: #fff; font-size: 1.5rem; }
.hero p { color: #dcdcff; margin: 0; max-width: 620px; }
.hero .hero-stats { display: flex; gap: 26px; margin-top: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .hero-stats b { display: block; font-size: 1.35rem; }
.hero .hero-stats span { font-size: 12.5px; color: #c9cbff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(.95); background: var(--green); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.95); background: var(--red); }
.btn-soft { background: var(--primary-50); border-color: transparent; color: var(--primary); }
.btn-soft:hover { background: var(--primary-100); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn .icon { width: 16px; height: 16px; }
.inline-form { display: inline; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: 13.5px; color: var(--text); }
.field .req { color: var(--red); }
.help { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a809a' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
select[multiple].select { height: auto; min-height: 120px; padding: 6px; background-image: none; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input-group { position: relative; }
.input-group .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-group .input { padding-left: 38px; }
.input-group .toggle-pw { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.field-error { color: var(--red); font-size: 12.5px; font-weight: 500; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 23px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .15s; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; max-height: 260px; overflow: auto; padding: 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }

.pw-rules { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.pw-rules li::before { content: "○"; margin-right: 6px; }
.pw-rules li.ok { color: var(--green); }
.pw-rules li.ok::before { content: "●"; }
.meter { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s, background .2s; }

/* Filters toolbar */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.toolbar .field { gap: 4px; }
.toolbar .field > label { font-size: 12px; color: var(--muted); font-weight: 600; }
.toolbar .input, .toolbar .select { height: 36px; min-width: 150px; font-size: 13.5px; }
.toolbar .grow { flex: 1; min-width: 200px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.8px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary-50) 45%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn, .table .actions form + form, .table .actions .btn + form, .table .actions form + .btn { margin-left: 4px; }
.cell-title { font-weight: 600; color: var(--text); display: block; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.person { display: flex; align-items: center; gap: 10px; }
.table.compact td, .table.compact th { padding: 8px 12px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; line-height: 20px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.badge-cyan { background: var(--cyan-bg); color: var(--cyan); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); font-weight: 550; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { background: var(--gray-bg); color: var(--text-2); border-radius: 99px; font-size: 11.5px; padding: 0 7px; line-height: 18px; }
.tabs a.active .count { background: var(--primary-50); color: var(--primary); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills a { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-2); font-size: 13px; font-weight: 600; background: var(--surface); }
.pills a:hover { text-decoration: none; border-color: var(--border-strong); }
.pills a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Alerts / flash */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; border: 1px solid; font-size: 14px; margin-bottom: 16px; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--green); }
.alert-error { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.alert-info { background: var(--blue-bg); border-color: color-mix(in srgb, var(--blue) 30%, transparent); color: var(--blue); }
.alert-warn { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--amber); }
.alert > div { flex: 1; color: var(--text); }
.alert .close { background: none; border: 0; color: inherit; cursor: pointer; opacity: .7; padding: 0; }
.flash-stack { position: fixed; top: 76px; right: 22px; z-index: 90; width: min(420px, calc(100vw - 32px)); }
.flash-stack .alert { box-shadow: var(--shadow-lg); background-color: var(--surface); animation: slidein .25s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Empty state */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .empty-icon { width: 60px; height: 60px; border-radius: 18px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; margin: 0 auto 14px; }
.empty h3 { color: var(--text); }

/* Progress */
.progress { height: 7px; border-radius: 99px; background: var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #22d3ee); }
.progress.green > span { background: var(--green); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(12, 12, 30, .55); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-backdrop.open { display: flex; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: 18px; width: min(520px, 100%); box-shadow: var(--shadow-lg); max-height: calc(100vh - 40px); overflow: auto; animation: pop .18s ease-out; }
.modal-head { padding: 20px 22px 0; display: flex; gap: 14px; align-items: flex-start; }
.modal-body { padding: 14px 22px 4px; color: var(--text-2); }
.modal-foot { padding: 16px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: 0 0 auto; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Lists & timeline */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: center; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list a.item-link { color: var(--text); font-weight: 600; }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 9px 14px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); font-weight: 550; }
.dl dd { margin: 0; min-width: 0; word-break: break-word; }

.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 12px; }
.msg-body { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 12px 15px; min-width: 0; }
.msg-meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.msg-meta b { color: var(--text); font-size: 13.5px; }
.msg.answer .msg-body { border-color: color-mix(in srgb, var(--green) 40%, var(--border)); background: color-mix(in srgb, var(--green-bg) 55%, var(--surface)); }
.msg.note .msg-body { border-style: dashed; background: var(--amber-bg); }
.msg-status { text-align: center; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.msg-status::before, .msg-status::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.msg-text { white-space: pre-wrap; word-break: break-word; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 14px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); }

/* Video */
.video-card { overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.video-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.video-thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, #1e1b4b, #4338ca 60%, #0e7490); position: relative; display: grid; place-items: center; color: #fff; }
.video-thumb .num { position: absolute; left: 12px; top: 10px; font-size: 12px; font-weight: 700; background: rgba(0,0,0,.3); padding: 2px 8px; border-radius: 6px; }
.video-thumb .dur { position: absolute; right: 10px; bottom: 10px; font-size: 12px; font-weight: 600; background: rgba(0,0,0,.55); padding: 1px 7px; border-radius: 5px; }
.video-thumb .play { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; backdrop-filter: blur(4px); transition: transform .15s, background .15s; }
.video-card:hover .play { transform: scale(1.08); background: rgba(255,255,255,.3); }
.video-thumb .lock { position: absolute; inset: 0; background: rgba(10,10,25,.6); display: grid; place-items: center; font-weight: 600; font-size: 13px; text-align: center; gap: 6px; }
.video-thumb .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 0; background: rgba(255,255,255,.2); }
.video-meta { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.video-meta h3 { font-size: 15px; margin: 0; }
.video-meta h3 a { color: var(--text); }
.video-meta .info { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.player-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; user-select: none; -webkit-user-select: none; }
.player-wrap video, .player-wrap iframe { width: 100%; height: 100%; display: block; border: 0; background: #000; }
.watermark { position: absolute; pointer-events: none; color: rgba(255,255,255,.28); font-size: 13px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.4); white-space: nowrap; transition: top 2s ease, left 2s ease; z-index: 3; top: 12%; left: 8%; }
.playlist { max-height: 520px; overflow: auto; }
.playlist a { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); align-items: center; }
.playlist a:hover { background: var(--surface-2); text-decoration: none; }
.playlist a.current { background: var(--primary-50); }
.playlist .n { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.playlist a.done .n { background: var(--green-bg); color: var(--green); border-color: transparent; }

/* Bars (simple charts) */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar span { width: 100%; max-width: 28px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #8b80ff, var(--primary)); min-height: 3px; }
.bars .bar small { font-size: 10.5px; color: var(--muted); }
.hbar { display: grid; grid-template-columns: 130px 1fr 46px; gap: 10px; align-items: center; font-size: 13px; margin-bottom: 9px; }
.hbar .track { height: 9px; background: var(--border); border-radius: 99px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: 99px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* Stepper (deploy) */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.steps li:last-child { border-bottom: 0; }
.steps .s-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-bg); color: var(--muted); font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.steps li.done .s-ic { background: var(--green-bg); color: var(--green); }
.steps li.running .s-ic { background: var(--primary-50); color: var(--primary); }
.steps li.failed .s-ic { background: var(--red-bg); color: var(--red); }
.steps li .s-msg { font-size: 12.5px; color: var(--muted); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.console { background: #0d1022; color: #cfd3f5; border-radius: 12px; padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; min-height: 160px; max-height: 360px; overflow: auto; white-space: pre-wrap; border: 1px solid #222645; }

/* Pagination */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }
.pagination a, .pagination span.cur { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; display: inline-grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--text-2); border: 1px solid var(--border); background: var(--surface); }
.pagination a:hover { text-decoration: none; border-color: var(--border-strong); }
.pagination span.cur { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-art { background: radial-gradient(circle at 20% 15%, rgba(139,128,255,.55), transparent 45%), radial-gradient(circle at 85% 85%, rgba(34,211,238,.35), transparent 45%), linear-gradient(140deg, #17153b, #312e81 60%, #1e1b4b); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h2 { color: #fff; font-size: 2.1rem; line-height: 1.15; max-width: 470px; letter-spacing: -.02em; }
.auth-art p { color: #cfd0ff; max-width: 440px; font-size: 15px; }
.auth-feats { display: grid; gap: 14px; margin-top: 28px; max-width: 440px; }
.auth-feat { display: flex; gap: 13px; align-items: flex-start; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 13px 15px; backdrop-filter: blur(6px); }
.auth-feat .icon { color: #a5b4fc; margin-top: 2px; }
.auth-feat b { display: block; font-size: 14px; }
.auth-feat span { font-size: 13px; color: #c3c5f5; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-box { width: 100%; max-width: 420px; }
.auth-box .card { padding: 30px; box-shadow: var(--shadow); }
.auth-box h1 { font-size: 1.45rem; }
.auth-box .lead { color: var(--muted); margin-bottom: 22px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-foot { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 18px; }
.otp-input { letter-spacing: 10px; font-size: 22px; text-align: center; font-weight: 700; height: 52px; font-family: var(--mono); }

/* Blank / error */
.blank { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: var(--bg); }
.blank-box { max-width: 520px; text-align: center; }
.blank-box .code { font-size: 4.5rem; font-weight: 800; letter-spacing: -.04em; background: linear-gradient(120deg, #4f46e5, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; margin-bottom: 10px; }

.settings-layout { grid-template-columns: 240px minmax(0, 1fr); }

/* Install wizard */
.wizard { max-width: 760px; margin: 40px auto; padding: 0 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10,10,30,.45); z-index: 35; }
  .menu-toggle { display: inline-grid; }
  .g-main, .g-3, .settings-layout { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 720px) {
  .content { padding: 16px; }
  .topbar { padding: 0 14px; }
  .g-2, .g-4, .form-grid { grid-template-columns: 1fr; }
  .user-chip .meta { display: none; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .notif-menu { width: calc(100vw - 28px); right: -60px; }
  .hbar { grid-template-columns: 90px 1fr 40px; }
  .pw-rules { grid-template-columns: 1fr; }
}
@media print { .sidebar, .topbar, .page-actions, .toolbar { display: none !important; } .content { padding: 0; } }
