/* The Desk — shared styles for /, /login, /settings */

:root {
  --bg-0: #06080f;
  --bg-1: #0b1020;
  --bg-2: #121a33;
  --ink: #eef1f7;
  --ink-2: #aeb6c8;
  --ink-3: #6f788f;
  --line: rgba(190, 205, 240, 0.13);
  --line-strong: rgba(190, 205, 240, 0.26);
  --glass: rgba(9, 13, 24, 0.62);
  --glass-2: rgba(14, 20, 38, 0.55);
  --futures: #5eb0ff;
  --smallcaps: #22d3a0;
  --options: #f356c9;
  --hedge: #f5b331;
  --calendar: #c9d1e0;
  --whales: #9b7bff;
  --biotech: #ff7a87;
  --ok: #22d3a0;
  --bad: #ff7a87;
  --warn: #f5b331;
  --accent: var(--futures);
  --radius: 10px;
  --radius-sm: 6px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-body: 15px;
  --hud-pad: 20px;
  --panel-w: 320px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg-0);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 42%, var(--bg-2) 0%, var(--bg-1) 48%, var(--bg-0) 100%);
  background-attachment: fixed;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
@media (max-width: 640px) { :root { --fs-body: 16px; } }

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- buttons, pills ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: rgba(255,255,255,0.04);
  cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 14px;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { background: transparent; }
.btn-accent {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  color: #fff;
}
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 34%, transparent); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[aria-pressed="false"] { border-color: var(--warn); color: var(--warn); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 12.5px; font-weight: 500; line-height: 1;
  background: rgba(255,255,255,0.08); color: var(--ink-2);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.idle { color: var(--ink-2); }
.pill.working { color: var(--ok); background: rgba(34,211,160,0.14); }
.pill.waiting { color: var(--warn); background: rgba(245,179,49,0.14); }
.pill.error { color: var(--bad); background: rgba(255,122,135,0.14); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12.5px; font-weight: 600; line-height: 1.4;
  background: rgba(255,255,255,0.08); color: var(--ink-2);
}
.badge.confirm { background: rgba(34,211,160,0.16); color: var(--ok); }
.badge.skip { background: rgba(255,122,135,0.16); color: var(--bad); }
.badge.pending { background: rgba(245,179,49,0.14); color: var(--warn); }
.badge.long { color: var(--ok); }
.badge.short { color: var(--bad); }
.badge.kind { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--ink); }

.num-pos { color: var(--ok); }
.num-neg { color: var(--bad); }
.muted { color: var(--ink-3); }

