:root {
  --bg: #0d0e10;
  --panel: #141619;
  --panel-2: #1a1d21;
  --raise: #20242a;
  --line: #2b2f36;
  --line-soft: #1f2227;
  --text: #ecebe6;
  --muted: #a3a49f;
  --faint: #8c8e88;
  --rec: #ff4d2e;
  --rec-ink: #ff7a61;
  --rec-soft: rgba(255, 77, 46, 0.13);
  --go: #3ecf8e;
  --go-soft: rgba(62, 207, 142, 0.13);
  --warn: #f2b33d;
  --warn-soft: rgba(242, 179, 61, 0.13);
  --info: #7cb2ff;
  --info-soft: rgba(124, 178, 255, 0.13);
  --radius: 12px;
  --r-sm: 8px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Archivo", system-ui, -apple-system, sans-serif;
  --top-h: 60px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top-h) + 16px); scrollbar-color: #33373d var(--bg); }
* { scrollbar-width: thin; scrollbar-color: #33373d transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--rec);
}
::selection { background: rgba(255, 77, 46, 0.35); color: #fff; }
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--faint); }
a:hover { text-decoration-color: var(--rec); }
code { font: 0.88em var(--mono); background: var(--raise); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 650; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* wordmark (brand voice, used only for the name) */
.wordmark { font: italic 900 34px/0.9 var(--sans); font-stretch: 125%; letter-spacing: -0.035em; color: var(--text); }
.wordmark b { color: var(--rec); font-weight: 900; }
.wordmark.small { font-size: 17px; }

/* ---------- gate ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(360px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center; }
.gate-card img { margin-bottom: 4px; }
.gate-sub { margin: 0 0 8px; color: var(--muted); }
.gate-card input { width: 100%; font: 16px var(--sans); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.gate-card .btn { width: 100%; padding: 12px; font-size: 15px; }
.gate-field { width: 100%; display: grid; gap: 6px; text-align: left; }
.gate-field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.gate-hint { font: 400 12px var(--mono); color: var(--faint); margin-left: 6px; }
.gate-err { margin: 0; min-height: 1.5em; color: var(--rec-ink); font-size: 14px; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: var(--top-h); padding: 0 24px;
  background: rgba(13, 14, 16, 0.94);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.logo { display: block; }
.brand-text { display: grid; gap: 2px; }
.brand-sub { font-size: 12px; color: var(--muted); line-height: 1; }
.jump { display: flex; gap: 2px; margin-left: auto; }
.jump a { text-decoration: none; font-size: 14px; color: var(--muted); padding: 7px 11px; border-radius: 7px; white-space: nowrap; }
.jump a:hover { color: var(--text); background: var(--panel-2); }
.top-right { display: flex; align-items: center; gap: 14px; flex: none; }
.ext { font-size: 13px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 6px 10px; border-radius: 7px; }
.ext:hover { color: var(--text); border-color: #3a3f46; }
.sync { display: flex; align-items: center; gap: 7px; font: 12px var(--mono); color: var(--faint); white-space: nowrap; }
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.sync.ok .dot { background: var(--go); }
.sync.err .dot { background: var(--rec); }
.sync.err { color: var(--rec-ink); }

/* urgent submit bar */
.alert {
  position: sticky; top: var(--top-h); z-index: 19;
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  padding: 10px 24px; background: var(--rec); color: var(--bg); font-weight: 600; font-size: 14px;
}
.alert .t { font: 600 14px var(--mono); font-variant-numeric: tabular-nums; background: var(--bg); color: var(--text); padding: 2px 8px; border-radius: 5px; }
.alert a { color: var(--bg); text-decoration-thickness: 2px; text-underline-offset: 3px; padding: 4px 0; }
.alert :focus-visible { outline-color: var(--bg); }
.alert .item { display: flex; gap: 10px; align-items: center; }

main { max-width: 1360px; margin: 0 auto; padding: 20px 24px 96px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
main > * { min-width: 0; }

/* ---------- status strip ---------- */
.status {
  display: flex; flex-wrap: wrap; align-items: stretch;
  border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel);
}
.stat { padding: 12px 18px; display: grid; gap: 2px; border-right: 1px solid var(--line-soft); min-width: 0; }
.stat:last-child { border-right: 0; margin-left: auto; }
.stat .l { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stat .v { font: 600 20px/1.2 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; }
.stat .v.go { color: var(--go); }
.stat.pipe .v { font: 600 14px/1.2 var(--sans); display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.stat.pipe .v::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--go); box-shadow: 0 0 0 3px var(--go-soft); }

/* ---------- next actions ---------- */
.next { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.next-col { min-width: 0; }
.who { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.who::before { content: ""; width: 8px; height: 8px; border-radius: 2px; }
.who.you::before { background: var(--warn); }
.who.claude::before { background: var(--info); }
.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.todo li {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 14px;
}
.tag { font: 600 11px/1.6 var(--mono); padding: 0 7px; border-radius: 4px; white-space: nowrap; margin-top: 1px; }
.tag.urgent { background: var(--rec-soft); color: var(--rec-ink); }
.tag.soon { background: var(--warn-soft); color: var(--warn); }
.tag.info { background: var(--info-soft); color: var(--info); }
.todo li.empty { display: block; color: var(--faint); background: transparent; border-style: dashed; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px 22px; }
.panel-head { display: flex; align-items: baseline; gap: 6px 14px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head .btn { margin-left: auto; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.hero { border-color: var(--line); padding-top: 22px; }
.h-hero { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }

/* buttons */
.btn {
  font: 600 13px/1 var(--sans); color: #121315; background: var(--text);
  border: 1px solid transparent; border-radius: 7px; padding: 9px 14px; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
  white-space: nowrap;
}
.btn:hover { background: #fff; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--panel-2); border-color: #3a3f46; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.danger { color: var(--rec-ink); border-color: rgba(255, 77, 46, 0.4); }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; border-radius: 6px; }

/* ---------- board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(172px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; }
.col.hot { border-color: rgba(255, 77, 46, 0.5); background: linear-gradient(var(--rec-soft), transparent 120px), var(--bg); }
.col.mine .col-name::after { content: "you"; font: 600 10px/1.6 var(--mono); color: var(--warn); background: var(--warn-soft); padding: 0 5px; border-radius: 3px; margin-left: 7px; vertical-align: 1px; }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 4px; gap: 8px; }
.col-name { font-size: 13px; font-weight: 650; }
.col-sub { font-size: 12px; color: var(--faint); margin-top: 1px; }
.count { font: 600 13px var(--mono); color: var(--muted); }
.col .none { color: var(--faint); font-size: 13px; padding: 6px 4px; }

.clip { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; display: grid; gap: 7px; transition: border-color .15s ease; }
.clip:hover { border-color: #3d424a; }
.clip-open { all: unset; cursor: pointer; display: grid; gap: 6px; border-radius: 4px; }
.clip-open:focus-visible { outline: 2px solid var(--info); outline-offset: 3px; }
.clip .t { font-size: 14px; font-weight: 650; line-height: 1.3; }
.clip .meta { display: flex; gap: 5px; flex-wrap: wrap; }
.chip { font: 500 11px/1.7 var(--mono); padding: 0 6px; border-radius: 4px; background: var(--raise); color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.p { color: var(--text); }
.clip .file { font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip .row { display: flex; justify-content: space-between; align-items: center; font: 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.clip .money { color: var(--go); font-weight: 600; }
.clip .timer { font: 600 13px var(--mono); font-variant-numeric: tabular-nums; color: var(--rec-ink); }
.clip .timer.late { color: var(--faint); }
.clip .move { justify-self: start; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .rates { font: 12px/1.6 var(--mono); color: var(--muted); }
.tbl .small { font-size: 12px; color: var(--faint); margin-top: 2px; }
.tbl .cname { font-weight: 600; }
.status-pill { font: 600 11px/1.7 var(--mono); padding: 0 7px; border-radius: 4px; white-space: nowrap; }
.status-pill.found { background: var(--raise); color: var(--muted); }
.status-pill.applied { background: var(--warn-soft); color: var(--warn); }
.status-pill.joined, .status-pill.active { background: var(--go-soft); color: var(--go); }
.status-pill.ended, .status-pill.parked { color: var(--faint); border: 1px solid var(--line); }
.status-pill.parked { border-style: dashed; }

/* ---------- sources ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 8px; align-content: start; }
.card .t { font-weight: 650; }
.card .meta { font: 12px/1.5 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.empty-box { border: 1px dashed var(--line); border-radius: 10px; padding: 22px; color: var(--muted); font-size: 14px; text-align: center; grid-column: 1 / -1; }

/* ---------- accounts ---------- */
.acct-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.acct { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 10px; align-content: start; }
.acct.done { border-color: rgba(62, 207, 142, 0.35); }
.acct .p { font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.acct .h { font: 12px var(--mono); color: var(--muted); }
.acct .ty { font-size: 12px; color: var(--faint); }
.checks { display: grid; gap: 2px; }
.check { display: flex; gap: 9px; align-items: center; font-size: 13px; cursor: pointer; padding: 5px 0; min-height: 32px; }
.check input { accent-color: var(--go); width: 17px; height: 17px; margin: 0; flex: none; }
.acct .note { font-size: 12px; color: var(--faint); border-top: 1px solid var(--line-soft); padding-top: 8px; }
.progress { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--go); transition: width .25s ease; }

/* ---------- money ---------- */
.money-grid { display: grid; grid-template-columns: 1fr 1fr 0.85fr; gap: 10px; }
.chart-card { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.chart-card h3 { margin-bottom: 12px; }
.bars { display: grid; gap: 9px; }
.bar { display: grid; grid-template-columns: minmax(70px, 120px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar .lbl { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { height: 8px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--text); border-radius: 3px; }
.bar .fill.g { background: var(--go); }
.bar .v { font: 12px var(--mono); font-variant-numeric: tabular-nums; text-align: right; min-width: 56px; }
.cost-num { font: 600 28px/1.1 var(--mono); }
.cost-sub { font-size: 13px; color: var(--muted); margin: 6px 0 12px; }
.be-track { height: 8px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.be-track span { display: block; height: 100%; background: var(--go); }
.be-cap { font-size: 12px; color: var(--faint); margin-top: 6px; }
.muted-line { color: var(--faint); font-size: 13px; }

/* ---------- playbook ---------- */
.play-grid { display: grid; grid-template-columns: 1.1fr 1fr 0.9fr; gap: 10px; }
.play { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 10px; padding: 16px; }
.play h3 { margin-bottom: 10px; }
.steps, .rules { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 14px; color: #d6d5cf; }
.steps li::marker { font: 600 12px var(--mono); color: var(--faint); }
.rules li::marker { color: var(--rec); }
.cmds { display: grid; gap: 6px; margin-top: 10px; }
.cmd {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  font: 13px/1.4 var(--sans); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 12px; color: var(--text); cursor: pointer; text-align: left; width: 100%;
}
.cmd:hover { border-color: #3d424a; }
.cmd .copy { font: 11px var(--mono); color: var(--faint); flex: none; }

/* ---------- log ---------- */
.log { list-style: none; margin: 0; padding: 0; display: grid; max-height: 280px; overflow: auto; font-size: 13px; }
.log li { display: grid; grid-template-columns: 120px 56px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.log .at { font: 12px var(--mono); color: var(--faint); font-variant-numeric: tabular-nums; }
.log .w { font-size: 12px; font-weight: 600; }
.log .w.claude { color: var(--info); }
.log .w.you { color: var(--warn); }

/* ---------- modal ---------- */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  padding: 0; width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
dialog::backdrop { background: rgba(5, 6, 7, 0.7); }
dialog form { padding: 22px; display: grid; gap: 18px; }
.fields { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  font: 15px var(--sans); color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #4a5058; }
.field textarea { min-height: 76px; resize: vertical; }
.modal-actions { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; }

.toast {
  position: fixed; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--text); color: #111; font-size: 14px; font-weight: 600;
  padding: 10px 16px; border-radius: 9px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s cubic-bezier(.2,.8,.2,1);
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .jump { display: none; }
  .acct-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .money-grid, .play-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --top-h: 56px; }
  .top { padding: 0 14px; gap: 10px; }
  .ext { display: none; }
  .brand-sub { display: none; }
  main { padding: 14px 12px 96px; gap: 14px; }
  .panel { padding: 16px 14px; }
  .alert { padding: 10px 14px; }
  .status { display: grid; grid-template-columns: 1fr 1fr; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 10px 14px; }
  .stat:nth-child(odd) { border-right: 1px solid var(--line-soft); }
  .stat:last-child { margin-left: 0; grid-column: 1 / -1; border-bottom: 0; border-right: 0; }
  .next { grid-template-columns: 1fr; gap: 14px; }
  .h-hero { font-size: 22px; }
  /* phone: stages stack, empty stages collapse to one line */
  .board { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
  .col { min-height: 0; }
  .col.empty { flex-direction: row; align-items: center; padding: 8px 12px; }
  .col.empty .col-head { flex: 1; padding: 0; }
  .col.empty .col-sub, .col.empty .none { display: none; }
  .acct-grid { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
  .log li { grid-template-columns: 1fr auto; gap: 2px 10px; }
  .log li > :last-child { grid-column: 1 / -1; }
  .panel-head .btn { margin-left: 0; }
  .panel-head .hint { flex-basis: 100%; order: 3; }
  .tbl { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

.pillar { display: inline-block; font: 600 11px var(--mono); letter-spacing: .02em; color: var(--muted); border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px; margin-bottom: 4px; }
