/* ═══════════════════════════════════════════════════════════════════════
   Crescent Planner — styles.
   Design tokens PINNED below; every rule uses tokens, never raw values.

   The visual system is DIGIT's (extracted from the live app bundle via
   reference/crescent-meats-design-ref.html): Inter, the stone neutral
   palette, hairline rgba-black borders, 28px small buttons (radius 8),
   dark stone primary button, underline tab bar (36px), and AG-Grid-style
   tables (36px rows, 13px, hairline row+column borders, stone-50 hover).
   Desktop-first, full-width pages.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* Stone neutral scale (Digit `Z`) */
  --stone-50:  rgba(250, 250, 249, 1);
  --stone-100: rgba(245, 245, 244, 1);
  --stone-150: rgba(238, 237, 236, 1);
  --stone-200: rgba(231, 229, 228, 1);
  --stone-300: rgba(214, 211, 209, 1);
  --stone-350: rgba(190, 185, 182, 1);
  --stone-450: rgba(143, 136, 131, 1);
  --stone-650: rgba(77, 73, 68, 1);
  --stone-700: rgba(68, 64, 59, 1);
  --stone-800: rgba(41, 37, 36, 1);
  --stone-900: rgba(28, 25, 23, 1);
  --stone-950: rgba(12, 10, 9, 1);

  /* Text */
  --text-primary:   var(--stone-950);
  --text-secondary: var(--stone-650);
  --text-tertiary:  var(--stone-450);
  --text-invert:    #FFFFFF;

  /* Surfaces */
  --bg:             #FFFFFF;            /* page background */
  --panel:          #FFFFFF;            /* paper */
  --panel-raised:   var(--stone-100);   /* group rows, selected cells */
  --divider:        rgba(0, 0, 0, 0.05);   /* border.default / hairline */
  --border:         rgba(0, 0, 0, 0.10);   /* border.strong (inputs, buttons) */
  --hover:          rgba(0, 0, 0, 0.05);   /* text/icon button hover fill */
  --row-hover:      var(--stone-50);

  /* Accent (Digit blue `X`) — focus rings, links, gantt driver bars */
  --accent:         rgba(43, 127, 255, 1);
  --accent-strong:  rgba(21, 93, 252, 1);
  --accent-soft:    rgba(219, 234, 254, 1);
  --gantt-bar:      var(--accent-strong);
  --weekend-shade:  var(--stone-100);

  /* Status ramp (Digit red/amber/orange/green scales; RCC heat map + flags) */
  --ok-bg:   rgba(220, 252, 231, 1);  --ok-fg:   rgba(1, 102, 48, 1);
  --warn-bg: rgba(254, 243, 198, 1);  --warn-fg: rgba(151, 60, 0, 1);
  --hot-bg:  rgba(255, 237, 212, 1);  --hot-fg:  rgba(154, 52, 18, 1);
  --crit-bg: rgba(255, 226, 226, 1);  --crit-fg: rgba(159, 7, 18, 1);
  --ok-solid:   rgba(0, 166, 62, 1);
  --warn-solid: rgba(225, 113, 0, 1);
  --crit-solid: rgba(231, 0, 11, 1);

  /* Type + spacing (Digit: 13px body, buttons 13/500, h5 16/600) */
  --font: 'Inter var', Inter, ui-sans-serif, system-ui, -apple-system,
          BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-lg: 14px; --fs-xl: 16px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --radius: 10px; --radius-sm: 8px; --radius-lg: 16px;
  --row-h: 36px; --ctl-h: 28px;

  /* Shadows (Digit Fc / Ic) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.10), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.10), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.10), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-inset: 0 2px 4px 0 rgba(0, 0, 0, 0.06) inset;
  --shadow: var(--shadow-md);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.25rem;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

/* ── Header row (Digit app bar: transparent on page bg, h5 title) ──────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
}
.topbar-title { font-size: var(--fs-xl); line-height: 20px; font-weight: 600; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }

/* ── Tab bar (Digit sub-nav: 36px, hairline bottom, 2px indicator) ─────── */
.tabbar {
  display: flex;
  height: var(--row-h);
  align-items: stretch;
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--divider);
  overflow-x: auto; white-space: nowrap;
  scrollbar-width: none;
}
.tabbar a {
  display: inline-flex; align-items: center; gap: 4px;
  margin-right: var(--sp-4);
  padding: var(--sp-2) 0 var(--sp-3);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--fs-md);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabbar a svg { width: 16px; height: 16px; }
