/* ============================================================
   O'Shaughnessy Painting OS — design system
   Brand taken from oshaughnessypainting.com: deep red #AD0C10,
   charcoal #3B3839, off-white #EEECEC, condensed gothic wordmark.
   Sales demonstration only — synthetic data, no backend.
   ============================================================ */

/* ---------- fonts (vendored, no CDN) ---------- */
@font-face {
  font-family: "Outfit";
  src: url("./fonts/outfit-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Oswald — condensed gothic, chosen to echo the O'SHAUGHNESSY wordmark */
@font-face {
  font-family: "Oswald";
  src: url("./fonts/oswald-var.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  /* brand */
  --char: #1C1A1A;          /* rail / deepest ink */
  --char-soft: #302C2C;
  --char-70: #57504E;
  --bone: #EEECEC;          /* their off-white — the app canvas */
  --bone-2: #E6E3E3;
  --paper: #ffffff;
  --stone: #DAD6D6;
  --stone-2: #E9E6E6;
  --brand: #AD0C10;         /* their red — the one accent */
  --brand-deep: #8A0A0D;
  --brand-lite: #C81E23;    /* the red in the logo ring */
  --brand-soft: #FBE9E9;

  /* semantic */
  --ink: #1A1717;
  --ink-2: #55504F;
  --ink-3: #837C7B;
  --line: #DEDADA;
  --line-strong: #C9C4C4;
  --info: #2B5F8A;
  --info-soft: #E6EEF5;
  --success: #2E7D4A;
  --success-soft: #E7F2EA;
  --warn: #C8861A;          /* amber = soon / needs attention */
  --warn-soft: #FBF1DC;
  --danger: #AD0C10;        /* urgent shares the brand red, by design */
  --danger-soft: #FBE9E9;

  /* surfaces */
  --bg: var(--bone);
  --surface: var(--paper);
  --surface-2: #F7F6F6;
  --surface-sink: #EFEDED;

  /* type */
  --font: "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Oswald", "Outfit", ui-sans-serif, sans-serif;

  /* radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* elevation */
  --sh-xs: 0 1px 2px #1C1A1A12;
  --sh-sm: 0 2px 6px #1C1A1A14, 0 1px 2px #1C1A1A0a;
  --sh-md: 0 8px 22px #1C1A1A14, 0 2px 6px #1C1A1A0d;
  --sh-lg: 0 20px 46px #1C1A1A1f, 0 6px 12px #1C1A1A10;
  --stamp: 4px 4px 0 var(--char);
  --stamp-brand: 4px 4px 0 var(--brand);

  --rail-w: 68px;
  --side-w: 244px;
  --top-h: 60px;
  --dur: .18s;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--brand); color: #fff; }
img { max-width: 100%; display: block; }
svg { width: 1.1em; height: 1.1em; flex: none; } /* sane default; components override below */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* the condensed display accent — echoes the wordmark, never all-caps by CSS */
.display { font-family: var(--display); font-weight: 600; color: var(--brand); letter-spacing: .005em; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #CFCACA; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #B9B3B3; background-clip: content-box; }

/* ============================================================
   App shell
   ============================================================ */
.app { display: grid; grid-template-columns: var(--rail-w) var(--side-w) 1fr; height: 100vh; overflow: hidden; }
#rail, #sideMount { display: contents; }
#topMount { flex: none; }

/* icon rail */
.rail {
  background: var(--char);
  color: #C6C0C0;
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0 14px; gap: 4px;
  position: relative; z-index: 30;
}
.rail-logo { width: 44px; height: 44px; margin-bottom: 10px; display: grid; place-items: center; }
.rail-logo img { width: 44px; height: auto; }
.rail-nav { display: flex; flex-direction: column; gap: 3px; width: 100%; align-items: center; flex: 1; overflow-y: auto; }
.rail-nav::-webkit-scrollbar { width: 0; }
.rail-btn {
  width: 46px; height: 46px; border: none; background: transparent; color: #ADA6A6;
  border-radius: 12px; display: grid; place-items: center; position: relative;
  transition: background var(--dur), color var(--dur);
}
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn:hover { background: #2A2626; color: var(--bone); }
.rail-btn.active { background: #322D2D; color: #fff; }
.rail-btn.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; background: var(--brand-lite); border-radius: 0 4px 4px 0;
}
.rail-btn .tip {
  position: absolute; left: 56px; top: 50%; transform: translateY(-50%) translateX(-6px);
  background: var(--char); color: var(--bone); padding: 6px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity var(--dur), transform var(--dur); box-shadow: var(--sh-md);
  z-index: 50;
}
.rail-btn:hover .tip { opacity: 1; transform: translateY(-50%) translateX(0); }
.rail-foot { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.rail-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 2px solid #3A3434; }

/* contextual sidebar */
.side {
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
}
.side-head { padding: 16px 16px 10px; }
.side-head .brand-mark { height: 34px; width: auto; }
.side-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 8px; }
.side-scroll { flex: 1; overflow-y: auto; padding: 6px 10px 14px; }
.side-group { margin-top: 14px; }
.side-group-label { font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 4px 10px; }
.side-link {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 9px; border: none; background: transparent; color: var(--ink-2);
  font-size: 13.5px; font-weight: 600; transition: background var(--dur), color var(--dur); position: relative;
}
.side-link svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.side-link:hover { background: var(--stone-2); color: var(--ink); }
.side-link.active { background: var(--paper); color: var(--ink); box-shadow: var(--sh-xs); }
.side-link.active svg { color: var(--brand); }
.side-link .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--stone); color: var(--char-soft);
  border-radius: 999px; padding: 1px 8px; min-width: 20px; text-align: center; }
.side-link.active .count { background: var(--brand); color: #fff; }
.side-foot { padding: 12px 14px; border-top: 1px solid var(--line); }
.side-card { background: linear-gradient(140deg, var(--char), var(--char-soft)); color: var(--bone); border-radius: var(--r-md); padding: 13px; box-shadow: var(--sh-sm); }
.side-card h5 { color: #fff; font-size: 13px; margin-bottom: 3px; }
.side-card p { font-size: 11.5px; color: #B7B0B0; line-height: 1.4; }
.side-card .bar { height: 6px; border-radius: 999px; background: #3D3737; margin-top: 9px; overflow: hidden; }
.side-card .bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-lite)); }

/* main */
.main { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.topbar {
  height: var(--top-h); flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 22px; border-bottom: 1px solid var(--line); background: #F7F6F6cc; backdrop-filter: blur(8px);
}
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.crumbs b { color: var(--ink); }
.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 9px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--ink-3);
  transition: border var(--dur), box-shadow var(--dur);
}
.search:hover { border-color: var(--line-strong); }
.search svg { width: 16px; height: 16px; }
.search input { border: none; background: transparent; outline: none; flex: 1; font-size: 13px; color: var(--ink); font-family: inherit; }
.search kbd { font-size: 10.5px; font-weight: 700; background: var(--surface-sink); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--ink-3); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.weather-chip { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 6px 11px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.weather-chip svg { width: 16px; height: 16px; color: var(--info); }
.weather-chip b { color: var(--ink); }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  display: grid; place-items: center; position: relative; transition: background var(--dur), border var(--dur); }
.icon-btn:hover { background: var(--surface-sink); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); border: 2px solid var(--paper); }

.workspace { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 24px 26px 60px; }

/* page header */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 12px; font-weight: 700; color: var(--brand); }
.page-head h1 { font-size: 27px; margin-top: 3px; }
.page-head h1 .display { font-size: 30px; }
.page-head .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; max-width: 660px; }
.page-head .ph-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ============================================================
   Components
   ============================================================ */
