/* ===========================================================================
   OPERA · Operations dashboard
   Modern design system — refined light + dark, toggled via html[data-theme].
   All class names match dashboard.blade.php; logic is untouched.
   =========================================================================== */

:root {
  /* Light theme — "Slate & Teal" (luxury-minimal, productivity-tuned) */
  --primary: #0E6E66;
  --primary-strong: #0A554E;
  --primary-contrast: #ffffff;
  --primary-tint: rgba(14, 110, 102, 0.10);
  --ring: rgba(14, 110, 102, 0.28);

  --bg: #EEF3F3;
  --bg-accent-1: rgba(14, 110, 102, 0.06);
  --bg-accent-2: rgba(14, 110, 102, 0.04);

  --surface: #ffffff;
  --surface-2: #F4F8F7;
  --surface-hover: #EAF1F0;
  --surface-translucent: rgba(255, 255, 255, 0.72);

  --text: #10201F;
  --text-soft: #33474A;
  --muted: #61727A;

  --border: #DFE7E7;
  --border-strong: #CBD8D8;

  --danger: #B23B3B;
  --danger-tint: #f7e9e8;
  --success: #2E7D5B;
  --success-tint: #e6f2ec;
  --warning: #B5792B;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, 0.22);

  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 18px;

  --r: 22, 99, 235; /* primary as rgb for composing */
}