.tabbar a:hover { color: var(--text-primary); }
.tabbar a.active {
  color: var(--stone-900);
  border-bottom-color: var(--stone-900);
}

/* ── Main view (full width) ────────────────────────────────────────────── */
.view { padding: var(--sp-4); }
.view h2 { font-size: var(--fs-xl); line-height: 20px; font-weight: 600; margin: var(--sp-1) 0 var(--sp-4); }
.view h3 { font-size: var(--fs-lg); font-weight: 600; margin: var(--sp-5) 0 var(--sp-3); }

.panel {
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.panel-title { font-weight: 600; margin-bottom: var(--sp-3); }
.hint { color: var(--text-secondary); font-size: var(--fs-sm); }
.placeholder {
  color: var(--text-tertiary);
  text-align: center;
  padding: var(--sp-6);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ── Buttons (Digit small buttons: 28px, radius 8, 13/500) ─────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  font: inherit; font-size: var(--fs-md); font-weight: 500; line-height: 1;
  cursor: pointer;
  min-height: var(--ctl-h);
  padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.btn:hover:not(:disabled) { background: var(--stone-50); }
.btn:active:not(:disabled) { background: var(--stone-100); box-shadow: var(--shadow-inset); }
.btn:disabled { color: var(--text-tertiary); cursor: not-allowed; }
.btn-primary {
  background: var(--stone-700); border-color: var(--stone-700);
  color: var(--text-invert); font-weight: 500;
}
.btn-primary:hover:not(:disabled) { background: var(--stone-800); border-color: var(--stone-800); }
.btn-primary:active:not(:disabled) { background: var(--stone-900); border-color: var(--stone-900); box-shadow: var(--shadow-inset); }
.btn-primary:disabled { background: var(--stone-350); border-color: var(--stone-350); color: var(--text-invert); }
.btn-danger { color: var(--crit-fg); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; cursor: pointer;
  width: var(--ctl-h); height: var(--ctl-h); min-height: var(--ctl-h); padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}
.btn-icon:hover:not(:disabled) { background: var(--hover); }
.btn-icon:active:not(:disabled) { background: rgba(0, 0, 0, 0.10); }
.btn-icon:disabled { color: var(--text-tertiary); cursor: not-allowed; }

/* ── Inputs (Digit: radius 8, 13px, 28px, hairline-to-strong borders) ──── */
input[type=text], input[type=number], input[type=date],
input[type=datetime-local], select {
  font: inherit; font-size: var(--fs-md);
  min-height: var(--ctl-h);
  padding: 3px var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-primary);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--stone-900); }
input.num { width: 72px; text-align: right; }
label.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ── Tables (Digit AG Grid: 36px rows, 13px, hairline row+col borders,
      white paper, normal-case muted headers, stone-50 hover) ───────────── */
table.grid { border-collapse: collapse; width: 100%; background: var(--panel);
  border: 1px solid var(--divider); }
