:root {
  color-scheme: dark;
  --bg: #0D0F12; --rail: #0F1115; --panel: #14171C; --sunk: #111418; --field: #0F1216; --raised: #171B21; --hover: #161A20;
  --line: #232830; --line-2: #2A3038; --line-3: #1D2127; --rail-line: #1C2026;
  --text: #E8EAED; --text-2: #C9CED6; --muted: #A2AAB6; --muted-2: #8C95A3; --faint: #7D8795;
  --accent: #7AA7FF; --link: #8DB4FF; --link-hover: #B5CDFF;
  --good: #6EE0A5; --good-bg: rgba(83,208,143,.13); --good-bar: #53D08F; --good-ans: #8FE8B9;
  --warn: #F5C16C; --warn-bg: rgba(242,179,75,.13);
  --bad: #FF9B80; --bad-bg: rgba(255,138,107,.13); --bad-bar: #FF8A6B; --bad-ans: #FFAE98;
  --lilac: #C7B5FF; --lilac-bg: rgba(185,162,255,.13);
  --run: #9DBDFF; --run-bg: rgba(122,167,255,.14);
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--text); font: 14px/1.5 "Geist", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; } a:hover { color: var(--link-hover); }
.mono { font-family: var(--mono); } .num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--muted-2); } .small { font-size: 12px; }
.err { color: var(--bad); } .warn { color: var(--warn); } .ok { color: var(--good); }

