/* Mycroft web app. The design system is the landing page's (site-src/index.src.html): the same
   tokens, the same fonts, the same report components. test_web.py fails if the tokens drift.
   An app is used every day, so none of the landing page's scroll choreography comes along. */

@font-face { font-family: "Mona Sans"; src: url("fonts/mona-sans-var.woff2") format("woff2"); font-weight: 200 900; font-stretch: 75% 125%; font-display: swap; }
@font-face { font-family: "Martian Mono"; src: url("fonts/martian-mono-var.woff2") format("woff2"); font-weight: 100 800; font-stretch: 75% 112.5%; font-display: swap; }

/* --- tokens: light (copied from the landing page) --- */
:root {
  --bg: #f4f4f1;
  --raise: #ffffff;
  --sunk: #ebebe7;
  --ink: #0d0f12;
  --ink-2: #30353c;
  --muted: #5a6069;
  --faint: #646a73;
  --line: #dedfda;
  --line-2: #c9cbc5;
  --accent: #8a5600;
  --accent-fill: #e3a12f;
  --accent-line: #b06f00;
  --accent-wash: rgba(227, 161, 47, .16);
  --red: #b8402b;
  --ok: #1c7444;
  --stay: #48505a;
  --btn-bg: #0d0f12;
  --btn-fg: #ffffff;
  --tile: #ffffff;
  --shadow: 0 1px 0 rgba(13,15,18,.04), 0 24px 60px -24px rgba(13,15,18,.18), 0 60px 120px -60px rgba(13,15,18,.22);
  color-scheme: light;

  --sans: "Mona Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1120px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 22px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

/* --- tokens: dark (copied from the landing page) --- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0c0e; --raise: #121418; --sunk: #08090b; --ink: #eeeeea; --ink-2: #c5c8cd; --muted: #8e939b;
    --faint: #7a8089; --line: #1f2227; --line-2: #2c3037; --accent: #f2b43c; --accent-fill: #f2b43c;
    --accent-line: #f2b43c; --accent-wash: rgba(242, 180, 60, .12); --red: #ff7a66; --ok: #6fcf97;
    --stay: #b4bac2; --btn-bg: #f2b43c; --btn-fg: #0b0c0e; --tile: #eeeeea;
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 30px 80px -30px rgba(0,0,0,.8), 0 80px 160px -80px rgba(0,0,0,.9);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0c0e; --raise: #121418; --sunk: #08090b; --ink: #eeeeea; --ink-2: #c5c8cd; --muted: #8e939b;
  --faint: #7a8089; --line: #1f2227; --line-2: #2c3037; --accent: #f2b43c; --accent-fill: #f2b43c;
  --accent-line: #f2b43c; --accent-wash: rgba(242, 180, 60, .12); --red: #ff7a66; --ok: #6fcf97;
  --stay: #b4bac2; --btn-bg: #f2b43c; --btn-fg: #0b0c0e; --tile: #eeeeea;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 30px 80px -30px rgba(0,0,0,.8), 0 80px 160px -80px rgba(0,0,0,.9);
  color-scheme: dark;
}

/* --- base --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.6; font-weight: 420; font-stretch: 100%;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3 { margin: 0; font-weight: 640; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
code, .mono { font-family: var(--mono); font-stretch: 87.5%; font-size: .84em; font-weight: 420; }
:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -48px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--btn-bg); color: var(--btn-fg); text-decoration: none; z-index: 20; }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: calc(var(--max) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.i { width: 18px; height: 18px; flex: none; }

/* --- top bar --- */
.top { position: sticky; top: 0; z-index: 10; height: 60px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.top .wrap { height: 100%; display: flex; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-stretch: 112%; font-size: 17px; letter-spacing: -.02em; }
.mark { width: 22px; height: 22px; }
.mark .sq { fill: currentColor; }
.mark .lens { fill: none; stroke: var(--accent-fill); stroke-width: 2; }
.crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb b { color: var(--ink); font-weight: 580; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.top-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tag { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-stretch: 87.5%; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: var(--accent-wash); color: var(--accent); font-weight: 500; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-fill); }
.theme-btn { display: none; place-items: center; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; }
html.js .theme-btn { display: grid; }
.theme-btn:hover { background: var(--sunk); color: var(--ink); }
.theme-btn .moon { display: none; }
:root[data-theme="light"] .theme-btn .sun { display: none; }
:root[data-theme="light"] .theme-btn .moon { display: block; }

/* --- page --- */
main { padding: clamp(24px, 4vw, 48px) 0 72px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(24px, 2.6vw, 34px); line-height: 1.1; letter-spacing: -.03em; font-stretch: 106%; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 6px; }
.label { display: flex; align-items: center; gap: 14px; margin: clamp(36px, 5vw, 56px) 0 16px; font-family: var(--mono); font-stretch: 87.5%; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.label b { color: var(--accent); font-weight: 500; }
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* --- the window every panel sits in (from the landing page) --- */
.win { background: var(--raise); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; font-size: 14.5px; line-height: 1.5; }
.win + .win { margin-top: 16px; }
.pane { padding: clamp(18px, 2.4vw, 30px); min-width: 0; }
.win-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 20px; padding: 14px clamp(18px, 2.4vw, 30px); border-top: 1px solid var(--line); background: var(--sunk); font-size: 13.5px; color: var(--ink-2); }
.win-foot b { color: var(--accent); font-weight: 620; }
.win-foot a { color: var(--ink); font-weight: 580; text-underline-offset: 4px; }
.num { font-family: var(--mono); font-stretch: 87.5%; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num.dim { color: var(--muted); }
.cap { margin: 0 0 10px; font-family: var(--mono); font-stretch: 87.5%; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 450; }

/* --- what it cost --- */
.rep-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.rep-title { font-size: 13.5px; color: var(--muted); }
.rep-total { font-family: var(--mono); font-stretch: 87.5%; font-size: clamp(30px, 3.4vw, 44px); letter-spacing: -.045em; line-height: 1.05; margin-top: 6px; font-weight: 420; }
.rep-total small { font-family: var(--sans); font-stretch: 100%; font-size: 13.5px; letter-spacing: 0; color: var(--muted); margin-left: 8px; }
.rep-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-pill { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); border: 1px solid var(--line); }
.rep-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px 32px; margin-top: 20px; }
.bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--sunk); margin-bottom: 12px; }
.bar span { display: block; height: 100%; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto; align-items: baseline; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.rows li:last-child { border-bottom: 0; }
.rows i { width: 8px; height: 8px; border-radius: 2px; align-self: center; }
.rows .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows small { color: var(--muted); }
.rows .pct { color: var(--muted); min-width: 3.8em; text-align: right; }
.c1 { background: var(--stay); }
.c2 { background: var(--accent-fill); }
.c3 { background: var(--line-2); }
.note { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--sunk); border: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px; }
.note + .note { margin-top: 10px; }