/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 9px 15px; font-size: 13px; font-weight: 700; transition: transform var(--dur), box-shadow var(--dur), background var(--dur); white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--char); color: var(--bone); box-shadow: var(--stamp-brand); }
.btn-primary:hover { background: #262121; }
.btn-brand { background: var(--brand); color: #fff; box-shadow: var(--stamp); }
.btn-brand:hover { background: var(--brand-lite); }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--sh-xs); }
.btn-ghost:hover { background: var(--surface-sink); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--stone-2); color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: var(--r-xs); }
.btn-block { width: 100%; justify-content: center; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-sm); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15px; }
.card-head .sub { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.card-head .head-act { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 17px; position: relative; box-shadow: var(--sh-sm); overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); }
.stat.st-brand::after { background: var(--brand); }
.stat.st-green::after { background: var(--success); }
.stat.st-char::after  { background: var(--char); }
.stat.st-info::after  { background: var(--info); }
.stat .st-label { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.stat .st-val { font-size: 27px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; color: var(--ink); }
.stat .st-val small { font-size: 15px; font-weight: 700; color: var(--ink-3); }
.stat .st-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; padding: 1px 6px; border-radius: 999px; font-size: 11.5px; }
.trend.tr-up { color: var(--success); background: var(--success-soft); }
.trend.tr-down { color: var(--danger); background: var(--danger-soft); }
.trend svg { width: 12px; height: 12px; }

