/* CarGlow Enterprise Command Center — v3. Loaded after ../_shared/tokens.css
   and ../_shared/components.css (see index.html). Every class name below
   that predates v3 (.panel, .badge, .stat-card, button.primary, .tabs/.tab,
   table, .card, .stack, .btn-row, .muted, .empty, .linklike, .funnel-*,
   .viz-root) is kept exactly as-is so none of the ~28 modules' render
   functions in app.js need to change — only what each class *looks like*
   changes. New shell classes (.cg-*) are additive, used by shell.js. */

html, body { margin: 0; padding: 0; background: var(--color-bg); color: var(--color-ink); font-family: var(--font-body); }
#app { min-height: 100vh; display: flex; flex-direction: column; }

h1, h2, h3 { font-family: var(--font-display); color: var(--color-ink); margin: 0 0 var(--space-2); }
.mono { font-family: var(--font-mono); }

/* Pre-auth topbar (login screen only — shell.js's authenticated topbar uses .cg-topbar) */
.topbar {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-6);
  background: var(--slate-800); color: white;
}
.topbar img { width: 32px; height: 32px; border-radius: var(--radius-sm); }
.topbar .title { font-family: var(--font-display); font-weight: 700; flex: 1; font-size: 1.1rem; }
.topbar button.chip {
  background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius-full); padding: 6px 14px; font-size: 0.85rem; cursor: pointer;
}

.content { flex: 1; padding: var(--space-6); max-width: 1200px; margin: 0 auto; width: 100%; }
.login-wrap { max-width: 400px; margin: 72px auto; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); align-items: start; }
/* CSS Grid items default to min-width:auto, which refuses to shrink below
   the content's max-content size (a wide table) — the grid track then
   grows to fit it and the whole page overflows horizontally, even with
   min-width:0 explicitly here so the wide-table .panel's own
   overflow-x:auto (not the grid) is what handles it. Caught by the same
   automated 320-414px check as the .panel fix above; same root cause,
   different layer. */
.grid-2 > * { min-width: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: var(--space-5); margin-bottom: var(--space-5);
  transition: box-shadow var(--duration-base) var(--ease-standard);
  /* Real bug caught by an automated 320/375/390/414px overflow check: wide
     tables (Workforce, Job feed, etc.) were forcing the entire page to
     scroll horizontally instead of just the table. Standard mobile-table
     fix — the table keeps its natural width, only this container scrolls. */
  max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.panel h2 { display: flex; align-items: center; gap: var(--space-2); font-size: 15px; font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--color-ink-muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em; padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); color: var(--color-ink); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--duration-fast) var(--ease-standard); }
tbody tr:hover { background: var(--color-bg); }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-full); background: var(--slate-50); color: var(--slate-500); }
.badge.on { background: var(--success-bg); color: var(--success-text); }
.badge.off { background: var(--slate-50); color: var(--color-ink-muted); }
.badge.state-assigned { background: var(--info-bg); color: var(--info-text); }
.badge.state-started { background: var(--warning-bg); color: var(--warning-text); }
.badge.state-completed { background: var(--success-bg); color: var(--success-text); }

.muted { color: var(--color-ink-muted); font-size: 0.85rem; }
.empty { color: var(--color-ink-faint); font-size: 0.9rem; padding: var(--space-2) 0; }

/* booking funnel: single-hue sequential bar, magnitude by length (dataviz skill) */
.viz-root {
  --bar-fill: var(--accent-500);
  --bar-track: var(--slate-50);
  --text-primary: var(--color-ink);
  --text-secondary: var(--color-ink-muted);
}
.funnel-row { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.funnel-label { font-size: 0.85rem; color: var(--text-secondary); text-transform: capitalize; }
.funnel-track { background: var(--bar-track); border-radius: 5px; height: 22px; position: relative; overflow: hidden; }
.funnel-fill { background: var(--bar-fill); height: 100%; border-radius: 5px 0 0 5px; min-width: 4px; transition: width var(--duration-slow) var(--ease-decel); }
.funnel-value { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-primary); text-align: right; }

.linklike { color: var(--info-500); text-decoration: underline; cursor: pointer; }
.linklike:hover { color: var(--accent-600); }
.error-banner { background: var(--danger-bg); color: var(--danger-text); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); font-size: 0.9rem; }
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }

button { font-family: var(--font-body); font-size: 14px; font-weight: 600; border: none; border-radius: var(--radius-md); padding: 10px var(--space-4); cursor: pointer; transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard); }
button:active { transform: scale(0.98); }
button.primary { background: var(--color-primary); color: white; box-shadow: var(--shadow-brand); }
button.primary:hover { background: var(--color-primary-hover); }
button.secondary { background: var(--color-surface); color: var(--color-ink); border: 1.5px solid var(--color-border-strong); }
button.secondary:hover { border-color: var(--color-primary); }
button.block { width: 100%; }
input[type=tel], input[type=number] { font-family: var(--font-mono); font-size: 15px; padding: 11px var(--space-3); border-radius: var(--radius-md); border: 1.5px solid var(--color-border-strong); width: 100%; background: var(--color-surface); color: var(--color-ink); outline: none; transition: border-color var(--duration-fast) var(--ease-standard); }
input[type=text], input[type=password], select { font-family: var(--font-body); font-size: 14px; padding: 11px var(--space-3); border-radius: var(--radius-md); border: 1.5px solid var(--color-border-strong); width: 100%; background: var(--color-surface); color: var(--color-ink); outline: none; transition: border-color var(--duration-fast) var(--ease-standard); }
input:focus, select:focus { border-color: var(--color-primary); }

/* Tabs + onboarding review + impact panel additions */
.tabs { display: flex; gap: var(--space-1); padding: 0 var(--space-6); background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.tab { padding: var(--space-3) var(--space-4); cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--color-ink-muted); border-bottom: 3px solid transparent; transition: color var(--duration-fast) var(--ease-standard); }
.tab.active { color: var(--color-ink); border-bottom-color: var(--color-primary); }
.badge.status-open { background: var(--warning-bg); color: var(--warning-text); }
.badge.status-resolved { background: var(--success-bg); color: var(--success-text); }
.badge.status-placeholder { background: var(--slate-50); color: var(--color-ink-muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.stat-card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.stat-card .num { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--color-ink); letter-spacing: -0.02em; }
.stat-card .lab { font-size: 11px; color: var(--color-ink-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- Enterprise Command Center shell (v3, see shell.js) ---------- */
.cg-nav-scroll { flex: 1; padding: var(--space-2) 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.cg-sidebar-user {
  padding: var(--space-3) var(--space-3); margin: 0 4px; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: var(--space-2);
}
/* Sidebar is fully hidden below 1024px by default (see .cg-sidebar in
   components.css) and shown as a full-width drawer with full labels when
   toggled open via the hamburger button — no separate icon-only collapsed
   state, so labels must stay visible whenever the drawer is open. */
