/* ════════════════════════════════════════════════════════════════════
   Base element + utility styles.

   COLORS DO NOT LIVE HERE. Every color token is defined in the canonical
   ui/_shared/tokens.css — linked BEFORE this file via the mirror that
   scripts/ci/sync_shared.sh drops at ../_shared/ (and into ui/system-portal
   too, which ships from a different bucket root). Read the
   header of that file before touching any color — it documents the
   invariants (surface ramp, border-above-surface, WCAG floors, --on-fill).

   Never hardcode a color here or in any other stylesheet: a raw hex works
   in one theme and goes unreadable (or invisible) in the other.
   ════════════════════════════════════════════════════════════════════ */

:root {
  /* Layout only — the color tokens come from ui/_shared/tokens.css. */
  --sidebar-w: 176px;
  --sidebar-collapsed-w: 48px;
  --topbar-h: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ── Base form controls ─────────────────────────────────────────────── */

select, button, input[type="search"] {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.875rem;
}

input[type="search"] {
  width: 180px;
}
input[type="search"]:focus { border-color: var(--accent); }
input[type="search"]::placeholder { color: var(--muted); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

button { cursor: pointer; }
button:hover { border-color: var(--accent); }

label { font-size: 0.875rem; color: var(--muted); }

/* ── Shared utility classes ──────────────────────────────────────────── */

.mono  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }
.dim   { color: var(--muted); }
.error { color: var(--danger); }
.wrap  { max-width: 280px; white-space: normal; word-break: break-word; font-size: 0.82rem; color: var(--muted); }

/* Shared muted pill — used everywhere a count or short label needs
   the same visual weight (controls category header, etc.). Kept in
   visual lockstep with .framework-chip below so the two read as one
   chip family rather than two competing styles in the same table. */
.count-pill {
  display: inline-flex;
  align-items: center;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

details > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.85rem;
  user-select: none;
  list-style: none;
}
details > summary::before { content: "+ "; }
details[open] > summary::before { content: "- "; }
details[open] > summary { margin-bottom: 0.4rem; }

/* ── Empty states (item 9) ───────────────────────────────────────────
   Shared between Reporting / Alerts (and reusable elsewhere). The
   icon is a per-page inline SVG so each view can pick a meaningful
   glyph; the layout + typography stay consistent. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.25rem 1.5rem;
  max-width: 480px;
  margin: 1rem auto;
}
.empty-state-icon {
  width: 56px;
  height: 56px;
  color: var(--muted);
  margin-bottom: 0.85rem;
  opacity: 0.6;
}
.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.45rem;
}
.empty-state-body {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 1rem;
}
.empty-state .btn-primary {
  align-self: center;
}

/* ── Theme toggle (topbar) ───────────────────────────────────────────
   Renders the mode you'd switch TO (sun in dark, moon in light), so the
   control reads as an action rather than a status indicator. */
.topbar-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  background: none;
  border: none;
  color: var(--muted);
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.topbar-theme-btn:hover {
  color: var(--accent);
  background: var(--accent-a10);
  border-color: transparent;
}
/* ── Keyboard focus ──────────────────────────────────────────────────
   Every interactive element used to carry `outline: none` on its BASE
   rule, so the focus ring was suppressed permanently — not just on mouse
   click. The only thing left was a 1px border-color change on *some*
   inputs, and nothing at all on selects, buttons and links. Tabbing
   through the app was invisible (WCAG 2.4.7, Level AA).

   One ring, on --accent, for everything. :focus-visible means it shows
   for keyboard/AT users and for text entry, but not on a mouse click of
   a button — which is the behaviour the `outline: none` was reaching for
   in the first place. */
:is(a, button, input, select, textarea, summary, [tabindex], [role="button"]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
