/* Brain. Quiet chrome: hairlines over boxes, one typeface, colour only where it carries meaning.
   Tokens are shared with the embedded reports through skin.py. */
:root {
  --paper: #ffffff; --side: #fafafa; --hover: #f3f4f5; --line: #e7e8eb; --line-strong: #d5d7dc;
  --ink: #0f1114; --ink-2: #3b4048; --muted: #6c727d; --faint: #a0a5ae;
  --accent: #2f6fd6; --good: #2f855a; --warn: #b7791f; --bad: #c53030;
  --panel-shadow: 0 24px 60px rgba(15, 17, 20, 0.14), 0 2px 6px rgba(15, 17, 20, 0.06);
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0a0a0b; --side: #0c0c0d; --hover: #17171a; --line: #1f1f23; --line-strong: #2c2c31;
  --ink: #ededee; --ink-2: #b9b9bf; --muted: #8a8a92; --faint: #5c5c64;
  --accent: #f0541e; --good: #4ade80; --warn: #f0a35e; --bad: #f87171;
  --panel-shadow: 0 0 0 1px #1f1f23, 0 24px 60px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 14px/1.55 var(--sans); letter-spacing: -0.006em;
  font-feature-settings: "cv11"; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; letter-spacing: inherit; }
h1 { margin: 0; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.024em; line-height: 1.15; }
h2 { margin: 0; font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
svg { flex: none; }

/* Shell */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 1.1rem 0.75rem 1rem; background: var(--side); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.55rem; padding: 0.25rem 0.5rem; font-size: 0.95rem; font-weight: 600; letter-spacing: -0.015em; }
.brand img { width: 22px; height: 22px; }
.side-nav { display: flex; flex-direction: column; gap: 1px; margin-top: 1.5rem; overflow-y: auto; }
.side-group { margin: 1.4rem 0.5rem 0.35rem; color: var(--faint); font-size: 0.75rem; font-weight: 500; }
.side-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.36rem 0.5rem; border-radius: 6px; color: var(--ink-2); font-size: 0.86rem;
}
.side-link:hover { background: var(--hover); color: var(--ink); }
.side-link.is-active { background: var(--hover); color: var(--ink); font-weight: 500; }
.side-link.is-soon { color: var(--muted); }
.soon { color: var(--faint); font-size: 0.7rem; }
.side-foot { margin-top: auto; padding: 0 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.who { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-tools { display: flex; align-items: center; gap: 0.75rem; margin-left: -0.35rem; }
.side-out { color: var(--muted); font-size: 0.8rem; }
.side-out:hover { color: var(--ink); }
.icon-button {
  display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer;
}
.icon-button:hover { background: var(--hover); color: var(--ink); }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

.main { width: 100%; max-width: 1160px; padding: 3.5rem 4rem 6rem; }
.empty { color: var(--muted); margin-top: 3rem; }

/* Page head */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2.25rem; }
.crumb { color: var(--muted); font-size: 0.8rem; font-weight: 500; margin-bottom: 0.5rem; }
.sub { color: var(--muted); font-size: 0.95rem; margin-top: 0.55rem; max-width: 60ch; }

/* Freshness: muted text, colour only on the dot */
.asof { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.asof::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.asof-fresh::before { background: var(--good); }
.asof-ageing::before { background: var(--warn); }
.asof-stale::before { background: var(--bad); }

/* Metrics: a band of numbers between hairlines */
.metrics, .asof { font-variant-numeric: tabular-nums; }
.metrics {
  display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.metric { position: relative; display: flex; flex-direction: column; padding: 1.4rem 1.75rem 1.5rem; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; padding-left: 0; }
.metric-label { color: var(--muted); font-size: 0.84rem; font-weight: 500; }
.metric-value { margin-top: 0.6rem; font-size: 2.6rem; font-weight: 500; letter-spacing: -0.035em; line-height: 1; color: var(--ink); }
.metric-foot { display: flex; flex-wrap: wrap; gap: 0.15rem 0.5rem; margin-top: 0.75rem; color: var(--muted); font-size: 0.82rem; }
.delta { color: var(--ink-2); font-weight: 500; }
.tone-good { color: var(--good); }
.tone-bad { color: var(--bad); }
.tone-warn { color: var(--warn); }
.metric-link .metric-label::after { content: "→"; margin-left: 0.4rem; color: var(--faint); opacity: 0; transition: opacity 120ms, margin 120ms; }
.metric-link:hover .metric-label { color: var(--ink); }
.metric-link:hover .metric-label::after { opacity: 1; margin-left: 0.55rem; }

/* Home: one big question, then the pills it picks */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6vh 0 4.5rem; }
.hero-mark { width: 104px; height: 104px; margin-bottom: 1.5rem; border-radius: 24px; box-shadow: 0 1px 2px rgba(4, 18, 58, 0.25), 0 16px 40px rgba(30, 90, 220, 0.32); }
.hero-title { font-size: 2.6rem; letter-spacing: -0.035em; margin-bottom: 2rem; }
.hero-ask {
  display: flex; align-items: center; gap: 0.75rem; width: min(820px, 100%); height: 68px; padding: 0 0.6rem 0 1.5rem;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15, 17, 20, 0.04), 0 12px 32px rgba(15, 17, 20, 0.06); transition: border-color 120ms, box-shadow 120ms;
}
.hero-ask:focus-within { border-color: var(--ink-2); box-shadow: 0 0 0 5px var(--hover), 0 12px 32px rgba(15, 17, 20, 0.08); }
.hero-input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: 400 1.2rem var(--sans); letter-spacing: -0.015em; }
.hero-input::placeholder { color: var(--faint); }
.hero-go { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 11px; background: var(--ink); color: var(--paper); cursor: pointer; }
.hero-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.prompts-center { justify-content: center; margin-top: 1.1rem; max-width: 820px; }