/* shell */
.shell { display: flex; min-height: 100vh; }
.rail { width: 232px; flex-shrink: 0; padding: 20px 12px; border-right: 1px solid var(--rail-line); background: var(--rail); display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
body.out .rail { display: none; }
body.out main { padding: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px; color: var(--text); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.rail-group { display: flex; flex-direction: column; gap: 2px; }
.rail-h { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--faint); padding: 0 10px 6px; }
.rail-a { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 10px; border-radius: 8px; color: var(--text-2); font-size: 14px; }
.rail-a:hover { background: var(--raised); color: var(--text); }
.rail-a.on { background: #1A1F27; color: var(--text); font-weight: 500; }
.rail-a.off, .rail-a.off:hover { color: var(--faint); background: none; cursor: default; }
.soon { font-size: 11px; color: var(--muted-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 7px; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--good-bar); }
.me { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 10px; border-top: 1px solid var(--rail-line); }
.avatar { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: #1E2530; color: var(--run); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
main { flex-grow: 1; min-width: 0; padding: 32px 40px 72px; }
.page { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

/* type */
h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
h3 { margin: 0; font-size: 13px; font-weight: 600; }
.lead { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.crumb { font-size: 12px; color: var(--muted-2); }
.hint { margin: 4px 0 0; font-size: 12px; color: var(--muted-2); }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.card.pad { padding: 18px; }
.card-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 18px 18px 8px; flex-wrap: wrap; }
.clip { overflow: hidden; }
.tile { padding: 12px; border-radius: 10px; background: var(--sunk); border: 1px solid var(--line-3); }
.notice { padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.err { background: var(--bad-bg); color: var(--bad); }

/* controls */
button, .btn { font: inherit; font-size: 13px; font-weight: 500; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--raised); color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap; }
button:hover, .btn:hover { border-color: #3A424D; color: var(--text); }
.primary { background: var(--accent); border-color: var(--accent); color: #0B0D10; font-weight: 600; }
.primary:hover { background: #94B8FF; border-color: #94B8FF; color: #0B0D10; }
button:disabled, button:disabled:hover { opacity: .45; cursor: not-allowed; border-color: var(--line-2); }
.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
button.link { height: auto; padding: 0; border: 0; background: none; color: var(--link); font-weight: 400; font-size: inherit; }
button.link:hover { color: var(--link-hover); }
button.icon { width: 36px; padding: 0; }
.input, input:not([type=checkbox]):not([type=radio]), textarea, select { font: inherit; font-size: 13px; color: var(--text); background: var(--field); border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 12px; width: 100%; }
select { height: 38px; padding: 0 10px; }
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #5C84D6; }
:focus-visible { outline: 2px solid #5C84D6; outline-offset: 2px; }
.label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 2px 0 0; flex-shrink: 0; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--field); border: 1px solid var(--line-2); gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 400; }
.seg button.on { background: #1E2530; color: var(--text); font-weight: 500; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--sunk); cursor: pointer; }
.opt:hover { border-color: #323A45; }
.opt.on { border-color: #5C84D6; background: #141B28; }
.opt.off { opacity: .5; cursor: not-allowed; }
.ec-call { margin-top: 14px; }
.ec-h { margin-bottom: 8px; color: var(--text-2); }
.ec-opts { display: flex; flex-direction: column; gap: 6px; }
.ec-scroll { max-height: 360px; overflow-y: auto; padding-right: 4px; }
.ec-line { padding: 10px 12px; }
.ec-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; overflow-wrap: anywhere; }
.line-1 { max-width: 46ch; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.v-stable { background: var(--good-bg); color: var(--good); }
.v-unstable { background: var(--warn-bg); color: var(--warn); }
.v-mismatch { background: var(--bad-bg); color: var(--bad); }
.v-format { background: var(--lilac-bg); color: var(--lilac); }
.v-none { background: #20252C; color: var(--muted); }
.v-run { background: var(--run-bg); color: var(--run); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; background: #1B2027; color: var(--text-2); border: 1px solid var(--line-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; background: #1B2027; border: 1px solid var(--line-2); color: var(--text-2); white-space: nowrap; }
.pill b { font-weight: 600; color: var(--text); }
.ans { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 500; font-family: var(--mono); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; background: #1B2027; color: var(--text); border: 1px solid var(--line-2); }
.ans.same { background: rgba(83,208,143,.12); color: var(--good-ans); border-color: transparent; }
.ans.diff { background: rgba(255,138,107,.12); color: var(--bad-ans); border-color: transparent; }
button.ans { height: 24px; padding: 0 9px; font-size: 12px; font-weight: 500; }
button.ans.picked { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { font-size: 12px; font-weight: 500; color: var(--muted-2); text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: bottom; }
td { font-size: 13px; padding: 13px 16px; border-bottom: 1px solid var(--line-3); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.hover:hover td { background: var(--hover); }
tr.click { cursor: pointer; }
tr.pick td { background: #18202C; }
.scroll-x { overflow-x: auto; }

/* stats and bars */
.stat-l { font-size: 12px; color: var(--muted-2); }
.stat-v { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: #20252C; }
.bar span { display: block; height: 100%; }
.dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.dot.sm { width: 10px; height: 10px; border-radius: 3px; }
.dot.ring { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--bad-bar); }
.dot.empty { background: transparent !important; border: 1.5px dashed #4A515C; }
.dot.failed { background: transparent !important; border: 1.5px solid var(--bad-bar); }
.dots { display: flex; gap: 5px; flex-wrap: wrap; }

/* new run */
.newrun { display: flex; gap: 28px; align-items: flex-start; }
.newrun > .steps { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.step-h { display: flex; align-items: center; gap: 12px; }
.step-h h2 { flex-grow: 1; }
.n { width: 24px; height: 24px; border-radius: 50%; background: #1E2530; color: var(--run); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.n.done { background: rgba(83,208,143,.16); color: var(--good); }
.aside { width: 320px; flex-shrink: 0; position: sticky; top: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.aside .sect { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line-3); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.check svg { flex-shrink: 0; margin-top: 1px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

/* dialog */
dialog { padding: 0; width: min(1040px, 94vw); height: min(780px, 90vh); border: 1px solid var(--line-2); border-radius: 18px; background: var(--panel); color: var(--text); overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgb(8 10 12 / .86); }
.dlg-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line-3); }
.dlg-b { flex-grow: 1; display: flex; min-height: 0; }
.dlg-list { width: 270px; flex-shrink: 0; padding: 16px 12px; border-right: 1px solid var(--line-3); display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.dlg-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; font-size: 13px; color: var(--text-2); cursor: pointer; border: 0; background: none; height: auto; justify-content: flex-start; font-weight: 400; text-align: left; width: 100%; }
.dlg-item:hover { background: var(--raised); }
.dlg-item.on { background: #1A2130; color: var(--text); }
.dlg-item .nm { flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-main { flex-grow: 1; min-width: 0; padding: 20px 24px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.dlg-f { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--line-3); flex-wrap: wrap; }
.answer-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 34px; gap: 8px; align-items: center; }
.diff { padding: 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--field); font-family: var(--mono); font-size: 12px; line-height: 1.75; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.diff .add { background: rgba(122,167,255,.12); color: #C8DAFF; }
.diff .del { background: rgba(255,138,107,.10); color: #FFB4A0; text-decoration: line-through; text-decoration-color: rgba(255,155,128,.6); }

/* one call */
.split { display: grid; grid-template-columns: minmax(0, 500px) minmax(0, 1fr); gap: 20px; align-items: start; }
.turns { padding: 16px; display: flex; flex-direction: column; gap: 14px; max-height: 1100px; overflow-y: auto; }
.who { font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.turn p { margin: 4px 0 0; font-size: 13px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; }
.turn.user { padding-left: 14px; border-left: 2px solid var(--line-2); }
pre.code { margin: 0; padding: 12px; border-radius: 10px; background: var(--field); border: 1px solid var(--line-3); font-family: var(--mono); font-size: 11.5px; line-height: 1.65; color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 460px; overflow: auto; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; display: inline-block; width: 16px; color: var(--muted-2); transition: transform .12s; }
details[open] > summary::before { transform: rotate(90deg); }

/* sign in */
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.signin-box { width: 404px; max-width: 100%; display: flex; flex-direction: column; gap: 28px; }
.signin form { display: flex; flex-direction: column; gap: 16px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.signin input:not([type=checkbox]) { height: 44px; font-size: 14px; border-radius: 10px; }
.signin button { height: 44px; font-size: 14px; border-radius: 10px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; }
.or::before, .or::after { content: ""; flex-grow: 1; height: 1px; background: var(--line); }
tr.logrow { cursor: pointer; }
tr.logrow.open td { background: #18202C; }
tr.logdetail > td { background: var(--sunk); padding: 16px; }
.msg { border-left: 2px solid var(--line-2); padding-left: 12px; }
.msg .who { margin-bottom: 4px; }
.logo { width: 44px; height: 44px; border-radius: 12px; background: #151922; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; }

@media (max-width: 1100px) { .newrun { flex-direction: column; } .aside { position: static; width: 100%; } .split { grid-template-columns: minmax(0, 1fr); } .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .rail { position: static; width: auto; height: auto; flex-direction: row; flex-wrap: wrap; gap: 12px; border-right: 0; border-bottom: 1px solid var(--rail-line); }
  .me { margin-top: 0; border-top: 0; padding: 0 10px; }
  main { padding: 20px 16px 48px; }
  .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); }
  .dlg-b { flex-direction: column; } .dlg-list { width: auto; border-right: 0; border-bottom: 1px solid var(--line-3); max-height: 180px; }
  .answer-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 34px; }
}
