/* Azul acero: shared presentation tokens for clinical, account and admin pages. */
:root {
  color-scheme: light;
  --canvas: #F1F5FA;
  --surface: #FFFFFF;
  --surface-subtle: #F7F9FC;
  --surface-sunken: #EBF0F6;
  --surface-tint: #EDF3F9;
  --sidebar-surface: #E5ECF4;
  --ink: #182B42;
  --muted: #4A5E75;
  --brand: #244966;
  --brand-hover: #183B57;
  --on-brand: #FFFFFF;
  --secondary: #6995B7;
  --accent: #B18B45;
  --accent-ink: #77551C;
  --accent-soft: #F7EFDF;
  --selected: #DCE8F4;
  --hover-surface: #E7EFF7;
  --input-surface: #FFFFFF;
  --input-border: #71849B;
  --border: #D4DEE9;
  --focus: #936B29;
  --success: #215F43;
  --success-surface: #E8F4EC;
  --success-border: #9FC5AD;
  --warning: #765117;
  --warning-surface: #FFF4DB;
  --warning-border: #D5B271;
  --danger: #A23334;
  --danger-surface: #FCEEEE;
  --danger-border: #D8A3A3;
  --info-text: #244966;
  --info-surface: #EAF2FA;
  --info-border: #A8BED5;
  --wave-active: #244966;
  --wave-idle: #71849B;
  --overlay: #10223599;
  --viewer-shadow: #102235B3;
  --shadow-small: 0 2px 8px #182B4207;
  --shadow-dialog: 0 20px 70px #10223533;
  --danger-halo: #A233341A;
  --strong-action: #203B53;
  --on-strong-action: #FFFFFF;
  --document-paper: #FFFFFF;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #101923;
  --surface: #182534;
  --surface-subtle: #1D2D3F;
  --surface-sunken: #14202D;
  --surface-tint: #1D3044;
  --sidebar-surface: #14202D;
  --ink: #EAF1F8;
  --muted: #B3C3D4;
  --brand: #8DBCE3;
  --brand-hover: #AED2EF;
  --on-brand: #102235;
  --secondary: #81A6C7;
  --accent: #E2B66A;
  --accent-ink: #F2CE8E;
  --accent-soft: #403521;
  --selected: #223D56;
  --hover-surface: #24374A;
  --input-surface: #122030;
  --input-border: #667F97;
  --border: #334A61;
  --focus: #E2B66A;
  --success: #A7DDB8;
  --success-surface: #18392B;
  --success-border: #4F8063;
  --warning: #F0CF8C;
  --warning-surface: #3A3020;
  --warning-border: #987B49;
  --danger: #FFB9B9;
  --danger-surface: #42272F;
  --danger-border: #AE6B78;
  --info-text: #C0DCF4;
  --info-surface: #1D334A;
  --info-border: #597D9E;
  --wave-active: #8DBCE3;
  --wave-idle: #8DA5BC;
  --overlay: #030A15B8;
  --viewer-shadow: #030A15D6;
  --shadow-small: 0 2px 8px #00000014;
  --shadow-dialog: 0 20px 70px #00000066;
  --danger-halo: #FFB9B91A;
  --strong-action: #314C67;
  --on-strong-action: #F1F6FB;
  --document-paper: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
  color-scheme: dark;
  --canvas: #101923;
  --surface: #182534;
  --surface-subtle: #1D2D3F;
  --surface-sunken: #14202D;
  --surface-tint: #1D3044;
  --sidebar-surface: #14202D;
  --ink: #EAF1F8;
  --muted: #B3C3D4;
  --brand: #8DBCE3;
  --brand-hover: #AED2EF;
  --on-brand: #102235;
  --secondary: #81A6C7;
  --accent: #E2B66A;
  --accent-ink: #F2CE8E;
  --accent-soft: #403521;
  --selected: #223D56;
  --hover-surface: #24374A;
  --input-surface: #122030;
  --input-border: #667F97;
  --border: #334A61;
  --focus: #E2B66A;
  --success: #A7DDB8;
  --success-surface: #18392B;
  --success-border: #4F8063;
  --warning: #F0CF8C;
  --warning-surface: #3A3020;
  --warning-border: #987B49;
  --danger: #FFB9B9;
  --danger-surface: #42272F;
  --danger-border: #AE6B78;
  --info-text: #C0DCF4;
  --info-surface: #1D334A;
  --info-border: #597D9E;
  --wave-active: #8DBCE3;
  --wave-idle: #8DA5BC;
  --overlay: #030A15B8;
  --viewer-shadow: #030A15D6;
  --shadow-small: 0 2px 8px #00000014;
  --shadow-dialog: 0 20px 70px #00000066;
  --danger-halo: #FFB9B91A;
  --strong-action: #314C67;
  --on-strong-action: #F1F6FB;
  --document-paper: #FFFFFF;
}
}

