/* Preferencias locales compartidas por la cabecera y todos los recorridos. */
.topbar .top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.appearance-control { position: relative; display: flex; margin-left: auto; }
.top-actions #sarModeButton { min-width: 8rem; min-height: 44px; white-space: nowrap; font-size: .76rem; }
.top-actions .appearance-button { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; min-width: 44px; height: 44px; padding: 9px; }
.appearance-button .guide-icon { width: 24px; height: 24px; }
.appearance-panel {
  position: fixed; z-index: 30;
  width: min(352px, calc(100vw - 28px)); max-height: min(720px, calc(100dvh - 108px));
  overflow: auto; overscroll-behavior: contain; padding: 20px;
  border: 1px solid var(--color-border-control); border-radius: 12px;
  background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow);
  text-align: left; font-size: .85rem; line-height: 1.45;
}
.appearance-panel[hidden], .top-actions > [hidden] { display: none !important; }
.appearance-panel h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.appearance-intro { margin: 4px 0 18px; color: var(--color-text-muted); font-size: .78rem; }
.appearance-panel fieldset { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.appearance-panel legend { margin-bottom: 8px; padding: 0; font-size: .8rem; font-weight: 650; }
.appearance-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.appearance-options label {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 68px; padding: 8px 3px; border: 1px solid var(--color-border-subtle); border-radius: 7px;
  background: var(--color-surface); color: var(--color-text); font-size: .8rem; cursor: pointer;
}
.appearance-options label:hover { background: var(--color-surface-subtle); border-color: var(--color-action); }
.appearance-options label:has(input:checked) { border-color: var(--color-link); background: var(--color-info-soft); box-shadow: inset 0 0 0 1px var(--color-link); font-weight: 700; }
.appearance-options label:has(input:checked)::after { content: ""; position: absolute; right: 7px; top: 6px; width: 5px; height: 9px; border: solid var(--color-link); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.appearance-options input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.appearance-options label:has(input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.appearance-options svg, .appearance-switch-row > svg { flex-shrink: 0; width: 21px; height: 21px; color: var(--color-link); }
.appearance-sample { display: flex; align-items: center; height: 25px; font-weight: 650; line-height: 1; }
.appearance-size-options label:nth-child(1) .appearance-sample { font-size: 16px; }
.appearance-size-options label:nth-child(2) .appearance-sample { font-size: 19px; }
.appearance-size-options label:nth-child(3) .appearance-sample { font-size: 22px; }
.appearance-switch-row { display: flex; align-items: center; gap: 10px; padding: 14px 0; border-top: 1px solid var(--color-border-subtle); cursor: pointer; }
.appearance-switch-row > span { flex: 1; min-width: 0; }
.appearance-switch-row strong { display: block; font-size: .8rem; font-weight: 650; }
.appearance-switch-row small { display: block; margin-top: 3px; color: var(--color-text-muted); font-size: .8rem; line-height: 1.4; }
.appearance-switch-row input {
  appearance: none; position: relative; flex: 0 0 36px; width: 36px; height: 22px; margin: 0;
  padding: 2px; border: 1px solid var(--color-border-control); border-radius: 999px;
  background: var(--color-surface-subtle); cursor: pointer;
}
.appearance-switch-row input::before { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--color-text-muted); }
.appearance-switch-row input:checked { border-color: var(--color-action); background: var(--color-action); }
.appearance-switch-row input:checked::before { transform: translateX(14px); background: var(--color-on-action); }
.appearance-switch-row input:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.appearance-motion-note { margin: -5px 0 14px 31px; color: var(--color-text-muted); font-size: .75rem; }
.top-actions .appearance-reset { width: 100%; padding: 10px; border: 1px solid var(--color-border-control); border-radius: 7px; background: var(--color-surface); color: var(--color-text); font-size: .77rem; }
.top-actions .appearance-reset:hover { border-color: var(--color-link); background: var(--color-surface-subtle); }
.appearance-save-status { margin: 12px 0 0; color: var(--color-text-muted); font-size: .75rem; line-height: 1.4; }

html[data-contrast="high"] {
  --ink: var(--color-text);
  --muted: var(--color-text-muted);
  --line: var(--color-border-subtle);
  --control-line: var(--color-border-control);
  --surface: var(--color-surface);
  --canvas: var(--color-canvas);
  --field: var(--color-surface);
  --field-hover: var(--color-surface-subtle);
  --speech: var(--color-info-soft);
  --section: var(--color-surface-subtle);
  --teal: var(--color-action);
  --teal-dark: var(--color-link);
  --focus: var(--color-focus);
  --color-canvas: #ffffff;
  --color-surface: #ffffff;
  --color-surface-subtle: #e4eaf0;
  --color-text: #07151e;
  --color-text-muted: #172b39;
  --color-border-subtle: #344c5c;
  --color-border-control: #172b39;
  --color-action: #005b8e;
  --color-action-hover: #003b5e;
  --color-link: #004b78;
  --color-focus: #004b78;
}
html[data-theme="dark"][data-contrast="high"] {
  --color-canvas: #080e13;
  --color-surface: #101b24;
  --color-surface-subtle: #203440;
  --color-text: #ffffff;
  --color-text-muted: #e1eaf1;
  --color-border-subtle: #9db4c4;
  --color-border-control: #c1d3df;
  --color-action: #006ea8;
  --color-action-hover: #005e93;
  --color-link: #b1dfff;
  --color-focus: #b1dfff;
}
html[data-contrast="high"] .validation-flow { --line: var(--color-border-subtle); }
html[data-contrast="high"] :is(button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }

html[data-reduced-motion="true"], html[data-reduced-motion="true"] *, html[data-reduced-motion="true"] *::before, html[data-reduced-motion="true"] *::after {
  scroll-behavior: auto !important; transition: none !important; animation: none !important;
}
html[data-reduced-motion="true"] .mode-card:hover, html[data-reduced-motion="true"] .mode-card:focus-visible { transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-reduced-motion]), html:not([data-reduced-motion]) *, html:not([data-reduced-motion]) *::before, html:not([data-reduced-motion]) *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (max-width: 980px) {
  html[data-theme] .topbar { flex-wrap: wrap; }
  .topbar .top-actions { max-width: none; margin-left: auto; }
}
@media (max-width: 600px) {
  .topbar .top-actions { width: auto; max-width: 100%; }
}
@media print { .appearance-control { display: none !important; } }
