/*
 * LuvPM Design System — components.css
 * Canonical class contract. Names here are stable — other builders code new
 * surfaces against these exact names. Consumes semantic/component tokens
 * from tokens.css only. No page-level layout here (see app.css).
 */

/* Base + resets ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--surface-0); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
h1, h2, h3, h4 { line-height: var(--leading-heading); font-weight: 650; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { touch-action: manipulation; }
table { border-collapse: collapse; }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[data-numeric], .num { font-variant-numeric: tabular-nums; }

.skip-link {
  position: fixed; z-index: 1000; top: -60px; left: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--text-primary); color: var(--surface-0);
  border-radius: var(--radius-control);
  font-weight: 700; text-decoration: none;
  transition: top var(--motion-base) var(--ease-out);
}
.skip-link:focus { top: var(--space-3); }

/* Shell -------------------------------------------------------------------
 * .shell    grid: sidebar + main column
 * .sidebar  persistent primary navigation
 * .topbar   context + freshness + theme + user menu
 * .content  routed page body (landmark: <main id="main">)
 */
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-5) var(--space-4);
  background: var(--surface-1);
  border-right: 1px solid var(--border-default);
}
.sidebar__brand {
  display: flex; align-items: center; gap: var(--space-2);
  font-weight: 800; font-size: var(--text-md);
  text-decoration: none; color: var(--text-primary);
  padding: var(--space-1) var(--space-2);
}
.sidebar__brand-mark {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: var(--radius-control);
  background: var(--accent); color: var(--accent-contrast);
  font-size: var(--text-md); font-weight: 800;
}
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__footer { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-2); }

.shell__main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  min-height: 56px;
  padding: var(--space-3) var(--space-6);
  background: color-mix(in srgb, var(--surface-1) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-default);
}
.topbar__context { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.topbar__title { font-size: var(--text-md); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.topbar__menu-toggle { display: none; }

.content { padding: var(--space-6); flex: 1; }

.notice-region:empty { display: none; }

/* Nav items ---------------------------------------------------------------
 * .nav-item / .nav-item--active
 */
.nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  color: var(--text-secondary);
  font-size: var(--text-sm); font-weight: 600;
  text-decoration: none;
  transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item--active, .nav-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Subnav — workspace context tabs (Overview / Board / Lifecycle / Integrations) */
.subnav {
  display: flex; gap: var(--space-1);
  border-bottom: 1px solid var(--border-default);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}
.subnav__link {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm); font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  margin-bottom: -1px;
}
.subnav__link:hover { color: var(--text-primary); }
.subnav__link--active, .subnav__link[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent);
}

/* Card ----------------------------------------------------------------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}
.card__header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
  padding: var(--card-padding) var(--card-padding) 0;
}
.card__body { padding: var(--card-padding); }
.card__header + .card__body { padding-top: var(--space-4); }
.card__footer {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: 0 var(--card-padding) var(--card-padding);
}

/* Stat tile -------------------------------------------------------------- */
.stat-tile {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-5) var(--space-6);
}
.stat-tile__label {
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted);
}
.stat-tile__value {
  font-size: var(--text-2xl); font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-primary); line-height: 1.1;
}
.stat-tile__delta { font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); }
.stat-tile__delta--up { color: var(--status-ok); }
.stat-tile__delta--down { color: var(--status-problem); }

/* Changed-value pulse (WO-PM-017, design spec §1 Motion: "no motion on data
 * updates except a gentle highlight pulse on changed values"). Applied by
 * public/app.js to any [data-metric] element whose rendered value differs
 * from what this browser last saw for the same page. The global
 * prefers-reduced-motion rule in this file already zeroes animation
 * durations, so this degrades to an instant, motion-free background flash
 * rather than being separately guarded here. */
[data-metric].pulse { animation: metric-pulse 900ms var(--ease-out); border-radius: var(--radius-control); }
@keyframes metric-pulse {
  0% { background: var(--accent-soft); }
  100% { background: transparent; }
}

/* Data table --------------------------------------------------------------
 * sticky header, right-aligned tabular numerics via [data-numeric] / .num
 */