.board { transition: opacity 160ms; }
.board.is-thinking { opacity: 0.35; pointer-events: none; }
.board-head { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 1rem; min-height: 1.6rem; }
.board-q { font-size: 1.1rem; letter-spacing: -0.015em; }
.board-count { color: var(--faint); font-size: 0.9rem; }
.board-reset { margin-left: auto; padding: 0; border: 0; background: none; color: var(--muted); font-size: 0.82rem; cursor: pointer; }
.board-reset:hover { color: var(--ink); }
.board-empty { padding: 2rem 0; color: var(--muted); border-top: 1px solid var(--line); }
.board-note { margin-top: 1rem; color: var(--faint); font-size: 0.78rem; }
.pills {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.pill { display: flex; flex-direction: column; margin: -1px 0 0 -1px; padding: 1.25rem 1.4rem 1.4rem; border-left: 1px solid var(--line); border-top: 1px solid var(--line); background: var(--paper); animation: pill-in 380ms both; animation-delay: calc(var(--i) * 55ms); transition: background 120ms; }
.pill:hover { background: var(--hover); }
@keyframes pill-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pill-top { display: flex; justify-content: space-between; align-items: center; min-height: 1.1rem; font-size: 0.76rem; }
.pill-level { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
.pill-urgent .pill-level { color: var(--bad); }
.pill-watch .pill-level { color: var(--warn); }
.pill-urgent .pill-level::before, .pill-watch .pill-level::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-where { color: var(--faint); }
.pill-value { margin-top: 0.9rem; font-size: 2.3rem; font-weight: 500; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.pill-label { margin-top: 0.5rem; font-weight: 500; font-size: 0.9rem; }
.pill-why { margin-top: 0.3rem; color: var(--muted); font-size: 0.84rem; line-height: 1.45; }

/* Opening splash, once a session */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--paper); transition: opacity 420ms ease; }
.splash img { width: 112px; height: 112px; animation: splash-in 620ms ease-out both; }
.splash.is-out { opacity: 0; pointer-events: none; }
.opened .splash { display: none; }
@keyframes splash-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }

/* Ask bar */
.ask-block { max-width: 720px; margin: 2.75rem 0 3.25rem; }
.ask {
  display: flex; align-items: center; gap: 0.75rem; height: 52px; padding: 0 0.9rem 0 1rem;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 17, 20, 0.04); transition: border-color 120ms, box-shadow 120ms;
}
.ask:focus-within { border-color: var(--ink-2); box-shadow: 0 0 0 4px var(--hover); }
.ask-icon { width: 16px; height: 16px; fill: var(--accent); }
.ask-input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: 400 0.97rem var(--sans); letter-spacing: -0.01em; }
.ask-input::placeholder { color: var(--faint); }
.ask-kbd { padding: 0.1rem 0.4rem; border: 1px solid var(--line); border-radius: 4px; color: var(--faint); font: 500 0.7rem var(--sans); }
.prompts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.prompt {
  padding: 0.38rem 0.7rem; border: 1px solid var(--line); border-radius: 6px; background: none;
  color: var(--ink-2); font-size: 0.82rem; cursor: pointer; transition: background 120ms, border-color 120ms;
}
.prompt:hover { background: var(--hover); border-color: var(--line-strong); color: var(--ink); }

/* Embedded report */
.report-bar { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.6rem; color: var(--muted); font-size: 0.8rem; }
.report-bar a:hover { color: var(--ink); }
.report-frame { display: block; width: 100%; height: calc(100vh - 32px); min-height: 640px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }

