@font-face{font-family:'IBM Plex Sans';font-weight:400;font-style:normal;font-display:swap;src:url('./ibm-plex-sans-latin-400-normal.woff2') format('woff2')}
@font-face{font-family:'IBM Plex Sans';font-weight:500;font-style:normal;font-display:swap;src:url('./ibm-plex-sans-latin-500-normal.woff2') format('woff2')}
@font-face{font-family:'IBM Plex Sans';font-weight:600;font-style:normal;font-display:swap;src:url('./ibm-plex-sans-latin-600-normal.woff2') format('woff2')}
/* Local IBM Plex Sans and the reference's ink and pastel pigments on light paper. */
:root {
  --stock: #D1D3D2;
  --stock-deep: #C9CBCB;
  --ink: #2C2D30;
  --ink-soft: #343538;
  --mint: #A2C8BF;
  --sage: #B2CEBE;
  --forest: #587869;
  --olive: #7C8B68;
  --sand: #EADCB5;
  --ochre: #DEC085;
  --rose: #D89D8A;
  --terra: #D68C76;
  --blue: #A5BAC4;
  --brown: #7D6B5E;
  --paper: #D1D3D2;
  --paper-deep: #C9CBCB;
  --surface: color-mix(in srgb, var(--paper) 72%, white);
  --surface-deep: color-mix(in srgb, var(--paper-deep) 58%, var(--surface));
  --field-surface: color-mix(in srgb, var(--blue) 24%, var(--surface));
  --canvas: var(--surface);
  --muted: color-mix(in srgb, var(--ink-soft) 79%, var(--paper));
  --shadow-dark: rgba(44, 45, 48, .10);
  --shadow-dark-strong: rgba(44, 45, 48, .2);
  --shadow-light: rgba(255, 255, 255, .30);
  --shadow-light-strong: rgba(255, 255, 255, .5);
  --line: rgba(44, 45, 48, .22);
  --line-soft: rgba(44, 45, 48, .11);
  --control-edge: var(--paper-deep);
  --control-radius: 6px;
  --action-radius: 9999px;
  --control-face: var(--surface);
  --card-radius: 16px;
  --card-edge: rgba(255, 255, 255, .2);
  --card-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
  --card-transition: all .3s ease;
  --raised: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  --recessed: inset 3px 3px 6px rgba(44, 45, 48, .05), inset -2px -2px 4px rgba(201, 203, 203, .2);
  --ring: inset 4px 4px 8px rgba(44, 45, 48, .07), inset -4px -4px 8px rgba(255, 255, 255, .28);
  --selector-tray: inset 2px 2px 5px rgba(44, 45, 48, .08), inset -2px -2px 5px rgba(255, 255, 255, .3);
  --selector-active: 2px 2px 5px var(--shadow-dark), -2px -2px 5px var(--shadow-light);
  --solid-relief: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
  --dialog-radius: var(--card-radius);
  --font: "IBM Plex Sans", sans-serif;
  color-scheme: light;
}
body[data-border="papel"] {
  --card-radius: 12px;
  --card-edge: var(--paper-deep);
  --card-shadow: 6px 6px 14px rgba(44, 45, 48, .08), -4px -4px 10px rgba(201, 203, 203, .4);
  --card-transition: transform .2s ease, box-shadow .2s ease, border-radius .3s ease, border-color .3s ease;
  --selector-active: 1px 1px 3px rgba(44, 45, 48, .08);
}
body[data-border="papel"] :is(.setup-panel[open], .dialog, .border-switcher):hover {
  transform: translateY(-2px);
  box-shadow: 8px 8px 20px rgba(44, 45, 48, .1), -6px -6px 12px rgba(201, 203, 203, .5);
}
* { box-sizing: border-box; }
html { height: 100%; background: var(--paper); }
body {
  margin: 0; height: 100vh; height: 100dvh; overflow: hidden;
  background: linear-gradient(135deg, #DFE1E0 0%, var(--paper) 50%, var(--paper-deep) 100%);
  background-attachment: fixed;
  color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, label, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
button, input, select, textarea { outline: none; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; }
button:disabled { opacity: .43; box-shadow: none; }
button:focus-visible, summary:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 1px solid var(--ink-soft);
  outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
input:is([type="checkbox"], [type="range"]):focus-visible { outline: 1px solid var(--ink-soft); outline-offset: 2px; }
button, label, input, select, summary { touch-action: manipulation; }
::selection { background: var(--ink-soft); color: var(--surface); }
svg { display: block; flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
h2, h3 { font-size: 16px; font-weight: 600; letter-spacing: -.25px; }
fieldset { margin: 0; padding: 0; min-width: 0; border: 0; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -60px; left: 20px; z-index: 100;
  padding: 10px 16px; border-radius: 6px; background: var(--ink); color: var(--surface);
}
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.full-width { width: 100%; }

/* One working surface. File controls, status and the grid share a common edge. */
.app-main {
  --gutter: clamp(12px, 1.45vw, 28px);
  display: flex; flex-direction: column; gap: 0; width: 100%; height: 100%; min-height: 0;
  margin: 0 auto; padding: 0 var(--gutter);
}
.setup-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  min-height: 48px; padding: 8px 112px 8px 0; list-style: none;
}
.setup-summary::-webkit-details-marker, .options-panel summary::-webkit-details-marker { display: none; }
.section-heading { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 16px; font-weight: 600; }
.setup-summary-end { display: flex; align-items: center; gap: 16px; min-width: 0; font-size: 12px; font-weight: 400; }
.setup-summary-end > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: min(65vw, 660px); }
.chevron { width: 18px; height: 18px; color: var(--ink-soft); transition: transform .16s ease; }
.setup-panel[open] > .setup-summary .chevron, .options-panel[open] > summary .chevron { transform: rotate(180deg); }
.setup-panel:not([open]) .setup-summary { justify-content: flex-start; }
.setup-panel:not([open]) .setup-summary-end { flex: 1; }
.setup-panel:not([open]) .setup-summary-end .chevron { margin-left: auto; }
.setup-panel:not([open]) .setup-summary-end > span { max-width: none; }
.setup-panel[open] > .setup-summary { border-bottom: 1px solid var(--line-soft); }
.setup-panel[open] {
  padding-inline: clamp(10px, 1.6vw, 20px); border: 1px solid var(--card-edge); border-radius: var(--card-radius);
  background: var(--surface); box-shadow: var(--card-shadow); transition: var(--card-transition);
}
.setup-content { padding: 11px 0 15px; }
.mode-row { display: flex; align-items: center; gap: 14px; margin-bottom: 15px; }
.segmented {
  display: inline-flex; align-items: center; gap: 3px; padding: 3px;
  border: 1px solid var(--surface-deep); border-radius: var(--action-radius);
  background: var(--surface); box-shadow: var(--selector-tray);
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; }
.segmented label > span {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 5px 11px; border: 1px solid transparent; border-radius: var(--action-radius);
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.segmented svg { width: 15px; height: 15px; }
.segmented input:checked + span { color: var(--ink); background: var(--surface); box-shadow: var(--selector-active); font-weight: 600; }
body[data-border="papel"] .segmented input:checked + span { border-color: var(--surface-deep); }
.segmented input:focus-visible + span { border-color: var(--ink-soft); outline: none; }
.segmented input:disabled + span { opacity: .5; cursor: not-allowed; }
.mode-hint { font-size: 12px; color: var(--muted); }
.files-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.files-grid.single-file { grid-template-columns: minmax(0, 1fr); }
.file-card {
  display: flex; align-items: center; gap: 14px; min-width: 0; min-height: 96px;
  padding: 16px 18px; border: 1px dashed var(--control-edge); border-radius: var(--control-radius);
  transition: border-color .16s ease, background .16s ease;
}
.file-card:not(.has-file):not(:has(input:disabled)) { cursor: pointer; }
.file-card.has-file {
  min-height: 70px; padding-inline: 14px; border: 1px solid var(--line-soft);
  background: var(--surface); box-shadow: var(--recessed);
}
.file-card[data-slot="1"] .file-icon { background: color-mix(in srgb, var(--mint) 50%, var(--surface)); }
.file-card[data-slot="2"] .file-icon { background: color-mix(in srgb, var(--sand) 58%, var(--surface)); }
.file-card[data-slot="1"] .file-slot { color: var(--forest); }
.file-card[data-slot="2"] .file-slot { color: var(--brown); }
.file-card.dragover { background: color-mix(in srgb, var(--mint) 32%, var(--surface)); border-color: var(--forest); }
.file-icon {
  display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px;
  border: 2px solid var(--surface); border-radius: 50%; background: var(--control-face);
  box-shadow: var(--ring); color: var(--ink-soft);
}
.file-icon svg { width: 21px; height: 21px; }
.file-description { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.file-slot { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .035em; }
.single-file .file-slot { display: none; }
.file-description strong { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card:not(.has-file) .file-description strong { white-space: normal; }
.file-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-picker { flex-shrink: 0; cursor: pointer; }
.file-picker.button { background: var(--ink); color: var(--surface); padding-inline: 18px; border-color: var(--ink); box-shadow: var(--solid-relief); }
.file-picker.button:hover:not(:has(input:disabled)) { background: var(--ink-soft); color: var(--surface); }
.file-card.has-file .file-picker { background: var(--control-face); color: var(--ink); border-color: var(--control-edge); box-shadow: var(--raised); }
.file-picker:focus-within { border-color: var(--ink-soft); outline: none; }
.file-picker:has(input:disabled) { cursor: not-allowed; opacity: .43; box-shadow: none; }
.file-remove { flex-shrink: 0; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 34px; padding: 6px 12px; border: 1px solid transparent; border-radius: var(--control-radius);
  font-size: 13px; font-weight: 500; line-height: 1.4; text-decoration: none; white-space: nowrap;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.button svg, .icon-button svg { width: 17px; height: 17px; }
.button-primary, .button-secondary { border-radius: var(--action-radius); }
.button-primary { background: var(--ink); color: var(--surface); border-color: var(--ink); box-shadow: var(--solid-relief); }
.button-primary:hover:enabled { background: var(--ink-soft); transform: translateY(-1px); }
.button-primary:active:enabled { transform: translateY(1px); box-shadow: 2px 2px 5px var(--shadow-dark), -2px -2px 5px var(--shadow-light); }
.button-secondary { background: var(--surface); color: var(--ink); border-color: transparent; box-shadow: var(--raised); }
.button-secondary:hover:enabled { color: var(--forest); }
.button-secondary:active:enabled { color: var(--ink); box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light); }
.button-quiet { background: transparent; color: var(--ink-soft); }
.button-quiet:hover:enabled { background: rgba(44, 45, 48, .06); }
.button-small { min-height: 30px; padding: 5px 12px; font-size: 12px; }
.icon-button, .btn.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 31px; height: 31px; padding: 0; border: 2px solid var(--surface); border-radius: 50%;
  background: var(--control-face); box-shadow: var(--ring); color: var(--ink-soft); font-size: 22px; font-weight: 400; line-height: 1;
}
.icon-button:hover:enabled, .btn.icon-btn:hover:enabled { color: var(--ink); background: var(--surface-deep); }

.action-group { display: flex; align-items: center; gap: 8px; }
.setup-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; }
.local-note { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.local-note svg { width: 15px; height: 15px; }
.local-note svg { color: var(--forest); }
.segmented label:has(#modeExplore) svg { color: var(--forest); }
.segmented label:has(#modeCompare) svg { color: var(--brown); }
#reset:disabled { display: none; }
.comparison-setup { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.field-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.field-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.key-pairs { display: flex; flex-direction: column; gap: 12px; }
.key-pair { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 34px; align-items: end; gap: 10px; max-width: none; }
.key-pair:has(.key-field) { --key-select-offset: 22px; align-items: start; }
.key-pair:has(.key-field) > :is(span, .remove-key) { align-self: start; margin-top: var(--key-select-offset); }
.key-pair:has(.key-field) > span { height: 34px; min-height: 34px; }
.key-pair > label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 11px; }
.key-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--ink-soft); font-size: 11px; }
.key-field > span { min-height: 16px; line-height: 16px; }
.key-field:has(select[data-side="left"]) { --key-accent: var(--mint); }
.key-field:has(select[data-side="right"]) { --key-accent: var(--ochre); }
.key-field > span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--key-accent); vertical-align: 1px; }
.key-field-controls { display: grid; grid-template-columns: minmax(95px, .8fr) minmax(0, 1.4fr); gap: 6px; min-width: 0; }
.key-field-controls > :is(input, select) { width: 100%; min-width: 0; min-height: 34px; }
.key-field-search { padding-inline: 8px; font-size: 12px; }
.key-search-status { color: var(--brown); font-size: 11px; line-height: 1.4; }
.key-pair > span { display: flex; align-items: center; justify-content: center; min-height: 38px; color: var(--muted); }
.key-pair select { width: 100%; }
.key-diagnostics { margin-top: 12px; font-size: 12px; color: var(--muted); }
.options-panel { margin-top: 12px; border-top: 1px solid var(--line-soft); }
.options-panel > summary { display: flex; align-items: center; gap: 12px; padding: 10px 0 0; list-style: none; font-size: 13px; font-weight: 500; }
.options-panel > summary .chevron { margin-left: auto; }
.options-summary { color: var(--muted); font-size: 12px; font-weight: 400; }
.options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding-top: 15px; }
.options-grid fieldset { display: flex; flex-direction: column; gap: 10px; }
.options-grid legend { margin-bottom: 12px; font-size: 12px; font-weight: 600; }
.checkbox-label, .detail-toggle { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; color: var(--ink-soft); cursor: pointer; }
input[type="checkbox"] {
  appearance: none; position: relative; flex-shrink: 0;
  width: 15px; height: 15px; min-height: 0; padding: 0; margin: 2px 0 0;
  border: 1px solid rgba(44, 45, 48, .50); border-radius: 3px;
  background: var(--surface); cursor: pointer;
}
input[type="checkbox"]:checked { background: var(--ink); border-color: var(--ink); }
input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border-right: 2px solid var(--surface); border-bottom: 2px solid var(--surface); transform: rotate(45deg);
}
input[type="checkbox"]:disabled { opacity: .43; cursor: not-allowed; }
.tolerance-field { display: flex; align-items: center; gap: 12px; font-size: 12px; }
.tolerance-field input { width: 100px; min-height: 32px; padding: 5px 9px; }
.field-help { font-size: 11px; line-height: 1.6; color: var(--muted); }

