/* Match Lists: page-specific styles. Shared look comes from brand.css and app-shell.css. */
.app-title { font-size: var(--step-3); margin-bottom: 0.3em; }
.intro { color: var(--muted); max-width: 72ch; margin-bottom: 20px; }
.small { font-size: var(--step--1); margin: 6px 0 10px; }
.section-title { font-size: var(--step-2); margin: 32px 0 12px; }
.notice { padding: 10px 14px; border-left: 4px solid var(--highlight); background: var(--bg); margin: 0 0 12px; }

/* Choosing the job */
.modes { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.mode-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); cursor: pointer; }
.mode-card input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--primary); flex: none; }
.mode-card b { display: block; }
.mode-card small { display: block; color: var(--muted); }
.mode-card:has(input:checked) { border-color: var(--primary); }
.mode-card:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }

.slots { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.slots.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.slot { min-height: 200px; 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); }
.sheet-field { width: min(100%, 320px); text-align: left; }
.go-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.go-row .status { flex-basis: 100%; margin: 0; }
.run-progress { flex: 1 1 200px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 18px; min-width: 0; }
.panel h3 { font-size: var(--step-1); margin: 0 0 8px; }
.panel .sub-title { margin-top: 22px; }
.cols, .weights { width: 100%; border-collapse: collapse; font-size: var(--step--1); margin-bottom: 14px; }
.cols caption { text-align: left; font-weight: 700; padding: 4px 0 6px; }
.cols th, .cols td, .weights th, .weights td { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cols thead th { color: var(--muted); font-weight: 600; }
.cols tbody th { font-weight: 600; overflow-wrap: anywhere; }
.cols tr.off .col-name { color: var(--muted); font-weight: 400; }
.col-name { display: block; }
.example { display: block; color: var(--muted); font-weight: 400; font-size: 0.85rem; overflow-wrap: anywhere; }
.cols select, .weights select { font: inherit; padding: 0.35em 0.5em; border: 2px solid var(--line); border-radius: var(--radius-s); background: var(--bg); color: var(--fg); max-width: 100%; }
.weights td { white-space: nowrap; }
.weights .strong { display: flex; margin-top: 6px; white-space: normal; font-size: var(--step--1); }
.rules { display: grid; gap: 10px; }
.rule { align-items: flex-start; }
.rule input { margin-top: 3px; flex: none; }
.rule small { display: block; color: var(--muted); }
.tidy-preview { margin-top: 18px; }
.tidy-preview summary { cursor: pointer; font-weight: 600; color: var(--primary); padding: 4px 0; }
.tidy-preview .table-wrap { margin-top: 8px; }
#tidy-table { border-collapse: collapse; font-size: var(--step--1); width: 100%; }
#tidy-table th, #tidy-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
#tidy-table thead th { color: var(--muted); }
#tidy-table tr.sep > * { border-top: 2px solid var(--line); }
#tidy-table code { font-size: 0.85rem; }

/* Results */
.results-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.results-head h2 { font-size: var(--step-3); margin: 0 0 4px; }
.results-head h2:focus { outline: none; }
.results-head p { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.review-bar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 12px 16px;
  margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.threshold { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-weight: 600; }
.threshold input { width: min(260px, 60vw); accent-color: var(--primary); }
.threshold output { font-family: var(--font-display); font-size: 1.2rem; min-width: 3.2ch; }
.review-filters { display: flex; gap: 12px; flex-wrap: wrap; }
.inline-field { display: flex; gap: 6px; align-items: center; font-size: var(--step--1); font-weight: 600; }
.inline-field select { font: inherit; font-weight: 400; padding: 0.3em 0.5em; border: 2px solid var(--line); border-radius: var(--radius-s); background: var(--bg); color: var(--fg); }
.keys { margin-top: 0; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }

.groups { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.group { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; min-width: 0; }
.group[data-status="accepted"] { border-left-color: var(--ok); }
.group[data-status="rejected"] { border-left-color: var(--muted); }
.group[data-status="rejected"] .rows { opacity: 0.65; }
.group:focus { outline: 3px solid var(--primary); outline-offset: 2px; }
.group-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.group-head h3 { font-size: var(--step-0); margin: 0; flex: 1 1 auto; }
.group-head h3 .muted { font-family: var(--font); font-weight: 400; font-size: var(--step--1); }
.badge { font-size: 0.8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.badge[data-status="accepted"] { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); border-color: currentColor; }
.badge[data-status="below"] { color: var(--muted); }
.group-actions { display: flex; gap: 6px; }
.btn.small { padding: 0.35em 0.9em; font-size: var(--step--1); border-radius: 10px; }
.btn.small[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--on-primary); }
.btn.quiet.small[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); box-shadow: none; }

/* position: relative keeps visually hidden labels inside the scrolling box on phones. */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-s); }
.rows { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
.rows th, .rows td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 7em; overflow-wrap: break-word; }
.rows thead th { color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--bg); }
.rows tbody tr:last-child > * { border-bottom: 0; }
.rows .pick { min-width: 0; width: 3.5em; text-align: center; }
.rows .pick input { width: 18px; height: 18px; accent-color: var(--primary); }
.rows .rownum { min-width: 0; width: 4em; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; white-space: nowrap; }
.rows .score { min-width: 12em; }
.rows .why { display: block; color: var(--muted); font-size: 0.8rem; }
.rows tr.keep, .rows tr.source { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.rows tr.out > td:not(.pick):not(.score), .rows tr.out > th { text-decoration: line-through; color: var(--muted); }
.keep-label { font-weight: 700; color: var(--primary); }
mark { background: var(--highlight); color: var(--highlight-ink); border-radius: 3px; padding: 0 2px; }
.link-btn { font: inherit; font-size: 0.8rem; border: 0; background: none; color: var(--primary); cursor: pointer; text-decoration: underline; padding: 4px 0 0; display: block; }
.more-row { padding: 14px 0; }
.empty-state { padding: 32px 20px; text-align: center; }
.empty-state h3 { font-size: var(--step-2); }
.empty-state p { margin: 0 auto; }

@media (max-width: 860px) {
  .settings-grid, .slots.two { grid-template-columns: minmax(0, 1fr); }
  .results-head h2 { font-size: var(--step-2); }
}
/* Phones: each row's values stacked under their labels instead of a wide table. */
@media (max-width: 600px) {
  .group .table-wrap { overflow: visible; }
  .rows, .rows tbody { display: block; }
  .rows thead { display: none; }
  .rows tr { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); column-gap: 8px; padding: 8px 8px 8px 4px; border-bottom: 1px solid var(--line); }
  .rows tbody tr:last-child { border-bottom: 0; }
  .rows th, .rows td { display: block; grid-column: 2; border: 0; padding: 1px 0; min-width: 0; width: auto; text-align: left; }
  .rows .pick { grid-column: 1; grid-row: 1 / span 12; width: auto; padding-top: 2px; }
  .rows td:empty { display: none; }
  .rows [data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 600; }
  .rows .score::before { content: none; }
  .rows .score { margin-top: 4px; }
}
@media (max-width: 520px) {
  .app-title { font-size: var(--step-2); }
  .review-bar { padding: 10px 12px; }
  .group { padding: 10px; }
  .rows th, .rows td { padding: 5px 7px; }
  .weights td { white-space: normal; }
}
