/*
 * Trial Day Projects: the shared look of the analyst's pages (home, workspace, Track Record).
 *
 * One set of colour tokens with a light and a dark value. The bare :root is light; the
 * system's dark preference applies unless the reader chose light; an explicit choice wins
 * either way. Components only ever use the tokens, so both themes stay whole.
 */
@font-face { font-family: "Geist"; src: url("/vendor/fonts/geist-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --paper: #f1f3f6; --room: #e4e8ee; --card: #ffffff; --sunken: #f7f9fb; --raise: #ffffff;
  --ink: #151a21; --ink-2: #454f5d; --ink-3: #6f7a88;
  --rule: #dce1e8; --rule-2: #c5ccd7;
  --accent: #2a4bb5; --accent-2: #1c3585; --accent-bg: #e8edfa; --on-accent: #ffffff;
  --bronze: #96693a; --bronze-bg: #f4ede2;
  --teal: #1f6b64; --teal-bg: #e0efec;
  --warn: #8a5a06; --warn-bg: #f8eed7;
  --bad: #983039; --bad-bg: #f9e7e8; --bad-soft: #d98a8f;
  --good: #2f6a49; --good-bg: #e3f1e8;
  --code-bg: #0f1629; --code-ink: #d5dcea; --code-k: #8ea6ff; --code-f: #f0b3ff; --code-s: #9fe0b9; --code-c: #7d879a;
  --shadow: 0 1px 2px rgba(18, 26, 38, .05), 0 6px 18px rgba(18, 26, 38, .07);
  --shadow-lg: 0 12px 40px rgba(18, 26, 38, .18);
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1218; --room: #232a35; --card: #171b23; --sunken: #1c212b; --raise: #1f2430;
    --ink: #e7ebf2; --ink-2: #b4bdca; --ink-3: #8f99a8;
    --rule: #2a313d; --rule-2: #3a4250;
    --accent: #8ea6ff; --accent-2: #b8c6ff; --accent-bg: #1f2849; --on-accent: #0f1218;
    --bronze: #d9a974; --bronze-bg: #2f2518;
    --teal: #74c9bd; --teal-bg: #16302d;
    --warn: #e8b85e; --warn-bg: #33270f;
    --bad: #f2939b; --bad-bg: #3a1c20; --bad-soft: #b8606a;
    --good: #82d4a4; --good-bg: #173225;
    --code-bg: #0b0f1a; --code-ink: #d5dcea;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1218; --room: #232a35; --card: #171b23; --sunken: #1c212b; --raise: #1f2430;
  --ink: #e7ebf2; --ink-2: #b4bdca; --ink-3: #8f99a8;
  --rule: #2a313d; --rule-2: #3a4250;
  --accent: #8ea6ff; --accent-2: #b8c6ff; --accent-bg: #1f2849; --on-accent: #0f1218;
  --bronze: #d9a974; --bronze-bg: #2f2518;
  --teal: #74c9bd; --teal-bg: #16302d;
  --warn: #e8b85e; --warn-bg: #33270f;
  --bad: #f2939b; --bad-bg: #3a1c20; --bad-soft: #b8606a;
  --good: #82d4a4; --good-bg: #173225;
  --code-bg: #0b0f1a; --code-ink: #d5dcea;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 14.5px/1.55 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 { font: 650 26px/1.2 var(--font); }
h2 { font: 650 20px/1.25 var(--font); }
h3 { font: 650 15px/1.3 var(--font); }
p { margin: 0; }
a { color: var(--accent); }
code { font: 500 12.5px var(--mono); background: var(--sunken); border: 1px solid var(--rule); border-radius: 5px; padding: 0 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.quiet { color: var(--ink-3); font-size: 13px; }
.label { display: block; font: 600 11.5px/1 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.kicker { display: block; font: 600 12px/1 var(--font); color: var(--bronze); margin-bottom: 8px; }
.lead { font-size: 15.5px; color: var(--ink-2); line-height: 1.6; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--on-accent); font: 600 14px/1 var(--font); text-decoration: none; white-space: nowrap; transition: background .15s, transform .15s, opacity .15s; }
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--rule-2); }
.btn.ghost:hover { background: var(--sunken); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible {
  outline: 3px solid var(--accent-bg); outline-offset: 2px; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; background: var(--sunken); border: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--good-bg); border-color: transparent; color: var(--good); font-weight: 600; }
.chip.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); font-weight: 600; }
.chip.accent { background: var(--accent-bg); border-color: transparent; color: var(--accent-2); font-weight: 600; }
.av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 650 12px/1 var(--font); font-style: normal; color: #fff; }
.av.ceo { background: #6b4f8a; } .av.growth { background: #b35a2e; } .av.finance { background: #2f5d7c; } .av.ops { background: #3f7a4f; } .av.news { background: #8a5a06; } .av.product { background: #2f7a74; } .av.sales { background: #9a4466; } .av.cs { background: #5a6b2f; }
.av.me { background: var(--accent-bg); color: var(--accent); }

/* Forms */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea, .input { height: 38px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 9px; background: var(--card); color: var(--ink); font-weight: 400; font-size: 14px; }
.field textarea, textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

/* The top bar of every signed-in page */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; height: 58px; padding: 0 28px; background: var(--card); border-bottom: 1px solid var(--rule); }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 650 15.5px/1 var(--font); color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand em { font-style: normal; font-weight: 500; color: var(--ink-3); }
.mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font: 700 15px/1 var(--font); }
.grow { flex: 1; }
/* The light and dark switch in every header: a moon in light mode, a sun in dark. */
.theme-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; padding: 0; border: 1px solid var(--rule); background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.theme-btn:hover { background: var(--sunken); color: var(--ink); border-color: var(--rule-2); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; animation: theme-turn .4s cubic-bezier(.2, .8, .2, 1); }
@keyframes theme-turn { from { opacity: 0; transform: rotate(-60deg) scale(.6); } }

