/* ============================================================
   themes.css — 5 colour themes the user can choose (2026-11-21)
   ------------------------------------------------------------
   Account menu → "🎨 Theme". Saved on each device.
     clinic   Standard       (the original look — no overrides)
     navy     Navy Dark      (the whole app dark — dark.css)
     teal     Clinical Teal  (calm healthcare teal)
     graphite Graphite       (charcoal sidebar, indigo)
     stone    Sand & Slate   (warm neutral, slate blue)
   (2026-11-22: Warm Sunset → Sand & Slate, Lavender → Standard)
   Loaded AFTER style.css, theme.css, responsive.css.
   Only colours / corners / title font change — layouts and
   therapy screens stay exactly the same.
   ============================================================ */

/* ---------- 1. Theme tokens ---------- */
/* Clinical Teal — calm healthcare teal, cool greys, crisp corners */
html[data-theme="teal"] {
  --accent: #0f766e; --accent-hover: #0b5f59; --accent-soft: #e1f2ef; --accent-ring: rgba(15, 118, 110, 0.26); --accent-2: #14968a;
  --bg: #eef4f3; --bg-subtle: #f5f9f8; --border: #cad9d6; --border-light: #dde8e6;
  --text-primary: #10201e; --text-secondary: #4a5c59; --text-tertiary: #7d8f8c;
  --radius-sm: 7px; --radius: 10px; --radius-lg: 14px;
  --t-blue: #0f766e; --t-blue-bg: #e1f2ef;
}
/* Graphite — charcoal menu, indigo accents, sharp and modern */
html[data-theme="graphite"] {
  --accent: #4f46e5; --accent-hover: #4338ca; --accent-soft: #eceefe; --accent-ring: rgba(79, 70, 229, 0.26); --accent-2: #6366f1;
  --bg: #f1f2f4; --bg-subtle: #f7f8f9; --border: #d3d6dc; --border-light: #e3e5e9;
  --text-primary: #111827; --text-secondary: #4b5563; --text-tertiary: #7f8794;
  --radius-sm: 6px; --radius: 9px; --radius-lg: 12px;
  --t-blue: #4f46e5; --t-blue-bg: #eceefe;
}
/* Sand & Slate — warm paper background, slate-blue accents, quiet and formal */
html[data-theme="stone"] {
  --accent: #3d5c7c; --accent-hover: #314b66; --accent-soft: #e7edf3; --accent-ring: rgba(61, 92, 124, 0.26); --accent-2: #56799c;
  --bg: #f4f1ec; --bg-subtle: #f9f7f3; --border: #dbd3c7; --border-light: #e9e3da;
  --text-primary: #23201c; --text-secondary: #5f584e; --text-tertiary: #938a7e;
  --radius-sm: 8px; --radius: 12px; --radius-lg: 16px;
  --t-blue: #3d5c7c; --t-blue-bg: #e7edf3;
}
html[data-theme="navy"] {
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-soft: #e8eefc; --accent-ring: rgba(37, 99, 235, 0.28); --accent-2: #4f8df5;
  --bg: #eef1f5; --bg-subtle: #f6f8fa; --border: #d2d8e1; --border-light: #e2e7ee;
  --text-primary: #0f172a; --text-secondary: #4b5567; --text-tertiary: #7c8799;
  --radius-sm: 6px; --radius: 8px; --radius-lg: 11px;
  --t-blue: #2563eb; --t-blue-bg: #e8eefc;
}

