/* IQDC Drills — collegiate plum and marigold, index-card study surfaces. */

:root {
  --bg: #F7F5FB;
  --surface: #FFFFFF;
  --surface-2: #F0ECF7;
  --ink: #221B33;
  --ink-2: #5D5672;
  --line: #E3DDEE;
  --plum: #4B2E83;
  --plum-ink: #FFFFFF;
  --plum-soft: #ECE6F7;
  --gold: #F4A938;
  --gold-deep: #9A6108;
  --sage: #2E8B6E;
  --rose: #C2415D;
  --amber: #B97712;
  --focus: #4B2E83;

  --d-gk: #D9822B;
  --d-gs: #2F7FB8;
  --d-bms: #C2415D;
  --d-bcs: #6C4BB4;
  --d-cs: #2E8B6E;

  --ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --read: 'Literata', Georgia, 'Times New Roman', serif;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 0 rgba(34, 27, 51, .04), 0 10px 30px -12px rgba(75, 46, 131, .25);
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15111E;
    --surface: #1F1A2B;
    --surface-2: #2A2339;
    --ink: #F1EDF8;
    --ink-2: #B5ADC8;
    --line: #352D46;
    --plum: #B79BEA;
    --plum-ink: #1B1229;
    --plum-soft: #2E2445;
    --gold: #F6B955;
    --gold-deep: #F6B955;
    --sage: #5CC4A2;
    --rose: #EE7590;
    --amber: #E6A84A;
    --focus: #CDB8F5;
    --d-gk: #EBA25A;
    --d-gs: #6AAEDD;
    --d-bms: #EE7590;
    --d-bcs: #A88AE6;
    --d-cs: #5CC4A2;
    --shadow-card: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 32px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--ui);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
body.has-nav main { padding-bottom: calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px 32px;
}

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.125rem; font-weight: 700; margin: 28px 0 12px; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 12px; }
a { color: var(--plum); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.space { justify-content: space-between; }
.row.space h2 { margin: 0; }
section + section { margin-top: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 999px;
  font: 700 .95rem/1 var(--ui); text-decoration: none; cursor: pointer;
  background: var(--surface-2); color: var(--ink);
  transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: default; }
.btn-primary { background: var(--plum); color: var(--plum-ink); }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--rose); color: #fff; }
.btn-danger-quiet { background: transparent; color: var(--rose); border-color: color-mix(in srgb, var(--rose) 40%, transparent); }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-small { min-height: 34px; padding: 0 14px; font-size: .85rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn[disabled] { opacity: .35; cursor: default; }
.back { display: inline-grid; place-items: center; width: 40px; height: 40px; margin: 0 0 6px -10px; color: var(--ink); border-radius: 50%; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.field label, .field legend { font-weight: 700; font-size: .9rem; padding: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: 400 1rem/1.4 var(--ui);
}
textarea { resize: vertical; font-family: var(--read); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--plum); box-shadow: 0 0 0 3px var(--plum-soft); }
.field .row input[type=number] { width: 6rem; flex: none; }
.hint { color: var(--ink-2); font-size: .85rem; margin: 0; }
.form-error { color: var(--rose); font-weight: 600; margin: 0; }
.check { display: flex; gap: 10px; align-items: center; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--plum); }
.checks { display: grid; gap: 2px; }

