:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #1b1f24;
  --muted: #5d6673;
  --accent: #2456d6;
  --accent-soft: #e6edfc;
  --good: #16833a;
  --good-soft: #e4f4e9;
  --bad: #c8262c;
  --bad-soft: #fbe7e8;
  --warn: #9a6200;
  --warn-soft: #fbf0dc;
  --info: #5b5fc7;
  --info-soft: #ecedfa;
  --diff: #fff1c2;
  --shadow: 0 10px 40px rgba(16, 24, 40, .18);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --surface: #181c21; --surface-2: #20252c; --border: #2d333b;
    --text: #e6e9ee; --muted: #9aa4b1; --accent: #6f98ff; --accent-soft: #1c2a4a;
    --good: #4cc274; --good-soft: #163222; --bad: #ff6b6f; --bad-soft: #3a1a1c;
    --warn: #e6b450; --warn-soft: #3a2e14; --info: #9a9df0; --info-soft: #24264a;
    --diff: #4a3d10; --shadow: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111418; --surface: #181c21; --surface-2: #20252c; --border: #2d333b;
  --text: #e6e9ee; --muted: #9aa4b1; --accent: #6f98ff; --accent-soft: #1c2a4a;
  --good: #4cc274; --good-soft: #163222; --bad: #ff6b6f; --bad-soft: #3a1a1c;
  --warn: #e6b450; --warn-soft: #3a2e14; --info: #9a9df0; --info-soft: #24264a;
  --diff: #4a3d10; --shadow: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

button, .button, select, input {
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; text-decoration: none; cursor: pointer;
}
input { cursor: text; }
button:hover, .button:hover { background: var(--surface-2); }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: var(--accent); filter: brightness(1.08); }
.ghost { background: transparent; }
.danger { color: var(--bad); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface-2); font-size: 12px; }
.field { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.field.block { display: flex; flex-direction: column; align-items: stretch; gap: 4px; color: var(--text); }
.field input[type=number] { width: 70px; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; }
.modes { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 8px; }
.mode { border: 0; background: transparent; padding: 6px 14px; border-radius: 6px; }
.mode.active { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }
.spacer { flex: 1; }

.view { display: flex; min-height: calc(100vh - 53px); }
.suites { width: 290px; flex: none; border-right: 1px solid var(--border); background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.suites-head { display: flex; align-items: center; justify-content: space-between; }
.suite-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.suite-list li { border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: pointer; }
.suite-list li:hover { background: var(--surface-2); }
.suite-list li.active { border-color: var(--accent); background: var(--accent-soft); }
.suite-list .name { font-weight: 600; word-break: break-word; }
.suite-list .stats { display: flex; gap: 10px; font-size: 12px; margin-top: 4px; }
.bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-top: 6px; display: flex; }
.bar span { display: block; height: 100%; }
.hint { font-size: 12px; color: var(--muted); margin: 0; }

.content { flex: 1; min-width: 0; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.content.wide { max-width: none; }
.empty { margin: 80px auto; text-align: center; max-width: 460px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 8px; }
.suite-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile.good .value { color: var(--good); }
.tile.bad .value { color: var(--bad); }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border-radius: 16px; padding: 4px 12px; font-size: 13px; }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: auto; max-height: calc(100vh - 330px); }
.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid th, .grid td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.grid th { position: sticky; top: 0; background: var(--surface-2); font-size: 12px; color: var(--muted); font-weight: 600; cursor: default; z-index: 1; }
.grid th[data-sort] { cursor: pointer; }
.grid th.sorted::after { content: " ▾"; }
.grid th.sorted.asc::after { content: " ▴"; }
.grid .num { text-align: right; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid.compact td, .grid.compact th { padding: 5px 8px; }
.grid.compact tbody tr { cursor: default; }
.icon-col { width: 34px; text-align: center !important; }
.foot { padding: 8px 12px; font-size: 12px; }

.ok, .bad, .info, .warn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 800; font-size: 13px; }
.ok { background: var(--good-soft); color: var(--good); }
.bad { background: var(--bad-soft); color: var(--bad); }
.info { background: var(--info-soft); color: var(--info); }
.warn { background: var(--warn-soft); color: var(--warn); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--surface-2); color: var(--muted); margin-right: 4px; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--info-soft); color: var(--info); }
td.differs { background: var(--diff); }
.pair { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.pair .was { color: var(--muted); font-size: 11px; text-decoration: line-through; }

.fuzz-panels { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; max-height: 260px; overflow: auto; }
.coverage { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.coverage span { background: var(--surface-2); border-radius: 4px; padding: 2px 6px; }

.dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 0; box-shadow: var(--shadow); width: min(640px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(10, 14, 20, .45); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.drop { border: 2px dashed var(--border); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-buttons { display: flex; gap: 8px; margin-top: 6px; }
.file-list { list-style: none; margin: 0; padding: 0; max-height: 140px; overflow: auto; font-size: 12px; font-family: var(--mono); }
.import-result { background: var(--surface-2); border-radius: 8px; padding: 10px; font-size: 13px; max-height: 200px; overflow: auto; }

.slip { width: min(1180px, calc(100vw - 32px)); height: min(90vh, 980px); }
.slip[open] { display: flex; flex-direction: column; }
.slip-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 20px 8px; gap: 12px; }
.slip-title { font-size: 18px; font-weight: 700; }
.slip-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.slip-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 12px; color: var(--muted); }
.slip-tabs button.active { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
.slip-body { flex: 1; overflow: auto; padding: 16px 20px 24px; }
.slip-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.payslip { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.payslip table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.payslip th, .payslip td { padding: 6px 12px; border-bottom: 1px solid var(--border); text-align: right; }
.payslip th:first-child, .payslip td:first-child { text-align: left; }
.payslip thead th { background: var(--surface-2); font-size: 12px; color: var(--muted); }
.payslip .section td { background: var(--surface-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; }
.payslip .total td { font-weight: 700; }
.payslip tr.differs td { background: var(--diff); }
.payslip .delta { color: var(--bad); font-size: 12px; }
.side { display: flex; flex-direction: column; gap: 16px; }
.card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.check { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--border); }
.check:last-child { border-bottom: 0; }
.check .name { font-size: 13px; }
.check .detail { font-size: 12px; color: var(--muted); }
.check button { padding: 2px 8px; font-size: 12px; }
pre.json { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border-radius: 8px; padding: 12px; overflow: auto; margin: 0; white-space: pre; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); z-index: 50; }

.me { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; width: min(380px, 100%); box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 4px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.login-error { color: var(--bad); margin: 0; font-size: 13px; }

@media (max-width: 900px) {
  .view { flex-direction: column; }
  .suites { width: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .slip-grid, .fuzz-panels { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .table-wrap { max-height: none; }
}
