/* ──────────────────────────────────────────────────────────────────────────
   Switchboard · design tokens and shared primitives
   Derived from AI Studio's Ledger v2 (design-system/ai-studio/OVERRIDES.md):
   same teal, same IBM Plex Sans + JetBrains Mono, same Swiss restraint.
   What is deliberately NOT inherited — and why — is docs/02-design-system.md.
   Short version: Ledger is an instrument panel for an ML engineer. This is a
   phone answering service for a dental clinic manager. Softer radii, mono
   confined to data, no graph paper on a marketing page.
   ────────────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Light is the default and lives on bare :root, so no colour is ever defined
   only inside a media query. Dark is applied twice: once for the OS preference
   (unless the user pinned light) and once for an explicit pin, so the toggle
   wins in both directions. */
:root {
  --ground: #fcfdfd;
  --surface: #f4f7f7;
  --surface-2: #ebf0f0;
  --ink: #101617;
  --ink-2: #3c4a4c;
  --muted: #5f7174;
  --line: #dfe6e6;
  --line-strong: #c3d0d0;
  --accent: #00706a;
  --accent-hover: #005b56;
  --on-accent: #ffffff;
  --accent-soft: #e2f2f0;
  --warn: #8a5209;
  --warn-soft: #fbf0dd;
  --crit: #9c2732;
  --crit-soft: #fbe8ea;
  --ok: #1c6b3f;
  --ok-soft: #e3f2e9;
  --scrim: rgba(16, 22, 23, 0.34);
  --shadow-pop: 0 8px 24px rgba(16, 22, 23, 0.10), 0 1px 2px rgba(16, 22, 23, 0.06);

  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius: 7px;
  --radius-lg: 11px;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 104px;

  --maxw: 1140px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0d1112;
    --surface: #151b1c;
    --surface-2: #1c2426;
    --ink: #e6eded;
    --ink-2: #bcc9c9;
    --muted: #8b9d9e;
    --line: #263031;
    --line-strong: #374445;
    --accent: #3ad3c3;
    --accent-hover: #5fe0d2;
    --on-accent: #062a27;
    --accent-soft: #12302e;
    --warn: #e0a45c;
    --warn-soft: #2c2113;
    --crit: #f08a94;
    --crit-soft: #301418;
    --ok: #6fce97;
    --ok-soft: #13291d;
    --scrim: rgba(2, 5, 5, 0.62);
    --shadow-pop: 0 8px 28px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --ground: #0d1112;
  --surface: #151b1c;
  --surface-2: #1c2426;
  --ink: #e6eded;
  --ink-2: #bcc9c9;
  --muted: #8b9d9e;
  --line: #263031;
  --line-strong: #374445;
  --accent: #3ad3c3;
  --accent-hover: #5fe0d2;
  --on-accent: #062a27;
  --accent-soft: #12302e;
  --warn: #e0a45c;
  --warn-soft: #2c2113;
  --crit: #f08a94;
  --crit-soft: #301418;
  --ok: #6fce97;
  --ok-soft: #13291d;
  --scrim: rgba(2, 5, 5, 0.62);
  --shadow-pop: 0 8px 28px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, select, summary, [role="button"], label[for] { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.021em; line-height: 1.15; }
h1 { font-size: clamp(2.1rem, 1.3rem + 3.2vw, 3.5rem); }
h2 { font-size: clamp(1.55rem, 1.1rem + 1.7vw, 2.25rem); }
h3 { font-size: 1.125rem; letter-spacing: -0.012em; }
p  { color: var(--ink-2); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--s5); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Uppercase mono microlabel — inherited from Ledger, but used sparingly here:
   section eyebrows and table heads only, never body copy. */
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Inline icons carry no intrinsic size: an <svg> with only a viewBox paints
   at the CSS default 300x150. Every generated icon gets this class so a
   forgotten rule is a wrong size, never a full-panel glyph. */
.ic { width: 15px; height: 15px; flex: none; stroke-width: 1.7; }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font-size: 14.5px; font-weight: 500; white-space: nowrap;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { border-color: var(--line-strong); color: var(--ink); background: var(--ground); }
.btn-secondary:hover { border-color: var(--ink-2); background: var(--surface); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn-lg { padding: 13px 24px; font-size: 15.5px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

/* ── form controls ───────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--ground);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.hint { font-size: 12.5px; color: var(--muted); }

/* ── status: an LED dot plus a word. Never colour alone. ─────────────────── */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.led-ok { background: var(--ok); }
.led-live { background: var(--accent); animation: led-pulse 1.6s ease-in-out infinite; }
.led-warn { background: var(--warn); }
.led-crit { background: var(--crit); }
@keyframes led-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-2); color: var(--ink-2);
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-crit { background: var(--crit-soft); color: var(--crit); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* ── theme toggle (three states: light / dark / system) ──────────────────── */
.theme-toggle {
  display: inline-flex; align-items: center;
  padding: 2px; gap: 2px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.theme-toggle button {
  display: grid; place-items: center;
  width: 26px; height: 24px;
  border: 0; border-radius: var(--radius-xs);
  background: transparent; color: var(--muted);
  transition: background-color 160ms ease, color 160ms ease;
}
.theme-toggle button:hover { color: var(--ink); }
.theme-toggle button[aria-pressed="true"] { background: var(--ground); color: var(--ink); box-shadow: 0 1px 1px rgba(0,0,0,0.06); }
.theme-toggle svg { width: 14px; height: 14px; stroke-width: 1.7; }

/* ── the voice signature: a level meter, drawn not decorated ─────────────── */
.meter { display: flex; align-items: center; gap: 3px; height: 22px; }
.meter i { display: block; width: 3px; border-radius: 2px; background: var(--accent); opacity: 0.85; }
.meter-idle i { background: var(--line-strong); }
.meter-live i { animation: meter-bounce 900ms ease-in-out infinite; }
@keyframes meter-bounce { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

.skip-link {
  position: absolute; left: -9999px; top: 8px;
  padding: 10px 16px; background: var(--accent); color: var(--on-accent);
  border-radius: var(--radius-sm); z-index: 100;
}
.skip-link:focus { left: 8px; }

/* Wide content scrolls inside its own box. The page body never does. */
.table-scroll { overflow-x: auto; max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