/* Coming soon */
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.fact { padding: 1.25rem 1.75rem 0 0; }
.fact-label { color: var(--muted); font-size: 0.8rem; font-weight: 500; margin-bottom: 0.5rem; }
.fact ul { margin: 0; padding: 0; list-style: none; }
.fact li { color: var(--ink-2); margin: 0.35rem 0; max-width: 34ch; }

/* Ask Brain: corner bubble and panel */
.ai-bubble {
  position: fixed; right: 24px; bottom: 24px; z-index: 30; display: grid; place-items: center;
  width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--ink); color: var(--paper);
  box-shadow: 0 8px 24px rgba(15, 17, 20, 0.22); cursor: pointer; transition: transform 140ms;
}
.ai-bubble:hover { transform: translateY(-1px) scale(1.03); }
.ai-bubble svg { width: 20px; height: 20px; fill: currentColor; }
.ai-bubble[aria-expanded="true"] { display: none; }
.ai-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 31; display: flex; flex-direction: column;
  width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 48px));
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--panel-shadow);
  animation: rise 160ms ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ai-head { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 0.6rem 0 1rem; border-bottom: 1px solid var(--line); font-size: 0.88rem; font-weight: 600; }
.ai-thread { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.ai-hint { color: var(--muted); font-size: 0.78rem; margin-bottom: 0.15rem; }
.ai-suggest { display: flex; flex-direction: column; gap: 0.45rem; }
.ai-prompt {
  text-align: left; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 8px; background: none;
  color: var(--ink-2); font-size: 0.85rem; cursor: pointer;
}
.ai-prompt:hover { background: var(--hover); color: var(--ink); }
.ai-msg { max-width: 88%; font-size: 0.88rem; line-height: 1.5; }
.ai-msg-you { align-self: flex-end; padding: 0.55rem 0.8rem; border-radius: 10px; background: var(--hover); color: var(--ink); }
.ai-msg-brain { align-self: flex-start; color: var(--ink-2); }
.ai-form { display: flex; align-items: center; gap: 0.5rem; margin: 0.75rem; padding: 0.3rem 0.3rem 0.3rem 0.85rem; border: 1px solid var(--line-strong); border-radius: 10px; }
.ai-form:focus-within { border-color: var(--ink-2); }
.ai-input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: 400 0.9rem var(--sans); }
.ai-input::placeholder { color: var(--faint); }
.ai-send { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: var(--ink); color: var(--paper); cursor: pointer; }
.ai-send svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Sign in: always dark, the head and one button over a living network */
.login-body { min-height: 100vh; margin: 0; overflow: hidden; background: #04060c; color: #e8ecf5; }
.login-net { position: fixed; inset: 0; width: 100%; height: 100%; }
.login { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3rem; min-height: 100vh; padding: 2rem; }
.login-head {
  width: 200px; height: 200px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(150, 200, 255, 0.35), 0 0 0 10px rgba(80, 150, 255, 0.06), 0 0 90px rgba(50, 120, 255, 0.5);
  animation: login-appear 1.2s ease-out both, login-glow 6s 1.2s ease-in-out infinite;
}
.google-button {
  display: inline-flex; align-items: center; gap: 0.7rem; padding: 0.8rem 1.35rem 0.8rem 1.1rem; border-radius: 999px;
  background: #ffffff; color: #1f1f1f; font: 500 0.95rem var(--sans); letter-spacing: -0.005em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); transition: transform 160ms, box-shadow 160ms;
  animation: login-rise 700ms 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.google-button:hover { transform: translateY(-1px); box-shadow: 0 14px 40px rgba(60, 130, 255, 0.35); }
.google-button svg { width: 18px; height: 18px; }
.login-note { max-width: 36ch; margin-top: -2rem; color: rgba(232, 236, 245, 0.55); font-size: 0.82rem; text-align: center; }
.login-error { color: #f7a1a1; }
.login code { background: rgba(255, 255, 255, 0.08); color: inherit; }
@keyframes login-appear { from { opacity: 0; transform: scale(0.92); filter: brightness(0.3) blur(6px); } }
@keyframes login-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes login-glow { 50% { box-shadow: 0 0 0 1px rgba(150, 200, 255, 0.45), 0 0 0 14px rgba(80, 150, 255, 0.07), 0 0 130px rgba(70, 140, 255, 0.7); } }
@media (prefers-reduced-motion: reduce) { .login-head, .google-button { animation: none; } }
code { font-size: 0.88em; padding: 0.05rem 0.3rem; border-radius: 4px; background: var(--hover); }

@media (max-width: 1080px) {
  .main { padding: 2.5rem 2.5rem 5rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 0; }
  .metric, .metric:first-child { border-left: 0; padding-left: 0; border-bottom: 1px solid var(--line); }
  .pills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 1.5rem 1.25rem 5rem; }
  .facts, .pills { grid-template-columns: 1fr; }
  .head { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}
