:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --border: #e3e0d7;
  --text: #1d1c1a;
  --muted: #6b6860;
  --accent: #2f5d50;
  --accent-soft: #e2ece8;
  --accent-text: #ffffff;
  --warn: #a5561a;
  --warn-soft: #f8eadf;
  --danger: #a83232;
  --danger-soft: #f7e3e3;
  --ok: #2e7d4f;
  --ok-soft: #e1f1e7;
  --user-bubble: #2f5d50;
  --user-text: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --radius: 12px;
  --g-part: #7357c9; --g-insight: #3b78c9; --g-pitfall: #c4553a; --g-school: #d07a1f; --g-admit: #1d917d;
  --g-pattern: #a8861f; --g-source: #b3afa5; --g-you: #2f7d5c; --g-link: #d9d5cb; --g-finding: #c2477f;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161715;
    --surface: #1f201e;
    --surface-2: #272926;
    --border: #353733;
    --text: #ecebe6;
    --muted: #a3a199;
    --accent: #7fb8a6;
    --accent-soft: #23332e;
    --accent-text: #0f1a16;
    --warn: #e0a06a;
    --warn-soft: #3a2a1d;
    --danger: #e08585;
    --danger-soft: #3a2222;
    --ok: #7cc79a;
    --ok-soft: #1f3327;
    --user-bubble: #2c4a41;
    --user-text: #ecebe6;
    --shadow: none;
    --g-part: #a690f2; --g-insight: #77a6ec; --g-pitfall: #e8876d; --g-school: #f0a35e; --g-admit: #4fc6b0;
    --g-pattern: #dcbb57; --g-source: #5e5c56; --g-you: #7fcfa3; --g-link: #3a3c37; --g-finding: #e77fb0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 228px 1fr; height: 100vh; height: 100dvh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 12px; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 1.05rem; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-family: var(--serif); font-size: 1.1rem; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar .spacer { flex: 1; }
.brand .brand-name { flex: 1; }
.collapse-btn { display: grid; place-items: center; padding: 5px; }
.collapse-btn svg { width: 18px; height: 18px; }
.collapse-btn .chev { transition: transform .2s; transform-box: fill-box; transform-origin: center; }
/* the menu minimized to its icons (wide screens only; phones open it with the menu button) */
@media (min-width: 821px) {
  .app { transition: grid-template-columns .2s; }
  .app.collapsed { grid-template-columns: 64px 1fr; }
  .app.collapsed .sidebar { padding: 18px 8px; overflow-x: hidden; }
  .app.collapsed .brand { flex-direction: column; gap: 10px; padding: 4px 0 18px; }
  .app.collapsed .brand-name, .app.collapsed .sidebar .foot { display: none; }
  .app.collapsed .collapse-btn .chev { transform: rotate(180deg); }
  .app.collapsed .nav a { justify-content: center; gap: 0; padding: 9px 0; font-size: 0; }
}
@media (prefers-reduced-motion: reduce) { .app, .collapse-btn .chev { transition: none; } }
.sidebar .foot { padding: 10px 12px; font-size: .8rem; color: var(--muted); }
.sidebar .foot button { background: none; border: 0; color: var(--muted); padding: 0; cursor: pointer; text-decoration: underline; }
.main { overflow-y: auto; min-width: 0; }
.page { max-width: 980px; margin: 0 auto; padding: 28px 28px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; }
.topbar { display: none; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 20; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar button { background: none; border: 0; padding: 4px; cursor: pointer; }
  .topbar .title { font-weight: 650; }
  .collapse-btn { display: none; }
  .page { padding: 18px 16px 80px; }
}

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.grid > .card { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 550; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.ghost { border-color: transparent; background: none; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }
.iconbtn { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }

input[type=text], input[type=password], input[type=url], input[type=date], input[type=month], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 10px; }
.inline-form { display: grid; gap: 8px; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; }
.inline-form label { margin-bottom: 4px; }
@media (max-width: 820px) { .inline-form { grid-template-columns: 1fr 1fr; } .inline-form > :first-child { grid-column: 1 / -1; } }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.banner { padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); margin-bottom: 16px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; z-index: 50; font-weight: 500; max-width: 90vw; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.days { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 52px; }
.days.soon { color: var(--danger); }
.done-text { text-decoration: line-through; color: var(--muted); }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: .8rem; }
.chip.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.stat { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }

