/* RRB-SHARED v0.1.0 — do not edit project copy; sync from /opt/stacks/ops/shared */
/* =============================================
   RRB Design Primitives — ops/shared master
   rrb-css-v: 2.0.0  (BEM list-row, empty-state, tooltip, focus-visible ring, skip-link)
   ============================================= */

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  background: var(--surface);
  color: var(--text);
  font: 500 13px/1 var(--font);
  cursor: pointer;
  transition: all var(--t) var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); box-shadow: var(--e1); }
.btn:focus { outline: 0; }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgb(26 106 163 / 0.4); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: var(--e1); }

.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-muted); color: var(--text); border-color: transparent; box-shadow: none; }

.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }

.ico-btn {
  width: 32px; height: 32px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t) var(--ease);
}
.ico-btn:hover { color: var(--text); border-color: var(--border-strong); }

@media (max-width: 768px) {
  .btn { height: 40px; font-size: 14px; }
  .btn-sm { height: 32px; }
  .ico-btn { width: 40px; height: 40px; }
}

/* ========== Chips ========== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font: 500 12px/1 var(--font);
  font-variant-numeric: tabular-nums;
  background: var(--surface-muted);
  color: var(--text-muted);
  white-space: nowrap;
}
.chip-sm { height: 20px; font-size: 11px; padding: 0 7px; }
.chip-primary { background: var(--primary-50); color: var(--primary); }
.chip-accent  { background: var(--accent-50);  color: #008020; }
.chip-warning { background: var(--warning-50); color: var(--warning); }
.chip-danger  { background: var(--danger-50);  color: var(--danger); }
.chip-muted   { background: var(--surface-muted); color: var(--text-muted); }

.chip-removable { padding-right: 4px; }
.chip-removable .chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 500 12px/1 var(--font);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--t) var(--ease), background-color var(--t) var(--ease);
}
.chip-removable .chip-x:hover { opacity: 1; background: rgba(0,0,0,0.08); }

/* Interactive chip variants — button/anchor chips need appearance reset + focus ring */
button.chip,
a.chip {
  appearance: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
button.chip:focus-visible,
a.chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.chip:disabled,
.chip[aria-disabled="true"],
button.chip:disabled,
a.chip[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
button.chip:active,
a.chip:active {
  transform: scale(0.97);
  transition: transform 80ms ease-out;
}

.chip-stack {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.val.val-chips {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.val.val-stack {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: stretch;
  text-align: left;
}

.multiselect-shell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--r-field, 6px);
  background: var(--surface);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.multiselect-shell > .chip-sm {
  flex: 0 0 auto;
  max-width: 100%;
  min-width: 0;
  word-break: break-word;
}
.multiselect-shell > .ac-wrap {
  flex: 1 1 140px;
  min-width: 0;
}
.multiselect-shell:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
}
.multiselect-input {
  width: 100%;
  border: 0;
  outline: none;
  font: 500 13px/1.2 var(--font);
  color: var(--text);
  background: transparent;
  padding: 4px 0;
  min-width: 0;
}
@media (max-width: 480px) {
  .multiselect-shell > .ac-wrap { flex-basis: 100%; }
}

/* ========== Card ========== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--e1); }
.card-title { font: 600 15px/1.3 var(--font); letter-spacing: -.01em; margin: 0 0 4px; }
.card-subtitle, .card-sub { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }

/* ========== Qty pill ========== */
/* Touch sizing: button 32x34 / input 56px so total pill >=34px high and
   on @media(hover:none) inherits the 44px min from responsive.css without
   children clipping. Let content size the pill; no explicit height. */
.qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--r-field);
  background: var(--surface);
  overflow: hidden;
}
.qty button {
  min-width: 32px;
  height: 34px;
  border: 0; background: transparent;
  color: var(--text-muted);
  font: 500 16px/1 var(--font);
  cursor: pointer;
  transition: all var(--t) var(--ease);
  padding: 0 8px;
}
.qty button:hover { background: var(--primary-50); color: var(--primary); }
.qty input {
  width: 56px;
  border: 0;
  text-align: center;
  background: transparent;
  color: var(--text);
  font: 500 13px/1 var(--font);
  font-variant-numeric: tabular-nums;
}
.qty input:focus { outline: 0; }
@media (hover: none) {
  .qty button { min-width: 40px; height: 40px; }
  .qty input  { width: 64px; }
}

@media (max-width: 768px) {
  .qty { height: 36px; }
  .qty button { width: 32px; height: 34px; font-size: 18px; }
  .qty input { width: 60px; font-size: 14px; }
}
@media (max-width: 360px) {
  .qty { height: 38px; }
  .qty button { width: 34px; height: 36px; }
  .qty input { width: 56px; }
}

/* ========== Field / info-row ========== */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  transition: background-color var(--t) var(--ease), border-left-color var(--t) var(--ease);
}
.info-row:last-child { border-bottom: 0; }
.info-row:hover { background: var(--primary-50); border-left-color: var(--primary); }
.info-row .lbl { font-size: 12px; color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.info-row .val {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  font: 500 13px/1.2 var(--font);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
/* right-edge alignment rule per spec — plain text, editable-field, qty pill,
   and chips all share the same right line */

@media (max-width: 480px) {
  .info-row:has(.qty), .info-row.stack {
    flex-direction: column;
    align-items: flex-start;
  }
  .info-row:has(.qty) .val, .info-row.stack .val {
    width: 100%;
    justify-content: flex-end;
  }
}
@media (max-width: 768px) {
  .info-row.stack { flex-direction: column; align-items: flex-start; }
  .info-row.stack .val { width: 100%; justify-content: flex-start; }
  .info-row.stack .val.val-stack { flex-basis: 100%; }
}

/* ========== Editable field (restyled) ========== */
.editable-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-btn);
  cursor: pointer;
  transition: background-color var(--t) var(--ease);
}
.editable-field:hover { background: var(--primary-100); color: var(--primary); }
.editable-field .edit-hint {
  opacity: 0;
  font-size: 11px;
  color: var(--primary);
  transition: opacity var(--t) var(--ease);
}
.editable-field:hover .edit-hint { opacity: 1; }

/* ========== Location tile ========== */
.loc {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid transparent;
  border-radius: var(--r-card);
  transition: all var(--t) var(--ease);
}
.loc:hover { border-color: var(--border-strong); border-left-color: var(--primary); background: var(--primary-50); }
.loc-name { font: 500 13px/1 var(--font); color: var(--text); }
.loc-sub  { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.loc-qty  { display: flex; align-items: center; gap: 10px; }
.loc-val  { font: 600 17px/1 var(--font); color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

@media (max-width: 540px) {
  .loc-grid { grid-template-columns: 1fr !important; }
}

/* ========== List row ========== */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  transition: all var(--t) var(--ease);
  cursor: pointer;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-muted); border-left-color: var(--primary); }
