/* ════════════════════════════════════════════════════════════════
   ShopManager V3 — workshop industrial dark theme
   2026-05-03 sandbox build.

   Theme tokens at :root for easy swap to light mode later
   (Loki #8: shop fluorescents may demand a light theme).
   ════════════════════════════════════════════════════════════════ */

:root {
  /* Color tokens */
  --bg-primary:    #0d0f12;
  --bg-elevated:   #181b21;
  --bg-overlay:    #1f242c;
  --border:        #262a33;
  --border-strong: #3a4150;

  --text-primary:  #e8eaed;
  --text-muted:    #8a92a6;
  --text-dim:      #5b6275;

  --accent:        #ff7a1a;
  --accent-soft:   #ff7a1a22;
  --accent-glow:   #ff7a1a55;

  --success:       #3dd97f;
  --success-soft:  #3dd97f22;
  --warning:       #ffb84d;
  --warning-soft:  #ffb84d22;
  --danger:        #ff5a5f;
  --danger-soft:   #ff5a5f22;

  /* Lane tones */
  --lane-intake:   #5b9cff;
  --lane-incoming: #ffb84d;
  --lane-shop:     #ff7a1a;
  --lane-ready:    #3dd97f;
  --lane-done:     #5b6275;

  /* Type */
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* Spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;

  --shadow: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lift: 0 10px 24px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}
body { min-height: 100vh; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px;
  background: var(--bg-overlay);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-glow);
  outline-offset: -1px;
  border-color: var(--accent);
}
code {
  font-family: var(--font-mono);
  background: var(--bg-overlay);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 12.5px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  transition: background 100ms, border-color 100ms, transform 80ms;
}
.btn:hover { background: var(--bg-overlay); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); color: #0d0f12; border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: #ff8c3a; border-color: #ff8c3a; color: #0d0f12; }
.btn-ghost {
  background: transparent; border-color: transparent; color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-success { background: var(--success); color: #0d0f12; border-color: var(--success); font-weight: 600; }

/* ── PIN screen ──────────────────────────────────────────── */
.pin-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,122,26,0.08), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(91,156,255,0.05), transparent 50%),
    var(--bg-primary);
}
.pin-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  width: min(360px, 92vw);
  box-shadow: var(--shadow-lift);
}
.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.brand-mark {
  font-size: 28px;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-overlay);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.brand-mark.sm { width: 36px; height: 36px; font-size: 20px; box-shadow: none; }
.brand-name { font-weight: 600; font-size: 16px; }
.brand-sub  { color: var(--text-muted); font-size: 12px; }

.pin-display {
  font-family: var(--font-mono);
  font-size: 32px;
  letter-spacing: 12px;
  text-align: center;
  padding: var(--sp-3);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-3);
  color: var(--accent);
}
.pin-error {
  color: var(--danger); font-size: 13px; text-align: center;
  padding: var(--sp-2); margin-bottom: var(--sp-2);
}
.pin-pad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2);
}
.pin-pad button {
  padding: 18px 0; font-size: 22px;
  background: var(--bg-overlay);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: background 80ms;
}
.pin-pad button:hover { background: var(--bg-elevated); border-color: var(--accent); }
.pin-pad .pin-fn { font-size: 14px; color: var(--text-muted); }
.pin-pad .pin-enter { background: var(--accent); color: #0d0f12; border-color: var(--accent); font-weight: 700; font-size: 22px; }
.pin-pad .pin-enter:hover { background: #ff8c3a; }
.pin-hint {
  margin-top: var(--sp-4); text-align: center;
  color: var(--text-dim); font-size: 11.5px;
  font-family: var(--font-mono);
}

/* ── Topbar ──────────────────────────────────────────────── */
.app { padding-bottom: var(--sp-5); }
.topbar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 8px var(--sp-5);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  min-height: 52px;
}
.topbar-left { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }
.topbar-app { font-weight: 600; font-size: 15px; }
.topbar-date { color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); }
.topbar-search { flex: 1; max-width: 640px; margin: 0 auto; }
.topbar-search input { padding: 7px 12px; min-height: 34px; font-size: 13.5px; }
.topbar-right { display: flex; align-items: center; gap: var(--sp-3); }
.user-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 4px 4px 12px;
  font-size: 13px;
}
.user-logout {
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text-muted); padding: 4px 10px;
  border-radius: 999px; font-size: 12px;
}
.user-logout:hover { color: var(--danger); border-color: var(--danger); }

