:root {
  /* ADR-0145 M1: sidebar rail, charcoal in both themes */
  --sidebar-bg: #1f2d3a;
  --sidebar-text: #d5dde5;
  --sidebar-muted: #8fa1b3;
  --sidebar-hover: #2a3b4c;
  --sidebar-active-bg: #ffffff;
  --sidebar-active-text: #1f2d3a;
  /* Turns Brand Colors */
  --bg: #f8f9fa;
  --bg-card: #fff;
  --bg-soft: #f8f9fa;
  --bg-subtle: #f0f2f5;
  --bg-secondary: #f0f2f5;
  --text: #2c3e50;
  --text-strong: #1a2533;
  --text-subtle: #666;
  --text-muted: #95a5a6;
  --text-faint: #999;
  --text-on-primary: #fff;
  --border: #ecf0f1;
  --border-subtle: #e1e5eb;
  --border-strong: #d6dbdf;
  --primary: #2c3e50;
  --primary-hover: #34495e;
  --success: #27ae60;
  --success-hover: #1e8449;
  --success-text-strong: #166534;
  --warning: #f39c12;
  --warning-hover: #e67e22;
  --warning-text-strong: #b7950b;
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --danger-text-strong: #922b21;
  --info: #2563eb;
  --info-hover: #1565c0;
  --info-text-strong: #1d5a85;
  --info-bg: #e3f2fd;
  --info-bg-hover: #d6eaf8;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-strong: 0 4px 12px rgba(0,0,0,0.1);
  --overlay: rgba(0,0,0,0.5);

  /* Derived status tints (light backgrounds for status indicators) */
  --success-bg: #f0fdf4;
  --success-bg-hover: #dcfce7;
  --warning-bg: #fffbeb;
  --warning-bg-hover: #fef3c7;
  --danger-bg: #fef2f2;
  --danger-bg-hover: #fee2e2;
  --primary-bg: #f0f4f8;
  --primary-bg-hover: #e2e8f0;

  /* Button hover variants */
  --border-hover: #d5dbdb;

  /* Row-hover that adapts in dark mode */
  --row-hover: #f8f9fa;
  --pickable-row-bg: #f0f4ff;
  /* Translucent overlay layered over a --primary background (e.g. the Exit
     Impersonation button on the impersonation banner). Light mode: white
     wash on dark navy. Dark mode (overridden below): dark wash on light
     slate. Keeps button visible in both themes. */
  --overlay-on-primary: rgba(255, 255, 255, 0.2);
  --overlay-on-primary-hover: rgba(255, 255, 255, 0.35);
}

/* Dark theme — set via document.documentElement.dataset.theme = 'dark'.
   Re-declares every token so any element using var(--…) flips automatically.
   See /js/shared/theme.js for the toggle wiring. */
[data-theme="dark"] {
  --sidebar-bg: #121820;
  --sidebar-text: #c9d2dc;
  --sidebar-muted: #7f8b97;
  --sidebar-hover: #1d2631;
  --sidebar-active-bg: #2c3a4a;
  --sidebar-active-text: #ffffff;
  --bg: #0f1419;
  --bg-card: #1a2030;
  --bg-soft: #161b22;
  --bg-subtle: #20272f;
  --bg-secondary: #20272f;
  --text: #e6e9ed;
  --text-strong: #ffffff;
  --text-subtle: #b0b7c0;
  --text-muted: #8b949e;
  --text-faint: #6e7681;
  --border: #2d333b;
  --border-subtle: #2d333b;
  --border-strong: #444c56;
  --border-hover: #444c56;
  /* Primary in dark mode is a lightened Charcoal — same slate-navy hue family
     as the brand's #2c3e50, just raised in lightness so it reads on a dark
     background. NOT a generic vibrant blue. Stays on-brand for the logo,
     primary buttons, and breadcrumb-current. */
  --primary: #bdc7d3;
  --primary-hover: #d4dce5;
  --primary-bg: #1f2a38;
  --primary-bg-hover: #2a3848;
  --text-on-primary: #0f1419;
  --success: #3fb950;
  --success-hover: #56d364;
  --success-text-strong: #56d364;
  --success-bg: #0d2818;
  --success-bg-hover: #133622;
  --warning: #d29922;
  --warning-hover: #e3b341;
  --warning-text-strong: #e3b341;
  --warning-bg: #2d2410;
  --warning-bg-hover: #3a2d12;
  --danger: #f85149;
  --danger-hover: #ff6a63;
  --danger-text-strong: #ff8b86;
  --danger-bg: #2d1212;
  --danger-bg-hover: #401818;
  /* Info is the only accent the brand doesn't define — it carries the "blue"
     role for link-like UI (status pills, "Approved", info badges). Pulled
     toward the Charcoal slate hue so it complements rather than fights the
     primary. */
  --info: #7da3c8;
  --info-hover: #96b8d6;
  --info-text-strong: #a3c2dd;
  --info-bg: #18253a;
  --info-bg-hover: #233247;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-strong: 0 4px 12px rgba(0,0,0,0.4);
  --overlay: rgba(0,0,0,0.7);
  --row-hover: #20272f;
  --pickable-row-bg: #1c2c4a;
  --overlay-on-primary: rgba(0, 0, 0, 0.15);
  --overlay-on-primary-hover: rgba(0, 0, 0, 0.28);
}

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

body {
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.region-list-table { width: 100%; border-collapse: collapse; }
.region-list-table th, .region-list-table td { padding: 10px 16px; text-align: left; border-top: 1px solid var(--border-subtle); vertical-align: middle; }
.region-list-table th { font-size: 12px; font-weight: 600; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.04em; }
.region-list-current td { background: var(--bg-soft); }

/* ADR-0145 M9: Company › Plan and Billing. These classes were used and never defined. */
.billing-page { display: flex; flex-direction: column; gap: 20px; max-width: 960px; }
.billing-section { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 20px; }
.billing-section-title { font-size: 15px; font-weight: 600; margin: 0 0 14px; color: var(--text-strong); }
.billing-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.billing-hero-cell-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-subtle); margin-bottom: 4px; }
.billing-hero-cell-value { font-size: 18px; font-weight: 600; color: var(--text-strong); }
.billing-money { font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; color: white; background: var(--text-muted); }
.pill.verified { background: var(--success); }
.pill.submitted { background: var(--warning); }
.pill.approved { background: var(--info); }
.pill.failed { background: var(--danger); }
.pill.draft { background: var(--border); color: var(--text); }
.pad-existing { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pad-existing-label { font-weight: 600; color: var(--text-strong); }
#pad-form-host:not(:empty) { margin-top: 16px; }
.pad-form { display: grid; gap: 14px; max-width: 520px; }
.pad-form-row { display: flex; flex-direction: column; gap: 4px; }
.pad-form-row label { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.pad-form-row input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card); color: var(--text); font-size: 14px; }
.pad-form-row input:focus-visible { outline: 2px solid #8db6f0; outline-offset: 1px; }
.pad-form-row .hint { font-size: 12px; color: var(--text-subtle); }
.pad-form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.invoice-table { width: 100%; border-collapse: collapse; }
.invoice-table th, .invoice-table td { padding: 12px 16px; text-align: left; border-top: 1px solid var(--border-subtle); vertical-align: middle; }
.invoice-table thead th { border-top: none; font-size: 12px; font-weight: 600; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.04em; }
.invoice-table .invoice-amount { text-align: right; font-variant-numeric: tabular-nums; }
.invoice-number { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.plan-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.plan-toggle input { width: 18px; height: 18px; accent-color: var(--primary); }
.plan-toggle input:disabled { cursor: not-allowed; }

/* ADR-0028: multi-location scope picker in the add/edit employee forms */
.location-checkbox-list {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--bg-card);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.card-body { padding: 20px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--text-on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--border-hover); }
.btn-danger { background: var(--danger); color: var(--text-on-primary); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--border); color: var(--text); }
.btn-danger-icon:hover { background: var(--danger); color: var(--text-on-primary); }

