/* Dar CRM. One face (Manrope), light only, gold on data and the one primary action.
 * Grid: sidebar 232 + canvas. Canvas padding 32 each side; at 1440 the content is 1440-232-64 = 1144.
 * Main row: 2fr 1fr with a 16px gap -> 757 + 16 + 371 = 1144.
 */
:root {
  --ground: #f5f6f7;
  --surface: #ffffff;
  --raised: #f8f9fa;
  --active: #e9ebee;
  --border: #e4e6e9;
  --rule: #eef0f2;
  --control: #cfd3d8;
  --text: #15171a;
  --muted: #555b63;
  --faint: #676c74;
  --gold: #e8a200;          /* data hue */
  --gold-fill: #f2b705;     /* primary button, mark */
  --gold-fill-hover: #e5a800;
  --gold-ink: #2b2100;      /* text on gold */
  --gold-wash: #fff4d1;
  --gold-text: #7a5300;     /* gold as text, 6.6:1 on white */
  --gold-line: #f0cf6b;
  --positive: #247b50;
  --pos-bg: #dff5e7; --pos-ink: #0d3b22;
  --negative: #c4242a;
  --neg-bg: #ffebe8; --neg-ink: #831c1e;
  --warn-bg: #fff7e0; --warn-ink: #8a4a00; --warn-line: #f6dc95;
  --grid: #e8e9eb;
  --r-card: 10px; --r-control: 6px;
  --gap: 16px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--text); font: 400 14px/20px var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, th.num, .kpi-value, .tnum { font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; line-height: 16px; }
