/* Compare Two Spreadsheets (/tools/spreadsheet-compare/): what ft-tool-20261106.css doesn't cover.
   Two file slots, compact loaded files, matching set-up, progress, the side-by-side grid (virtual rows) and
   row details. Colours come from the --ft-* tokens only. */

/* Files ------------------------------------------------------------------------------------ */
.sc-files { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ft-space-4); }
@media (min-width: 40rem) {
  .sc-files { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  /* As tall as an empty drop box, so the row keeps its height when a file (or the example opening with the page) arrives. */
  .sc-file { min-height: 12rem; }
}
.sc-file { display: grid; gap: var(--ft-space-2); align-content: start; min-width: 0; }
.sc-drop__text { color: var(--ft-ink-2); }
.sc-drop__file:empty { display: none; }
.sc-file.is-loaded .ft-drop__label {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "icon title button" "icon text button";
  justify-items: start;
  align-items: center;
  gap: 0 var(--ft-space-3);
  min-height: 0;
  padding: var(--ft-space-3) var(--ft-space-4);
  border-style: solid;
  border-width: 1px;
  text-align: left;
}
.sc-file.is-loaded .ft-drop__icon { grid-area: icon; }
.sc-file.is-loaded .ft-drop__label strong { grid-area: title; }
.sc-file.is-loaded .sc-drop__text { grid-area: text; min-width: 0; overflow-wrap: anywhere; color: var(--ft-ink); font-weight: 600; }
.sc-file.is-loaded .ft-drop__button { grid-area: button; }
.sc-file.is-loaded .sc-drop__file { display: none; }
.sc-file__details:empty, .sc-file__error:empty { display: none; }
.sc-file__details { display: grid; gap: var(--ft-space-3); min-width: 0; }
.sc-file__meta { margin: 0; color: var(--ft-ink-2); font-size: var(--ft-text-sm); }
.sc-file__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), minmax(0, 1fr))); gap: var(--ft-space-3); min-width: 0; }
.sc-file__fields > * { min-width: 0; }
.sc-file__fields .ft-field, .sc-setup .ft-field { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.sc-file__fields .ft-select, .sc-setup .ft-select, .sc-toolbar .ft-select { width: 100%; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sc-file__error .ft-note { margin: 0; }
.sc-limits { margin-top: var(--ft-space-3); }

/* Matching set-up --------------------------------------------------------------------------- */
.sc-setup { display: grid; gap: var(--ft-space-3); margin-top: var(--ft-space-5); padding-top: var(--ft-space-5); border-top: 1px solid var(--ft-line); }
.sc-setup__row { display: flex; flex-wrap: wrap; align-items: end; gap: var(--ft-space-3) var(--ft-space-5); }
.sc-keyfield { flex: 1 1 13rem; max-width: 22rem; }
.sc-keyhint { margin: 0; max-width: var(--ft-measure); }
.sc-disclosure > summary { font-size: var(--ft-text-sm); }
.sc-disclosure .ft-disclosure__body { display: grid; gap: var(--ft-space-3); }
.sc-maptable td, .sc-maptable th { vertical-align: middle; }
.sc-maptable .ft-select { min-width: 12rem; }
.sc-maptable .ft-check { min-height: 2.75rem; }
.sc-mapwrap { max-height: 24rem; }
.sc-options { display: grid; gap: var(--ft-space-4); }
.sc-group { display: grid; gap: var(--ft-space-1); min-width: 0; margin: 0; padding: 0; border: 0; }
.sc-group__legend { margin-bottom: var(--ft-space-1); padding: 0; color: var(--ft-ink); font-size: var(--ft-text-sm); font-weight: 700; }
@media (min-width: 56rem) {
  .sc-options { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .sc-options > .ft-btnrow { grid-column: 1 / -1; }
}

/* Results ----------------------------------------------------------------------------------- */
.sc-linkhint { margin: calc(-1 * var(--ft-space-3)) 0 var(--ft-space-3); }
#tool-results-title { scroll-margin-top: var(--ft-space-5); }
.sc-empty { min-height: 14rem; }
.sc-empty p { margin: 0; max-width: 32rem; }
.sc-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--ft-space-2) var(--ft-space-4);
  margin-bottom: var(--ft-space-4);
  padding: var(--ft-space-4);
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius-l);
  background: var(--ft-surface-2);
}
.sc-progress__label { grid-column: 1 / -1; margin: 0; color: var(--ft-ink); font-size: var(--ft-text-sm); font-weight: 600; }
.sc-progress__bar { width: 100%; height: 0.625rem; accent-color: var(--ft-accent); }
.sc-results { display: grid; gap: var(--ft-space-4); }
.sc-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); }
.sc-stats .ft-stat { position: relative; }
.sc-stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: var(--ft-radius) 0 0 var(--ft-radius); }
.sc-stat--added::before { background: var(--ft-ok); }
.sc-stat--removed::before { background: var(--ft-bad); }
.sc-stat--changed::before { background: var(--ft-warn); }
.sc-sentence { margin: 0; color: var(--ft-ink); font-size: var(--ft-text-md); font-weight: 650; }
.sc-notes:empty { display: none; }
.sc-notes { display: grid; gap: var(--ft-space-2); }
.sc-notes .ft-note { margin: 0; }
.sc-notes .ft-note .ft-btn { margin-top: var(--ft-space-2); }
.sc-h3 { margin: var(--ft-space-3) 0 0; color: var(--ft-ink); font-size: var(--ft-text-lg); font-weight: 650; }
.sc-colswrap { max-height: 20rem; }
.sc-colstable th, .sc-colstable td { height: var(--ft-target); padding-top: 0; padding-bottom: 0; vertical-align: middle; }
.sc-colstable .sc-linkbtn { padding: 0 0.5rem; }
.sc-linkbtn {
  display: inline-flex; align-items: center; justify-content: center; min-width: var(--ft-target); min-height: var(--ft-target); padding: 0 0.35rem; border: 0; background: none;
  color: var(--ft-link); font: inherit; font-variant-numeric: tabular-nums; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer;
}
.sc-linkbtn:hover { text-decoration-thickness: 2px; }
.sc-linkbtn:focus-visible { outline: 3px solid var(--ft-focus); outline-offset: 2px; border-radius: var(--ft-radius-s); }
.sc-muted { color: var(--ft-ink-3); }