table.grid th {
  text-align: left;
  font-size: var(--fs-md);
  font-weight: 400;
  color: var(--text-secondary);
  background: var(--panel);
  height: var(--row-h);
  padding: 0 var(--sp-2);
  border-bottom: 1px solid var(--divider);
  border-right: 1px solid var(--divider);
  position: sticky; top: 0;
}
table.grid td {
  height: var(--row-h);
  padding: 0 var(--sp-2);
  border-bottom: 1px solid var(--divider);
  border-right: 1px solid var(--divider);
}
table.grid th:last-child, table.grid td:last-child { border-right: none; }
table.grid tr:hover td { background: var(--row-hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }

/* Status chips */
.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.chip-ok   { background: var(--ok-bg);   color: var(--ok-fg); }
.chip-warn { background: var(--warn-bg); color: var(--warn-fg); }
.chip-hot  { background: var(--hot-bg);  color: var(--hot-fg); }
.chip-crit { background: var(--crit-bg); color: var(--crit-fg); }
.chip-mute { background: var(--stone-150); color: var(--text-secondary); }

/* ── Modal (Digit dialog: radius 16, xl shadow, 20% black overlay) ─────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.2);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh var(--sp-4);
  z-index: 100;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: min(760px, 100%);
  max-height: 85vh;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--divider);
  font-weight: 600; font-size: var(--fs-xl);
}
.modal-body { padding: var(--sp-4); overflow-y: auto; }
.modal-body h4 { margin: var(--sp-4) 0 var(--sp-2); }
.modal-body p, .modal-body li { line-height: 1.5; color: var(--text-secondary); }

/* ── Toasts (Digit snackbar: stone-800, radius 10) ─────────────────────── */
#toast-root {
  position: fixed; bottom: var(--sp-4); right: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-2);
  z-index: 200;
}
.toast {
  background: var(--stone-800);
  color: var(--text-invert);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
}
.toast-err { background: var(--crit-fg); }

/* ── Schedule view ─────────────────────────────────────────────────────── */
.sched-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center;
  margin-bottom: var(--sp-3);
}
.sched-toolbar .spacer { flex: 1; }
.sched-count { color: var(--text-secondary); font-size: var(--fs-sm); }

table.sched { border-collapse: collapse; width: 100%; background: var(--panel);
  border: 1px solid var(--divider); }
table.sched th {
  text-align: left; font-size: var(--fs-md); font-weight: 400;
  color: var(--text-secondary); background: var(--panel);
  height: var(--row-h); padding: 0 var(--sp-2);
  border-bottom: 1px solid var(--divider); border-right: 1px solid var(--divider);
  position: sticky; top: 0; z-index: 2; white-space: nowrap;
}
table.sched td { padding: 2px var(--sp-2); border-bottom: 1px solid var(--divider);
  border-right: 1px solid var(--divider); vertical-align: middle; }
table.sched th:last-child, table.sched td:last-child { border-right: none; }
tr.mo-row td { background: var(--panel-raised); font-weight: 600; cursor: grab; }
tr.mo-row.dragging td { opacity: .4; }
tr.mo-row.drop-above td { border-top: 2px solid var(--accent); }
tr.mo-row td.caret { cursor: pointer; width: 24px; text-align: center; color: var(--text-secondary); }
tr.wo-row td { font-weight: 400; font-size: var(--fs-sm); height: var(--row-h); }
.mo-num-unknown { color: var(--crit-fg); font-weight: 700; }

/* Full-bleed list tables (Digit list pages): row hairlines run edge-to-edge
   under the side nav / window edge; the page gutter moves into the first and
   last cells so content stays aligned with the toolbar above. */
.bleed { margin: 0 calc(-1 * var(--sp-4)); }
.bleed > table { border-left: none; border-right: none; }
.bleed > table th:first-child, .bleed > table td:first-child { padding-left: var(--sp-4); }
.bleed > table th:last-child,  .bleed > table td:last-child  { padding-right: var(--sp-4); }
input.seq-input { width: 44px; min-height: 0; text-align: right; font: inherit; padding: 2px 4px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; }
input.seq-input:hover, input.seq-input:focus { border-color: var(--border); background: var(--panel); }