/* Compact status and analysis controls. Color carries meaning only. */
.analysis-status { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 3px 14px; }
.analysis-status:has(#progressArea[hidden]):has(#notice[hidden]), .analysis-note:has(#notice[hidden]) { display: none; }
.analysis-note { max-width: 100%; margin-left: auto; }
.analysis-note > summary { display: flex; align-items: center; gap: 4px; list-style: none; font-size: 12px; font-weight: 500; padding: 3px 0; }
.analysis-note > summary::-webkit-details-marker { display: none; }
.analysis-note[open] { flex-basis: 100%; }
.analysis-note[open] .chevron { transform: rotate(180deg); }
.analysis-note .chevron { width: 14px; height: 14px; }
.progress-area { display: flex; flex: 1 1 auto; align-items: center; min-width: 0; gap: 12px; padding: 5px 0; }
.progress-copy { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; min-width: 0; }
.progress-copy strong, #progressDetail { font-size: 12px; font-weight: 400; }
#progressDetail, .elapsed { color: var(--muted); }
.elapsed { min-width: 13ch; text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-dot { align-self: center; width: 6px; height: 6px; background: var(--forest); border-radius: 50%; }
.progress-area:has(#cancel[hidden]) progress { display: none; }
.progress-area progress {
  appearance: none; width: min(200px, 30%); height: 6px; overflow: hidden; border: 0;
  border-radius: 4px; background: var(--surface-deep); accent-color: var(--forest);
}
.progress-area progress::-webkit-progress-bar { background: var(--surface-deep); }
.progress-area progress::-webkit-progress-value { background: var(--forest); }
.progress-area progress::-moz-progress-bar { background: var(--forest); }
.progress-area:has(#cancel:not([hidden])) {
  display: grid; flex-basis: 100%; grid-template-columns: minmax(0, 1fr) auto;
  min-height: 93px; gap: 8px 16px; padding: 13px 0 15px; border-block: 1px solid var(--line-soft);
}
.progress-area:has(#cancel:not([hidden])) .progress-copy {
  display: grid; grid-column: 1; grid-row: 1; grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline; gap: 2px 8px;
}
.progress-area:has(#cancel:not([hidden])) .status-dot { display: none; }
.progress-area:has(#cancel:not([hidden])) #progressText { grid-column: 1; font-size: 14px; font-weight: 600; }
.progress-area:has(#cancel:not([hidden])) #progressDetail { grid-column: 1 / -1; grid-row: 2; min-height: 18px; }
.progress-area:has(#cancel:not([hidden])) .elapsed { grid-column: 2; grid-row: 1; font-size: 12px; }
.progress-area:has(#cancel:not([hidden])) progress { width: 100%; grid-column: 1; grid-row: 2; }
.progress-area #cancel { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.progress-area.is-busy progress:not([value]) {
  background: linear-gradient(var(--forest), var(--forest)) left center / 20% 100% no-repeat var(--surface-deep);
  animation: progress-pending 1.6s ease-in-out infinite alternate;
}
.progress-area.is-busy progress:not([value])::-webkit-progress-bar { background: transparent; }
.progress-area.is-busy progress:not([value])::-moz-progress-bar { background: transparent; }
@keyframes progress-pending { to { background-position: right center; } }
.progress-area.is-error { padding-inline: 8px; border-radius: var(--control-radius); background: color-mix(in srgb, var(--rose) 18%, var(--surface)); }
.progress-area.is-error .status-dot { background: var(--terra); }
.notice { margin-top: 3px; padding: 7px 10px; border: 1px solid var(--line-soft); border-radius: 6px; background: color-mix(in srgb, var(--sage) 18%, var(--surface)); color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.stats-grid { display: flex; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid var(--line-soft); }
.stat-card {
  display: inline-flex; flex: 0 0 auto; align-items: baseline; gap: 7px;
  padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink);
  text-align: left;
}
.stat-card:first-child { padding-left: 0; }

.stat-card > span { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.stat-card > span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-soft); }
.stat-card.equal > span::before { background: var(--forest); }
.stat-card.changed > span::before { background: var(--terra); }
.stat-card.base1 > span::before { background: var(--forest); }
.stat-card.base2 > span::before { background: var(--ochre); box-shadow: 0 0 0 1px rgba(44, 45, 48, .16); }
.stat-card[data-filter="NO_KEY"] > span::before { background: var(--ochre); box-shadow: 0 0 0 1px rgba(44, 45, 48, .16); }
.stat-card[data-filter="DUPLICATE"] > span::before { background: var(--terra); }
.stat-card strong { font-size: 14px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-card:hover { background: rgba(44, 45, 48, .035); }
.stat-card.active { border-bottom-color: var(--forest); }
.stat-card.changed.active { border-bottom-color: var(--terra); }
.stat-card.base2.active { border-bottom-color: var(--ochre); }
.stat-card[data-filter="NO_KEY"].active { border-bottom-color: var(--ochre); }
.stat-card[data-filter="DUPLICATE"].active { border-bottom-color: var(--terra); }
.stat-card:focus-visible { outline-offset: -4px; }

/* Table boundaries remain quiet; differences and fixed keys remain readable. */
.results-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.results-controls { flex: none; max-height: 42%; overflow: auto; }
.workspace-controls {
  flex: 0 1 auto; max-height: 43%; min-height: 0; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.workspace-controls > * { flex-shrink: 0; }
.setup-shell { position: relative; border-bottom: 1px solid var(--line-soft); }
.appearance-menu {
  position: fixed; top: 9px; right: var(--gutter); z-index: 10;
  color: var(--ink-soft); font-size: 12px;
}
.appearance-menu > summary {
  display: flex; align-items: center; gap: 6px; width: max-content; margin-left: auto; padding: 6px 8px;
  list-style: none; border: 1px solid var(--surface-deep); border-radius: 9999px; background: var(--surface); box-shadow: var(--selector-tray);
}
.appearance-menu > summary::-webkit-details-marker { display: none; }
.appearance-menu > summary:hover, .appearance-menu[open] > summary { border-color: var(--line); }
.appearance-menu > summary svg { width: 15px; height: 15px; }
.border-switcher {
  position: absolute; top: calc(100% + 5px); right: 0; display: grid; gap: 2px;
  width: 158px; padding: 25px 4px 4px; border: 1px solid var(--card-edge);
  border-radius: var(--card-radius); background: var(--surface); box-shadow: var(--card-shadow); transition: var(--card-transition);
}
.border-switcher legend { position: absolute; top: 7px; left: 11px; font-size: 11px; color: var(--muted); }
.border-switcher label {
  display: flex; align-items: center; gap: 8px; padding: 6px 7px; border-radius: var(--control-radius);
  color: var(--ink-soft); line-height: 1.4; font-weight: 500; cursor: pointer;
}
.border-switcher label:hover, .border-switcher input:focus-visible + label { background: var(--surface-deep); }
.border-switcher input:checked + label::after {
  content: ""; width: 5px; height: 9px; margin-left: auto; margin-right: 4px;
  border-right: 1.5px solid var(--forest); border-bottom: 1.5px solid var(--forest); transform: rotate(45deg);
}
.border-switcher input:focus-visible + label { outline: 1px solid var(--ink-soft); outline-offset: -1px; }
.border-sample { width: 15px; height: 12px; border: 1px solid var(--control-edge); }
.sample-soft { border-radius: 5px; border-color: rgba(255,255,255,.2); background: var(--surface); box-shadow: var(--selector-active); }
.sample-paper { border-radius: 3px; border-color: var(--surface-deep); background: var(--surface); box-shadow: 1px 1px 3px rgba(44,45,48,.08); }

.app-main:has(#grid[hidden]) .workspace-controls { max-height: 100%; }
.results-panel:has(#grid[hidden]) { flex: none; }
.results-panel:has(#grid[hidden]) .results-controls { max-height: none; }
.results-panel:has(#grid[hidden]) :is(.table-toolbar, .table-footer, .grid-clip, .grid-wrap) { display: none; }
.app-main:not(:has(.has-file)) .results-panel:has(#grid[hidden]) { display: none; }
.results-panel:has(#grid[hidden]) .result-count { display: none; }
.results-panel:has(#grid[hidden]) .results-heading { border-top: 1px solid var(--line-soft); }
.results-panel:has(#grid[hidden]) #exportBtn, .results-panel:has(#grid[hidden]) .tool-divider { display: none; }
.app-main:has(#grid[hidden]):has(#setupPanel[open]) { max-width: 980px; padding-top: clamp(18px, 8vh, 90px); }
.app-main:has(#grid[hidden]):has(#compareSetup[hidden]) { max-width: 792px; padding-top: clamp(48px, 17vh, 160px); }
.app-main:has(#grid[hidden]) .setup-shell { border-bottom: 0; }
.app-main:has(#grid[hidden]) .setup-summary-end > .muted { display: none; }
.app-main:has(#grid[hidden]):has(#compareSetup[hidden]):not(:has(.has-file)) {
  max-width: 792px; padding-top: clamp(52px, 21vh, 190px);
}
.app-main:has(#grid[hidden]):has(#compareSetup[hidden]):not(:has(.has-file)) .setup-summary-end .muted { display: none; }
.app-main:has(#grid[hidden]):has(#compareSetup[hidden]):not(:has(.has-file)) .setup-summary .section-heading { font-size: 24px; letter-spacing: -.65px; }
.app-main:has(#grid[hidden]):has(#compareSetup[hidden]):not(:has(.has-file)) .setup-summary { padding: 12px 0; }
#stats:has(.stat-card:only-child) { display: none; }
.results-heading, .table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-inline: 0; }
.results-heading { flex-wrap: wrap; padding-block: 14px 7px; }
.results-heading h2 { font-size: 17px; }
.result-count { font-size: 12px; font-weight: 400; color: var(--muted); }
.result-tools { display: flex; align-items: center; gap: 6px; }
#qualityBtn::before, #schemaBtn::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; }
#qualityBtn::before { background: var(--forest); }
#schemaBtn::before { background: var(--blue); box-shadow: 0 0 0 1px rgba(44,45,48,.16); }
#exportBtn svg { color: var(--brown); }
#columnsBtn svg { color: var(--forest); }
.tool-divider { width: 1px; height: 17px; background: var(--line); margin: 0 6px; }
.table-toolbar { padding-block: 1px 10px; }
.search-group, .filter-group { display: flex; align-items: center; gap: 9px; min-width: 0; }
.search-group { flex: 1; }

input, select, textarea {
  min-height: 34px; padding: 6px 10px; border: 1px solid var(--control-edge); border-radius: var(--control-radius);
  background: var(--surface); color: var(--ink); font-size: 13px; box-shadow: var(--recessed);
}
input::placeholder, textarea::placeholder { color: var(--ink-soft); opacity: .7; }
input:focus, select:focus, textarea:focus { border-color: var(--ink-soft); outline: none; }
input:disabled, select:disabled { color: rgba(52, 53, 56, .53); background: var(--surface-deep); border-color: var(--line-soft); box-shadow: none; }
input:disabled::placeholder { color: rgba(52, 53, 56, .53); }
select { max-width: 100%; padding-right: 28px; }
.search-field { background: var(--surface); display: flex; align-items: center; flex: 1; gap: 7px; max-width: 390px; min-width: 150px; padding: 0 10px; border: 1px solid var(--control-edge); border-radius: var(--control-radius); box-shadow: var(--recessed); }
.search-field svg { width: 17px; height: 17px; color: var(--ink-soft); }
.search-field input { width: 100%; min-width: 0; padding: 5px 0; border: 0; background: transparent; box-shadow: none; }
.search-field:focus-within { border-color: var(--ink-soft); outline: none; }
.search-field input:focus-visible { outline: none; }
.search-field:has(input:disabled) { background: var(--surface-deep); border-color: var(--line-soft); box-shadow: none; }
#searchColumn { max-width: 190px; }
#filter { max-width: 195px; }
.app-main:has(#modeExplore:checked) #filter { display: none; }
/* Horizontal scrolling is driven by the visible rail. overflow-x:hidden keeps
   scrollLeft available without a second native bar (including Chrome/Windows). */
.grid-clip { display: flex; flex: 1; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.grid-wrap {
  overflow-x: hidden; overflow-y: auto; flex: 1; min-height: 0; min-width: 0; position: relative;
  background: var(--surface); border-top: 1px solid var(--card-edge);
  border-radius: var(--card-radius) var(--card-radius) 0 0;
  scrollbar-color: rgba(44, 45, 48, .42) var(--surface-deep);
}
.grid-wrap, .column-navigation, .table-footer { border-inline: 1px solid var(--card-edge); }
.grid-wrap::-webkit-scrollbar { width: 12px; }
.grid-wrap::-webkit-scrollbar-track { background: var(--surface-deep); }
.grid-wrap::-webkit-scrollbar-thumb { border: 2px solid var(--surface-deep); border-radius: 6px; background: rgba(44, 45, 48, .36); }
.data-grid { --record-gutter: 72px; border-collapse: separate; border-spacing: 0; width: 0; table-layout: fixed; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
.app-main:has(#modeCompare:checked) .data-grid { --record-gutter: 126px; }
.data-grid th, .data-grid td { border-right: 1px solid rgba(44, 45, 48, .06); border-bottom: 1px solid rgba(44, 45, 48, .08); }
.data-grid th { position: sticky; top: 0; z-index: 3; padding: 7px 10px; background: var(--surface-deep); border-bottom-color: var(--line); color: var(--ink-soft); font-size: 12px; font-weight: 500; vertical-align: top; }
.data-grid td { height: 31px; padding: 5px 10px; background: var(--surface); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.data-grid tbody tr { cursor: pointer; }
.grid-wrap.can-pan .data-grid tbody tr,
.grid-wrap.can-pan .record-open,
.grid-wrap.can-pan .sort-button { cursor: grab; }
.grid-wrap.is-panning, .grid-wrap.is-panning * { cursor: grabbing !important; user-select: none; }
.data-grid tbody tr:hover td, .data-grid tbody tr:focus-within td { background: var(--surface-deep); }
.data-grid tbody tr:focus-visible { outline: none; }
.data-grid tbody tr:focus-visible td { box-shadow: inset 0 -2px var(--forest); }
.data-grid .sticky-status { position: sticky; left: 0; width: var(--record-gutter); min-width: var(--record-gutter); max-width: var(--record-gutter); z-index: 2; border-right-color: var(--line); }
.data-grid th.sticky-status { z-index: 6; vertical-align: middle; }
.data-grid td.key-column { z-index: 1; font-weight: 500; }
.data-grid th.key-column { z-index: 5; }
.data-grid th.key-column { background: color-mix(in srgb, var(--blue) 30%, var(--surface)); box-shadow: inset 0 -2px var(--blue); }
.app-main:has(#modeCompare:checked) .data-grid th[data-side="left"]:not(.key-column) { background: color-mix(in srgb, var(--mint) 22%, var(--surface)); box-shadow: inset 0 -2px var(--mint); }
.app-main:has(#modeCompare:checked) .data-grid th[data-side="right"]:not(.key-column) { background: color-mix(in srgb, var(--sand) 32%, var(--surface)); box-shadow: inset 0 -2px var(--ochre); }
.app-main:has(#modeExplore:checked) .data-grid th:not(.sticky-status) { box-shadow: inset 0 -2px var(--blue); }
.data-grid td.cell-diff, .data-grid td.key-column.cell-diff { background: color-mix(in srgb, var(--rose) 22%, var(--surface)); color: var(--ink); box-shadow: none; }
.data-grid tbody tr:hover td.cell-diff, .data-grid tbody tr:focus-within td.cell-diff { background: color-mix(in srgb, var(--rose) 32%, var(--surface)); box-shadow: none; }
.sort-button { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 1px 5px; width: 100%; padding: 0 9px 0 0; border: 0; background: transparent; text-align: left; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.sort-button small { display: block; width: 100%; color: var(--muted); font-size: 10px; font-weight: 400; }
.sort-button .key-icon { color: var(--ink); font-size: 13px; }
[aria-sort="ascending"] > .sort-button::after { content: "↑"; font-size: 13px; }
[aria-sort="descending"] > .sort-button::after { content: "↓"; font-size: 13px; }
.col-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 7; touch-action: none; }
.col-resize:hover, .col-resize:focus-visible { background: rgba(44, 45, 48, .16); }
.diff-count { display: inline-flex; align-items: center; padding: 1px 5px; border-radius: 3px; background: color-mix(in srgb, var(--rose) 45%, var(--surface)); color: var(--ink); font-size: 10px; font-weight: 500; white-space: nowrap; }
.null-value, .empty-value { color: var(--muted); font-size: 11px; font-style: italic; font-weight: 400; }
.status-badge { display: inline-flex; align-items: center; max-width: 100%; padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-deep); color: var(--ink); font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-equal { background: color-mix(in srgb, var(--sage) 73%, var(--canvas)); border-color: var(--sage); }
.status-changed { background: color-mix(in srgb, var(--rose) 48%, var(--surface)); border-color: var(--rose); }
.status-only_b1 { background: color-mix(in srgb, var(--mint) 63%, var(--canvas)); border-color: var(--mint); }
.status-only_b2 { background: color-mix(in srgb, var(--sand) 65%, var(--surface)); border-color: var(--ochre); }
.status-no_key { background: color-mix(in srgb, var(--ochre) 68%, var(--canvas)); border-color: var(--ochre); }
.status-duplicate { background: color-mix(in srgb, var(--rose) 66%, var(--canvas)); border-color: var(--rose); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 22px; text-align: center; }
.empty-state h2 { color: var(--ink-soft); font-size: 15px; font-weight: 500; }
.empty-state p { margin-top: 7px; color: var(--muted); font-size: 13px; }
.table-footer {
  display: flex; flex: none; align-items: center; gap: 22px; min-height: 40px; padding: 4px 8px;
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--card-edge);
  border-radius: 0 0 var(--card-radius) var(--card-radius); background: var(--surface);
  color: var(--muted); font-size: 12px;
}
.page-size-field { display: flex; align-items: center; gap: 9px; }
.page-size-field select { min-height: 28px; padding: 3px 18px 3px 7px; font-size: 12px; }
.page-info { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pagination { display: flex; align-items: center; gap: 4px; }
.pagination input { width: 44px; min-height: 28px; padding: 5px; text-align: center; font-size: 12px; -moz-appearance: textfield; }
.pagination input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Horizontal navigation stays in view while rows scroll. */
.column-navigation {
  display: flex; align-items: center; gap: 9px; flex: none; padding: 3px 8px;
  border-top: 1px solid var(--line); background: var(--surface);
}
.column-navigation label { font-size: 12px; font-weight: 500; white-space: nowrap; }
.scroll-arrow {
  display: grid; place-items: center; width: 30px; height: 27px; flex: none; font-size: 17px; line-height: 1;
  padding: 0; color: var(--ink); border: 2px solid var(--surface); border-radius: var(--action-radius);
  background: var(--control-face); box-shadow: var(--ring);
}
.scroll-arrow:disabled { opacity: .46; }
.column-navigation input {
  flex: 1; min-width: 0; height: 28px; min-height: 0; padding: 0; margin: 0;
  appearance: none; border: 0; box-shadow: none; background: transparent;
  --thumb-width: 15%; --rail: var(--surface-deep); --handle: var(--blue);
  cursor: pointer;
}
.column-navigation input::-webkit-slider-runnable-track { background: var(--rail); border-radius: 6px; height: 9px; box-shadow: var(--recessed); }
.column-navigation input::-moz-range-track { background: var(--rail); border-radius: 6px; height: 9px; box-shadow: var(--recessed); }
.column-navigation input::-webkit-slider-thumb {
  appearance: none; width: var(--thumb-width); min-width: 18px; height: 13px; margin-top: -2px;
  border: 1px solid var(--ink-soft); border-radius: 8px; background: var(--handle); cursor: grab; box-shadow: var(--selector-active);
}
.column-navigation input::-moz-range-thumb {
  width: var(--thumb-width); min-width: 18px; height: 13px; border: 1px solid var(--ink-soft); border-radius: 8px;
  background: var(--handle); cursor: grab; box-shadow: var(--selector-active);
}
.column-navigation input:active { cursor: grabbing; }
.record-open { display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; border: 0; padding: 0; background: transparent; color: var(--ink); text-align: left; }
.record-open > [aria-hidden] { color: var(--muted); font-size: 13px; }
.record-open:hover > [aria-hidden] { color: var(--ink); }

/* Dialog surfaces use the same paper, typography and understated edges. */
.dialog {
  padding: 0; border: 1px solid var(--card-edge); border-radius: var(--card-radius); background: var(--surface); color: var(--ink);
  box-shadow: var(--card-shadow); transition: var(--card-transition);
}
.dialog { width: min(640px, calc(100vw - 48px)); max-width: none; max-height: calc(100dvh - 56px); }
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: rgba(44, 45, 48, .17); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 17px; font-weight: 600; letter-spacing: -.2px; }
.dialog-body { padding: 16px 18px; min-height: 0; overflow: auto; }
.dialog-footer { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--surface-deep); }
.columns-dialog { width: min(820px, calc(100vw - 48px)); overflow: hidden; }
.columns-dialog .dialog-body { display: flex; flex: 1 1 auto; flex-direction: column; overflow: hidden; }
.columns-dialog .dialog-body > :not(.column-list) { flex-shrink: 0; }
.column-actions { display: flex; align-items: center; flex-wrap: wrap; flex-shrink: 0; gap: 3px; margin: 10px -8px 8px; }
#columnCount { margin-left: auto; padding: 5px 8px; font-size: 11px; font-variant-numeric: tabular-nums; }
.column-list {
  display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; max-height: min(56dvh, 560px);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  scrollbar-color: var(--muted) var(--surface-deep); border-top: 1px solid var(--line-soft);
}
.column-category { flex: none; min-width: 0; border-bottom: 1px solid var(--line); }
.column-category { --category-accent: var(--stock-deep); }
.column-category:has(input[data-category="identification"]) { --category-accent: var(--blue); }
.column-category:has(input[data-category="registry"]) { --category-accent: var(--sage); }
.column-category:has(input[data-category="location"]) { --category-accent: var(--olive); }
.column-category:has(input[data-category="consumption"]) { --category-accent: var(--mint); }
.column-category:has(input[data-category="economic_activity"]) { --category-accent: var(--ochre); }
.column-category:has(input[data-category="contact"]) { --category-accent: var(--forest); }
.column-category:has(input[data-category="dates"]) { --category-accent: var(--brown); }
.column-category:has(input[data-category="other"]) { --category-accent: var(--stock-deep); }
.column-category-heading { display: flex; align-items: center; gap: 8px; min-height: 45px; padding: 5px 9px; }
.column-category-select { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.column-category-select input { margin: 0; }
.column-category-select > span { min-width: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.column-category-select > span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--category-accent); box-shadow: 0 0 0 1px rgba(44,45,48,.12); vertical-align: 1px; }
.column-category-select > small { margin-left: auto; padding: 1px 7px; border-radius: 9999px; background: color-mix(in srgb, var(--category-accent) 24%, var(--surface)); color: var(--ink-soft); font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.column-category-match { color: var(--muted); font-size: 11px; font-weight: 400; }
.column-category-select input:checked { background: var(--forest); border-color: var(--forest); }
.column-category-select input:indeterminate { background: var(--blue); border-color: var(--ink-soft); }
.column-category-select input:indeterminate::after {
  content: ""; position: absolute; left: 3px; top: 6px; width: 7px; height: 1px;
  border: 0; background: var(--ink); transform: none;
}
.column-category-toggle {
  display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; padding: 0;
  border: 2px solid var(--surface); border-radius: 50%; background: var(--surface); color: var(--ink-soft); box-shadow: var(--ring);
}
.column-category-toggle:hover { color: var(--ink); background: var(--surface-deep); }
.column-category-toggle svg { width: 16px; height: 16px; transition: transform .16s ease; }
.column-category-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.column-category-fields { border-top: 1px solid var(--line-soft); }
.column-option { display: flex; align-items: center; gap: 11px; padding: 8px 9px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.column-category-fields .column-option { padding-left: 34px; }
.column-category-fields .column-option:last-child { border-bottom: 0; }
.column-option:hover { background: var(--surface-deep); }
.column-option > span:not(.diff-count) { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.column-option small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.column-option input { margin: 0; }
.columns-dialog .dialog-footer { flex-wrap: wrap; gap: 8px 18px; }
.columns-dialog .dialog-footer .action-group { margin-left: auto; }
.info-dialog { width: min(1000px, calc(100vw - 48px)); }
.info-content > p { margin-bottom: 18px; font-size: 12px; line-height: 1.65; }
.info-content > h3 { margin: 22px 0 12px; font-size: 14px; overflow-wrap: anywhere; }
.info-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; font-variant-numeric: tabular-nums; }
.info-table th, .info-table td { padding: 10px 12px; border: 1px solid var(--line); white-space: nowrap; }
.info-table th { background: var(--surface-deep); font-size: 11px; font-weight: 500; }
.info-table td { color: var(--ink); }
.info-dialog[data-view="quality"] .dialog-header { border-bottom: 2px solid var(--sage); }
.info-dialog[data-view="schema"] .dialog-header { border-bottom: 2px solid var(--blue); }
.info-dialog[data-view="quality"] .info-table th { background: color-mix(in srgb, var(--sage) 30%, var(--surface)); }
.info-dialog[data-view="schema"] .info-table th { background: color-mix(in srgb, var(--blue) 30%, var(--surface)); }
.record-dialog {
  --record-padding: 20px;
  width: min(2048px, calc(100% - 48px)); max-width: none; max-height: calc(100dvh - 32px);
  margin: auto; overflow: hidden;
}
.record-header { padding: 12px var(--record-padding); border-bottom: 0; }
.record-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 13px; }
#detailPosition { font-size: 12px; font-variant-numeric: tabular-nums; }
.record-toolbar {
  display: flex; flex: none; align-items: center; gap: 8px 14px;
  padding: 0 var(--record-padding) 10px; border-bottom: 1px solid var(--line-soft);
}
.record-toolbar .action-group { margin-left: auto; }
.record-search { max-width: 360px; min-width: 110px; }
.record-dialog .dialog-body { padding: 0; min-height: 0; overscroll-behavior: contain; scrollbar-color: var(--muted) var(--surface-deep); }
.record-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 7px var(--record-padding); font-size: 12px; }
.record-tools label { display: inline-flex; gap: 7px; align-items: center; }
.record-sections {
  display: grid; grid-template-columns: repeat(var(--record-columns, 1), minmax(0, 1fr));
  align-items: start; gap: 16px; padding: 0 var(--record-padding) 8px;
}
.record-field-panel { min-width: 0; }
.record-field-panel .record-fields th:first-child { width: 40%; padding-left: 8px; }
.record-field-panel .record-fields th, .record-field-panel .record-fields td { padding: 3px 8px; height: 24px; line-height: 17px; }
.record-field-panel .record-fields td { color: var(--ink); }
.record-field-panel .record-fields thead th { background: var(--surface-deep); }
.record-field-panel .record-fields th:first-child { background: var(--field-surface); }
.record-field-panel .record-fields-compare th:first-child { width: 28%; }
.record-field-panel .record-fields-compare thead th.record-base-1 { width: 36%; background: color-mix(in srgb, var(--mint) 27%, var(--surface)); border-bottom: 1px solid var(--line); }
.record-field-panel .record-fields-compare thead th.record-base-2 { width: 36%; background: color-mix(in srgb, var(--sand) 38%, var(--surface)); border-bottom: 1px solid var(--line); }
.record-field-panel .record-fields td { background: var(--surface); }
.record-field-panel .record-fields-compare tr.is-diff td { background: color-mix(in srgb, var(--rose) 22%, var(--surface)); }
.record-fields { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; text-align: left; font-size: 13px; }
.record-fields th, .record-fields td {
  padding: 5px 12px; height: 29px; border-bottom: 1px solid var(--line-soft);
  text-align: left; vertical-align: top; overflow-wrap: anywhere;
}
.record-fields thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-deep); color: var(--ink);
  border-bottom-color: var(--line); font-size: 12px; font-weight: 600;
}
.record-fields th:first-child { width: 196px; padding-left: var(--record-padding); }
.record-fields tbody th { font-weight: 500; color: var(--ink-soft); background: var(--field-surface); }
.record-fields tbody th small { display: inline; margin-left: 4px; color: var(--muted); font-size: 10px; font-weight: 400; }
.record-fields thead th + th { border-left: 1px solid var(--line-soft); }
.record-fields td { border-left: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.record-value { white-space: pre-wrap; overflow-wrap: anywhere; }
.record-fields .is-diff td { background: color-mix(in srgb, var(--rose) 22%, var(--surface)); }
.record-unavailable, .record-message, .record-no-match { color: var(--muted); }
.record-message, .record-no-match { padding: 12px var(--record-padding); }
.export-dialog { width: min(640px, calc(100vw - 48px)); }
.export-summary { padding: 0; margin: 0 0 18px; border: 0; background: transparent; color: var(--muted); font-size: 12px; line-height: 1.55; }
.export-section { min-width: 0; }
.export-option { display: grid; grid-template-columns: 43px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.export-type { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 3px 6px; border: 1px solid var(--line-soft); border-radius: var(--control-radius); background: transparent; color: var(--ink-soft); font-size: 11px; font-weight: 500; }
.export-copy { min-width: 0; }
.export-option h3 { font-size: 14px; font-weight: 500; }
.export-option p { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.export-action { width: auto; min-height: 34px; padding: 6px 13px; font-size: 13px; }
.export-safety { margin: 16px 0 0 55px; }
.export-safety small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.export-divider { height: 1px; background: var(--line-soft); margin: 20px 0; }
#exportLimit { margin: 12px 0 0 55px; }

@media (min-height: 450px) {
  .app-main:has(#grid[hidden]):has(#compareSetup[hidden]):not(:has(.has-file)) .workspace-controls { overflow: visible; }
}

/* Keep file names and comparison controls readable without sacrificing data rows. */
@media (min-width: 1250px) {
  .results-panel:not(:has(#grid[hidden])) .results-controls {
    display: grid; grid-template-columns: minmax(195px, .8fr) minmax(270px, 1.4fr) max-content max-content;
    gap: 12px; align-items: center; padding: 13px 0; overflow: visible;
  }
  .results-panel:not(:has(#grid[hidden])) :is(.results-heading, .table-toolbar) { display: contents; }
  .results-heading .section-heading { flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.28; }
  .search-group { grid-column: 2; grid-row: 1; }
  .search-group #searchColumn { max-width: 165px; }
  .search-group .search-field { min-width: 120px; }
  .filter-group { grid-column: 3; grid-row: 1; }
  .result-tools { grid-column: 4; grid-row: 1; }
  .result-tools .button { padding-inline: 11px; font-size: 12px; }
  .tool-divider { margin-inline: 2px; }
}
@media (max-width: 980px) {
  .app-main { --gutter: 14px; }
  .setup-summary { padding-left: 0; }
  .file-card { padding: 14px; gap: 10px; }
  .file-icon { width: 34px; height: 34px; }
  .stats-grid { display: flex; overflow-x: auto; scrollbar-width: thin; }
  .stat-card { flex: 1 0 max-content; padding: 6px 12px; }
  .stat-card strong { font-size: 18px; }
  .stat-card > span { gap: 5px; }
  .search-field { max-width: none; }
}
@media (max-width: 850px) {
  .data-grid td.key-column, .data-grid th.key-column { position: static !important; left: auto !important; z-index: auto; }
  .data-grid th.key-column { position: sticky !important; top: 0; z-index: 3; }
  .data-grid { --record-gutter: 68px; }
  .app-main:has(#modeCompare:checked) .data-grid { --record-gutter: 110px; }
  .files-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .file-card { min-height: 70px; }
  .field-heading { align-items: flex-start; }
  .key-actions { flex-wrap: wrap; justify-content: flex-end; }
  .table-toolbar { flex-wrap: wrap; }
  .search-group { min-width: min(100%, 220px); }
  .options-summary { display: none; }
}
@media (max-width: 650px) {
  .app-main { --gutter: 12px; }
  .appearance-menu { top: 5px; }
  .appearance-menu > summary { padding: 9px; }
  .appearance-menu > summary span { display: none; }
  .app-main:has(#grid[hidden]):has(#compareSetup[hidden]):not(:has(.has-file)) {
    padding: clamp(48px, 12vh, 96px) var(--gutter) 8px;
  }
  .workspace-controls { max-height: 35%; }
  .results-controls { max-height: 40%; overflow-x: hidden; }
  .setup-summary { min-height: 42px; padding: 6px 45px 6px 0; gap: 5px; }
  .setup-summary .section-heading { font-size: 13px; white-space: nowrap; }
  .setup-summary-end { gap: 3px; }
  .setup-summary-end > span { max-width: 20vw; font-size: 11px; }
  .setup-panel:not([open]) .section-heading { display: none; }
  .setup-panel:not([open]) .setup-summary-end .muted { display: block; color: var(--ink); font-weight: 500; }
  .setup-summary-end svg { width: 15px; height: 15px; }
  .setup-content { padding: 10px 0; }
  .mode-row { margin-bottom: 12px; }
  .segmented { gap: 2px; }
  .segmented label { flex: 0 0 auto; }
  .segmented label > span { gap: 5px; padding: 6px 5px; font-size: 12px; }
  .segmented svg { width: 14px; height: 14px; }
  .file-card { flex-wrap: wrap; padding: 13px; gap: 8px; }
  .file-description { min-width: min(135px, 100%); }
  .file-description strong { font-size: 13px; }
  .file-meta { white-space: normal; font-size: 11px; }
  .file-picker.button { min-height: 31px; padding: 6px 12px; font-size: 12px; }
  .file-card.has-file .file-remove { margin-left: auto; }
  .file-card.has-file .file-description { min-width: min(115px, 100%); }
  .setup-actions { margin-top: 9px; gap: 8px; flex-wrap: wrap; }
  .setup-actions > .action-group { margin-left: auto; gap: 4px; }
  .setup-actions .button { padding: 7px 10px; font-size: 12px; }
  .local-note { font-size: 11px; }
  .field-heading { flex-direction: column; gap: 7px; }
  .field-heading h2 { font-size: 15px; }
  .key-actions { gap: 3px; }
  .key-actions .button { min-height: 30px; font-size: 11px; padding: 5px 9px; }
  .key-pair { grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr) 24px; gap: 4px; }
  .key-pair select { font-size: 12px; padding-left: 6px; }
  .key-field-controls { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .key-field-controls > :is(input, select) { min-height: 32px; font-size: 12px; }
  .key-pair:has(.key-field) { --key-select-offset: 59px; }
  .key-pair:has(.key-field) > span { height: 32px; min-height: 32px; }
  .key-pair .btn.icon-btn { width: 24px; height: 32px; }
  .options-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .analysis-status { gap: 0 4px; }
  .analysis-note > summary { padding-inline: 5px; font-size: 11px; }
  .progress-area { gap: 5px; }
  .progress-copy { gap: 2px 5px; }
  .progress-copy strong, #progressDetail { font-size: 11px; }
  .elapsed { font-size: 10px; }
  .progress-area:has(#cancel:not([hidden])) { gap: 8px; }
  .stats-grid .stat-card { padding: 5px 9px; gap: 1px; }
  .stats-grid .stat-card strong { font-size: 17px; }
  .stat-card > span { font-size: 10px; }
  .results-heading { padding: 8px 0 6px; gap: 7px; }
  .results-heading h2 { font-size: 15px; }
  .results-heading > .section-heading { flex-wrap: wrap; gap: 3px 8px; }
  .result-count { font-size: 11px; }
  .result-tools { gap: 3px; }
  .result-tools .button { padding: 4px 8px; min-height: 28px; font-size: 11px; }
  .tool-divider { display: none; }
  .result-tools svg { width: 14px; height: 14px; }
  .table-toolbar { padding: 3px 0 8px; gap: 6px; }
  .search-group, .filter-group { gap: 6px; }
  .search-group { flex: 1 1 235px; min-width: 0; }
  .filter-group { flex: 1 1 120px; }
  .app-main:has(#modeExplore:checked) .filter-group { flex: none; }
  .filter-group #filter { flex: 1; max-width: none; }
  .filter-group .button { margin-left: auto; }
  .search-field { min-width: 0; gap: 5px; padding: 0 7px; }
  .table-toolbar :is(input, select, .button) { min-height: 30px; font-size: 12px; }
  .table-toolbar select { padding: 4px; }
  #searchColumn { max-width: 38%; }
  #searchBtn { padding-inline: 9px; }
  .data-grid { font-size: 12px; }
  .data-grid td { height: 29px; padding: 4px 8px; }
  .data-grid th { padding: 5px 8px; }
  .record-open { gap: 3px; }
  .record-open svg { width: 12px; height: 12px; }
  .status-badge { font-size: 10px; padding: 2px 5px; }
  .column-navigation { gap: 5px; padding: 2px 5px; }
  .column-navigation label { font-size: 11px; }
  .column-navigation .scroll-arrow { width: 27px; height: 26px; }
  .table-footer { flex-wrap: wrap; gap: 3px 7px; padding: 4px 5px; min-height: 34px; font-size: 11px; }
  .page-size-field { gap: 4px; }
  .page-size-field label { line-height: 1.2; white-space: nowrap; }
  .pagination { gap: 1px; }
  .pagination .icon-button { width: 26px; height: 27px; }
  .pagination input { width: 36px; }
  .dialog, .info-dialog, .export-dialog, .record-dialog { width: calc(100vw - 18px); max-height: calc(100dvh - 22px); }
  .dialog-header { padding: 9px 12px; }
  .dialog-header h2 { font-size: 16px; }
  .dialog-body { padding: 12px; }
  .dialog-footer { padding: 9px 12px; gap: 7px; flex-wrap: wrap; }
  .dialog-footer .action-group { margin-left: auto; }
  .export-option { grid-template-columns: 39px minmax(0, 1fr); gap: 8px 10px; }
  .export-action { grid-column: 2; justify-self: start; }
  .export-safety, #exportLimit { margin-left: 49px; }
  .column-actions .button { font-size: 11px; padding-inline: 6px; }
  .columns-dialog { width: calc(100vw - 18px); }
  .column-actions { gap: 2px; margin-block: 8px 6px; }
  #columnCount { flex-basis: 100%; padding-block: 2px 5px; }
  .column-category-heading { gap: 6px; padding-inline: 5px; }
  .column-category-select { display: grid; grid-template-columns: 15px minmax(0, 1fr); gap: 1px 9px; }
  .column-category-select input { grid-column: 1; grid-row: 1 / 3; }
  .column-category-select > span { grid-column: 2; }
  .column-category-select > small { grid-column: 2; justify-self: start; margin-left: 0; text-align: left; }
  .column-category-fields .column-option { padding-left: 29px; }
  .columns-dialog .dialog-footer { gap: 6px; }
  .columns-dialog .dialog-footer .button { padding-inline: 11px; }
  .record-dialog { --record-padding: 11px; }
  .record-header { padding: 8px var(--record-padding); }
  .record-heading { display: grid; gap: 0; }
  .record-toolbar { padding: 0 var(--record-padding) 7px; gap: 5px; }
  .record-search { padding-inline: 6px; }
  .record-toolbar .button { font-size: 11px; min-height: 30px; padding-inline: 7px; }
  .record-toolbar .action-group { gap: 4px; }
  .record-toolbar .action-group { margin-left: auto; }
  .record-tools { padding: 5px var(--record-padding); }
  .record-fields th, .record-fields td { padding: 5px 8px; }
  .record-fields th:first-child { width: 32%; padding-left: var(--record-padding); }
}
@media (max-width: 375px) {
  .setup-summary-end > span { display: none; }
  .table-footer { gap: 3px 5px; }
  .page-size-field select { width: 45px; padding: 3px; }
  .pagination .icon-button { width: 23px; }
  .pagination input { width: 29px; }
  .file-card { display: grid; grid-template-columns: 27px minmax(0, 1fr) auto; }
  .file-card .file-icon { width: 27px; height: 27px; }
  .file-card .file-icon svg { width: 17px; height: 17px; }
  .file-card .file-description { grid-column: 2 / -1; min-width: 0; }
  .file-card .file-picker { grid-column: 2; justify-self: start; }
}
@media (max-height: 540px) {
  .app-main { padding-block: 2px; }
  .workspace-controls { max-height: 27%; }
  .results-controls { max-height: 29%; }
  .app-main:has(#grid[hidden]):has(#compareSetup[hidden]):not(:has(.has-file)) { padding-top: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