html[data-theme="dark"] {
  /* Dark — "Slate & Teal" */
  --primary: #3FB9AD;
  --primary-strong: #5FCABE;
  --primary-contrast: #06201E;
  --primary-tint: rgba(63, 185, 173, 0.16);
  --ring: rgba(63, 185, 173, 0.40);

  --bg: #0A1413;
  --bg-accent-1: rgba(63, 185, 173, 0.10);
  --bg-accent-2: rgba(63, 185, 173, 0.06);

  --surface: #11201E;
  --surface-2: #0E1B19;
  --surface-hover: #182A27;
  --surface-translucent: rgba(17, 32, 30, 0.72);

  --text: #E6EDEC;
  --text-soft: #C2D0CD;
  --muted: #8DA09D;

  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --danger: #E08585;
  --danger-tint: rgba(224, 133, 133, 0.14);
  --success: #5FC394;
  --success-tint: rgba(95, 195, 148, 0.14);
  --warning: #D9A65A;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 50px -12px rgba(0, 0, 0, 0.65);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at 100% -5%, var(--bg-accent-1), transparent 60%),
    radial-gradient(800px 500px at -5% 105%, var(--bg-accent-2), transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
[x-cloak] { display: none !important; }
::selection { background: var(--primary-tint); }

/* Subtle, themed scrollbars */
* { scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { height: 10px; width: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* --- Typography helpers --- */
/* Minimal wordmark — solid, letter-spaced caps */
.brand {
  font-size: 30px; font-weight: 700; letter-spacing: 6px; text-align: center;
  color: var(--primary); padding-left: 6px; /* optical balance for tracking */
}
/* Login screen gets a centered ring+node mark above the wordmark */
.login-mark { display: flex; justify-content: center; margin-bottom: 14px; }
.tagline { color: var(--muted); text-align: center; margin: 6px 0 26px; font-size: 13px; }
.muted { color: var(--muted); }

/* --- Forms --- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin: 14px 0 6px; }
input, select {
  width: 100%; height: 44px; padding: 0 13px; font-size: 14.5px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  appearance: none;
}
input::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover { border-color: var(--border-strong); }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 18px; border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; white-space: nowrap;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: var(--primary-contrast); box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease, background .15s ease;
}
.btn:hover { filter: brightness(1.05); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .55; cursor: default; transform: none; filter: none; box-shadow: none; }
.btn.full { width: 100%; }
.btn.sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn.ghost {
  background: var(--surface); color: var(--text-soft);
  border: 1px solid var(--border); box-shadow: none;
}
.btn.ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); filter: none; }
.btn.danger { background: linear-gradient(135deg, var(--danger), var(--danger)); color: #fff; }
.btn.danger-text { color: var(--danger); }
.btn.danger-text:hover { border-color: var(--danger); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 16px;
  background: var(--surface-2); color: var(--text-soft);
  border: 1px solid var(--border); transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.link { color: var(--primary); cursor: pointer; font-weight: 600; background: none; border: none; font-size: 13px; font-family: inherit; }
.link:hover { color: var(--primary-strong); text-decoration: underline; }
.err { color: var(--danger); margin-top: 10px; font-size: 13px; }
.switch-link { text-align: center; margin: 20px 0 0; font-size: 13px; }

/* --- Login --- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; }
.login-theme { position: fixed; top: 18px; right: 18px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 36px 32px; width: 100%; max-width: 390px; box-shadow: var(--shadow-lg);
}

/* --- App shell / topbar --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-translucent);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border); padding: 11px 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .row { gap: 22px; }
.topbar .brand {
  font-size: 19px; letter-spacing: 3px; margin: 0; display: inline-flex; align-items: center; gap: 10px;
}
.topbar .brand .mark { flex: none; display: block; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 8px 14px; border-radius: 9px; cursor: pointer; color: var(--muted);
  font-weight: 600; font-size: 13.5px; transition: background .15s ease, color .15s ease;
}
.tab:hover { background: var(--surface-hover); color: var(--text-soft); }
.tab.active { background: var(--primary-tint); color: var(--primary); }
.who { color: var(--muted); font-size: 13px; }
/* Fluid up to a generous ceiling — the board/stats grids below are already
   1fr-based, so they stretch to fill whatever width main gives them. Capped
   rather than unbounded so content doesn't stretch into unreadably long rows
   on ultrawide/4K displays. */
main { padding: 24px 22px 40px; max-width: 2200px; width: 100%; margin: 0 auto; box-sizing: border-box; }

/* --- Pipeline board --- */
.board-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; }
.ops-scope-toggle select { width: auto; height: 34px; padding: 0 30px 0 12px; font-size: 13px; }
.pipeline-range { display: flex; align-items: center; gap: 8px; }
.pipeline-range select.range-preset { width: auto; height: 34px; padding: 0 30px 0 12px; font-size: 13px; }
.pipeline-range input[type="date"] { width: auto; height: 34px; padding: 0 10px; font-size: 13px; }
.pipeline-range .range-label { font-size: 12.5px; white-space: nowrap; }
.picked-client { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-weight: 600; }
.board-scroll { overflow-x: auto; padding-bottom: 6px; }
.pipeline-summary { display: grid; grid-template-columns: repeat(9, minmax(210px, 1fr)); gap: 16px; margin-bottom: 16px; }
.psum {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px 9px 14px; box-shadow: var(--shadow-sm); overflow: hidden;
}
.psum::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent, var(--primary)); opacity: .9;
}
.psum-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.psum-head .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.psum-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.psum-count { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.psum-value { font-size: 12.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 3px; }
.board { display: grid; grid-template-columns: repeat(9, minmax(210px, 1fr)); gap: 16px; }
.pipeline-summary.leads-board, .board.leads-board { grid-template-columns: repeat(6, minmax(210px, 1fr)); }
.ocard.lead-overdue::before { background: var(--danger); }
.lead-overdue-text { color: var(--danger) !important; font-weight: 700; }
.col { background: transparent; min-width: 0; border-radius: var(--radius-lg); transition: background .12s ease, box-shadow .12s ease; }
.col-drop-target { background: color-mix(in srgb, var(--primary) 7%, transparent); box-shadow: inset 0 0 0 2px var(--primary); }
.suggestions-panel { max-width: none; margin-bottom: 20px; }

/* --- Ops metrics row: every panel shares one fixed width/height (.metric-panel) so
   they read as one row of comparable KPIs; list-heavy panels scroll internally
   (.metric-body) rather than growing the card. --- */
.metrics-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; align-items: stretch; }
.panel.metric-panel {
  width: 260px; max-width: 260px; height: 300px; margin-bottom: 0;
  display: flex; flex-direction: column; text-align: center;
}
.metric-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.metric-head h3 { margin: 0; }
.metric-subhead { font-size: 11.5px; white-space: nowrap; }
.metric-body { flex: 1; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; min-height: 0; }
.metric-body.stage-list, .metric-body.leaderboard-list { justify-content: flex-start; }
.metric-caption { font-size: 11.5px; margin: 6px 0 0; }
.metric-hero { font-size: 34px; font-weight: 800; letter-spacing: -.5px; color: var(--text); }

/* Delivery-speed gauge (arc + needle) */
.gauge-svg { width: 100%; height: auto; margin-top: 6px; }
.gauge-arc { fill: none; stroke-width: 14; stroke-linecap: round; }
.gauge-arc-good { stroke: var(--success); }
.gauge-arc-warn { stroke: var(--warning); }
.gauge-arc-bad { stroke: var(--danger); }
.gauge-pivot { fill: var(--text-soft); }
.gauge-needle { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.gauge-readout { margin-top: -22px; }
.gauge-value { font-size: 30px; font-weight: 800; letter-spacing: -.5px; color: var(--text); }
.gauge-status { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-soft); margin-top: 2px; }
.gauge-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* Linear meter — same-ramp track, fill carries severity (accent → warning → danger) */
.meter-track { width: 100%; height: 8px; border-radius: 20px; background: var(--surface-2); overflow: hidden; margin-top: 14px; }
.meter-track.sm { height: 6px; margin-top: 4px; }
.meter-fill { height: 100%; border-radius: 20px; transition: width .3s ease; }

/* Exceptions & cancellations */
.fault-row { text-align: left; margin-top: 14px; }
.fault-row:first-child { margin-top: 4px; }
.fault-label { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }

/* Stage breakdown */
.stage-list { text-align: left; gap: 12px; margin-top: 4px; }
.stage-row-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--text-soft); gap: 8px; }
.stage-row-head span:last-child { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 700; }