.sc-toolbar { display: grid; gap: var(--ft-space-3); }
@media (min-width: 40rem) { .sc-toolbar { grid-template-columns: minmax(0, 12rem) minmax(0, 14rem) minmax(0, 1fr); align-items: end; } }
.sc-gridbar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--ft-space-1) var(--ft-space-4); }
.sc-count { margin: 0; color: var(--ft-ink-2); font-size: var(--ft-text-sm); font-variant-numeric: tabular-nums; }
.sc-legend { display: flex; flex-wrap: wrap; gap: var(--ft-space-1) var(--ft-space-4); margin: 0; color: var(--ft-ink-2); font-size: var(--ft-text-xs); }
.sc-legend__item { display: inline-flex; align-items: center; gap: var(--ft-space-1); }
.sc-swatch { display: inline-block; width: 0.875rem; height: 0.875rem; border-radius: 3px; border: 1px solid var(--ft-line-strong); }
.sc-swatch--added { background: var(--ft-ok-soft); }
.sc-swatch--removed { background: var(--ft-bad-soft); }

/* Side-by-side grid (only the visible rows are in the page) ---------------------------------- */
.sc-grid {
  --sc-row: 2.8125rem; /* 45 px: a 44 px button plus the 1 px row line */
  position: relative;
  max-height: min(34rem, 70vh);
  overflow: auto;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  overscroll-behavior: contain;
}
.sc-grid:focus-visible { outline: 3px solid var(--ft-focus); outline-offset: 2px; }
.sc-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; color: var(--ft-ink); font-size: var(--ft-text-sm); line-height: 1.3; }
.sc-table th, .sc-table td {
  box-sizing: border-box;
  height: var(--sc-row);
  max-width: 20rem;
  padding: 0 0.75rem;
  overflow: hidden;
  border-bottom: 1px solid var(--ft-line);
  text-align: left;
  text-overflow: ellipsis;
  white-space: pre;
  vertical-align: middle;
}
.sc-table thead th { position: sticky; top: 0; z-index: 2; background: var(--ft-surface-2); font-weight: 650; }
.sc-table th:first-child, .sc-table td:first-child { position: sticky; left: 0; z-index: 1; padding: 0; background: var(--ft-surface); border-right: 1px solid var(--ft-line); }
.sc-table thead th:first-child { z-index: 3; padding: 0 0.75rem; background: var(--ft-surface-2); }
.sc-table .sc-num { text-align: right; font-variant-numeric: tabular-nums; }
.sc-table .sc-keycell { font-weight: 650; }
.sc-table .sc-onlycol { color: var(--ft-ink-2); }
.sc-table tr.sc-spacer > td { height: auto; padding: 0; border: 0; background: none; }
.sc-table tr.is-added > td { background: var(--ft-ok-soft); }
.sc-table tr.is-removed > td { background: var(--ft-bad-soft); }
.sc-table tr.is-added > td:first-child { background: var(--ft-ok-soft); }
.sc-table tr.is-removed > td:first-child { background: var(--ft-bad-soft); }
.sc-table td.is-changed { background: var(--ft-warn-soft); }
.sc-table tr.is-loading > td { color: var(--ft-ink-3); }
.sc-table tr.is-current > td { box-shadow: inset 0 2px 0 var(--ft-accent), inset 0 -2px 0 var(--ft-accent); }
.sc-del { color: var(--ft-ink-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.sc-ins { color: var(--ft-ink); font-weight: 700; text-decoration: none; }
.sc-arrow { margin: 0 0.35em; color: var(--ft-ink-3); }
.sc-rowbtn {
  display: flex; align-items: center; gap: var(--ft-space-2); box-sizing: border-box; width: 100%; min-width: 7.5rem; height: calc(var(--sc-row) - 1px);
  padding: 0 0.75rem; border: 0; background: transparent; color: var(--ft-link); font: inherit; font-weight: 650;
  text-align: left; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer;
}
.sc-rowbtn:hover { background: var(--ft-accent-soft); }
.sc-rowbtn:focus-visible { outline: 3px solid var(--ft-focus); outline-offset: -3px; }
.sc-mark { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; }
.sc-mark--1 { background: var(--ft-warn); }
.sc-mark--2 { background: var(--ft-ok); }
.sc-mark--3 { background: var(--ft-bad); }
.sc-mark--0 { background: var(--ft-line-strong); }
.sc-gridempty { margin: 0; padding: var(--ft-space-5); color: var(--ft-ink-2); font-size: var(--ft-text-sm); }

/* Row details --------------------------------------------------------------------------------- */
.sc-detail { display: grid; gap: var(--ft-space-3); padding: var(--ft-space-4); border: 1px solid var(--ft-line-strong); border-radius: var(--ft-radius-l); background: var(--ft-surface); }
.sc-detail__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ft-space-2); }
.sc-detail__title { margin: 0; color: var(--ft-ink); font-size: var(--ft-text-md); font-weight: 700; }
.sc-detail__title:focus { outline: none; }
.sc-detail__title:focus-visible { outline: 3px solid var(--ft-focus); outline-offset: 2px; }
.sc-detailtable td { white-space: pre-wrap; overflow-wrap: anywhere; }
.sc-detailtable tr.is-changed > * { background: var(--ft-warn-soft); }
.sc-detailtable .sc-space { padding: 0 1px; border-radius: 2px; background: var(--ft-surface-2); color: var(--ft-ink-3); }