/* Impersonation banner — fixed strip at the top while a super-admin is
   viewing a customer. Was inline style.cssText in navigation.js; moved
   into CSS so the Exit button overlay can flip from a white-wash (light
   mode) to a dark-wash (dark mode) via --overlay-on-primary. */
.impersonation-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: var(--text-on-primary);
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}
.impersonation-banner button {
  background: var(--overlay-on-primary);
  border: none;
  color: var(--text-on-primary);
  padding: 4px 12px;
  margin-left: 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.impersonation-banner button:hover {
  background: var(--overlay-on-primary-hover);
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--primary); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-weight: 600; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.table tr:hover { background: var(--bg); }
.table-clickable tr { cursor: pointer; }
/* Wrapper for wide tables. Transparent on desktop (keeps hover tooltips unclipped);
   becomes horizontally scrollable on narrow screens — see the mobile media query. */
.table-scroll { max-width: 100%; }

/* Reusable hover-bg utility (drop-in for migration off inline
   `onmouseenter="this.style.background='#f8f9fa'" onmouseleave="this.style.background=''"`
   — see CSP sweep, task #89). */
.row-hover { cursor: pointer; transition: background 0.1s; }
.row-hover:hover { background: var(--row-hover); }

/* Color-shift hover for muted-link-style spans */
.hover-darken:hover { color: var(--primary-hover); }

/* Underline-on-hover for ingredient-match links */
.hover-underline:hover { text-decoration: underline; }

/* Pickable list row — selected state takes priority over hover. */
.pickable-row { cursor: pointer; }
.pickable-row:hover:not(.selected) { background: var(--bg-subtle); }
.match-ingredient-row:hover:not(.selected) { background: var(--pickable-row-bg); }

/* Supplier-filter pill — `.active` state styled here so we can drop the
   inline `this.style.background=…; this.style.color=…; this.style.borderColor=…`
   handler in suppliers.js. */
.type-pill {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-subtle);
  transition: all 0.15s;
}
.type-pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-on-primary);
}

/* Month grid */
.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.month-card {
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.month-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.month-card .card-body { padding: 24px 20px; }
.month-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}
.month-year {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.month-count {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}
.month-card.previous-years {
  background: linear-gradient(135deg, var(--bg) 0%, var(--border) 100%);
  border-style: dashed;
}

/* Scope/Location grid */
.scope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.scope-card {
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg) 100%);
}
.scope-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--primary);
}
.scope-card .card-body { padding: 24px 20px; position: relative; }
.scope-actions {
  position: absolute;
  top: 8px;
  right: 8px;
}
.scope-actions .btn-link {
  padding: 4px;
  color: var(--text-muted);
  opacity: 0.6;
  transition: opacity 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
}
.scope-actions .btn-link:hover {
  opacity: 1;
  color: var(--primary);
}
/* Inventory card grid */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.inventory-card { cursor: pointer; transition: all 0.15s; text-align: center; }
.inventory-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--primary);
}
.inventory-card .card-body { padding: 32px 20px; }
.inventory-card-icon { margin-bottom: 12px; color: var(--primary); }
.inventory-card-icon svg { width: 32px; height: 32px; }
.supplier-card { transition: all 0.15s; }
.supplier-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--primary);
}
.inventory-card-disabled { opacity: 0.5; cursor: default; pointer-events: none; }

.scope-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.scope-code {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 8px;
}
.scope-info {
  font-size: 13px;
  color: var(--text-muted);
}
.region-section {
  margin-bottom: 32px;
}
.region-header {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Date list */
.date-list { list-style: none; }
.date-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  border-left: 4px solid transparent;
}
.date-item:hover { background: var(--bg); }
.date-item:last-child { border-bottom: none; }
.date-label { font-weight: 500; }
.date-meta { font-size: 13px; color: var(--text-muted); }
.date-cash { font-weight: 600; color: var(--success); font-size: 14px; }

/* Date item status colors */
.date-item-verified { border-left-color: var(--success); background: var(--success-bg); }
.date-item-verified:hover { background: var(--success-bg-hover); }
.date-item-submitted { border-left-color: var(--primary); background: var(--primary-bg); }
.date-item-submitted:hover { background: var(--primary-bg-hover); }
.date-item-missing { border-left-color: var(--danger); background: var(--danger-bg); }
.date-item-missing:hover { background: var(--danger-bg-hover); }

/* Month summary table */
.month-table-wrapper { overflow-x: auto; }
.month-summary-table { min-width: 800px; }
.month-summary-table th { white-space: nowrap; }
.month-summary-table td { white-space: nowrap; }

/* Month table row colours: the tip pipeline with the EOD stages in front.
   Mirrors STAGE_COLORS in tip-management.js so a day reads the same colour
   here as its week does on the tips screen. */
