/*
 * A tool for reading differences, styled like an instrument rather than a landing page:
 * hairline rules instead of floating cards, tight radii, monospace for every value,
 * and colour used only where it carries meaning — severity, and what is interactive.
 * No gradients, no drop shadows outside modals.
 */

:root {
  color-scheme: light;
  --bg: #fbfbfc;
  --panel: #ffffff;
  --panel-2: #f4f5f7;
  --line: #e2e4e9;
  --line-strong: #cdd1d9;
  --text: #14171c;
  --muted: #6b7280;
  --accent: #1d4ed8;
  --accent-soft: #eaefff;
  --bad: #c62740;
  --bad-soft: #fdecef;
  --warn: #8a5a00;
  --warn-soft: #fdf3e2;
  --good: #0f7a52;
  --good-soft: #e8f6f0;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --r: 6px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0f13;
  --panel: #14171d;
  --panel-2: #191d25;
  --line: #262c37;
  --line-strong: #39414f;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --accent: #6f9bff;
  --accent-soft: #18213a;
  --bad: #ff5f7a;
  --bad-soft: #2a1219;
  --warn: #ffb020;
  --warn-soft: #2a2011;
  --good: #45d69a;
  --good-soft: #10241c;
}

* { box-sizing: border-box; }
/* A class with display: flex outranks the user-agent [hidden] rule, so hidden
   elements keep showing. Stating it once here beats remembering it per component. */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono, .tabular { font-family: var(--mono); font-variant-numeric: tabular-nums; }
h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 {
  font-size: 11px; margin: 0 0 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
p { margin: 0; }
.muted { color: var(--muted); }

/* ---- shell ------------------------------------------------------------- */
.top {
  display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 30;
}
.brand { font-weight: 700; letter-spacing: -0.04em; font-size: 15px; }
.crumbs { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; min-width: 0; }
.crumbs .sep { opacity: 0.45; }
.crumbs a, .crumbs strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs strong { color: var(--text); font-weight: 550; }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

main { max-width: 1000px; margin: 0 auto; padding: 22px 18px 64px; }

/* ---- controls ---------------------------------------------------------- */
button, .btn {
  appearance: none; font: inherit; cursor: pointer; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  padding: 5px 11px; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--panel-2); text-decoration: none; }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.1); }
button.danger { color: var(--bad); border-color: var(--line-strong); }
button.danger:hover { background: var(--bad-soft); }
button.ghost { background: none; border-color: transparent; color: var(--muted); padding: 4px 7px; }
button.ghost:hover { color: var(--text); background: var(--panel-2); }
button.sm { padding: 3px 8px; font-size: 12px; }
button.icon { padding: 4px 7px; font-size: 13px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 7px 10px; border-radius: var(--r); border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--text); font: inherit; text-transform: none; letter-spacing: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=file] { padding: 5px; font-size: 12px; }
.grid { display: grid; gap: 11px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }

/* ---- surfaces ---------------------------------------------------------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
}
.card + .card { margin-top: 10px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h1, .card-head h2 { margin: 0; }
.card-head .right { margin-left: auto; display: flex; gap: 6px; }

/* Rows read as a list, not as a deck of cards. */
.list { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--panel-2); }
.item .title { font-weight: 550; }
.item .sub { color: var(--muted); font-size: 12px; margin-top: 1px; overflow-wrap: anywhere; font-family: var(--mono); }
.item .right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.pill {
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--muted);
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.pill.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.pill.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.pill.good { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.pill.accent { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.empty {
  padding: 46px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--r);
}
.empty h2 { color: var(--text); font-size: 14px; text-transform: none; letter-spacing: 0; margin-bottom: 6px; }

/* ---- findings ---------------------------------------------------------- */
.finding { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.finding:last-child { border-bottom: 0; }
.finding.ignored { opacity: 0.45; }
.finding-head { display: flex; align-items: center; gap: 8px; }
.sev { width: 6px; height: 6px; border-radius: 1px; background: var(--warn); flex: none; }
.sev.error { background: var(--bad); }
.f-label { font-weight: 600; }
.f-cat { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.f-sel { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.values { display: flex; align-items: center; gap: 7px; margin-top: 6px; font-family: var(--mono); font-size: 12px; flex-wrap: wrap; }
.val { padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel-2); }
.val.exp { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.val.act { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.delta { color: var(--muted); }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px;
  border: 1px solid var(--line-strong); vertical-align: -1px; }
.hint { margin-top: 5px; font-family: var(--mono); font-size: 11.5px; color: var(--accent); }
.triage { margin-left: auto; display: flex; gap: 4px; }

.filters { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--muted);
  border-radius: 4px; padding: 2px 9px; font-size: 11.5px; cursor: pointer;
  font-family: var(--mono); text-transform: lowercase;
}
.chip:hover { background: var(--panel-2); }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---- auth -------------------------------------------------------------- */
.auth { max-width: 340px; margin: 10vh auto; }
.auth .card { padding: 20px; }
.auth h1 { margin-bottom: 4px; }
.auth .lede { color: var(--muted); margin-bottom: 16px; font-size: 12.5px; }
.switch { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ---- misc -------------------------------------------------------------- */
.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 100; max-width: 360px;
  padding: 9px 13px; border-radius: var(--r); border: 1px solid var(--line-strong);
  background: var(--panel); font-size: 12.5px;
}
.toast.bad { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.toast.good { border-color: var(--good); color: var(--good); background: var(--good-soft); }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 44px; text-align: center; color: var(--muted); }

dialog {
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--panel);
  color: var(--text); padding: 0; max-width: 480px; width: calc(100% - 32px);
  box-shadow: 0 16px 44px rgb(0 0 0 / 0.22);
}
dialog::backdrop { background: rgb(0 0 0 / 0.42); }
dialog .body { padding: 16px 18px 18px; }
dialog .actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 16px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 16px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: .06em;
  font-weight: 650; padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .grid.two { grid-template-columns: 1fr; }
  .crumbs { display: none; }
}
