/* Dashboard SPA (app.html) — uses tokens from common.css */
:root {
  --card-radius: 14px;
  --page-w: 1240px;
  --topbar-h: 60px;
  --warn-bg: #fff4e0;
  --warn-fg: #b35c00;
  --ok-bg: #e8f6ea;
  --ok-fg: #2b8a3e;
  --pct-good: #2f9e44;
  --pct-mid: #f08c00;
  --pct-low: #e03131;
  --thumb-bg: var(--surface-2);
}
[data-theme='dark'] {
  --warn-bg: #3a2a12;
  --warn-fg: #ffc078;
  --ok-bg: #1d3a26;
  --ok-fg: #69db7c;
  --pct-good: #51cf66;
  --pct-mid: #fcc419;
  --pct-low: #ff6b6b;
}

body.app-page { background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
.app-shell { zoom: var(--ui-scale); min-height: 100%; display: flex; flex-direction: column; }
.site-version { padding: 8px 16px; text-align: center; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.site-version a { display: inline-block; padding: 4px 8px; color: inherit; text-decoration: none; border-radius: 6px; }
.site-version a:hover { color: var(--text); text-decoration: underline; }

/* ---------- utilities ---------- */
.sr-only, .copy-buffer {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 2000; background: var(--accent); color: var(--accent-fg);
  padding: 10px 14px; border-radius: 10px; font-weight: 600; text-decoration: none; transition: top 0.15s;
}
.skip-link:not(:focus) { opacity: 0; pointer-events: none; }
.skip-link:focus { top: 12px; }
.boot { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.boot .spinner { width: 28px; height: 28px; border-width: 3px; }
.noscript { max-width: 520px; margin: 15vh auto; padding: 24px; text-align: center; background: var(--surface); border-radius: var(--card-radius); box-shadow: var(--shadow); }
.grow { flex: 1; min-width: 0; }
.grow2 { flex: 2; min-width: 0; }
.grow2 > .field { margin-bottom: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row-wrap { flex-wrap: wrap; align-items: flex-start; }
.row-wrap > .field, .row-wrap > .grow2 { min-width: 180px; }
.form-stack > .field:last-child { margin-bottom: 0; }
.form-stack > p { margin: 0 0 14px; line-height: 1.5; }
.assessment-content, .assessment-content .field, .assessment-content label, .assessment-content details {
  min-width: 0;
  overflow-wrap: anywhere;
}
.assessment-content input, .assessment-content select, .assessment-content textarea {
  min-width: 0;
  max-width: 100%;
}
.input-sm { height: 34px; font-size: 13px; padding: 0 10px; }
select.select { padding-right: 30px; appearance: none; -webkit-appearance: none; cursor: pointer;
  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='%23858c99' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
select.select option { background: var(--surface); color: var(--text); }
.btn-lg { height: 44px; font-size: 15px; border-radius: 11px; }
.btn .btn-spin { display: none; width: 16px; height: 16px; border-color: color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; }
.btn.busy .btn-spin { display: inline-block; }
.btn.busy > svg { display: none; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { background: var(--danger-bg); }
.icon-btn-sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn-sm svg { width: 16px; height: 16px; }
.icon-btn.icon-danger:hover { color: var(--danger); background: var(--danger-bg); }
.icon-btn.copied, .btn.copied { color: var(--ok); }
.btn.btn-primary.copied { color: var(--accent-fg); }
.spinner-lg { width: 34px; height: 34px; border-width: 3px; }
kbd { font-family: inherit; }
.textarea { line-height: 1.5; }
.fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 0; margin: 0 0 14px; }
.fieldset legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0 6px; margin-left: -6px; }
.fieldset .check { margin-bottom: 12px; font-size: 14px; }
.info-box { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; margin-bottom: 14px; }
.info-box svg { color: var(--accent); width: 18px; height: 18px; margin-top: 1px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: var(--page-w); min-height: var(--topbar-h); margin: 0 auto; padding: 8px 24px; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; border-radius: 10px; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; color: #1b4365; font-size: 16px; line-height: 0.95; font-weight: 800; letter-spacing: -0.03em; }
[data-theme='dark'] .brand-text { color: #d3e6f4; }
.topnav { display: flex; gap: 4px; padding-left: 18px; border-left: 1px solid var(--border); }
.topnav-link { padding: 8px 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.topnav-link:hover { background: var(--surface-3); color: var(--text); }
.topnav-link[aria-current='page'] { color: var(--text); background: var(--surface-3); }
.topbar-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex: none; }
.admin-content { display: grid; gap: 18px; }
.admin-section { min-width: 0; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-list, .admin-audit { padding: 0; margin: 16px 0 0; list-style: none; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.admin-row-info, .admin-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; }
.admin-form { display: grid; gap: 14px; }
.admin-audit-row { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; overflow-wrap: anywhere; }
.catalog-privacy { margin: -12px 0 20px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text-2); line-height: 1.5; }
.catalog-list { display: grid; gap: 18px; }
.catalog-book { min-width: 0; }
.catalog-book-head, .catalog-chapter-head, .catalog-exercise-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.catalog-book-meta { color: var(--muted); margin: 6px 0 0; }
.catalog-chapters { display: grid; gap: 14px; margin-top: 18px; }
.catalog-chapter { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.catalog-chapter-head { align-items: center; }
.catalog-chapter-head h3 { display: flex; gap: 8px; margin: 0; font-size: 16px; }
.catalog-position { color: var(--muted); font-variant-numeric: tabular-nums; }
.catalog-exercises { list-style: none; padding: 0; margin: 12px 0 0; }
.catalog-exercise { padding: 12px 0; border-top: 1px solid var(--border); min-width: 0; }
.catalog-exercise-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.catalog-exercise-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 12px 0 0; }
.catalog-exercise-data > div { min-width: 0; }
.catalog-exercise-data dt { color: var(--muted); font-size: 12px; }
.catalog-exercise-data dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.catalog-form { display: grid; gap: 14px; }
.catalog-form-heading { margin: 6px 0 -8px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; }
.feedback-actions, .feedback-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.feedback-entry { padding: 12px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.feedback-description { white-space: pre-wrap; margin: 8px 0 0; }
.release-entry { margin-top: 16px; }
.release-entry ul { padding-left: 22px; }
.page > .admin-section + .admin-section { margin-top: 16px; }
.build-version { font-size: 1rem; overflow-wrap: anywhere; }
.search { position: relative; display: flex; align-items: center; width: 100%; max-width: 420px; }
.search > svg { position: absolute; left: 11px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 14px; padding: 0 36px 0 36px; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search-input::placeholder { color: var(--muted); }
.search-input:hover { border-color: var(--border-strong); }
.search-input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-kbd {
  position: absolute; right: 9px; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; line-height: 17px; background: var(--surface); pointer-events: none;
}
.search-input:focus + .search-kbd, .search-input:not(:placeholder-shown) + .search-kbd { display: none; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px; border: 1px solid transparent; border-radius: 99px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.user-btn:hover, .user-btn[aria-expanded='true'] { background: var(--surface-3); }
.user-btn svg { width: 16px; height: 16px; color: var(--muted); }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; border-width: 3px; box-shadow: var(--shadow-sm); }

/* ---------- popovers & menus ---------- */
.popover {
  position: fixed; z-index: 1200; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); min-width: 200px; opacity: 0; transform: translateY(-4px) scale(0.98);
  transform-origin: top right; transition: opacity 0.12s ease-out, transform 0.12s ease-out;
}
.popover { max-height: calc(100dvh / var(--ui-scale) - 16px); overflow: auto; }
.app-page > .popover { zoom: var(--ui-scale); }
.popover.in { opacity: 1; transform: none; }
.pop-pad { padding: 14px; width: 280px; max-width: calc(100vw / var(--ui-scale) - 16px); }
.pop-title { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.menu { padding: 6px; display: flex; flex-direction: column; min-width: 210px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.menu-item svg { width: 17px; height: 17px; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--danger-bg); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.menu-head-text { display: flex; flex-direction: column; min-width: 0; }
.menu-head-text b { font-size: 14px; }
.menu-head-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* ---------- page ---------- */
.page { width: 100%; max-width: var(--page-w); margin: 0 auto; padding: 32px 24px 72px; flex: 1; outline: none; }
.page-center { display: flex; align-items: center; justify-content: center; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-title { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; outline: none; }
.page-sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.live-text { display: inline-flex; align-items: center; gap: 6px; color: var(--ok-fg); font-weight: 600; }
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-title { font-size: 18px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.count { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 99px; padding: 2px 8px; }
.section-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* ---------- cards & grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--card-radius); box-shadow: var(--shadow-sm); overflow: hidden;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.card:has(.card-link):hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); }
.card:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-link { color: inherit; text-decoration: none; outline: none; }
.card-link::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card .icon-btn, .card .btn, .card .invite-code { position: relative; z-index: 2; }
.card-body { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.card-body-row { flex-direction: row; align-items: flex-start; gap: 8px; }
.card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-title { font-size: 15px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { margin: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-menu { margin: -6px -8px 0 0; flex: none; }
.card-line { margin: 0; display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); min-width: 0; }
.card-line > svg { width: 15px; height: 15px; color: var(--muted); }
.card-line .grade { height: 20px; min-width: 22px; font-size: 12px; padding: 0 5px; border-radius: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; }
.chip-grade { padding-left: 3px; }
.chip-grade .grade { height: 18px; min-width: 26px; font-size: 11.5px; padding: 0 5px; border-radius: 99px; }
.chip-pct.pct-good, .chip-ok { background: var(--ok-bg); color: var(--ok-fg); }
.chip-pct.pct-mid, .chip-warn { background: var(--warn-bg); color: var(--warn-fg); }
.chip-pct.pct-low { background: var(--danger-bg); color: var(--danger); }
.card-foot { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); min-height: 46px; }
.foot-stat { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.foot-stat svg { width: 14px; height: 14px; }
.foot-when { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invite-foot { background: color-mix(in srgb, var(--warn-bg) 55%, transparent); gap: 8px; }
.invite-label { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--warn-fg); }
.invite-label svg { width: 14px; height: 14px; }
.invite-code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; color: var(--text); user-select: all; flex: 1; }
.invite-foot .icon-btn { margin-right: -6px; }

/* ---------- thumbnails ---------- */
.thumb { position: relative; aspect-ratio: 16 / 10; background: var(--thumb-bg); overflow: hidden; border-bottom: 1px solid var(--border); flex: none; }
.thumb canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity 0.25s; }
.thumb.loading canvas { opacity: 0; }
.thumb.loading::before, .sk {
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%);
  background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
.thumb.loading::before { content: ''; position: absolute; inset: 0; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.thumb-empty, .thumb-missing {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600;
  color: var(--muted); letter-spacing: 0.01em;
}
.thumb.empty .thumb-empty, .thumb.missing .thumb-missing { display: flex; }
[data-theme='dark'] .thumb canvas { filter: brightness(0.86); }
.topic-main { min-width: 0; }
.thumb.empty .thumb-empty::before, .thumb.missing .thumb-missing::before {
  content: ''; width: 26px; height: 18px; margin-right: 8px; border: 2px dashed var(--border-strong); border-radius: 5px;
}
.thumb.missing canvas { display: none; }
.live-badge, .thumb-badge { position: absolute; z-index: 2; box-shadow: var(--shadow-sm); }
.thumb .live-badge { top: 10px; left: 10px; }
.thumb .thumb-badge { top: 10px; right: 10px; }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge svg { width: 13px; height: 13px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; position: relative; }
.live-dot::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: ping 1.8s ease-out infinite; }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(1.6); opacity: 0; } }

/* skeleton */
.sk-card { pointer-events: none; }
.sk-line { height: 12px; border-radius: 6px; }
.sk-line.lg { height: 26px; border-radius: 8px; margin-bottom: 10px; }
.w20 { width: 20%; } .w40 { width: 40%; } .w60 { width: 60%; }
.sk-avatar { width: 64px; height: 64px; border-radius: 50%; flex: none; }
.sk-stat { min-height: 92px; align-items: center; }
.sk-stat .sk-line { width: 70%; }
.folder-skel .stats { margin: 24px 0; }

/* ---------- empty / error states ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 44px 20px 48px; gap: 6px;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--card-radius);
}
.empty-art { position: relative; width: 76px; height: 76px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.empty-ring { position: absolute; inset: 0; border-radius: 24px; background: var(--accent-soft); transform: rotate(-8deg); }
.empty-ring::after { content: ''; position: absolute; inset: 8px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); transform: rotate(8deg); }
.empty-icon { position: relative; z-index: 1; color: var(--accent); display: inline-flex; }
.empty-icon svg { width: 28px; height: 28px; }
.empty-title { font-size: 16px; font-weight: 700; }
.empty-text { margin: 0 0 10px; color: var(--muted); max-width: 420px; line-height: 1.5; font-size: 14px; }
.empty-error .empty-ring { background: var(--danger-bg); }
.empty-error .empty-icon { color: var(--danger); }
.notfound { text-align: center; padding: 10vh 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.nf-code {
  font-size: 96px; font-weight: 800; letter-spacing: -0.05em; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.notfound p { margin: 0 0 8px; max-width: 420px; }

/* ---------- invite ---------- */
.invite-box { display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.invite-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.invite-k { width: 34px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; flex: none; }
.invite-code-lg { font-size: 18px; letter-spacing: 0.12em; flex: none; }
.input-link { flex: 1; min-width: 0; height: 34px; font-size: 13px; color: var(--text-2); }
.invite-row .btn { flex: none; }
.success-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.success-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--ok-bg); color: var(--ok-fg); display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--shadow-sm); padding: 20px; min-width: 0; }
.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.panel-sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.panel-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- account ---------- */
.account-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.account-settings { display: grid; gap: 18px; min-width: 0; }
.panel-wide { grid-column: 1 / -1; }
.profile { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.profile-text { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-text .muted { overflow-wrap: anywhere; }
.personal-avatar { background: var(--accent); overflow: hidden; }
.personal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-editor-disclosure { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.profile-editor-disclosure summary { cursor: pointer; color: var(--text); }
.profile-editor-disclosure summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.profile-editor-disclosure summary h3 { display: inline; }
.profile-editor { display: grid; gap: 12px; margin-top: 16px; }
.profile-editor .field, .profile-editor .hint { margin: 0; }
.profile-editor input[type='file'] { width: 100%; min-width: 0; font: inherit; }
.profile-preview { display: flex; align-items: center; padding: 8px; border-radius: 12px; background: var(--surface-2); }
.profile-options { border: 0; margin: 0; padding: 0; min-width: 0; }
.profile-options legend { margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.profile-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-choice { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 3px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 22px; cursor: pointer; }
.profile-choice img { width: 100%; height: 100%; border-radius: 8px; }
.profile-choice[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.profile-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.profile-choice:disabled { cursor: wait; opacity: .6; }
.pw-form { max-width: 620px; }
.form-actions { display: flex; gap: 8px; }

/* ---------- student folder ---------- */
.folder-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.folder-title { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; margin-left: -4px; padding: 2px 6px 2px 2px; border-radius: 6px; }
.back-link svg { width: 16px; height: 16px; }
.back-link:hover { color: var(--accent); background: var(--accent-soft); }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.folder-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.folder-actions { display: flex; gap: 6px; align-items: center; }
.invite-panel { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; border-color: color-mix(in srgb, var(--warn-fg) 30%, var(--border)); background: linear-gradient(0deg, color-mix(in srgb, var(--warn-bg) 50%, var(--surface)), var(--surface)); }
.invite-panel .invite-box { flex: 1; min-width: 280px; margin: 0; background: var(--surface); }
.invite-panel-text { display: flex; gap: 12px; align-items: flex-start; flex: 0 1 300px; }
.invite-panel-text p { margin: 2px 0 0; }
.invite-panel-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-fg); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.invite-panel-icon svg { width: 19px; height: 19px; }
.notes-panel { margin-bottom: 18px; padding: 14px 18px; }
.notes-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.notes-head svg { width: 15px; height: 15px; }
.notes-text { margin: 8px 0 0; white-space: pre-wrap; line-height: 1.55; font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); padding: 16px; box-shadow: var(--shadow-sm); min-width: 0; }
.stat-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-text { min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-g1 .stat-icon, .stat-g2 .stat-icon, .stat-p-low .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-g3 .stat-icon, .stat-p-mid .stat-icon { background: var(--warn-bg); color: var(--warn-fg); }
.stat-g4 .stat-icon, .stat-g5 .stat-icon, .stat-g6 .stat-icon, .stat-p-good .stat-icon { background: var(--ok-bg); color: var(--ok-fg); }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.chart-panel { padding: 16px 18px 10px; }
.chart { width: 100%; height: auto; display: block; margin-top: 6px; overflow: visible; }
.chart-empty { display: flex; align-items: center; justify-content: center; min-height: 150px; text-align: center; padding: 0 20px; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.ch-val { fill: var(--text-2); font-size: 11px; font-weight: 700; font-family: var(--font); }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot circle { stroke: var(--surface); stroke-width: 2.5; transition: r 0.15s; }
.ch-dot:hover circle { r: 7; }
.ch-dot.g1 circle { fill: #e03131; } .ch-dot.g2 circle { fill: #f76707; } .ch-dot.g3 circle { fill: #f59f00; }
.ch-dot.g4 circle { fill: #74b816; } .ch-dot.g5 circle { fill: #2f9e44; } .ch-dot.g6 circle { fill: #0c8599; }
.ch-bar rect { transition: opacity 0.15s; }
.ch-bar:hover rect { opacity: 0.8; }
.ch-bar.pct-good rect { fill: var(--pct-good); } .ch-bar.pct-mid rect { fill: var(--pct-mid); } .ch-bar.pct-low rect { fill: var(--pct-low); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px 12px; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; position: relative; white-space: nowrap; border-radius: 8px 8px 0 0;
}
.tab svg { width: 17px; height: 17px; }
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab[aria-selected='true'] { color: var(--accent); }
.tab[aria-selected='true']::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tab-count { font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--muted); padding: 1px 7px; border-radius: 99px; }
.tab[aria-selected='true'] .tab-count { background: var(--accent-soft); color: var(--accent); }
.tab-short { display: none; }
.tab-panel { outline: none; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.pane-head p { margin: 0; max-width: 640px; line-height: 1.5; }

/* exams */
.exam-list { display: flex; flex-direction: column; gap: 12px; }
.exam-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto auto; gap: 18px; align-items: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--card-radius); padding: 12px 16px 12px 12px; box-shadow: var(--shadow-sm); transition: box-shadow 0.18s, border-color 0.18s;
}
.exam-row:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.exam-thumb-link { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.exam-thumb-link .thumb { border-bottom: 0; }
.exam-thumb-link .live-badge { top: 6px; left: 6px; font-size: 11px; padding: 1px 6px; }
.exam-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.exam-title { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exam-title a { color: var(--text); text-decoration: none; }
.exam-title a:hover { color: var(--accent); }
.exam-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.exam-meta > span { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; }
.exam-meta svg { width: 14px; height: 14px; flex: none; }
.exam-note { margin: 0; font-size: 13px; color: var(--text-2); display: flex; gap: 6px; align-items: flex-start; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-q { display: inline-flex; color: var(--muted); margin-top: 1px; }
.note-q svg { width: 14px; height: 14px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; max-width: 320px; }
.meter i { display: block; height: 100%; border-radius: inherit; }
.meter .pct-good { background: var(--pct-good); } .meter .pct-mid { background: var(--pct-mid); } .meter .pct-low { background: var(--pct-low); }
.exam-result { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; min-width: 140px; }
.exam-score { font-size: 13.5px; color: var(--text-2); display: flex; align-items: baseline; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.exam-score b { font-size: 18px; color: var(--text); }
.pct { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-left: 4px; }
.pct.pct-good { background: var(--ok-bg); color: var(--ok-fg); }
.pct.pct-mid { background: var(--warn-bg); color: var(--warn-fg); }
.pct.pct-low { background: var(--danger-bg); color: var(--danger); }
.exam-grade { display: flex; align-items: center; gap: 8px; }
.exam-actions { display: flex; align-items: center; gap: 6px; }

/* topics table */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.topics { width: 100%; border-collapse: collapse; font-size: 14px; }
.topics th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.topics td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.topics tbody tr:last-child td { border-bottom: 0; }
.topics tbody tr { transition: background 0.12s; }
.topics tbody tr:hover { background: var(--surface-2); }
.td-date { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; width: 1%; }
.topic-title { font-weight: 600; overflow-wrap: anywhere; }
.topic-note { margin-top: 3px; font-size: 13px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.td-grade { white-space: nowrap; }
.under { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.board-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; text-decoration: none; max-width: 220px; }
.board-link svg { width: 15px; height: 15px; flex: none; }
.board-link:hover { text-decoration: underline; }
.td-actions { white-space: nowrap; text-align: right; width: 1%; padding-top: 7px !important; padding-bottom: 7px !important; }

/* grade / understanding inputs */
.suggest { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; margin: -2px 0 14px; background: var(--accent-soft); border-radius: 10px; font-size: 13px; }
.suggest-icon { color: var(--accent); display: inline-flex; }
.suggest-icon svg { width: 17px; height: 17px; }
.suggest .btn { margin-left: auto; }
.scale { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.scale-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-2); font: inherit; cursor: pointer; transition: border-color 0.12s, background 0.12s, transform 0.12s;
}
.scale-btn b { font-size: 16px; }
.scale-btn span { font-size: 10.5px; line-height: 1.15; text-align: center; color: var(--muted); }
.scale-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.scale-btn.active { color: #fff; border-color: transparent; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.scale-btn.active span { color: rgba(255, 255, 255, 0.92); }
.scale-btn.g1.active { background: #e03131; } .scale-btn.g2.active { background: #f76707; } .scale-btn.g3.active { background: #f59f00; }
.scale-btn.g4.active { background: #74b816; } .scale-btn.g5.active { background: #2f9e44; } .scale-btn.g6.active { background: #0c8599; }
.scale-sel { display: none; }

/* ---------- exam wizard ---------- */
.modal-wizard .modal-body { position: relative; }
.wizard { position: relative; }
.wiz-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.wiz-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 38px; border: 0; border-radius: 9px; background: transparent;
  color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; overflow-wrap: anywhere;
}
.wiz-tab svg { width: 17px; height: 17px; }
.wiz-tab:hover { color: var(--text); }
.wiz-tab[aria-selected='true'] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.wiz-pane { margin-bottom: 16px; }
.wiz-filters { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.wiz-filters > select { width: auto; min-width: 220px; flex: 0 1 260px; }
.wiz-filters .grow { min-width: 160px; }
.exam-pick { height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overscroll-behavior: contain; }
.pick-year { position: sticky; top: 0; z-index: 1; padding: 6px 14px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); letter-spacing: 0.04em; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
.pick-item:hover { background: var(--surface-2); }
.pick-item:has(input:checked) { background: var(--accent-soft); }
.pick-item input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; margin: 0; }
.pick-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pick-title { font-size: 14px; font-weight: 550; }
.pick-sub { font-size: 12px; color: var(--muted); }
.pick-flag { font-size: 11px; font-weight: 600; color: var(--warn-fg); background: var(--warn-bg); padding: 1px 7px; border-radius: 99px; white-space: nowrap; }
.pick-loading, .pick-empty, .pick-error { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; font-size: 14px; }
.pick-loading { flex-direction: row; color: var(--muted); }
.pick-error b { color: var(--danger); }
.wiz-which { margin-top: 12px; gap: 10px; flex-wrap: wrap; }
.wiz-which .seg { max-width: 100%; flex-wrap: wrap; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 220px; padding: 24px; text-align: center;
  border: 2px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over, .dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
.drop-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--surface); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.drop-icon svg { width: 24px; height: 24px; }
.drop-text { display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.blank-preview { display: flex; justify-content: center; gap: 12px; padding: 18px; margin-bottom: 14px; background: var(--surface-2); border-radius: 12px; }
.blank-page {
  width: 64px; aspect-ratio: 210 / 297; background-color: #fff; border-radius: 3px; box-shadow: var(--shadow-sm);
  background-image: linear-gradient(#e4e8ef 1px, transparent 1px), linear-gradient(90deg, #e4e8ef 1px, transparent 1px); background-size: 8px 8px;
}
.wiz-common { border-top: 1px solid var(--border); padding-top: 16px; }
.wiz-common .row > .field, .wiz-common .grow2 > .field { margin-bottom: 0; }
.wiz-busy {
  position: absolute; inset: -8px -20px -16px; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(2px); text-align: center; padding: 20px;
}
.progress-text { font-size: 16px; font-weight: 650; }
.error-box > .small { margin-top: 4px; opacity: 0.9; }

/* ---------- auth ---------- */
.auth-page { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px 32px; outline: none; overflow: hidden; }
.auth-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(600px 400px at 12% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(520px 420px at 92% 90%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--bg);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 40%, rgba(0, 0, 0, 0.55) 100%);
  mask-image: radial-gradient(ellipse at center, #000 40%, rgba(0, 0, 0, 0.55) 100%);
}
.auth-light {
  position: fixed; top: 0; left: 0; z-index: 0; width: 620px; height: 620px;
  transform: translate3d(var(--pointer-x, -1000px), var(--pointer-y, -1000px), 0) translate(-50%, -50%);
  opacity: 0; pointer-events: none; transition: opacity 180ms ease-out;
}
[data-theme='dark'] .auth-light {
  background: radial-gradient(circle at center, rgba(245, 248, 255, 0.2) 0%, rgba(147, 171, 255, 0.11) 32%, transparent 76%);
}
[data-theme='light'] .auth-light {
  background: radial-gradient(circle at center, color-mix(in srgb, var(--accent) 18%, transparent) 0%, color-mix(in srgb, var(--accent) 9%, transparent) 35%, transparent 76%);
}
.auth-page[data-bg-hover='true'] .auth-light { opacity: 1; will-change: transform, opacity; }
.math-motes { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.math-mote {
  position: absolute; left: var(--left); bottom: -12vh; color: color-mix(in srgb, var(--accent) 72%, var(--text));
  font-size: var(--mote-size); line-height: 1; opacity: 0;
  filter: drop-shadow(0 6px 16px color-mix(in srgb, var(--accent) 18%, transparent));
  animation: math-float var(--float-time) linear var(--float-delay) infinite;
}
@keyframes math-float {
  0% { transform: translate3d(0, 0, 0) rotate(-12deg); opacity: 0; }
  12% { opacity: 0.22; }
  82% { opacity: 0.18; }
  100% { transform: translate3d(42px, -115vh, 0) rotate(18deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-light { transition: none; }
  .math-mote { animation: none; top: var(--mote-top); bottom: auto; opacity: 0.12; }
}
@media (hover: none), (pointer: coarse) { .auth-light { display: none; } }
.auth-corner { position: fixed; top: 14px; right: 14px; z-index: 2; }
.auth-corner .icon-btn { background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow-lg); padding: 32px 32px 24px; animation: rise 0.25s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.auth-card .brand { margin-bottom: 24px; }
.auth-title { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; outline: none; }
.auth-sub { margin: 6px 0 22px; color: var(--muted); font-size: 14.5px; line-height: 1.5; min-height: 1.5em; }
.auth-form .btn-lg { margin-top: 6px; }
.auth-switch { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; font-size: 14px; color: var(--muted); }
.auth-switch a { font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-actions { display: flex; flex-direction: column; gap: 8px; }
.auth-foot { position: relative; z-index: 1; margin: 22px 0 0; font-size: 13px; color: var(--muted); }
.seg-block { display: flex; width: 100%; }
.seg-block button { flex: 1; justify-content: center; height: 36px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 42px; width: 100%; }
.pw-toggle { position: absolute; right: 5px; }
.input-code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; letter-spacing: 0.1em; font-weight: 600; text-transform: uppercase; }
.input-code::placeholder { letter-spacing: 0.1em; font-weight: 400; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-row { grid-template-columns: 120px minmax(0, 1fr) auto; }
  .exam-actions { grid-column: 2 / -1; justify-content: flex-end; }
}
@media (max-width: 1100px) {
  .topnav { display: none; }
}
@media (max-width: 860px) {
  .charts, .account-grid { grid-template-columns: minmax(0, 1fr); }
  .user-name { display: none; }
  .user-btn { padding-right: 6px; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 56px; }
  .topbar-inner { padding: 8px 14px; gap: 10px; }
  .topbar.has-search .topbar-inner { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'brand actions' 'search search'; gap: 8px 10px; }
  .topbar.has-search .brand { grid-area: brand; justify-self: start; }
  .topbar.has-search .topbar-right { grid-area: actions; }
  .topbar.has-search .topbar-center { grid-area: search; }
  .topbar.has-search .search { max-width: none; }
  .page { padding: 22px 14px 56px; }
  .page-title { font-size: 23px; }
  .page-head { margin-bottom: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
  .sort-label { display: none; }
  .section-head { align-items: flex-start; }
  .stats { gap: 10px; }
  .stat { padding: 12px; gap: 10px; flex-direction: column; }
  .stat-icon { width: 34px; height: 34px; }
  .stat-value { font-size: 22px; }
  .folder-head { gap: 14px; }
  .avatar-xl { width: 52px; height: 52px; font-size: 18px; }
  .folder-actions { width: 100%; }
  .tab-long { display: none; }
  .tab-short { display: inline; }
  .tab { padding: 10px 10px 12px; }
  .exam-row { grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 10px; }
  .exam-result { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; min-width: 0; }
  .exam-actions { grid-column: 1 / -1; justify-content: stretch; }
  .exam-actions .btn { flex: 1; justify-content: center; }
  .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .topics thead { display: none; }
  .topics, .topics tbody, .topics tr, .topics td { display: block; width: 100%; }
  .topics tr { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); margin-bottom: 10px; padding: 10px 14px; box-shadow: var(--shadow-sm); }
  .topics tbody tr:hover { background: var(--surface); }
  .topics td { border: 0; padding: 4px 0; display: flex; gap: 10px; align-items: baseline; }
  .topics td[data-label]::before { content: attr(data-label); flex: none; width: 96px; font-size: 12px; font-weight: 600; color: var(--muted); }
  .td-date, .td-actions { width: 100%; }
  .td-actions { position: absolute; top: 4px; right: 6px; width: auto !important; padding: 0 !important; }
  .td-date { padding-right: 70px !important; }
  .scale { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wiz-tab { font-size: 13px; gap: 5px; }
  .wiz-tab svg { display: none; }
  .wiz-filters > select { flex: 1 1 100%; }
  .exam-pick { height: 240px; }
  .invite-row { flex-wrap: wrap; }
  .input-link { flex-basis: 100%; order: 3; }
  .auth-card { padding: 26px 20px 20px; border-radius: 16px; }
  .modal-foot { flex-wrap: wrap; }
  .catalog-exercise-data { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 400px) {
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat-sub { white-space: normal; }
  .card-foot { gap: 8px; }
}