.row-missing, .row-no-report, .row-unverified, .row-failed { background: var(--danger-bg); border-left: 4px solid var(--danger); }
.row-missing:hover, .row-no-report:hover, .row-unverified:hover, .row-failed:hover { background: var(--danger-bg-hover); }
.row-ready { background: var(--warning-bg); border-left: 4px solid var(--warning); }
.row-ready:hover { background: var(--warning-bg-hover); }
.row-allocated { background: var(--info-bg); border-left: 4px solid var(--info); }
.row-allocated:hover { background: var(--info-bg-hover); }
.row-distributing { background: var(--success-bg); border-left: 4px solid var(--success-hover); }
.row-distributing:hover { background: var(--success-bg-hover); }
.row-distributed { background: var(--success-bg); border-left: 4px solid var(--success); }
.row-distributed:hover { background: var(--success-bg-hover); }
.row-closed { color: var(--text-muted); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 20px; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 600; }
.stat-value.money::before { content: '$'; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Server cards */
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.server-card { cursor: pointer; transition: box-shadow 0.15s; }
.server-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.server-name { font-weight: 600; font-size: 16px; margin-bottom: 8px; }
.server-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.server-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.server-stat-value { font-size: 16px; font-weight: 600; }
.server-adjustments { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.adjustment-badge { font-size: 11px; padding: 4px 8px; border-radius: var(--radius); font-weight: 500; }
.adjustment-badge.void { background: var(--danger-bg-hover); color: var(--danger); }
.adjustment-badge.discount { background: var(--warning-bg-hover); color: var(--warning); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card { width: 100%; max-width: 360px; }
.login-title { text-align: center; margin-bottom: 24px; font-size: 24px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-admin { background: var(--primary-bg-hover); color: var(--text); }
.badge-viewer { background: var(--border); color: var(--text-muted); }

/* Report Status */
.report-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
}
.report-status.verified { background: var(--success-bg-hover); color: var(--success); }
.report-status.pending { background: var(--warning-bg-hover); color: var(--warning); }
.report-status.missing, .report-status.no-report, .report-status.unverified, .report-status.failed { background: var(--danger-bg-hover); color: var(--danger); }
.report-status.ready { background: var(--warning-bg-hover); color: var(--warning); }
.report-status.allocated { background: var(--info-bg-hover); color: var(--info); }
.report-status.distributing { background: var(--success-bg-hover); color: var(--success-hover); }
.report-status.distributed { background: var(--success-bg-hover); color: var(--success); }
.report-status.closed { background: var(--text-muted); color: var(--text-on-primary); }

/* Loading Spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
}

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

/* Active tab in header */
.btn.active {
  background: var(--primary);
  color: white;
}

/* Utilities */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.bg-success { background: var(--success-bg); }
.bg-warning { background: var(--warning-bg); }
.bg-danger { background: var(--danger-bg); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Inline status badges (for JS-rendered content) */
.status-badge { display: inline-block; padding: 4px 8px; border-radius: var(--radius); font-size: 11px; font-weight: 600; }
.status-badge-success { background: var(--success); color: white; }
.status-badge-warning { background: var(--warning); color: white; }
.status-badge-danger { background: var(--danger); color: white; }
.status-badge-primary { background: var(--primary); color: var(--text-on-primary); }
.status-badge-muted { background: var(--text-muted); color: var(--text-on-primary); }
.status-badge-light { background: var(--border); color: var(--text); }

/* Alert/info cards (for JS-rendered content) */
.alert-info { background: var(--primary-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning); border-radius: var(--radius); padding: 12px 16px; }
.alert-danger { background: var(--danger-bg); border: 1px solid var(--danger); border-radius: var(--radius); padding: 12px 16px; }
.alert-success { background: var(--success-bg); border: 1px solid var(--success); border-radius: var(--radius); padding: 12px 16px; }

/* User type badges */
.badge-foh { background: var(--success-bg-hover); color: var(--success); }
.badge-boh { background: var(--warning-bg-hover); color: var(--warning); }
.badge-salary { background: var(--primary-bg-hover); color: var(--text); }

/* Turns Logo — the mark is an inline <svg> that <use>s each arc from
   /brand/turns-mark.svg, painted with the theme's --primary via `color`
   (charcoal in light, slate in dark). Geometry lives in docs/branding/build.py;
   never redraw it here. The motion (arcs turn into place once per page load,
   none under reduced motion) is in /brand/turns-mark.css. */
.turns-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.turns-logo-icon {
  width: 32px;
  height: 32px;
  color: var(--primary);
  flex-shrink: 0;
}

.turns-logo-text {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--primary);
  letter-spacing: 0.0375em;
}

/* Login page branding */
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  color: var(--primary);
}

.login-logo-text {
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--primary);
  letter-spacing: 0.0375em;
}

/* Accordion */
.accordion { margin-bottom: 8px; }
.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.accordion-header:hover { background: var(--border); }
.accordion-header.open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.accordion-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.accordion-count { font-size: 0.85rem; color: var(--text-muted); }
.accordion-chevron { transition: transform 0.2s; }
.accordion-header.open .accordion-chevron { transform: rotate(180deg); }
.accordion-content {
  display: none;
  border: 1px solid var(--border);
  border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  background: var(--bg-card);
}
.accordion-content.open { display: block; }

/* Scope-based accordion colors */
.accordion-header.scope-system { background: var(--primary-bg-hover); border-color: var(--primary); }
.accordion-header.scope-system:hover { background: var(--border-hover); }
.accordion-header.scope-company { background: var(--success-bg-hover); border-color: var(--success); }
.accordion-header.scope-company:hover { background: var(--success-bg); }
.accordion-header.scope-region { background: var(--warning-bg-hover); border-color: var(--warning); }
.accordion-header.scope-region:hover { background: var(--warning-bg); }
.accordion-header.scope-location { background: var(--border); border-color: var(--text-muted); }
.accordion-header.scope-location:hover { background: var(--border-hover); }

/* User list within accordion */
.user-list { padding: 0; margin: 0; list-style: none; }
.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.user-item:last-child { border-bottom: none; }
.user-info { display: flex; flex-direction: column; gap: 4px; }
.user-name { font-weight: 500; }
.user-meta { font-size: 0.85rem; color: var(--text-muted); display: flex; gap: 12px; }
.user-actions { display: flex; gap: 8px; }

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .server-grid { grid-template-columns: 1fr; }

  /* Wide tables scroll sideways instead of overflowing the viewport. */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Tighter cells so wide tables (EOD cash/tips, POS adjustments) fit more before scrolling. */
  .table th, .table td { padding: 8px 10px; font-size: 12.5px; }
  .card-body { padding: 16px; }

  /* Let card headers drop their status badge / actions onto a second line. */
  .card-header { flex-wrap: wrap; gap: 8px; }

  /* EOD cash & adjustment entry rows: stack inputs and let the fixed-width
     numeric fields expand instead of crushing on a single line.
     !important overrides the inline width:Npx set at render time. */
  .cash-input-row, .adjustment-row, .adjustment-edit-row { flex-wrap: wrap; }
  .cash-input-row .form-input,
  .adjustment-row .form-input,
  .adjustment-edit-row .form-input { flex: 1 1 120px; width: auto !important; min-width: 0; }

  /* Tip pool summary stat grid: collapse 3/4-up to 2-up on phones.
     id selector + !important beats the inline grid-template-columns. */
  #tip-pool-summary { grid-template-columns: 1fr 1fr !important; }

  /* EOD per-check adjustment entry table: on phones a 6-column table forces
     horizontal scroll that pushes the Reason input off-screen and crushes it
     to a few characters (the "staf"/"gurs" truncation report). Collapse each
     row into a stacked card so the Reason note gets a full-width field on its
     own line and long notes stay readable. */
  .adjustments-entry-table thead { display: none; }
  .adjustments-entry-table,
  .adjustments-entry-table tbody { display: block; width: 100%; }
  .adjustments-entry-table tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 10px;
  }
  .adjustments-entry-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 5px 0;
    border-bottom: none;
    text-align: right;
  }
  .adjustments-entry-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-subtle);
    text-align: left;
    flex-shrink: 0;
  }
  /* Reason gets its own full-width row — label above, input below. */
  .adjustments-entry-table td.adjustment-reason-cell {
    display: block;
    text-align: left;
    padding-top: 8px;
  }
  .adjustments-entry-table td.adjustment-reason-cell::before {
    display: block;
    margin-bottom: 5px;
  }
  .adjustments-entry-table td.adjustment-reason-cell .form-input { width: 100%; }
}

