/* Copied from stroodle-planning/design/stroodle.css. Change the design there first, then copy it here.
   App-only additions (validation, Blazor) live in app.css. */
/* Stroodle — shared design tokens and components */
:root {
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --line: #DCDFE5;
  --line-soft: #ECEEF1;
  --field-line: #C3C8D1;
  --text: #15181D;
  --text-2: #2D323B;
  --muted: #5A6170;
  --accent: #2449D8;
  --accent-ink: #1A37A8;
  --accent-soft: #E6ECFC;
  --ok: #0B5E53;
  --ok-soft: #DFF2EE;
  --warn: #8A3F0E;
  --warn-soft: #FBEBDD;
  --danger: #A33A3A;
  /* recap blocks — colours from the Typst templates */
  --b-def: #3B5B8C;
  --b-steps: #15181D;
  --b-ex: #2F7A4F;
  --b-key: #8A6D1F;
  --b-key-bg: #FBF7EC;
  --b-key-line: #E7DCBD;
  --b-pit: #A33A3A;
  --b-todo: #B05A1E;
  --b-q: #5A3F7A;
  --b-formula: #5A6170;
  --radius: 4px;
  --sans: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', Consolas, monospace;
  --math: 'STIX Two Text', 'Times New Roman', serif;
  /* surfaces and states (light values; dark ones below) */
  --surface-2: #FAFAFB;
  --surface-3: #F7F8FA;
  --chip: #EEF0F3;
  --badge-muted-bg: #E8EAEE;
  --badge-muted-text: #4B5563;
  --muted-2: #6B7280;
  --faint: #8A919C;
  --faint-line: #9AA1AD;
  --card-line: #AEB4BF;
  --on-strong: #FFFFFF;
  --on-strong-muted: #C9CED6;
  --accent-fill: #2449D8;
  --accent-fill-hover: #1A37A8;
  --accent-line: #C5D2F6;
  --accent-mid: #7F95E6;
  --accent-deep: #13286F;
  --accent-paper: #F2F5FE;
  --accent-faint: #F8FAFF;
  --ok-line: #B9DFD6;
  --ok-ink: #0A3F38;
  --warn-line: #E7C9A9;
  --warn-faint: #FDF6EF;
  --warn-paper: #FFFBF4;
  --warn-tint: #FDF1E7;
  --danger-soft: #FBEAEA;
  --danger-line: #E3B8B8;
  --danger-faint: #FFF6F6;
  --danger-ink: #7A2424;
  --highlight: #FDF1C7;
  --bookmark: #6B3FA0;
  --bookmark-bg: #F3EDFA;
  --shadow: rgba(21, 24, 29, 0.25);
  color-scheme: light;
}

/* Dark: set on <html> by js/theme.js (the user's choice, or the system's), and by the chat client for the views in the AI's chat. */
:root[data-theme="dark"] {
  --bg: #15171B;
  --surface: #1D2026;
  --line: #343841;
  --line-soft: #2A2D34;
  --field-line: #4A505B;
  --text: #E9EBEF;
  --text-2: #CDD1D8;
  --muted: #9DA3AE;
  --accent: #7D9BFF;
  --accent-ink: #A9BCFF;
  --accent-soft: #24304F;
  --ok: #6FD3BF;
  --ok-soft: #173A34;
  --warn: #F0A56B;
  --warn-soft: #3D2A1C;
  --danger: #F08A8A;
  --b-def: #8FB0E0;
  --b-steps: #E9EBEF;
  --b-ex: #7ACB9A;
  --b-key: #E2C470;
  --b-key-bg: #2A2618;
  --b-key-line: #4A4126;
  --b-pit: #F08A8A;
  --b-todo: #F0A56B;
  --b-q: #C3A6E6;
  --b-formula: #AEB4BF;
  --surface-2: #181A1F;
  --surface-3: #24272E;
  --chip: #2A2E36;
  --badge-muted-bg: #2E323A;
  --badge-muted-text: #C7CBD3;
  --muted-2: #A0A6B1;
  --faint: #7D838E;
  --faint-line: #5A606B;
  --card-line: #4A505B;
  --on-strong: #15171B;
  --on-strong-muted: #4A505B;
  --accent-fill: #3558E0;
  --accent-fill-hover: #2747C4;
  --accent-line: #34477A;
  --accent-mid: #5670C8;
  --accent-deep: #BFCCFF;
  --accent-paper: #212A44;
  --accent-faint: #1C2236;
  --ok-line: #2E6B60;
  --ok-ink: #8FE0CF;
  --warn-line: #6B4A2E;
  --warn-faint: #2B2119;
  --warn-paper: #2A2118;
  --warn-tint: #3D2A1C;
  --danger-soft: #3A2224;
  --danger-line: #7A4A4E;
  --danger-faint: #2E1E20;
  --danger-ink: #F5B3B3;
  --highlight: #5A4A12;
  --bookmark: #C3A6E6;
  --bookmark-bg: #2E2540;
  --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

.app { min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
.app a { color: var(--accent); }
.app a:hover { color: var(--accent-ink); }
.app *, .app *::before, .app *::after { box-sizing: border-box; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: flex; align-items: stretch; gap: 24px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--text) !important; text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { display: flex; align-items: center; min-height: 56px; padding: 0 12px; font-size: 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 500; border-bottom-color: var(--accent); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius); background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--bg); }

/* layout */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px 72px; display: flex; flex-direction: column; gap: 28px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.split { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.split > .main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split > .side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; }