/* Inline editors inside schedule cells (transparent until hover, like the
   global input rule doesn't apply — keep these selectors ≥ its specificity) */
input.cell-edit, select.cell-edit { font: inherit; font-size: var(--fs-sm);
  min-height: 0; padding: 2px 5px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; max-width: 130px; }
input.cell-edit:hover, select.cell-edit:hover { border-color: var(--border); }
input.cell-edit:focus, select.cell-edit:focus { border-color: var(--stone-900); background: var(--panel); outline: none; }
input.cell-edit.num { width: 62px; text-align: right; }
input.cell-edit.driver-empty { background: var(--warn-bg); border-color: var(--warn-fg); }
input.cell-edit[type="datetime-local"] { max-width: 178px; }

/* Step badges */
.step-badge { display: inline-block; padding: 1px 7px; border-radius: 4px;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; }
.step-badge.THAW  { background: #E3F2FD; color: #0D47A1; }
.step-badge.GRIND { background: #FBE9E7; color: #BF360C; }
.step-badge.SPICE { background: #FFF3E0; color: #E65100; }
.step-badge.ACID  { background: #F3E5F5; color: #6A1B9A; }
.step-badge.MIX   { background: #E8F5E9; color: #1B5E20; }
.step-badge.STUFF { background: #E0F7FA; color: #006064; }
.step-badge.SMOKE { background: #EFEBE9; color: #4E342E; }
.step-badge.PREP  { background: #FFFDE7; color: #827717; }
.step-badge.PACK  { background: #E8EAF6; color: #283593; }

/* ── Create Job wizard ─────────────────────────────────────────────────── */
.modal.wizard { width: min(860px, 100%); }
.stepper { display: flex; gap: var(--sp-1); padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--divider); }
.stepper .step { padding: var(--sp-2) var(--sp-3) var(--sp-3); color: var(--text-tertiary);
  font-weight: 500; font-size: var(--fs-md);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.stepper .step.active { color: var(--stone-900); border-bottom-color: var(--stone-900); }
.stepper .step.done { color: var(--ok-fg); }

.wiz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3) var(--sp-4); }
.wiz-grid .full { grid-column: 1 / -1; }
.wiz-grid label { display: block; font-size: var(--fs-sm); font-weight: 500;
  margin-bottom: 4px; color: var(--text-secondary); }
.wiz-grid label .opt { font-weight: 400; color: var(--text-tertiary); }
.wiz-grid input, .wiz-grid select, .wiz-grid textarea { width: 100%; }
.wiz-grid textarea { font: inherit; font-size: var(--fs-md); padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); min-height: 56px; resize: vertical; }
.helper { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: 3px; }
.helper.warn { color: var(--crit-fg); font-weight: 600; }
.calc-result { font-size: var(--fs-xs); color: var(--ok-fg); margin-top: 3px; min-height: 14px; }
.calc-result.error { color: var(--crit-fg); }

.searchable { position: relative; }
.searchable-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  background: var(--panel); border: 1px solid var(--divider); border-radius: var(--radius-sm);
  max-height: 240px; overflow-y: auto; box-shadow: var(--shadow-md); display: none; }
.searchable-list.visible { display: block; }
.searchable-item { padding: 6px 10px; cursor: pointer; font-size: var(--fs-sm); }
.searchable-item:hover, .searchable-item.highlighted { background: var(--stone-100); }
.searchable-empty { padding: 8px 10px; color: var(--text-tertiary); font-size: var(--fs-sm); }

.sub-summary { display: flex; justify-content: space-between; align-items: center;
  background: var(--stone-50); border: 1px solid var(--divider);
  border-radius: var(--radius-sm); padding: var(--sp-3);
  margin-bottom: var(--sp-3); }
.sub-summary .item-name { font-weight: 600; }
.sub-summary .qty { color: var(--text-secondary); font-size: var(--fs-sm); }

.sub-table { border: 1px solid var(--divider); border-radius: var(--radius-sm); overflow: hidden; }
.sub-row { display: grid; grid-template-columns: 40px 64px 1fr 150px 150px 70px;
  gap: var(--sp-2); align-items: center; padding: 6px 10px;
  border-bottom: 1px solid var(--divider); }
.sub-row:last-child { border-bottom: none; }
.sub-row.header { background: var(--panel); font-size: var(--fs-sm); font-weight: 400;
  color: var(--text-secondary); }
.sub-row.locked { background: var(--warn-bg); }
.sub-row.recalculated { animation: recalc-flash .6s ease; }
@keyframes recalc-flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.sub-item .name { font-size: var(--fs-sm); font-weight: 500; }
.sub-item .id { font-size: var(--fs-xs); color: var(--text-tertiary); }
.qty-input-group { display: flex; align-items: center; gap: 4px; }
.qty-input-group input { width: 90px; text-align: right; }
.qty-input-group .unit { font-size: var(--fs-xs); color: var(--text-tertiary); }
.sub-empty { padding: var(--sp-4); color: var(--text-tertiary); text-align: center; }
.cascade-note { font-size: var(--fs-xs); color: var(--text-tertiary); margin: var(--sp-2) 0 0; }

.wiz-footer { display: flex; gap: var(--sp-2); align-items: center;
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--divider); }
.wiz-footer .spacer { flex: 1; }
.wiz-status { flex: 1; padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: var(--fs-sm); display: none; }
.wiz-status.visible { display: block; }
.wiz-status.success { background: var(--ok-bg); color: var(--ok-fg); }
.wiz-status.error { background: var(--crit-bg); color: var(--crit-fg); }
.wiz-status.loading { background: var(--stone-100); color: var(--text-secondary); }

/* Formula-card preview (overlay above the wizard) */
.preview-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.2);
  display: none; align-items: flex-start; justify-content: center;
  padding: 8vh var(--sp-4); z-index: 300; }
.preview-overlay.show { display: flex; }
.preview-modal { background: var(--panel); border-radius: var(--radius-lg);
  border: 1px solid var(--divider);
  box-shadow: var(--shadow-xl); width: min(640px, 100%); max-height: 80vh;
  display: flex; flex-direction: column; }
.preview-card { border: 1px solid var(--divider); border-radius: var(--radius-sm);
  margin-bottom: var(--sp-3); overflow: hidden; }
.preview-card-head { background: var(--stone-50); padding: 4px 10px;
  font-size: var(--fs-xs); font-weight: 600; }
.preview-card-item { padding: 6px 10px; font-weight: 600; font-size: var(--fs-sm); }
.preview-card-body { padding: 6px 10px 10px; font-family: var(--font-mono);
  font-size: var(--fs-xs); white-space: pre-wrap; color: var(--text-secondary); }

/* ── Gantt ─────────────────────────────────────────────────────────────── */
.gantt-toolbar { display: flex; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-3); flex-wrap: wrap; }
.gantt-mode { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; box-shadow: var(--shadow-sm); }
.gantt-mode button { font: inherit; font-size: var(--fs-md); font-weight: 500;
  min-height: calc(var(--ctl-h) - 2px); padding: 0 var(--sp-2);
  border: none; background: var(--panel); cursor: pointer; color: var(--text-primary); }
.gantt-mode button:hover:not(.active) { background: var(--stone-50); }
.gantt-mode button.active { background: var(--stone-700); color: var(--text-invert); }
.gantt { background: var(--panel); border: 1px solid var(--divider); overflow-x: auto; }
.gantt-row { display: grid; grid-template-columns: 220px 1fr; border-bottom: 1px solid var(--divider); min-height: 26px; }
.gantt-row.head { position: sticky; top: 0; background: var(--panel); z-index: 2;
  font-size: var(--fs-sm); font-weight: 400; color: var(--text-secondary); }
.gantt-row.group { background: var(--panel-raised); font-weight: 600; font-size: var(--fs-sm); }
.gantt-label { padding: 4px 10px; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--divider); cursor: default; }
.gantt-label a { color: inherit; text-decoration: none; }
.gantt-label a:hover { color: var(--accent-strong); }
.gantt-days { position: relative; display: grid; }
.gantt-daycell { border-right: 1px solid var(--divider); font-size: var(--fs-xs); text-align: center; padding: 4px 0; }
.gantt-daycell.off { background: var(--weekend-shade); }
.gantt-daycell.today { box-shadow: inset 0 0 0 1px var(--accent); }
.gantt-bar { position: absolute; top: 4px; height: 16px; border-radius: 4px;
  background: var(--gantt-bar); opacity: .92; cursor: pointer; min-width: 3px; }