.list-row .ico {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--surface-muted);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.list-row .title { font: 500 13px/1.3 var(--font); color: var(--text); }
.list-row .sub   { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.list-row .trail { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ========== Vendor row ========== */
.vendor-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  transition: all var(--t) var(--ease);
}
.vendor-row:last-child { border-bottom: 0; }
.vendor-row:hover { background: var(--surface-muted); border-left-color: var(--primary); }
.vendor-name        { font: 500 13px/1.3 var(--font); color: var(--text); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vendor-name-text   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vendor-name-tags   { display: flex; flex-wrap: wrap; gap: 4px; }
.vendor-sku         { font: 500 12px/1 'SF Mono', Menlo, monospace; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vendor-price       { font: 500 13px/1 var(--font); font-variant-numeric: tabular-nums; text-align: right; }
.vendor-actions     { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }

@media (max-width: 768px) {
  .vendor-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name actions" "sku price";
    gap: 6px 10px;
    padding: 12px;
  }
  .vendor-name    { grid-area: name; }
  .vendor-actions { grid-area: actions; }
  .vendor-sku     { grid-area: sku; }
  .vendor-price   { grid-area: price; }
}

/* ========== Movement row ========== */
.mov-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  transition: all var(--t) var(--ease);
}
.mov-row:last-child { border-bottom: 0; }
.mov-row:hover { background: var(--surface-muted); border-left-color: var(--primary); }

/* ========== Timeline ========== */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 1px;
  background: var(--border);
}
.tl-item { position: relative; padding: 10px 0 10px 8px; }
.tl-item::before {
  content: '';
  position: absolute;
  left: -15px; top: 14px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--primary);
}
.tl-item.warn::before   { border-color: var(--warning); }
.tl-item.danger::before { border-color: var(--danger); }
.tl-item.accent::before { border-color: var(--accent); }
.tl-row   { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-title { font: 500 13px/1.3 var(--font); color: var(--text); }
.tl-sub   { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }

/* ========== Banner ========== */
.banner {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: var(--primary-50);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.banner .bttl { font: 600 13px/1.3 var(--font); color: var(--primary); }
.banner .btxt { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.banner.warn   { background: var(--warning-50); border-color: var(--warning); }
.banner.warn .bttl   { color: var(--warning); }
.banner.accent { background: var(--accent-50);  border-color: var(--accent);  }
.banner.accent .bttl { color: #008020; }
.banner.danger { background: var(--danger-50);  border-color: var(--danger);  }
.banner.danger .bttl { color: var(--danger); }

/* ========== Stat card ========== */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px;
  transition: all var(--t) var(--ease);
}
.stat:hover { border-color: var(--border-strong); box-shadow: var(--e1); }
.stat-label {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 6px;
}
.stat-value {
  font: 600 24px/1 var(--font);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.stat-delta { font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-delta.down { color: var(--danger); }

/* === Hero stat card (dashboard primary metrics) === */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.hero.primary { border-top: 3px solid var(--primary); }
.hero.warning { border-top: 3px solid var(--warning); }
.hero.accent  { border-top: 3px solid var(--accent); }

.hero-label {
  font: 600 11px/1 var(--font);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.hero-value {
  font: 600 clamp(22px, 3vw, 28px) var(--font);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.hero-value.warning { color: var(--warning); }
.hero-value.accent  { color: var(--accent); }
.hero-value.danger  { color: var(--danger); }

.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

/* === Mini stat card (dashboard secondary metrics) === */
.mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-field);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.mini-label {
  font: 600 10px/1 var(--font);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.mini-value {
  font: 600 18px/1.1 var(--font);
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.mini-value.warning { color: var(--warning); }
.mini-value.accent  { color: var(--accent); }
.mini-value.danger  { color: var(--danger); }

/* ========== Collapsible ========== */
.collapsible { border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
.collapsible summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font: 600 13px/1.2 var(--font);
  color: var(--text);
  user-select: none;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::before {
  content: '';
  width: 10px; height: 10px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform var(--t) var(--ease);
}
.collapsible[open] summary::before { transform: rotate(45deg); }
.collapsible > :not(summary) { padding: 0 16px 16px; }

/* ========== List-collapse (show-more inline expand) ========== */
.list-collapse .is-folded { display: none; }
.list-collapse.is-open .is-folded { display: flex; }
.list-collapse.is-open .is-folded.tl-item { display: block; }
.list-collapse.is-open .is-folded.list-row { display: grid; }
.list-collapse__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  color: var(--primary);
  font: 500 12px/1 var(--font);
  cursor: pointer;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.list-collapse__more:hover { background: var(--primary-50); border-color: var(--primary-200); }
.list-collapse__more::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--t) var(--ease);
  margin-left: 2px;
}
.list-collapse.is-open .list-collapse__more::after { transform: rotate(-135deg); }

/* =============================================
   Werkbon primitives (promoted W10)
   ============================================= */

/* ========== a-chip — tinted pill ========== */
.a-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(26,106,163,0.08);
  color: var(--primary);
  border: 1px solid rgba(26,106,163,0.15);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.a-chip.is-success { background: rgba(0,193,48,0.08); color: #0d7a2b; border-color: rgba(0,193,48,0.2); }
.a-chip.is-warn    { background: rgba(239,108,0,0.08); color: #9a4500; border-color: rgba(239,108,0,0.2); }
.a-chip.is-danger  { background: rgba(220,53,69,0.08); color: #a8271e; border-color: rgba(220,53,69,0.2); }
.a-chip.is-neutral { background: var(--surface-muted); color: var(--text-muted); border-color: var(--border); }
.a-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ========== microstat — compact inline chip ========== */
.microstat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.microstat.is-success { background: rgba(0,193,48,0.08); color: #0d7a2b; border-color: rgba(0,193,48,0.2); }
.microstat.is-warn    { background: rgba(239,108,0,0.08); color: #9a4500; border-color: rgba(239,108,0,0.2); }
.microstat.is-danger  { background: rgba(220,53,69,0.08); color: #a8271e; border-color: rgba(220,53,69,0.2); }
.microstat.is-brand   { background: rgba(26,106,163,0.08); color: var(--primary); border-color: rgba(26,106,163,0.15); }

/* ========== status-chip — semantic single-health ========== */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-chip.is-success { background: rgba(0,193,48,0.08); color: #0d7a2b; border-color: rgba(0,193,48,0.2); }
.status-chip.is-warn    { background: rgba(239,108,0,0.08); color: #9a4500; border-color: rgba(239,108,0,0.2); }
.status-chip.is-danger  { background: rgba(220,53,69,0.08); color: #a8271e; border-color: rgba(220,53,69,0.2); }

/* ========== a-table — clean data table ========== */
.a-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.a-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  white-space: nowrap;
}
.a-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.a-table td.nowrap { white-space: nowrap; }
.a-table tr:hover td { background: var(--surface-muted); }
.a-table tr:last-child td { border-bottom: 0; }

/* ========== a-field — form row (220px label · control/help) ========== */
.a-field {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.a-field:last-child { border-bottom: 0; }
.a-field .lbl { font-size: 13px; color: var(--text-muted); }
.a-field .lbl .help {
  display: block;
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 2px;
  font-weight: 400;
}
.a-field .ctl { display: flex; align-items: center; gap: 8px; }
.a-field input,
.a-field select,
.a-field textarea {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  max-width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.a-field input { width: 280px; }
.a-field input:focus,
.a-field select:focus,
.a-field textarea:focus {
  outline: none;
}
.a-field input:focus-visible,
.a-field select:focus-visible,
.a-field textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,106,163,0.12);
}
@media (max-width: 600px) {
  .a-field { grid-template-columns: 1fr; gap: 4px; }
  .a-field input { width: 100%; }
}

/* ========== a-bar — label · track · value · chip-group ========== */
.a-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 12px;
  flex-wrap: nowrap;
}
.a-bar .lbl {
  flex: 0 0 140px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-bar-track {
  flex: 1 1 auto;
  min-width: 40px;
  background: var(--surface-muted);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.a-bar-fill {
  background: linear-gradient(90deg, var(--primary), #2e8bc9);
  height: 100%;
  border-radius: 999px;
}
.a-bar .v {
  flex: 0 0 64px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}
.a-bar .meta-chips {
  flex: 0 0 auto;
  flex-shrink: 0;
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .a-bar .lbl { flex-basis: 100px; }
  .a-bar .v { flex-basis: 56px; }
}

/* ========== tab-strip + tab-item — segmented pill tabs ========== */
.tab-strip {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-muted);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.tab-item:hover { color: var(--text); background: rgba(255,255,255,0.6); }
.tab-item.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(13,17,23,0.06);
}
.tab-item .count {
  font-size: 11px;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.tab-item.is-active .count { color: var(--primary); }

/* ========== event — timeline row ========== */
.event {
  display: grid;
  grid-template-columns: 12px 72px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.event:last-child { border-bottom: 0; }
.event .evt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  justify-self: center;
}
.event.is-success .evt-dot { background: #0d7a2b; }
.event.is-warn    .evt-dot { background: var(--warning); }
.event.is-danger  .evt-dot { background: var(--danger); }
.event .evt-time {
  font-size: 11px;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.event .evt-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event .evt-main .actor { font-weight: 500; color: var(--text); }
.event .evt-right { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 600px) {
  .event {
    grid-template-columns: 12px 1fr auto;
    grid-template-rows: auto auto;
    row-gap: 2px;
  }
  .event .evt-time { grid-column: 2 / span 2; font-size: 10px; }
  .event .evt-dot { grid-row: 1 / span 2; align-self: start; margin-top: 4px; }
  .event .evt-main { grid-column: 2; }
  .event .evt-right { grid-column: 3; grid-row: 2; }
}

/* ========== a-stat — left-accent stat card ========== */
.a-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.a-stat:hover { border-color: var(--border-strong); box-shadow: 0 1px 3px rgba(13,17,23,0.06); }
.a-stat.is-success { border-left-color: var(--accent); }
.a-stat.is-warn    { border-left-color: var(--warning); }
.a-stat.is-danger  { border-left-color: var(--danger); }
.a-stat .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 500;
}
.a-stat .v {
  font: 600 26px/1 inherit;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.a-stat .delta {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.a-stat .delta.is-up   { color: #0d7a2b; }
.a-stat .delta.is-down { color: #a8271e; }

/* ========== a-row — anchor-as-row (native right-click/middle-click) ========== */
a.a-row,
.a-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.15s, border-left-color 0.15s;
}
a.a-row:hover,
.a-row:hover {
  background: var(--surface-muted);
  border-left-color: var(--primary);
}
a.a-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.a-row:last-child { border-bottom: 0; }
.a-row .ico {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-muted);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  flex: 0 0 28px;
}
.a-row .main { flex: 1 1 auto; min-width: 0; }
.a-row .main .title {
  font: 500 13px/1.3 inherit;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-row .main .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.a-row .right {
  flex: 0 0 auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ========== a-listrow — single-line item row (chip/label · action) ========== */
.a-listrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.a-listrow:last-of-type { border-bottom: 0; }

/* ========== btn-outline-danger ========== */
.btn-outline-danger {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-outline-danger:hover {
  background: var(--danger-50);
  color: var(--danger-dark);
  border-color: var(--danger-dark);
}

/* ========== Global focus-visible fallback ========== */
:focus { outline: 0; }
:focus-visible { outline: 3px solid rgb(26 106 163 / 0.4); outline-offset: 2px; }

/* ========== Skip-link — keyboard jump-to-content ========== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  z-index: 10000;
  border-radius: var(--r-btn);
}

/* ========== Reduced motion — OS accessibility preference ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========== Press feedback (tactile) ========== */
.list-row:active,
.card-clickable:active {
  transform: scale(0.98);
  transition: transform 80ms ease-out;
}

/* ========== Toast entrance animation ========== */
@keyframes toast-in {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-card);
  box-shadow: var(--e2);
  font: 500 13px/1.4 var(--font);
  color: var(--text);
  z-index: 9999;
  animation: toast-in 240ms cubic-bezier(.2, .8, .2, 1);
}
.toast-success { border-left-color: var(--accent); }
.toast-warning { border-left-color: var(--warning); }
.toast-error   { border-left-color: var(--danger); }

/* ========== High-contrast mode — prefers-contrast: more ========== */
@media (prefers-contrast: more) {
  :root {
    --border:          #000;
    --border-strong:   #000;
    --color-border:    #000;
    --color-text-muted:   var(--color-text);
    --color-text-subtle:  var(--color-text);
  }
  .btn-outline,
  .card,
  .list-row {
    border-width: 2px;
  }
}

/* ========== Typography utilities — Phase 2 ========== */
.num,
.stat-value,
.list-row__metric,
table td.num,
table td[data-type="number"] {
  font-variant-numeric: tabular-nums;
}

.mono,
.code-id,
.loc-code {
  font-family: var(--font-mono);
  font-feature-settings: 'zero';
  font-size: 0.92em;
  background: var(--gray-100);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--gray-800);
}

/* ========== List row BEM primitive — structured proximity layout ==========
   Usage:
   <div class="list-row list-row--warning">
     <div class="list-row__icon">[icon]</div>
     <div class="list-row__body">
       <div class="list-row__title">Product name</div>
       <div class="list-row__meta">
         <span>Brand</span>
         <span class="loc-code">MAG-A1</span>
         <span>3d</span>
       </div>
     </div>
     <div class="list-row__metric">
       <div class="list-row__metric-value">2<span class="list-row__metric-denom"> / 8</span></div>
       <div class="list-row__metric-label">Tekort 6</div>
     </div>
     <div class="list-row__action"><a href="...">Bestel</a></div>
   </div>

   Additive to existing .list-row flex rule — BEM children select the grid layout.
*/
.list-row:has(.list-row__body) {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  border-left: 0;
  position: relative;
}
.list-row:has(.list-row__body)::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
}
.list-row--warning::before { background: var(--warning-600); }
.list-row--danger::before  { background: var(--danger-500);  }
.list-row--accent::before  { background: var(--accent-600);  }

.list-row__icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.list-row--warning .list-row__icon { background: var(--warning-50); }
.list-row--danger  .list-row__icon { background: var(--danger-50);  }
.list-row--accent  .list-row__icon { background: var(--accent-50);  }

.list-row__body { min-width: 0; }
.list-row__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-row__meta {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
  display: flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}

.list-row__metric {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-right: 4px;
}
.list-row__metric-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.list-row--warning .list-row__metric-value { color: var(--warning-600); }
.list-row--danger  .list-row__metric-value { color: var(--danger-500);  }
.list-row__metric-denom {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
}
.list-row__metric-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.list-row--warning .list-row__metric-label { color: var(--warning-700); }
.list-row--danger  .list-row__metric-label { color: var(--danger-700);  }

.list-row__action .btn,
.list-row__action a {
  font-size: 11px;
  padding: 6px 10px;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .list-row:has(.list-row__body) {
    grid-template-columns: 32px 1fr auto;
    gap: 10px;
  }
  .list-row__action { grid-column: 1 / -1; justify-self: stretch; }
  .list-row__action .btn,
  .list-row__action a { display: block; text-align: center; }
}

/* ========== Form group — proximity for related inputs ==========
   <fieldset class="form-group" data-title="Leveranciergegevens">
     <input>...</input>
   </fieldset>
*/
.form-group {
  border: 1px solid var(--gray-200);
  border-radius: var(--r-card);
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
}
.form-group[data-title]::before {
  content: attr(data-title);
  position: absolute;
  top: -8px;
  left: 12px;
  padding: 0 8px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}
.form-group > * + * { margin-top: 12px; }

/* ========== Section spacing primitives — Phase 3 ========== */
.page-header { margin-bottom: var(--sp-section, 32px); }
.section-hero { padding: var(--sp-hero, 48px) 0; }

/* ========== List-row hover affordance — Phase 3 ========== */
.list-row:has(.list-row__body):hover { background: var(--primary-50); }
.list-row:has(.list-row__body):hover::before { background: var(--primary-600); }
.list-row--warning:hover::before { background: var(--warning-600); }
.list-row--danger:hover::before  { background: var(--danger-500);  }

/* ========== Empty state ========== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--color-text-muted);
}
.empty-state__icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: var(--gray-400);
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 6px;
}
.empty-state p {
  font-size: 13px;
  margin: 0 0 16px;
  max-width: 32ch;
}

/* ========== Tooltip — CSS-only, keyboard-accessible ==========
   <button aria-label="Dupliceer" data-tooltip="Dupliceer">...</button>
*/
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: var(--gray-900);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-out;
  z-index: 100;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
}

/* Scanner dock — sits directly under a camera viewport.
   Used by inventory scanner; reusable for any camera-control UI. */
.scanner-dock {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-card) var(--r-card);
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.scanner-dock-row {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
}

.scanner-dock-slider {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.scanner-dock-slider input[type="range"] {
  flex: 1;
  min-width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: 0;
}

.scanner-dock-slider input[type="range"]:focus-visible {
  outline: 3px solid rgb(26 106 163 / 0.4);
  outline-offset: 2px;
}

.scanner-dock-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--e1);
}

.scanner-dock-slider input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  box-shadow: var(--e1);
}

.scanner-dock-slider-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  min-width: 48px;
  text-align: right;
}

/* Preset button group — segmented pill for discrete choices.
   Used by scanner zoom (1x/2x/Max) but reusable. */
.preset-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  padding: 3px;
  background: var(--surface-muted);
  gap: 2px;
}

.preset-group button {
  padding: 8px 12px;
  min-height: 44px;
  min-width: 52px;
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: calc(var(--r-btn) - 2px);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}

.preset-group button[aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
}

.preset-group button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Dock pill — disabled/info state (iOS fallback) */
.scanner-dock-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px 14px;
  min-height: 44px;
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  font-size: var(--fs-sm);
  cursor: help;
}

/* Skeleton variant — used while capState === 'detecting' */
.scanner-dock-pill.skeleton {
  background: linear-gradient(90deg, var(--surface-muted) 0%, var(--border) 50%, var(--surface-muted) 100%);
  background-size: 200% 100%;
  animation: scanner-dock-skel 1.2s ease-in-out infinite;
  color: transparent;
  pointer-events: none;
}

@keyframes scanner-dock-skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Busy state — applyConstraints pending */
.scanner-dock button[aria-busy="true"],
.preset-group button[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}

/* Slider stays interactive while busy — drag must not be interrupted. */
.scanner-dock-slider input[aria-busy="true"] {
  opacity: 0.7;
}

/* Error state surface */
.scanner-dock-error {
  background: var(--danger-50);
  border: 1px solid var(--danger);
  color: var(--danger-dark);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-btn);
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
}

@media (max-width: 480px) {
  .scanner-dock-row {
    flex-wrap: wrap;
  }
  .scanner-dock-row > .btn,
  .scanner-dock-row > .preset-group {
    flex: 1 1 100%;
  }
  .preset-group button {
    flex: 1;
    min-width: 0;
  }
}

/* === Low-stock severity group (dashboard accordion bucket) === */
.low-stock-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}
.low-stock-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font: 600 13px/1.2 var(--font);
  user-select: none;
  transition: background 180ms;
}
.low-stock-group-head .left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.low-stock-group-head .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.low-stock-group-head .count {
  font: 700 11px/1 var(--font);
  padding: 3px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.6);
}
.low-stock-group-head .caret {
  opacity: 0.6;
  transition: transform 180ms var(--ease);
}
.low-stock-group[aria-expanded="true"] .caret { transform: rotate(90deg); }

.low-stock-group.kritiek .low-stock-group-head { background: var(--danger-50); color: var(--danger); }
.low-stock-group.kritiek .dot { background: var(--danger); }
.low-stock-group.laag .low-stock-group-head    { background: var(--warning-50); color: var(--warning); }
.low-stock-group.laag .dot { background: var(--warning); }
.low-stock-group.ok .low-stock-group-head      { background: var(--surface-muted); color: var(--text-muted); }
.low-stock-group.ok .dot { background: var(--text-subtle); }

.low-stock-group-body { background: var(--surface); }
.low-stock-group[aria-expanded="false"] .low-stock-group-body { display: none; }

.low-stock-group-body.is-scroll {
  max-height: calc(10 * 40px + 16px);
  overflow-y: auto;
}

.low-stock-group-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.low-stock-group-row:hover { background: var(--surface-muted); }
.low-stock-group-row .name {
  flex: 1 1 auto;
  min-width: 0;
  font: 500 13px/1.3 var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.low-stock-group-row .meta {
  font: 500 11px/1 var(--font);
  color: var(--text-muted);
  flex: 0 0 auto;
}
.low-stock-group-row .qty {
  font: 700 13px/1 var(--font);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  min-width: 56px;
  text-align: right;
}
.low-stock-group-row .qty.kritiek { color: var(--danger); }
.low-stock-group-row .qty.laag    { color: var(--warning); }

@media (prefers-reduced-motion: reduce) {
  .low-stock-group-head,
  .low-stock-group-head .caret { transition: none; }
}

/* === Headings (added 2026-05-07 per style-card spec §21.2) === */
h1, .h1 { font-size: var(--fs-3xl); font-weight: 700; line-height: 1.2; color: var(--text); margin: 0 0 var(--sp-lg); }
h2, .h2 { font-size: var(--fs-2xl); font-weight: 600; line-height: 1.3; color: var(--text); margin: 0 0 var(--sp-md); }
h3, .h3 { font-size: var(--fs-xl);  font-weight: 600; line-height: 1.4; color: var(--text); margin: 0 0 var(--sp-sm); }
h4, .h4 { font-size: var(--fs-lg);  font-weight: 600; line-height: 1.4; color: var(--text); margin: 0 0 var(--sp-sm); }
h5, .h5 { font-size: var(--fs-md);  font-weight: 600; color: var(--text-muted); }
h6, .h6 { font-size: var(--fs-sm);  font-weight: 600; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.04em; }

@media (max-width: 768px) {
  h1, .h1 { font-size: var(--fs-2xl); }
  h2, .h2 { font-size: var(--fs-xl); }
}

/* === Form inputs (added 2026-05-07 per style-card spec §21.2) === */
.form-input, .form-select, .form-textarea {
  width: 100%; min-height: 36px; padding: var(--sp-sm) var(--sp-md);
  font: inherit; font-size: var(--fs-md);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-field);
  transition: border-color var(--t), box-shadow var(--t);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(26 106 163 / 0.15);
}
@media (max-width: 768px) {
  .form-input, .form-select, .form-textarea { min-height: 44px; }
}
.form-label { display: block; font-size: var(--fs-sm); font-weight: 600;
              color: var(--text-muted); margin-bottom: var(--sp-xs); }

/* === Dropdown (added 2026-05-07 per style-card spec §21.2) === */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 4px); right: 0;
                 min-width: 180px; background: var(--surface);
                 border: 1px solid var(--border); border-radius: var(--r-card);
                 box-shadow: var(--e2); padding: var(--sp-xs); z-index: 50; }
.dropdown-item { display: block; padding: var(--sp-sm) var(--sp-md);
                 font-size: var(--fs-sm); color: var(--text);
                 border-radius: var(--r-btn); cursor: pointer; }
.dropdown-item:hover { background: var(--surface-muted); }
.dropdown-divider { height: 1px; background: var(--border); margin: var(--sp-xs) 0; }

/* === Search-bar (added 2026-05-07 per style-card spec §16.1) === */
.search-bar { display: flex; align-items: center; gap: var(--sp-sm);
              background: var(--surface); border: 1px solid var(--border);
              border-radius: var(--r-field); padding: 0 var(--sp-md);
              min-height: 36px; }
.search-bar .search-icon  { color: var(--text-muted); }
.search-bar .search-input { flex: 1; border: 0; background: transparent;
                            min-height: unset; padding: var(--sp-sm) 0;
                            font: inherit; font-size: var(--fs-md); }
.search-bar .search-input:focus { outline: 0; }
.search-bar .search-clear { color: var(--text-subtle); cursor: pointer; }
.search-bar .search-filter { display: flex; gap: var(--sp-xs); }

@media (max-width: 768px) {
  .search-bar { width: 100%; min-height: 44px; padding: var(--sp-md); }
}

/* === Severity card — monitoring-grid variant (added 2026-05-07) ===
   Extends .card primitive with data-severity left-strip and grid anatomy.
   Used by server-status / unifi / uisp / dahua / ajax-alarm. */
.s-card {
  position: relative;
  padding: var(--sp-lg);
  display: grid;
  grid-template-rows: auto auto auto;
  gap: var(--sp-sm);
}
.s-card[data-severity="danger"]   { border-left: 3px solid var(--danger); }
.s-card[data-severity="warning"]  { border-left: 3px solid var(--warning); }
.s-card[data-severity="unknown"]  { border-left: 3px solid var(--border-strong); }
.s-card[data-severity="ok"]       { border-left: 3px solid var(--accent); }
.s-card[data-severity="snoozed"]  { border-left: 3px solid var(--gray-300); opacity: 0.85; }

.s-head { display: flex; align-items: center; gap: var(--sp-sm); flex-wrap: wrap; }
.s-name {
  font: 600 15px/1.3 var(--font);
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.s-head .s-tag { margin-left: auto; flex: 0 0 auto; font-size: 11px; color: var(--text-subtle); }
.s-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}
.s-meta b { font-weight: 600; color: var(--text); }
.s-row  { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.s-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 12px;
  color: var(--text-muted);
  padding-top: var(--sp-sm);
  border-top: 1px solid var(--border);
}
.s-foot b { font-weight: 600; color: var(--text); }
.s-snooze { font-size: 11px; color: var(--warning); }

@media (max-width: 480px) {
  .s-card { padding: var(--sp-md); }
}

/* === Bucket head — severity-bucket section title === */
.bucket-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-sm);
  margin: var(--sp-xl) 0 var(--sp-md);
}
.bucket-head h3 {
  font: 600 14px/1.2 var(--font);
  margin: 0;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.bucket-head .count { font: 600 12px/1 var(--font); color: var(--text-subtle); }
.bucket-head .toolbar { margin-left: auto; }

@media (max-width: 768px) {
  .bucket-head { margin-top: var(--sp-lg); }
}

/* === Filter row — severity filter-chip strip === */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  margin: var(--sp-md) 0;
}
.filter-row .chip { cursor: pointer; }
.filter-row .chip[aria-pressed="true"] { background: var(--primary); color: var(--surface); }

/* === Status dot — 8px health indicator === */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.dot.ok   { background: var(--accent); }
.dot.bad  { background: var(--danger); }
.dot.warn { background: var(--warning); }
.dot.unk  { background: var(--border-strong); }
.dot.pulse { animation: rrb-pulse 1.6s ease-in-out infinite; }
.pulse { animation: rrb-pulse 1.6s ease-in-out infinite; }

@keyframes rrb-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}
@media (prefers-reduced-motion: reduce) {
  .dot.pulse, .pulse { animation: none; }
}

/* === Drawer — side panel (desktop) / fullscreen sheet (mobile) === */
body.drawer-locked { overflow: hidden; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 10001;
  animation: rrb-drawer-fade 160ms ease-out;
}

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
  z-index: 10002;
  display: flex;
  flex-direction: column;
  animation: rrb-drawer-slide 200ms ease-out;
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.drawer-title {
  margin: 0;
  font: 600 var(--fs-md)/1.3 var(--font);
  color: var(--primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-close {
  appearance: none;
  background: transparent;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--r-btn);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
}

/* ========== Dashboard sidebar shell (B2 default, promoted 2026-05-22) ==========
   Applies only to desktop dashboard sidebars. Project mobile styles keep
   ownership of drawer width, transforms, and larger touch targets. */
@media (min-width: 769px) {
  :root body .sidebar:not(.mobile-open) {
    width: var(--sidebar-width, 188px);
    padding: 10px;
    color: var(--color-sidebar-text);
    background:
      linear-gradient(90deg, rgba(0, 193, 48, .08), transparent 32%),
      linear-gradient(180deg, #0a263d 0%, #071d2f 100%);
    transition: width var(--t), transform var(--t), background var(--t);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.24) transparent;
  }

  :root body .sidebar:not(.mobile-open)::-webkit-scrollbar {
    width: 8px;
  }

  :root body .sidebar:not(.mobile-open)::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255,255,255,.22);
  }

  :root body .sidebar.collapsed:not(.mobile-open) {
    width: var(--sidebar-collapsed-width, 56px);
    padding: 12px 0;
    align-items: center;
  }

  :root body .sidebar-logo,
  :root body .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    min-height: 54px;
    margin: 0 0 10px;
    padding: 7px 4px 9px;
    border-bottom: 1px solid rgba(255,255,255,.10);
  }

  :root body .sidebar-logo::before,
  :root body .sidebar-header::before {
    content: "";
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 12px;
    background: transparent url("/static/rrb-logo-shield.png?v=20260522menulogo") center / 25px 27px no-repeat;
    box-shadow: 0 14px 30px rgba(0,0,0,.20);
  }

  :root body .sidebar.collapsed .sidebar-logo::before,
  :root body .sidebar.collapsed .sidebar-header::before {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    background-size: 26px 28px;
    border-radius: 12px;
  }

  :root body .sidebar-logo {
    color: #fff;
    font-size: 14px;
    font-weight: 760;
    line-height: 1.15;
    letter-spacing: 0;
  }

  :root body .sidebar-logo > span {
    flex: 1 1 auto;
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :root body .sidebar-header > :is(h1, p) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :root body .sidebar-header {
    flex-wrap: wrap;
  }

  :root body .sidebar-header h1 {
    flex: 1 1 calc(100% - 42px);
    margin: 0;
    font-size: 13px;
    line-height: 1.2;
  }

  :root body .sidebar-header p {
    flex: 1 1 100%;
    margin: -6px 0 0 42px;
    color: rgba(255,255,255,.63);
    font-size: 11px;
    font-weight: 650;
  }

  :root body .sidebar-logo .brand-green {
    display: none;
  }

  :root body .sidebar-logo .sidebar-toggle,
  :root body .sidebar-logo .sidebar-close {
    margin-left: auto;
  }

  :root body .sidebar-toggle {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    color: rgba(255,255,255,.66);
    transition: background var(--t), color var(--t), transform var(--t);
  }

  :root body .sidebar-toggle:hover,
  :root body .sidebar-toggle:focus-visible {
    color: #fff;
    background: rgba(255,255,255,.08);
    outline: 0;
  }

  :root body .sidebar-nav {
    gap: 2px;
    min-width: 0;
  }

  :root body .sidebar .nav-item {
    position: relative;
    min-width: 0;
    min-height: 34px;
    gap: 7px;
    padding: 7px 8px;
    border-left: 2px solid transparent;
    border-radius: 8px;
    color: var(--color-sidebar-text);
    font-size: 13px;
    line-height: 1.25;
    transition: transform 190ms ease, background 190ms ease, color 190ms ease, border-color 190ms ease, box-shadow 190ms ease;
  }

  :root body .sidebar .nav-item:hover {
    color: #fff;
    background: var(--color-sidebar-hover);
    text-decoration: none;
    transform: translateX(3px);
  }

  :root body .sidebar .nav-item:focus-visible {
    outline: 2px solid rgba(255,255,255,.45);
    outline-offset: 2px;
  }

  :root body .sidebar .nav-item.active {
    border-left-color: var(--accent);
    background: var(--color-sidebar-active);
    color: #fff;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  }

  :root body .sidebar .nav-item.active::after {
    content: "";
    position: absolute;
    right: 9px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(0,193,48,.12);
  }

  :root body .sidebar.collapsed .nav-item.active::after {
    display: none;
  }

  :root body .sidebar .nav-icon {
    width: 18px;
    flex: 0 0 18px;
    text-align: center;
    font-size: 14px;
  }

  :root body .sidebar .nav-label,
  :root body .sidebar .nav-group-label,
  :root body .sidebar .sidebar-user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :root body .sidebar-user,
  :root body .sidebar-footer {
    min-width: 0;
    margin-top: auto;
    padding: 12px 6px 4px;
    border-top: 1px solid rgba(255,255,255,.10);
    color: rgba(255,255,255,.72);
    opacity: 1;
  }

  :root body .sidebar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(255,255,255,.10);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
  }

  :root body .app-header-logo,
  :root body .header-logo {
    color: transparent !important;
    background: transparent url("/static/rrb-logo-shield.png?v=20260522menulogo") center / contain no-repeat !important;
    overflow: hidden;
    text-indent: -999px;
  }
}

/* ========== Mobile dashboard chrome (B2 default, promoted 2026-05-22) ==========
   Keeps project-owned drawer width/transforms intact while aligning the
   visible mobile topbar, drawer background, logo, and title readability. */
@media (max-width: 768px) {
  :root body {
    --rrb-mobile-topbar-height: 54px;
  }

  :root body .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    width: 100%;
    min-height: var(--rrb-mobile-topbar-height);
    margin: 0;
    padding: 0 12px;
    box-sizing: border-box;
    justify-content: flex-start;
    gap: 10px;
    color: #fff;
    background:
      linear-gradient(90deg, rgba(0, 193, 48, .12), transparent 42%),
      linear-gradient(180deg, #0a263d 0%, #071d2f 100%);
    border-bottom: 1px solid rgba(255,255,255,.10);
    border-radius: 0;
    box-shadow: 0 8px 18px rgba(3, 14, 24, .14);
    backdrop-filter: blur(12px);
  }

  :root body .mobile-topbar-title {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 760;
    line-height: 1.15;
    letter-spacing: 0;
  }

  :root body .mobile-topbar-title::before,
  :root body .topbar-brand::before {
    content: "";
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: transparent url("/static/rrb-logo-shield.png?v=20260522menulogo") center / 22px 24px no-repeat;
    box-shadow: 0 10px 22px rgba(0,0,0,.20);
  }

  :root body .mobile-topbar-title::before {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  :root body .mobile-topbar-title > span {
    grid-column: 2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :root body .mobile-topbar-title > span:first-child > span:first-child,
  :root body .mobile-topbar-title .brand-accent {
    display: none !important;
  }

  :root body .mobile-page-indicator {
    color: rgba(255,255,255,.62);
    opacity: 1;
  }

  :root body .topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 14px;
    font-weight: 760;
    line-height: 1.15;
    letter-spacing: 0;
  }

  :root body .mobile-topbar .hamburger,
  :root body .hamburger-btn {
    position: relative;
    inset: auto;
    z-index: auto;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 12px;
    color: #fff;
    background: rgba(255,255,255,.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
    font-size: 0;
    overflow: hidden;
    text-indent: 0;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
  }

  :root body .mobile-topbar .hamburger::before,
  :root body .hamburger-btn::before {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    top: 14px;
    height: 2px;
    border: 0;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 7px 0 currentColor, 0 14px 0 currentColor;
  }

  :root body .mobile-topbar .hamburger::after,
  :root body .hamburger-btn::after {
    content: none;
  }

  :root body .mobile-topbar .hamburger:active,
  :root body .hamburger-btn:active {
    transform: scale(.97);
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.20);
  }

  :root body .hamburger-btn {
    background:
      linear-gradient(90deg, rgba(0, 193, 48, .12), transparent 42%),
      linear-gradient(180deg, #0a263d 0%, #071d2f 100%);
  }

  :root body .sidebar {
    top: var(--rrb-mobile-topbar-height);
    bottom: 0;
    height: calc(100dvh - var(--rrb-mobile-topbar-height));
    min-height: 0;
    color: var(--color-sidebar-text);
    background:
      linear-gradient(90deg, rgba(0, 193, 48, .08), transparent 32%),
      linear-gradient(180deg, #0a263d 0%, #071d2f 100%);
  }

  :root body .sidebar-backdrop,
  :root body .sidebar-overlay {
    top: var(--rrb-mobile-topbar-height);
  }

  :root body .sidebar-logo,
  :root body .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    min-height: 54px;
    margin: 0 0 10px;
    padding: 7px 4px 9px;
    border-bottom: 1px solid rgba(255,255,255,.10);
  }

  :root body .sidebar-logo::before,
  :root body .sidebar-header::before {
    content: "";
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 12px;
    background: transparent url("/static/rrb-logo-shield.png?v=20260522menulogo") center / 25px 27px no-repeat;
    box-shadow: 0 14px 30px rgba(0,0,0,.20);
  }

  :root body .sidebar-logo {
    color: #fff;
    font-size: 14px;
    font-weight: 760;
    line-height: 1.15;
    letter-spacing: 0;
  }

  :root body .sidebar-header {
    flex-wrap: wrap;
  }

  :root body .sidebar-logo > :is(span, .brand-text),
  :root body .sidebar-header > :is(h1, p) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :root body .sidebar-header h1 {
    flex: 1 1 calc(100% - 42px);
    margin: 0;
    font-size: 13px;
    line-height: 1.2;
  }

  :root body .sidebar-header p {
    flex: 1 1 100%;
    margin: -6px 0 0 42px;
    color: rgba(255,255,255,.63);
    font-size: 11px;
    font-weight: 650;
  }

  :root body .sidebar-logo > :is(span, .brand-text) {
    flex: 1 1 auto;
    display: block;
    max-width: 100%;
  }

  :root body .sidebar-logo .brand-green {
    display: none !important;
  }

  :root body .sidebar-logo .sidebar-toggle,
  :root body .sidebar-logo .sidebar-close {
    margin-left: auto;
  }

  :root body .sidebar-close {
    color: rgba(255,255,255,.76);
    border-radius: 12px;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease;
  }

  :root body .sidebar-close:active {
    transform: scale(.97);
    color: #fff;
    background: rgba(255,255,255,.14);
  }

  :root body .sidebar .nav-item {
    color: var(--color-sidebar-text);
  }

  :root body .sidebar .nav-item.active {
    background: var(--color-sidebar-active);
    color: #fff;
  }
.drawer-close:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-lg);
}

.drawer-foot {
  display: flex;
  gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-lg);
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
}

@keyframes rrb-drawer-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes rrb-drawer-slide {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@media (max-width: 767px) {
  .drawer {
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-left: 0;
    border-radius: 0;
  }
  .drawer-backdrop { display: none; }
  .drawer-close { min-width: 44px; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-backdrop { animation: none; }
}
/* =============================================================
   §17 LIST-OVERVIEW PRIMITIVES (added 2026-05-08)
   Container components for the list-overview page archetype:
   filter-toolbar, bucket-pills, list-pane, color-legend, pin-badge.
   Mobile uses edge-to-edge containers — see rrb-responsive.css .shell.
   ============================================================= */

/* === Toolbar — sticky filter strip (search + buckets + sort) === */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  align-items: center;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}
.toolbar > .search-bar { flex: 1 1 280px; min-width: 0; }
.toolbar select.form-input,
.toolbar .form-input { min-height: 36px; }

/* === Bucket pills — segmented filter buttons with counts === */
.bucket-pills {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-muted);
  border-radius: var(--r-btn);
}
.bucket-pills button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 0;
  border-radius: calc(var(--r-btn) - 2px);
  font: 500 var(--fs-sm)/1 var(--font);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.bucket-pills button:hover { background: var(--surface); color: var(--text); }
.bucket-pills button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
}
.bucket-pills .count {
  font-size: 11px;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.bucket-pills button.is-active .count { color: var(--primary); }

/* === List-pane — scrollable list container with sticky head === */
.list-pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.list-pane .list-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}
.list-pane .list-pane-head h2 {
  font: 600 12px/1 var(--font);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin: 0;
}
.list-pane .list-rows {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Card-stack variant — softer surround for tile-like list items */
.list-pane.cardstack-pane { background: var(--surface-muted); }
.list-pane.cardstack-pane .list-pane-head { background: var(--surface); }
.list-pane.cardstack-pane .list-rows {
  background: transparent;
  padding: var(--sp-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* === Color-legend — explanatory color-key strip === */
.color-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-lg);
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  align-items: center;
}
.color-legend .legend-title {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 11px;
}
.color-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.color-legend .swatch {
  display: inline-block;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}
.color-legend .swatch.crit { background: var(--danger); }
.color-legend .swatch.high { background: var(--warning); }
.color-legend .swatch.norm { background: var(--primary); }
.color-legend .swatch.low  { background: var(--border-strong); }
.color-legend .dot-key {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.color-legend .dot-key.crit { background: var(--danger); }
.color-legend .dot-key.high { background: var(--warning); }
.color-legend .dot-key.norm { background: var(--primary); }
.color-legend .dot-key.low  { background: var(--border-strong); }
.color-legend .pin-key { color: var(--warning); }

/* === Pin-badge — replaces yellow gradient bg for pinned items.
   Drift rule: never use solid-color bg as semantic indicator on cards. === */
.pin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: var(--warning-50, rgb(239 108 0 / 0.10));
  color: var(--warning);
  border-radius: 4px;
  font: 600 10.5px/1 var(--font);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pin-badge svg { width: 10px; height: 10px; }

/* Pin corner — icon-only variant for cards with pin in top-right */
.pin-corner {
  position: absolute;
  top: 8px;
  right: 10px;
  color: var(--warning);
  pointer-events: none;
}

/* =============================================================
   §17 LIST-OVERVIEW MOBILE — edge-to-edge containers
   Negative margin = parent shell padding (4px → 8px → 12px scale).
   Drops border + radius to extend cards to screen edge.
   ============================================================= */
@media (max-width: 768px) {
  .list-pane.cardstack-pane .list-rows { padding: 4px; gap: 4px; }
}
@media (max-width: 480px) {
  .toolbar {
    padding: var(--sp-sm);
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin-left: calc(var(--sp-sm) * -1);
    margin-right: calc(var(--sp-sm) * -1);
    gap: 6px;
  }
  .toolbar > .search-bar { flex: 1 1 100%; }
  .toolbar .bucket-pills { width: 100%; justify-content: space-between; }
  .toolbar .bucket-pills button {
    flex: 1 1 0;
    justify-content: center;
    padding: 8px 6px;
  }
  .toolbar select.form-input { flex: 1 1 100%; min-width: 0; }

  .list-pane.cardstack-pane {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin: 0 calc(var(--sp-sm) * -1);
  }
  .list-pane.cardstack-pane .list-rows {
    padding: 4px 0;
    gap: 4px;
  }

  .color-legend {
    padding: 6px 8px;
    gap: 8px;
    font-size: 10.5px;
  }
  .color-legend .legend-title { font-size: 10px; }
}

/* ============================================================
 * NAMING CANON FOUNDATION (2026-05-26) — 5 missing primitives
 * Spec: docs/superpowers/specs/2026-05-26-naming-canon.md
 * ============================================================ */

/* --- .popover — tooltip / balloon ----------------------------- */
.popover {
  position: absolute;
  z-index: 1300;
  max-width: 280px;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--text);
  color: #fff;
  border-radius: var(--r-btn);
  font: 500 12px/1.4 var(--font);
  box-shadow: var(--e1);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
}
.popover.is-open { opacity: 1; }
.popover::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--text);
  transform: rotate(45deg);
}
.popover[data-placement="top"]::after    { bottom: -4px; left: 50%; margin-left: -4px; }
.popover[data-placement="bottom"]::after { top: -4px; left: 50%; margin-left: -4px; }
.popover[data-placement="left"]::after   { right: -4px; top: 50%; margin-top: -4px; }
.popover[data-placement="right"]::after  { left: -4px; top: 50%; margin-top: -4px; }

/* --- .skel — loading skeleton primitives ---------------------- */
.skel {
  display: inline-block;
  background: linear-gradient(90deg, var(--surface-muted) 0%, var(--border) 50%, var(--surface-muted) 100%);
  background-size: 200% 100%;
  animation: rrb-skel-shimmer 1.2s ease-in-out infinite;
  border-radius: var(--r-btn);
  color: transparent;
  user-select: none;
}
.skel-row {
  display: block;
  height: 14px;
  margin: 6px 0;
  border-radius: var(--r-btn);
  background: linear-gradient(90deg, var(--surface-muted) 0%, var(--border) 50%, var(--surface-muted) 100%);
  background-size: 200% 100%;
  animation: rrb-skel-shimmer 1.2s ease-in-out infinite;
}
.skel-card {
  display: block;
  height: 80px;
  border-radius: var(--r-card);
  background: linear-gradient(90deg, var(--surface-muted) 0%, var(--border) 50%, var(--surface-muted) 100%);
  background-size: 200% 100%;
  animation: rrb-skel-shimmer 1.2s ease-in-out infinite;
}
@keyframes rrb-skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skel, .skel-row, .skel-card { animation: none; }
}

/* --- .field-error / .form-input--error — form error state ----- */
.form-input--error,
.form-select.form-input--error,
.form-textarea.form-input--error {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger-50);
}
.form-input--error:focus {
  outline: 0;
  box-shadow: 0 0 0 3px rgb(220 53 69 / 0.25);
}
.field-error {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
}
.field-error::before {
  content: "⚠ ";
  margin-right: 2px;
}

/* --- .pager / .pager-btn — pagination ------------------------- */
.pager {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-md) 0;
  font-size: 13px;
  color: var(--text-muted);
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--sp-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-btn);
  font: 500 13px/1 var(--font);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.pager-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-muted);
}
.pager-btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.pager-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.pager-info {
  margin: 0 var(--sp-sm);
  font-variant-numeric: tabular-nums;
}

/* --- .drag-handle --------------------------------------------- */
.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 24px;
  color: var(--text-subtle);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.drag-handle::before {
  content: "⋮⋮";
  font-size: 14px;
  letter-spacing: -1px;
  line-height: 1;
}
.drag-handle:hover { color: var(--text-muted); }
.drag-handle:active { cursor: grabbing; }
.drag-handle.is-dragging { color: var(--primary); }
