/*! AppVitamins Theme v1 — LIGHT is the default; dark is opt-in via the toggle.
    Loaded AFTER each app's own inline <style>, so these :root values win by source order.
    Every token-name variant used anywhere in the fleet is mapped, because apps were written
    by different generations of the builder (--acc1/--accent/--a1, --sec/--muted/--text2, …).
    Non-colour tokens (--radius, --font) are deliberately NOT touched. */

:root {
  color-scheme: light;
  /* surfaces */
  --bg:#F3FBFA; --bg2:#FFFFFF; --bg-2:#FFFFFF;
  --card:#FFFFFF; --card2:#EAF7F5; --card-2:#EAF7F5; --panel:#EAF7F5; --surface:#FFFFFF;
  /* text */
  --text:#102A2C; --tx:#102A2C;
  --sec:#47666A; --text2:#47666A; --text-2:#47666A; --secondary:#47666A;
  --sub:#47666A; --dim:#5A7276; --muted:#496568; --text-muted:#496568;
  /* lines */
  --border:#C9E5E0; --bd:#C9E5E0; --line:#C9E5E0;
  /* accents — darker teal so text/icons keep AA contrast on light surfaces */
  --accent:#07736D; --acc1:#07736D; --accent1:#07736D; --accent-1:#07736D;
  --ac1:#07736D; --a1:#07736D; --accent-start:#07736D; --primary:#07736D;
  --accent2:#2BA99E; --acc2:#2BA99E; --accent-2:#2BA99E; --ac2:#2BA99E;
  --a2:#2BA99E; --accent-end:#2BA99E;
  --grad:linear-gradient(135deg,#087F78,#2BA99E);
  --cyan:#0E8A90;
  /* status — darkened for light backgrounds */
  --good:#147A56; --success:#147A56; --green:#147A56; --ok:#147A56;
  --bad:#B83939; --error:#B83939; --danger:#B83939; --red:#B83939;
  --warn:#986511; --amber:#986511; --gold:#8A6508; --yellow:#8A6508; --sun:#B35C12;
  --info:#0E6FA8; --purple:#6D4AC4;
  /* button surface tokens (fleet-wide convention) */
  --button:#07736D; --button-hover:#055F5A; --button-text:#FFFFFF;
  --button-disabled:#496568; --button-disabled-text:#FFFFFF;
  --shadow:0 8px 30px rgba(16,42,44,.10);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:#071C20; --bg2:#0B252A; --bg-2:#0B252A;
  --card:#103138; --card2:#123B42; --card-2:#123B42; --panel:#123B42; --surface:#103138;
  --text:#ECFFFB; --tx:#ECFFFB;
  --sec:#A9C9C7; --text2:#A9C9C7; --text-2:#A9C9C7; --secondary:#A9C9C7;
  --sub:#A9C9C7; --dim:#8FAFAD; --muted:#91B4B1; --text-muted:#91B4B1;
  --border:#24515A; --bd:#24515A; --line:#24515A;
  --accent:#48D5C7; --acc1:#48D5C7; --accent1:#48D5C7; --accent-1:#48D5C7;
  --ac1:#48D5C7; --a1:#48D5C7; --accent-start:#48D5C7; --primary:#48D5C7;
  --accent2:#20A89C; --acc2:#20A89C; --accent-2:#20A89C; --ac2:#20A89C;
  --a2:#20A89C; --accent-end:#20A89C;
  --grad:linear-gradient(135deg,#48D5C7,#20A89C);
  --cyan:#19D3DA;
  --good:#34D399; --success:#34D399; --green:#34D399; --ok:#2BD9B0;
  --bad:#FF9A9A; --error:#FF9A9A; --danger:#FF9A9A; --red:#FF9A9A;
  --warn:#FBBF24; --amber:#FFB054; --gold:#F6C453; --yellow:#F5C842; --sun:#FF8A3D;
  --info:#56CCF2; --purple:#C4B5FD;
  --button:#48D5C7; --button-hover:#65E1D5; --button-text:#071C20;
  --button-disabled:#91B4B1; --button-disabled-text:#071C20;
  --shadow:0 8px 30px rgba(0,0,0,.35);
}

/* Body ground: many apps paint a dark radial behind the page. Re-derive it from the
   live tokens so it follows the theme instead of staying navy in light mode. */
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent2, #2BA99E) 16%, var(--bg)) 0%, var(--bg) 55%) fixed,
    var(--bg);
  color: var(--text);
}

/* Floating theme toggle injected by av-theme.js (apps that ship their own
   [data-av-theme-toggle] button keep theirs — this one is only added when absent). */
.av-theme-fab {
  position: fixed; right: 14px; bottom: 14px; z-index: 2147483000;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border-radius: 999px; cursor: pointer; font-size: 19px; line-height: 1;
  display: grid; place-items: center; padding: 0;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); box-shadow: 0 6px 20px rgba(16,42,44,.18);
  transition: transform .12s ease, filter .15s ease;
}
.av-theme-fab:hover { filter: brightness(1.06); transform: translateY(-1px); }
.av-theme-fab:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media print { .av-theme-fab { display: none !important; } }
