/* Ulti-Care 360 — shared design layer for every portal.
 *
 * Why this exists
 * ---------------
 * Twenty portals each grew their own palette, type scale and elevation, so the product looked like several
 * products: `apps/web` alone carried 46 linear gradients, 9 radial glows, 72 box-shadows, 15 border radii and
 * three font families. The citizen portal was put in order first; this is the layer the rest adopt, so they
 * inherit the brand instead of approximating it.
 *
 * Deliberately conservative. It sets brand tokens, removes elevation and caps corner radius — it does not
 * restyle layouts, because a shared file that reflows twenty screens cannot be verified screen by screen.
 * Anything stronger belongs in the portal that needs it, where it can be looked at.
 *
 * Load it LAST in each portal's <head>: the rules below rely on that order.
 */

:root {
  /* Brand — taken from the logo, not guessed. */
  --uc-navy: #123a4d;
  --uc-navy-deep: #0b2633;
  --uc-teal: #12707c;
  --uc-teal-bright: #1b8b95;
  --uc-amber: #e3a455;
  --uc-mint: #a9c4bc;

  /* Surfaces and text. Portals that already define --primary/--panel keep theirs; these are the fallbacks a
     portal opts into by reading them. */
  --uc-ink: #0f1d26;
  --uc-body: #4a5a63;
  --uc-line: #dfe6e9;
  --uc-surface: #ffffff;
  --uc-canvas: #f6f9fa;

  /* One stacking scale. The UI guide used 2,147,482,000, which outranked the portal's own toasts. */
  --z-dock: 900;
  --z-dock-panel: 950;
  --z-sheet: 980;
  --z-modal: 1000;
  --z-toast: 1100;
}

[data-theme="dark"] {
  --uc-ink: #e6eef0;
  --uc-body: #a3b3ba;
  --uc-line: #223540;
  --uc-surface: #10222c;
  --uc-canvas: #0b1a21;
}

/* ── restraint ──────────────────────────────────────────────────────────────────────────────────────── */

/* Elevation on every card is what makes a dense dashboard read as a template: if everything floats, nothing is
   in front. Borders and background do the grouping; the shadow goes.
   These selectors are NOT wrapped in :where(). The first version was, for politeness, and `:where()` has zero
   specificity — so every portal's own `.card { box-shadow: … }` beat it and the layer did nothing at all
   (measured: 40 of 40 cards still lifted on the doctor and MOH dashboards). This sheet loads last in <head>,
   it would still win. The html body prefix puts these rules one step above any single-class selector, so order
   Specificity note: health-theme.css is injected a SECOND time at runtime, after this sheet, so on order alone
html body .card, html body .panel, html body .kpi-card, html body .stat-card, html body .metric-card, html body .tile {
  /* !important because shared/health-theme.css sets ox-shadow: var(--shadow) !important on these very
     selectors (line ~528), so an equal-specificity rule without it loses. Measured three times: 40/40, then
     48/48 cards still lifted with :where() and with plain selectors. Modals use .modal, not .card, so flattening
     cards cannot flatten a dialog that needs to sit above the page. */
  box-shadow: none !important;
  border-radius: 8px !important;
}

/* Sixteen-pixel corners everywhere is a house style nobody chose. Eight is a grid, not a mood. */
html body .btn, html body button.btn, html body .chip, html body .pill, html body .badge, html body input, html body select, html body textarea {
  border-radius: 6px !important;
}

/* Headlines tracked loosely at display sizes look unset. */
h1, h2, h3 {
  letter-spacing: -0.01em;
}

/* A visible focus ring on every interactive element, in brand teal. Accessibility that is also a design
   decision: the portals mostly had none, or a browser default that vanished against the surface. */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--uc-teal-bright);
  outline-offset: 2px;
}

/* Links underline on hover rather than sitting in a colour that may not meet contrast on every surface. */
main a:hover, .main a:hover, .content a:hover, .page a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