/* type */
.eyebrow { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.h1 { margin: 0; font-size: 32px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
.h2 { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 600; }
.h3 { margin: 0; font-size: 15px; line-height: 1.35; font-weight: 600; }
.lead { margin: 0; max-width: 640px; font-size: 16px; line-height: 1.55; color: var(--text-2); }
.p { margin: 0; line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.num { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.panel-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.list-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.list-row:first-child { border-top: 0; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 14px; line-height: 1.5; }
.callout.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.callout.info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.danger-zone { border-color: var(--danger-line); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--radius); font: 500 14px var(--sans); text-decoration: none !important; white-space: nowrap; cursor: pointer; }
.btn-primary { background: var(--accent-fill); color: #FFFFFF !important; }
.btn-primary:hover { background: var(--accent-fill-hover); }
.btn-secondary { background: var(--surface); border-color: var(--field-line); color: var(--text) !important; }
.btn-secondary:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--text) !important; text-decoration: underline !important; text-underline-offset: 3px; padding: 0 10px; }
.btn-danger { background: var(--surface); border-color: var(--danger-line); color: var(--danger) !important; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-secondary[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--on-strong) !important; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* badges */
.badge { display: inline-block; padding: 3px 7px; border-radius: 3px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; line-height: 1.4; }
.badge-new { background: var(--accent-soft); color: var(--accent-ink); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-muted { background: var(--badge-muted-bg); color: var(--badge-muted-text); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.swatch { display: inline-block; width: 10px; height: 10px; flex-shrink: 0; }
.mod { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 500; }
.hint { font-size: 13px; line-height: 1.45; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: var(--radius); background: var(--surface); color: var(--text); font: 400 14px var(--sans); }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.input[readonly] { background: var(--bg); }
.input.mono, .textarea { font-family: var(--mono); font-size: 13px; }
.textarea { padding: 10px 12px; min-height: 120px; line-height: 1.55; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 28px; font-size: 14px; line-height: 1.45; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--field-line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { min-height: 40px; padding: 0 14px; border: 0; border-left: 1px solid var(--field-line); background: transparent; color: var(--text); font: 500 13px var(--sans); cursor: pointer; white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--on-strong); }
.seg button[disabled] { color: var(--faint-line); cursor: not-allowed; }
.toggle { position: relative; width: 44px; height: 26px; flex-shrink: 0; border: 0; border-radius: 13px; background: var(--field-line); cursor: pointer; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF; }
.toggle[aria-checked="true"] { background: var(--accent-fill); }
.toggle[aria-checked="true"]::after { left: 21px; }
.toggle[disabled] { opacity: 0.45; cursor: not-allowed; }
.setting { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.setting:first-child { border-top: 0; }
.setting > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 10px 16px; text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.table td { padding: 12px 16px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table tr.is-muted td { color: var(--muted); }
.table .right { text-align: right; }
.group-row td { background: var(--bg); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px 16px; }

/* stepper (onboarding) */
.stepper { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.stepper li { flex: 1 1 80px; padding-top: 8px; border-top: 2px solid var(--line); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.stepper li.done { border-top-color: var(--text); color: var(--text); }
.stepper li.current { border-top-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.onb-top { background: var(--surface); border-bottom: 1px solid var(--line); }
.onb-top-in { max-width: 880px; margin: 0 auto; padding: 0 24px; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.onb { max-width: 880px; margin: 0 auto; padding: 28px 24px 72px; display: flex; flex-direction: column; gap: 28px; }
.onb-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--line); }
.numbered { margin: 0; padding: 0; list-style: none; counter-reset: n; display: flex; flex-direction: column; gap: 16px; }
.numbered > li { counter-increment: n; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 4px 12px; }
.numbered > li::before { content: counter(n); grid-row: span 3; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--text); font-family: var(--mono); font-size: 12px; font-weight: 500; }

/* recap blocks */
.recap { display: flex; flex-direction: column; gap: 14px; }
.block { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.block-label { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.block-label::before { content: ""; width: 8px; height: 8px; background: currentColor; }
.block-title { font-size: 15px; font-weight: 600; }
.block p, .block li { margin: 0; font-size: 14px; line-height: 1.6; }
.block ul, .block ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }
.b-def .block-label { color: var(--b-def); }
.b-steps .block-label { color: var(--b-steps); }
.b-ex .block-label { color: var(--b-ex); }
.b-key { background: var(--b-key-bg); border-color: var(--b-key-line); }
.b-key .block-label { color: var(--b-key); }
.b-pit .block-label { color: var(--b-pit); }
.b-todo .block-label { color: var(--b-todo); }
.b-q .block-label { color: var(--b-q); }
.b-formula .block-label { color: var(--b-formula); }
.code { margin: 0; padding: 10px 12px; background: var(--bg); border-radius: 3px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre; overflow-x: auto; color: var(--text); }
.code .c { color: var(--muted); }
code.inline { font-family: var(--mono); font-size: 0.92em; }
.formula { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 0; font-family: var(--math); font-style: italic; font-size: 18px; flex-wrap: wrap; }
.frac { display: inline-flex; flex-direction: column; align-items: center; }
.frac > span:first-child { padding: 0 4px 3px; }
.frac > span:last-child { padding: 3px 4px 0; border-top: 1.5px solid currentColor; }
.question { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.question:first-of-type { border-top: 0; padding-top: 4px; }
.question-q { font-size: 14px; font-weight: 500; line-height: 1.5; }
.question-a { font-size: 14px; line-height: 1.6; color: var(--text-2); background: var(--bg); padding: 10px 12px; border-radius: 3px; }