/* badges / chips */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 10px; letter-spacing: .01em; }
.badge svg { width: 12px; height: 12px; }
.b-warn  { background: var(--warn-soft); color: #96650F; }
.b-brand { background: var(--brand-soft); color: var(--brand); }
.b-green { background: var(--success-soft); color: var(--success); }
.b-info  { background: var(--info-soft); color: var(--info); }
.b-char  { background: var(--stone-2); color: var(--char-soft); }
.b-stone { background: var(--stone); color: var(--char-70); }
.b-solid { background: var(--brand); color: #fff; }
.dotb { width: 7px; height: 7px; border-radius: 50%; }

.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; color: var(--ink-2); transition: all var(--dur); cursor: pointer; }
.chip:hover { border-color: var(--line-strong); }
.chip.active { background: var(--char); color: var(--bone); border-color: var(--char); }
.chip.active svg { color: var(--brand-lite); }
.chip .ct { font-weight: 700; color: var(--ink-3); }
.chip.active .ct { color: #C6C0C0; }
.chip svg { width: 14px; height: 14px; }

/* avatars */
.av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: #fff; flex: none; background: var(--char-soft); }
.av.sm { width: 26px; height: 26px; font-size: 10.5px; }
.av.lg { width: 46px; height: 46px; font-size: 16px; }
.av-stack { display: flex; }
.av-stack .av { border: 2px solid var(--surface); margin-left: -8px; }
.av-stack .av:first-child { margin-left: 0; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.table tbody tr { transition: background var(--dur); cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.cell-main { font-weight: 700; color: var(--ink); }
.cell-sub { font-size: 11.5px; color: var(--ink-3); }

/* segmented control + tabs */
.seg { display: inline-flex; background: var(--surface-sink); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 6px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); transition: all var(--dur); }
.seg button.active { background: var(--paper); color: var(--ink); box-shadow: var(--sh-xs); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: none; background: transparent; padding: 11px 4px; margin-right: 18px; font-size: 13.5px; font-weight: 700; color: var(--ink-3); border-bottom: 2px solid transparent; transition: color var(--dur), border var(--dur); white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--brand); }

/* progress */
.prog { height: 8px; background: var(--surface-sink); border-radius: 999px; overflow: hidden; }
.prog > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-deep), var(--brand-lite)); border-radius: 999px; transition: width .5s var(--ease); }

/* timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px 4px; }
.tl-item::before { content: ""; position: absolute; left: -21px; top: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 2px solid var(--line-strong); }
.tl-item.tl-done::before { background: var(--success); border-color: var(--success); }
.tl-item.tl-now::before { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.tl-item .tl-time { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.tl-item .tl-title { font-size: 13px; font-weight: 700; }
.tl-item .tl-body { font-size: 12.5px; color: var(--ink-2); }

/* ============================================================
   Pipeline (kanban)
   ============================================================ */