/* Tip allocation card (EOD form, under the report, Tips › Daily allocation) */
.tip-allocation-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tip-strategy-line { font-size: 12px; font-weight: normal; }
.tip-pool-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.tip-pool-tile .stat-value { font-size: 18px; }
#tip-cash-note:not(:empty), .tip-allocation-card .alert { margin-bottom: 12px; }
.tip-blurb { font-size: 12px; margin-bottom: 12px; }
.tip-group-title { font-size: 14px; margin: 16px 0 8px; }
.tip-allocation-table td { vertical-align: middle; }
.tip-allocation-table .tip-points-input { width: 80px; padding: 6px 8px; }
.tip-allocation-table .tip-share-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tip-pay-basis { font-size: 11px; display: block; }
.kiosk-clock-status { font-size: 10px; margin-top: 2px; }
.tip-allocation-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 640px) {
  .tip-allocation-table th, .tip-allocation-table td { padding: 8px 6px; }
  .tip-allocation-table .tip-points-input { width: 64px; font-size: 16px; } /* 16px stops iOS zooming on focus */
}

/* Tooltip for items */
.items-tooltip {
  position: relative;
  cursor: help;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.items-tooltip .tooltip-content {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  white-space: normal;
  min-width: 200px;
  max-width: 300px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: opacity 0.2s, visibility 0.2s;
  margin-bottom: 8px;
}
.items-tooltip .tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--primary);
}
.items-tooltip:hover .tooltip-content,
.items-tooltip:focus-visible .tooltip-content,
.items-tooltip.open .tooltip-content {
  visibility: visible;
  opacity: 1;
}
/* A phone has no hover: a tap opens the list in the row itself, where no scroll
   container can clip it and no hover state sticks it open. */
@media (hover: none) {
  .items-tooltip { cursor: pointer; text-decoration: underline dotted; }
  .items-tooltip:hover:not(.open) .tooltip-content { visibility: hidden; opacity: 0; }
  .items-tooltip.open { white-space: normal; max-width: none; }
  .items-tooltip.open .tooltip-content {
    position: static;
    display: block;
    transform: none;
    min-width: 0;
    max-width: none;
    margin: 6px 0 0;
  }
  .items-tooltip.open .tooltip-content::after { display: none; }
}

/* Banking Dashboard */
.banking-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.banking-stat { padding: 16px; }
.banking-stat-value { font-size: 24px; font-weight: 700; }
.banking-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.batch-status-badge { display: inline-block; padding: 4px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; color: white; }
.customer-group { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.customer-group-header { background: var(--bg); padding: 12px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.customer-group-header:hover { background: var(--border); }
.region-group-header { padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--border); font-size: 13px; }
.request-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.request-row:last-child { border-bottom: none; }
.funding-balance { background: var(--primary-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }

/* ── Location Dashboard ────────────────────────────────────── */
/* min(): a phone narrower than one 300px column gets one column that fits, not a sideways scroll. */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 20px; }
.dashboard-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
}
.dashboard-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: var(--border-hover); }
.dashboard-card-header {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px 0;
}
.dashboard-card-icon {
  width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dashboard-card-title { font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.dashboard-card-body { padding: 12px 20px 20px; }
.dashboard-metric-primary { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; }
.dashboard-metric-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; margin-bottom: 12px; }
.dashboard-metric-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text); padding: 4px 0; border-top: 1px solid var(--border);
}
.dashboard-metric-row:first-child { border-top: none; }