/* --- since last time --- */
.sl-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sl-box { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.sl-box .cap { margin-bottom: 4px; }
.sl-box .num { font-size: clamp(18px, 1.8vw, 22px); letter-spacing: -.03em; color: var(--ink); }
.sl-change { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.sl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sl-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; color: var(--ink-2); }
.sl-list .num { color: var(--accent); }
.moved .cap, .sl-group .cap { margin-top: 18px; }
.caveat { margin-top: 16px; font-size: 13px; color: var(--muted); }

/* --- findings: list and detail, as on the landing page --- */
.fw-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.f-list { list-style: none; margin: 0; padding: 10px; background: var(--sunk); border-right: 1px solid var(--line); display: grid; gap: 4px; align-content: start; }
.f-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 4px 14px; padding: 14px; border-radius: 12px; text-decoration: none; color: var(--ink-2); }
.f-item .t { font-size: 14.5px; line-height: 1.35; font-weight: 580; color: var(--ink); }
.f-item .c { grid-column: 2; font-family: var(--mono); font-stretch: 87.5%; font-size: 12.5px; color: var(--accent); }
.f-item .c.attr { color: var(--muted); font-family: var(--sans); font-stretch: 100%; font-size: 13px; }
.f-item:hover { background: color-mix(in srgb, var(--raise) 60%, transparent); }
.f-item[aria-current="true"] { background: var(--raise); box-shadow: 0 0 0 1px var(--line); }
.find-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: var(--bg); font-family: var(--mono); font-stretch: 87.5%; font-size: 12px; font-weight: 500; flex: none; }
.f-item[aria-current="true"] .find-no { background: var(--accent-fill); color: #0b0c0e; }
.f-details { padding: clamp(20px, 3vw, 34px); min-width: 0; }
.f-detail + .f-detail { margin-top: 32px; padding-top: 32px; border-top: 1px solid var(--line); }
html.js .f-detail { display: none; margin: 0; padding: 0; border: 0; }
html.js .f-detail.is-open { display: block; }
.fd-head { display: flex; gap: 14px; align-items: flex-start; }
.fd-head h3 { font-size: clamp(18px, 1.7vw, 21px); line-height: 1.25; letter-spacing: -.014em; font-weight: 620; }
.fd-head > div { min-width: 0; }
.fd-cap { margin-top: 16px; font-weight: 620; color: var(--ink); font-size: 14px; }
.fd-shows { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; color: var(--ink-2); font-size: 14.5px; }
.fd-shows li { padding-left: 16px; position: relative; overflow-wrap: anywhere; }
.fd-shows li::before { content: ""; position: absolute; left: 0; top: .7em; width: 6px; height: 1px; background: var(--muted); }
.fd-shows li.sub { padding-left: 32px; font-family: var(--mono); font-stretch: 87.5%; font-size: 12.5px; }
.fd-shows li.sub::before { left: 16px; }
.ceiling { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: var(--accent-wash); border: 1px solid color-mix(in srgb, var(--accent-fill) 35%, transparent); }
.ceiling b { font-family: var(--mono); font-stretch: 87.5%; font-size: clamp(18px, 1.9vw, 24px); color: var(--accent); font-weight: 520; letter-spacing: -.03em; }
.ceiling span { color: var(--ink-2); font-size: 13.5px; }
.ceiling.attr { background: var(--sunk); border-color: var(--line); }
.ceiling.attr b { color: var(--ink); font-family: var(--sans); font-stretch: 100%; font-size: 15px; letter-spacing: 0; font-weight: 600; }
.fd-next, .fd-cannot { margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.fd-next b, .fd-cannot b { display: block; color: var(--ink); font-weight: 620; margin-bottom: 4px; }
.fd-cannot { padding-top: 14px; border-top: 1px dashed var(--line-2); }
.fd-cannot ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.empty { padding: clamp(20px, 3vw, 34px); color: var(--ink-2); }

/* --- notes and provenance --- */
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: var(--ink-2); font-size: 14px; }
.plain li { padding-left: 16px; position: relative; }
.plain li::before { content: ""; position: absolute; left: 0; top: .7em; width: 6px; height: 1px; background: var(--muted); }
.prov p + p { margin-top: 10px; }
.prov p { color: var(--ink-2); font-size: 14px; max-width: 78ch; }

/* --- other reads, and the index --- */
.reads { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); font-size: 13px; text-decoration: none; }
.chip:hover { background: var(--sunk); border-color: var(--line-2); color: var(--ink); }
.chip[aria-current="page"] { background: var(--raise); border-color: var(--line-2); color: var(--ink); font-weight: 580; }
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 18px clamp(18px, 2.4vw, 30px); text-decoration: none; }
.list a:hover { background: var(--sunk); }
.list .t { font-weight: 600; font-size: 15.5px; }
.list .s { color: var(--muted); font-size: 13.5px; grid-column: 1; }
.list .num { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 14px; }