.pipe { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.pipe-col { flex: 0 0 268px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.pipe-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 13px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface-2); border-radius: var(--r-md) var(--r-md) 0 0; z-index: 2; }
.pipe-col-head .pc-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pipe-col-head h4 { font-size: 13px; }
.pipe-col-head .pc-count { font-size: 11px; font-weight: 700; color: var(--ink-3); background: var(--stone); border-radius: 999px; padding: 1px 8px; }
.pipe-col-head .pc-sum { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.bolt { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; color: var(--brand); transition: all var(--dur); flex: none; }
.bolt:hover { background: var(--brand); color: #fff; border-color: var(--brand-deep); box-shadow: 2px 2px 0 var(--char); }
.bolt svg { width: 14px; height: 14px; }
.pipe-col-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.deal { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; box-shadow: var(--sh-xs); cursor: pointer; transition: transform var(--dur), box-shadow var(--dur), border var(--dur); }
.deal:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--line-strong); }
.deal .d-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deal .d-cust { font-weight: 700; font-size: 13px; }
.deal .d-svc { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.deal .d-val { font-weight: 800; font-size: 14px; letter-spacing: -.02em; }
.deal .d-foot { display: flex; align-items: center; gap: 7px; margin-top: 10px; }
.deal .d-foot .av { width: 22px; height: 22px; font-size: 9.5px; }
.deal .d-tag { margin-left: auto; }

/* ============================================================
   Cabinet batch board — the one component only this business needs
   ============================================================ */
.batch { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-sm); overflow: hidden; margin-bottom: 14px; }
.batch-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.batch-head .bh-id { font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--brand); letter-spacing: .01em; }
.batch-head .bh-who { font-weight: 700; font-size: 14px; }
.batch-head .bh-sub { font-size: 12px; color: var(--ink-3); }
.batch-head .bh-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.batch-count { display: flex; align-items: baseline; gap: 4px; background: var(--surface-sink); border-radius: 8px; padding: 5px 10px; }
.batch-count b { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.batch-count span { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

/* the travel line: off → prep → prime → coat 1 → coat 2 → cure → back on */
.btrack { display: flex; align-items: stretch; padding: 16px; gap: 0; overflow-x: auto; }
.bstop { flex: 1 1 0; min-width: 92px; position: relative; padding: 0 6px; text-align: center; }
.bstop .bs-dot {
  width: 15px; height: 15px; border-radius: 50%; margin: 0 auto 9px;
  background: var(--paper); border: 2px solid var(--line-strong); position: relative; z-index: 2;
}
.bstop .bs-rail { position: absolute; top: 6px; left: 0; right: 0; height: 3px; background: var(--line); z-index: 1; }
.bstop:first-child .bs-rail { left: 50%; }
.bstop:last-child .bs-rail { right: 50%; }
.bstop .bs-name { font-size: 11.5px; font-weight: 700; color: var(--ink-3); line-height: 1.25; }
.bstop .bs-when { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }
.bstop.bs-done .bs-dot { background: var(--success); border-color: var(--success); }
.bstop.bs-done .bs-rail { background: var(--success); }
.bstop.bs-done .bs-name { color: var(--ink-2); }
.bstop.bs-here .bs-dot { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.bstop.bs-here .bs-name { color: var(--brand); }
.bstop.bs-here .bs-rail { background: linear-gradient(90deg, var(--success) 50%, var(--line) 50%); }
/* the first stop's rail starts AT the dot, so a left-half gradient would paint
   progress that has not happened. Nothing precedes it — keep it grey. */
.bstop:first-child.bs-here .bs-rail { background: var(--line); }

/* the recoat / cure clock — the reason a 38-door kitchen takes a week */
.bwindow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface-2); border-top: 1px solid var(--line); flex-wrap: wrap; }
.bwindow .bw-label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.bwindow .bw-bar { flex: 1; min-width: 160px; height: 10px; border-radius: 999px; background: var(--stone); overflow: hidden; display: flex; }
.bwindow .bw-bar i { display: block; height: 100%; background: var(--brand); }
.bwindow .bw-ready { font-size: 12px; font-weight: 700; color: var(--ink); }
.bwindow .bw-note { font-size: 12px; color: var(--ink-2); flex-basis: 100%; }

/* ============================================================
   Weather / paint window strip
   ============================================================ */
.wx { display: flex; gap: 6px; overflow-x: auto; }
.wx-day { flex: 1 1 0; min-width: 62px; text-align: center; padding: 10px 4px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; }
.wx-day.wx-no { background: var(--danger-soft); border-color: #F0CFCF; }
.wx-day .wx-d { font-size: 11px; font-weight: 700; }
.wx-day .wx-ic { display: grid; place-items: center; height: 26px; color: var(--ink-3); }
.wx-day.wx-no .wx-ic { color: var(--brand); }
.wx-day .wx-t { font-size: 13px; font-weight: 700; }
.wx-day .wx-p { font-size: 10.5px; color: var(--info); font-weight: 600; }
.wx-day .wx-flag { font-size: 10px; font-weight: 800; color: var(--brand); margin-top: 3px; }
.wx-day .wx-ok { font-size: 10px; font-weight: 700; color: var(--success); margin-top: 3px; }

/* ============================================================
   Agent bench — a path into a wall, never a card
   ============================================================ */
.bench { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-sm); padding: 14px 16px; margin-bottom: 12px; display: grid; grid-template-columns: 200px 1fr 250px; gap: 18px; align-items: center; }
.bench-who .bw-name { font-weight: 700; font-size: 14px; }
.bench-who .bw-meta { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.bench-who .bw-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; margin-bottom: 8px; }
.bench-who .bw-ic svg { width: 18px; height: 18px; }
.bench-path { display: flex; align-items: center; gap: 8px; }
.bench-path .bp-step { flex: 1; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; min-width: 0; }
.bench-path .bp-k { font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.bench-path .bp-v { font-size: 12px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.bench-path .bp-step.bp-out { background: var(--brand-soft); border-color: #F0CFCF; }
.bench-path .bp-step.bp-out .bp-v { color: var(--brand-deep); }
.bench-path .bp-arrow { color: var(--ink-3); flex: none; }
.bench-path .bp-arrow svg { width: 16px; height: 16px; }
.bench-wall { position: relative; padding-left: 20px; }
.bench-wall::before {
  content: ""; position: absolute; left: 0; top: -6px; bottom: -6px; width: 9px; border-radius: 2px;
  background: repeating-linear-gradient(45deg, var(--char) 0 3px, #6B6363 3px 6px);
}
.bench-wall .bwl-k { font-size: 10.5px; font-weight: 700; color: var(--char); }
.bench-wall .bwl-list { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.bench-wall .bwl-wait { font-size: 11.5px; font-weight: 700; color: var(--brand); margin-top: 5px; }

/* ============================================================
   Service-area map (hand-drawn SVG — no WebGL, no tiles)
   ============================================================ */
.terr { width: 100%; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: #F2F0F0; }
.terr svg { width: 100%; height: auto; }
.terr-town { font: 600 9px var(--font); fill: var(--ink-2); }
.terr-town-id { fill: var(--ink-3); }
.terr-ring { font: 700 8px var(--font); fill: var(--ink-3); }
.terr-state { font: 700 9px var(--font); fill: var(--ink-3); letter-spacing: .04em; }

/* ============================================================
   Drawer + modal + toast
   ============================================================ */
.scrim { position: fixed; inset: 0; background: #1C1A1A55; backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity var(--dur); z-index: 60; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 560px; max-width: 94vw; background: var(--bg); box-shadow: var(--sh-lg); transform: translateX(100%); transition: transform .28s var(--ease); z-index: 70; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: flex-start; gap: 12px; }
.drawer-head .dh-close { margin-left: auto; }
.drawer-head .eyebrow { font-size: 12px; font-weight: 700; color: var(--brand); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 10px; align-items: center; }

.modal-wrap { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; z-index: 80; opacity: 0; pointer-events: none; transition: opacity var(--dur); }
.modal-wrap.open { opacity: 1; pointer-events: auto; }
.modal { background: var(--bg); border-radius: var(--r-lg); box-shadow: var(--sh-lg); width: 100%; max-width: 560px; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; transform: translateY(10px) scale(.98); transition: transform var(--dur); }
.modal-wrap.open .modal { transform: translateY(0) scale(1); }
.modal-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }

.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.toast { display: flex; align-items: center; gap: 11px; background: var(--char); color: var(--bone); padding: 12px 15px; border-radius: var(--r-sm); box-shadow: var(--sh-lg); min-width: 280px; max-width: 380px; transform: translateX(20px); opacity: 0; animation: toastIn .3s var(--ease) forwards; border-left: 4px solid var(--brand); }
.toast.t-ok { border-left-color: var(--success); }
.toast.t-warn { border-left-color: var(--warn); }
.toast .t-icn { width: 30px; height: 30px; border-radius: 8px; background: #322D2D; display: grid; place-items: center; color: var(--brand-lite); flex: none; }
.toast .t-icn svg { width: 16px; height: 16px; }
.toast .t-title { font-weight: 700; font-size: 13px; color: #fff; }
.toast .t-body { font-size: 12px; color: #B7B0B0; }
@keyframes toastIn { to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 9px 11px; font-size: 13px; font-family: inherit; background: var(--paper); color: var(--ink); transition: border var(--dur), box-shadow var(--dur); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px #AD0C1026; }
.field textarea { resize: vertical; min-height: 74px; }
.field .hint { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* toggle */
.switch { position: relative; width: 40px; height: 23px; border-radius: 999px; background: var(--line-strong); border: none; transition: background var(--dur); flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: var(--sh-xs); transition: transform var(--dur); }
.switch.on { background: var(--success); }
.switch.on::after { transform: translateX(17px); }

/* misc layout helpers */
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vcenter { display: flex; align-items: center; gap: 10px; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.wrap-g { flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; }
.muted { color: var(--ink-3); }
.muted2 { color: var(--ink-2); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.strong { font-weight: 700; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hide { display: none !important; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* empty state — namespaced so it can never land on a component as a bare word */
.is-empty { text-align: center; padding: 46px 20px; color: var(--ink-3); }
.is-empty svg { width: 40px; height: 40px; color: var(--line-strong); margin-bottom: 10px; }
.is-empty h4 { color: var(--ink-2); font-size: 15px; }

/* AI / agent surfaces — a quiet panel with a brand hairline, not a gradient */
.ai-surface { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--sh-sm); position: relative; overflow: hidden; }
.ai-surface::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand); }
.ai-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800; color: var(--brand); }
.ai-tag svg { width: 13px; height: 13px; }
.agent-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.agent-ic svg { width: 20px; height: 20px; }
.side-card h5 svg, .card-head h3 svg { width: 1em; height: 1em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.s-live { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.s-idle { background: var(--ink-3); }
.s-wait { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* inbox — selected thread row */
.th-on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--brand); }

/* risk row (money on the table) */
.risk { border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); padding: 13px 14px; margin-top: 10px; }
.risk .rk-title { font-weight: 700; color: var(--ink); }
.risk .rk-amt { color: var(--brand); font-weight: 800; }
.risk .rk-meta { font-size: 11px; color: var(--ink-3); }
.risk .rk-why { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.risk .rk-rec { display: flex; align-items: flex-start; gap: 7px; margin-top: 12px; font-size: 12.5px; }
.risk .rk-rec b { color: var(--ink); }

/* ============================================================
   Customer shell — a second application, not a staff route.
   Own rail, own signed-in person, its own surface tint, and no
   staff destination reachable from inside it.
   ============================================================ */
.app.is-portal { grid-template-columns: var(--side-w) 1fr; background: #F3F1EF; }
.prail {
  background: var(--paper); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
}
.prail-head { padding: 20px 18px 14px; border-bottom: 1px solid var(--line); }
.prail-head img { height: 34px; width: auto; }
.prail-head .ph-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 10px; }
.prail-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.prail-link {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 9px; border: none; background: transparent; color: var(--ink-2);
  font-size: 14px; font-weight: 600; transition: background var(--dur), color var(--dur);
}
.prail-link svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.prail-link:hover { background: var(--surface-sink); color: var(--ink); }
.prail-link.active { background: var(--brand-soft); color: var(--brand-deep); }
.prail-link.active svg { color: var(--brand); }
.prail-foot { padding: 14px 16px; border-top: 1px solid var(--line); }
.prail-foot .pf-who { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.prail-foot .pf-who .pf-name { font-size: 13px; font-weight: 700; }
.prail-foot .pf-who .pf-role { font-size: 11px; color: var(--ink-3); }
.ptop {
  height: var(--top-h); flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; border-bottom: 1px solid var(--line); background: #FBFAF9;
}
.ptop .pt-title { font-size: 13.5px; font-weight: 700; }
.ptop .pt-sub { font-size: 12px; color: var(--ink-3); }
.ptop .pt-back { margin-left: auto; }

@media (max-width: 760px) {
  .app.is-portal { grid-template-columns: 1fr; }
  .prail { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); z-index: 40; transform: translateX(-115%); transition: transform var(--dur); }
  .prail.open { transform: translateX(0); box-shadow: var(--sh-lg); }
  .ptop { padding: 0 14px; }
}

/* portal (external customer view) */
.portal-hero { background: linear-gradient(135deg, var(--char), #2C2626); color: var(--bone); border-radius: var(--r-lg); padding: 26px; position: relative; overflow: hidden; }
.portal-hero .display { color: #fff; }
.portal-hero::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, #AD0C1044, transparent 70%); }

/* demonstration banner */
.demo-bar { display: flex; align-items: center; gap: 10px; background: var(--stone-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 16px; font-size: 12px; color: var(--ink-2); }
.demo-bar b { color: var(--ink); }
.demo-bar svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; }

/* responsive */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .bench { grid-template-columns: 1fr; gap: 12px; }
  .bench-wall { padding-left: 20px; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: var(--rail-w) 1fr; }
  .side { position: fixed; left: var(--rail-w); top: 0; bottom: 0; width: var(--side-w); z-index: 40; transform: translateX(-115%); transition: transform var(--dur); }
  .side.open { transform: translateX(0); box-shadow: var(--sh-lg); }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
}
@media (max-width: 640px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; bottom: 0; left: 0; right: 0; top: auto; flex-direction: row; height: 58px; width: 100%; padding: 0 10px; z-index: 50; justify-content: space-around; }
  .rail-logo, .rail-foot { display: none; }
  .rail-nav { flex-direction: row; overflow-x: auto; }
  .rail-btn.active::before { left: 50%; top: auto; bottom: 0; transform: translateX(-50%); width: 22px; height: 3px; border-radius: 3px 3px 0 0; }
  .side { left: 0; }
  .main { padding-bottom: 58px; }
  .stats { grid-template-columns: 1fr; }
  .wrap { padding: 16px 14px 80px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .search { display: none; }
  /* at 390px the crumb trail, the forecast chip, the bell and the avatar do not
     all fit. Keep the page name and the bell; the forecast has its own card. */
  .weather-chip { display: none; }
  .crumbs { min-width: 0; overflow: hidden; white-space: nowrap; }
  .crumbs .cr-fam, .crumbs .cr-sep { display: none; }
  .topbar .rail-avatar { display: none; }
  .page-head h1 { font-size: 22px; }
  .btrack { padding: 12px 8px; }
  .bstop { min-width: 78px; }
  .mobile-menu { display: grid !important; }
}
.mobile-menu { display: none; }
