:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --row-alt: #f6f8fb;
  --text: #1c2430;
  --muted: #667085;
  --grid: #e3e7ed;
  --sel: #dbe8ff;
  --hit: #fff4c2;
  --accent: #2a6fdb;
  --bad: #d93025;
  --warn: #b26a00;
  --good: #1e8e4e;
}
* { 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", sans-serif; display: flex; flex-direction: column; }
button, select, input[type="search"] { font: inherit; color: inherit; }
button, select { background: var(--panel); border: 1px solid #cdd3dc; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
button:hover:not(:disabled), select:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
.top { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--grid); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; margin-right: 8px; }
.logo { width: 20px; height: 20px; border-radius: 5px; background: var(--accent); display: inline-block; position: relative; }
.logo::after { content: ""; position: absolute; left: 4px; top: 5px; width: 12px; height: 3px; background: #fff; box-shadow: 3px 5px 0 #ffffffcc, 6px 10px 0 -1px #ffffff99; border-radius: 1px; }
.spacer { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); user-select: none; }
.menu { position: relative; }
.menu-body { position: absolute; right: 0; top: 36px; background: var(--panel); border: 1px solid var(--grid); border-radius: 8px; box-shadow: 0 8px 24px #0002; padding: 6px; display: flex; flex-direction: column; z-index: 20; min-width: 240px; }
.menu-body[hidden] { display: none; }
.menu-body button { border: 0; text-align: left; border-radius: 4px; }
.menu-body button:hover { background: var(--sel); }

#app { flex: 1; min-height: 0; padding: 12px 16px 16px; display: flex; flex-direction: column; }
#workspace { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#workspace[hidden], [hidden] { display: none !important; }
.landing { max-width: 760px; margin: 8vh auto; text-align: center; }
.landing h1 { font-size: 30px; margin-bottom: 8px; }
.drop-hint { border: 2px dashed #b4bfd0; border-radius: 12px; padding: 36px; margin: 24px 0 12px; color: var(--muted); background: var(--panel); }
.sample-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; text-align: left; }
.sample-buttons button { display: flex; flex-direction: column; gap: 2px; padding: 12px; }
.sample-buttons span { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.pad { padding: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { background: var(--panel); border: 1px solid var(--grid); border-radius: 8px; padding: 4px 12px; display: flex; flex-direction: column; min-width: 90px; }
.chip span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chip b { font-size: 16px; }
.chip.bad b { color: var(--bad); }
.chip.warn b { color: var(--warn); }
.chip.good b { color: var(--good); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--grid); margin-bottom: 10px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 14px; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.view { flex: 1; min-height: 0; overflow: auto; }
#view-waterfall { display: flex; flex-direction: column; overflow: hidden; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.toolbar input[type="search"] { flex: 1; min-width: 260px; border: 1px solid #cdd3dc; border-radius: 6px; padding: 6px 10px; background: var(--panel); font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.qerr { color: var(--bad); font-size: 12px; }
.minimap { width: 100%; height: 46px; border: 1px solid var(--grid); border-radius: 6px; margin-bottom: 8px; cursor: pointer; background: var(--panel); display: block; }
.split { display: flex; gap: 12px; flex: 1; min-height: 0; }
.wf-wrap { flex: 1; min-width: 0; position: relative; border: 1px solid var(--grid); border-radius: 8px; background: var(--panel); overflow: hidden; }
.wf-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; }
.wf-scroll canvas { position: sticky; top: 0; display: block; }
.wf-spacer { position: relative; min-height: 100%; }
.panel { width: 380px; flex: none; background: var(--panel); border: 1px solid var(--grid); border-radius: 8px; overflow: auto; padding: 4px 14px 14px; }
.tooltip { position: absolute; pointer-events: none; background: #1c2430; color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 12px; z-index: 5; max-width: 320px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

.details h3 { margin: 10px 0 6px; font-size: 15px; word-break: break-word; }
.details h4 { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
a.jump { color: var(--accent); text-decoration: none; }
a.jump:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.wrap { word-break: break-all; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px; border-bottom: 1px solid var(--grid); }
table.data td { padding: 4px 8px; border-bottom: 1px solid #eef0f4; vertical-align: top; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 600; }
.bar { display: inline-block; width: 90px; height: 8px; background: #eef0f4; border-radius: 4px; overflow: hidden; vertical-align: middle; }
.bar i { display: block; height: 100%; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(480px, 1fr)); gap: 12px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--grid); border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card p { margin: 4px 0 8px; }
.findings { padding-left: 18px; margin: 6px 0; }
.findings li { margin-bottom: 8px; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: #e8ecf2; }
.badge.warn { background: #ffe8c2; color: #8a4f00; }
.badge.ok { background: #d9f3e3; color: #166b3a; }
.st-regression { background: #fddcd9; color: #a3170d; }
.st-improvement { background: #d9f3e3; color: #166b3a; }
.st-added { background: #dbe8ff; color: #1b4fa3; }
.st-removed { background: #eceff3; color: #475467; }
.st-changed { background: #ffe8c2; color: #8a4f00; }
.graph { width: 100%; max-height: 560px; background: var(--panel); border: 1px solid var(--grid); border-radius: 8px; margin-bottom: 12px; }
.nlabel { font-size: 12px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.ncount { font-size: 11px; fill: #fff; font-weight: 700; }
.elabel { font-size: 10.5px; fill: var(--muted); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.drop-overlay { position: fixed; inset: 0; background: #2a6fdbcc; color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center; z-index: 50; pointer-events: none; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1c2430; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: 80vw; }

@media (max-width: 900px) {
  .split { flex-direction: column; }
  .panel { width: auto; max-height: 40vh; }
}
