/* ============================================================
   Burgan OS — design system
   Brand tokens pulled from burganhomeservice.com (coal/cream,
   gold + red, hard "stamp" offset shadow, Outfit + script).
   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;
}
@font-face {
  font-family: "Caveat";
  src: url("./fonts/caveat-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  /* brand */
  --coal: #15110e;
  --coal-soft: #2a2622;
  --coal-70: #46403a;
  --cream: #faf6ee;
  --cream-2: #f2ecdf;
  --paper: #ffffff;
  --sand: #e6dfcf;
  --sand-2: #efe8da;
  --gold: #f5b11c;
  --gold-deep: #c8861a;
  --gold-glow: #ffd15c;
  --red: #e63b2e;
  --red-deep: #b82516;
  --brown: #5e3a24;

  /* semantic */
  --ink: #1c1712;
  --ink-2: #56504a;
  --ink-3: #857d73;
  --line: #e4dccd;
  --line-strong: #d4c9b4;
  --info: #2b5f8a;
  --success: #2e7d4a;
  --success-soft: #e8f2ea;
  --warn: #c8861a;
  --warn-soft: #fbf0d8;
  --danger: #b82516;
  --danger-soft: #fbe6e2;

  /* surfaces */
  --bg: var(--cream);
  --surface: var(--paper);
  --surface-2: #fbf8f1;
  --surface-sink: #f5efe3;

  /* type */
  --font: "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --script: "Caveat", "Outfit", cursive;

  /* 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 #15110e12;
  --sh-sm: 0 2px 6px #15110e14, 0 1px 2px #15110e0a;
  --sh-md: 0 8px 22px #15110e14, 0 2px 6px #15110e0d;
  --sh-lg: 0 20px 46px #15110e1f, 0 6px 12px #15110e10;
  --stamp: 4px 4px 0 var(--coal);
  --stamp-gold: 4px 4px 0 var(--gold);
  --stamp-red: 4px 4px 0 var(--red);

  --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(--gold-glow); color: var(--coal); }
img { max-width: 100%; display: block; }
svg { width: 1.1em; height: 1.1em; flex: none; } /* sane default; components override below */
:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; border-radius: 4px; }

.script { font-family: var(--script); color: var(--red); font-weight: 600; letter-spacing: 0; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8cdb8; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c7b998; 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(--coal);
  color: #cabfae;
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0 14px; gap: 4px;
  position: relative; z-index: 30;
}
.rail-logo {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--gold); color: var(--coal);
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  margin-bottom: 10px; box-shadow: 3px 3px 0 var(--red);
  letter-spacing: -.03em;
}
.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: #b6ab99;
  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: #241f1a; color: var(--cream); }
