/* Design system — light palette. */
:root {
  --window: #f4f5f7;
  --card: #ffffff;
  --card-border: #e2e5eb;
  --sunken: #f6f7f9;
  --text: #1b2230;
  --text-dim: #5c6676;
  --accent: #2f63e7;
  --accent-hover: #2653c7;
  --enemy: #d43d8c;
  --success: #1e8e4e;
  --danger: #d33a3a;
  --warning: #b57714;
  --scrollbar-track: #eef0f4;
  --scrollbar-thumb: #aeb6c4;
  --scrollbar-thumb-hover: #8792a4;
  --radius: 8px;
  --radius-sm: 6px;
  font-size: 14px;
}

* {
  box-sizing: border-box;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--scrollbar-track); }
*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border: 2px solid var(--scrollbar-track);
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

html, body {
  margin: 0;
  padding: 0;
  background: var(--window);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  height: 100%;
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  flex: none;
  overflow-x: auto;
  scrollbar-gutter: stable;
}
.topbar .app-title {
  font-weight: 700;
  font-size: 15px;
  margin-right: 14px;
  white-space: nowrap;
}
.topbar .bridge {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { background: #eceff4; color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }
.tab.active:hover { background: var(--accent-hover); }

/* ---------- Views ---------- */
.view { flex: 1; overflow-y: auto; padding: 12px 14px 24px; display: none; }
.view.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.card h2 {
  margin: 0 0 2px;
  font-size: 15px;
}
.card .subtitle {
  margin: 0 0 8px;
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.45;
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row + .row { margin-top: 8px; }

input[type="text"], input[type="number"], select, textarea {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  min-width: 0;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(47, 99, 231, 0.35);
  outline-offset: 0;
  border-color: var(--accent);
}
input.mono, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
input.invalid { border-color: var(--danger); }

/* ---------- Combo dropdowns (filterable selects) ---------- */
.combo { display: inline-block; position: relative; }
.combo-select { display: none; }
.combo-face {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.combo-face:hover { border-color: var(--accent); }
.combo-face:disabled { cursor: not-allowed; opacity: .58; border-color: var(--border); }
.combo-face .combo-value { overflow: hidden; text-overflow: ellipsis; }
.combo-caret { color: var(--text-dim); font-size: 9px; flex: none; }
.combo-popup {
  position: fixed;
  z-index: 1200;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(20, 30, 50, 0.18);
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow: hidden;
}
.combo-filter {
  flex: none;
  margin: 6px 6px 4px;
  font-size: 13px;
}
.combo-list { overflow-y: auto; padding-bottom: 4px; }
.combo-option {
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-option:hover, .combo-option.active { background: rgba(47, 99, 231, 0.14); }
.combo-option.current { font-weight: 700; }
.combo-empty { padding: 8px 10px; color: var(--text-dim); font-size: 12.5px; }

button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: #eceff4;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { background: #e1e6ef; }
button:active { background: #d3dbe8; }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); }
button.danger {
  background: rgba(211, 58, 58, 0.1);
  border-color: rgba(211, 58, 58, 0.45);
  color: var(--danger);
}
button.danger:hover { background: rgba(211, 58, 58, 0.18); }
button.small { padding: 3px 8px; font-size: 12px; }

.notice { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.notice.error { color: var(--danger); }
.notice.ok { color: var(--success); }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin: 8px 0; }
.stat {
  background: var(--sunken);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  min-width: 0;
}
.stat .value { font-size: 15px; font-weight: 700; white-space: nowrap; }
.stat .label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid;
  white-space: nowrap;
}
.badge.win, .badge.ongoing-win { color: var(--success); background: rgba(30,142,78,.12); border-color: rgba(30,142,78,.45); }
.badge.loss { color: var(--danger); background: rgba(211,58,58,.12); border-color: rgba(211,58,58,.45); }
.badge.error { color: var(--warning); background: rgba(181,119,20,.12); border-color: rgba(181,119,20,.45); }
.badge.ongoing { color: var(--accent); background: rgba(47,99,231,.12); border-color: rgba(47,99,231,.45); }
.badge.neutral { color: var(--text-dim); background: var(--sunken); border-color: var(--card-border); }
.badge.status-condition { color: var(--warning); background: rgba(181,119,20,.14); border-color: rgba(181,119,20,.5); }

/* ---------- Tables ---------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.data th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 4px 8px 4px 0;
  border-bottom: 1px solid var(--card-border);
}
table.data td {
  padding: 4px 8px 4px 0;
  border-bottom: 1px solid var(--sunken);
  vertical-align: top;
}
table.data tbody tr:nth-child(even) { background: var(--sunken); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: #e1e6ef; }
table.data tbody tr.selected { background: rgba(47,99,231,.14) !important; }
.table-scroll { max-height: 260px; overflow: auto; }
.red-results-table { max-height: 360px; scrollbar-gutter: stable; }
.red-config-lock { min-width: 0; margin: 0; padding: 0; border: 0; }
.red-prefix-list { margin-top: 8px; }
.red-prefix-row { margin: 4px 0; align-items: center; }
.red-prefix-action { min-width: 160px; }
.red-enumeration-note { margin-top: 8px !important; }
.red-run-controls, .red-output-row { margin-top: 10px; }
.red-active-workers {
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid rgba(47, 99, 231, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(47, 99, 231, 0.07);
}
.red-active-workers-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}
.red-active-workers-heading > strong {
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.red-active-workers-heading > span {
  color: var(--text-dim);
  font-size: 11px;
}
.red-worker-table-scroll {
  max-height: 176px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.red-worker-table { min-width: 720px; }
.red-worker-table th,
.red-worker-table td { padding-block: 3px !important; }
.red-worker-table thead th,
.red-turn-history-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3ff;
}
.red-turn-history-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 9px 0 4px;
  color: var(--text-dim);
  font-size: 11px;
}
.red-turn-history-heading > strong {
  color: var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.red-turn-history-scroll {
  max-height: 164px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.red-turn-history-table { min-width: 440px; }
.red-turn-history-table th,
.red-turn-history-table td { padding-block: 3px !important; }
.red-pruning-field { flex: 1 1 430px; max-width: 720px; }
.field > .red-pruning-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 12.5px;
  letter-spacing: normal;
  text-transform: none;
}
.red-pruning-toggle:has(input:disabled) { cursor: not-allowed; }
.red-pruning-help {
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.4;
}
.red-workers-empty { min-height: 24px; margin: 0; display: flex; align-items: center; }
.red-output-file { min-width: 220px; overflow-wrap: anywhere; }
.red-results-table table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
}
.red-pagebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-top: 6px;
}
.red-pagebar .notice { margin-top: 0; }
.red-results-state {
  min-height: 54px;
  display: flex;
  align-items: center;
}
@media (max-width: 720px) {
  .red-active-workers-heading,
  .red-turn-history-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
}

/* ---------- Progress ---------- */
.progress {
  height: 16px;
  background: var(--sunken);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  margin: 8px 0;
}
.progress > .fill { height: 100%; background: var(--accent); width: 0%; transition: width .15s; }
.progress > .text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 600; color: var(--text);
  mix-blend-mode: multiply;
}

/* ---------- HP bars ---------- */
.hpbar {
  height: 18px;
  background: var(--sunken);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  margin: 6px 0;
}
.hpbar > .fill { height: 100%; }
.hpbar > .fill.good { background: var(--success); }
.hpbar > .fill.mid { background: var(--warning); }
.hpbar > .fill.low { background: var(--danger); }
.hpbar > .text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; color: var(--text);
}

/* ---------- Trainer cards (manual view) ---------- */
.battle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trainer-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.trainer-head .side { font-size: 11px; font-weight: 700; }
.trainer-head .side.player { color: var(--accent); }
.trainer-head .side.enemy { color: var(--enemy); }
.trainer-head .species { font-size: 17px; font-weight: 700; }
.trainer-head .level { font-size: 12px; color: var(--text-dim); }
.trainer-head .badge { margin-left: auto; }
.trainer-meta { font-size: 11px; color: var(--text-dim); }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 10px; }
.action-grid button { white-space: normal; line-height: 1.25; padding: 8px 6px; }
.action-grid .pp { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-dim); }

/* ---------- Battle log ---------- */
.log-turn {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--sunken);
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.log-turn .turn-head {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  font-size: 11px; color: var(--text-dim); margin-bottom: 4px;
}
.log-turn .turn-head .turn-no { font-weight: 700; color: var(--text); font-size: 12.5px; }
.log-turn .side-line { margin: 2px 0; }
.log-turn .side-tag { font-weight: 700; font-size: 10.5px; margin-right: 6px; }
.log-turn .side-tag.player { color: var(--accent); }
.log-turn .side-tag.enemy { color: var(--enemy); }

/* ---------- Teams editor ---------- */
.subtabs { display: flex; gap: 4px; margin-bottom: 12px; }
.subtabs .tab { border: 1px solid var(--card-border); background: var(--card); }
.subtabs .tab.active { border-color: var(--accent); background: #eef2fd; color: var(--accent); }

.party-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.mon-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--sunken);
  padding: 10px;
}
.mon-card h3 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.mon-card h3 .remove { margin-left: auto; }
.stat6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.stat6 input { width: 100%; padding: 4px 4px; text-align: center; }
.stat6-labels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; font-size: 9.5px; color: var(--text-dim); text-align: center; text-transform: uppercase; }
.actual-stats output {
  display: block;
  padding: 5px 4px;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: flex; gap: 5px; align-items: center; font-size: 12.5px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  padding: 3px 4px 3px 8px; font-size: 12.5px;
}