/* ---------- auth ---------- */
.auth { padding-top: 6vh; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-brand img { border-radius: 14px; }
.auth-name { margin: 0; font-weight: 800; font-size: 1.1rem; }
.auth h1 { font-size: 2rem; margin-bottom: 8px; }
.auth .lead { color: var(--ink-2); margin-bottom: 24px; }
.auth-footer { margin-top: 24px; color: var(--ink-2); line-height: 2; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; padding: 16px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.splash { display: grid; justify-items: center; gap: 16px; padding-top: 30vh; color: var(--ink-2); }
.splash img { border-radius: 16px; }

/* ---------- page heads ---------- */
.page-head { margin-bottom: 18px; }
.page-head .crumbs { color: var(--ink-2); font-size: .85rem; margin: 0 0 2px; }
.page-head .muted { margin: 6px 0 0; }
.page-head[style*="--hue"] h1 { box-shadow: inset 0 -.32em 0 color-mix(in srgb, var(--hue) 22%, transparent); display: inline; }
.greet { font-size: 1.5rem; font-weight: 800; margin: 0; }
.role-line { margin: 6px 0 0; font-weight: 600; color: var(--plum); }

/* ---------- home ---------- */
.today {
  display: grid; grid-template-columns: 128px 1fr; gap: 18px; align-items: center;
  padding: 18px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-card);
}
.ring { position: relative; width: 128px; height: 128px; }
.ring-svg { width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.ring-fill { fill: none; stroke: var(--plum); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.2, .8, .2, 1); }
.ring-fill.is-earned { stroke: var(--gold); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-num { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.ring-of { color: var(--ink-2); font-size: .85rem; }
.today.is-earned .ring-label { color: var(--gold-deep); }
.today-status { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.streak { display: flex; gap: 6px; align-items: center; color: var(--ink-2); margin: 0; }
.streak svg { color: var(--gold); }
.home-rank { margin: 6px 0 0; font-weight: 600; }
.home-rank:empty { display: none; }
.waiting { margin-top: 16px; }
.waiting-row { display: flex; gap: 24px; margin-bottom: 14px; padding: 0 4px; }
.waiting-row strong { font-size: 1.5rem; font-weight: 800; }
.waiting-row span { color: var(--ink-2); }

.domain-list, .deck-list, .hub, .member-list, .class-list, .card-list, .pending-list, .lb-list { list-style: none; margin: 0; padding: 0; }
.domain-link, .deck-root {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center;
  padding: 12px 6px 12px 12px; border-radius: var(--radius); text-decoration: none; color: inherit;
}
.domain-link:hover, .deck-root:hover, .deck-row:hover, .member-row:hover, .hub-item:hover { background: var(--surface-2); }
.domain-chip {
  display: inline-grid; place-items: center; min-width: 44px; height: 30px; padding: 0 6px; border-radius: 8px;
  background: color-mix(in srgb, var(--hue, var(--plum)) 16%, transparent); color: var(--hue, var(--plum));
  font-weight: 800; font-size: .78rem; letter-spacing: .02em;
}
.domain-name { font-weight: 600; }
.domain-due { color: var(--ink-2); font-size: .9rem; }

/* ---------- decks ---------- */
.deck-list-roots .deck-root { grid-template-columns: auto 1fr auto; padding: 14px 6px 14px 12px; }
.deck-root-text { display: grid; }
.deck-root-name { font-weight: 700; }
.deck-root-meta { color: var(--ink-2); font-size: .875rem; }
.deck-row {
  display: grid; grid-template-columns: 1fr auto 18px; gap: 10px; align-items: center;
  padding: 13px 6px 13px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
}
.deck-row-name { font-weight: 600; }
.deck-row-meta { display: flex; gap: 6px; color: var(--ink-2); font-size: .85rem; }
.pill { padding: 2px 9px; border-radius: 999px; background: var(--surface-2); font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.pill-due { background: var(--plum-soft); color: var(--plum); }
.pill-done { color: var(--sage); background: color-mix(in srgb, var(--sage) 12%, transparent); }
.deck-summary { background: var(--surface); border-radius: 22px; padding: 18px; box-shadow: var(--shadow-card); display: grid; gap: 14px; }
.tally { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; }
.tally div { display: grid; }
.tally dt { color: var(--ink-2); font-size: .85rem; }
.tally dd { margin: 0; font-size: 1.6rem; font-weight: 800; }

/* ---------- study: the index card ---------- */
.study { max-width: 640px; margin: 0 auto; }
.study-bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: -6px -6px 10px; }
.study-title { text-align: center; min-width: 0; }
.study-title p { margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.study-counts { display: flex; justify-content: center; gap: 14px; font-weight: 800; font-size: .9rem; margin: 0; }
.c-new { color: var(--d-gs); }
.c-learn { color: var(--rose); }
.c-review { color: var(--sage); }
.study-stage { display: grid; gap: 18px; }

.flashcard {
  position: relative;
  min-height: 46dvh;
  padding: 26px 22px 26px 30px;
  background: var(--surface);
  border-radius: 6px 18px 18px 6px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  animation: card-in .28s ease-out;
}
.flashcard::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 8px;
  background: var(--hue, var(--plum)); border-radius: 6px 0 0 6px;
}
.card-where { color: var(--ink-2); font-size: .82rem; font-weight: 600; margin: 0 0 18px; display: flex; gap: 8px; align-items: center; }
.new-badge { background: color-mix(in srgb, var(--d-gs) 16%, transparent); color: var(--d-gs); padding: 1px 8px; border-radius: 999px; font-weight: 800; }
.question-text { font: 500 clamp(1.25rem, 4.6vw, 1.55rem)/1.45 var(--read); margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-answer {
  margin-top: 26px; padding-top: 22px;
  border-top: 2px dashed color-mix(in srgb, var(--hue, var(--plum)) 45%, transparent);
  animation: answer-in .22s ease-out;
}
.answer-text { font: 600 clamp(1.15rem, 4.2vw, 1.4rem)/1.45 var(--read); color: var(--plum); margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@keyframes card-in { from { opacity: 0; transform: translateY(8px) rotate(-.4deg); } }
@keyframes answer-in { from { opacity: 0; transform: translateY(-6px); } }

.study-actions { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); }
.rating-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rate {
  display: grid; gap: 2px; justify-items: center; padding: 10px 4px; min-height: 60px;
  border: 0; border-radius: 14px; cursor: pointer; font-family: var(--ui);
  background: var(--surface); box-shadow: inset 0 0 0 2px var(--rc); color: var(--ink);
}
.rate:active { transform: scale(.97); }
.rate-label { font-weight: 800; color: var(--rc); }
.rate-when { font-size: .8rem; color: var(--ink-2); }
.r-again { --rc: var(--rose); }
.r-hard { --rc: var(--amber); }
.r-good { --rc: var(--plum); }
.r-easy { --rc: var(--sage); }
.r-good { background: var(--plum); box-shadow: none; }
.r-good .rate-label, .r-good .rate-when { color: var(--plum-ink); }
.study-done { text-align: center; padding: 10vh 8px 0; display: grid; gap: 12px; justify-items: center; }
.study-done h2 { font-size: 1.6rem; margin: 0; }
.study-done .earned { color: var(--gold-deep); font-weight: 700; }
.study-done .btn-block { max-width: 320px; }
.save-banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 10px 14px; margin-bottom: 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--amber) 15%, var(--surface)); font-size: .9rem; font-weight: 600;
}
.save-banner[hidden] { display: none; }

/* ---------- leaderboard ---------- */
.lb-controls { display: grid; gap: 10px; margin-bottom: 14px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.segmented button {
  min-height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2);
  font: 700 .9rem var(--ui); cursor: pointer;
}
.segmented button.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.lb-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin-bottom: 8px; }
.lb-period { text-align: center; margin: 0; font-size: 1.05rem; }
.lb-me { font-weight: 700; padding: 12px 14px; border-radius: 12px; background: var(--plum-soft); color: var(--plum); }
.lb-row {
  display: grid; grid-template-columns: 34px 1fr auto 40px; gap: 10px; align-items: center;
  padding: 11px 8px; border-bottom: 1px solid var(--line);
}
.lb-row.is-me { background: var(--plum-soft); border-radius: 12px; border-bottom-color: transparent; }
.lb-rank { font-weight: 800; text-align: center; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lb-row.top-1 .lb-rank { color: #1B1229; background: var(--gold); border-radius: 50%; width: 30px; height: 30px; line-height: 30px; }
.lb-row.top-2 .lb-rank, .lb-row.top-3 .lb-rank { color: var(--gold-deep); }
.lb-who { display: grid; min-width: 0; }
.lb-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.you { color: var(--ink-2); font-weight: 500; }
.lb-class { color: var(--ink-2); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-score { text-align: right; font-variant-numeric: tabular-nums; }
.lb-score strong { font-size: 1.15rem; }
.lb-score span { color: var(--ink-2); font-size: .85rem; }
.lb-score small { display: block; color: var(--ink-2); font-size: .75rem; }
.lb-streak { display: inline-flex; gap: 2px; align-items: center; justify-content: flex-end; color: var(--gold-deep); font-weight: 800; font-size: .85rem; }
.lb-streak svg { color: var(--gold); }
.lb-class-group h3 { margin: 22px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.lb-class-total { margin-left: auto; font-weight: 600; color: var(--ink-2); font-size: .85rem; }

/* ---------- admin ---------- */
.hub-item, .member-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 14px 8px 14px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
}
.member-row { grid-template-columns: 1fr auto 18px; }
.hub-text { display: grid; gap: 2px; }
.hub-text span { color: var(--ink-2); font-size: .9rem; }
.hub-badge { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--gold); color: #1B1229; font-size: .78rem; }
.member-who { display: grid; min-width: 0; }
.member-who span { color: var(--ink-2); font-size: .85rem; overflow-wrap: anywhere; }
.member-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.tag { padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 800; background: color-mix(in srgb, var(--hue, var(--plum)) 16%, transparent); color: var(--hue, var(--plum)); }
.tag-super { background: var(--gold); color: #1B1229; }
.pending-card { display: grid; gap: 12px; padding: 16px; margin-bottom: 10px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
.pending-card p { margin: 0; }
.card-panel { background: var(--surface); border-radius: var(--radius); padding: 18px; border: 1px solid var(--line); margin-bottom: 14px; }
.card-panel h2 { margin: 0; }
.class-row {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.class-list + .btn { margin-top: 16px; }
.card-item {
  width: 100%; display: grid; gap: 4px; text-align: left; padding: 12px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.card-item:hover { background: var(--surface-2); }
.card-q { font-family: var(--read); font-weight: 500; }
.card-a { color: var(--plum); font-family: var(--read); font-size: .92rem; }
.columns { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.columns dt { font-weight: 800; font-family: var(--ui); }
.columns dd { margin: 0; color: var(--ink-2); font-size: .92rem; }
.dropzone {
  display: grid; justify-items: center; gap: 8px; padding: 28px 16px; margin: 6px 0 18px;
  border: 2px dashed var(--line); border-radius: var(--radius); color: var(--plum); font-weight: 700; cursor: pointer; text-align: center;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--plum); background: var(--plum-soft); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.preview { border-collapse: collapse; width: 100%; font-size: .85rem; }
.preview th, .preview td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.preview th { background: var(--surface-2); }
.preview td:first-child { color: var(--ink-2); }
.error-list { padding-left: 18px; }
.error-list li { margin-bottom: 6px; }
.done-panel { border-color: color-mix(in srgb, var(--sage) 50%, transparent); }
.done-panel ul { margin: 0; padding-left: 18px; }

/* ---------- dialogs & toasts ---------- */
.dialog {
  width: min(480px, calc(100vw - 24px)); border: 0; border-radius: 20px; padding: 22px;
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
}
.dialog-wide { width: min(600px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(21, 17, 30, .55); }
.dialog h2 { margin: 0 0 6px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.dialog-actions .btn-danger-quiet { margin-right: auto; }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; pointer-events: none; z-index: 50; padding: 0 16px; }
.toast {
  max-width: 480px; padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg);
  font-weight: 600; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); animation: answer-in .2s ease-out;
}
.toast-success { background: var(--sage); color: #fff; }
.toast-error { background: var(--rose); color: #fff; }

/* ---------- bottom navigation ---------- */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center; gap: 4px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
#nav[hidden] { display: none; }
.tab {
  flex: 1; max-width: 110px; display: grid; justify-items: center; align-content: center; gap: 2px;
  border-radius: 12px; color: var(--ink-2); text-decoration: none; font-size: .72rem; font-weight: 700;
}
.tab.is-active { color: var(--plum); }
.tab.is-active svg { stroke-width: 2.3; }

@media (min-width: 720px) {
  main { padding-top: 40px; }
  .flashcard { min-height: 380px; padding: 34px 34px 34px 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- section navigation: sidebar (wide screens) and tabs (phones) ---------- */
#side[hidden] { display: none; }
#side { display: none; }
.side-title {
  display: block; padding: 6px 12px 10px; font-weight: 800; font-size: 1.15rem;
  color: var(--ink); text-decoration: none; border-radius: 10px;
}
.side-title.is-on { color: var(--plum); }
.side-subtitle { margin: 18px 12px 6px; color: var(--ink-2); font-size: .82rem; font-weight: 700; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 40px; padding: 8px 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.side-link:hover { background: var(--surface-2); }
.side-link.is-on { background: var(--plum-soft); color: var(--plum); box-shadow: inset 3px 0 0 var(--plum); }
.side-badge { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--gold); color: #1B1229; font-size: .75rem; font-weight: 800; text-align: center; line-height: 20px; }
.side-badge[hidden] { display: none; }
.side-count { color: var(--plum); font-size: .78rem; font-weight: 800; }
.tree-children { margin-left: 14px; padding-left: 8px; border-left: 1px solid var(--line); }
.tree-link { font-weight: 500; }
.tree-link.is-root { font-weight: 700; }
.tree-link.is-root .tree-name::before {
  content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px;
  background: var(--hue, var(--plum)); vertical-align: middle;
}
.tree-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; }
.tree-caret, .tree-caret-space { display: none; }

/* phones: a scrollable row of tabs above admin pages */
.subtabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: -6px -16px 16px; padding: 4px 16px 8px;
  border-bottom: 1px solid var(--line);
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: .88rem;
}
.subtab.is-on { background: var(--plum); color: var(--plum-ink); }

/* clickable path above a deck's name */
nav.crumbs { color: var(--ink-2); font-size: .85rem; margin: 0 0 2px; }
nav.crumbs a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
nav.crumbs a:hover { color: var(--plum); text-decoration: underline; }

@media (min-width: 900px) {
  body.has-side #layout {
    display: grid; grid-template-columns: 250px minmax(0, 560px); gap: 40px;
    justify-content: center; padding: 0 24px;
  }
  body.has-side main { margin: 0; padding-left: 0; padding-right: 0; }
  body.has-side #side:not([hidden]) {
    display: block; position: sticky; top: 0; align-self: start;
    max-height: calc(100dvh - var(--nav-h)); overflow-y: auto;
    padding: 40px 0 24px;
  }
  body.has-side .subtabs { display: none; }
}

/* ---------- suggestions ---------- */
.card-credit { margin: 14px 0 0; text-align: right; font: 500 .78rem/1.3 var(--ui); color: var(--ink-2); }
.sugg-list, .sugg-mine { list-style: none; margin: 0; padding: 0; }
.sugg-card {
  position: relative; display: grid; gap: 8px; padding: 16px 16px 16px 22px; margin-bottom: 12px;
  background: var(--surface); border-radius: 6px 14px 14px 6px; box-shadow: var(--shadow-card);
}
.sugg-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; border-radius: 6px 0 0 6px; background: var(--hue, var(--plum)); }
.sugg-card p { margin: 0; }
.sugg-where { display: flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: .85rem; font-weight: 600; }
.sugg-where .domain-chip { height: 24px; min-width: 38px; font-size: .72rem; }
.sugg-q { font-family: var(--read); font-weight: 500; margin: 0; }
.sugg-a { font-family: var(--read); color: var(--plum); }
.sugg-meta { color: var(--ink-2); font-size: .82rem; margin: 2px 0 0; }
.sugg-reason { margin: 4px 0 0; font-size: .85rem; color: var(--ink); }
.sugg-mine li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.sugg-mine li:last-child { border-bottom: 0; }
.status { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 800; font-size: .74rem; }
.status-pending { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.status-accepted { background: color-mix(in srgb, var(--sage) 16%, transparent); color: var(--sage); }
.status-declined { background: var(--surface-2); color: var(--ink-2); }
.link-btn { border: 0; background: none; padding: 0; color: var(--plum); font: 700 .82rem var(--ui); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.notice { padding: 14px 16px; border-radius: 12px; background: var(--plum-soft); }
.notice p { margin: 0; font-weight: 600; color: var(--plum); }
.notice[hidden] { display: none; }
[hidden] { display: none !important; }