/* ── Today Strip ────────────────────────────────────────── */
.today-strip {
  margin: var(--sp-4) var(--sp-5) 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.today-title {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 2px; color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.today-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: var(--sp-4);
}
/* Daily Pulse line (Migration 016) — quiet single row under the grid.
   Just the numbers vs. the 7-day average. No score, no colour. */
.today-pulse {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px var(--sp-3);
  font-family: var(--font-mono);
  font-size: 12px;
}
.today-pulse-main { color: var(--text); }
.today-pulse-avg  { color: var(--text-muted); }
.today-block {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
}
.today-block-title {
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: var(--sp-2);
}
.today-rows { display: flex; flex-direction: column; gap: 6px; }
.today-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.today-row:hover { border-color: var(--accent); }
.today-row.active { border-color: var(--accent); background: var(--accent-soft); }
.today-row-label { font-size: 13px; color: var(--text-primary); }
.today-row-count {
  font-family: var(--font-mono); font-size: 16px;
  color: var(--accent); font-weight: 600;
}
.today-row[data-bucket="overdue"] .today-row-count { color: var(--danger); }
.today-row[data-bucket="today"] .today-row-count { color: var(--accent); }
.today-row[data-bucket="tomorrow"] .today-row-count { color: var(--text-muted); }
.today-detail .today-detail-list {
  max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.today-detail-item {
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.today-detail-item:hover { border-color: var(--accent); }
.today-detail-item .ji-job { font-family: var(--font-mono); color: var(--accent); font-size: 12px; }
.today-detail-item .ji-name { font-size: 13px; color: var(--text-primary); }
.today-detail-item .ji-equip { font-size: 12px; color: var(--text-muted); }
.empty {
  color: var(--text-dim); text-align: center; padding: var(--sp-4);
  font-size: 12px; font-style: italic;
}

/* ── Kanban ─────────────────────────────────────────────── */
.kanban-wrap {
  margin: var(--sp-4) var(--sp-5) 0;
}
.kanban-controls {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-3);
  flex-wrap: wrap; gap: var(--sp-3);
}
.lane-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
}
.filter-chip:hover { color: var(--text-primary); border-color: var(--accent); }
.filter-chip.active { background: var(--accent); color: #0d0f12; border-color: var(--accent); }
.lane-meta { color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); }

.kanban {
  display: grid;
  /* Weighted lanes: In Shop is the work-in-progress focus and gets the most
     cards, so it's wider. Left Today is just a closed-today tally, so it's
     consolidated tighter. Triage / Incoming / Ready stay equal. */
  grid-template-columns: 1fr 1fr 1.2fr 1fr 1fr;
  gap: var(--sp-3);
  min-height: 400px;
}
@media (max-width: 1280px) {
  .kanban {
    grid-template-columns:
      minmax(220px, 1fr)
      minmax(220px, 1fr)
      minmax(260px, 1.2fr)
      minmax(220px, 1fr)
      minmax(220px, 1fr);
    overflow-x: auto;
  }
}

.lane {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  display: flex; flex-direction: column;
  min-width: 0;
}
.lane.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.lane-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 2px solid var(--lane-color, var(--border));
}
.lane[data-lane="intake"]   { --lane-color: var(--lane-intake); }
.lane[data-lane="incoming"] { --lane-color: var(--lane-incoming); }
.lane[data-lane="in_shop"]  { --lane-color: var(--lane-shop); }
.lane[data-lane="ready"]    { --lane-color: var(--lane-ready); }
.lane[data-lane="done"]     { --lane-color: var(--lane-done); }
.lane-name {
  font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--lane-color, var(--text-primary));
}
.lane-count {
  background: var(--bg-overlay); color: var(--text-muted);
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; border-radius: 999px;
}
/* Live "collected today" scoreboard — 'done' (Left Today) lane only.
   Sits tight after the job count, green to read as money not a count.
   margin-left:auto keeps name on the left, count+scoreboard on the right. */