/* Dashboard loading skeleton */
.dashboard-card-loading .dashboard-card-body { padding: 24px 20px; }
.skeleton-line {
  height: 14px; background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%; animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px; margin-bottom: 10px;
}
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ADR-0126 D1: card sizes and the shared anatomy (headline, rows, footer). */
.dashboard-grid { grid-auto-flow: row dense; }
.dashboard-slot { display: flex; min-width: 0; }
.dashboard-slot > .dashboard-card { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dashboard-slot > .dashboard-card > .dashboard-card-body { flex: 1; display: flex; flex-direction: column; }
.dashboard-slot-wide { grid-column: span 2; }
/* ADR-0146 D7: New in Turns runs the full width of the grid, above every other card. */
.dashboard-slot-full { grid-column: 1 / -1; }
.glance-posture-chip { font-size: 11px; font-weight: 600; vertical-align: middle; background: var(--bg-secondary); color: var(--text-subtle); border: 1px solid var(--border); border-radius: 10px; padding: 2px 8px; margin-left: 6px; }
@media (max-width: 700px) {
  .dashboard-slot-wide { grid-column: auto; }
}
.dashboard-card-header .dashboard-chip { margin-left: auto; }
.dashboard-chip {
  display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;
  background: var(--border); color: var(--text-muted); white-space: nowrap;
}
.dashboard-chip.tone-good { background: var(--success-bg-hover); color: var(--success); }
.dashboard-chip.tone-warning { background: var(--warning-bg-hover); color: var(--warning); }
.dashboard-chip.tone-bad { background: var(--danger-bg-hover); color: var(--danger); }
.dashboard-headline { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dashboard-wide-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 700px) {
  /* minmax(0, …), not 1fr: a bare 1fr grows to its longest unbreakable row and bleeds out. */
  .dashboard-wide-body { grid-template-columns: minmax(0, 1fr); }
}
/* ADR-0146 D7: New in Turns — the count takes only its own width, and each release reads
   as a title with its line under it instead of one truncated line. */
.dashboard-card-full .dashboard-wide-body { grid-template-columns: auto minmax(0, 1fr); gap: 32px; }
.dashboard-card-full .dashboard-row { align-items: flex-start; padding: 6px 0; }
.dashboard-card-full .dashboard-row > span:first-child { white-space: normal; overflow-wrap: anywhere; }
.dashboard-card-full .dashboard-row-detail { display: block; margin: 2px 0 0; font-size: 12px; }
@media (max-width: 700px) {
  .dashboard-card-full .dashboard-wide-body { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
.dashboard-chart { margin: 4px 0 8px; }
.dashboard-chart svg { display: block; width: 100%; height: 64px; }
.dashboard-chart-legend { display: flex; gap: 12px; font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.dashboard-row { gap: 8px; }
.dashboard-row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-row-link { cursor: pointer; border-radius: 4px; }
.dashboard-row-link:hover { background: var(--bg); }
.dashboard-row-value { font-weight: 600; white-space: nowrap; }
.dashboard-row-detail { font-size: 11px; color: var(--text-faint); margin-left: 6px; }
.dashboard-row-value.tone-good { color: var(--success); }
.dashboard-row-value.tone-warning { color: var(--warning); }
.dashboard-row-value.tone-bad { color: var(--danger); }
.dashboard-card-footer {
  margin-top: auto; padding-top: 8px; font-size: 11px; color: var(--text-faint);
  border-top: 1px solid var(--border);
}
.dashboard-card-footer .dashboard-footer-warning { color: var(--warning); display: block; margin-top: 2px; }

/* ADR-0126 D3/P3: "More for this location" — locked module tiles (Glance and home). */
.locked-modules { margin-top: 32px; }
.locked-modules-heading {
  margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.locked-modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.locked-module {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 14px 16px; background: var(--bg-soft); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); color: var(--text-subtle);
}
.locked-module-header { display: flex; align-items: center; gap: 8px; }
.locked-module-lock { display: inline-flex; color: var(--text-muted); flex-shrink: 0; }
.locked-module-label { font-size: 14px; font-weight: 600; color: var(--text); }
.locked-module-outcome { margin: 0; font-size: 13px; line-height: 1.45; flex: 1; }
.locked-module-price { font-size: 12px; font-weight: 600; color: var(--text-subtle); }
.locked-module-price-detail { display: block; font-weight: 400; color: var(--text-faint); }
.locked-module-action { margin-top: 4px; font-size: 13px; }
.locked-module-ask { color: var(--text-muted); }
.locked-module-requested { color: var(--success); font-weight: 600; }

/* ── POS Sales Dashboard ───────────────────────────────────── */

/* Range bar */
.sales-range-bar { margin-bottom: 20px; }
.sales-pills { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.sales-pill {
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text); cursor: pointer;
  transition: all 0.15s;
}
.sales-pill:hover { border-color: var(--primary); }
.sales-pill.active { background: var(--primary); color: var(--text-on-primary); border-color: var(--primary); }
.sales-range-nav { display: flex; align-items: center; gap: 8px; }
.sales-nav-arrow {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: 20px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.sales-nav-arrow:hover:not(.disabled) { background: var(--primary); color: var(--text-on-primary); border-color: var(--primary); }
.sales-nav-arrow.disabled { opacity: 0.3; cursor: default; }
.sales-range-label { text-align: center; }
.sales-range-dates { font-size: 14px; font-weight: 600; color: var(--text); display: block; }
.sales-range-compare { font-size: 12px; color: var(--text-muted); opacity: 0.7; }

/* KPIs */
.sales-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.sales-kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.sales-kpi-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.2; }
.sales-kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 2px; }
.sales-kpi-change { margin-top: 6px; }
.sales-kpi-vs { font-size: 11px; color: var(--text-muted); margin-left: 4px; }
.sales-change { font-size: 13px; font-weight: 600; }
.sales-change.up { color: var(--success); }
.sales-change.down { color: var(--danger); }
.sales-change.muted { color: var(--text-muted); font-weight: 400; }

/* Bar chart */
.sales-chart-bars { display: flex; gap: 6px; align-items: flex-end; padding-top: 20px; }
.sales-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.sales-chart-col:hover .sales-chart-fill { opacity: 0.8; }
.sales-chart-val { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; white-space: nowrap; }
.sales-chart-track { width: 100%; max-width: 56px; position: relative; display: flex; align-items: flex-end; justify-content: center; }
.sales-chart-ghost {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 70%; border-radius: 3px 3px 0 0; background: var(--border); opacity: 0.5;
}
.sales-chart-fill {
  width: 80%; border-radius: 3px 3px 0 0; background: var(--primary); position: relative; z-index: 1;
  min-height: 2px; transition: height 0.3s ease;
}
.sales-chart-fill.empty { background: var(--border); opacity: 0.3; }
.sales-chart-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.sales-chart-date { font-size: 10px; color: var(--text-muted); opacity: 0.6; }
.sales-chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.sales-legend-swatch { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.sales-legend-swatch.current { background: var(--primary); }
.sales-legend-swatch.prior { background: var(--border); }
/* ADR-0126 P5: the forecast target on the daily chart — a tick across each bar. */
.sales-chart-target {
  position: absolute; left: 0; right: 0; height: 0; z-index: 2;
  border-top: 2px dashed var(--warning); pointer-events: none;
}
.sales-legend-swatch.target { background: var(--warning); }

/* Detail grid (3 columns) */
.sales-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.sales-detail-card { min-height: 200px; }
.sales-detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sales-detail-title { font-weight: 600; font-size: 15px; }
.sales-sort-pills { display: flex; gap: 4px; }
.sales-sort-pills .btn { padding: 2px 10px; font-size: 11px; }

/* Items table */
.sales-table { font-size: 13px; }
.sales-table th { font-size: 11px; }

/* Servers list */
.sales-servers-list { display: flex; flex-direction: column; gap: 2px; }
.sales-server-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.sales-server-rank { font-size: 12px; color: var(--text-muted); min-width: 18px; text-align: right; }
.sales-server-info { min-width: 90px; flex-shrink: 0; }
.sales-server-name { font-size: 13px; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.sales-server-meta { font-size: 11px; color: var(--text-muted); display: block; }
.sales-server-bar-track { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.sales-server-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s ease; }
.sales-server-amount { font-size: 13px; font-weight: 600; min-width: 70px; text-align: right; }

/* Category bars */
.sales-category-list { display: flex; flex-direction: column; gap: 6px; }
.sales-category-row { display: flex; align-items: center; gap: 8px; }
.sales-category-info { min-width: 100px; flex-shrink: 0; }
.sales-category-name { font-size: 13px; font-weight: 500; display: block; }
.sales-category-meta { font-size: 11px; color: var(--text-muted); }
.sales-category-bar-track { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.sales-category-bar-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s ease; }
.sales-category-amount { font-size: 13px; font-weight: 600; min-width: 70px; text-align: right; }

/* Company Library rich-text editor (Quill): a fixed-height flex column
   (#lib-editor sets height + display:flex inline) whose toolbar stays pinned at
   the top while the editable content scrolls internally — so a long document
   doesn't grow the whole page and the formatting tools are never scrolled away. */
#lib-editor .ql-toolbar { flex: 0 0 auto; }
#lib-editor .ql-container { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* Inline "busy" spinner for buttons mid-action — autosave feedback + share→add
   (which now sends emails). Reuses @keyframes spin; currentColor matches the
   button's text so it works on primary/secondary/ghost buttons. */
.btn.is-busy { pointer-events: none; opacity: 0.9; }
.btn-spinner {
  display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── ADR-0071 Labour Scheduling (module-owned styles — delete with the module) ── */
.sched-section { margin-bottom: 24px; }
.sched-section h3 { margin: 0 0 8px 0; font-size: 15px; }
.sched-findings { display: flex; flex-direction: column; gap: 6px; }
.sched-finding {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  border-left-width: 3px; font-size: 13.5px;
}
.sched-red   { border-left-color: var(--danger);  background: var(--danger-bg); }
.sched-amber { border-left-color: var(--warning); background: var(--warning-bg); }
.sched-info  { border-left-color: var(--primary); background: var(--primary-bg); }
.sched-finding-code {
  flex-shrink: 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); padding-top: 1px;
}
.sched-legend { font-size: 12px; color: var(--text-muted); padding: 10px 16px 0; }
.sched-heatmap th, .sched-heatmap td { padding: 6px 8px; text-align: center; white-space: nowrap; }
.sched-heatmap td:first-child { text-align: left; }
.sched-cell-empty { color: var(--border); }
.sched-cell-gap  { background: var(--danger-bg); }
.sched-cell-over { background: var(--warning-bg); }
.sched-fields { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.sched-num { width: 84px; }
.sched-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.sched-checks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.sched-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.sched-check-bold { font-weight: 600; display: flex; }
.sched-disabled { opacity: 0.4; pointer-events: none; }
.sched-effective { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }

/* Phase 2/3: advisor suggestions, draft grid, entry sheet, retro. */
.sched-advice { display: flex; flex-direction: column; gap: 10px; }
.sched-advice-card {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius); background: var(--bg-card);
}
.sched-advice-card.sched-red   { border-left-color: var(--danger); }
.sched-advice-card.sched-amber { border-left-color: var(--warning); }
.sched-advice-body { flex: 1; min-width: 0; }
.sched-advice-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.sched-advice-why { font-size: 13px; color: var(--text-muted); }
.sched-advice-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; font-size: 12px; }
.sched-delta { font-weight: 600; white-space: nowrap; }
.sched-delta-save { color: var(--success); }
.sched-delta-spend { color: var(--danger); }
.sched-day-block { margin-bottom: 16px; }
.sched-day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 14px; background: var(--bg-subtle); border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border); border-bottom: none; font-size: 13px;
}
.sched-diff-add    { color: var(--success); font-weight: 600; }
.sched-diff-remove { color: var(--danger); font-weight: 600; }
.sched-diff-change { color: var(--warning); font-weight: 600; }
.sched-effect { display: inline-flex; gap: 4px; align-items: baseline; white-space: nowrap; }

/* ADR-0105 A11: collapsible deal-page sections. <details> keeps its children in
   the DOM when closed, which matters because the discovery form is saved by
   reading every input by id — rendering a section out would post nulls. */
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary:hover { background: var(--bg-subtle); }
details.card > summary .crm-chevron {
  color: var(--text-subtle);
  transition: transform 0.15s ease;
  display: inline-block;
}
details.card[open] > summary .crm-chevron { transform: rotate(90deg); }

/* Deal page body (ADR-0105 follow-up): Contacts and Tasks moved out of the
   half-width grid under the questionnaires and into a collapsible left rail,
   so Activity and the two forms get the full content column. The rail
   collapses to a strip rather than unmounting - the cards keep their DOM for
   the same reason the sections above use <details>. */
.crm-deal-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}
.crm-deal-body.crm-rail-closed { grid-template-columns: 38px minmax(0, 1fr); }

.crm-rail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.crm-rail-cards { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.crm-rail-closed .crm-rail-cards { display: none; }

.crm-rail-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; cursor: pointer;
  background: var(--bg-subtle); border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text); font-size: 13px; font-weight: 500; text-align: left;
}
.crm-rail-toggle:hover { background: var(--border); }
.crm-rail-count {
  margin-left: auto; color: var(--text-muted); font-weight: 400; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.crm-rail-closed .crm-rail-toggle { justify-content: center; padding: 8px 0; }
.crm-rail-closed .crm-rail-label,
.crm-rail-closed .crm-rail-count { display: none; }
.crm-rail-chevron { display: inline-block; transition: transform 0.15s ease; }
.crm-rail-closed .crm-rail-chevron { transform: rotate(180deg); }

/* The main column spaces itself: every section below Activity carries its own
   margin-top, so Activity sits flush with the top of the rail. */
.crm-deal-main { min-width: 0; }

/* One column on narrow screens - a 260px rail beside a form is unusable there,
   and the toggle has nothing to collapse into. */
@media (max-width: 900px) {
  .crm-deal-body,
  .crm-deal-body.crm-rail-closed { grid-template-columns: minmax(0, 1fr); }
  .crm-deal-body.crm-rail-closed .crm-rail-cards { display: flex; }
  .crm-rail-toggle { display: none; }
}

/* Cards in the rail were built for the ~600px half-width column they used to
   sit in: a rigid two-column flex row and a 1fr-1fr picker grid. At 260px the
   name block could not shrink (no min-width:0) and the action buttons ran off
   the card - "Remove" rendered as "Rer". These rules make the rows shrink and
   wrap intrinsically, so they hold at any column width rather than at one. */
.crm-person-row,
.crm-task-row {
  display: flex; flex-wrap: wrap; gap: 6px 8px;
  padding: 8px 0; border-bottom: 1px solid var(--bg-subtle);
}
.crm-person-row { align-items: flex-start; }
.crm-task-row { align-items: center; justify-content: space-between; }

/* flex:1 alone still refuses to shrink past content width - min-width:0 is what
   actually lets a long name or email give way instead of overflowing. */
.crm-person-main { flex: 1 1 140px; min-width: 0; }
.crm-task-text { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }

/* Emails and phone numbers are single unbreakable tokens; without this one
   address (ravendward+tingAlias@pm.me) sets the card's scrollWidth on its own. */
.crm-person-meta {
  font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere;
}

/* Actions sit on the name line when there is room and drop to their own line
   when there is not, instead of being clipped. */
.crm-row-actions { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }

.crm-role-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px;
}
/* Two selects side by side in a 260px rail leaves ~120px each, which wraps
   "Operator (gets the login)" onto three lines. One per row in the rail. */