.data-table-scroll { overflow-x: auto; border: 1px solid var(--border-default); border-radius: var(--radius-card); }
.data-table { width: 100%; font-size: var(--text-sm); }
.data-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2);
  text-align: left;
  font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
}
.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  color: var(--text-primary);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table th[data-numeric], .data-table td[data-numeric], .data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: var(--surface-2); }

/* Sortable column headers (WO-PM-017) — button-in-<th> + aria-sort, the
 * standard accessible sort pattern. The <button> (public/app.js) is a real
 * focusable control with native Enter/Space activation; th[aria-sort] alone
 * carries the machine-readable state. Every table works fully, in its
 * server-rendered row order, without this script. The button fills the
 * whole <th> (padding moves from the cell onto the button) so the click/tap
 * target is the entire header cell, not just the text — comfortably over
 * the WCAG 2.2 §2.5.8 24x24px minimum. */
.data-table th:has(.sort-button) { padding: 0; }
.data-table th .sort-button {
  display: inline-flex; align-items: center; gap: var(--space-1);
  width: 100%; height: 100%;
  background: transparent; border: 0; margin: 0;
  padding: var(--space-3) var(--space-4);
  font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit;
  cursor: pointer;
}
.data-table th[data-numeric] .sort-button { justify-content: flex-end; }
.data-table th .sort-button:hover { color: var(--text-primary); background: var(--surface-1); }
.data-table th .sort-button__icon { flex-shrink: 0; width: 0.8em; font-size: 0.7em; color: var(--text-muted); }
.data-table th .sort-button__icon::before { content: "\25B4\25BE"; }
.data-table th[aria-sort="ascending"] .sort-button__icon,
.data-table th[aria-sort="descending"] .sort-button__icon { color: var(--accent); }
.data-table th[aria-sort="ascending"] .sort-button__icon::before { content: "\25B4"; }
.data-table th[aria-sort="descending"] .sort-button__icon::before { content: "\25BE"; }

/* Chip --------------------------------------------------------------------
 * status/freshness/role badges. Never color-alone — always paired with a
 * label or icon. Modifiers: --ok / --attention / --problem / --neutral / --stale
 */
.chip {
  display: inline-flex; align-items: center; gap: var(--chip-gap);
  padding: var(--chip-padding-y) var(--chip-padding-x);
  border-radius: var(--chip-radius);
  border: 1px solid var(--status-neutral-border);
  background: var(--status-neutral-bg);
  color: var(--status-neutral);
  font-size: var(--chip-font-size); font-weight: 700;
  white-space: nowrap; line-height: 1.6;
}
.chip::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.chip--ok { color: var(--status-ok); background: var(--status-ok-bg); border-color: var(--status-ok-border); }
.chip--attention { color: var(--status-attention); background: var(--status-attention-bg); border-color: var(--status-attention-border); }
.chip--problem { color: var(--status-problem); background: var(--status-problem-bg); border-color: var(--status-problem-border); }
.chip--neutral { color: var(--status-neutral); background: var(--status-neutral-bg); border-color: var(--status-neutral-border); }
.chip--stale { color: var(--status-stale); background: var(--status-stale-bg); border-color: var(--status-stale-border); }
.chip--accent { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-soft-border); }

/* Health indicator ----------------------------------------------------------
 * ring/dot + label. Modifiers: --ok / --attention / --problem / --unknown
 */
.health { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.health__dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--status-neutral);
  background: var(--surface-1);
}
.health__label { color: var(--text-secondary); }
.health--ok .health__dot { border-color: var(--status-ok); background: var(--status-ok); }
.health--ok .health__label { color: var(--status-ok); }
.health--attention .health__dot { border-color: var(--status-attention); background: var(--status-attention); }
.health--attention .health__label { color: var(--status-attention); }
.health--problem .health__dot { border-color: var(--status-problem); background: var(--status-problem); }
.health--problem .health__label { color: var(--status-problem); }
.health--unknown .health__dot { border-color: var(--status-neutral); background: transparent; }
.health--unknown .health__label { color: var(--text-muted); }

/* Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-size: var(--text-sm); font-weight: 700;
  text-decoration: none; cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--secondary { background: var(--surface-1); border-color: var(--border-strong); color: var(--text-primary); }
.btn--secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn--quiet { background: transparent; border-color: transparent; color: var(--text-secondary); min-height: 36px; padding: var(--space-1) var(--space-3); }
.btn--quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--text-primary); }
.btn--danger { background: var(--surface-1); border-color: var(--danger); color: var(--danger); }
.btn--danger:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--compact { min-height: 34px; padding: var(--space-1) var(--space-3); }
.btn--block { width: 100%; }
kbd.btn__key, .btn kbd {
  font-family: var(--font-mono); font-size: 0.7rem; padding: 1px 5px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--border-default); color: var(--text-muted);
}

/* Text link -------------------------------------------------------------- */
.text-link {
  display: inline-flex; align-items: center; min-height: 36px;
  color: var(--accent); text-decoration: none; font-weight: 600; font-size: var(--text-sm);
  border-bottom: 1px solid transparent;
}
.text-link:hover { border-color: var(--accent); }

/* Form fields ---------------------------------------------------------------
 * .field wraps a label + control + optional help/error text.
 */
.field { display: grid; gap: var(--space-2); }
.field__label { font-size: var(--text-sm); font-weight: 700; color: var(--text-secondary); }
.field__help { font-size: var(--text-xs); color: var(--text-muted); }
.field__error { font-size: var(--text-xs); color: var(--status-problem); font-weight: 600; }
.field input, .field select, .field textarea,
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 40px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-control);
  background: var(--surface-1); color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
}
textarea { resize: vertical; min-height: 84px; }
.field--invalid input, .field--invalid select, .field--invalid textarea { border-color: var(--status-problem); }

/* Empty state ------------------------------------------------------------ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  text-align: center; padding: var(--space-10) var(--space-6);
  border: 1px dashed var(--border-strong); border-radius: var(--card-radius);
  color: var(--text-secondary);
}
.empty-state h2, .empty-state h3 { color: var(--text-primary); }
.empty-state p { max-width: 52ch; color: var(--text-secondary); }

/* Skeleton loader ---------------------------------------------------------- */
.skeleton {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-1) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Notice / toast ------------------------------------------------------------ */
.notice {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-control);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text-primary);
  font-size: var(--text-sm);
}
.notice--ok { border-color: var(--status-ok); background: var(--status-ok-bg); }
.notice--error { border-color: var(--status-problem); background: var(--status-problem-bg); }
.notice--attention { border-color: var(--status-attention); background: var(--status-attention-bg); }

/* Kanban -------------------------------------------------------------------
 * .kanban / .kanban__column / .kanban__card
 */
.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr);
  gap: var(--space-4); overflow-x: auto; overscroll-behavior-inline: contain;
  padding-bottom: var(--space-4);
}
.kanban__column { min-width: 0; display: flex; flex-direction: column; }
.kanban__column-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: var(--space-2) var(--space-1);
  border-bottom: 2px solid var(--accent);
}
.kanban__column-header h2, .kanban__column-header h3 { font-size: var(--text-sm); }
.kanban__count {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 var(--space-2);
  border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-secondary);
  font-size: var(--text-xs); font-weight: 700;
}
.kanban__mapped-states { font-size: var(--text-xs); color: var(--text-muted); margin: var(--space-2) var(--space-1); }
.kanban__cards { display: grid; gap: var(--space-3); }
.kanban__empty { padding: var(--space-5) var(--space-1); color: var(--text-muted); font-size: var(--text-sm); }
/* .drag-over (not a BEM modifier) is the exact class public/app.js already
   toggles via classList.add/remove — kept as-is so the existing drag/drop
   behavior needs zero JS changes. */
.kanban__column.drag-over { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-control); }

