:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #14181f; --muted: #5b6472; --line: #dde1e7;
  --accent: #0b6bcb; --good: #1a7f37; --warn: #b26b00; --bad: #c62828; --chip: #eef1f5;
  --user: #e8f1fb; --bars: #0b6bcb; --bars2: #7a8696; --bars3: #b26b00;
  --mono: 'IBM Plex Mono', ui-monospace, monospace; --sans: 'IBM Plex Sans', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --panel: #161b22; --ink: #e6e9ee; --muted: #9aa4b2; --line: #2a313c;
    --accent: #5aa9ff; --good: #4cc26a; --warn: #e0a030; --bad: #ff6b6b; --chip: #1f2630;
    --user: #14253a; --bars: #5aa9ff; --bars2: #6b7686; --bars3: #e0a030;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116; --panel: #161b22; --ink: #e6e9ee; --muted: #9aa4b2; --line: #2a313c;
  --accent: #5aa9ff; --good: #4cc26a; --warn: #e0a030; --bad: #ff6b6b; --chip: #1f2630;
  --user: #14253a; --bars: #5aa9ff; --bars2: #6b7686; --bars3: #e0a030;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.pad { padding: 24px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; white-space: nowrap; }
.brand .mark { color: var(--accent); }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.tabs button { font: inherit; border: 1px solid var(--line); background: var(--chip); color: var(--ink); padding: 6px 14px;
  border-radius: 6px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs button small { opacity: .75; margin-left: 6px; font-family: var(--mono); font-size: 11px; }
.theme { font: inherit; background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: 4px 9px; cursor: pointer; }
main { padding: 20px 24px 60px; }
h1 { font-size: 26px; margin: 4px 0 2px; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: .01em; }
.sub { color: var(--muted); margin: 0 0 6px; }
.meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pill { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 99px; border: 1px solid currentColor; font-weight: 600; }
.pill.run { color: var(--warn); } .pill.done { color: var(--good); }
.grid { display: grid; gap: 16px; }
.scores { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 18px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; min-width: 0; }
.score .label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.score .big { font: 600 34px/1.1 var(--mono); margin: 6px 0 4px; }
.score .note { font-size: 13px; color: var(--muted); }
.meter { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-bottom: 16px; }
.brief img { width: 100%; border-radius: 6px; border: 1px solid var(--line); }
.brief p { margin: 10px 0 0; }
.phases { display: flex; height: 30px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 12px; }
.phases span { display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; overflow: hidden;
  white-space: nowrap; padding: 0 4px; border-right: 1px solid rgba(255,255,255,.35); }
.phase-list { margin: 0; padding: 0; list-style: none; }
.phase-list li { display: grid; grid-template-columns: 14px 120px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.phase-list .sw { width: 12px; height: 12px; border-radius: 3px; margin-top: 4px; }
.phase-list .t { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.chart svg { width: 100%; height: 150px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-top: 0; }
.st { font-weight: 600; white-space: nowrap; }
.st.done, .st.pass { color: var(--good); } .st.partial, .st.pending { color: var(--warn); } .st.fail { color: var(--bad); }
.gap { color: var(--muted); font-size: 13px; }
.gallery { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.gallery figure { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: zoom-in; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #fff; display: block; }
.gallery figcaption { font-size: 13px; padding: 8px 10px; color: var(--muted); }
.deliv { margin: 0; padding-left: 18px; } .deliv code { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
section { margin-bottom: 16px; }
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--panel); max-width: 900px; min-width: 0; }
.msg.user { background: var(--user); align-self: flex-end; border-color: transparent; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 4px; font-family: var(--mono); }
.msg .body { overflow-wrap: anywhere; }
.msg .body p { margin: 6px 0; } .msg .body ul, .msg .body ol { margin: 6px 0; padding-left: 20px; }
.msg .body code { font-family: var(--mono); font-size: 13px; background: var(--chip); padding: 0 4px; border-radius: 4px; }
.msg .body pre { overflow-x: auto; background: var(--chip); padding: 8px; border-radius: 6px; }
.msg .body table { font-size: 13px; display: block; overflow-x: auto; }
.msg img { max-width: 100%; border-radius: 6px; margin-top: 6px; }
.msg.compact .body { max-height: 220px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.msg .more { font: inherit; font-size: 12px; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; margin-top: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; font-size: 13px; }
.toolbar input { font: inherit; padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); min-width: 220px; }
.log { font-family: var(--mono); font-size: 12.5px; max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.log div { display: grid; grid-template-columns: 70px 120px 1fr; gap: 10px; padding: 3px 10px; border-top: 1px solid var(--line); }
.log div:first-child { border-top: 0; }
.log .tool { color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.log .helper .tool { color: var(--warn); }
details > summary { cursor: pointer; font-weight: 600; font-size: 17px; margin-bottom: 10px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 20; padding: 20px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 85vh; background: #fff; border-radius: 6px; }
.lightbox p { color: #ddd; margin-top: 10px; text-align: center; }
.scoring { font-size: 14px; } .scoring li { margin-bottom: 4px; }
@media (max-width: 640px) {
  .top { padding: 8px 16px; flex-wrap: wrap; } main { padding: 16px 16px 48px; }
  .two { grid-template-columns: 1fr; } .phase-list li { grid-template-columns: 14px 1fr; } .phase-list .t { grid-column: 2; }
  .log div { grid-template-columns: 52px 1fr; } .log .what { grid-column: 1 / -1; }
  .toolbar input { min-width: 0; width: 100%; }
}