footer { border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; }

@media (max-width: 760px) {
  .fw-body { grid-template-columns: minmax(0, 1fr); }
  .f-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .sl-totals { grid-template-columns: minmax(0, 1fr); }
  .crumb .hide-sm { display: none; }
}

/* A report is forwarded to finance and printed: show every finding, in the light theme. */
@media print {
  /* Paper is white whatever theme the reader picked: a saved dark theme printed light text on
     white. Every colour token is reset, at a specificity that beats the theme selectors. */
  :root, :root[data-theme], :root:not([data-theme="light"]) {
    --bg: #fff; --raise: #fff; --sunk: #f6f6f3; --ink: #0d0f12; --ink-2: #30353c; --muted: #5a6069;
    --faint: #646a73; --line: #dedfda; --line-2: #c9cbc5; --accent: #8a5600; --accent-fill: #e3a12f;
    --accent-line: #b06f00; --accent-wash: rgba(227, 161, 47, .16); --red: #b8402b; --ok: #1c7444;
    --stay: #48505a; --tile: #fff; --shadow: none; color-scheme: light;
  }
  .top, .theme-btn, .skip, .reads-block { display: none !important; }
  html.js .f-detail { display: block; }
  .f-list { display: none; }
  .fw-body { grid-template-columns: minmax(0, 1fr); }
  .f-detail + .f-detail { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
  .win { box-shadow: none; break-inside: auto; }
  .f-detail { break-inside: avoid; }
}

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

/* --- documents (the pilot guide): long-form prose in the same system --- */
.doc { max-width: 78ch; }
.doc h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.1; letter-spacing: -.03em; font-stretch: 106%; margin-bottom: 16px; }
.doc h2 { font-size: clamp(20px, 2vw, 26px); line-height: 1.2; letter-spacing: -.02em; margin: 44px 0 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.doc h3 { font-size: 17px; letter-spacing: -.01em; margin: 28px 0 8px; }
.doc p, .doc li { color: var(--ink-2); font-size: 15.5px; }
.doc p { margin: 10px 0; }
.doc strong { color: var(--ink); font-weight: 620; }
.doc ul, .doc ol { padding-left: 22px; margin: 10px 0; display: grid; gap: 6px; }
.doc code { background: var(--sunk); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--ink); overflow-wrap: anywhere; }
.doc pre { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; margin: 12px 0; }
.doc pre code { background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.6; overflow-wrap: normal; }
.doc table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 12px; border: 1px solid var(--line); color: var(--ink-2); }
.doc th { background: var(--sunk); color: var(--ink); font-weight: 620; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0 0; }
.doc hr + h2 { border-top: 0; padding-top: 0; }
@media print { .doc { max-width: none; } .doc h2 { break-after: avoid; } .doc pre, .doc table { break-inside: avoid; } }


