:root {
  --bg: #F4F5F7; --panel: #FFFFFF; --col: #E9EBF0; --line: #DDE0E6; --line2: #B9BECA;
  --text: #16181D; --dim: #4B5262; --chip: #EEF0F4; --chip-text: #3A4050; --link: #1D4ED8;
  --ok-bg: #DCF3E3; --ok-text: #0F5A2C; --ok-line: #2E9550;
  --work-bg: #DDE7FF; --work-text: #173A9E;
  --need-bg: #FFF3DC; --need-line: #C77A14; --need-text: #5C3400; --need-dim: #7A4300; --need-pill: #FFE7BD;
  --bad: #A11919; --solid: #16181D; --solid-text: #FFFFFF;
  --term: #15171C; --term-bar: #23262E; --term-text: #D7DAE2;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318; --panel: #1B1E25; --col: #16181E; --line: #2C303A; --line2: #454B59;
    --text: #E8EAF0; --dim: #A3AABA; --chip: #272B35; --chip-text: #C5CAD6; --link: #8FB4FF;
    --ok-bg: #143823; --ok-text: #8FE0A8; --ok-line: #2E9550;
    --work-bg: #1B2A55; --work-text: #B5C8FF;
    --need-bg: #33270F; --need-line: #C77A14; --need-text: #FFD899; --need-dim: #F0B762; --need-pill: #5A3C08;
    --bad: #FF8F8F; --solid: #E8EAF0; --solid-text: #16181D;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; padding-bottom: 48px; }
a { color: var(--link); }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
h1, h2, h3, .brand { font-weight: 600; letter-spacing: -0.01em; }
[hidden] { display: none !important; }

.top { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.brand { font-size: 21px; }
.top .right { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px; color: var(--dim); }
.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; text-decoration: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 7px; background: var(--line2); }
.dot.on { background: #15803D; }
.dot.off { background: var(--bad); }
.main { max-width: 1360px; margin: 0 auto; padding: 20px 16px 0; display: flex; flex-direction: column; gap: 20px; }
.main.narrow { max-width: 920px; }
@media (min-width: 800px) { .top { padding: 12px 32px; } .main { padding: 24px 32px 0; gap: 24px; } }

.btn { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel); color: var(--text); font-size: 15px; }
.btn.solid { border-color: var(--solid); background: var(--solid); color: var(--solid-text); font-weight: 500; }
.btn.armed { border-color: var(--bad); background: var(--bad); color: #FFFFFF; font-weight: 600; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.input { flex: 999 1 220px; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel); color: var(--text); font-size: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.note { font-size: 14px; color: var(--dim); }
.warn { background: var(--need-bg); border: 1px solid var(--need-line); color: var(--need-text); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel h2 { font-size: 18px; }
.mono { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.chip { font-family: var(--mono); font-size: 12px; background: var(--chip); color: var(--chip-text); padding: 2px 7px; border-radius: 5px; overflow-wrap: anywhere; }
.count { font-weight: 600; font-size: 14px; border-radius: 999px; padding: 2px 11px; background: var(--chip); color: var(--dim); }
.pill { align-self: flex-start; padding: 3px 11px; border-radius: 999px; font-weight: 600; font-size: 13px; background: var(--chip); color: var(--dim); }
.pill.working { background: var(--work-bg); color: var(--work-text); }
.pill.blocked { background: var(--need-pill); color: var(--need-text); }
.gate { padding: 2px 8px; border-radius: 5px; font-size: 13px; background: var(--chip); color: var(--dim); }
.gate.pass { background: var(--ok-bg); color: var(--ok-text); font-weight: 500; }

/* sign-in */
.sign { max-width: 440px; margin: 8vh auto 0; }
.sign h1 { font-size: 24px; }

/* needs you */
.need { border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); border: 2px solid var(--line); transition: background 400ms, border-color 400ms; }
.need.hot { background: var(--need-bg); border-color: var(--need-line); animation: pulse 2.4s ease-in-out infinite; }
.need.hot .count { background: var(--need-line); color: #FFFFFF; }
.need h2 { font-size: 20px; }
.ask { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--need-line); }
.ask:first-of-type { border-top: 0; padding-top: 0; }
.ask .where { font-size: 13px; color: var(--need-dim); font-weight: 500; }
.ask .title { font-weight: 500; }
.ask .q { color: var(--need-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.askcard { background: var(--need-bg); border: 2px solid var(--need-line); border-radius: 14px; padding: 16px 18px; }
.askcard .ask { border: 0; padding: 0; gap: 10px; }

/* board */
.cols { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.col { flex: 1 1 320px; min-width: 0; background: var(--col); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.col .head { display: flex; justify-content: space-between; align-items: baseline; }
.col h3 { font-size: 16px; }
.col.empty { flex: 1 1 100%; flex-direction: row; justify-content: space-between; align-items: center; padding: 10px 14px; color: var(--dim); }
@media (min-width: 800px) {
  .col.empty { flex: 0 0 60px; flex-direction: column-reverse; justify-content: flex-end; padding: 14px 0; gap: 10px; }
  .col.empty h3 { writing-mode: vertical-rl; }
}
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.blocked { border: 2px solid var(--need-line); }
.card .title { font-weight: 500; color: var(--text); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; overflow-wrap: anywhere; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--dim); align-items: center; }
.card .foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.strip { background: var(--col); border-radius: 14px; padding: 4px 14px; display: flex; flex-direction: column; }
.strip > button { all: unset; cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 44px; font-weight: 600; }
.strip > button:focus-visible { outline: 2px solid var(--link); }
.strip .plain { display: flex; justify-content: space-between; align-items: center; min-height: 44px; font-weight: 600; color: var(--dim); }
.list { list-style: none; padding: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.list a { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.list .wait { color: var(--dim); font-size: 13px; }

/* card detail */
.h1 { font-size: 22px; line-height: 1.3; max-width: 1000px; overflow-wrap: anywhere; }
@media (min-width: 800px) { .h1 { font-size: 26px; } }
.gates { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; border: 2px solid var(--line); transition: background 400ms, border-color 400ms; }
.tile.pass { background: var(--ok-bg); border-color: var(--ok-line); }
.tile .name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; }
.tile .st { font-size: 13px; color: var(--dim); }
.tile.pass .st { color: var(--ok-text); }
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .wide { flex: 999 1 560px; min-width: 0; }
.split > .side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.crit { list-style: none; padding: 0; }
.crit li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.crit .tick { flex: 0 0 76px; text-align: center; font-size: 13px; font-weight: 600; border-radius: 5px; padding: 2px 0; background: var(--chip); color: var(--dim); }
.crit .tick.yes { background: var(--ok-bg); color: var(--ok-text); }
.crit .body { min-width: 0; display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.crit code { font-family: var(--mono); font-size: 12.5px; color: var(--dim); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--dim); }
.kv dd { overflow-wrap: anywhere; }
.bul { padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.raw { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; max-height: 60vh; overflow: auto; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }

/* agent screen */
.term { border-radius: 14px; overflow: hidden; border: 1px solid var(--term-bar); display: flex; flex-direction: column; }
.term .bar { background: var(--term-bar); color: var(--term-text); padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; }
.term .bar strong { color: #FFFFFF; font-weight: 600; }
.term .bar .pill { margin-left: auto; align-self: center; }
.term pre { margin: 0; background: var(--term); color: var(--term-text); font-family: var(--mono); font-size: 13px; line-height: 1.6; padding: 14px 16px; height: 56vh; min-height: 260px; overflow: auto; white-space: pre; }
.term form { background: var(--panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
.term label { font-size: 14px; font-weight: 500; }

/* toast and motion */
.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 480px; margin: 0 auto; background: var(--solid); color: var(--solid-text); border-radius: 10px; padding: 12px 16px; font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); animation: slide 200ms ease-out; overflow-wrap: anywhere; z-index: 5; }
.enter > * { animation: rise 260ms ease-out both; }
.enter > *:nth-child(2) { animation-delay: 40ms; }
.enter > *:nth-child(3) { animation-delay: 80ms; }
.enter > *:nth-child(n+4) { animation-delay: 120ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(199, 122, 20, 0); } 50% { box-shadow: 0 0 0 6px rgba(199, 122, 20, 0.22); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.sign .input { flex: 0 0 auto; width: 100%; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