.menu { position: relative; }
.menu-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 4px 0 4px; border: 0; background: none; color: var(--ink-2); font-weight: 500; }
.menu-btn .av { width: 32px; height: 32px; font-size: 11px; }
.menu-pop { position: absolute; right: 0; top: 44px; z-index: 40; width: 240px; padding: 8px; display: grid; gap: 2px; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-decoration: none; font-size: 13.5px; text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--sunken); }
.menu-pop hr { border: 0; border-top: 1px solid var(--rule); margin: 4px 0; }
.menu-pop .who { padding: 6px 10px 8px; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.theme-row { display: flex; gap: 4px; padding: 4px 6px; }
.theme-row button { flex: 1; justify-content: center; padding: 6px 4px; border-radius: 7px; font-size: 12px; color: var(--ink-2); border: 1px solid var(--rule); }
.theme-row button.on { background: var(--accent-bg); color: var(--accent-2); border-color: transparent; font-weight: 600; }

/* Dialogs and toasts */
.dialog-bg { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(10, 13, 18, .45); animation: fade .15s ease both; }
.dialog { width: min(460px, 100%); padding: 22px 24px; display: grid; gap: 12px; }
.dialog p { color: var(--ink-2); font-size: 14px; }
.dialog-f { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 70; translate: -50% 0; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 13.5px; box-shadow: var(--shadow-lg); animation: rise .2s ease both; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--accent-bg); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* Result tables and code */
.grid { width: 100%; border-collapse: collapse; font: 500 12.5px/1.4 var(--mono); }
.grid th { position: sticky; top: 0; text-align: left; padding: 7px 12px; background: var(--sunken); color: var(--ink-3); font-weight: 600; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.grid td { padding: 6px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.grid tr:last-child td { border-bottom: 0; }
.grid .n { text-align: right; font-variant-numeric: tabular-nums; }
.grid .null { color: var(--ink-3); font-style: italic; }
.code { margin: 0; padding: 12px 14px; border-radius: 9px; background: var(--code-bg); color: var(--code-ink); font: 500 12.5px/1.6 var(--mono); overflow-x: auto; white-space: pre; }

/* Things that arrive as they scroll in. theme.js marks the page "js", so without scripts they just show. */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal.d1 { transition-delay: .12s; }

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

/* What's new (news.js) */
.news { width: min(560px, 100%); gap: 14px; padding: 26px 28px; }
.news-k { justify-self: start; padding: 3px 10px; border-radius: 99px; background: var(--accent-bg); color: var(--accent-2); font-size: 12px; font-weight: 650; }
.news h3 { margin: 0; font-size: 20px; line-height: 1.3; text-wrap: balance; }
.news-safe { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--good-bg); color: var(--ink) !important; font-size: 14px; }
.news-l { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-height: 52vh; overflow: auto; }
.news-l li { display: grid; gap: 2px; padding-left: 14px; border-left: 3px solid var(--accent-bg); }
.news-l b { font-size: 14.5px; }
.news-l span { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.news-bg { z-index: 70; }
