/* Compare Sheets. Tokens from /shared/ui/brand.css. */

.app-title { font-size: var(--step-3); margin-bottom: 0.25em; }
.app-brand .wordmark { font-size: 1.25rem; }
.intro { color: var(--muted); margin-bottom: 24px; }

.slots { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.slot { min-height: 190px; align-content: center; }
.slot h2 { font-size: var(--step-1); }
.slot-file { overflow-wrap: anywhere; }
.slot[data-loaded] { border-style: solid; border-color: var(--primary); }
.slot[data-loaded] .slot-file { color: var(--fg); font-weight: 600; }
.slot[data-error] { border-color: var(--danger); }
.slot[data-error] .slot-file { color: var(--danger); }
.slot-arrow { display: grid; place-items: center; color: var(--muted); }

.options { margin: 20px 0 8px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.options summary { cursor: pointer; padding: 14px 16px; font-weight: 700; }
.options-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; padding: 4px 16px 18px; }
.options fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.options legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.key-field, .tol-field { margin-top: 4px; }
.tol-field input { width: 10ch; }
.pair-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.pair-row select { width: 100%; }

.go-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.go-row .status { flex-basis: 100%; }

/* Results */
.results-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.results-head h2 { font-size: var(--step-3); margin: 0 0 4px; }
.results-head h2:focus { outline: none; }
.results-head p { margin: 0; }
.export { display: flex; gap: 8px; flex-wrap: wrap; }
.pro-mark { font-size: 0.75em; font-weight: 800; background: var(--highlight); color: var(--highlight-ink); padding: 1px 6px; border-radius: 3px; margin-left: 4px; }

.sheet-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin: 16px 0 0; }
.sheet-tab { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px;
  padding: 10px 14px; color: var(--muted); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.sheet-tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--primary); }
.sheet-tab .count { font-size: 0.8rem; min-width: 1.6em; padding: 1px 7px; border-radius: 999px; background: var(--highlight); color: var(--highlight-ink); font-weight: 800; }
.sheet-tab .count[data-zero] { background: var(--line); color: var(--muted); }

.sheet-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 0; align-items: center; }
.sheet-summary .item { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgb(0 0 0 / 0.15); flex: none; }
.sw-changed { background: var(--cell-changed); }
.sw-added { background: var(--row-added); }
.sw-removed { background: var(--row-removed); }
.sw-moved { background: var(--row-moved); }
.sheet-summary .spacer { flex: 1; }
.notice { padding: 10px 14px; border-left: 4px solid var(--highlight); background: var(--surface); margin: 0 0 12px; }

:root {
  --row-added: #CFF3E8;
  --row-removed: #FBD3D8;
  --row-moved: #E7E1FB;
  --cell-changed: #FFE58F;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --row-added: #123B33; --row-removed: #4A1C2A; --row-moved: #2E2650; }
}
:root[data-theme="dark"] { --row-added: #123B33; --row-removed: #4A1C2A; --row-moved: #2E2650; }

/* position: relative makes the wrap the containing block for the visually hidden labels in cells,
   so they scroll with the table instead of widening the page on phones. */
.grid-wrap { position: relative; overflow: auto; max-height: min(70vh, 900px); border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; max-width: none; font-size: 0.92rem; }
.grid th, .grid td { padding: 6px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap;
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; vertical-align: top; text-align: left; }
.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); color: var(--fg); font-weight: 700; font-size: 0.85rem; }
.grid thead th .col-letter { display: block; color: var(--muted); font-weight: 600; font-size: 0.75rem; }
.grid .g-mark, .grid .g-row { position: sticky; left: 0; z-index: 1; background: var(--surface); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.grid .g-mark { width: 2.2em; text-align: center; font-weight: 800; }
.grid .g-row { left: 2.2em; min-width: 4.5em; }
.grid thead .g-mark, .grid thead .g-row { z-index: 3; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid tr.added td { background: var(--row-added); }
.grid tr.removed td { background: var(--row-removed); }
.grid tr.removed td:not(.g-mark):not(.g-row) { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 70%, transparent); }
.grid tr.moved td { background: var(--row-moved); }
.grid td.changed { background: var(--cell-changed); color: var(--highlight-ink); white-space: normal; min-width: 8em; }
.grid td.changed .old { color: color-mix(in srgb, var(--highlight-ink) 62%, transparent); }
.grid td.changed .fx { color: color-mix(in srgb, var(--highlight-ink) 75%, transparent); }
.grid td.col-added { background: var(--row-added); }
.grid td.col-removed { background: var(--row-removed); }
.grid .old { display: block; color: var(--muted); text-decoration: line-through; }
.grid .new { display: block; font-weight: 700; }
.grid .fx { display: block; font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; color: var(--muted); }
.grid tr.gap td { background: var(--bg); color: var(--muted); font-style: italic; text-align: left; position: static; }
.grid tr.gap button { font: inherit; background: none; border: 0; color: var(--primary); text-decoration: underline; cursor: pointer; padding: 0 4px; }
.more-row { padding: 12px 0; }

.empty-state { padding: 40px 20px; text-align: center; }
.empty-state h3 { font-size: var(--step-2); }

@media (max-width: 760px) {
  .slots { grid-template-columns: 1fr; }
  .slot-arrow { transform: rotate(90deg); }
  .results-head h2 { font-size: var(--step-2); }
}