/* ---------- Run data filter ---------- */
.dataset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}
.dataset-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 9px 11px;
  white-space: normal;
  text-align: left;
  overflow-wrap: anywhere;
}
.dataset-option span { color: var(--text-dim); font-size: 11px; font-weight: 400; }
.dataset-option.selected { background: rgba(47,99,231,.14); border-color: var(--accent); }
.cue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.cue-grid section {
  min-width: 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: var(--sunken);
}
.cue-grid h3 { margin: 0 0 6px; font-size: 12px; }
.cue-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 330px;
  overflow-y: auto;
}
.cue-option {
  width: 100%;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.cue-option.selected { background: var(--success); color: #fff; }

/* ---------- Live seed calibration ---------- */
.calibration-mode label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
}
.calibration-summary .stats { margin: 0; }
.calibration-side-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 170px;
}
.calibration-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.calibration-actions section {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--sunken);
}
.calibration-actions h3 { margin: 0 0 7px; font-size: 12px; }
.calibration-outcomes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 8px;
}
.calibration-outcome {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
  border: 1px solid var(--card-border);
}
.calibration-outcome:hover { border-color: var(--accent); background: rgba(47,99,231,.1); }
.outcome-count { color: var(--accent); font-size: 14px; font-weight: 700; }
.outcome-status { color: var(--text-dim); font-size: 11px; }
.calibration-candidate-table { max-height: 340px; margin-top: 10px; scrollbar-gutter: stable; }
.calibration-candidate-table td { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .cue-grid { grid-template-columns: 1fr; }
  .calibration-actions { grid-template-columns: 1fr; }
  .calibration-side-actions { flex-direction: row; width: 100%; }
  .stats { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { overflow-x: auto; }
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(27, 34, 48, 0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  width: 420px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(27, 34, 48, 0.25);
}
.modal h3 { margin: 0 0 10px; font-size: 15px; }
.modal .row { justify-content: flex-end; }
.modal textarea { width: 100%; min-height: 220px; resize: vertical; }

.directory-picker { display: flex; align-items: center; gap: 10px; min-width: min(680px, calc(100vw - 80px)); }
.directory-picker .mono { color: var(--text-dim); overflow-wrap: anywhere; }
.filter-open-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filter-identifier-modal {
  width: min(1100px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
}
.filter-identifier-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.filter-identifier-heading h3 { margin-bottom: 3px; }
.filter-identifier-toolbar { align-items: center; position: sticky; top: -16px; z-index: 2; background: var(--card); padding: 12px 0; }
.filter-event-search { display: flex; align-items: center; gap: 10px; margin: 8px 0 10px; font-size: 12px; font-weight: 600; }
.filter-event-search input { flex: 1; min-width: 160px; }
.filter-result-backdrop { z-index: 110; }
.filter-result-modal { width: min(1100px, calc(100vw - 40px)); max-height: calc(100vh - 40px); }
.filter-result-content h2 { margin: 0 0 4px; font-size: 17px; }
.filter-result-content .table-scroll { max-height: calc(100vh - 190px); }
.filter-result-content .event-cell { white-space: pre-line; min-width: 210px; }

/* ---------- Layout helpers ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hidden { display: none !important; }
.spacer { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important; /* accessibility override */
    transition-duration: 0.01ms !important; /* accessibility override */
    animation-duration: 0.01ms !important; /* accessibility override */
    animation-iteration-count: 1 !important; /* accessibility override */
  }
}

@media (forced-colors: active) {
  * { scrollbar-color: auto; }
}

/* Seed filter: column searches, candidate recovery, and route guidance. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-player-input {
  display: flex; flex-direction: column; gap: 5px; padding: 14px 18px; margin: 10px 0 14px;
  border: 1px solid var(--accent); border-left-width: 5px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 7%, var(--card)); overflow-wrap: anywhere;
}
.filter-player-input span { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.filter-player-input strong { display: block; font-size: 24px; line-height: 1.3; color: var(--accent); }
.filter-player-input small { font-size: 12px; }
.filter-column-search { position: relative; margin: 8px 0; }
.filter-column-search input { width: 100%; min-width: 0; padding: 8px 34px 8px 9px; border: 1px solid var(--card-border); border-radius: var(--radius-sm); background: var(--card); color: var(--text); font: inherit; }
.filter-column-search input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; right: 3px; top: 3px; padding: 3px 8px; font-size: 18px; line-height: 24px; }
.cue-grid section:first-child h3 { color: var(--accent); }
.cue-grid section:nth-child(2) h3 { color: var(--enemy); }
.cue-options { scrollbar-gutter: stable; }
.filter-identifier-toolbar { position: static; padding: 0; }
.filter-turn-navigation { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; }
.filter-turn-navigation button { min-height: 48px; padding: 10px 16px; font-size: 16px; font-weight: 600; }
.filter-turn-navigation strong { text-align: center; font-size: 15px; }
.filter-turn-navigation strong:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.filter-turn-help { margin: 6px 0 12px; font-size: 12px; color: var(--text-dim); }
.filter-dialog { width: 100%; height: 100%; max-width: none; max-height: none; border: 0; padding: 20px; margin: 0; color: var(--text); background: transparent; }
.filter-dialog::backdrop { background: rgba(27, 34, 48, 0.35); }
.filter-dialog .modal { display: flex; flex-direction: column; overflow: hidden; margin: 0; max-width: 100%; max-height: 100%; }
.filter-dialog .modal-body { min-height: 0; overflow: auto; scrollbar-gutter: stable; }
.filter-identifier-heading { flex-shrink: 0; }
.filter-result-content .table-scroll { max-height: min(440px, 52vh); scrollbar-gutter: stable; }
.route-table { min-width: 760px; width: 100%; }
.route-table thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.route-table .route-input { min-width: 200px; white-space: normal; overflow-wrap: anywhere; }
.candidate-table { max-height: 55vh; overflow: auto; scrollbar-gutter: stable; }
.candidate-table table { min-width: 440px; }
.candidate-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.candidate-pagination span { margin-right: auto; }
@media (max-width: 720px) {
  .filter-turn-navigation { gap: 8px; }
  .filter-turn-navigation button { padding: 10px 8px; font-size: 14px; }
  .filter-dialog { padding: 10px; }
  .filter-dialog .modal { width: 100%; padding: 12px; }
  .filter-open-card { flex-wrap: wrap; }
  .directory-picker { min-width: 0; flex-wrap: wrap; }
  .dataset-grid { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
}
@media (forced-colors: active) {
}

.route-table .route-start td { padding: 10px 0; background: var(--card); }
.route-start-note { padding: 9px 12px; border: 1px solid var(--card-border); border-radius: var(--radius-sm); background: var(--sunken); color: var(--text); font-weight: 600; }