.crm-rail .crm-role-grid { grid-template-columns: 1fr; }

/* ADR-0123 P2a: Location Settings — side menu + section body */
.location-settings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.location-settings-menu { padding: 4px 8px 12px; position: sticky; top: 72px; }
.location-settings-group { padding: 16px 12px 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.location-settings-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 12px; border: none; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.location-settings-item:hover { background: var(--row-hover); }
.location-settings-item.active { background: var(--primary); color: var(--text-on-primary); }
@media (max-width: 760px) {
  .location-settings { grid-template-columns: minmax(0, 1fr); }
  .location-settings-menu { position: static; }
}

/* Weekly tip summary: money columns never wrap, but the name (with its claims pill) and the
   Adjustment column may, so the table fits its card instead of clipping the last column. */
.tip-week-table th, .tip-week-table td { white-space: nowrap; }
.tip-week-table td:first-child, .tip-week-table .adj-cell { white-space: normal; }
.tip-week-table .adj-cell { min-width: 140px; }

/* ADR-0145 M1 + ADR-0147: the app shell. No header: the sidebar holds the logo, the
   pickers, the modules and the account row, full height, below any impersonation
   banner (--banner-h). */
.app-shell { display: flex; align-items: stretch; min-height: calc(100vh - var(--banner-h, 0px)); }
.app-main { flex: 1 1 auto; min-width: 0; }
.app-sidebar {
  flex: 0 0 232px;
  width: 232px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 14px 10px 10px;
  box-sizing: border-box;
  position: sticky;
  top: var(--banner-h, 0px);
  align-self: flex-start;
  height: calc(100vh - var(--banner-h, 0px));
  display: flex; flex-direction: column; gap: 10px;
}
body.no-sidebar .app-sidebar, body.no-sidebar .mobile-bar { display: none; }
.sidebar-brand { padding: 2px 8px 0; }
.sidebar-brand .turns-logo-icon, .mobile-bar-logo .turns-logo-icon { width: 26px; height: 26px; color: #ffffff; }
.sidebar-brand .turns-logo-text, .mobile-bar-logo .turns-logo-text { font-size: 1.25rem; color: #ffffff; }

/* ADR-0145 M9: the company and location pickers, together at the top of the sidebar. */
.sidebar-pickers { display: flex; flex-direction: column; gap: 6px; }
.sidebar-pickers > div:empty { display: none; }
.location-picker { display: flex; min-width: 0; }
.location-picker-select, .membership-switcher {
  width: 100%; min-height: 36px; font-size: 14px; font-weight: 500; padding: 6px 28px 6px 10px;
  border: 1px solid var(--sidebar-hover); border-radius: 8px; background-color: var(--sidebar-hover);
  color: #ffffff; cursor: pointer;
}
.membership-switcher { font-size: 13px; color: var(--sidebar-text); }
.location-picker-select option, .location-picker-select optgroup, .membership-switcher option { color: var(--text); background: var(--bg-card); }
.location-picker-select:focus-visible, .membership-switcher:focus-visible { outline: 2px solid #8db6f0; outline-offset: 2px; }

/* ADR-0147 D2: the module list fits a 768px laptop; on a shorter screen it scrolls on
   its own between the pinned top and the pinned account row. */
.sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-group { display: flex; flex-direction: column; gap: 1px; padding: 6px 0; }
.sidebar-group + .sidebar-group { border-top: 1px solid var(--sidebar-hover); }
.sidebar-module, .sidebar-hint {
  display: flex; align-items: center; gap: 12px;
  min-height: 36px; padding: 0 12px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none; font-size: 14px;
}
.sidebar-module:hover { background: var(--sidebar-hover); color: #ffffff; }
.sidebar-module.active {
  background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600;
}
.sidebar-hint { font-size: 13px; color: var(--sidebar-muted); border: 1px dashed var(--sidebar-hover); margin: 8px 0; }
.sidebar-icon { flex: 0 0 18px; }
.sidebar-module:focus-visible, .sidebar-toggle:focus-visible, .sidebar-account-row:focus-visible,
.sidebar-account-item:focus-visible, .back-link:focus-visible {
  outline: 2px solid #8db6f0; outline-offset: 2px;
}

/* ADR-0147 D3: the account row, pinned at the foot; its menu opens upward. */
.sidebar-account-host { border-top: 1px solid var(--sidebar-hover); padding-top: 8px; }
.sidebar-account { position: relative; }
.sidebar-account-row {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px;
  border-radius: 8px; cursor: pointer; list-style: none; color: var(--sidebar-text); font-size: 14px;
}
.sidebar-account-row::-webkit-details-marker { display: none; }
.sidebar-account-row:hover, .sidebar-account[open] .sidebar-account-row { background: var(--sidebar-hover); color: #ffffff; }
.sidebar-account-avatar {
  flex: 0 0 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-size: 12px; font-weight: 600;
}
.sidebar-account-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-chevron { flex: 0 0 14px; transform: rotate(180deg); transition: transform 0.15s; }
.sidebar-account[open] .sidebar-account-chevron { transform: none; }
.sidebar-account-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.sidebar-account-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 14px;
  text-align: left; text-decoration: none; cursor: pointer;
}
.sidebar-account-item:hover { background: var(--bg-soft); }
.sidebar-account-switch { position: relative; flex: 0 0 32px; height: 18px; border-radius: 9px; background: var(--border); }
.sidebar-account-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #ffffff; transition: left 0.15s;
}
.sidebar-account-switch.on { background: var(--primary); }
.sidebar-account-switch.on::after { left: 16px; }

/* ADR-0147 D5: a detail page's one link back to its parent. */
.back-link-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px 0; }
.back-link {
  border: 0; background: none; padding: 4px 0; font: inherit; font-size: 14px; font-weight: 500;
  color: var(--primary); cursor: pointer;
}
.back-link:hover { text-decoration: underline; }
.back-link-bar:not([hidden]) + .container { padding-top: 12px; }
.external-mark { margin-left: 4px; font-size: 12px; color: var(--text-subtle); }

/* ADR-0147 D7: phones. A slim bar opens the drawer; the drawer opens below it, so the
   button stays in reach and becomes an X. */
.mobile-bar { display: none; }
.sidebar-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: #ffffff; cursor: pointer;
}
.sidebar-toggle .icon-close, body.sidebar-open .sidebar-toggle .icon-open { display: none; }
body.sidebar-open .sidebar-toggle .icon-close { display: block; }
body.sidebar-open .sidebar-toggle { background: var(--sidebar-hover); }
@media (max-width: 900px) {
  .mobile-bar {
    display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 8px; box-sizing: border-box;
    background: var(--sidebar-bg); color: #ffffff;
    position: sticky; top: var(--banner-h, 0px); z-index: 400;
  }
  .mobile-bar-logo { flex: 1 1 auto; gap: 8px; }
  .mobile-bar-location {
    font-size: 13px; color: var(--sidebar-muted); padding-right: 8px; max-width: 45%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .app-shell { min-height: calc(100vh - var(--banner-h, 0px) - 56px); }
  .app-sidebar {
    /* align-self: flex-start (desktop) would shrink a fixed box to its content. */
    position: fixed; left: 0; top: calc(var(--banner-h, 0px) + 56px); bottom: 0; height: auto; align-self: auto;
    width: min(300px, 85vw); z-index: 300;
    transform: translateX(-100%); transition: transform 0.18s ease-out;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
  }
  .app-sidebar .sidebar-brand { display: none; }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .app-sidebar { transform: none; }
  body.sidebar-open::after {
    content: ""; position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--banner-h, 0px) + 56px);
    z-index: 250; background: rgba(15, 20, 25, 0.45);
  }
  .back-link-inner { padding: 12px 16px 0; }
}
@media (prefers-reduced-motion: reduce) { .app-sidebar { transition: none; } }

/* ADR-0145 R4: a grid cell that differs from the person's role (added or taken away). */
.access-cell.access-override { background: var(--warning-bg, var(--bg-soft)); outline: 1px dashed var(--warning); }

/* Visually hidden, still read by screen readers (labels for search boxes and inputs). */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ADR-0156 P1: the (i) beside each access cell and the panel that explains it. */
.access-cell-wrap { display: inline-flex; align-items: center; gap: 2px; }
.perm-explain-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.perm-explain-btn:hover, .perm-explain-btn[aria-expanded="true"] { color: var(--primary); background: var(--primary-bg); }
.perm-explain-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.perm-explainer {
  position: fixed; z-index: 1200; overflow-y: auto;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-strong); font-size: 13px; line-height: 1.45;
}
.perm-explainer[hidden], .perm-explainer-backdrop[hidden] { display: none; }
.perm-explainer-head {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: 12px 12px 8px 14px; background: var(--bg-card); border-bottom: 1px solid var(--border-subtle);
}
.perm-explainer-title { font-weight: 600; font-size: 14px; color: var(--text-strong); }
.perm-explainer-code {
  font-size: 11px; color: var(--text-subtle); background: var(--bg-subtle);
  padding: 1px 5px; border-radius: 4px; word-break: break-all;
}
.perm-explainer-body { padding: 10px 14px 4px; display: flex; flex-direction: column; gap: 10px; }
.perm-explainer-summary { font-size: 14px; color: var(--text-strong); }
.perm-explainer-h {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-subtle); margin-bottom: 3px;
}
.perm-explainer-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.perm-explainer-watch {
  background: var(--warning-bg); border-left: 3px solid var(--warning); color: var(--text);
  padding: 8px 10px; border-radius: 4px;
}
.perm-explainer-foot { padding: 8px 14px 12px; }
.perm-explainer-link { color: var(--primary); font-weight: 500; text-decoration: underline; }
.perm-explainer-backdrop { position: fixed; inset: 0; z-index: 1199; background: var(--overlay); }
/* A phone opens it as a bottom sheet, clear of the grid it explains. */
.perm-explainer.perm-explainer--sheet {
  left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto !important;
  max-height: 80vh !important; border-radius: 14px 14px 0 0; border-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.perm-explainer--sheet .perm-explainer-head { padding-top: 16px; }
.perm-explainer--sheet .perm-explainer-close { min-width: 44px; min-height: 44px; font-size: 20px; }
@media (max-width: 640px) {
  .perm-explain-btn { width: 32px; height: 32px; }
}

/* ADR-0156 P1: People › Permissions guide */
.perm-guide-toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 10px 0; margin-bottom: 8px; background: var(--bg);
}
.perm-guide-toolbar #perm-guide-search { flex: 1 1 320px; max-width: 520px; font-size: 16px; }
.perm-guide-toolbar #perm-guide-role { flex: 0 1 240px; }
.perm-guide-count { font-size: 13px; color: var(--text-subtle); }
.perm-guide-group { margin-bottom: 24px; }
.perm-guide-group-title { font-size: 17px; margin: 8px 0 10px; }
.perm-guide-area { margin-bottom: 14px; overflow: hidden; }
.perm-guide-area-head { padding: 12px 16px; background: var(--bg-soft); border-bottom: 1px solid var(--border-subtle); }
.perm-guide-cell { padding: 14px 16px; border-top: 1px solid var(--bg-subtle); scroll-margin-top: 72px; }
.perm-guide-cell:first-of-type { border-top: 0; }
.perm-guide-cell:focus { outline: none; }
.perm-guide-cell--focus { background: var(--primary-bg); box-shadow: inset 3px 0 0 var(--primary); }
.perm-guide-cell-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.perm-guide-cell-title { font-size: 15px; font-weight: 600; margin: 0; }
.perm-guide-cell-link { color: var(--text-muted); text-decoration: none; font-weight: 600; }
.perm-guide-cell-link:hover, .perm-guide-cell-link:focus-visible { color: var(--primary); }
.perm-guide-cell-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 24px; font-size: 14px; }
.perm-guide-cell-body .perm-explainer-summary,
.perm-guide-cell-body .perm-explainer-watch { grid-column: 1 / -1; }
.perm-guide-holders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; }
.perm-guide-holders-label { font-weight: 600; color: var(--text-subtle); margin-right: 2px; }
.perm-guide-role {
  border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text);
  border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer;
}
.perm-guide-role:hover, .perm-guide-role:focus-visible { border-color: var(--primary); color: var(--primary); }
@media (max-width: 640px) {
  .perm-guide-cell { padding: 12px; }
  .perm-guide-toolbar #perm-guide-search, .perm-guide-toolbar #perm-guide-role { flex: 1 1 100%; max-width: none; }
}

