:root {
  --bg: #14161a;
  --panel: #1b1e24;
  --line: #2a2f38;
  --fg: #d8dce3;
  --muted: #858d9c;
  --accent: #6aa9ff;
  --same: #5d6675;
  --diff: #e0a33e;
  --left: #7ec8e3;
  --right: #b78ce0;
  --clash: #e06c6c;
  --verified: #6fbf82;
  --bytes: #ef7a4e;
  --moved: #5fc2b0;
  --row-h: 24px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --cols: 28px minmax(200px, 1fr) 88px 88px 84px 124px 124px;
}

* { box-sizing: border-box; }

/* Author rules beat the UA stylesheet's [hidden]{display:none} regardless of
   specificity, so any `display:` declared below would silently defeat the hidden
   attribute. Keep this ahead of them. */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100%; min-height: 0; }

header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-bottom: 1px solid var(--line); flex: none;
}
header h1 { font-size: 14px; margin: 0; font-weight: 600; letter-spacing: .02em; }
.pairline { font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


button.icon {
  padding: 3px 8px; font-size: 13px; line-height: 1;
  background: transparent; border-color: transparent; color: var(--muted);
}
button.icon:hover { color: var(--fg); background: #262b33; }

.muted { color: var(--muted); }

button {
  font: inherit; color: var(--fg);
  background: #262b33; border: 1px solid var(--line);
  border-radius: 5px; padding: 4px 10px; cursor: pointer; font-size: 12px;
}
button:hover:not(:disabled) { background: #2f353f; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #85b9ff; }
button.wide {
  width: 100%; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Restoring the last pair is an offer, not the primary action — dashed, so it
   reads as a shortcut sitting above Compare rather than competing with it. */
.reopen { border-style: dashed; border-color: #3a4658; color: var(--accent); }

/* ---- two-column body ---- */
.body { flex: 1; display: flex; min-height: 0; }

#sidebar {
  width: 264px; flex: none; overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--panel);
  padding: 12px; display: flex; flex-direction: column; gap: 16px;
}
.group { display: flex; flex-direction: column; gap: 7px; }
.glabel {
  font-size: 10px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 5px;
}
.buttons { display: flex; gap: 7px; }
.buttons button { flex: 1; }

.pane { border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: #1f232a; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pane-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.pane-name {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pane-name.set { color: var(--fg); }
.pane.dropping { border-color: var(--accent); background: #1e2733; }
.pane.dropping .pane-name { color: var(--accent); }

.opt { color: var(--muted); display: flex; align-items: center; gap: 6px; font-size: 12px; }
.opt.col { flex-direction: column; align-items: stretch; gap: 4px; }
.opt input[type=number] { width: 56px; }
.opt input[type=number], .opt input[type=text] {
  background: #262b33; color: var(--fg); border: 1px solid var(--line);
  border-radius: 4px; padding: 4px 7px; font-size: 12px; font-family: var(--mono);
}
.opt input::placeholder { color: #5a6270; }

.progress { font-family: var(--mono); font-size: 11px; line-height: 1.5; word-break: break-word; }
.hint { font-size: 11px; line-height: 1.45; }
.hint strong { color: var(--fg); font-weight: 600; }

/* ---- results column ---- */
.results { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.toolbar {
  flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
}
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px;
  font-family: var(--mono); font-size: 11px; cursor: pointer;
  background: #22262e; color: var(--muted); user-select: none;
}
.chip:hover { border-color: #3d444f; }
.chip .n { color: var(--fg); }
.chip.off { opacity: .38; }
.chip.off .n { color: var(--muted); }
.chip.zero { opacity: .3; }
.shown { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.toolbar input[type=search] {
  flex: 1; min-width: 140px;
  background: #262b33; color: var(--fg); border: 1px solid var(--line);
  border-radius: 4px; padding: 4px 8px; font: inherit; font-size: 12px;
}
.toolbar input[type=search]::placeholder { color: #5a6270; }

.notice, .errors {
  margin: 8px 14px 0; padding: 7px 10px; border-radius: 5px;
  border: 1px solid var(--line); font-size: 12px; flex: none;
}
.notice { border-color: #4a3f22; background: #241f14; color: var(--diff); }
.errors { border-color: #4a2626; background: #241616; color: #e59a9a; max-height: 120px; overflow: auto; font-family: var(--mono); }
.empty { padding: 28px 18px; color: var(--muted); text-align: center; }

/* ---- virtualized list ---- */
.table { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.thead, .row {
  display: grid; grid-template-columns: var(--cols);
  align-items: center; column-gap: 12px; padding: 0 14px;
}
.thead {
  flex: none; height: 28px;
  color: var(--muted); font-size: 11px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--fg); }
.sortable.on { color: var(--accent); }
.sortable.on::after { content: ' ▲'; font-size: 8px; vertical-align: 2px; }
.sortable.on.desc::after { content: ' ▼'; }

.viewport { flex: 1; min-height: 0; overflow: auto; position: relative; }
.spacer { width: 1px; }
.rowlayer { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }

.row {
  height: var(--row-h);
  font-family: var(--mono); font-size: 12px;
  white-space: nowrap;
  border-bottom: 1px solid #1c2027;
}
.row:hover { background: #1b1e24; }

.c-status { text-align: center; }
.c-path { overflow: hidden; text-overflow: ellipsis; }
.c-size, .c-time, .c-delta { text-align: right; color: var(--muted); }
.c-delta { font-variant-numeric: tabular-nums; }
.row .c-delta.up { color: var(--right); }
.row .c-delta.down { color: var(--left); }

.g { display: inline-block; width: 14px; text-align: center; font-weight: 700; }
.g.same { color: var(--same); }
.g.diff { color: var(--diff); }
.g.left { color: var(--left); }
.g.right { color: var(--right); }
.g.clash { color: var(--clash); }
.g.verified { color: var(--verified); }
.g.bytes { color: var(--bytes); }
.g.moved { color: var(--moved); }

.row.s0 .c-path { color: var(--same); }
.row.s1 .c-path { color: var(--diff); }
.row.s2 .c-path { color: var(--left); }
.row.s3 .c-path { color: var(--right); }
.row.s4 .c-path { color: var(--clash); }
.row.s5 .c-path { color: var(--verified); }
.row.s6 .c-path { color: var(--bytes); }
.row.s7 .c-path { color: var(--moved); }
.row .dim { color: #454c56; }
.row.mt .c-time { color: var(--diff); }

/* ---- blocked screen ---- */
#unsupported { display: grid; place-items: center; height: 100%; padding: 20px; overflow: auto; }
.card { max-width: 560px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 24px 28px; }
.card h1 { margin-top: 0; font-size: 18px; }
.card p { margin: 10px 0; }
.card a { color: var(--accent); }
pre { background: #0f1114; border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; overflow-x: auto; font-family: var(--mono); font-size: 12px; }
code { font-family: var(--mono); background: #0f1114; padding: 1px 4px; border-radius: 3px; }
.diag { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; font-family: var(--mono); font-size: 11px; width: 100%; }
.diag th { text-align: left; font-weight: 400; color: var(--muted); padding: 2px 12px 2px 0; white-space: nowrap; vertical-align: top; }
.diag td { padding: 2px 0; word-break: break-all; }

.hint { padding: 0 18px 8px; font-size: 11.5px; line-height: 1.45; max-width: 90ch; }
.hint strong { color: var(--fg); font-weight: 600; }

/* ---- diff viewer ---- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 10, 13, .72);
  display: flex; align-items: center; justify-content: center; padding: 28px;
}
.modal-card {
  width: 100%; height: 100%; max-width: 1500px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
}
.modal-head {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
}
.dtitle { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dstats { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.dstats .ins { color: var(--verified); }
.dstats .del { color: var(--bytes); }
.dstats .chg { color: var(--diff); }
.dspacer { flex: 1; }

.dmessage { padding: 30px; display: flex; align-items: center; justify-content: center; }
.dnote { max-width: 60ch; text-align: center; color: var(--muted); line-height: 1.6; }
.dnote p { margin: 0 0 12px; }

.dtable { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dviewport { overflow: auto; }

.drow {
  display: grid; height: 20px; align-items: center;
  font-family: var(--mono); font-size: 11.5px; white-space: pre;
}
.rowlayer.split .drow { grid-template-columns: 52px minmax(0, 1fr) 52px minmax(0, 1fr); }
.rowlayer.unified .drow { grid-template-columns: 46px 46px 16px minmax(0, 1fr); }

.dln {
  color: #4d5563; text-align: right; padding-right: 9px;
  border-right: 1px solid var(--line); user-select: none;
}
.dsign { text-align: center; color: var(--muted); user-select: none; }
/* Every row is its own grid, so content-based column sizing would make the
   columns disagree from row to row. Fixed columns + clipping keeps them aligned;
   the full line is on the cell's title. */
.dtext { padding: 0 10px; overflow: hidden; text-overflow: ellipsis; }

.drow.eq .dtext { color: var(--fg); }
.drow.del .dl { background: #2c1a18; color: #f0a08c; }
.drow.ins .dr { background: #16281c; color: #9adcae; }
.drow.chg .dl, .drow.chg .dr { background: #2a2317; color: #e8c98a; }
/* the empty half of a one-sided row, so a gap reads as a gap */
.drow.del .dr, .drow.ins .dl { background: #171a1f; }
.rowlayer.unified .drow.del .dtext { background: #2c1a18; color: #f0a08c; }
.rowlayer.unified .drow.ins .dtext { background: #16281c; color: #9adcae; }

.row.clickable { cursor: pointer; }
.row.clickable:hover .c-path { text-decoration: underline; }

.row.dirrow .c-path { font-weight: 600; }
.row.dirrow .c-size { font-size: 11px; }