.rail-btn.active { background: #2c2620; color: var(--gold); }
.rail-btn.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; background: var(--gold); border-radius: 0 4px 4px 0;
}
.rail-btn .tip {
  position: absolute; left: 56px; top: 50%; transform: translateY(-50%) translateX(-6px);
  background: var(--coal); color: var(--cream); 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(--gold); color: var(--coal);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 2px solid #3a332c; }

/* 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: 30px; width: auto; }
.side-title { font-size: 15px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 6px; }
.side-sub { font-size: 11px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.side-scroll { flex: 1; overflow-y: auto; padding: 6px 10px 14px; }
.side-group { margin-top: 14px; }
.side-group-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; 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(--sand-2); color: var(--ink); }
.side-link.active { background: var(--paper); color: var(--ink); box-shadow: var(--sh-xs); }
.side-link.active svg { color: var(--red); }
.side-link .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--sand); color: var(--coal-soft);
  border-radius: 999px; padding: 1px 8px; min-width: 20px; text-align: center; }
.side-link.active .count { background: var(--red); color: #fff; }
.side-foot { padding: 12px 14px; border-top: 1px solid var(--line); }
.side-card { background: linear-gradient(140deg, var(--coal), var(--coal-soft)); color: var(--cream); 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: #c8bda9; line-height: 1.4; }
.side-card .bar { height: 6px; border-radius: 999px; background: #362f28; margin-top: 9px; overflow: hidden; }
.side-card .bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-glow)); }

/* 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: #fbf8f1cc; 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(--red); 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: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--red); }
.page-head h1 { font-size: 27px; margin-top: 3px; }
.page-head h1 .script { font-size: 30px; }
.page-head .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; max-width: 640px; }
.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(--coal); color: var(--cream); box-shadow: var(--stamp-red); }
.btn-primary:hover { background: #211c17; }
.btn-gold { background: var(--gold); color: var(--coal); box-shadow: var(--stamp); }
.btn-gold:hover { background: var(--gold-glow); }
.btn-red { background: var(--red); color: #fff; box-shadow: var(--stamp); }
.btn-red:hover { background: var(--red-deep); }
.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(--sand-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 / kpi stamp 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(--gold); }
.stat.red::after { background: var(--red); }
.stat.green::after { background: var(--success); }
.stat.coal::after { background: var(--coal); }
.stat .st-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; 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.up { color: var(--success); background: var(--success-soft); }
.trend.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-gold { background: var(--warn-soft); color: var(--gold-deep); }
.b-red { background: var(--danger-soft); color: var(--danger); }
.b-green { background: var(--success-soft); color: var(--success); }
.b-blue { background: #e4eef6; color: var(--info); }
.b-coal { background: #ece7dd; color: var(--coal-soft); }
.b-sand { background: var(--sand-2); color: var(--brown); }
.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); }
.chip:hover { border-color: var(--line-strong); }
.chip.active { background: var(--coal); color: var(--cream); border-color: var(--coal); }
.chip.active svg { color: var(--gold); }
.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(--coal-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: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; 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(--red); }

/* progress */
.prog { height: 8px; background: var(--surface-sink); border-radius: 999px; overflow: hidden; }
.prog > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); 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(--gold-deep); }
.tl-item.done::before { background: var(--success); border-color: var(--success); }
.tl-item.now::before { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px var(--danger-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%; }
.pipe-col-head h4 { font-size: 13px; }
.pipe-col-head .pc-count { font-size: 11px; font-weight: 700; color: var(--ink-3); background: var(--sand); 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(--gold-deep); transition: all var(--dur); }
.bolt:hover { background: var(--gold); color: var(--coal); border-color: var(--gold-deep); box-shadow: 2px 2px 0 var(--coal); }
.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; }

/* ============================================================
   Drawer + modal + toast
   ============================================================ */
.scrim { position: fixed; inset: 0; background: #15110e55; 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-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(--coal); color: var(--cream); 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(--gold); }
.toast.ok { border-left-color: var(--success); }
.toast.warn { border-left-color: var(--gold); }
.toast .t-icn { width: 30px; height: 30px; border-radius: 8px; background: #2c2620; display: grid; place-items: center; color: var(--gold); 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: #c8bda9; }
@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(--gold-deep); box-shadow: 0 0 0 3px #f5b11c33; }
.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 */
.empty { text-align: center; padding: 46px 20px; color: var(--ink-3); }
.empty svg { width: 40px; height: 40px; color: var(--line-strong); margin-bottom: 10px; }
.empty h4 { color: var(--ink-2); font-size: 15px; }

/* AI / agent surfaces */
.ai-surface { background: linear-gradient(150deg, #fffdf7, #fbf3df); border: 1px solid var(--gold-deep); 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: linear-gradient(90deg, var(--gold), var(--red)); }
.ai-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-deep); }
.ai-tag svg { width: 13px; height: 13px; }
.agent-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 15px; box-shadow: var(--sh-sm); transition: transform var(--dur), box-shadow var(--dur); }
.agent-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.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, .drawer-head .eyebrow svg, .card-head h3 svg { width: 1em; height: 1em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.s-live { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.s-idle { background: var(--ink-3); }
.s-wait { background: var(--gold); box-shadow: 0 0 0 3px var(--warn-soft); }

/* map */
.map { height: 340px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.maplibregl-ctrl-attrib { font-size: 9px; }

/* portal accent (external customer view) */
.portal-hero { background: linear-gradient(135deg, var(--coal), #241d16); color: var(--cream); border-radius: var(--r-lg); padding: 26px; position: relative; overflow: hidden; }
.portal-hero .script { color: var(--gold-glow); }
.portal-hero::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, #f5b11c33, transparent 70%); }

/* responsive */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@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: -0px; 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 14px; }
  .search { display: none; }
  .page-head h1 { font-size: 22px; }
  .mobile-menu { display: grid !important; }
}
.mobile-menu { display: none; }