/* --- the hosted app: forms, onboarding steps, account --- */
.narrow { max-width: 560px; }
.lead { color: var(--ink-2); font-size: 15.5px; }
.muted-note { margin-top: 14px; color: var(--muted); font-size: 13.5px; }
.muted { color: var(--muted); }
.who-am-i { font-size: 13px; color: var(--muted); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-form { display: inline; margin: 0; }
button.chip { font: inherit; font-size: 13px; background: transparent; cursor: pointer; }
.chip.danger { color: var(--red); justify-self: start; }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 20px; background: var(--btn-bg); color: var(--btn-fg); border: 0; border-radius: 999px; text-decoration: none; font: inherit; font-weight: 620; font-size: 15px; cursor: pointer; }
.btn:hover { box-shadow: 0 0 0 5px var(--accent-wash); }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: 14px; }
.form { display: grid; gap: 10px; margin: 0; }
.form label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 580; color: var(--ink); }
.form .inline-check { display: flex; align-items: center; gap: 8px; font-weight: 420; color: var(--ink-2); margin-top: 16px; }
.form .inline-check input { width: auto; min-height: 0; }
.form input, .form select, .form textarea { font: inherit; font-size: 15px; font-weight: 420; color: var(--ink); background: var(--raise); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
.form input:focus-visible, .form select:focus-visible, .form textarea:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 1px; }
.form .btn { justify-self: start; margin-top: 6px; }
.form-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; margin-top: 16px; }
.form-row .btn { margin-top: 0; }
.grid-form { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.grid-form .wide { grid-column: 1 / -1; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; }
.step { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 14px; padding: 12px 0; }
.step + .step { border-top: 1px solid var(--line); }
.step .dot { width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--raise); }
.step.done .dot { background: var(--ok); border-color: var(--ok); }
.step.current .dot { background: var(--accent-fill); border-color: var(--accent-fill); box-shadow: 0 0 0 4px var(--accent-wash); }
.step b { font-weight: 620; }
.step p { color: var(--ink-2); font-size: 14px; }
.step.upcoming b, .step.upcoming p { color: var(--muted); }
.page-head .btn, .page-head .chip { align-self: center; }
@media (max-width: 760px) { .who-am-i { display: none; } }