/* ---------- scene ---------- */
.scene { position: fixed; inset: 0; z-index: 1; }
#gl { display: block; width: 100%; height: 100%; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; white-space: nowrap;
  transition: opacity 300ms ease;
  will-change: transform;
}
/* Office names: large serif capitals over the cloud, status under them. */
.label.office .label-name {
  font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.7vw, 42px);
  font-variation-settings: "opsz" 144;
  letter-spacing: 0.14em; text-transform: uppercase; line-height: 1;
  color: #fff; text-shadow: 0 0 24px rgba(0,0,0,0.9), 0 2px 10px rgba(0,0,0,0.8), 0 0 36px color-mix(in srgb, var(--c) 45%, transparent);
  transition: letter-spacing 400ms ease;
}
.label.office.hot .label-name { letter-spacing: 0.2em; }
.label.office.dim .label-name { color: var(--ink-2); }
.label-sub { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.label-num { font-size: 14px; color: var(--ink-2); text-shadow: 0 1px 8px rgba(0,0,0,0.9); }
.label.office .pill, .label.office .label-num {
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); background: rgba(9,13,24,0.55);
}
.label.office .label-num { height: 22px; line-height: 22px; padding: 0 9px; border-radius: 11px; font-size: 13.5px; color: var(--ink); }
.label.office .pill.working { background: rgba(34,211,160,0.18); }
.label.office .pill.waiting { background: rgba(245,179,49,0.18); }
/* Feeders and sub-filters: small mono capitals. */
.label.feeder .label-name, .label.sub .label-name {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-2); text-shadow: 0 1px 8px rgba(0,0,0,0.9);
}
.label.feeder .label-name { font-size: 13px; color: var(--ink); }
.label.feeder .label-num { font-size: 12px; color: var(--ink-3); }
.label.sub .label-name { color: color-mix(in srgb, var(--c) 70%, #fff); opacity: 0.85; }
.label.hot .label-name { color: #fff; opacity: 1; }
@media (max-width: 640px) {
  .label.office .label-name { font-size: 19px; letter-spacing: 0.08em; }
  .label-num { font-size: 13px; }
  .label.feeder .label-num { display: none; }
  .label.sub .label-name, .label.feeder .label-name { font-size: 10.5px; letter-spacing: 0.12em; }
}

/* ---------- HUD ---------- */
.hud { position: fixed; z-index: 12; }
.hud-tl { top: var(--hud-pad); left: var(--hud-pad); max-width: 260px; }
.hud-tc { top: var(--hud-pad); left: 50%; transform: translateX(-50%); }
.hud-tr { top: var(--hud-pad); right: var(--hud-pad); text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hud-bl { bottom: var(--hud-pad); left: var(--hud-pad); }
.hud-br { bottom: var(--hud-pad); right: var(--hud-pad); }
.hud[hidden], .label[hidden] { display: none; }

.brand {
  font-family: var(--serif); font-weight: 300; font-size: 30px; letter-spacing: 0.26em; text-transform: uppercase;
  font-variation-settings: "opsz" 144; line-height: 1; color: #fff; margin-left: 2px;
}
.brand-sub { color: var(--ink-2); font-size: 14px; margin: 8px 0 14px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.lg { display: grid; grid-template-columns: 10px auto auto; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.lg-name { color: var(--ink); }
.lg-st { color: var(--ink-3); font-size: 12.5px; }
.lg.working .lg-st { color: var(--ok); }
.lg.waiting .lg-st { color: var(--warn); }
.lg.error .lg-st { color: var(--bad); }

/* events: three chips, importance first */
.events { display: flex; gap: 8px; }
.ev {
  display: flex; align-items: center; gap: 10px; min-width: 150px;
  padding: 7px 12px 7px 8px; border-radius: 8px;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.ev-imp { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; padding: 3px 6px; border-radius: 4px; font-weight: 600; }
.ev.high .ev-imp { background: rgba(245,179,49,0.2); color: var(--warn); }
.ev.medium .ev-imp { background: rgba(140,165,210,0.18); color: #9fb3d6; }
.ev.low .ev-imp { background: rgba(255,255,255,0.06); color: var(--ink-3); }
.ev-text { display: flex; flex-direction: column; line-height: 1.25; }
.ev-title { font-family: var(--serif); font-size: 16px; font-weight: 500; color: #fff; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ev-time { font-size: 12.5px; color: var(--ink-3); font-family: var(--mono); letter-spacing: 0.02em; white-space: nowrap; }
.ev.past .ev-time { color: var(--warn); }
.ev-empty { font-size: 13.5px; color: var(--ink-3); padding: 8px 12px; background: var(--glass); border: 1px solid var(--line); border-radius: 8px; }

/* clock block */
.clock { font-family: var(--mono); font-size: 34px; font-weight: 500; letter-spacing: 0.04em; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.date { font-size: 13.5px; color: var(--ink-2); }
.sessions { display: flex; gap: 14px; margin-top: 2px; }
.sess { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.4; }
.sess-name { color: var(--ink-3); }
.sess-st { color: var(--ink-3); }
.sess.open .sess-st { color: var(--ok); }
.sess.open .sess-name { color: var(--ink-2); }
.controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.meter { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12.5px; margin-right: 6px; }
.meter-bar { width: 64px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--ok); transition: width 400ms ease; }
.meter-fill.warn { background: var(--warn); }
.meter-fill.over { background: var(--bad); }
.meter-runs { color: var(--ink-3); }

/* glass panels: levels, book */
.panel {
  width: var(--panel-w); padding: 14px 16px 12px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.panel-head { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: baseline; margin-bottom: 6px; }
.panel-kicker { grid-column: 1; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.panel-title { grid-column: 1; font-family: var(--serif); font-size: 24px; font-weight: 400; line-height: 1.1; color: #fff; }
.lv-price, .bk-day { grid-column: 2; grid-row: 1 / span 1; font-family: var(--mono); font-size: 22px; font-weight: 500; color: #fff; line-height: 1; justify-self: end; }
.lv-delta, .bk-daylbl { grid-column: 2; grid-row: 2; font-size: 12.5px; color: var(--ink-3); justify-self: end; font-family: var(--mono); }
.lv-delta.brake { color: var(--smallcaps); }
.lv-delta.gas { color: var(--options); }
.lv-delta.hinge { color: var(--hedge); }
.lv-basis { font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); margin-bottom: 8px; line-height: 1.4; }
.lv-rows { display: flex; flex-direction: column; }
.lv-row { display: grid; grid-template-columns: 70px 1fr 66px 46px; gap: 8px; align-items: baseline; padding: 4px 0; border-top: 1px solid var(--line); font-size: 14px; }
.lv-row:first-child { border-top: 0; }
.lv-es { font-family: var(--mono); color: var(--ink); }
.lv-role { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-spx { font-family: var(--mono); color: var(--ink-3); font-size: 13px; text-align: right; }
.lv-size { color: var(--ink-3); font-size: 12px; text-align: right; }
.lv-row.brake .lv-role { color: var(--smallcaps); }
.lv-row.gas .lv-role { color: var(--options); }
.lv-row.hinge .lv-role { color: var(--hedge); }
.lv-row.last { background: rgba(255,255,255,0.06); margin: 0 -8px; padding: 4px 8px; border-radius: 4px; border-top: 0; }
.lv-row.last .lv-es, .lv-row.last .lv-role { color: #fff; font-weight: 600; }
.lv-empty { color: var(--ink-3); font-size: 14px; padding: 6px 0 2px; }

.spark { display: block; width: 100%; height: 56px; margin: 4px 0 8px; }
.bk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }
.bk-grid > div { min-width: 0; }
.bk-grid dt { font-size: 12px; color: var(--ink-3); }
.bk-grid dd { margin: 0; font-family: var(--mono); font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-grid dd.muted { font-family: var(--font); font-size: 13.5px; white-space: normal; line-height: 1.3; }
.bk-pos { display: block; font-size: 13.5px; color: var(--ink); }
.bk-pos::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--ink-3)); margin-right: 6px; vertical-align: 2px; }
.bk-pos small { color: var(--ink-3); font-size: 12px; }
.bk-foot { font-size: 12px; color: var(--ink-3); margin-top: 10px; }

/* tablet: narrower panels, smaller type */
@media (max-width: 1180px) {
  :root { --panel-w: 272px; --hud-pad: 14px; }
  .brand { font-size: 24px; }
  .brand-sub { margin: 6px 0 10px; }
  .hud-tl { max-width: 200px; }
  .ev { min-width: 0; gap: 8px; padding: 6px 10px 6px 7px; }
  .ev-title { max-width: 118px; font-size: 14.5px; }
  .ev-time { font-size: 12px; }
  .clock { font-size: 28px; }
  .date { font-size: 12.5px; }
  .sessions { gap: 10px; }
  .meter-runs, .meter-text { display: none; }
  .controls .btn-sm { height: 28px; padding: 0 8px; font-size: 12.5px; }
  .lv-row { grid-template-columns: 70px 1fr 64px; }
  .lv-size { display: none; }
  .panel-title { font-size: 21px; }
  .label.office .label-name { font-size: clamp(22px, 2.6vw, 30px); letter-spacing: 0.12em; }
}
@media (max-width: 900px) {
  .hud-tc { display: none; }
  .ev-empty { display: block; }
}

/* phone: bottom sheet with tabs */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; max-height: 42vh;
  display: flex; flex-direction: column;
  background: rgba(7,10,19,0.86); border-top: 1px solid var(--line-strong);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet[hidden] { display: none; }
.sheet-tabs { display: flex; padding: 0 8px; border-bottom: 1px solid var(--line); }
.sheet-tab { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 6px; font-size: 14.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.sheet-tab[aria-selected="true"] { color: #fff; border-bottom-color: #fff; }
.sheet-body { overflow-y: auto; padding: 10px 12px 12px; }
.sheet-body .panel { width: 100%; background: transparent; border: 0; box-shadow: none; padding: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.sheet-body .hud { position: static; transform: none; }
.sheet-body .events { flex-direction: column; }
.sheet-body .ev { min-width: 0; }
.sheet-body .ev-title { max-width: none; white-space: normal; }
body.phone .hud-tl { max-width: 60vw; }
body.phone .brand { font-size: 20px; letter-spacing: 0.2em; }
body.phone .brand-sub { font-size: 13px; margin: 4px 0 0; }
body.phone .legend { display: none; }
body.phone .clock { font-size: 24px; }
body.phone .date { display: none; }
body.phone .sessions { gap: 10px; }
body.phone .sess { font-size: 10px; letter-spacing: 0.08em; }
body.phone .controls { gap: 6px; margin-top: 6px; }
body.phone .meter { display: none; }
body.phone .controls .btn { height: 28px; padding: 0 8px; font-size: 12.5px; }
body.phone .hud-tr { max-width: 46vw; }

/* ---------- hover cards ---------- */
.hovercard, .orbcard {
  position: fixed; z-index: 15; width: 340px; max-width: calc(100vw - 32px);
  padding: 14px 16px 12px; border-radius: var(--radius);
  background: rgba(9,13,24,0.8); border: 1px solid var(--line-strong);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
              0 18px 48px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
  transition: opacity 140ms ease, transform 140ms ease;
}
.hovercard[hidden], .orbcard[hidden] { display: none; }
.hc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); flex: none; }
.hc-name { font-family: var(--serif); font-weight: 500; font-size: 18px; flex: 1; }
.hc-synopsis { color: var(--ink); font-size: 14.5px; line-height: 1.45; }
.hc-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0 8px; }
.hc-stats .st { display: flex; flex-direction: column; gap: 1px; }
.hc-stats .st b { font-weight: 600; font-size: 15px; }
.hc-stats .st span { font-size: 12px; color: var(--ink-3); }
.hc-plan { font-size: 13.5px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 8px; }
.hc-plan:empty { display: none; }
.hc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.hc-updated { font-size: 12.5px; color: var(--ink-3); }

.orbcard { width: 300px; padding: 12px 14px 10px; }
.oc-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.oc-tag { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; color: var(--accent); }
.oc-count { font-size: 12.5px; color: var(--ink-3); }
.oc-item { padding: 7px 0; border-top: 1px solid var(--line); }
.oc-item:first-child { border-top: 0; padding-top: 0; }
.oc-title { font-size: 14px; line-height: 1.35; color: var(--ink); }
.oc-meta { font-size: 12px; color: var(--ink-3); font-family: var(--mono); margin-top: 2px; }
.oc-empty { font-size: 13.5px; color: var(--ink-3); }

/* ---------- workspace ---------- */
.scrim { position: fixed; inset: 0; z-index: 25; background: rgba(4,8,18,0.5); }
.scrim[hidden] { display: none; }
.workspace {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: 85vw; max-width: 1480px;
  display: flex; flex-direction: column;
  background: linear-gradient(to right, #0d1428, #0a1020);
  border-left: 1px solid var(--line-strong);
  box-shadow: -24px 0 80px rgba(0,0,0,0.5);
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(.2,.8,.2,1);
}
.workspace[hidden] { display: none; }
.workspace.open { transform: translateX(0); }
@media (max-width: 760px) { .workspace { width: 100vw; border-left: 0; } }

.ws-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
}
.ws-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ws-title h1 { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-actions { display: flex; align-items: center; gap: 12px; }
.ws-updated { font-size: 13px; color: var(--ink-3); }
@media (max-width: 640px) { .ws-head { padding: 12px 16px; } .ws-title h1 { font-size: 18px; } .ws-updated { display: none; } }

.tabs { display: flex; gap: 4px; padding: 8px 24px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 8px 12px 10px; font-size: 14.5px; font-weight: 500; color: var(--ink-2); cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .count { margin-left: 6px; color: var(--ink-3); font-weight: 400; }
@media (max-width: 640px) { .tabs { padding: 6px 12px 0; } .tab { padding: 8px 10px 10px; } }

.ws-body { flex: 1; overflow-y: auto; padding: 24px; }
@media (max-width: 640px) { .ws-body { padding: 16px; } }

.empty { padding: 32px 0; color: var(--ink-3); font-size: 15px; }
.err { color: var(--bad); }

/* overview */
.overview { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); gap: 28px; }
@media (max-width: 1000px) { .overview { grid-template-columns: 1fr; } }
.synopsis { font-size: 17px; line-height: 1.5; margin-bottom: 18px; }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
@media (max-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile {
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
}
.tile b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.tile span { font-size: 13px; color: var(--ink-3); }
.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.section-title { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; }

.log { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; padding-right: 4px; }
.log-item { display: grid; grid-template-columns: 56px 1fr; gap: 10px; font-size: 14px; line-height: 1.45; }
.log-item time { color: var(--ink-3); font-size: 13px; padding-top: 2px; }
.log-item .role { color: var(--accent); font-weight: 500; margin-right: 6px; }

.chat { display: flex; flex-direction: column; gap: 10px; }
.chat-history { display: flex; flex-direction: column; gap: 10px; max-height: 40vh; overflow-y: auto; }
.msg { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; max-width: 92%; }
.msg.me { align-self: flex-end; background: color-mix(in srgb, var(--accent) 20%, transparent); }
.msg.them { align-self: flex-start; background: rgba(255,255,255,0.06); }
.chat-form { display: flex; gap: 8px; }
.chat-form input, .input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: rgba(0,0,0,0.25); color: var(--ink); font: inherit; font-size: 15px;
}
.chat-form input:focus, .input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

/* tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 13px; padding: 6px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl tr.total td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line-strong); }
.tbl .sym { font-weight: 600; }
.tbl details summary { cursor: pointer; color: var(--ink-2); list-style: none; }
.tbl details summary::-webkit-details-marker { display: none; }
.tbl details summary::after { content: " more"; color: var(--accent); font-size: 13px; }
.tbl details[open] summary::after { content: " less"; }
.tbl details p { margin-top: 6px; color: var(--ink); white-space: pre-wrap; max-width: 70ch; }
.reason { display: block; font-size: 13px; color: var(--ink-3); margin-top: 3px; max-width: 40ch; white-space: normal; }

/* lessons */
.lesson { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.5; }
.lesson.superseded { opacity: 0.45; }
.lesson time { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

/* feed */
.feed-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.feed-item .ft { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.feed-item .ft a { font-weight: 500; font-size: 15px; }
.feed-item .ft time { color: var(--ink-3); font-size: 13px; }
.feed-item .ft .src { color: var(--ink-3); font-size: 13px; }
.feed-item .why { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.feed-item .body { color: var(--ink-2); font-size: 14px; margin-top: 4px; max-width: 80ch; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px;
  background: rgba(255,255,255,0.07); color: var(--ink-2); border: 1px solid transparent; cursor: pointer;
}
.chip.on { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 20%, transparent); }
.imp-3 .ft a { color: #fff; }
.filterbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filterbar .lbl { font-size: 13px; color: var(--ink-3); margin-right: 4px; }

/* research */
.paper { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr; gap: 6px; }
.paper .pt { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.paper .pt a { font-weight: 600; font-size: 15.5px; }
.paper .stage { font-size: 12.5px; color: var(--ink-3); }
.paper .step { display: grid; grid-template-columns: 96px 1fr; gap: 10px; font-size: 14.5px; }
.paper .step span { color: var(--ink-3); font-size: 13px; padding-top: 2px; }
.paper .step p { white-space: pre-wrap; max-width: 80ch; }
.flag-paper { color: var(--hedge); font-weight: 600; font-size: 13px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  padding: 10px 16px; border-radius: var(--radius-sm); font-size: 14px;
  background: rgba(20,30,58,0.95); border: 1px solid var(--line-strong); box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.toast[hidden] { display: none; }
.toast.bad { border-color: var(--bad); }

/* ---------- login / settings pages ---------- */
body.page { overflow: auto; }
.center { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.card {
  width: 100%; max-width: 400px; padding: 28px 28px 24px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--line-strong);
  box-shadow: 0 24px 64px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.card h1 { font-size: 24px; margin-bottom: 4px; }
.card .lead { color: var(--ink-2); font-size: 14.5px; margin-bottom: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; color: var(--ink-2); }
.field .input { height: 44px; font-size: 16px; }
.card .btn { width: 100%; height: 44px; justify-content: center; font-size: 15px; margin-top: 6px; }
.err-line { color: var(--bad); font-size: 14px; margin-bottom: 14px; }
.err-line[hidden] { display: none; }

.page-wrap { max-width: 920px; margin: 0 auto; padding: 32px 16px 64px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.page-head h1 { font-size: 26px; }
.page-head a { color: var(--ink-2); font-size: 14.5px; }
.note { color: var(--ink-2); font-size: 14.5px; max-width: 70ch; margin-bottom: 24px; line-height: 1.5; }
.cred { display: grid; grid-template-columns: 1.1fr 1.4fr auto auto; gap: 10px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cred .meta { min-width: 0; }
.cred .meta b { display: block; font-weight: 600; font-size: 15px; }
.cred .meta span { display: block; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.cred .meta .set { color: var(--ok); }
.cred .meta .unset { color: var(--warn); }
.cred .input { width: 100%; }
.cred .result { grid-column: 1 / -1; font-size: 13.5px; min-height: 0; }
.cred .result:empty { display: none; }
.cred .result.ok { color: var(--ok); }
.cred .result.bad { color: var(--bad); }
@media (max-width: 640px) {
  .cred { grid-template-columns: 1fr 1fr; }
  .cred .meta, .cred .input-wrap { grid-column: 1 / -1; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation: none !important; }
}