/* ---------- 2. Places where the blue was written directly ---------- */
html[data-theme] body { background: var(--bg); }
html[data-theme] .ca-start { background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%); box-shadow: 0 2px 6px var(--accent-ring), inset 0 1px 0 rgba(255,255,255,0.18); }
html[data-theme] .ca-start:hover { box-shadow: 0 6px 14px var(--accent-ring); }
html[data-theme] .btn-primary, html[data-theme] .btn-small.btn-primary, html[data-theme] .appdlg-ok { box-shadow: 0 1px 2px var(--accent-ring); }
html[data-theme] .btn-primary:hover { box-shadow: 0 2px 8px var(--accent-ring); }
html[data-theme] .acct-avatar { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
html[data-theme] .ag-tile { border-left-color: var(--accent); }
html[data-theme] .ag-tile.ag-done { border-left-color: #16a34a; }
html[data-theme] .ag-tile.ag-next { border-left-color: #f59e0b; }
html[data-theme] .ag-tile.ag-sms { border-left-color: #8b5cf6; }
html[data-theme] .ag-st.up { background: var(--accent-soft); color: var(--accent-hover); }
html[data-theme] .workspace-switcher .btn-small.btn-primary { border-color: var(--border); }
html[data-theme] input[type="checkbox"], html[data-theme] input[type="radio"], html[data-theme] input[type="range"] { accent-color: var(--accent) !important; }

/* inline styles in the screens that used the old blue (#0071e3) */
html[data-theme] [style^="color: #0071e3"], html[data-theme] [style^="color:#0071e3"],
html[data-theme] [style*=" color: #0071e3"], html[data-theme] [style*=";color:#0071e3"], html[data-theme] [style*="; color:#0071e3"],
html[data-theme] [style^="color: rgb(0, 113, 227)"], html[data-theme] [style*=" color: rgb(0, 113, 227)"] { color: var(--accent) !important; }
html[data-theme] [style*="background: #0071e3"], html[data-theme] [style*="background:#0071e3"], html[data-theme] [style*="background-color: #0071e3"],
html[data-theme] [style*="background: rgb(0, 113, 227)"], html[data-theme] [style*="background-color: rgb(0, 113, 227)"] { background: var(--accent) !important; }
html[data-theme] [style*="border-color: #0071e3"], html[data-theme] [style*="solid #0071e3"],
html[data-theme] [style*="border-color: rgb(0, 113, 227)"], html[data-theme] [style*="solid rgb(0, 113, 227)"] { border-color: var(--accent) !important; }
html[data-theme] [style*="border-left-color: #0071e3"] { border-left-color: var(--accent) !important; }
html[data-theme] [style*="background: #e8f2fd"], html[data-theme] [style*="background:#e8f2fd"],
html[data-theme] [style*="background: rgb(232, 242, 253)"], html[data-theme] [style*="background-color: rgb(232, 242, 253)"] { background: var(--accent-soft) !important; }

/* ---------- 3. Light themes: sidebar tint ---------- */
html[data-theme="teal"] .sidebar { background: #f7fbfa !important; }
html[data-theme="teal"] .nav-item:hover, html[data-theme="teal"] .acct-chip:hover { background: #e8f1ef; }
html[data-theme="stone"] .sidebar { background: #faf8f4 !important; border-right-color: #e6dfd4 !important; }
html[data-theme="stone"] .nav-item:hover, html[data-theme="stone"] .acct-chip:hover { background: #f1ece4; }
html[data-theme="stone"] h1 { letter-spacing: -0.015em; }

/* ---------- 4. Navy Pro: dark sidebar ---------- */
html[data-theme="navy"] .sidebar { background: #0f1b2d !important; border-right-color: #0f1b2d !important; color: #e6ecf5; }
html[data-theme="navy"] .sidebar-brand { border-bottom-color: rgba(255,255,255,0.08); }
html[data-theme="navy"] .sidebar-footer { border-top-color: rgba(255,255,255,0.08); }
html[data-theme="navy"] .nav-item { color: #b8c4d6; }
html[data-theme="navy"] .nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
html[data-theme="navy"] .nav-item.active { background: rgba(79,141,245,0.20); color: #fff; }
html[data-theme="navy"] .nav-item.active::before { background: #60a5fa; }
html[data-theme="navy"] .workspace-switcher { border-bottom-color: rgba(255,255,255,0.08); }
html[data-theme="navy"] .workspace-switcher label { color: #8193ad; }
html[data-theme="navy"] .workspace-switcher select {
  color: #e6ecf5; border-color: #2a3a55;
  background: #1a2840 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b8c4d6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
}
html[data-theme="navy"] .workspace-switcher select option { color: #0f172a; background: #fff; }
html[data-theme="navy"] .workspace-switcher .btn-small.btn-primary { color: #93c5fd; border-color: #3a4d6b; background: transparent; }
html[data-theme="navy"] .workspace-switcher .btn-small.btn-primary:hover { background: rgba(255,255,255,0.06); }
html[data-theme="navy"] .acct-chip { color: #fff; }
html[data-theme="navy"] .acct-chip:hover, html[data-theme="navy"] .acct-chip[aria-expanded="true"] { background: rgba(255,255,255,0.07); }
html[data-theme="navy"] .acct-role, html[data-theme="navy"] .acct-caret { color: #8193ad; }
html[data-theme="navy"] .acct-icon-btn { background: transparent; border-color: #2a3a55; color: #b8c4d6; }
html[data-theme="navy"] .acct-icon-btn:hover { background: rgba(255,255,255,0.07); color: #fff; }
html[data-theme="navy"] .acct-menu { color: var(--text-primary); }
html[data-theme="navy"] .sidebar .sidebar-brand img { box-shadow: 0 0 0 1px rgba(255,255,255,0.08); }

/* ---------- 4b. Graphite: charcoal sidebar ---------- */
html[data-theme="graphite"] .sidebar { background: #181b21 !important; border-right-color: #181b21 !important; color: #eceef2; }
html[data-theme="graphite"] .sidebar-brand { border-bottom-color: rgba(255,255,255,0.08); }
html[data-theme="graphite"] .sidebar-footer { border-top-color: rgba(255,255,255,0.08); }
html[data-theme="graphite"] .nav-item { color: #b4bac5; }
html[data-theme="graphite"] .nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
html[data-theme="graphite"] .nav-item.active { background: rgba(129,140,248,0.20); color: #fff; }
html[data-theme="graphite"] .nav-item.active::before { background: #818cf8; }
html[data-theme="graphite"] .workspace-switcher { border-bottom-color: rgba(255,255,255,0.08); }
html[data-theme="graphite"] .workspace-switcher label { color: #868d99; }
html[data-theme="graphite"] .workspace-switcher select {
  color: #eceef2; border-color: #2f343d;
  background: #22262e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b4bac5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
}
html[data-theme="graphite"] .workspace-switcher select option { color: #0f172a; background: #fff; }
html[data-theme="graphite"] .workspace-switcher .btn-small.btn-primary { color: #a5b4fc; border-color: #3a404b; background: transparent; }
html[data-theme="graphite"] .workspace-switcher .btn-small.btn-primary:hover { background: rgba(255,255,255,0.06); }
html[data-theme="graphite"] .acct-chip { color: #fff; }
html[data-theme="graphite"] .acct-chip:hover, html[data-theme="graphite"] .acct-chip[aria-expanded="true"] { background: rgba(255,255,255,0.07); }
html[data-theme="graphite"] .acct-role, html[data-theme="graphite"] .acct-caret { color: #868d99; }
html[data-theme="graphite"] .acct-icon-btn { background: transparent; border-color: #2f343d; color: #b4bac5; }
html[data-theme="graphite"] .acct-icon-btn:hover { background: rgba(255,255,255,0.07); color: #fff; }
html[data-theme="graphite"] .acct-menu { color: var(--text-primary); }
html[data-theme="graphite"] .sidebar .sidebar-brand img { box-shadow: 0 0 0 1px rgba(255,255,255,0.08); }

/* ---------- 5. The theme picker window ---------- */
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 6px 0 4px; }
.th-card { position: relative; border: 2px solid var(--border-light); border-radius: 14px; padding: 0; background: #fff; cursor: pointer; text-align: left; font: inherit; overflow: hidden; transition: border-color .12s, transform .12s, box-shadow .12s; }
.th-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.th-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.th-card.on::after { content: "✓"; position: absolute; top: 7px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.th-prev { display: grid; grid-template-columns: 30% 1fr; height: 86px; }
.th-prev .sb { padding: 8px 6px; display: flex; flex-direction: column; gap: 5px; }
.th-prev .sb i { display: block; height: 6px; border-radius: 3px; opacity: .55; }
.th-prev .sb i.a { opacity: 1; }
.th-prev .mn { padding: 9px 8px; display: flex; flex-direction: column; gap: 6px; }
.th-prev .mn .t { height: 8px; width: 60%; border-radius: 4px; background: #2b2f36; opacity: .8; }
.th-prev .mn .r { height: 16px; border-radius: 5px; background: #fff; border: 1px solid rgba(0,0,0,.07); display: flex; align-items: center; justify-content: flex-end; padding: 0 3px; }
.th-prev .mn .r b { display: block; width: 26px; height: 9px; border-radius: 3px; }
.th-name { padding: 8px 11px 10px; border-top: 1px solid var(--border-light); min-height: 62px; }
.th-name strong { display: block; font-size: 14px; color: var(--text-primary); }
.th-name span { display: block; font-size: 12px; color: var(--text-secondary); }

/* ---------- 6. Graphite: brand text on the charcoal sidebar ---------- */
html[data-theme="graphite"] .sb-name strong { color: #ffffff; }
html[data-theme="graphite"] .sidebar-brand .sb-copy, html[data-theme="graphite"] .sb-name small { color: #8d94a0; }
html[data-theme="graphite"] .nav-item.active { color: #fff; }
html[data-theme="graphite"] .sidebar .user-chip { background: rgba(255,255,255,0.06); color: #b4bac5; }
.th-card { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; }
.th-card .th-prev { flex: 0 0 auto; }
.th-card .th-name { flex: 1 1 auto; }

/* ---------- 7. Friendly colour INSIDE every light theme (2026-12-05, Natanael: "only navy looks OK; I like friendly
   colours inside each theme") — a soft tinted page, cards with a thin accent line on top, a tinted therapy stage,
   an accent bar under page titles, and the parts that stayed blue now follow the theme. Navy Dark is not touched. ---------- */
html:not([data-theme])            { --page-grad: linear-gradient(160deg, #e6effc 0%, #f3f6fb 42%, #f4f5f7 100%); --tint: #e8f1fd; --tint-2: #f3f8ff; --accent: #0071e3; --accent-ring: rgba(0,113,227,.24); }
html[data-theme="teal"]           { --page-grad: linear-gradient(160deg, #dff1ec 0%, #eef6f4 42%, #eef4f3 100%); --tint: #e1f2ef; --tint-2: #f1f9f7; }
html[data-theme="graphite"]       { --page-grad: linear-gradient(160deg, #e7e8fb 0%, #f1f2f7 42%, #f1f2f4 100%); --tint: #eceefe; --tint-2: #f6f6ff; }
html[data-theme="stone"]          { --page-grad: linear-gradient(160deg, #efe6d8 0%, #f6f2ec 42%, #f4f1ec 100%); --tint: #e7edf3; --tint-2: #faf7f2; }
html:not([data-theme="navy"]) body, html:not([data-theme="navy"]) .app-shell { background: var(--page-grad) fixed !important; }
html:not([data-theme="navy"]) .content { background: transparent !important; }
html:not([data-theme="navy"]) .card { box-shadow: inset 0 3px 0 0 color-mix(in srgb, var(--accent) 55%, transparent), 0 1px 3px rgba(16,24,40,.06), 0 6px 18px rgba(16,24,40,.04) !important; }
html:not([data-theme="navy"]) .page-header h1::after { content: ""; display: block; width: 44px; height: 4px; border-radius: 2px; margin-top: 7px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 35%, transparent)); }
html:not([data-theme="navy"]) .therapy-stage { background: radial-gradient(ellipse at 50% 38%, var(--tint-2) 0%, #ffffff 62%) !important; border-color: color-mix(in srgb, var(--accent) 22%, #e5e5ea) !important;
  box-shadow: inset 0 3px 0 0 color-mix(in srgb, var(--accent) 55%, transparent), 0 6px 20px rgba(16,24,40,.05) !important; }
html:not([data-theme="navy"]) .modal-card, html:not([data-theme="navy"]) .appdlg { box-shadow: inset 0 4px 0 0 var(--accent), 0 24px 60px rgba(16,24,40,.22) !important; }
html:not([data-theme="navy"]) .nav-item.active { background: var(--tint) !important; color: var(--accent) !important; font-weight: 700; }
html:not([data-theme="navy"]):not([data-theme="graphite"]) .nav-item:hover { background: color-mix(in srgb, var(--tint) 70%, transparent); }
/* parts that were written in the fixed blue: follow the theme */
html[data-theme] .sb-b-btn { background: var(--accent) !important; }
html[data-theme] .sb-info, html[data-theme] .sp-ii { border-color: var(--accent) !important; color: var(--accent) !important; }
html[data-theme] .sp-ii:hover, html[data-theme] .sp-ii:focus { background: var(--accent) !important; color: #fff !important; }
html[data-theme] .bub-mid { color: var(--accent) !important; }
html[data-theme] .bub.live { border-color: var(--accent) !important; box-shadow: 0 0 0 5px var(--accent-ring) !important; }
html[data-theme] #sp-tools .sp-part { background: var(--tint, var(--accent-soft)) !important; color: var(--accent) !important; }
html[data-theme] .sp-c-btn:hover { border-color: var(--accent) !important; color: var(--accent) !important; }
html[data-theme] #cs-card { background: var(--tint, var(--accent-soft)) !important; border-color: color-mix(in srgb, var(--accent) 30%, transparent) !important; }
html[data-theme] #cs-card h4, html[data-theme] .cs-step .cs-go { color: var(--accent) !important; }
html[data-theme] .cs-n { background: var(--accent); }
html[data-theme="navy"] .sp-ii, html[data-theme="navy"] .sb-info { border-color: #509eec !important; color: #9cc8ff !important; }
html[data-theme="navy"] .bub-mid { color: #6aa8ff !important; }