.lane-count { margin-left: auto; }
.lane-scoreboard {
  margin-left: 6px;
  background: var(--bg-overlay);
  color: var(--success, #3fb950);
  font-family: var(--font-mono); font-weight: 600; font-size: 11px;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--success, #3fb950);
}
/* Ready lane = value awaiting pickup. Matt 2026-05-30: match Left Today's
   green (kept as its own class so we can re-style independently later). */
.lane-scoreboard-pending {
}
.lane-body {
  display: flex; flex-direction: column; gap: 8px;
  flex: 1; overflow-y: auto; max-height: calc(100vh - 380px);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  padding-right: 6px;
}
.lane-body::-webkit-scrollbar {
  width: 6px;
}
.lane-body::-webkit-scrollbar-track {
  background: transparent;
}
.lane-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
.lane-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Job card ───────────────────────────────────────────── */
.card {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: grab;
  transition: border-color 100ms, transform 80ms;
  user-select: none;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.4; }

.card-row1 {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px;
}
.card-job {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--accent); font-weight: 500;
}
.card-source {
  font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.card-source.jarvis { color: var(--lane-intake); }
.card-source.website { color: var(--success); }
.card-customer {
  font-weight: 600; font-size: 14px; margin-top: 2px;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-contact { font-size: 11px; color: var(--text-muted); line-height: 1.2; margin-top: 1px; }
.card-phone { font-size: 14px; font-weight: 400; color: var(--accent); white-space: nowrap; flex-shrink: 0; }
.card-equip {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-chips {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px;
}
.chip {
  font-size: 10.5px; padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: lowercase;
}
.chip.needs_diag { background: var(--lane-intake)22; color: var(--lane-intake); }
.chip.awaiting_customer { background: var(--warning-soft); color: var(--warning); }
.chip.parts_ordered { background: var(--accent-soft); color: var(--accent); }
.chip.parts_received { background: var(--success-soft); color: var(--success); }
.chip.wrenches { background: var(--accent-soft); color: var(--accent); }
.chip.declined { background: var(--danger-soft); color: var(--danger); }
.chip.no_fee { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.chip.invoice { background: var(--success-soft); color: var(--success); }
.chip.scheduled { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.chip.overdue { background: var(--danger-soft); color: var(--danger); }
.chip.delivery { background: var(--lane-incoming)22; color: var(--lane-incoming); }
.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.card-money { color: var(--success); font-weight: 600; }

/* ── Drawer ─────────────────────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: min(max(50vw, 720px), 100vw);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column;
  animation: drawerIn 200ms ease-out;
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-head {
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.drawer-head > div:first-child {
  flex: 1; min-width: 0;
  display: flex; flex-wrap: nowrap; align-items: baseline;
  column-gap: 10px;
}
.drawer-job-num {
  font-family: var(--font-mono); color: var(--accent); font-size: 13px;
  flex: none;
}
.drawer-customer {
  font-size: 17px; font-weight: 600;
  flex: 0 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drawer-customer-meta {
  font-size: 12px; color: var(--text-dim);
  display: flex; align-items: baseline; gap: 6px;
  flex: 1 1 auto; min-width: 0;
  overflow: hidden;
}
.drawer-customer-meta-edit {
  background: transparent; border: none; color: var(--accent);
  cursor: pointer; font-size: 12px; padding: 1px 6px;
  border-radius: 3px; font-family: inherit;
  margin-left: auto;
}
.drawer-customer-meta-edit:hover { background: var(--bg-elevated); }
.drawer-body {
  flex: 1; overflow-y: auto;
  padding: 12px 16px;
}

.drawer-section {
  margin-bottom: 12px;
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.drawer-section:last-child { border-bottom: 0; }
.drawer-section h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); margin: 0 0 var(--sp-3) 0; font-weight: 500;
}
.drawer-fields { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 13px; }
.drawer-fields dt { color: var(--text-muted); }
.drawer-fields dd { margin: 0; color: var(--text-primary); }
.drawer-fields dd.mono { font-family: var(--font-mono); color: var(--accent); }
.drawer-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.drawer-actions .btn {
  padding: 6px 12px;
  font-size: 12.5px;
}
.drawer-actions .btn-icon {
  padding: 6px 9px;
  font-size: 14px;
  line-height: 1;
}
.drawer-lane-bar {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: var(--sp-2);
}
.lane-pill {
  font-size: 10.5px; padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.lane-pill:hover { border-color: var(--accent); color: var(--text-primary); }
.lane-pill.current {
  background: var(--lane-color, var(--accent));
  color: #0d0f12; border-color: transparent;
}
.lane-pill[data-lane="intake"]   { --lane-color: var(--lane-intake); }
.lane-pill[data-lane="incoming"] { --lane-color: var(--lane-incoming); }
.lane-pill[data-lane="in_shop"]  { --lane-color: var(--lane-shop); }
.lane-pill[data-lane="ready"]    { --lane-color: var(--lane-ready); }
.lane-pill[data-lane="done"]     { --lane-color: var(--lane-done); }

.audit-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 240px; overflow-y: auto;
}
.audit-item {
  display: grid; grid-template-columns: 130px 100px 1fr;
  gap: 8px; font-size: 11.5px; padding: 6px 8px;
  background: var(--bg-overlay); border-radius: var(--radius-sm);
}
.audit-item .at { color: var(--text-dim); font-family: var(--font-mono); }
.audit-item .who { color: var(--accent); }
.audit-item .what { color: var(--text-primary); }

/* ── Modal ──────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-panel {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  width: min(640px, 92vw);
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lift);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 18px; font-weight: 600; }

.form-grid { display: grid; gap: var(--sp-3); }
.form-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--text-muted);
}
.form-actions {
  display: flex; justify-content: flex-end; gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

/* ─── Availability modal: 30-day calendar grid + AM/PM time-preference row ─── */
/* Mirrors the customer-facing book.html .calendar-widget pattern so staff and
   customers learn the same UI. Mobile-first: 7-col grid, 44px min-height cells,
   tap targets ≥ 44px on phones. */
.avail-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 4px;
  padding: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.avail-cal-weekday {
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0 2px;
  user-select: none;
}
.avail-cal-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 2px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  min-height: 44px;
  user-select: none;
  color: #fff;
}
.avail-cal-cell .avail-cal-dow {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1;
  margin-bottom: 2px;
}
.avail-cal-cell .avail-cal-day {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1;
}
.avail-cal-cell:hover:not(.disabled):not(.selected) {
  background: rgba(244,96,10,0.10);
  border-color: rgba(244,96,10,0.35);
}
.avail-cal-cell.selected {
  background: var(--accent, #f4600a);
  border-color: var(--accent, #f4600a);
}
.avail-cal-cell.selected .avail-cal-day,
.avail-cal-cell.selected .avail-cal-dow { color: #000; }
.avail-cal-cell.disabled {
  opacity: 0.32;
  cursor: not-allowed;
  background: rgba(255,255,255,0.015);
}
/* Existing blackouts on the grid — visual indicator + click-suppressed.
   Full = red day text, partial (transport-only) = yellow day text. */
.avail-cal-cell.blackout-full {
  cursor: not-allowed;
  border-color: rgba(229,85,85,0.45);
  background: rgba(229,85,85,0.07);
}
.avail-cal-cell.blackout-full .avail-cal-day { color: #ff6b6b; }
.avail-cal-cell.blackout-full:hover {
  background: rgba(229,85,85,0.07);
  border-color: rgba(229,85,85,0.45);
}
.avail-cal-cell.blackout-partial {
  cursor: not-allowed;
  border-color: rgba(250,204,21,0.4);
  background: rgba(250,204,21,0.05);
}
.avail-cal-cell.blackout-partial .avail-cal-day { color: #facc15; }
.avail-cal-cell.blackout-partial:hover {
  background: rgba(250,204,21,0.05);
  border-color: rgba(250,204,21,0.4);
}

/* Selected always wins over blackout colors. Doubled .selected for specificity. */
.avail-cal-cell.selected.selected {
  background: var(--accent, #f4600a);
  border-color: var(--accent, #f4600a);
}
.avail-cal-cell.selected.selected .avail-cal-day,
.avail-cal-cell.selected.selected .avail-cal-dow { color: #000; }
.avail-cal-blank {
  background: transparent;
  border: none;
  cursor: default;
  min-height: 44px;
}
.avail-cal-blank:hover { background: transparent; border: none; }

.avail-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.avail-time-row .time-pref-btn {
  padding: 12px 8px;
  background: var(--bg-elevated, rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
  font-size: 14px;
  min-height: 44px;
}
.avail-time-row .time-pref-btn:hover { border-color: rgba(244,96,10,0.45); }
.avail-time-row .time-pref-btn.selected {
  border-color: var(--accent, #f4600a);
  background: rgba(244,96,10,0.12);
}

@media (max-width: 480px) {
  .avail-cal { padding: 6px; gap: 3px; }
  .avail-cal-cell { padding: 4px 1px; min-height: 42px; }
  .avail-cal-cell .avail-cal-day { font-size: 13px; }
}

/* Bulk-delete mode: red-tinted border around the grid + queued-for-delete cells. */
.avail-cal.bulk-delete {
  border-color: rgba(229,85,85,0.5);
  box-shadow: 0 0 0 1px rgba(229,85,85,0.2);
}
.avail-cal-cell.queued-delete {
  background: rgba(229,85,85,0.18) !important;
  border-color: #ff6b6b !important;
  outline: 1px dashed #ff6b6b;
}

/* Toast variant: with an inline action button (used for 5s undo). */
.toast.with-action {
  display: flex; align-items: center; gap: 12px;
  padding-right: 10px;
}
.toast .toast-undo-btn {
  background: transparent; border: 1px solid rgba(255,255,255,0.5); color: #fff;
  padding: 4px 12px; border-radius: 4px; font-size: 12px; font-weight: 600;
  cursor: pointer; text-transform: uppercase; letter-spacing: 0.05em;
}
.toast .toast-undo-btn:hover { background: rgba(255,255,255,0.15); }

.jarvis-help table {
  width: 100%; border-collapse: collapse; margin-top: var(--sp-3); font-size: 13px;
}
.jarvis-help th, .jarvis-help td {
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.jarvis-help th { color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.jarvis-help .hint { color: var(--text-muted); font-size: 12px; margin-top: var(--sp-3); }

/* ── Footer cheat sheet ─────────────────────────────────── */
.footer-cheat {
  margin: var(--sp-4) var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px; color: var(--text-muted);
}
.footer-cheat strong { color: var(--text-primary); margin-right: var(--sp-2); }

/* ── Toast ──────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: var(--sp-4); right: var(--sp-4); z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  min-width: 200px; max-width: 360px;
  box-shadow: var(--shadow);
  animation: toastIn 200ms ease-out;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Utility ────────────────────────────────────────────── */
.hidden, [hidden] { display: none !important; }


/* ── Round 5: visual hierarchy ─────────────────────────────────── */

/* Card: urgency border */
.card {
  position: relative;
  border-left: 3px solid transparent;
  padding: 10px 12px 10px 14px;
}
.card.urgency-red    { border-left-color: var(--danger);  background: linear-gradient(90deg, var(--danger-soft) 0%, var(--bg-overlay) 16%); }
.card.urgency-yellow { border-left-color: var(--warning); background: linear-gradient(90deg, var(--warning-soft) 0%, var(--bg-overlay) 16%); }
.card.urgency-green  { border-left-color: var(--success); background: linear-gradient(90deg, var(--success-soft) 0%, var(--bg-overlay) 16%); }

/* Card layout: top row, equip, bottom row */
.card-top {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 2px;
}
.card-customer {
  flex: 1; font-weight: 600; font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-equip {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 8px;
}
.card-bottom {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; min-height: 20px;
}
.card-bottom .chip {
  margin: 0;  /* override inherited */
}
.card-money-badge {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  color: var(--success);
  background: var(--success-soft);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.card-unread-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
  flex-shrink: 0;
}

/* Today Strip: tomorrow counts more muted */
.today-row[data-bucket="tomorrow"] .today-row-count { color: var(--text-dim); }

/* Line items panel: GREEN box (Round 5 — "money you modify") */
.li-panel-green {
  background: linear-gradient(135deg, rgba(61,217,127,0.04), transparent 60%), var(--bg-elevated);
  border: 1px solid var(--success);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: 0 0 0 4px rgba(61,217,127,0.06);
}
.li-panel-green > h3 {
  color: var(--success) !important;
  margin-top: 0 !important;
}
.li-panel-green h3 .li-hint {
  color: var(--text-dim);
  font-weight: normal;
  letter-spacing: 0;
  font-size: 10.5px;
  margin-left: 8px;
}

/* Muted sections: notes, details, sms-thread, audit */
.section-muted {
  background: rgba(0,0,0,0.15) !important;
  border-color: rgba(255,255,255,0.04) !important;
}
.section-muted summary,
.section-muted h3 {
  color: var(--text-dim) !important;
}


/* ── Round 6: truck icons + collapsible Today Strip ───────── */

.card-truck {
  font-size: 13px;
  background: var(--lane-incoming)22;
  color: var(--lane-incoming);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* Today Strip <details> styling */
.today-strip[open] .today-toggle-hint::before { content: '(click to collapse)'; }
.today-strip:not([open]) .today-toggle-hint::before { content: '(click to expand)'; }
.today-strip .today-toggle-hint {
  font-size: 10px; color: var(--text-dim); margin-left: 8px; font-weight: normal; letter-spacing: 0;
}
.today-strip .today-toggle-hint::before { display: inline; }
.today-strip > .today-title {
  cursor: pointer;
  list-style: none;  /* hide default disclosure triangle on Chrome */
  user-select: none;
}
.today-strip > .today-title::-webkit-details-marker { display: none; }
.today-strip > .today-title::before {
  content: '▾';
  display: inline-block;
  margin-right: 8px;
  color: var(--text-muted);
  transition: transform 100ms;
}
.today-strip:not([open]) > .today-title::before { transform: rotate(-90deg); }


/* ── Round 6.5: Today Strip "blocked by" line ─────────────── */
.today-detail-item .ji-why {
  font-size: 11.5px;
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.1px;
}
.today-detail-item .ji-left { flex: 1; min-width: 0; }


/* ── Round 7: efficiency improvements ─────────────────────── */

/* Quick-accept button on intake cards (saves 2 clicks per accept) */
.card-quick-accept {
  background: var(--success);
  color: #0d0f12;
  border: 0;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 80ms;
}
.card-quick-accept:hover { background: #5ce899; }

/* Mini-status hint on cards (reduces drawer-opens) */
.card-mini-hint {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card.urgency-red    .card-mini-hint { color: var(--danger); font-style: normal; font-weight: 500; }
.card.urgency-yellow .card-mini-hint { color: var(--warning); font-style: normal; }
.card.urgency-green  .card-mini-hint { color: var(--success); font-style: normal; }

/* Aging metadata under the job # (Matt 2026-05-30): quiet, single line,
   "Updated: 3d · Age: 5d". Kept smaller/lighter than the equipment line so it
   reads as ambient info and doesn't compete with name/chip/price. */
.card-aging {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.85;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pulse animation removed Round 7 — stale jobs use ⚠ in chip text instead */

/* ══════════════════════════════════════════════════════════════
   HISTORY — topbar dropdown + modal (jobs / invoices / payments)
   Self-contained block. Lift out whole when app.css is chunked.
   ══════════════════════════════════════════════════════════════ */

/* Dropdown trigger in the topbar */
.history-menu { position: relative; }
.history-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  padding: 4px;
  z-index: 120;
}
.history-dd-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.history-dd-item:hover { background: var(--bg-elevated); color: var(--accent); }

/* Modal: tabs */
.history-tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.history-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 12px;
  cursor: pointer;
}
.history-tab:hover { color: var(--text-primary); }
.history-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Modal: filter toolbar */
.history-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 8px;
}
.history-toolbar input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
}
.history-toolbar input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Modal: scrollable table area */
.history-body {
  padding: 0 20px 20px;
  max-height: 60vh;
  overflow-y: auto;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.history-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-overlay);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-strong);
}
.history-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  white-space: nowrap;
}
.history-row-clickable { cursor: pointer; }
.history-row-clickable:hover td { background: var(--bg-elevated); }

/* ── Form input polish (2026-05-18) ───────────────────────────── */

/* Hide number-input spinners (the up/down arrows inside money/numeric fields).
   Matt: price boxes don't need them; users either type or use other controls. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Date / datetime-local inputs: theme the native picker for dark UI.
   color-scheme: dark tells the browser to render the calendar popup in dark
   mode; invert filter recolors the tiny built-in calendar icon so it's
   visible against our dark inputs. */
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"] {
  color-scheme: dark;
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
  /* Recolor the native dark icon to theme orange. invert+sepia+hue-rotate
     is the trick for tinting an SVG you can't directly style. */
  filter: invert(50%) sepia(95%) saturate(2000%) hue-rotate(360deg) brightness(105%);
  cursor: pointer;
  /* Make the indicator span the right side of the input so clicking
     anywhere on the right edge opens the picker. Chrome/Edge expand
     the click target to the full input automatically on focus, but
     this gives a larger visible hit area. */
  padding: 4px 6px;
  opacity: 1;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="week"]::-webkit-calendar-picker-indicator:hover {
  background: var(--bg-overlay);
  border-radius: 3px;
}

/* ── Navbar redesign 2026-05-18 ─────────────────────────────── */
/* Icons get labels under them — no more mystery row. CTA "+ New Job"
   is the only orange element so it pops. Logout is collapsed into a user
   menu. Date moved to the footer cheat strip. */

.topbar-icons {
  display: flex; align-items: stretch; gap: 2px;
}
.topbar-icon {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 10px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  min-width: 56px;
  position: relative;
  transition: background 100ms, color 100ms, border-color 100ms;
}
.topbar-icon:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
  border-color: var(--border);
}
.topbar-icon-emoji {
  font-size: 17px; line-height: 1;
  filter: saturate(0.85);
}
.topbar-icon-label {
  font-size: 10px; letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
}
/* Unread badge — amber, not red. Red is for errors. */
.topbar-icon-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--warning);
  color: #0d0f12;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 999px;
  min-width: 14px; text-align: center;
}

/* Make the primary CTA stand out as the only orange in the row */
.topbar-cta {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13.5px;
}

/* User menu: collapses Logout out of sight by default */
.user-menu { position: relative; }
.user-menu .user-chip {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-overlay);
  border-radius: 999px;
  padding: 4px 10px 4px 12px;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-primary);
}
.user-menu .user-chip:hover { border-color: var(--accent); }
.user-chip-caret { color: var(--text-dim); font-size: 10px; }
.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  min-width: 140px;
  padding: 4px;
  z-index: 60;
}
.user-dd-item {
  display: block; width: 100%;
  background: transparent; border: none;
  color: var(--text-primary);
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}
.user-dd-item:hover { background: var(--bg-overlay); color: var(--danger); }

/* Footer cheat row now holds the date at the right */
.footer-cheat {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.footer-cheat-left { flex: 1; min-width: 0; }
.footer