/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --navy:         #0D2140;
  --navy-hover:   #142D56;
  --teal:         #2A8C7E;
  --teal-light:   #35B5A4;
  --teal-muted:   #E6F4F2;
  --bg:           #F0F4F8;
  --surface:      #FFFFFF;
  --border:       #DDE3EA;
  --text:         #1A2D3E;
  --text-muted:   #6B7D8D;
  --expired:      #C0392B;
  --critical:     #D35400;
  --at-risk:      #B7950B;
  --monitor:      #1E8449;
  --shadow-sm:    0 1px 3px rgba(13,33,64,.08), 0 1px 2px rgba(13,33,64,.06);
  --shadow-md:    0 4px 12px rgba(13,33,64,.12);
  --radius:       8px;
  --header-h:     56px;

  /* CCA portal visual/UX pass (2026-08-12) — see CLAUDE_CODE_BUILD.md */
  --surface-alt:   #FAFBFC;  /* table + chart header row fill */
  --divider:       #EDF1F5;  /* table body row divider, lighter than --border */
  --divider-light: #F3F6F9;  /* chart row divider */
  --hover-tint:    #EEF7F5;  /* popover row hover */
  --text-faint:    #93A2AF;  /* section labels, pending text */
  --border-strong: #C9D3DC;  /* unchecked control borders, unlit meter, dashed pending */
  --info:          #2471A3;  /* OEM lens, preview tag — same blue as .exp-pill.tier-watch */
  --info-muted:    #EBF2FA;
  --field-bg:      #F7F9FB;  /* search-in-popover fill */
  --radius-pop:    10px;
  --shadow-menu:   0 12px 32px rgba(13,33,64,.24);
  --shadow-pop:    0 16px 44px rgba(13,33,64,.22);
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.hidden { display: none !important; }

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo svg {
  flex-shrink: 0;
}

.logo-text {
  color: rgba(255,255,255,.85);
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 0.03em;
}

.logo-text span {
  font-weight: 700;
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── Lens switch (header center) ───────────────────────────────────────────
   Session-scoped (?lens=facility|oem URL param, see view-shell.js getLens/
   setLens) — reframes any dual-lens CCA view (SKU Rationalization, PAR
   Optimization, Consignment Liability). Renders in every tenant's header;
   inert for tenants with no dual-lens views (Ascension today). */
.lens-switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lens-switch-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.4);
}

.lens-switch-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 100px;
  padding: 3px;
}

.lens-btn {
  padding: 5px 16px;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: rgba(255,255,255,.6);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .14s ease;
}

.lens-btn.active {
  background: var(--teal);
  color: #fff;
}

/* ── Page header (replaces per-card <h2> on single-card registry views) ──── */
.page-header {
  max-width: 1440px;
  padding: 24px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-header-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--navy);
}

.lens-chip {
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  border-radius: 100px;
  padding: 4px 9px;
}

.lens-chip--facility { background: var(--teal-muted); color: var(--teal); }
.lens-chip--oem      { background: var(--info-muted); color: var(--info); }

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 760px;
  text-wrap: pretty;
}

/* Dual-lens indicator inline in the nav tab — tells the reader which views
   the header lens switch actually reframes. */
.dual-lens-chip {
  display: inline-flex;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--teal);
  background: var(--teal-muted);
  border-radius: 100px;
  padding: 2px 6px;
  margin-left: 6px;
}

/* ── View tabs ──────────────────────────────────────────────────────────────── */
/* Sits directly under the navy header; one tab per view a signed-in tenant
   actually has (currently exactly one per tenant — see app.js TENANT_VIEWS).
   Styled as an underline-tab strip rather than pills, so it doesn't visually
   compete with the pill-style facility/manufacturer filters directly below it. */
.view-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.view-tab {
  padding: 12px 4px;
  margin: 0 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color .14s ease, border-color .14s ease;
}

.view-tab:hover {
  color: var(--text);
}

.view-tab.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

