:root {
  /* 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"] {
  --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; }
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
}
.header h1 { font-size: 20px; font-weight: 600; }
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.header-username {
  font-size: 13px;
  color: var(--text-muted);
}

/* ADR-0028: company switcher (only rendered when the user holds more than
   one membership) */
.membership-switcher {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  max-width: 200px;
  cursor: pointer;
}

/* 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);
}

/* Breadcrumb bar below header */
.breadcrumb-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.breadcrumb-bar:empty {
  display: none;
}
.breadcrumb-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 24px;
}

/* 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-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);
}

/* Location indicator in header (legacy - now using breadcrumbs) */
.location-indicator {
  background: var(--primary);
  color: var(--text-on-primary);
  padding: 4px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-right: 8px;
}
.location-indicator:hover {
  background: var(--primary-hover);
}

/* Breadcrumb navigation */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 500;
}
.breadcrumb-link {
  color: var(--primary);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.breadcrumb-link:hover {
  background: var(--border);
  text-decoration: underline;
}
.breadcrumb-sep {
  color: var(--text-muted);
  font-weight: 400;
  padding: 0 2px;
}
.breadcrumb-current {
  background: var(--primary);
  color: var(--text-on-primary);
  padding: 8px 12px;
  border-radius: var(--radius);
}

/* 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; }

/* Table row status colors */
.row-verified { background: var(--success-bg); border-left: 4px solid var(--success); }
.row-verified:hover { background: var(--success-bg-hover); }
.row-submitted { background: var(--primary-bg); border-left: 4px solid var(--primary); }
.row-submitted:hover { background: var(--primary-bg-hover); }
.row-pending { background: var(--warning-bg); border-left: 4px solid var(--warning); }
.row-pending:hover { background: var(--warning-bg-hover); }
.row-missing { background: var(--danger-bg); border-left: 4px solid var(--danger); }
.row-missing:hover { background: var(--danger-bg-hover); }
.row-distributing { background: var(--warning-bg); border-left: 4px solid var(--warning); }
.row-distributing:hover { background: var(--warning-bg-hover); }
.row-distributed { background: var(--success-bg); border-left: 4px solid var(--success); }
.row-distributed:hover { background: var(--success-bg-hover); }
.row-failed { background: var(--danger-bg); border-left: 4px solid var(--danger); }
.row-failed:hover { background: var(--danger-bg-hover); }

/* 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.submitted { background: var(--primary-bg-hover); color: var(--text); }
.report-status.pending { background: var(--warning-bg-hover); color: var(--warning); }
.report-status.missing { background: var(--danger-bg-hover); color: var(--danger); }
.report-status.distributing { background: var(--warning-bg-hover); color: var(--warning); }
.report-status.distributed { background: var(--success-bg-hover); color: var(--success); }
.report-status.failed { background: var(--danger-bg-hover); color: var(--danger); }

/* 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-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 */
.turns-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.turns-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius);
  position: relative;
  flex-shrink: 0;
}

.turns-logo-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background: var(--border);
  border-radius: 50%;
}

.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: 60px;
  height: 60px;
  background: var(--primary);
  border-radius: 12px;
  position: relative;
}

.login-logo-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  background: var(--border);
  border-radius: 50%;
}

.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; }
  .header-inner { padding: 12px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .server-grid { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .header-actions { margin-left: 0; margin-top: 8px; width: 100%; }

  /* 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; }
}

/* 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 {
  visibility: visible;
  opacity: 1;
}

/* 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 ────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 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-placeholder { opacity: 0.7; }
.dashboard-card-placeholder:hover { opacity: 0.85; }
.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-badge-coming {
  margin-left: auto; font-size: 10px; font-weight: 600; text-transform: uppercase;
  background: var(--warning-bg); color: var(--warning); padding: 2px 8px; border-radius: 10px; letter-spacing: 0.3px;
}

/* 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; } }

/* ── 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); }

/* 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; }

/* Day-of-week averages */
.sales-dow-grid { display: flex; flex-direction: column; gap: 6px; }
.sales-dow-row { display: flex; align-items: center; gap: 8px; }
.sales-dow-day { font-size: 13px; font-weight: 500; min-width: 36px; }
.sales-dow-bar-track { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.sales-dow-bar-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s ease; }
.sales-dow-value { font-size: 13px; font-weight: 600; min-width: 70px; text-align: right; }
.sales-dow-meta { font-size: 11px; color: var(--text-muted); min-width: 50px; }