.kanban__card {
  border: 1px solid var(--border-default); border-radius: var(--card-radius);
  background: var(--surface-1); box-shadow: var(--card-shadow);
  transition: border-color var(--motion-fast) var(--ease-out);
}
.kanban__card:hover { border-color: var(--accent); }
.kanban__card[draggable="true"] { cursor: grab; }
.kanban__card-link { display: block; padding: var(--space-4); color: inherit; text-decoration: none; }
.kanban__card-id { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; color: var(--accent); }
.kanban__card-title { font-size: var(--text-sm); font-weight: 650; margin: var(--space-2) 0 var(--space-3); }
.kanban__card-chips { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.kanban__card-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); margin-top: var(--space-3); }
.kanban__card-meta dt { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.kanban__card-meta dd { font-size: var(--text-xs); margin: 2px 0 0; color: var(--text-secondary); }
.kanban__card-blocked { display: inline-block; margin-top: var(--space-3); font-size: var(--text-xs); font-weight: 700; color: var(--status-problem); }
/* .card-move (not a BEM modifier) is the exact class public/app.js already
   queries (draggedCard.querySelector(".card-move")) to find the status
   <select> it drives on drop — kept as-is so drag/drop needs zero JS edits. */
.card-move { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2); padding: 0 var(--space-4) var(--space-4); }
.card-move select { min-height: 36px; }
.card-move .btn { min-height: 36px; }

/* Modal + drawer ------------------------------------------------------------- */
.modal-scrim, .drawer-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgb(15 23 42 / 0.45);
}
.modal {
  position: fixed; z-index: 91; inset: 0; margin: auto;
  width: min(560px, calc(100vw - var(--space-6)));
  max-height: calc(100vh - var(--space-8));
  overflow: auto;
  background: var(--surface-overlay);
  border-radius: var(--card-radius);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-overlay);
  padding: var(--card-padding);
}
.drawer {
  position: fixed; z-index: 91; top: 0; right: 0; bottom: 0;
  width: min(420px, 100vw);
  background: var(--surface-overlay);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-overlay);
  padding: var(--card-padding);
  overflow: auto;
}

/* Command palette --------------------------------------------------------- */
.palette-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgb(15 23 42 / 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: min(14vh, 140px);
}
/* The [hidden] global attribute is only display:none via the UA stylesheet,
   which author rules of equal specificity (a plain class selector, here
   .palette-scrim) always win over — so a bare `display:flex` above would
   otherwise keep the scrim visible AND click-interceptive even while
   JS sets root.hidden = true. This rule restores the attribute's effect. */
.palette-scrim[hidden] { display: none; }
.palette {
  width: min(560px, calc(100vw - var(--space-6)));
  max-height: min(70vh, 560px);
  display: flex; flex-direction: column;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-overlay);
  overflow: hidden;
}
.palette__input-row {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-default);
}
.palette__input {
  flex: 1; border: 0 !important; min-height: auto !important; padding: 0 !important;
  background: transparent !important; font-size: var(--text-md);
}
.palette__input:focus { outline: none; }
.palette__hint { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.palette__results { overflow-y: auto; padding: var(--space-2) 0; }
.palette__group-label {
  padding: var(--space-2) var(--space-4);
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
}
.palette__item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  width: 100%; text-align: left;
  padding: var(--space-2) var(--space-4);
  border: 0; border-left: 3px solid transparent;
  background: transparent; color: var(--text-primary);
  font-size: var(--text-sm); text-decoration: none;
  cursor: pointer;
}
.palette__item-label { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.palette__item-label span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__item[aria-selected="true"] { background: var(--surface-2); border-left-color: var(--accent); font-weight: 650; }
.palette__empty { padding: var(--space-6) var(--space-4); text-align: center; color: var(--text-muted); font-size: var(--text-sm); }
.palette__footer {
  display: flex; gap: var(--space-4); flex-wrap: wrap;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border-default);
  font-size: var(--text-xs); color: var(--text-muted);
}
.palette__footer span { display: inline-flex; align-items: center; gap: var(--space-1); }

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

/* ---------------------------------------------------------------------------
 * Cross-surface compatibility
 *
 * WO-PM-010/011/012/013/014/015/016 (rules, health engine, ops health,
 * reports, dashboards, capacity, security hardening) landed on main
 * concurrently with this work order and were coded against the pre-existing
 * .primary-button/.secondary-button/.text-button/.status button and badge
 * conventions. Rather than rewrite five other work orders' tested view
 * markup and their locked-down security/accessibility test assertions,
 * these names are styled here as first-class citizens of the same token
 * system — every surface gets the same visual language with zero markup
 * risk. New surfaces should still prefer .btn/.btn--* and .chip/.chip--*
 * (the canonical contract above); these exist for what already shipped.
 * ------------------------------------------------------------------------- */