table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: .92rem; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }
.table select { padding: 4px 6px; font-size: .85rem; width: auto; }

/* ---------- markdown ---------- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.3em; }
.md li { margin: .2em 0; }
.md table { border-collapse: collapse; margin: .5em 0 .9em; font-size: .9rem; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
.md blockquote { margin: .5em 0; padding-left: 12px; border-left: 3px solid var(--border); color: var(--muted); }
.md h1, .md h2, .md h3 { margin: 1em 0 .4em; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; position: relative; }
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-inner { max-width: 760px; margin: 0 auto; padding: 24px 20px 12px; }
.msg { margin-bottom: 18px; display: flex; }
.msg.user { justify-content: flex-end; }
.msg .bubble { max-width: 85%; }
.msg.user .bubble { background: var(--user-bubble); color: var(--user-text); padding: 10px 14px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant .bubble { max-width: 100%; }
.msg.assistant .who { font-size: .78rem; font-weight: 650; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.msg.assistant .who .dot { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-family: var(--serif); font-size: .7rem; }
.msg .attach { font-size: .8rem; opacity: .85; margin-top: 4px; }
.steps { margin: 4px 0 8px; display: flex; flex-direction: column; gap: 4px; }
.step { font-size: .83rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.step .spin { width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.step .check { color: var(--ok); }
@keyframes spin { to { transform: rotate(360deg); } }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { border-top: 1px solid var(--border); background: var(--surface); padding: 12px 16px; }
.composer-inner { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 44px; max-height: 220px; resize: none; border-radius: 12px; }
.composer textarea:focus { min-height: 96px; transition: min-height .15s ease-out; }
@media (prefers-reduced-motion: reduce) { .composer textarea:focus { transition: none; } }
.attach-list { max-width: 760px; margin: 0 auto 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: .82rem; padding: 4px 6px 4px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.file-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: .8rem; }
.file-chip button:hover { color: var(--danger); }
.chat.dragging { outline: 2px dashed var(--accent); outline-offset: -8px; }
.chat.dragging::after { content: "Drop files to attach them"; position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--bg) 80%, transparent); pointer-events: none; }
.load-earlier { display: block; margin: 0 auto 16px; }

/* ---------- quick help (the circle in the corner) ---------- */
.helper-fab { position: fixed; right: 20px; bottom: var(--helper-bottom, 20px); z-index: 35; width: 52px; height: 52px;
  border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center;
  cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.2); transition: bottom .15s ease-out, transform .15s; }
.helper-fab:hover { transform: scale(1.06); }
.helper-fab:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.helper-panel { position: fixed; right: 20px; bottom: calc(var(--helper-bottom, 20px) + 64px); z-index: 35;
  width: min(380px, calc(100vw - 32px)); height: min(520px, calc(100dvh - var(--helper-bottom, 20px) - 96px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18); overflow: hidden; }
.helper-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--border); }
.helper-head .grow { min-width: 0; }
.helper-head .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.helper-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.helper-msg { max-width: 92%; padding: 8px 12px; border-radius: 14px; font-size: .9rem; word-wrap: break-word; }
.helper-msg.user { align-self: flex-end; background: var(--user-bubble); color: var(--user-text); border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.helper-msg.assistant { align-self: flex-start; background: var(--surface-2); border-radius: 14px 14px 14px 4px; }
.helper-msg.md > :first-child { margin-top: 0; } .helper-msg.md > :last-child { margin-bottom: 0; }
.helper-on { font-size: .72rem; opacity: .75; margin-top: 2px; white-space: normal; }
.helper-msgs .banner { font-size: .85rem; }
.helper-form { display: flex; gap: 6px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--border); }
.helper-form textarea { min-height: 38px; max-height: 140px; resize: none; border-radius: 10px; font-size: .9rem; padding: 8px 10px; }
@media (max-width: 820px) { .helper-fab, .helper-panel { right: 16px; } }
@media (prefers-reduced-motion: reduce) { .helper-fab { transition: none; } }