/* Worked example -------------------------------------------------------------------------------- */
.sc-example-prose { margin-top: var(--ft-space-4); }
.sc-example-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ft-space-2) var(--ft-space-4); }
.sc-example-links a { display: inline-flex; align-items: center; min-height: var(--ft-target); }

@media (max-width: 40rem) {
  .sc-table th, .sc-table td { max-width: 14rem; }
  .sc-file.is-loaded .ft-drop__label { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon title" "icon text" "button button"; }
  .sc-file.is-loaded .ft-drop__button { margin-top: var(--ft-space-2); }
}
.sc-printonly { display: none; }
@media print {
  /* Only the visible rows of the grid exist in the page, so print the summary and point to the full list instead. */
  .sc-toolbar, .sc-gridbar, .sc-grid, .sc-detail, #sc-rows-title, .sc-progress, .sc-linkhint, .sc-setup, .sc-example-links { display: none !important; }
  .sc-printonly { display: block; }
}

/* Mobile form controls (16px to prevent iOS Safari zoom) and 44px primary buttons */
@media screen and (max-width: 640px), screen and (hover: none) and (pointer: coarse) {
  .ft-tool input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  .ft-tool select,
  .ft-tool textarea,
  .ft-tool .ft-input,
  .ft-tool .ft-select,
  .ft-tool .ft-textarea,
  .ft-tool .ft-inputgroup > .ft-select.ft-inputgroup__unit {
    font-size: max(16px, 1rem);
  }
  .ft-tool .ft-btn--primary {
    min-height: 44px;
  }
}