.nowrap { white-space: nowrap; }
.unit { color: var(--faint); font-weight: 400; font-size: .62em; margin-left: 3px; }
.unit-pre { color: var(--faint); font-weight: 400; font-size: .62em; margin-right: 4px; }
.dash { color: var(--faint); }
.neg { color: var(--negative); }
.pos { color: var(--positive); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--border); padding: 16px 12px; background: var(--ground); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand svg { flex: none; }
.brand-name { font-size: 16px; font-weight: 700; line-height: 20px; letter-spacing: -.01em; }
.brand-ws { font-size: 12px; line-height: 16px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; color: #3a3f46; font-weight: 500; }
.nav a svg { width: 16px; height: 16px; flex: none; color: #6a7078; }
.nav a:hover { background: #eceef0; }
.nav a.on { background: var(--active); color: var(--text); }
.nav a.on svg { color: var(--text); }
.nav .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.nav .count b { color: var(--gold-text); font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px; }
.sim { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 6px; padding: 4px 8px; }
.sim::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #d08a00; flex: none; }
.me-row { display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; color: #2c2f33; }
.me-row .who { min-width: 0; }
.me-row .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:hover { color: var(--text); }

.topbar { display: none; }
.canvas { padding: 24px 32px 48px; min-width: 0; }
.page { max-width: 1440px; }

/* ---------- title row ---------- */
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.title-row h1 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -.015em; }
.title-row .sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; max-width: 760px; }
.title-row .sub b { color: var(--text); font-weight: 600; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumb a:hover { color: var(--text); text-decoration: underline; }

/* ---------- controls ---------- */
.btn { height: 32px; padding: 0 12px; border-radius: var(--r-control); border: 1px solid var(--control); background: var(--surface); cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--raised); border-color: #b9bec5; }
.btn:disabled { color: #8a8f96; background: #f1f2f4; cursor: not-allowed; }
.btn.primary { background: var(--gold-fill); border-color: var(--gold-fill); color: var(--gold-ink); font-weight: 600; }
.btn.primary:hover { background: var(--gold-fill-hover); border-color: var(--gold-fill-hover); }
.btn.primary:disabled { background: #f6e3a6; border-color: #f6e3a6; color: #6d5a20; }
.btn.danger { color: var(--negative); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eceef0; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=search], input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  height: 32px; border: 1px solid var(--control); border-radius: var(--r-control); background: var(--surface); padding: 0 10px; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 20px; }
select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23555b63' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242,183,5,.25); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 16px; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #eceef1; border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { height: 28px; padding: 0 12px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.switch { position: relative; width: 34px; height: 20px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #c9cdd3; border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--positive); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch.lg { width: 48px; height: 28px; }
.switch.lg span::after { width: 24px; height: 24px; }
.switch.lg input:checked + span::after { transform: translateX(20px); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 20px; min-width: 0; }
.card.flush { padding: 0; }
.card.flush > .card-head { padding: 16px 20px 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.card-head .meta { font-size: 12px; color: var(--muted); }
.card-head .meta a { color: var(--gold-text); font-weight: 600; }
.card-head .meta a:hover { text-decoration: underline; }
.grid { display: grid; gap: var(--gap); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-half { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.mt { margin-top: var(--gap); }
.note-line { font-size: 12px; color: var(--muted); margin: 0 0 10px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); border-bottom: 1px solid var(--rule); padding-bottom: 16px; margin-bottom: 16px; }
.kpi { padding: 0 16px; border-left: 1px solid var(--rule); min-width: 0; }
.kpi:first-child { padding-left: 0; border-left: 0; }
.kpi-label { font-size: 13px; color: var(--muted); line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 22px; line-height: 30px; font-weight: 600; margin-top: 2px; white-space: nowrap; }
.kpi.lead .kpi-value { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -.02em; }
.kpi-sub { font-size: 12px; color: var(--muted); line-height: 16px; margin-top: 2px; }

/* drill-down: every figure on the dashboard opens the matching leads */
a.drill { border-radius: 4px; text-decoration: underline; text-decoration-style: dotted; text-decoration-color: var(--gold-line); text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: pointer; }
a.drill:hover { background: var(--gold-wash); text-decoration-color: var(--gold); text-decoration-style: solid; }
a.drill.plain { text-decoration: none; }

/* ---------- funnel ---------- */
.funnel { display: flex; flex-direction: column; }
.f-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 64px 56px; align-items: center; gap: 12px; height: 40px; border-radius: 6px; }
.f-row:hover { background: var(--raised); }
.f-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-track { height: 20px; position: relative; }
.f-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gold); border-radius: 0 3px 3px 0; min-width: 2px; }
.f-row.won .f-bar { background: #b97e00; }
.f-count { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.f-pct { text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.f-drop { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; height: 20px; font-size: 12px; line-height: 18px; color: var(--faint); }
.f-drop span:last-child { padding-left: 2px; }
.f-drop.worst span:last-child { color: var(--negative); font-weight: 600; }
.legend { display: inline-flex; gap: 12px; font-size: 12px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 5px; }

/* ---------- waiting list ---------- */
.wlist { display: flex; flex-direction: column; }
.wrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 8px; margin: 0 -8px; border-radius: 6px; border-bottom: 1px solid var(--rule); min-height: 52px; }
.wrow:last-child { border-bottom: 0; }
.wrow:hover { background: var(--raised); }
.wrow .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrow .sl { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrow .wt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrow .wt small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.card.fill { display: flex; flex-direction: column; }
.card.fill .card-foot { margin-top: auto; padding-top: 12px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.card.flush .tbl th:first-child, .card.flush .tbl td:first-child { padding-left: 20px; }
.card.flush .tbl th:last-child, .card.flush .tbl td:last-child { padding-right: 20px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--raised); }
.tbl tfoot td { font-weight: 600; background: var(--raised); border-top: 1px solid var(--border); border-bottom: 0; }
.tbl .id-main { font-weight: 600; }
.tbl .id-sub { font-size: 12px; color: var(--muted); line-height: 16px; margin-top: 2px; }
.tbl td.wrap-cell { max-width: 280px; }
.tbl td.wrap-cell .id-main, .tbl td.wrap-cell .id-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-line2 { display: none; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: #eef0f2; color: #3b4048; white-space: nowrap; flex: none; }
.pill.won, .pill.received { background: var(--pos-bg); color: var(--pos-ink); }
.pill.lost { background: var(--neg-bg); color: var(--neg-ink); }
.pill.new { background: var(--gold-wash); color: var(--gold-text); }
.pill.invoiced { background: #e7eefb; color: #1f3d75; }
.pill.agreed { background: #eef0f2; color: #3b4048; }
.pill.held { background: var(--warn-bg); color: var(--warn-ink); }
.pill.failed { background: var(--neg-bg); color: var(--neg-ink); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ---------- states ---------- */
.skel { display: inline-block; background: #eceef1; border-radius: 4px; height: 12px; width: 60px; vertical-align: middle; }
.skel-block { display: flex; flex-direction: column; gap: 14px; padding: 4px 0; }
.skel-block .skel { width: 100%; height: 14px; }
.skel-block .skel:nth-child(2n) { width: 82%; }
.skel-block .skel:nth-child(3n) { width: 64%; }
.block-error { display: flex; align-items: flex-start; gap: 10px; flex-wrap: nowrap; padding: 10px 12px; border: 1px solid #f3c9c4; background: #fff6f5; border-radius: 8px; color: var(--neg-ink); font-size: 13px; }
.block-error::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--negative); flex: none; margin-top: 6px; }
.block-error > span { flex: 1; min-width: 0; }
.block-error .linkbtn { color: var(--neg-ink); font-size: 13px; }
.empty { border: 1px dashed var(--control); border-radius: 8px; padding: 12px 14px; color: var(--muted); font-size: 13px; }
.notice { font-size: 12px; line-height: 16px; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px; padding: 8px 10px; }
.inline-error { color: var(--negative); font-size: 13px; }
.saved { color: var(--positive); font-size: 13px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #fff; border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.12); border-radius: 8px; padding: 10px 14px; font-size: 13px; z-index: 60; }

/* ---------- filters ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--rule); }
.toolbar input[type=search] { width: 260px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--rule); font-size: 12px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--gold-wash); color: var(--gold-text); font-weight: 600; font-size: 12px; }
.chip button { border: 0; background: transparent; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; color: var(--gold-text); font-size: 14px; line-height: 1; }
.chip button:hover { background: rgba(122,83,0,.12); }
.toggle-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--r-control); background: #fff; cursor: pointer; font-weight: 500; white-space: nowrap; }
.toggle-chip.on { background: var(--gold-wash); border-color: var(--gold-line); color: var(--gold-text); }

/* ---------- lead detail ---------- */
.lead-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.lead-head h1 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -.015em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lead-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--muted); margin-top: 4px; }
.lead-meta a { color: var(--text); font-weight: 500; }
.lead-meta a:hover { text-decoration: underline; }
.lead-ctrls { display: grid; grid-template-columns: repeat(3, minmax(150px, 190px)); gap: 10px 12px; align-items: end; }
.lead-ctrls .field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 0; }
.kv > div { padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.timeline { display: flex; flex-direction: column; }
.t-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.t-item:last-child { border-bottom: 0; }
.t-ico { width: 22px; height: 22px; display: grid; place-items: center; color: #6a7078; }
.t-ico svg { width: 16px; height: 16px; }
.t-body { min-width: 0; }
.t-title { font-weight: 500; }
.t-title .faint { font-weight: 400; }
.t-text { color: #30353b; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.t-when { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; }
.t-item.auto .t-title { color: var(--muted); font-weight: 400; }
.composer { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 8px; background: var(--raised); }
.composer textarea { width: 100%; min-height: 72px; background: #fff; }
.composer .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.tasks .task { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.tasks .task:last-child { border-bottom: 0; }
.tasks .task input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--positive); }
.tasks .task.done .tt { color: var(--faint); text-decoration: line-through; }
.out-item { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.out-item:last-child { border-bottom: 0; }
.out-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.out-body { color: #30353b; font-size: 13px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dup { font-size: 13px; color: var(--warn-ink); }

/* ---------- dialer ---------- */
.dial-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.avail { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.avail .st { font-size: 16px; font-weight: 600; }
.call-card .who { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -.015em; }
.call-card .phone { font-size: 18px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.call-live { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--positive); font-variant-numeric: tabular-nums; }
.call-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--positive); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .call-live::before { animation: none; } }
.outcomes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.oc { min-height: 84px; border: 1px solid var(--control); border-radius: 10px; background: #fff; cursor: pointer; text-align: left; padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.oc b { font-size: 16px; font-weight: 600; }
.oc span { font-size: 12px; color: var(--muted); line-height: 16px; }
.oc:hover { border-color: #a9aeb5; background: var(--raised); }
.oc.good { border-color: #9fd3b4; background: #f2fbf5; }
.oc.good:hover { background: #e4f6ea; }
.oc.good b { color: var(--pos-ink); }
.oc:disabled { opacity: .55; cursor: wait; }
.stat-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.stat-list > div:last-child { border-bottom: 0; }
.stat-list b { font-variant-numeric: tabular-nums; font-weight: 600; }
.ring-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); align-items: center; }
.ring-row:last-child { border-bottom: 0; }
.ringing { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gold-text); font-weight: 600; }
.ringing::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.waiting-call { text-align: left; padding: 28px 4px; }
.waiting-call h2 { margin: 0 0 4px; font-size: 20px; line-height: 28px; }

/* ---------- settings ---------- */
.set-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.set-tabs a { padding: 8px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.set-tabs a.on { color: var(--text); border-bottom-color: var(--gold); }
.set-sec { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 32px; padding: 0 0 28px; margin-bottom: 28px; border-bottom: 1px solid var(--border); }
.set-sec:last-child { border-bottom: 0; }
.set-sec h2 { margin: 0 0 4px; font-size: 16px; line-height: 24px; font-weight: 600; }
.set-sec p { margin: 0; color: var(--muted); font-size: 13px; }
.set-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 20px; min-width: 0; max-width: 760px; }
.sw-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.sw-row:first-child { padding-top: 0; }
.sw-row:last-of-type { border-bottom: 0; }
.sw-row .t { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sw-row .d { font-size: 13px; color: var(--muted); margin-top: 2px; }
.wa-preview { background: #eef3ef; border-radius: 10px; padding: 12px; margin-top: 10px; }
.wa-bubble { background: #fff; border-radius: 8px 8px 8px 2px; padding: 8px 10px; max-width: 420px; font-size: 13px; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.wa-bubble small { display: block; text-align: right; color: var(--faint); font-size: 11px; margin-top: 2px; }
.temp-pass { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--raised); border: 1px solid var(--border); padding: 4px 8px; border-radius: 6px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; }
.login .brand { padding: 0 0 24px; }
.login .card { padding: 24px; }
.login h1 { margin: 0 0 4px; font-size: 20px; line-height: 28px; }
.login .field { margin-top: 14px; }
.login .field input { height: 40px; }
.login .btn { height: 40px; width: 100%; justify-content: center; margin-top: 18px; }
.demo-list { margin-top: 16px; font-size: 12px; color: var(--muted); }
.demo-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 0; cursor: pointer; color: var(--text); font-size: 13px; border-bottom: 1px solid var(--rule); }
.demo-list button:hover { color: var(--gold-text); }

/* ---------- menu sheet (phone + tablet) ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: var(--ground); display: none; flex-direction: column; padding: 12px 16px 24px; overflow-y: auto; }
.sheet.open { display: flex; }
.sheet .nav a { height: 48px; font-size: 16px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; height: 44px; margin-bottom: 12px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: #eceef0; }

/* ---------- tablet: sidebar folds ---------- */
@media (max-width: 1024px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 52px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; background: var(--ground); }
  .topbar .tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .topbar .tb-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .sim { padding: 2px 6px; }
  .canvas { padding: 20px 24px 40px; }
  .g-main, .dial-grid { grid-template-columns: minmax(0, 1fr); }
  .set-sec { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  .canvas { padding: 16px 16px 40px; }
  .title-row h1, .lead-head h1 { font-size: 22px; line-height: 28px; }
  .g-half { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .card.flush > .card-head { padding: 14px 16px 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .kpi { padding: 0 12px; }
  .kpi:nth-child(odd) { padding-left: 0; border-left: 0; }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi.lead .kpi-value { font-size: 28px; line-height: 36px; }
  .f-row { grid-template-columns: 108px minmax(0, 1fr) 40px 48px; gap: 8px; height: 40px; }
  .f-drop { grid-template-columns: 108px minmax(0, 1fr); gap: 8px; }
  .toolbar { padding: 12px 16px; }
  .toolbar input[type=search] { width: 100%; }
  .toolbar select { flex: 1 1 40%; }
  .chips { padding: 10px 16px; }
  /* tables become two-line rows */
  table.tbl.rows thead { display: none; }
  table.tbl.rows, table.tbl.rows tbody, table.tbl.rows tfoot { display: block; }
  table.tbl.rows tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 16px; border-bottom: 1px solid var(--rule); align-items: center; }
  table.tbl.rows tbody tr:last-child { border-bottom: 0; }
  table.tbl.rows td { padding: 0 !important; border: 0; display: block; }
  table.tbl.rows td.m-hide { display: none; }
  table.tbl.rows td.m-key { text-align: right; font-weight: 600; }
  table.tbl.rows td.wrap-cell { max-width: none; }
  table.tbl.rows .m-line2 { display: block; font-size: 13px; color: var(--muted); line-height: 18px; margin-top: 3px; white-space: normal; }
  table.tbl.rows tfoot tr { background: var(--raised); }
  table.tbl.rows tfoot td { background: transparent; border: 0; }
  .card:not(.flush) table.tbl.rows tr { padding-left: 0; padding-right: 0; }
  .lead-ctrls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
  .lead-ctrls .field:last-child { grid-column: 1 / -1; }
  .kv { grid-template-columns: 112px minmax(0, 1fr); }
  .outcomes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .oc { min-height: 96px; }
  .call-card .who { font-size: 24px; line-height: 32px; }
  .set-panel { padding: 16px; }
  .btn { height: 40px; }
  .btn.sm { height: 34px; }
  input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=search], input[type=date], input[type=datetime-local], input[type=time], select { height: 40px; font-size: 16px; }
  .seg button { height: 36px; }
  .pager { padding: 12px 16px; }
  .t-item { grid-template-columns: 22px minmax(0, 1fr); }
  .t-when { grid-column: 2; text-align: left; }
}

/* ---------- dashboard speed block + bar list ---------- */
.main-col { min-width: 0; }
.speed { display: flex; flex-direction: column; gap: 16px; }
.speed-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.speed-kpis .kpi { padding: 0 20px; border-left: 1px solid var(--rule); }
.speed-kpis .kpi:first-child { padding-left: 0; border-left: 0; }
.barlist { display: flex; flex-direction: column; }
.bl-row { display: block; padding: 8px 6px; margin: 0 -6px; border-radius: 6px; }
.bl-row:hover { background: var(--raised); }
.bl-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.bl-top .num b { font-weight: 600; }
.bl-bar { display: block; height: 4px; margin-top: 6px; }
.bl-bar i { display: block; height: 4px; border-radius: 2px; background: #d3d7dc; }
svg.chart { display: block; max-width: 100%; }
svg.chart .hit:hover { fill: rgba(232,162,0,.08); }
.tbl th.wrap { white-space: normal; line-height: 16px; vertical-align: bottom; }
@media (max-width: 640px) {
  .speed-kpis { grid-template-columns: 1fr 1fr; gap: 14px 0; }
  .speed-kpis .kpi { padding: 0 0 0 14px; }
  .speed-kpis .kpi:last-child { grid-column: 1 / -1; padding-left: 0; border-left: 0; }
}
.wrow .wt small.neg { color: var(--negative); font-weight: 500; }

.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .45; }

@media (max-width: 1024px) {
  #waiting { order: -1; }
}
@media (max-width: 640px) {
  .kpi-label { white-space: normal; overflow: visible; }
  .f-drop { height: auto; min-height: 20px; padding: 1px 0 3px; }
  .topbar .sim { font-size: 11px; }
}
.m-actions { display: none; }
@media (max-width: 640px) {
  .m-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
  .m-actions .btn { height: 44px; justify-content: center; font-size: 15px; }
}
@media (max-width: 640px) {
  .call-card .outcomes { position: sticky; bottom: 0; z-index: 5; background: var(--surface); margin: 16px -16px -16px; padding: 10px 16px 16px; border-top: 1px solid var(--border); border-radius: 0 0 var(--r-card) var(--r-card); gap: 8px; }
  .call-card .oc { min-height: 72px; padding: 10px 12px; }
  .call-card .oc b { font-size: 16px; }
}
.card.flush [data-body] > .skel-block, .card.flush [data-body] > .block-error { margin: 0 20px 20px; }
.card.flush [data-body] > .empty { margin: 0 20px 20px; }
