/* QS-Hub — brand stylesheet.
 * Palette (brand colour board): Navy #0B1F44 · Royal Blue #0066FF · Electric Blue #00C2FF · Gold #FFC629 · Light Grey #F1F5F9 · White.
 * Type: Manrope (vendored, /fonts). Mobile-first, WCAG AA text contrast in both themes.
 */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/manrope-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/manrope-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/manrope-latin-800-normal.woff2') format('woff2'); }

:root {
  --navy: #0B1F44; --royal: #0066FF; --electric: #00C2FF; --gold: #FFC629; --grey: #F1F5F9;
  --brand-gradient: linear-gradient(90deg, #0B1F44 0%, #0066FF 45%, #00C2FF 80%, #FFC629 100%);
  --hero-gradient: linear-gradient(135deg, #0B1F44 0%, #0F3A8F 55%, #0066FF 100%);

  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --surface-2: #E9EFF7;
  --text: #0B1F44;         /* 15.6:1 on white */
  --text-muted: #4A5A78;   /* 6.9:1 on white */
  --border: #D9E1EC;
  --accent: #0066FF;       /* 4.8:1 on white */
  --accent-text: #FFFFFF;
  --accent-soft: #E5EFFF;
  --btn-bg: #0066FF; --btn-text: #FFFFFF; /* primary buttons: white on royal, 4.8:1 in both themes */
  --accent-2: #00C2FF;     /* decorative only (not for text on light) */
  --danger: #B42318;       /* 6.5:1 on white */
  --danger-soft: #FEE4E2;
  --ok: #067647;           /* 5.6:1 on white */
  --ok-soft: #DCFAE6;
  --warn: #8A5A00;         /* 6.4:1 on white — gold family, text-safe */
  --warn-soft: #FFF1C2;
  --gold-fill: #FFC629;
  --focus: #FFC629;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11,31,68,.06), 0 6px 20px rgba(11,31,68,.06);
  --shadow-lg: 0 12px 40px rgba(11,31,68,.16);
  --tabbar-h: 62px;
  --topbar-h: 60px;
  --font: 'Manrope', system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1F44; --surface: #12294F; --surface-2: #1B3663;
    --text: #F1F5F9; --text-muted: #B8C6DF; --border: #2A4370;
    --accent: #4DA3FF; --accent-text: #0B1F44; --accent-soft: #1B3A6B; --accent-2: #00C2FF; --btn-bg: #0066FF; --btn-text: #FFFFFF;
    --danger: #FDA29B; --danger-soft: #55201C; --ok: #75E0A7; --ok-soft: #123B2A;
    --warn: #FFD966; --warn-soft: #4A3A0A; --gold-fill: #FFC629;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.35); --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --bg: #0B1F44; --surface: #12294F; --surface-2: #1B3663;
  --text: #F1F5F9; --text-muted: #B8C6DF; --border: #2A4370;
  --accent: #4DA3FF; --accent-text: #0B1F44; --accent-soft: #1B3A6B; --accent-2: #00C2FF; --btn-bg: #0066FF; --btn-text: #FFFFFF;
  --danger: #FDA29B; --danger-soft: #55201C; --ok: #75E0A7; --ok-soft: #123B2A;
  --warn: #FFD966; --warn-soft: #4A3A0A; --gold-fill: #FFC629;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.35); --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-weight: 500; font-size: 16px; line-height: 1.55;
  color: var(--text); background: var(--bg); min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
@media (min-width: 768px) { body { padding-bottom: 0; } }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
strong { font-weight: 700; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--navy); color: #fff; padding: .5rem .75rem; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface);
  border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top);
}
.topbar::before { content: ""; display: block; height: 3px; background: var(--brand-gradient); }
.topbar__inner { max-width: 1120px; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: 1rem; min-height: var(--topbar-h); }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand__logo { height: 30px; width: auto; display: block; }
.brand__logo--dark { display: none; }
:root[data-theme="dark"] .brand__logo--light { display: none; }
:root[data-theme="dark"] .brand__logo--dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand__logo--light { display: none; }
  :root:not([data-theme="light"]) .brand__logo--dark { display: block; }
}
.nav { display: none; gap: .25rem; margin-left: .75rem; }
.nav a { padding: .5rem .85rem; border-radius: 999px; text-decoration: none; color: var(--text-muted); font-weight: 700; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.nav a:hover { color: var(--text); }
@media (min-width: 768px) { .nav { display: flex; } }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.btn--signout { padding-inline: .7rem; }
@media (max-width: 479px) { .btn--signout__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .btn--signout { min-width: 44px; padding: .5rem; } }
.sync { font-size: .78rem; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: .25rem .6rem; border-radius: 999px; white-space: nowrap; }
.sync--offline { color: var(--warn); background: var(--warn-soft); }
.sync--pending { color: var(--text); background: var(--accent-soft); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ---------- Mobile tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px rgba(11,31,68,.06);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--text-muted); font-size: .72rem; font-weight: 700; border-radius: 12px; transition: background .15s, color .15s;
}
.tabbar a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
@media (min-width: 768px) { .tabbar { display: none; } }