/* ── User info (header) ──────────────────────────────────────────────────────── */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-email {
  font-size: 12px;
  color: rgba(255,255,255,.65);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-sign-out {
  padding: 4px 12px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 100px;
  background: transparent;
  color: rgba(255,255,255,.75);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all .14s;
  white-space: nowrap;
}

.btn-sign-out:hover {
  border-color: rgba(255,255,255,.6);
  color: #fff;
}

.pipeline-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 12px;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-loading { background: #a0aec0; animation: pulse 1.4s ease-in-out infinite; }
.dot-live    { background: #48bb78; box-shadow: 0 0 6px rgba(72,187,120,.5); }
.dot-error   { background: #fc8181; }
/* Manually-loaded data (e.g. CCA today) — deliberately distinct from
   dot-live's glow/pulse, which implies an automated recurring feed this
   isn't yet. Static, neutral teal: "real and current" without claiming
   "live." */
.dot-manual  { background: #35B5A4; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .25; }
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* ── Controls bar ────────────────────────────────────────────────────────── */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.pill {
  padding: 5px 13px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .14s ease;
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}

.pill:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.pill.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

/* ── KPI Grid ────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--teal);
  transition: box-shadow .15s;
}

.kpi-card:hover { box-shadow: var(--shadow-md); }

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 32px; /* up from 30px — CLAUDE_CODE_BUILD.md, the roomier page-header pass */
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.kpi-card.kpi-warn    { border-left-color: var(--expired); }
.kpi-card.kpi-caution { border-left-color: var(--critical); }
/* A card whose value is genuinely absent (no data to show yet), not just a
   low/bad number — PAR Optimization's pending-pricing card. Deliberately a
   neutral gray, not a color implying good/bad, since there's nothing to
   judge yet. */
.kpi-card.kpi-neutral  { border-left-color: var(--border-strong); }

.kpi-card.kpi-clickable {
  cursor: pointer;
}

/* ── Breakdown panel (portal/js/components/classification-breakdown.js) ──────
   "Items per case, by classification" — CLAUDE_CODE_BUILD.md §4.3. Renders
   below a kpi-row's cards. Full-width here (not the 1.15fr/1fr grid the
   spec describes) since its sibling panel — a case-intensity histogram —
   has no backing endpoint yet (Blocked #2) and isn't built. */
.breakdown-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
}

.breakdown-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 14px;
}

.breakdown-rows { display: flex; flex-direction: column; gap: 10px; }

.breakdown-row {
  display: grid;
  grid-template-columns: 150px 1fr 84px 56px;
  align-items: center;
  gap: 12px;
}

.breakdown-label {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breakdown-track {
  height: 14px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.breakdown-fill {
  height: 100%;
  min-width: 3px;
  background: var(--teal);
  border-radius: 3px;
}

.breakdown-value {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

.breakdown-cases {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.kpi-card.kpi-clickable:hover {
  box-shadow: var(--shadow-md);
  background: rgba(42,140,126,.03);
}

.kpi-card.kpi-active {
  background: rgba(42,140,126,.06);
  border-bottom: 3px solid var(--teal);
}

.kpi-card.kpi-info {
  cursor: default;
}

/* ── Facility locked label ───────────────────────────────────────────────────── */
.facility-locked {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  padding: 5px 13px;
  background: var(--teal-muted);
  border-radius: 100px;
  border: 1.5px solid var(--teal);
}

/* ── Card highlight animation (Transfer Opportunities scroll) ────────────────── */
@keyframes card-pulse {
  0%   { box-shadow: var(--shadow-sm); }
  25%  { box-shadow: 0 0 0 3px var(--teal-light), var(--shadow-md); }
  100% { box-shadow: var(--shadow-sm); }
}

.card-highlight {
  animation: card-pulse 1.4s ease-out forwards;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.card-top h2,
.card-header-simple h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.01em;
}

.card-header-simple {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

/* Single-card views carry their title in .page-header now (h1), not a
   repeated in-card <h2> — see the "page header" section above. Keeps the
   card-actions row (search / Columns / Filter / CSV) right-aligned once the
   title column is gone. */
.card-top--no-title { justify-content: flex-end; }

.view-subtitle {
  padding: 0 20px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

/* ── Data window badge (portal/js/components/data-window-badge.js) ───────── */
.view-data-window {
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
}

.data-window-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 100px;
  padding: 3px 10px;
}

/* ── Confidence badge (portal/js/components/confidence-badge.js) ─────────────
   Richer sibling of .data-window-badge above — maturity meter + headline +
   extrapolation note. Renders into the same .view-data-window slot (see
   view-shell.js's style:'confidence' branch), so it inherits that
   container's padding/border-bottom rather than redeclaring its own. First
   used by PAR Optimization, 2026-08-13. */
.confidence-badge {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.confidence-meter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.confidence-seg {
  width: 18px;
  height: 6px;
  border-radius: 3px;
  background: var(--border-strong);
}

.confidence-seg.lit { background: var(--teal); }

.confidence-tier {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-left: 4px;
}

.confidence-headline {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
}

.confidence-note {
  flex-basis: 100%;
  font-size: 11px;
  color: var(--text-faint);
}

/* ── KPI row paired above a table (view-shell.js's pairedKpis) ───────────── */
.view-kpis {
  padding: 16px 20px 0;
}

.view-kpis .kpi-grid {
  margin-bottom: 16px;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Finding banner (portal/js/components/finding-banner.js) ─────────────────
   A rare, registry-declared "lead with the one striking number" card —
   CLAUDE_CODE_BUILD.md §4.2/§2.3. Own card (shadow/border-left), sits above
   the view's main card, not embedded inside it. */
.view-finding { margin-bottom: 20px; }

.finding-banner {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--expired);
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}

.finding-left { flex: 1; min-width: 320px; }
.finding-right { flex: 1; min-width: 280px; }

.finding-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--expired);
}

.finding-statement {
  font-size: 19px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -.01em;
  line-height: 1.35;
  margin-top: 4px;
}

.finding-caveat {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.finding-bar {
  display: flex;
  gap: 2px;
  height: 14px;
  border-radius: 3px;
  overflow: hidden;
}

.finding-bar-seg { height: 100%; }

.finding-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 12px;
}

.finding-legend-item { display: flex; align-items: center; gap: 6px; }

.finding-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.finding-legend-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.finding-legend-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-input {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  width: 260px;
  outline: none;
  transition: border-color .14s;
  background: var(--surface);
}

.search-input:focus { border-color: var(--teal); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-outline {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .14s;
  white-space: nowrap;
}

.btn-outline:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr { background: var(--bg); }

th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color .12s;
}

/* NOT overflow:hidden on th itself — the resize handle (table-controls.js)
   is deliberately positioned 3px outside the cell's right edge so it's easy
   to grab, and th-level overflow:hidden would clip it invisible/dead.
   .th-label below carries its own overflow:hidden instead. */
th:hover { color: var(--teal); }
th.sort-asc::after  { content: ' ↑'; color: var(--teal); }
th.sort-desc::after { content: ' ↓'; color: var(--teal); }

/* Inner span, not the <th> itself, truncates — CLAUDE_CODE_BUILD.md §3.1: a
   narrowed column (via the resize handle) truncates its label instead of
   breaking the grid. Sort arrow (th::after above) stays outside it, so it
   never gets clipped along with a long label. */
.th-label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

th.sorted .th-label,
th.sort-asc .th-label,
th.sort-desc .th-label {
  color: var(--navy);
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(42,140,126,.04); cursor: pointer; }

/* No width constraint here anymore — both table.js and generic-table.js are
   now resizable, colgroup-driven (table-layout:fixed), and a resize handle
   is the actual source of truth for width. A max-width here silently fought
   it: found live via a real resize+reload test where a column's rendered
   width stayed capped at this class's old max-width (280px) no matter what
   the resize handle or the persisted width said — the exact "CSS quietly
   overrides a JS-driven resize" bug class CLAUDE_CODE_BUILD.md's chart
   section warns about, just for a table column instead of a bar fill. */
.col-item   { }
.col-narrow { white-space: nowrap; }

.item-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  display: block;
  font-weight: 500;
}

/* ── PAR Optimization cell treatments (registry.js) ───────────────────────
   Generic utility classes, not PAR-specific — any future numeric/muted/
   pending column can reuse these. */
.cell-num {
  display: block;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-faint { color: var(--text-faint); }
.cell-muted { color: var(--text-muted); }

.pending-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: 100px;
  padding: 3px 10px;
}

/* Maturity-tiered action-copy tag — agrees with confidence-badge.js's own
   90/270-day thresholds. --info/--info-muted already documented as "OEM
   lens, preview tag" in :root (Phase 1 anticipated this exact use). */
.action-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 100px;
  padding: 2px 7px;
  margin-left: 6px;
  white-space: nowrap;
}

.action-tag.tag-preview     { background: var(--info-muted); color: var(--info); }
.action-tag.tag-recommended { background: var(--teal-muted); color: var(--teal); }

/* ── Risk badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.badge-EXPIRED  { background: #FDECEA; color: var(--expired); }
.badge-CRITICAL { background: #FEF0E6; color: var(--critical); }
.badge-AT_RISK  { background: #FEF9E7; color: var(--at-risk); }
.badge-MONITOR  { background: #EAFAF1; color: var(--monitor); }
.badge-none     { background: var(--bg); color: var(--text-muted); }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-info { white-space: nowrap; }

.pagination-btns {
  display: flex;
  gap: 4px;
}

.page-btn {
  min-width: 30px;
  padding: 4px 8px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  transition: all .12s;
  text-align: center;
}

.page-btn:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.page-btn:disabled { opacity: .35; cursor: default; }
.page-btn.active { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }

/* ── Bottom row ──────────────────────────────────────────────────────────── */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .bottom-row { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
  .controls-bar { gap: 12px; }
}

/* ── Risk panel ──────────────────────────────────────────────────────────── */
.risk-list { padding: 4px 0 0; }

.risk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}

.risk-row:last-child { border-bottom: none; }
.risk-row:hover { background: var(--bg); }

.risk-badge-wrap { flex-shrink: 0; width: 80px; }
.risk-meta { flex: 1; }
.risk-devices { font-size: 13px; font-weight: 600; color: var(--navy); }
.risk-units   { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.risk-exposure {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

/* ── Transfers panel ─────────────────────────────────────────────────────── */
.transfer-list { padding: 4px 0 0; }

.transfer-row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}

.transfer-row:last-child { border-bottom: none; }
.transfer-row:hover { background: var(--bg); }

.transfer-item {
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.transfer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.transfer-route {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.transfer-arrow { color: var(--teal); font-size: 13px; }

.transfer-days {
  padding: 1px 7px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
}
.days-expired  { background: #FDECEA; color: var(--expired); }
.days-critical { background: #FEF0E6; color: var(--critical); }

/* ── Bar chart / leaderboard (portal/js/components/chart.js) ───────────────
   6-column grid per CLAUDE_CODE_BUILD.md's chart rewrite: group label · mark
   (segmented bar) · SKU count · Vendors · Mfrs · Units used. Bar *length* is
   total count in the group; bar *segmentation* is fragmentation (one block
   per vendor or per manufacturer, whichever the active lens counts) — two
   different signals on one mark, which is the whole reason this replaced
   the old "pack everything into the label" version. */
.chart-bars { display: flex; flex-direction: column; }

.chart-header-row,
.chart-bar-row,
.chart-footer-row {
  display: grid;
  grid-template-columns: 230px 1fr 76px 80px 80px 78px;
  align-items: center;
  gap: 16px;
}

.chart-header-row {
  padding: 12px 24px;
  background: var(--surface-alt);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.chart-header-row .chart-col-right { text-align: right; }

.chart-bar-row {
  padding: 11px 24px;
  border-bottom: 1px solid var(--divider-light);
  cursor: default;
}

.chart-bar-clickable { cursor: pointer; }

.chart-bar-clickable:hover,
.chart-bar-clickable:focus-visible {
  background: rgba(42,140,126,.05);
  outline: none;
}

.chart-bar-label {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Full-width track; the fill is a flex-shrink:0 child of it, sized to
   (count / max) * 100%. THIS IS THE ONE PLACE TO BE CAREFUL: an earlier
   revision put the fill in a flex row beside the value label with a 44px
   floor — flex re-clamped the percentages against that floor and 7 of 10
   rows rendered at identical length. The fill must live inside its own
   full-width track (not share a flex row with anything else), keep
   min-width ≤6px, and stay flex-shrink:0 so the track's flex context never
   renegotiates its width against a sibling. */
.chart-bar-track {
  width: 100%;
  height: 18px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.chart-bar-fill {
  display: flex;
  height: 100%;
  min-width: 6px;
  flex-shrink: 0;
  gap: 2px;
}

.chart-bar-segment {
  flex: 1;
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
}

.chart-col-count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.chart-col-count--active { font-weight: 700; color: var(--navy); }
.chart-col-count--muted  { font-weight: 400; color: var(--text-muted); }

.chart-footer-row {
  padding: 14px 24px;
  background: var(--surface-alt);
  font-size: 12px;
  color: var(--text-muted);
}

.chart-footer-note { grid-column: 1 / -1; }

/* ── Empty / loading states ──────────────────────────────────────────────── */
.state-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.state-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,33,64,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(13,33,64,.25);
  width: 100%;
  max-width: 620px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color .12s;
}

.modal-close:hover { color: var(--text); }

.modal-header {
  padding: 22px 52px 16px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.modal-body { padding: 20px 24px 24px; }

.modal-section { margin-bottom: 20px; }
.modal-section:last-child { margin-bottom: 0; }

.modal-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}

.detail-item label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

.detail-item span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.transfer-flow {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--teal-muted);
  border-radius: 6px;
  margin-bottom: 16px;
}

.transfer-flow-facility {
  flex: 1;
  text-align: center;
}

.transfer-flow-facility label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--teal);
  display: block;
  margin-bottom: 4px;
}

.transfer-flow-facility span {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.transfer-flow-arrow {
  font-size: 20px;
  color: var(--teal);
  flex-shrink: 0;
}

/* ── Expiry filter bar ───────────────────────────────────────────────────────── */
.expiry-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.exp-pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.exp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .14s ease;
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}

.exp-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  border-radius: 100px;
  background: var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  transition: all .14s ease;
}

/* All */
.exp-pill.tier-all:hover                    { border-color: var(--navy); color: var(--navy); }
.exp-pill.tier-all.active                   { background: var(--navy); border-color: var(--navy); color: #fff; }
.exp-pill.tier-all.active .exp-count        { background: rgba(255,255,255,.25); color: #fff; }

/* Expired — red */
.exp-pill.tier-expired:hover                { border-color: var(--expired); color: var(--expired); }
.exp-pill.tier-expired.active               { background: #FDECEA; border-color: var(--expired); color: var(--expired); }
.exp-pill.tier-expired.active .exp-count    { background: var(--expired); color: #fff; }

/* 0–30 Days — amber */
.exp-pill.tier-critical:hover               { border-color: var(--critical); color: var(--critical); }
.exp-pill.tier-critical.active              { background: #FEF0E6; border-color: var(--critical); color: var(--critical); }
.exp-pill.tier-critical.active .exp-count   { background: var(--critical); color: #fff; }

/* 31–90 Days — blue */
.exp-pill.tier-watch:hover                  { border-color: #2471A3; color: #2471A3; }
.exp-pill.tier-watch.active                 { background: #EBF5FB; border-color: #2471A3; color: #2471A3; }
.exp-pill.tier-watch.active .exp-count      { background: #2471A3; color: #fff; }

/* 91–180 Days — teal */
.exp-pill.tier-teal:hover                   { border-color: var(--teal); color: var(--teal); }
.exp-pill.tier-teal.active                  { background: var(--teal-muted); border-color: var(--teal); color: var(--teal); }
.exp-pill.tier-teal.active .exp-count       { background: var(--teal); color: #fff; }

/* No Exp — grey */
.exp-pill.tier-none:hover                   { border-color: #7F8C8D; color: #5D6D7E; }
.exp-pill.tier-none.active                  { background: #F2F3F4; border-color: #7F8C8D; color: #5D6D7E; }
.exp-pill.tier-none.active .exp-count       { background: #7F8C8D; color: #fff; }

/* Sort headers disabled when a tier filter is active */
th.no-sort          { cursor: default; }
th.no-sort:hover    { color: var(--text-muted); }

/* ── Inline column filters ───────────────────────────────────────────────────── */

/* Filter row sits between the header row and tbody */
.cf-row { background: var(--surface); }
.cf-row th.cf-cell {
  padding: 4px 6px;
  border-bottom: 2px solid var(--teal);
  cursor: default;
  user-select: none;
}
.cf-row th.cf-cell:hover { color: inherit; }  /* suppress header hover teal */
.cf-cell-none { /* intentionally empty — no control */ }

/* Text inputs (substring match) */
.cf-text,
.cf-number {
  width: 100%;
  min-width: 56px;
  padding: 3px 7px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .12s;
}
.cf-text:focus,
.cf-number:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(42,140,126,.12); }

/* Enum selects */
.cf-select {
  width: 100%;
  min-width: 56px;
  max-width: 130px;
  padding: 3px 6px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  cursor: pointer;
  transition: border-color .12s;
}
.cf-select:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(42,140,126,.12); }

/* Date trigger button */
.cf-date-btn {
  width: 100%;
  min-width: 56px;
  padding: 3px 7px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color .12s, color .12s;
}
.cf-date-btn:hover      { border-color: var(--teal); color: var(--teal); }
.cf-date-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.cf-date-btn--active    { border-color: var(--teal); color: var(--teal); background: var(--teal-muted); }

/* Date range popover — position:fixed, body-anchored, escapes overflow:hidden */
.cf-date-pop {
  position: fixed;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), 0 8px 24px rgba(13,33,64,.14);
  z-index: 160;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .13s ease, transform .13s ease;
}
.cf-date-pop--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.cf-date-pop-inner {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.cf-date-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.cf-date-input {
  padding: 4px 8px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .12s;
  width: 100%;
}
.cf-date-input:focus { border-color: var(--teal); }
.cf-date-pop-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
}
.cf-date-clear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0;
  font-family: inherit;
  transition: color .12s;
}
.cf-date-clear:hover { color: var(--text); }
.cf-date-done {
  padding: 4px 12px;
  border: 1.5px solid var(--teal);
  border-radius: 5px;
  background: var(--teal);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.cf-date-done:hover { background: var(--teal-light); border-color: var(--teal-light); }

/* Column resize handle — new in this pass (CLAUDE_CODE_BUILD.md §3.2), no
   prior implementation existed anywhere in the repo. One implementation,
   every table.js/generic-table.js caller (see table-controls.js). */
.col-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 5;
}

/* Filter toggle button state */
.cf-filter-btn { display: inline-flex; align-items: center; gap: 6px; }
.cf-filter-active {
  border-color: var(--teal) !important;
  color: var(--teal) !important;
}
.cf-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 15px;
  padding: 0 4px;
  border-radius: 100px;
  background: var(--teal);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* NO EXP badge — grey neutral */
.badge-NO_EXP { background: #EAECEE; color: #717D7E; }

/* ── Risk row — non-clickable tiers (MONITOR) ────────────────────────────────── */
.risk-row-no-click          { cursor: default; }
.risk-row-no-click:hover    { background: transparent; }

/* ── Risk tier modal — exposure/action card ──────────────────────────────────── */
.risk-exposure-big {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  display: block;
}

.transfer-flow-facility small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.transfer-flow-action span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
}

/* ── Risk tier modal — device list ───────────────────────────────────────────── */
.risk-device-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.risk-device-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.risk-device-row:last-child { border-bottom: none; }

.risk-device-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.risk-device-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.risk-days-label { font-weight: 600; }

.risk-device-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Risk tier modal — device row: reviewed checkbox ─────────────────────────── */
.risk-device-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.review-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.review-label input[type="checkbox"] { cursor: pointer; }

.risk-device-row.reviewed .risk-device-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.risk-device-row.reviewed .risk-device-meta,
.risk-device-row.reviewed .risk-device-stats {
  opacity: 0.45;
}

/* ── Risk tier modal — footer ────────────────────────────────────────────────── */
.modal-footer-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  margin-top: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-footer-totals {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-footer-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.btn-sm {
  padding: 4px 10px !important;
  font-size: 11px !important;
}

/* ── Login page ──────────────────────────────────────────────────────────────── */
.login-page {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 24px;
  overflow-y: auto;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(0,0,0,.35);
  padding: 52px 48px 48px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.login-logo {
  margin-bottom: 20px;
}

.login-brand {
  font-size: 28px;
  font-weight: 300;
  color: var(--navy);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.login-brand span {
  font-weight: 700;
}

.login-tagline {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 36px;
  text-align: center;
  line-height: 1.5;
}

.google-signin-wrap {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.login-error {
  margin-top: 16px;
  font-size: 13px;
  color: var(--expired);
  text-align: center;
  line-height: 1.5;
  max-width: 300px;
}

.login-error.hidden { display: none; }

.login-legal {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e5e5e5;
  text-align: center;
  width: 100%;
}

.login-legal p {
  font-size: 10px;
  color: #999;
  line-height: 1.65;
  max-width: 320px;
  margin: 0 auto;
}

.login-compliance-badges {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--teal);
  text-transform: uppercase;
}

.compliance-dot {
  color: #ccc;
  font-size: 12px;
  line-height: 1;
}