.gantt-bar.ok { background: var(--ok-solid); }
.gantt-bar.warn { background: var(--warn-solid); }
.gantt-bar.late { background: var(--crit-solid); }
.gantt-bar.done { background: var(--stone-350); }
.gantt-bar:hover { opacity: 1; box-shadow: 0 0 0 2px var(--accent-soft); }

/* ── Capacity heat map ─────────────────────────────────────────────────── */
table.rcc { border-collapse: collapse; background: var(--panel); border: 1px solid var(--divider); }
table.rcc th { font-size: var(--fs-md); font-weight: 400;
  color: var(--text-secondary); background: var(--panel);
  height: var(--row-h); padding: 0 var(--sp-2);
  border-bottom: 1px solid var(--divider); border-right: 1px solid var(--divider);
  position: sticky; top: 0; }
table.rcc td { padding: 4px 8px; border-bottom: 1px solid var(--divider);
  border-right: 1px solid var(--divider); font-size: var(--fs-sm);
  text-align: right; font-variant-numeric: tabular-nums; min-width: 52px; }
table.rcc th:last-child, table.rcc td:last-child { border-right: none; }
table.rcc td.eq { text-align: left; white-space: nowrap; }
table.rcc tr.wc-row td { background: var(--panel-raised); font-weight: 600; }
td.heat-0    { color: var(--text-tertiary); }
td.heat-ok   { background: var(--ok-bg);   color: var(--ok-fg); }
td.heat-warn { background: var(--warn-bg); color: var(--warn-fg); }
td.heat-hot  { background: var(--hot-bg);  color: var(--hot-fg); font-weight: 700; }
td.heat-crit { background: var(--crit-bg); color: var(--crit-fg); font-weight: 700; }
td.heat-off  { background: var(--weekend-shade); color: var(--text-tertiary); }

/* ── Dashboard ─────────────────────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--sp-4); }
.dash-card { background: var(--panel); border: 1px solid var(--divider); border-radius: var(--radius); padding: var(--sp-4); }
.dash-card h3 { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.dash-big { font-size: 30px; font-weight: 600; }
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li { padding: 5px 0; border-bottom: 1px solid var(--divider); font-size: var(--fs-sm);
  display: flex; justify-content: space-between; gap: var(--sp-2); }
.dash-list li:last-child { border-bottom: none; }
.dash-empty { color: var(--text-tertiary); font-size: var(--fs-sm); }

/* ── Sales Orders ──────────────────────────────────────────────────────── */
.so-toolbar { display: flex; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-3); flex-wrap: wrap; }
.so-linked { color: var(--ok-fg); font-weight: 600; }

/* ── Settings-specific ─────────────────────────────────────────────────── */
.settings-grid td input.num { width: 62px; }
.settings-actions {
  position: sticky; bottom: 0;
  background: var(--bg);
  padding: var(--sp-3) 0;
  display: flex; gap: var(--sp-2); align-items: center;
}
.cal-preview td { font-size: var(--fs-sm); }
.cal-preview .nonwork td { color: var(--text-tertiary); background: var(--weekend-shade); }