.main { max-width: 1120px; margin: 0 auto; padding: 1rem; }
.main:focus { outline: none; } /* programmatic focus target after route changes; real controls keep :focus-visible */
@media (min-width: 768px) { .main { padding: 1.5rem; } }

.view-header { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.view-header h1 { margin: 0; }
.view-header .spacer { flex: 1; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: .75rem; }
.card--clickable { cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.card--clickable:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card--hero { background: var(--hero-gradient); color: #fff; border: 0; position: relative; overflow: hidden; }
.card--hero h1, .card--hero h2 { color: #fff; }
.card--hero .muted { color: rgba(255,255,255,.8); }
.card--hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(0,194,255,.35), transparent 65%); pointer-events: none; }
.card--hero .badge { background: rgba(255,255,255,.14); color: #fff; }
.card--hero .ring text { fill: #fff; }
.card--hero .ring__track { stroke: rgba(255,255,255,.25); }
.card--hero .ring__val { stroke: var(--gold-fill); }

.stack > * + * { margin-top: .75rem; }
.grid { display: grid; gap: .85rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row .grow { flex: 1 1 10rem; min-width: 0; }
.row > select, .row > input:not([type=checkbox]) { width: auto; max-width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1.05rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 700; cursor: pointer; text-decoration: none; transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--btn-bg); border-color: transparent; color: var(--btn-text); box-shadow: 0 6px 16px rgba(0,102,255,.25); }
.btn--primary:hover { background: var(--btn-bg); filter: brightness(1.08); }
.btn--danger { color: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--icon { min-width: 44px; padding: .5rem; }
.btn--sm { min-height: 36px; padding: .3rem .8rem; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field label { font-weight: 700; font-size: .92rem; }
.field .hint { font-size: .85rem; color: var(--text-muted); }
.field .error { font-size: .85rem; color: var(--danger); font-weight: 700; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 96px; resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.form-row { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } .form-row--3 { grid-template-columns: 1fr 1fr 1fr; } }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; font-weight: 700; padding: .18rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.badge--example { background: var(--warn-soft); color: var(--warn); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--accent { background: var(--accent-soft); color: var(--text); }
.badge--gold { background: var(--gold-fill); color: var(--navy); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .6rem 0; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1 1 12rem; min-width: 0; }
.list .actions { display: flex; gap: .25rem; margin-left: auto; }
.list form.row { flex: 1 1 100%; }
@media (max-width: 639px) { .list .actions { flex-basis: 100%; justify-content: flex-end; } }
.detail-header { margin-bottom: .5rem; }

/* ---------- Progress ---------- */
.weight-total { font-weight: 800; }
.weight-total--ok { color: var(--ok); }
.weight-total--bad { color: var(--danger); }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--royal), var(--electric)); border-radius: 999px; transition: width .3s; }
.ring { width: 44px; height: 44px; flex: none; }
.ring circle { fill: none; stroke-width: 4; }
.ring .ring__track { stroke: var(--surface-2); }
.ring .ring__val { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .4s; }
.ring--ok .ring__val { stroke: var(--ok); }
.ring--bad .ring__val { stroke: var(--danger); }
.ring text { font-size: 11px; font-weight: 800; fill: var(--text); text-anchor: middle; dominant-baseline: central; }

/* ---------- Banner / toast / dialog ---------- */
.banner { background: var(--warn-soft); color: var(--warn); padding: .5rem 1rem; text-align: center; font-size: .9rem; font-weight: 700; }
.banner--danger { background: var(--danger-soft); color: var(--danger); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: .65rem 1.1rem; border-radius: 999px; z-index: 50; max-width: 92vw; box-shadow: var(--shadow-lg); font-weight: 700;
  border-left: 4px solid var(--gold);
}
@media (min-width: 768px) { .toast { bottom: 24px; } }
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.25rem; max-width: min(520px, 92vw); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(11,31,68,.55); backdrop-filter: blur(2px); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100dvh - 2rem); display: grid; place-items: center; }
.auth { width: min(440px, 100%); }
.auth__brand { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin-bottom: 1rem; text-align: center; }
.auth__icon { width: 84px; height: 84px; border-radius: 22px; box-shadow: var(--shadow-lg); }
.auth__wordmark { height: 34px; }
.auth__tag { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 2rem 1rem; color: var(--text-muted); }
.empty__icon { font-size: 2rem; margin-bottom: .25rem; }

/* ---------- Conflicts ---------- */
.conflict { border-color: var(--danger); }
.conflict pre { background: var(--surface-2); padding: .5rem; border-radius: 8px; overflow: auto; font-size: .8rem; }

/* ---------- Notes / editor ---------- */
.note-editor select { max-width: 22rem; }
.note-title { font-size: 1.5rem; font-weight: 800; border: 0; border-bottom: 2px solid var(--border); border-radius: 0; padding: .25rem 0; background: transparent; }
.note-title:focus { outline: none; border-bottom-color: var(--accent); box-shadow: none; }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .1rem; }
.editor { position: relative; margin-top: .5rem; }
.editor__toolbar { display: flex; flex-wrap: wrap; gap: .15rem; padding: .3rem; border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--surface-2); position: sticky; top: calc(var(--topbar-h) + 3px + env(safe-area-inset-top)); z-index: 5; }
.editor__btn { min-height: 36px; min-width: 36px; padding: .25rem .55rem; font-size: .9rem; border-radius: 8px; }
.editor__sep { width: 1px; background: var(--border); margin: .25rem .2rem; }
.editor__body { min-height: 40vh; padding: .85rem; border: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: var(--surface); line-height: 1.65; outline: none; }
.editor__body:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.editor__body:empty::before, .editor__body:has(> br:only-child)::before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }
.editor__body h1 { font-size: 1.4rem; } .editor__body h2 { font-size: 1.2rem; margin-top: 1rem; } .editor__body h3 { font-size: 1.05rem; margin-top: .75rem; }
.editor__body blockquote { margin: .5rem 0; padding: .25rem .75rem; border-left: 3px solid var(--gold); color: var(--text-muted); }
.editor__body pre { background: var(--surface-2); padding: .5rem .75rem; border-radius: 8px; overflow: auto; font-family: var(--mono); font-size: .9rem; white-space: pre-wrap; }
.editor__body code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 0 .2rem; border-radius: 4px; }
.editor__body ul, .editor__body ol { padding-left: 1.5rem; }
.editor__body a { color: var(--accent); }
.wikilink { background: var(--accent-soft); border-radius: 6px; padding: 0 .3rem; text-decoration: none; font-weight: 700; cursor: pointer; }
.wikilink--missing { background: var(--warn-soft); color: var(--warn); border-bottom: 1px dashed currentColor; }
.editor__pop { position: absolute; z-index: 30; min-width: 14rem; max-width: 90%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: .25rem; }
.editor__pop-item { padding: .45rem .65rem; border-radius: 8px; cursor: pointer; }
.editor__pop-item.is-active, .editor__pop-item:hover { background: var(--accent-soft); }
mark { background: var(--warn-soft); color: inherit; padding: 0 .1rem; border-radius: 3px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart-wrap { margin: .25rem 0 .75rem; }
.chart__label { font-size: 12px; font-weight: 700; fill: var(--text-muted); font-family: var(--font); }
.chart__value { font-size: 12px; font-weight: 800; fill: var(--text); font-family: var(--font); }
.chart__track { fill: var(--surface-2); }
.chart__bar { fill: var(--accent); }
.chart__bar--hi { fill: var(--gold-fill); }
.chart__lost { fill: var(--danger-soft); }
.chart__target { stroke: var(--gold-fill); stroke-width: 2; stroke-dasharray: 3 3; }
.chart__axis { stroke: var(--border); }

/* ---------- Due states ---------- */
.due--soon { color: var(--warn); font-weight: 700; }
.due--overdue { color: var(--danger); font-weight: 700; }
.list li.is-overdue { background: linear-gradient(90deg, var(--danger-soft), transparent 40%); border-radius: 8px; padding-left: .4rem; }
.list li input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--royal); flex: none; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal__head { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); text-align: center; padding: .25rem 0; }
.cal__cell { min-height: 72px; border: 1px solid var(--border); border-radius: 8px; padding: .25rem; background: var(--surface); overflow: hidden; }
.cal__cell--pad { border: 0; background: transparent; }
.cal__cell--today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal__num { font-size: .8rem; font-weight: 800; color: var(--text-muted); }
.cal__cell--today .cal__num { color: var(--accent); }
.cal__ev { display: block; font-size: .68rem; font-weight: 700; line-height: 1.2; padding: 2px 4px; margin-top: 2px; border-radius: 4px; background: var(--accent-soft); color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__ev--assessment { background: var(--gold-fill); color: var(--navy); }
.cal__ev--done { opacity: .5; text-decoration: line-through; }
@media (max-width: 639px) { .cal__cell { min-height: 56px; } .cal__ev { font-size: .6rem; } }

/* ---------- Files ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; font-size: .9rem; color: var(--text-muted); }
.crumbs a { color: var(--accent); text-decoration: none; font-weight: 700; }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); font-weight: 700; }
.crumbs__sep { opacity: .6; }
.fi { display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 2rem; border-radius: 6px; font-size: .7rem; font-weight: 800; letter-spacing: .04em; background: var(--surface-2); color: var(--text-muted); flex: 0 0 auto; }
.fi--folder { font-size: 1.2rem; color: var(--accent); background: var(--accent-soft); }
.fi--pdf { background: var(--danger-soft); color: var(--danger); }
.fi--img { background: var(--ok-soft); color: var(--ok); }
.fi--xls { background: var(--ok-soft); color: var(--ok); }
.fi--doc, .fi--txt { background: var(--accent-soft); color: var(--accent); }
.fi--ppt { background: var(--warn-soft); color: var(--warn); }
.fi--cad, .fi--zip, .fi--aud, .fi--vid { background: var(--surface-2); color: var(--text); }
.dropzone { position: relative; transition: border-color .15s, box-shadow .15s; }
.dropzone--over { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dropzone--over::after { content: "Drop to upload"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; color: var(--accent); background: color-mix(in srgb, var(--surface) 85%, transparent); border-radius: var(--radius); pointer-events: none; }
[data-testid="file-list"] li, [data-testid="module-file-list"] li, [data-testid="note-file-list"] li { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% - .4rem); z-index: 5; min-width: 11rem; display: flex; flex-direction: column; padding: .3rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); }
.menu button { text-align: left; background: transparent; border: 0; color: var(--text); font: inherit; font-weight: 600; padding: .5rem .7rem; border-radius: 6px; cursor: pointer; min-height: 40px; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu button:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.menu__danger { color: var(--danger) !important; }
.usage .progress { height: 10px; }
dialog.preview { width: min(1100px, 96vw); max-width: 96vw; height: min(90vh, 900px); padding: .6rem; display: flex; flex-direction: column; }
dialog.preview[open] { display: flex; }
.preview__bar { flex: 0 0 auto; margin-bottom: .5rem; }
.preview__frame { flex: 1 1 auto; width: 100%; border: 0; border-radius: 8px; background: #fff; min-height: 0; }
.preview__img { flex: 1 1 auto; max-width: 100%; max-height: 100%; object-fit: contain; min-height: 0; margin: auto; border-radius: 8px; }
