/* ============================================================
   IDCC Platform Design System
   ============================================================ */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed: 64px;
  --topbar-height: 56px;
  --brand-primary: #032366;
  --brand-dark: #0a0e27;
  --brand-sidebar: #0f1535;
  --brand-sidebar-hover: #1a2247;
  --brand-sidebar-active: #1e2a52;
  --brand-accent: #4e7cff;
  --brand-accent-soft: rgba(78,124,255,.12);
  --brand-orange: #f47b22;
  --brand-surface: #f5f7fa;
  --brand-card: #ffffff;
  --brand-border: #e2e8f0;
  --brand-text: #1e293b;
  --brand-text-muted: #64748b;
  --brand-text-light: #94a3b8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.1);
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--brand-surface);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--brand-text);
  -webkit-font-smoothing: antialiased;
}
/* ---- Layout Shell ---- */
.platform-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.platform-sidebar {
  width: var(--sidebar-width);
  background: var(--brand-sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}
.platform-sidebar .sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.platform-sidebar .sidebar-brand .brand-logo {
  width: 28px;
  height: 28px;
  background: var(--brand-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.platform-sidebar .sidebar-brand .brand-text {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* Nav sections */
.sidebar-section {
  margin-bottom: 2px;
}
.sidebar-section-header {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  margin: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}
.sidebar-section-header:hover { color: #e2e8f0; background: var(--brand-sidebar-hover); }
.sidebar-section-header .section-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  margin-right: 12px;
  opacity: .7;
}
.sidebar-section-header:hover .section-icon { opacity: 1; }
.sidebar-section-header .chevron {
  margin-left: auto;
  font-size: 10px;
  transition: transform var(--transition);
  opacity: .5;
}
.sidebar-section.collapsed .chevron { transform: rotate(-90deg); }
.sidebar-section.collapsed .sidebar-section-items {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0;
  transition: max-height .25s ease, opacity .2s ease;
}
.sidebar-section-items {
  max-height: 800px;
  opacity: 1;
  overflow: hidden;
  transition: max-height .3s ease, opacity .25s ease;
  padding-bottom: 4px;
}
/* Active section header highlight */
.sidebar-section.has-active > .sidebar-section-header {
  color: #e2e8f0;
}
.sidebar-section.has-active > .sidebar-section-header .section-icon {
  color: var(--brand-accent);
  opacity: 1;
}

/* Nav items */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  border-radius: 0;
  margin: 0 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}
.sidebar-item:hover {
  color: #e2e8f0;
  background: var(--brand-sidebar-hover);
}
.sidebar-item.active {
  color: #fff;
  background: var(--brand-sidebar-active);
}
.sidebar-item.active .sidebar-icon {
  color: var(--brand-accent);
}
.sidebar-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: .7;
}
.sidebar-item:hover .sidebar-icon { opacity: 1; }
.sidebar-item.active .sidebar-icon { opacity: 1; }
.sidebar-item .item-label { white-space: nowrap; }

/* Sidebar home link */
.sidebar-home {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  margin: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.sidebar-home:hover { background: var(--brand-sidebar-hover); color: #fff; }
.sidebar-home.active { background: var(--brand-sidebar-active); color: #fff; }

/* Sidebar section labels */
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.35);
  padding: 14px 20px 4px;
  text-transform: uppercase;
}
.platform-sidebar.minimised .sidebar-label { display: none; }
.platform-sidebar.minimised:hover .sidebar-label { display: block; }
.sidebar-sublabel {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,.25);
  padding: 10px 20px 2px;
  text-transform: uppercase;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 4px;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 12px 16px;
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: default;
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  background: var(--brand-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; flex: 1; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: #64748b;
}
.sidebar-logout {
  color: #64748b;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition);
  text-decoration: none;
}
.sidebar-logout:hover { color: #ef4444; background: rgba(239,68,68,.1); }

/* ---- Main Content ---- */
.platform-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* ---- Top Bar ---- */
.platform-topbar {
  height: var(--topbar-height);
  background: var(--brand-card);
  border-bottom: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 1020;
  flex-shrink: 0;
}
.topbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--brand-text);
  cursor: pointer;
  padding: 4px;
}
.topbar-breadcrumb {
  font-size: 14px;
  color: var(--brand-text-muted);
  font-weight: 500;
}
.topbar-breadcrumb strong {
  color: var(--brand-text);
  font-weight: 600;
}
.breadcrumb-section { display: block; line-height: 1.1; }
.breadcrumb-section:empty { display: none; }
.topbar-spacer { flex: 1; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-btn {
  background: none;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  color: var(--brand-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  font-weight: 500;
}
.topbar-btn:hover { background: var(--brand-surface); border-color: #cbd5e1; }
.topbar-btn.btn-ram {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}
.topbar-btn.btn-ram:hover { background: #b91c1c; }
.topbar-btn.btn-raf {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.topbar-btn.btn-raf:hover { background: #15803d; }

/* ---- Content Area ---- */
.platform-content {
  flex: 1;
  padding: 24px;
  max-width: 100%;
}

/* ---- Cards (override Bootstrap) ---- */
.card {
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--brand-card);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  background: var(--brand-card);
  border-bottom: 1px solid var(--brand-border);
  font-weight: 600;
  font-size: 14px;
}

/* ---- Tables ---- */
.table th {
  background: var(--brand-surface);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--brand-text-muted);
  border-bottom: 2px solid var(--brand-border);
}
.table td { vertical-align: middle; }

/* ---- Buttons ---- */
.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-primary:hover {
  background: #021b52;
  border-color: #021b52;
}

/* ---- Badges ---- */
.badge { font-weight: 500; font-size: 11px; letter-spacing: .02em; }

/* ---- Alerts ---- */
.platform-alerts {
  padding: 0;
  margin: 0;
}
.platform-alerts .alert {
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  margin-bottom: 12px;
}

/* ---- Login (full-page, no sidebar) ---- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-dark) 0%, #0f1535 50%, #142046 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--brand-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: 40px 36px;
}
.login-card h4 { color: var(--brand-primary); }
.login-card .brand-logo-lg {
  width: 48px;
  height: 48px;
  background: var(--brand-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  margin: 0 auto 20px;
}

/* ---- Sidebar Auto-minimise ---- */
.platform-sidebar.minimised {
  width: var(--sidebar-collapsed);
}
.platform-sidebar.minimised .brand-text,
.platform-sidebar.minimised .item-label,
.platform-sidebar.minimised .sidebar-section-header span:not(.section-icon),
.platform-sidebar.minimised .chevron,
.platform-sidebar.minimised .sidebar-user-info,
.platform-sidebar.minimised .sidebar-logout {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity .15s, width .15s;
}
.platform-sidebar.minimised .sidebar-brand { padding: 0 18px; justify-content: center; }
.platform-sidebar.minimised .sidebar-section-header { padding: 9px 0; justify-content: center; margin: 0 4px; }
.platform-sidebar.minimised .sidebar-section-header .section-icon { margin-right: 0; }
.platform-sidebar.minimised .sidebar-item { padding: 8px 0; justify-content: center; gap: 0; margin: 0 4px; }
.platform-sidebar.minimised .sidebar-home { padding: 10px 0; justify-content: center; gap: 0; margin: 4px; }
.platform-sidebar.minimised .sidebar-footer { padding: 12px 8px; }
.platform-sidebar.minimised .sidebar-user { justify-content: center; padding: 6px 0; }
.platform-sidebar.minimised .sidebar-user-avatar { margin: 0; }
/* Expand on hover when minimised */
.platform-sidebar.minimised:hover {
  width: var(--sidebar-width);
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
}
.platform-sidebar.minimised:hover .brand-text,
.platform-sidebar.minimised:hover .item-label,
.platform-sidebar.minimised:hover .sidebar-section-header span,
.platform-sidebar.minimised:hover .chevron,
.platform-sidebar.minimised:hover .sidebar-user-info,
.platform-sidebar.minimised:hover .sidebar-logout {
  opacity: 1;
  width: auto;
}
.platform-sidebar.minimised:hover .sidebar-brand { padding: 0 20px; justify-content: flex-start; }
.platform-sidebar.minimised:hover .sidebar-section-header { padding: 9px 20px; justify-content: flex-start; margin: 0 8px; }
.platform-sidebar.minimised:hover .sidebar-section-header .section-icon { margin-right: 12px; }
.platform-sidebar.minimised:hover .sidebar-item { padding: 8px 20px; justify-content: flex-start; gap: 12px; margin: 0 8px; }
.platform-sidebar.minimised:hover .sidebar-home { padding: 10px 20px; justify-content: flex-start; gap: 12px; margin: 4px 8px; }
.platform-sidebar.minimised:hover .sidebar-footer { padding: 12px 16px; }
.platform-sidebar.minimised:hover .sidebar-user { justify-content: flex-start; padding: 6px 8px; }
/* Main content shifts when minimised */
.platform-main.sidebar-minimised {
  margin-left: var(--sidebar-collapsed);
  max-width: calc(100vw - var(--sidebar-collapsed));
}
/* Pin button */
.sidebar-pin-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.5);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 5px;
  border-radius: 4px;
  transition: all var(--transition);
  margin-left: auto;
  flex-shrink: 0;
  line-height: 1;
}
.sidebar-pin-btn:hover { color: #fff; }
.sidebar-pin-btn.pinned { color: #fff; }
.platform-sidebar.minimised .sidebar-pin-btn { display: none; }
.platform-sidebar.minimised:hover .sidebar-pin-btn { display: block; }

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1035;
  backdrop-filter: blur(2px);
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
  .platform-sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .platform-sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .platform-main { margin-left: 0; max-width: 100vw; }
  .platform-main.sidebar-minimised { margin-left: 0; max-width: 100vw; }
  .topbar-toggle { display: flex; }
  .platform-content { padding: 12px; }

  /* Tables scroll horizontally */
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .table { font-size: .8rem; }

  /* Cards stack full width */
  .card { border-radius: var(--radius-sm); }

  /* Stats row */
  .row.g-3 > [class*="col-md"] { flex: 0 0 50%; max-width: 50%; }

  /* Topbar compact */
  .platform-topbar { padding: 0 12px; gap: 8px; }
  .topbar-breadcrumb { font-size: 13px; }
  .topbar-btn { padding: 4px 8px; font-size: 12px; }

  /* Welcome header */
  .welcome-header { padding: 16px 20px; }
  .welcome-header h3 { font-size: 1.2rem; }

  /* Dashboard grid */
  .dash-grid { grid-template-columns: 1fr !important; }
  .dash-card { grid-column: 1 / -1 !important; grid-row: auto !important; }

  /* Modals full width on mobile */
  .modal-dialog { margin: 8px; max-width: calc(100% - 16px); }

  /* Forms */
  .form-control-sm, .form-select-sm { font-size: 14px; padding: 6px 10px; }

  /* Designer shell responsive */
  .designer-shell { grid-template-columns: 1fr !important; }

  /* Hide less important columns on mobile */
  .d-none-mobile { display: none !important; }
}

@media (max-width: 575.98px) {
  .platform-content { padding: 8px; }
  .row.g-3 > [class*="col-md"] { flex: 0 0 100%; max-width: 100%; }
  .topbar-breadcrumb strong { font-size: 12px; }
  .welcome-header h3 { font-size: 1rem; }
  .stat-card .stat-value { font-size: 1.5rem; }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  :root { --sidebar-width: 240px; }
}

/* ---- Scrollbar Global ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Form Inputs (global polish) ---- */
.form-control:focus, .form-select:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px var(--brand-accent-soft);
}

/* ---- Print override ---- */
@media print {
  @page { size: landscape; margin: 10mm; }
  .platform-sidebar, .platform-topbar, #ramBtn, #ramModal, .no-print, form, .btn, .pagination, nav { display: none !important; }
  .platform-main { margin-left: 0 !important; max-width: 100% !important; }
  .platform-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  body { font-size: 10px !important; }
  canvas { max-height: 200px !important; }
}

/* ---- Existing class compat ---- */
.editable-row { background: #fffbeb; }
.calc-field { background: #ecfdf5; font-weight: 600; }
.badge-si { background: #16a34a; }
.badge-cr { background: #dc2626; }

/* ---- Portal Welcome ---- */
.welcome-header {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-dark) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
}
.welcome-header h3 { margin: 0; font-weight: 700; }
.welcome-header p { margin: 4px 0 0; opacity: .8; font-size: .9rem; }

/* Quick link cards */
.quick-link {
  transition: transform .15s, box-shadow .15s;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--brand-border) !important;
}
.quick-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg) !important;
}
.link-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Portal dashboard cards */
.portal-card {
  transition: transform .15s, box-shadow .15s;
}
.portal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg) !important;
}

/* News cards */
.news-card { border-left: 4px solid; border-radius: var(--radius-sm); }
.news-card.border-primary { border-left-color: var(--brand-primary); }
.news-card.border-success { border-left-color: #16a34a; }
.news-card.border-warning { border-left-color: #eab308; }
.news-card.border-danger { border-left-color: #dc2626; }
.news-card.border-info { border-left-color: #0ea5e9; }

/* ---- RAM Modal (updated) ---- */
#ramModal .modal-header {
  background: var(--brand-dark);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* ---- A261: Frozen table headers (sticky thead, page-scroll) ----
   Headers stick just below the topbar as the page scrolls.
   Bootstrap's .table-responsive creates a scroll container that
   would trap sticky inside it, so on desktop we let it pass through
   and only re-enable horizontal scroll on narrow viewports. */
.table-responsive { overflow: visible; }
@media (max-width: 991.98px) {
  .table-responsive { overflow-x: auto; }
}

.table > thead > tr > th,
.table > thead > tr > td {
  position: sticky;
  top: var(--topbar-height);
  z-index: 5;
  background: var(--brand-card);
  /* preserve the bottom rule that Bootstrap normally draws via border */
  box-shadow: inset 0 -1px 0 var(--brand-border);
}
.table > thead.table-light > tr > th,
.table > thead.table-light > tr > td {
  background: #f8fafc;
}
.table > thead.table-dark > tr > th,
.table > thead.table-dark > tr > td {
  background: var(--brand-dark);
  color: #fff;
}
/* Two-row headers (e.g. grouped columns): stack the second row */
.table > thead > tr:nth-child(2) > th,
.table > thead > tr:nth-child(2) > td {
  top: calc(var(--topbar-height) + 38px);
}
/* Opt-out for tables that shouldn't freeze (e.g. inside modals,
   nested compact summary tables, or tables already in a scroll box) */
.modal .table > thead > tr > th,
.modal .table > thead > tr > td,
.table.no-sticky-head > thead > tr > th,
.table.no-sticky-head > thead > tr > td {
  position: static;
  box-shadow: none;
}

/* A325 — Tables wrapped in a self-scrolling .table-responsive (inline
   max-height) need the thead pinned to the *container's* top, not the
   viewport's. The default top:var(--topbar-height) was being interpreted
   relative to the inner scroll container, leaving a 56px gap into which
   the first data row scrolled — visually rendering row 1 above the
   pinned column headers (e.g. /dave/order-sync Recent Orders, Xero
   pending invoices, products overview). */
.table-responsive[style*="max-height"] > .table > thead > tr > th,
.table-responsive[style*="max-height"] > .table > thead > tr > td {
  top: 0;
}
.table-responsive[style*="max-height"] > .table > thead > tr:nth-child(2) > th,
.table-responsive[style*="max-height"] > .table > thead > tr:nth-child(2) > td {
  top: 38px;
}

/* A325 — On mobile (≤991.98px) .table-responsive switches to
   overflow-x:auto (see the existing rule below at the same breakpoint),
   which makes the sticky thead's `top` resolve against the inner
   container instead of the viewport — the same gap-above-thead bug as
   the max-height case. */
@media (max-width: 991.98px) {
  .table-responsive > .table > thead > tr > th,
  .table-responsive > .table > thead > tr > td {
    top: 0;
  }
  .table-responsive > .table > thead > tr:nth-child(2) > th,
  .table-responsive > .table > thead > tr:nth-child(2) > td {
    top: 38px;
  }
}

/* ─── A261 — Shared sticky-table helpers ────────────────────────────────────
   The global rule above already freezes thead on every Bootstrap .table.
   Two opt-in classes for tables that need MORE:

   .sticky-table          — opt-in for non-Bootstrap tables (custom .perf-table
                             etc) so they get the same thead freeze without
                             needing the .table base class.
   .sticky-table-first-col — also freezes the first th/td column when scrolling
                             sideways. Use on wide tables with row labels (e.g.
                             /dave/sales-performance, anywhere with a tall
                             "Salesperson" or "Business Unit" leftmost column).
   Combine: <table class="table sticky-table sticky-table-first-col"> for full
   2-axis freeze. Stripe-row colours need to be re-stated on the sticky cells
   so the freeze blends with the table body.
*/
.sticky-table thead th,
.sticky-table thead td {
  position: sticky;
  top: var(--topbar-height);
  z-index: 5;
  background: var(--brand-card);
  box-shadow: inset 0 -1px 0 var(--brand-border);
}
.sticky-table thead tr:nth-child(2) th,
.sticky-table thead tr:nth-child(2) td {
  top: calc(var(--topbar-height) + 38px);
}
.sticky-table-first-col tbody th:first-child,
.sticky-table-first-col tbody td:first-child,
.sticky-table-first-col thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--brand-card);
}
.sticky-table-first-col thead th:first-child {
  z-index: 6;  /* corner cell sits above both axes */
}
/* Allow opt-out per-row for cells that need to stay in body flow */
.sticky-table-first-col .no-sticky-col:first-child {
  position: static !important;
}
