:root {
  --red: #C8102E;
  --red-dark: #9E0B22;
  --red-soft: #FDECEF;
  --ink: #16181D;
  --ink-2: #3B3F48;
  --muted: #6B7280;
  --line: #E5E7EB;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --side: #15161A;
  --side-2: #222329;
  --blue: #1F6FEB; --blue-soft: #E8F0FE;
  --green: #12805C; --green-soft: #E3F5EE;
  --amber: #B45309; --amber-soft: #FEF3C7;
  --purple: #7C3AED; --purple-soft: #EFE7FD;
  --teal: #0E7490; --teal-soft: #E0F4F8;
  --orange: #C2410C; --orange-soft: #FFEDD5;
  --gray-soft: #F1F2F4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- layout */
#app { display: flex; min-height: 100vh; }
#sidebar { width: 228px; flex: none; background: var(--side); color: #C9CBD1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 16px; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--red); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand b { display: block; font-size: 14px; letter-spacing: .2px; }
.brand span { display: block; font-size: 11px; color: #9396A0; letter-spacing: .4px; text-transform: uppercase; }
.nav { padding: 6px 8px 16px; display: flex; flex-direction: column; gap: 1px; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: #6E717B; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: #C9CBD1; font-weight: 500; }
.nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--red); color: #fff; }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav .badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.nav a.active .badge { background: #fff; color: var(--red); }
#main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar { height: 56px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 20; }
#menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 420px; }
.search input { width: 100%; padding-left: 34px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search-results { position: absolute; top: 40px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow: hidden; z-index: 30; }
.search-results a { display: block; padding: 9px 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--gray-soft); text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
#view { padding: 22px 24px 60px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ---------- controls */
input, select, textarea { font: inherit; color: inherit; border: 1px solid #D5D8DE; border-radius: 8px; padding: 7px 10px; background: #fff; min-height: 36px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(200,16,46,.25); border-color: var(--red); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--red); }
input[type=color] { padding: 2px; height: 36px; }
label.f { display: block; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 13px; border-radius: 8px; padding: 0 14px; height: 36px; border: 1px solid #D5D8DE; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--gray-soft); text-decoration: none; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--gray-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.lg { height: 46px; font-size: 15px; padding: 0 18px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { width: 36px; padding: 0; }

/* ---------- cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-h .actions { margin-left: auto; display: flex; gap: 6px; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.accent { border-top: 3px solid var(--red); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FAFAFB; white-space: nowrap; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: #FAFAFB; }
.t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--gray-soft); color: var(--ink-2); white-space: nowrap; text-transform: capitalize; }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.purple { background: var(--purple-soft); color: var(--purple); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }
.chip.orange { background: var(--orange-soft); color: var(--orange); }
.chip.red { background: var(--red-soft); color: var(--red); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: #EEF0F3; color: var(--ink-2); margin: 0 4px 4px 0; }
.tag button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; font-size: 14px; line-height: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- status stepper */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; }
.stepper button { flex: 1; min-width: 100px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 8px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.stepper button.done { background: var(--green-soft); border-color: #BDE5D3; color: var(--green); }
.stepper button.current { background: var(--red); border-color: var(--red); color: #fff; }
.stepper button:hover:not(.current) { border-color: var(--red); color: var(--red); }

/* ---------- dispatch board */
.dispatch { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.unsched { max-height: calc(100vh - 170px); overflow-y: auto; }
.uj { margin: 8px; padding: 10px; border: 1px dashed #C9CDD4; border-radius: 8px; background: #fff; cursor: grab; }
.uj:hover { border-color: var(--red); }
.board { overflow-x: auto; }
.board-inner { min-width: max-content; }
.b-row { display: flex; border-bottom: 1px solid var(--line); }
.b-row:last-child { border-bottom: 0; }
.b-label { width: 170px; flex: none; padding: 10px 12px; border-right: 1px solid var(--line); background: #FAFAFB; position: sticky; left: 0; z-index: 3; }
.b-label b { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.b-track { position: relative; flex: none; background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); }
.b-track.over { background-color: #FFF5F6; }
.b-head .b-track { height: 34px; background-image: none; }
.b-hour { position: absolute; top: 0; height: 100%; font-size: 11px; color: var(--muted); padding: 9px 6px; border-left: 1px solid var(--line); }
.b-job { position: absolute; border-radius: 7px; padding: 5px 8px; font-size: 12px; color: #fff; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.2); border-left: 4px solid rgba(0,0,0,.25); }
.b-job b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-job span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .92; font-size: 11px; }
.b-job.st-completed { opacity: .55; }
.b-job.st-canceled { opacity: .35; text-decoration: line-through; }
.now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); z-index: 2; pointer-events: none; }

/* ---------- pipeline */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.k-col { width: 270px; flex: none; background: #ECEEF1; border-radius: var(--radius); }
.k-col.over { outline: 2px dashed var(--red); }
.k-head { padding: 12px 12px 8px; }
.k-head b { display: flex; justify-content: space-between; }
.k-list { padding: 4px 8px 10px; min-height: 80px; display: flex; flex-direction: column; gap: 8px; }
.k-card { background: #fff; border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); cursor: grab; border: 1px solid transparent; }
.k-card:hover { border-color: var(--red); }

/* ---------- conversations */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100vh - 150px); min-height: 480px; overflow: hidden; }
.convo-list { border-right: 1px solid var(--line); overflow-y: auto; }
.convo { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.convo:hover, .convo.active { background: #FAFAFB; text-decoration: none; }
.convo.active { box-shadow: inset 3px 0 0 var(--red); }
.convo .snip { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #FAFAFB; }
.bubble { max-width: 72%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble.out { align-self: flex-end; background: var(--red); color: #fff; border-bottom-right-radius: 4px; }
.bubble.in { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.email.out { background: var(--ink); }
.bubble .meta { display: block; font-size: 10.5px; opacity: .75; margin-top: 4px; }
.composer { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #fff; }

/* ---------- timeline */
.tl { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--gray-soft); font-size: 13px; }
.tl-body { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 12px 10px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--red); border-bottom-color: var(--red); }

/* ---------- line items */
.items td input { min-height: 32px; padding: 5px 8px; }
.items .qty { width: 80px; }
.items .price { width: 110px; }
.totals { margin-left: auto; width: 300px; max-width: 100%; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 8px; font-weight: 700; font-size: 17px; }

/* ---------- automations */
.step { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; position: relative; }
.step-n { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.step.t-wait .step-n { background: var(--amber); }
.step.t-condition .step-n { background: var(--purple); }
.step.t-send_sms .step-n, .step.t-send_email .step-n { background: var(--red); }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.step-body .row > select { width: auto; flex: none; max-width: 180px; }
.step-body .row > input { flex: 1; min-width: 0; }
.step-connector { width: 2px; height: 14px; background: #CDD1D7; margin-left: 27px; }
.trigger-box { border: 2px solid var(--red); background: var(--red-soft); border-radius: 10px; padding: 14px; }
.merge-list { display: flex; flex-wrap: wrap; gap: 4px; }
.merge-list button { font: 12px ui-monospace, Menlo, monospace; border: 1px solid var(--line); background: #FAFAFB; border-radius: 5px; padding: 3px 6px; cursor: pointer; }
.merge-list button:hover { border-color: var(--red); color: var(--red); }
.switch { position: relative; width: 38px; height: 22px; display: inline-block; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #CDD1D7; border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ---------- bars */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bar i { display: block; width: 100%; background: var(--red); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar small { font-size: 10.5px; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.bar em { font-style: normal; font-size: 10.5px; color: var(--ink-2); margin-bottom: 3px; white-space: nowrap; }
.hbar { display: grid; grid-template-columns: 160px 1fr 90px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar .track { height: 10px; background: var(--gray-soft); border-radius: 99px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--red); border-radius: 99px; }

/* ---------- modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(17,19,24,.5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal.wide { width: 820px; }
.modal-h { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 500; animation: tin .2s ease; }
.toast.err { background: var(--red); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: 42px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 180px; padding: 6px; z-index: 40; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--gray-soft); text-decoration: none; }

/* ---------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #3a0a14 0%, var(--side) 55%); }
.auth .card { width: 400px; max-width: 100%; padding: 28px; }
.auth .brand { padding: 0 0 20px; color: var(--ink); }
.auth .brand span { color: var(--muted); }

/* ---------- tech "my day" */
.mjob { padding: 16px; }
.mjob + .mjob { margin-top: 12px; }
.mjob .big-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }

.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- charts */
.viz { min-height: 40px; }
.viz svg { display: block; overflow: visible; }
.viz .viz-hit { cursor: crosshair; }
.viz-tip { position: fixed; z-index: 300; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 8px 10px; font-size: 12.5px; color: var(--ink); max-width: 260px; display: none; }
.viz-tip .sw, .viz-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.viz-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; flex-wrap: wrap; }
.hb-row, .pb-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hb-row { grid-template-columns: 150px minmax(0, 1fr) 84px; }
.hb-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.hb-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-size: 12.5px; }
.hb-track { height: 12px; border-radius: 0 4px 4px 0; overflow: hidden; }
.hb-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.pb-bars { display: flex; flex-direction: column; gap: 2px; }
.pb-line { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 10px; align-items: center; }
.pb-line .hb-track { height: 9px; }
.seg { display: inline-flex; border: 1px solid #D5D8DE; border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; font: inherit; font-size: 12px; font-weight: 600; padding: 5px 10px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--ink); color: #fff; }

/* ---------- calls */
.call-row { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.call-row:last-child { border-bottom: 0; }
.call-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 15px; background: var(--blue-soft); }
.call-ico.missed { background: var(--red-soft); }
.call-ico.out { background: var(--green-soft); }
.call-detail { margin: 10px 0 0 44px; display: flex; flex-direction: column; gap: 10px; }
.call-detail audio { width: 100%; max-width: 420px; height: 36px; }
.ai-box { background: var(--purple-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.ai-box ul { margin: 4px 0 0; padding-left: 18px; }
.transcript { max-height: 240px; overflow-y: auto; font-size: 13px; background: var(--gray-soft); border-radius: 8px; padding: 10px 12px; }
.callpop { position: fixed; right: 20px; bottom: 20px; width: 340px; max-width: calc(100vw - 32px); z-index: 150; background: #fff; border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.28); border-top: 4px solid var(--green); overflow: hidden; animation: tin .2s ease; }
.callpop .cp-h { padding: 12px 14px; background: #F3FBF7; display: flex; align-items: center; gap: 10px; }
.callpop .cp-b { padding: 12px 14px; font-size: 13px; }
.callpop .cp-f { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; }
.ring { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; animation: ring 1.2s infinite; flex: none; }
@keyframes ring { 0%, 100% { box-shadow: 0 0 0 0 rgba(18,128,92,.45); } 50% { box-shadow: 0 0 0 10px rgba(18,128,92,0); } }

/* ---------- roles */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; }
.perm { align-items: flex-start; padding: 6px 0; font-weight: 400; }
.perm input { margin-top: 2px; }
.perm small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ph { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.ph img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--gray-soft); }
.ph figcaption { display: flex; align-items: center; gap: 4px; padding: 6px 8px; flex-wrap: wrap; }
.ph figcaption .btn { margin-left: auto; }

/* ---------- on-site presentation */
.present { position: fixed; inset: 0; z-index: 400; background: #F4F5F7; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pr-head { display: flex; align-items: center; gap: 16px; padding: 16px 24px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 2; }
.pr-brand { display: flex; align-items: center; gap: 10px; }
.pr-brand b { display: block; font-size: 16px; }
.pr-brand span, .pr-for span { display: block; font-size: 12px; color: #A7AAB3; }
.pr-for { margin-left: auto; text-align: right; }
.pr-for b { display: block; }
.pr-x { background: rgba(255,255,255,.12); color: #fff; border: 0; width: 38px; height: 38px; border-radius: 50%; font-size: 16px; cursor: pointer; flex: none; }
.pr-sub { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 24px; font-size: 14px; }
.pr-body { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.pr-title { font-size: 28px; font-weight: 800; text-align: center; margin: 6px 0 6px; }
.pr-lead { text-align: center; color: var(--ink-2); font-size: 16px; margin: 0 0 22px; }
.pr-grid { display: grid; gap: 18px; align-items: stretch; margin-top: 18px; }
.pr-grid.pr-n1 { grid-template-columns: minmax(0, 520px); justify-content: center; }
.pr-grid.pr-n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pr-grid.pr-n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pr-card { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; position: relative; box-shadow: var(--shadow); }
.pr-card.rec { border-color: var(--red); box-shadow: 0 10px 30px rgba(200,16,46,.15); }
.pr-card.won { border-color: var(--green); }
.pr-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 99px; white-space: nowrap; }
.pr-tier { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--red); }
.pr-card h2, .pr-summary h2 { font-size: 20px; margin: 4px 0 14px; }
.pr-items { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.pr-items li { display: flex; gap: 10px; font-size: 14px; }
.pr-items small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pr-items .ck { color: var(--green); font-weight: 800; flex: none; }
.pr-price { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 14px; text-align: center; }
.pr-total { font-size: 38px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.pr-price small { color: var(--muted); }
.pr-mo { margin-top: 4px; font-size: 15px; color: var(--ink-2); }
.pr-choose { width: 100%; }
.pr-mem { margin-top: 6px; color: var(--green); font-weight: 700; font-size: 14px; }
.pr-memoffer { margin-top: 8px; background: var(--blue-soft); color: var(--blue); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.pr-memband { margin-top: 22px; background: #fff; border: 2px dashed #9EC5F4; border-radius: 14px; padding: 16px 18px; text-align: center; }
.pr-memplans { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px 0 6px; }
.pr-memplans > div { background: var(--blue-soft); border-radius: 10px; padding: 10px 14px; font-size: 14px; max-width: 360px; }
.pr-memplans small, .pr-memband > small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.pr-newtotal { margin-top: 10px; font-size: 15px; min-height: 20px; }
.pr-state { text-align: center; font-weight: 700; color: var(--green); padding: 12px; text-transform: capitalize; }
.pr-foot { margin-top: 26px; font-size: 12.5px; color: var(--muted); text-align: center; }
.pr-accept { max-width: 720px; }
.pr-summary { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.pr-h2 { font-size: 18px; margin: 26px 0 10px; }
.pr-pay { display: grid; gap: 8px; }
.pr-payopt { display: flex; gap: 12px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; }
.pr-payopt:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.pr-payopt input { width: 20px; height: 20px; accent-color: var(--red); min-height: 0; }
.pr-payopt b { display: block; font-size: 16px; }
.pr-payopt small { color: var(--muted); }
.sigwrap { position: relative; background: #fff; border: 2px dashed #C9CDD4; border-radius: 12px; }
.sigpad { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.sigline { position: absolute; left: 16px; right: 16px; bottom: 34px; border-bottom: 1px solid #C9CDD4; color: var(--muted); font-size: 12px; pointer-events: none; }
.sigclear { position: absolute; top: 6px; right: 6px; }
.pr-err { color: var(--red); margin-top: 10px; min-height: 18px; }
.pr-done { text-align: center; padding-top: 70px; }
.pr-bigcheck { width: 86px; height: 86px; border-radius: 50%; background: var(--green); color: #fff; font-size: 46px; display: grid; place-items: center; margin: 0 auto 14px; }
@media (max-width: 900px) {
  .pr-grid.pr-n2, .pr-grid.pr-n3 { grid-template-columns: 1fr; }
  .pr-head { padding: 12px 16px; }
  .pr-for { display: none; }
  .pr-title { font-size: 22px; }
}

/* ---------- quote builder / measure */
.qb-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
@media (min-width: 1001px) { .qb-mapwrap { position: sticky !important; top: 12px; } }
.qb-mapwrap { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #1d2024; }
.qb-map { height: 520px; }
.qb-empty { height: 520px; display: grid; place-items: center; color: #C9CBD1; text-align: center; padding: 20px; }
.qb-toolbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 500; background: #fff; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.3); padding: 8px 10px; display: flex; gap: 8px; align-items: center; font-size: 13px; max-width: calc(100% - 20px); flex-wrap: wrap; justify-content: center; }
.qb-panel { display: flex; flex-direction: column; gap: 12px; }
.qb-svc { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.qb-svc.on { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
.qb-svc .row { flex-wrap: nowrap; }
.qb-shape { display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 0; }
.qb-lines div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13px; }
.qb-total { font-size: 22px; font-weight: 800; }
.vtx { background: #fff; border: 2px solid #111; border-radius: 2px; box-sizing: border-box; cursor: move; }
.leaflet-tooltip.mlabel { background: rgba(17,19,24,.85); color: #fff; border: 0; font-weight: 600; font-size: 12px; box-shadow: none; }
.leaflet-tooltip.mlabel::before { display: none; }
@media (max-width: 1000px) { .qb-main { grid-template-columns: 1fr; } .qb-map, .qb-empty { height: 380px; } }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  #sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  #sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  #menu-btn { display: inline-flex; }
  #view { padding: 16px 16px 60px; }
  #topbar { padding: 0 16px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
  .dispatch { grid-template-columns: 1fr; }
  .unsched { max-height: 220px; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .convo-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .thread { height: 70vh; }
  .user-chip .nm { display: none; }
  .hbar { grid-template-columns: 110px 1fr 80px; }
  .hb-row { grid-template-columns: 100px minmax(0, 1fr) 70px; }
  .pb-row { grid-template-columns: 100px minmax(0, 1fr); }
}
@media print {
  #sidebar, #topbar, .page-head .actions { display: none !important; }
}

/* ---- live map */
.map-split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
#mside { max-height: 640px; overflow-y: auto; }
.mpin { width: 28px; height: 28px; border-radius: 50%; color: #fff; font: 700 13px/28px -apple-system, system-ui, sans-serif; text-align: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.mpin.home { background: #15161A; font-size: 13px; line-height: 24px; width: 26px; height: 26px; }
.mtruck { width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 3px solid; display: grid; place-items: center; font-size: 17px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.mnum { flex: none; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; margin-right: 6px; }
@media (max-width: 900px) { .map-split { grid-template-columns: 1fr; } #lmap { height: 420px !important; } #mside { max-height: none; } }
#lmap { position: relative; z-index: 0; }
