:root {
  color-scheme: dark;
  --bg: #111110; --surface-1: #1a1a19; --surface-2: #232321; --line: #32322f;
  --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #8a897f;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --good: #3fae6a; --warn: #d9a21b; --critical: #e66767;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text-primary); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
a { color: var(--series-1); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 15px; margin: 0 0 10px; } h3 { font-size: 13px; margin: 0 0 6px; color: var(--text-secondary); font-weight: 600; }
.muted { color: var(--text-muted); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; } .spacer { flex: 1; }

.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.side { background: var(--surface-1); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { font-weight: 700; font-size: 17px; padding: 4px 10px 14px; letter-spacing: .2px; } .brand span { color: var(--series-1); }
.side a.nav { display: flex; gap: 9px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--text-secondary); }
.side a.nav:hover { background: var(--surface-2); text-decoration: none; } .side a.nav.on { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }
.side .sect { margin: 14px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); }
.side .who { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); }
.main { padding: 22px 28px 60px; max-width: 1240px; width: 100%; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card.click { cursor: pointer; } .card.click:hover { border-color: #4a4a45; }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; } .stat .l { color: var(--text-secondary); font-size: 12px; margin-top: 2px; } .stat .s { color: var(--text-muted); font-size: 12px; }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; } .bar-fill { height: 100%; background: var(--series-1); border-radius: 4px; }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-primary); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover { border-color: #55554f; } button.primary { background: var(--series-1); border-color: var(--series-1); font-weight: 600; } button.danger { color: var(--critical); }
button.ghost { background: transparent; } button.sm { padding: 3px 8px; font-size: 12px; } button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--text-primary); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--series-1); } textarea { min-height: 84px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--text-secondary); margin: 0 0 4px; } .field { margin-bottom: 12px; } .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; } .filters > * { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; } .seg button { border: 0; border-radius: 0; background: transparent; color: var(--text-secondary); } .seg button.on { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }

table { width: 100%; border-collapse: collapse; } th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; } tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); } tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--line); white-space: nowrap; }
.pill.good { color: var(--good); border-color: #2c5a3d; } .pill.warn { color: var(--warn); border-color: #5e4a17; } .pill.bad { color: var(--critical); border-color: #6b3030; } .pill.blue { color: #7fb2f0; border-color: #28466e; }
.handle { font-weight: 600; } .kind-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.feed-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; } .feed-item:last-child { border-bottom: 0; } .feed-item:hover { background: var(--surface-2); margin: 0 -8px; padding: 9px 8px; border-radius: 6px; }
.feed-item .t { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.empty { color: var(--text-muted); padding: 18px 4px; text-align: center; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.pre { white-space: pre-wrap; word-break: break-word; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; z-index: 50; }
.modal { background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; width: 100%; max-width: 600px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal.wide { max-width: 760px; } .modal h2 { font-size: 17px; margin-bottom: 14px; } .modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.choose { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .choose .card { cursor: pointer; } .choose .card:hover { border-color: var(--series-1); } .choose b { display: block; margin-bottom: 2px; }
.notice { border: 1px solid #5e4a17; background: #2a2210; color: #ecd28a; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.notice.bad { border-color: #6b3030; background: #2b1515; color: #f0a5a5; } .notice.ok { border-color: #2c5a3d; background: #13251a; color: #9fd9b5; }
.err { color: var(--critical); font-size: 13px; min-height: 18px; margin-top: 4px; }
.rev { border-left: 2px solid var(--line); padding: 2px 0 10px 12px; margin-left: 4px; } .rev b { font-weight: 600; }
.diff { font-size: 12.5px; color: var(--text-secondary); } .diff del { color: var(--critical); } .diff ins { color: var(--good); text-decoration: none; }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; } .chart text { fill: var(--text-muted); font-size: 10.5px; }
.chart .bar { fill: var(--series-1); } .chart .bar.c2 { fill: var(--series-2); } .chart .bar.c3 { fill: var(--series-3); } .chart .hit { fill: transparent; } .chart .hit:hover + .bar, .chart g:hover .bar { filter: brightness(1.25); }
.chart .gridline { stroke: var(--line); stroke-width: 1; } .chart .marker { fill: var(--series-2); stroke: var(--surface-1); stroke-width: 2; cursor: pointer; } .chart .mline { stroke: var(--series-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.tip { position: fixed; z-index: 99; pointer-events: none; background: #000; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; max-width: 280px; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.tip b { display: block; } .legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); margin-top: 6px; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.stage { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; } .stage-col { min-width: 0; } .stage-head { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.legend i.sw.c2 { background: var(--series-2); } .legend i.sw.c3 { background: var(--series-3); } .feat { margin-bottom: 8px; padding: 12px; }
.fu { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; min-width: 0; } .fu:hover { border-color: #55554f; } .fu .clip { max-width: 100%; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; } .login .card { width: 100%; max-width: 360px; padding: 26px; }
.steps { display: flex; gap: 6px; margin-bottom: 16px; } .steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); } .steps span.on { background: var(--series-1); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); } .side .sect, .brand { display: none; } .side .who { margin: 0 0 0 auto; border: 0; padding: 0; }
  .main { padding: 16px; } .g2, .g3, .g4, .stage { grid-template-columns: 1fr 1fr; } .fields { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .g2, .g3, .stage { grid-template-columns: 1fr; } }