/* Both logo variants are real transparent artwork, never recoloured with filters. */
:root img.appearance-logo-dark { display: none; }
:root[data-theme="dark"] img.appearance-logo-light { display: none; }
:root[data-theme="dark"] img.appearance-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) img.appearance-logo-light { display: none; }
  :root:not([data-theme]) img.appearance-logo-dark { display: block; }
}
/* Three explicit choices; SVG icons remain small while the whole button is tappable. */
.appearance-control {
  display: inline-flex; align-items: center; gap: 3px; padding: 4px;
  width: max-content; max-width: 100%; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-sunken); color: var(--muted);
}
.appearance-control .appearance-option {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 36px; width: 36px; height: 36px; min-height: 36px;
  margin: 0; padding: 0; border: 1px solid transparent; border-radius: 50%;
  color: var(--muted); background: transparent; box-shadow: none; cursor: pointer;
}
.appearance-option svg { width: 18px; height: 18px; pointer-events: none; }
.appearance-control .appearance-option:hover { color: var(--ink); background: var(--hover-surface); }
.appearance-control .appearance-option[aria-checked="true"] {
  color: var(--brand); background: var(--surface); border-color: var(--input-border);
  box-shadow: var(--shadow-small);
}
.appearance-control .appearance-option:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (pointer: coarse) {
  .appearance-control .appearance-option { flex-basis: 44px; width: 44px; height: 44px; min-height: 44px; }
}

/* Printed clinical documents retain a light, high-contrast presentation. */
@media print {
  :root, :root[data-theme] {
  color-scheme: light;
  --canvas: #F1F5FA;
  --surface: #FFFFFF;
  --surface-subtle: #F7F9FC;
  --surface-sunken: #EBF0F6;
  --surface-tint: #EDF3F9;
  --sidebar-surface: #E5ECF4;
  --ink: #182B42;
  --muted: #4A5E75;
  --brand: #244966;
  --brand-hover: #183B57;
  --on-brand: #FFFFFF;
  --secondary: #6995B7;
  --accent: #B18B45;
  --accent-ink: #77551C;
  --accent-soft: #F7EFDF;
  --selected: #DCE8F4;
  --hover-surface: #E7EFF7;
  --input-surface: #FFFFFF;
  --input-border: #71849B;
  --border: #D4DEE9;
  --focus: #936B29;
  --success: #215F43;
  --success-surface: #E8F4EC;
  --success-border: #9FC5AD;
  --warning: #765117;
  --warning-surface: #FFF4DB;
  --warning-border: #D5B271;
  --danger: #A23334;
  --danger-surface: #FCEEEE;
  --danger-border: #D8A3A3;
  --info-text: #244966;
  --info-surface: #EAF2FA;
  --info-border: #A8BED5;
  --wave-active: #244966;
  --wave-idle: #71849B;
  --overlay: #10223599;
  --viewer-shadow: #102235B3;
  --shadow-small: 0 2px 8px #182B4207;
  --shadow-dialog: 0 20px 70px #10223533;
  --danger-halo: #A233341A;
  --strong-action: #203B53;
  --on-strong-action: #FFFFFF;
  --document-paper: #FFFFFF;
}
  img.appearance-logo-light { display: block !important; }
  img.appearance-logo-dark, .appearance-control { display: none !important; }
}