/* ---------- essays ---------- */
.editor textarea { min-height: 420px; font-family: var(--serif); font-size: 1.05rem; line-height: 1.7; padding: 16px 18px; }
.wordbar { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--muted); margin-top: 6px; gap: 10px; flex-wrap: wrap; }
.over { color: var(--danger); font-weight: 650; }
.prompt-box { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: .92rem; margin-bottom: 12px; white-space: pre-wrap; }
.limit-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: .92rem; margin-bottom: 12px; }
.limit-box > p { margin: 6px 0 0; }
.limit-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.limit-form > p { margin: 0 0 8px; }
.limit-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 170px)); gap: 10px; margin-bottom: 10px; }
.fold > summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; list-style: none; padding: 4px 0; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; width: 7px; height: 7px; margin: 0 4px 3px auto; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .2s; }
.fold[open] > summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
.fold > summary:hover .fold-title { color: var(--accent); }
.fold-title { font-weight: 650; }
.fold[open] > summary { margin-bottom: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.fold-less { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { .fold > summary::after { transition: none; } }
.review h3 { margin-top: 14px; }
.review .fix { border-left: 3px solid var(--warn); padding: 4px 0 4px 12px; margin: 10px 0; }
.review .officer { border-left: 3px solid var(--border); padding: 4px 0 4px 12px; margin: 10px 0; }
.review .officer .row { gap: 8px; margin-bottom: 2px; }
.review .quote { font-family: var(--serif); font-style: italic; color: var(--muted); }
.verdict { font-size: .85rem; }
.counter { font-size: .75rem; color: var(--muted); text-align: right; margin-top: 2px; }
.counter.over { color: var(--danger); }
.item-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); margin-bottom: 12px; }
.item-card .grid { gap: 8px; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pos { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.profile-field { padding: 8px 0; border-bottom: 1px solid var(--border); }
.profile-field:last-child { border-bottom: 0; }
.profile-field .value { white-space: pre-wrap; cursor: text; min-height: 1.5em; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; }
.profile-field .value:hover { background: var(--surface-2); }
.profile-field .value.unknown { color: var(--muted); font-style: italic; }

/* ---------- common app ---------- */
.ca-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; margin-top: 14px; align-items: start; }
.ca-nav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; }
.ca-nav a { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 500; }
.ca-nav a:hover { background: var(--surface-2); }
.ca-nav a.active { background: var(--accent-soft); color: var(--accent); }
.ca-nav .grow { flex: 1; }
.ca-done { color: var(--ok); font-weight: 700; }
.card.ca-sub { padding: 0; }
.ca-sub > summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px; cursor: pointer; list-style: none; }
.ca-sub > summary::-webkit-details-marker { display: none; }
.ca-sub > summary .grow { flex: 1; min-width: 140px; }
.ca-sub[open] > summary { border-bottom: 1px solid var(--border); }
.ca-sub-body { padding: 4px 18px 18px; }
.ca-state { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.ca-state.ok { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.ca-state.warn { border-color: var(--warn); color: var(--warn); }
.ca-intro { white-space: pre-line; margin: 12px 0 0; }
.ca-q { padding: 12px 0 2px; max-width: 640px; }
.ca-q > label { font-size: .9rem; color: var(--text); }
.ca-q .req { color: var(--danger); }
.ca-help { margin: -2px 0 6px; }
.ca-opts { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ca-opts label { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: inherit; font-weight: 400; color: var(--text); cursor: pointer; }
.ca-opts input { margin-top: 5px; flex: none; }
.ca-flags { margin-top: 4px; }
.ca-rep .item-card, .ca-mirror .item-card { margin: 12px 0 0; }
.ca-mirror { margin-top: 12px; }
.ca-line { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.ca-line:last-child { border-bottom: 0; }
.ca-entered { display: flex; gap: 8px; align-items: center; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: .9rem; font-weight: 550; color: var(--text); cursor: pointer; }
@media (max-width: 820px) {
  .ca-layout { grid-template-columns: minmax(0, 1fr); }
  .ca-nav { position: static; flex-direction: row; overflow-x: auto; }
  .ca-nav a { white-space: nowrap; }
}

/* ---------- brain ---------- */
.brain-page { max-width: 1280px; }
.brain-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.brain-stats > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.brain-stats b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.brain-stats span { font-size: .78rem; color: var(--muted); }
.graph-card { position: relative; padding: 0; overflow: hidden; height: min(72vh, 780px); min-height: 420px; }
.graph { position: absolute; inset: 0; }
.graph-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; pointer-events: none; flex-wrap: wrap; }
.graph-top > * { pointer-events: auto; }
.graph-search { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px 10px 3px 3px; }
.graph-search input { border: 0; width: 210px; padding: 6px 8px; background: transparent; color: inherit; outline: none; -webkit-appearance: none; appearance: none; font: inherit; }
.graph-legend { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 640px; }
.legend-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; opacity: .55; }
.legend-chip.on { opacity: 1; color: var(--text); }
.legend-chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.graph-tools { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 5px 8px; }
.graph-tools select { width: auto; padding: 3px 6px; font-size: .8rem; }
.toggle { display: inline-flex; gap: 5px; align-items: center; margin: 0; color: var(--text); font-weight: 500; cursor: pointer; }
.graph-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); pointer-events: none; padding: 20px; }
.note-panel { position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(420px, calc(100% - 20px)); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.12); padding: 16px 18px; z-index: 2; }
.note-panel h2 { margin-right: 26px; }
.panel-close { position: absolute; top: 10px; right: 10px; }
.note-body { font-size: .92rem; }
.md sup { font-size: .68em; line-height: 0; }
.md sup a { color: var(--muted); text-decoration: none; }
.md sup a:hover { color: var(--accent); text-decoration: underline; }
.note-body h2 { font-size: 1rem; margin-top: 1.2em; }
.note-links { list-style: none; margin: 0 0 12px; padding: 0; }
.note-links a { display: flex; gap: 8px; align-items: baseline; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .88rem; }
.note-links a:hover { background: var(--surface-2); }
.note-links i { width: 8px; height: 8px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.note-links .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.note-panel h4, .note-page h4 { margin: 16px 0 6px; font-size: .85rem; }
.finding { padding: 8px 0; border-bottom: 1px solid var(--border); }
.finding .quote { font-family: var(--serif); font-style: italic; color: var(--muted); margin: 3px 0; }
.brain-lower { margin-top: 14px; align-items: start; }
.brain-lower .card + .card { margin-top: 0; }
.part-grid { display: grid; gap: 8px; }
.part-tile { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; }
.part-tile.done { border-color: color-mix(in srgb, var(--g-part) 35%, var(--border)); }
.note-page { max-width: 860px; }
.final-card .grow { flex: 1; min-width: 240px; }
.positioning { font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; margin: 12px 0; }
.playbook summary { cursor: pointer; padding: 4px 0; }
.playbook ul { margin: 4px 0 8px; padding-left: 1.2em; }
.playbook li { margin: 4px 0; }
.playbook .checklist { list-style: "☐  "; }
.rubric { width: 100%; border-collapse: collapse; margin: 6px 0 4px; font-size: .88rem; }
.rubric td { padding: 5px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dots { white-space: nowrap; letter-spacing: 1px; color: var(--accent); }
@media (max-width: 820px) {
  .brain-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .brain-stats > div { padding: 8px 10px; }
  .brain-stats b { font-size: 1.15rem; }
  .graph-card { height: 64vh; min-height: 360px; }
  .graph-search input { width: 140px; }
  .graph-legend { display: none; }
  .positioning { font-size: 1.05rem; }
  .note-panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72vh; border-radius: 16px 16px 0 0; z-index: 40; }
}

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; }
