/* MedLife design tokens: one palette for every public page, light and dark.
   Theme: <html data-theme="light|dark">; without the attribute the OS preference wins
   (set early by /static/js/theme-init.js, toggled by /static/js/theme.js). */
:root {
  color-scheme: light;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --surface-3: #e9edf1;
  --img-well: #f3f5f7;
  --text: #0f1720;
  --text2: #4a5563;
  --text3: #5d6875;
  --border: #e4e8ec;
  --border2: #cdd4db;
  --field-border: #8e98a3;
  --accent: #0d6e8a;
  --accent-h: #0a5a71;
  --accent-lt: #e6f2f5;
  --accent-text: #0b6480;
  --on-accent: #ffffff;
  --warm: #d9573b;
  --warm-lt: #fdeee9;
  --focus: #155eef;
  --header-bg: rgba(255, 255, 255, .92);
  --band: #f4f6f8;
  --band-text: #4a5563;
  --band-title: #0f1720;
  --band-muted: #5d6875;
  --band-line: #e4e8ec;
  --band-accent: #0d6e8a;
  --ok-bg: #e7f2ea; --ok-bd: #c6dfcd; --ok-fg: #276237;
  --warn-bg: #fbf0dd; --warn-bd: #ead2a3; --warn-fg: #7a5208;
  --bad-bg: #f9e8e8; --bad-bd: #e8c5c5; --bad-fg: #962f2f;
  --star: #b7791f;
  --overlay: rgba(15, 23, 32, .5);
  --shadow-sm: 0 1px 2px rgba(15, 23, 32, .06);
  --shadow: 0 1px 3px rgba(15, 23, 32, .06), 0 12px 32px rgba(15, 23, 32, .08);
  --shadow-lg: 0 24px 64px rgba(15, 23, 32, .2);
  --r: 14px;
  --r-sm: 10px;

  /* legacy names used by store and contact styles */
  --bg2: var(--surface-2);
  --bg3: var(--surface-3);
  --card: var(--surface);
  --card2: var(--surface-2);
  --green: var(--ok-fg);
  --amber: var(--warn-fg);
  --red: #a83232;
  --accent-h2: var(--accent-h);
  /* names used by server-rendered pages (site-shell.css) */
  --ml-bg: var(--bg);
  --ml-card: var(--surface);
  --ml-soft: var(--surface-2);
  --ml-accent: var(--accent);
  --ml-accent-h: var(--accent-h);
  --ml-accent-lt: var(--accent-lt);
  --ml-dark: var(--band);
  --ml-text: var(--text);
  --ml-text2: var(--text2);
  --ml-border: var(--border);
  --ml-border2: var(--border2);
  --ml-amber: var(--warn-fg);
  --ml-red: var(--red);
  --ml-focus: var(--focus);
  --ml-shadow: var(--shadow);
  --ml-r: var(--r-sm);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131719;
    --surface: #1a1f22;
    --surface-2: #20262a;
    --surface-3: #283035;
    --img-well: #c4cbd0;
    --text: #e6eaec;
    --text2: #a9b3b8;
    --text3: #939ea4;
    --border: #2a3237;
    --border2: #3a444a;
    --field-border: #5f6b76;
    --accent: #1f7f99;
    --accent-h: #2690ac;
    --accent-lt: rgba(38, 144, 172, .16);
    --accent-text: #79c3d8;
    --on-accent: #ffffff;
    --warm: #f08a6e;
    --warm-lt: rgba(240, 138, 110, .14);
    --focus: #8ab4ff;
    --header-bg: rgba(26, 31, 34, .92);
    --band: #161a1d;
    --band-text: #a9b3b8;
    --band-title: #e6eaec;
    --band-muted: #8f9aa4;
    --band-line: #262d31;
    --band-accent: #79c3d8;
    --ok-bg: rgba(110, 200, 140, .13); --ok-bd: rgba(110, 200, 140, .3); --ok-fg: #8fd6a6;
    --warn-bg: rgba(230, 175, 80, .13); --warn-bd: rgba(230, 175, 80, .3); --warn-fg: #efc57c;
    --bad-bg: rgba(235, 110, 110, .13); --bad-bd: rgba(235, 110, 110, .3); --bad-fg: #f2a3a3;
    --star: #f0b85a;
    --red: #f08a8a;
    --overlay: rgba(0, 0, 0, .6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131719;
  --surface: #1a1f22;
  --surface-2: #20262a;
  --surface-3: #283035;
  --img-well: #c4cbd0;
  --text: #e6eaec;
  --text2: #a9b3b8;
  --text3: #939ea4;
  --border: #2a3237;
  --border2: #3a444a;
  --field-border: #5f6b76;
  --accent: #1f7f99;
  --accent-h: #2690ac;
  --accent-lt: rgba(38, 144, 172, .16);
  --accent-text: #79c3d8;
  --on-accent: #ffffff;
  --warm: #f08a6e;
  --warm-lt: rgba(240, 138, 110, .14);
  --focus: #8ab4ff;
  --header-bg: rgba(26, 31, 34, .92);
  --band: #161a1d;
  --band-text: #a9b3b8;
  --band-title: #e6eaec;
  --band-muted: #8f9aa4;
  --band-line: #262d31;
  --band-accent: #79c3d8;
  --ok-bg: rgba(110, 200, 140, .13); --ok-bd: rgba(110, 200, 140, .3); --ok-fg: #8fd6a6;
  --warn-bg: rgba(230, 175, 80, .13); --warn-bd: rgba(230, 175, 80, .3); --warn-fg: #efc57c;
  --bad-bg: rgba(235, 110, 110, .13); --bad-bd: rgba(235, 110, 110, .3); --bad-fg: #f2a3a3;
  --star: #f0b85a;
  --red: #f08a8a;
  --overlay: rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
}

@media (prefers-contrast: more) {
  :root { --border: #8d9994; --border2: #69766f; --text2: #31403a; --text3: #46534d; }
}

/* Theme toggle button (shared by store header and server-rendered header) */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0;
  border: 1px solid var(--border2); border-radius: var(--r-sm);
  background: transparent; color: var(--text2); cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