/* ADR-0145 M2: the active module's screens as tabs above the page */
.module-tabs { background: var(--bg-card); border-bottom: 1px solid var(--border); }
.module-tabs-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.module-tab {
  padding: 12px 14px 10px; font-size: 14px; color: var(--text-subtle); text-decoration: none;
  border-bottom: 3px solid transparent;
}
.module-tab:hover { color: var(--text); }
.module-tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
.module-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.report-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; align-items: start; }
.report-index .month-grid { grid-template-columns: 1fr; }
.report-index-group h3 { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); margin: 0 0 10px; }

/* ADR-0150 P5c: the person page's "Roles & pay" section. One line per role (name, badge,
   current rate, actions on the right); the rate history and the add-rate form fold away. */
.role-pay { margin-top: 16px; }
.role-pay-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.role-pay-hint { font-weight: 400; color: var(--text-subtle); margin-left: 6px; }
.role-pay-empty { font-size: 14px; color: var(--text-subtle); padding: 8px 0; }
.role-pay-list { display: flex; flex-direction: column; gap: 8px; }
.role-pay-row { border: 1px solid var(--border-subtle); border-radius: var(--radius); background: var(--bg-card); }
.role-pay-row.is-paying { box-shadow: inset 3px 0 0 var(--primary); }
.role-pay-row.is-ended { background: var(--bg-soft); }
.role-pay-row.is-ended .role-pay-role,
.role-pay-row.is-ended .role-pay-current { color: var(--text-muted); }
.role-pay-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center;
  gap: 8px 16px; padding: 10px 14px; font-size: 14px;
}
.role-pay-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.role-pay-role { font-size: 15px; font-weight: 600; color: var(--text-strong); }
.role-pay-current { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* A fixed actions column keeps each role's rate in the same place, whatever its buttons. */
.role-pay-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 260px; }
.role-pay-more { border-top: 1px solid var(--border-subtle); }
.role-pay-more > summary {
  cursor: pointer; padding: 8px 14px; font-size: 13px; color: var(--text-subtle);
  list-style: none; user-select: none;
}
.role-pay-more > summary::-webkit-details-marker { display: none; }
.role-pay-more > summary::before { content: "\25B8"; display: inline-block; margin-right: 6px; transition: transform 0.15s ease; }
.role-pay-more[open] > summary::before { transform: rotate(90deg); }
.role-pay-more > summary:hover { color: var(--text); }
.role-pay-more[open] { padding-bottom: 12px; }
.role-pay-history { list-style: none; margin: 0 14px 10px; padding: 0; }
.role-pay-history-row {
  display: grid; grid-template-columns: 220px 160px auto; align-items: center; gap: 4px 12px;
  padding: 4px 0; font-size: 14px; font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border-subtle);
}
.role-pay-history-row:last-child { border-bottom: none; }
.role-pay-history-actions { display: flex; justify-content: flex-end; gap: 4px; }
.role-pay-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; padding: 0 14px; }
.role-pay-field { display: flex; flex-direction: column; flex: 0 1 150px; min-width: 120px; }
.role-pay-field .form-label { font-size: 13px; margin-bottom: 4px; color: var(--text-subtle); }
.role-pay-form .btn { margin-bottom: 2px; }
.role-pay-add {
  margin-top: 12px; padding: 12px 0; border: 1px dashed var(--border-strong);
  border-radius: var(--radius); background: var(--bg-soft);
}
.role-pay-add > .role-pay-title { padding: 0 14px; }
@media (max-width: 640px) {
  .role-pay-line { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; }
  .role-pay-actions { grid-column: 1 / -1; justify-content: flex-start; min-width: 0; }
  .role-pay-actions:empty { display: none; }
  .role-pay-more > summary { padding: 8px 12px; }
  .role-pay-history { margin: 0 12px 10px; }
  .role-pay-history-row { grid-template-columns: minmax(0, 1fr) auto; }
  .role-pay-history-actions { grid-column: 2; grid-row: 1 / span 2; }
  .role-pay-form { padding: 0 12px; }
  .role-pay-field { flex: 1 1 130px; }
  .role-pay-add > .role-pay-title { padding: 0 12px; }
  .role-pay-hint { display: block; margin-left: 0; margin-top: 2px; }
}