.primary-button, .secondary-button, .text-button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-size: var(--text-sm); font-weight: 700;
  text-decoration: none; cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.primary-button:disabled, .secondary-button:disabled, .text-button:disabled { opacity: 0.55; cursor: not-allowed; }
.primary-button { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.primary-button:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.secondary-button { background: var(--surface-1); border-color: var(--border-strong); color: var(--text-primary); }
.secondary-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.text-button { background: transparent; border-color: transparent; color: var(--accent); min-height: 36px; padding: var(--space-1) var(--space-2); text-decoration: underline; text-underline-offset: 2px; }
.text-button:hover:not(:disabled) { color: var(--accent-hover); }
.primary-button.compact, .secondary-button.compact, .text-button.compact { min-height: 34px; padding: var(--space-1) var(--space-3); }

/* .status / .status-* — the health-verdict and generic status badges used
 * by src/views/layout.mjs healthIndicator() (PM-ENG-04) and the health/ops,
 * rules, and dashboards surfaces. Same visual language as .chip, distinct
 * class family because the markup (and its tests) already ship this way. */
.status {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--chip-padding-y) var(--chip-padding-x);
  border-radius: var(--chip-radius);
  border: 1px solid var(--status-neutral-border);
  background: var(--status-neutral-bg);
  color: var(--status-neutral);
  font-size: var(--chip-font-size); font-weight: 700;
  white-space: nowrap; line-height: 1.6;
}
.status-healthy, .status-connected, .status-succeeded, .status-ok { color: var(--status-ok); background: var(--status-ok-bg); border-color: var(--status-ok-border); }
.status-attention, .status-waiting, .status-aging { color: var(--status-attention); background: var(--status-attention-bg); border-color: var(--status-attention-border); }
.status-problem, .status-error, .status-failed { color: var(--status-problem); background: var(--status-problem-bg); border-color: var(--status-problem-border); }
.status-unknown, .status-never, .status-stale { color: var(--status-stale); background: var(--status-stale-bg); border-color: var(--status-stale-border); }
.status-violet { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-soft-border); }

/* PM-ENG-04 health disclosure — <details class="health-indicator"> wrapping
 * a .status summary + a ranked explanation list. */
.health-indicator summary { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; list-style: none; }
.health-indicator summary::-webkit-details-marker { display: none; }
.health-indicator summary::before { content: "\25B8"; font-size: 0.7em; color: var(--text-muted); transition: transform var(--motion-fast) var(--ease-out); }
.health-indicator[open] summary::before { transform: rotate(90deg); }
.health-top-reason { font-size: var(--text-xs); color: var(--text-muted); }
.health-explanations {
  list-style: none; margin: var(--space-2) 0 0; padding: var(--space-3);
  display: grid; gap: var(--space-2);
  background: var(--surface-2); border-radius: var(--radius-control);
  font-size: var(--text-xs);
}
.health-explanations li { display: flex; justify-content: space-between; gap: var(--space-4); }
.health-signal { font-weight: 700; color: var(--text-secondary); text-transform: capitalize; }
.health-card { padding: var(--space-5) var(--card-padding); border: 1px solid var(--border-default); border-radius: var(--card-radius); background: var(--card-bg); margin-bottom: var(--space-6); }
.health-card .eyebrow { margin-bottom: var(--space-2); }
.workspace-badges { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* Generic scrollable table wrapper (health/ops, capacity, rules tables) —
 * same behavior as .data-table-scroll under a name those surfaces already
 * emit. */
.table-scroll { overflow-x: auto; border: 1px solid var(--border-default); border-radius: var(--radius-card); }
.table-scroll table, .health-table { width: 100%; font-size: var(--text-sm); border-collapse: collapse; }
.table-scroll thead th, .health-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left;
  font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-default);
}
.table-scroll td, .health-table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-default); }
.table-scroll tbody tr:last-child td, .health-table tbody tr:last-child td { border-bottom: 0; }
.table-scroll .num, .health-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll tbody tr:hover, .health-table tbody tr:hover { background: var(--surface-2); }