/* Leaderboards */
.leaderboard-list { text-align: left; gap: 2px; margin-top: 4px; }
.leader-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.leader-row:last-child { border-bottom: none; }
.leader-rank { color: var(--muted); font-weight: 700; width: 16px; flex: none; }
.leader-name { flex: 1; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-value { font-weight: 700; color: var(--text-soft); font-variant-numeric: tabular-nums; flex: none; }
.suggestion-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.suggestion-row:first-of-type { border-top: none; padding-top: 0; }
.suggestion-row .muted { margin-left: 8px; font-size: 13px; }
.ocard {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 14px 13px 16px; margin-bottom: 11px;
  box-shadow: var(--shadow-sm); overflow: hidden; cursor: grab;
  display: flex; flex-direction: column; min-height: 104px;
  transition: transform .14s ease, box-shadow .16s ease, border-color .16s ease, opacity .12s ease;
}
.ocard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent, var(--primary)); opacity: .9;
}
.ocard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.ocard:active { cursor: grabbing; }
.ocard-dragging { opacity: .4; }
.ocard-held { opacity: .5; }
.ocard-nodrag, .ocard-nodrag:active { cursor: pointer; }
.ocard-undo {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  font-size: 13px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .12s ease, background .12s ease, border-color .12s ease;
}
.ocard:hover .ocard-undo { opacity: 1; }
.ocard-undo:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.ocard .total { font-weight: 800; font-variant-numeric: tabular-nums; }
.ocard .elapsed { font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.ocard-meta { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.ocard-name-row { padding-right: 22px; }
.ocard-client {
  display: block; width: 100%; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ocard-tags { margin-top: 5px; gap: 6px; min-height: 19px; flex-wrap: wrap; }
/* --- Badges & tags: every small colored label on a card (status badge, priority tag,
   transit tag, lead source tag, active/inactive pill) shares one type scale so they
   never look mismatched sitting next to each other. */
.badge, .priority-tag, .pickup-tag, .tag, .pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.pickup-tag {
  flex: none; display: inline-block; border-radius: 20px; padding: 2px 8px;
  color: var(--text-soft);
  background: var(--surface-hover); border: 1px solid var(--border);
}
.priority-tag {
  flex: none; display: inline-block; border-radius: 20px; padding: 2px 8px; color: #fff;
}
.modal-pipeline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.modal-pipeline-actions select { height: 34px; }

.badge {
  flex: none; display: inline-block; border-radius: 20px; padding: 3px 9px; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* Lead tags — same badge scale, but a chip that can carry a remove button (see .tag-chip button). */
.tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  border-radius: 20px; padding: 3px 6px 3px 10px; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.tag-chip button {
  border: none; background: rgba(255, 255, 255, 0.25); cursor: pointer; color: #fff;
  font-size: 10px; width: 15px; height: 15px; border-radius: 50%; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.tag-chip button:hover { background: rgba(255, 255, 255, 0.4); }

/* --- Map --- */
.map-side {
  margin-bottom: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 7px 14px; font-size: 13px; box-shadow: var(--shadow-sm);
}
.map-side span { color: var(--text); font-weight: 700; }
.map-legend { display: inline-flex; gap: 14px; margin-left: 10px; padding-left: 14px; border-left: 1px solid var(--border); }
.map-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.map-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.map-dot-driver { background: #0E8C82; }
.map-dot-sales_rep { background: #B5792B; }
.map-dot-operations { background: #6B5B95; }
#map { height: 72vh; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-md); }
.loc-picker-map { height: 320px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.loc-picker-search { margin-bottom: 10px; }
.loc-picker-search gmp-place-autocomplete { width: 100%; }
html[data-theme="dark"] .leaflet-tile { filter: brightness(0.85) invert(1) hue-rotate(180deg) saturate(0.7); }
html[data-theme="dark"] .leaflet-container { background: var(--surface-2); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.leaflet-tooltip { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.leaflet-tooltip-top:before { border-top-color: var(--border-strong); }
/* Team map marker — a plain colored dot (role color set inline) with a ring for contrast against tiles. */
.team-marker { background: transparent; border: none; }
.team-marker span {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* --- Reports --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); transition: transform .14s ease, box-shadow .16s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 5px; font-weight: 500; }

/* --- Users (admin) --- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; max-width: 660px; box-shadow: var(--shadow-sm);
}
.panel h3 { margin: 0 0 16px; font-size: 16px; font-weight: 700; }
.day-off-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.day-toggle {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 60px; padding: 8px 6px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.day-toggle:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.day-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.day-toggle-name { font-size: 13px; font-weight: 700; color: var(--text); }
.day-toggle-state { font-size: 10px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--success); }
.day-toggle.is-off { background: var(--danger-tint); border-color: var(--danger); }
.day-toggle.is-off .day-toggle-name { color: var(--danger); }
.day-toggle.is-off .day-toggle-state { color: var(--danger); }
.stage-toggle {
  padding: 7px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft);
  cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.stage-toggle:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.stage-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.stage-toggle.is-active { color: #fff; border-color: transparent; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { margin: 0 0 5px; }
.utable {
  width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.utable th, .utable td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.utable th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; background: var(--surface-2); }
.utable tbody tr { transition: background .12s ease; }
.utable tbody tr:hover { background: var(--surface-hover); }
.utable tr:last-child td { border-bottom: none; }
.clickable-row { cursor: pointer; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; }
.pill.active { background: var(--success-tint); color: var(--success); }
.pill.inactive { background: var(--danger-tint); color: var(--danger); }

/* --- Settings (sidebar-navigated hub) --- */
.settings-layout { display: flex; align-items: flex-start; gap: 24px; }
.settings-sidebar {
  flex: none; width: 210px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 90px;
}
.settings-nav-item {
  padding: 10px 14px; border-radius: 9px; cursor: pointer; color: var(--text-soft);
  font-weight: 600; font-size: 13.5px; transition: background .15s ease, color .15s ease;
}
.settings-nav-item:hover { background: var(--surface-hover); }
.settings-nav-item.active { background: var(--primary-tint); color: var(--primary); }
.settings-content { flex: 1; min-width: 0; }

/* --- Import (CSV) --- */
.import-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.import-grid .panel { max-width: none; }
.import-hint { font-size: 12.5px; line-height: 1.6; margin: 0 0 14px; }
.import-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; color: var(--text-soft);
}
input[type="file"] { width: 100%; height: auto; padding: 9px 12px; font-size: 13px; cursor: pointer; }
input[type="file"]::file-selector-button {
  font-family: inherit; font-weight: 600; font-size: 13px; margin-right: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft);
  border-radius: 8px; padding: 6px 12px;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-hover); }
.import-actions { margin-top: 14px; }
.import-result { margin: 14px 0 0; font-weight: 600; color: var(--success); font-size: 13.5px; }
.import-err { margin: 6px 0 0; color: var(--danger); font-size: 12.5px; }

/* one-off customer tag on the board */
.client { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); margin-top: 2px; }
.tag {
  color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent);
  border-radius: 5px; padding: 1px 5px;
}

.modal-team { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.team-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.team-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--text-soft); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 6px 3px 10px; text-transform: none; letter-spacing: normal;
}
.team-chip button {
  border: none; background: none; cursor: pointer; color: var(--muted); font-size: 11px;
  width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.team-chip button:hover { background: var(--border); color: var(--text); }

/* --- Modal (edit user, etc.) --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: overlay-in .16s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 520px; box-shadow: var(--shadow-lg);
  animation: modal-in .2s cubic-bezier(.16, 1, .3, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal { max-height: 88vh; overflow-y: auto; }
.modal textarea {
  width: 100%; padding: 10px 12px; font-family: inherit; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); resize: vertical;
}
.modal textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

/* --- Order editor --- */
.edit-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.edit-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.edit-line-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.edit-line-name { font-weight: 600; font-size: 13.5px; }
.edit-line-total { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.qty-input { width: 62px; height: 34px; padding: 0 4px; text-align: center; }
.prod-search { position: relative; }
.prod-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); max-height: 220px; overflow-y: auto;
}
.prod-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; cursor: pointer; font-size: 13.5px; }
.prod-opt:hover { background: var(--surface-hover); }
.custom-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.edit-foot { display: flex; justify-content: flex-end; margin-top: 14px; }
.edit-total { font-size: 14px; color: var(--muted); }
.edit-total strong { color: var(--text); font-size: 18px; font-weight: 800; margin-left: 6px; font-variant-numeric: tabular-nums; }

/* --- Layout helpers --- */
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* --- Toast --- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px;
  z-index: 50; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toast-in .25s cubic-bezier(.16, 1, .3, 1);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* --- Responsive --- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar .row { gap: 12px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 18px 14px 32px; }
  .settings-layout { flex-direction: column; }
  .settings-sidebar { width: 100%; flex-direction: row; overflow-x: auto; position: static; }
}
