/* BudgetGadget UI — design tokens */
:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #f8fafc; --ink: #172238; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --line-2: #cbd5e1;
  --brand: #5145e5; --brand-ink: #4338ca; --brand-soft: #eef2ff;
  /* *-strong: filled-button backgrounds that keep white text at WCAG AA contrast */
  --green: #059669; --green-strong: #047857; --green-soft: #ecfdf5; --amber: #d97706; --amber-ink: #92400e; --amber-soft: #fffbeb;
  --red: #dc2626; --red-soft: #fef2f2; --blue: #2563eb; --blue-soft: #eff6ff;
  --side: #172238; --side-2: #1f2c47; --side-ink: #a3b0c6;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 34, 56, .05), 0 2px 8px rgba(23, 34, 56, .04);
  --shadow-lg: 0 10px 40px rgba(23, 34, 56, .18);
  --tabbar-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.015em; margin: 0 0 18px; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 650; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden, [hidden] { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .95em; }
:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }
svg.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; display: flex; flex-direction: column; color: var(--side-ink);
  background: var(--side); position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 750; font-size: 16px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 14px; }
.brand small { display: block; font-weight: 450; font-size: 11.5px; color: var(--side-ink); }
/* The <nav> is the flex child: it must shrink and scroll, or long menus push the profile/sign-out off the sidebar. */
.sidebar > nav { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.nav { list-style: none; margin: 0; padding: 4px 12px 12px; }
.nav-group { padding: 14px 12px 4px; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: #7b88a1; }
.nav-group:first-child { padding-top: 4px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 7px 12px; margin: 1px 0; border-radius: 8px; color: var(--side-ink); font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s; }
.nav a svg.icon { width: 18px; height: 18px; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.nav a.active { background: var(--brand); color: #fff; }
.nav a:focus-visible { outline-color: #a5b4fc; }
.sidebar-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.foot-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.foot-actions .btn.active { background: rgba(255, 255, 255, .16); }
.me { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: #6d63ea; flex-shrink: 0; position: relative; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .avatar { width: 32px; height: 32px; font-size: 12px; background: var(--brand-soft); color: var(--brand-ink); }
.person .avatar.off { background: #f1f5f9; color: var(--muted); }
.me .name { color: #f1f5f9; font-weight: 600; font-size: 13.5px; }
.me .role { font-size: 12px; text-transform: capitalize; }
.status-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #94a3b8; border: 2px solid var(--side-2); }
.status-dot.on { background: #22c55e; }
.sidebar-foot .btn { width: 100%; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: #e2e8f0; }
.sidebar-foot .btn:hover { background: rgba(255, 255, 255, .12); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 28px 32px 40px; max-width: 1440px; width: 100%; margin: 0 auto; }
.content:focus { outline: none; }
.backdrop { display: none; }
.tabbar { display: none; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat .value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin-top: 4px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.green .value { color: var(--green-strong); } .stat.amber .value { color: var(--amber); } .stat.red .value { color: var(--red); }
/* KPI cards: an icon chip carries the tone, the number stays in ink */
.stat.kpi { display: grid; grid-template-columns: 1fr auto; align-items: start; }
.stat.kpi .value { color: var(--ink); }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); grid-row: span 3; }
.stat-icon svg.icon { width: 18px; height: 18px; }
.stat.green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat.amber .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat.red .stat-icon { background: var(--red-soft); color: var(--red); }
.stat.blue .stat-icon { background: var(--blue-soft); color: var(--blue); }
.grid.kpis { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-bottom: 18px; }
/* Secondary metrics: a compact definition grid instead of a wall of cards */
.mini-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 20px; margin: 0; }
.mini-stats > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mini-stats dt { color: var(--muted); font-size: 13px; }
.mini-stats dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-stats dd.amber { color: var(--amber); } .mini-stats dd.red { color: var(--red); } .mini-stats dd.green { color: var(--green-strong); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 760px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 28px 4px; }
.loading::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--brand); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input, select, textarea {
  font: inherit; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  width: 100%; transition: border-color .15s, box-shadow .15s; min-height: 40px;
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(81, 69, 229, .15); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
textarea { min-height: 84px; resize: vertical; }
.field { margin-bottom: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 450; color: var(--ink); margin-bottom: 8px; cursor: pointer; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 4px 0 0; }
.btn {
  font: inherit; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; text-decoration: none; box-shadow: 0 1px 2px rgba(23, 34, 56, .05);
}
.btn svg.icon { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); border-color: #94a3b8; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
/* In-flight requests (delegate() disables the clicked button) */
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-color: #94a3b8 #94a3b8 transparent; animation: spin .7s linear infinite; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn-success { background: var(--green-strong); border-color: var(--green-strong); color: #fff; }
.btn-success:hover { background: #065f46; border-color: #065f46; color: #fff; }
/* Amber with white text fails contrast, so warning actions use a tinted style */
.btn-warn { background: var(--amber-soft); border-color: #fcd34d; color: var(--amber-ink); }
.btn-warn:hover { background: #fef3c7; border-color: var(--amber); color: #78350f; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 12.5px; }
.btn-lg { min-height: 46px; padding: 11px 20px; font-size: 15px; border-radius: 11px; }
td .btn-sm + .btn-sm { margin-left: 4px; }
.btn-group { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters .field { margin: 0; min-width: 150px; flex: 1 1 150px; }
.filters > .btn { flex: 0 0 auto; }
.form-error { color: var(--red); margin: 10px 0 0; font-weight: 500; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13.5px; }
th { background: var(--surface-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #f8f9ff; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.nowrap, .nowrap { white-space: nowrap; }
.zero { color: #a0aec0; }
.card table th { position: static; }
.cell-title { font-weight: 650; color: var(--ink); }
.cell-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty::before { content: ""; display: block; width: 40px; height: 40px; margin: 0 auto 10px; border-radius: 12px; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E") center / 22px no-repeat; border: 1px solid var(--line); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin: -6px 0 18px; font-size: 13px; }

/* ---------- badges & notices ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f1f5f9; color: var(--ink-2); white-space: nowrap; text-transform: capitalize; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.green { background: var(--green-soft); color: #047857; }
.badge.amber { background: var(--amber-soft); color: #b45309; }
.badge.red { background: var(--red-soft); color: #b91c1c; }
.badge.blue { background: var(--blue-soft); color: #1d4ed8; }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--brand-soft); color: #3730a3; margin: 12px 0; font-size: 13.5px; border: 1px solid #e0e7ff; }
.notice.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.notice.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.notice.ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
details.card summary { cursor: pointer; font-weight: 600; }

/* ---------- call workspace ---------- */
.workspace { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.lead-card .name { font-size: 24px; font-weight: 750; letter-spacing: -.01em; }
.phone-box { margin: 18px 0 6px; padding: 16px; border-radius: var(--radius); background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%); border: 1px solid #e0e7ff; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.phone-label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.phone-primary { font-size: 30px; font-weight: 800; letter-spacing: .02em; color: var(--ink); display: inline-block; font-variant-numeric: tabular-nums; }
.phone-primary:hover { color: var(--brand); }
.btn-call { background: var(--green); border-color: var(--green); color: #fff; border-radius: 999px; min-height: 48px; padding: 10px 22px; box-shadow: 0 4px 14px rgba(5, 150, 105, .3); }
.btn-call:hover { background: #047857; color: #fff; }
.alt-phone { margin-top: 10px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; margin: 16px 0; align-items: baseline; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.timer { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 10px 0 10px 18px; border-bottom: 1px dashed var(--line); }
.timeline li::before { content: ""; position: absolute; left: 2px; top: 17px; width: 8px; height: 8px; border-radius: 50%; background: #c7d2fe; }
.timeline li:last-child { border-bottom: 0; }

/* ---------- dialog & toast ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, 94vw); max-height: 90vh; box-shadow: var(--shadow-lg); color: var(--ink); }
dialog.wide { width: min(1000px, 96vw); }
dialog::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-form { padding: 22px 24px; }
.modal-form h3 { font-size: 18px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; max-width: 380px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .2s ease-out; }
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }
pre.json { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 10px; overflow: auto; max-height: 380px; font-size: 12px; }

/* ---------- chart ---------- */
.chart { width: 100%; height: 220px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: currentColor; }
.c1 { color: #94a3b8; } .c2 { color: #f59e0b; } .c3 { color: #6366f1; } .c4 { color: #10b981; }
.chart .s1 { fill: #cbd5e1; } .chart .s2 { fill: #fbbf24; } .chart .s3 { fill: #818cf8; } .chart .s4 { fill: #34d399; }
.chart rect { rx: 2px; }
.chart text { font-size: 10px; fill: #94a3b8; }

/* ---------- sign-in ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1000px 520px at 10% -10%, rgba(81, 69, 229, .55) 0%, transparent 60%), var(--side); }
.auth .card { width: min(420px, 100%); padding: 32px 28px; border-radius: 20px; box-shadow: var(--shadow-lg); }
.auth h1 { text-align: center; margin-bottom: 4px; }
.auth .logo { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; font-weight: 800; font-size: 22px; color: #fff; background: var(--brand); }
.auth .tagline { text-align: center; margin: 0 0 22px; }
.auth form .btn-lg { width: 100%; margin-top: 4px; }
.tabs { display: flex; gap: 4px; margin-bottom: 20px; padding: 4px; background: #f1f5f9; border-radius: 12px; }
.tabs button { flex: 1; border: 0; background: transparent; box-shadow: none; min-height: 38px; }
.tabs button.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(15, 23, 42, .1); }

/* ---------- tablet & phone ---------- */
@media (max-width: 900px) {
  body { font-size: 15px; }
  .layout { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(300px, 84vw); height: 100%; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .backdrop.show { opacity: 1; pointer-events: auto; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 30; align-items: center; gap: 12px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
    background: rgba(255, 255, 255, .92); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line);
  }
  .topbar .icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink); }
  .topbar .title { font-weight: 700; font-size: 16.5px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .avatar { width: 34px; height: 34px; }
  .topbar .status-dot { border-color: #fff; }
  .content { padding: 16px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .content > div > h1, .content > div > .row.between > h1 { display: none; } /* the top bar shows the page title */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: inherit; font-size: 11px; font-weight: 600; color: var(--muted); background: none; border: 0; position: relative; }
  .tabbar svg.icon { width: 23px; height: 23px; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a.active::after { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .tabbar .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; line-height: 18px; }
  #toasts { left: 14px; right: 14px; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.two { grid-template-columns: 1fr; }
  .stat { padding: 12px 12px 11px; }
  .stat .value { font-size: 21px; }
  .card { padding: 16px; border-radius: 16px; }
  .filters { padding: 12px; gap: 10px; }
  .filters .field { flex: 1 1 calc(50% - 10px); min-width: 0; }
  .filters > .btn { flex: 1 1 100%; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  input, select, textarea { min-height: 46px; font-size: 16px; } /* 16px stops iOS zoom-on-focus */
  .workspace { grid-template-columns: 1fr; }
  .lead-card .name { font-size: 21px; }
  .phone-primary { font-size: 26px; }
  .phone-box .btn-call { flex: 1 1 100%; }
  .kv { grid-template-columns: 112px 1fr; }
  .page-head > .btn-lg, .row.between > .btn-lg { width: 100%; }
  /* Call outcome buttons stay within thumb reach */
  .action-bar {
    position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 20; display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    margin: 16px -16px -16px; padding: 12px 16px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); border-radius: 0 0 16px 16px;
  }
  .action-bar .btn { width: 100%; }
  .action-bar .btn:only-child, .action-bar .btn.full { grid-column: 1 / -1; }
  dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  dialog[open] { animation: sheet .22s ease-out; }
  .modal-form { padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .modal-actions { position: sticky; bottom: 0; background: var(--surface); padding-top: 10px; }
  .modal-actions .btn { flex: 1; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Tables become stacked cards on phones */
@media (max-width: 760px) {
  .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
  .table-wrap td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line); text-align: right; }
  .table-wrap td:last-child { border-bottom: 0; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 550; text-align: left; flex-shrink: 0; max-width: 45%; }
  .table-wrap td[data-label=""] { justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
  .table-wrap td[data-label=""]::before { display: none; }
  .table-wrap td:first-child { font-weight: 650; font-size: 15px; }
  tbody tr:hover td { background: transparent; }
  .card table td, .card table th { padding: 9px 4px; }
  .empty { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Phone-only refinements: collapsible filters and a swipeable counter strip on the call screen */
.filters-toggle { display: none; }
@media (max-width: 900px) {
  .filters-toggle { display: inline-flex; width: 100%; margin-bottom: 10px; justify-content: space-between; }
  .filters-toggle::after { content: "▾"; color: var(--muted); }
  .filters-toggle[aria-expanded="true"]::after { content: "▴"; }
  form.filters:not(.open) { display: none; }
  .row.between { margin-bottom: 12px; }
  .summary-strip { display: flex; overflow-x: auto; gap: 10px; margin: 0 -14px 14px; padding: 2px 14px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .summary-strip::-webkit-scrollbar { display: none; }
  .summary-strip .stat { flex: 0 0 132px; scroll-snap-align: start; padding: 10px 12px; }
  .summary-strip .stat .value { font-size: 19px; }
}

/* ---------- notifications ---------- */
.bell { position: relative; margin-left: auto; width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06); color: #e2e8f0; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.bell:hover { background: rgba(255, 255, 255, .14); }
.topbar .bell { margin-left: 0; color: var(--ink); background: var(--surface); border-color: var(--line); }
.bell-count { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 19px; text-align: center; box-shadow: 0 0 0 2px var(--side); }
.topbar .bell-count { box-shadow: 0 0 0 2px #fff; }
.notif-panel { position: fixed; z-index: 70; top: 16px; left: 264px; width: min(400px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; position: sticky; top: 0; background: var(--surface); }
.notif-head h3 { margin: 0; }
.notif-settings { padding: 0 18px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; justify-items: start; }
.notif-list { list-style: none; margin: 0; padding: 6px 10px 12px; }
.notif-list li { padding: 12px 10px; border-radius: 12px; display: grid; gap: 3px; }
.notif-list li + li { border-top: 1px solid var(--line); }
.notif-list li.unread { background: var(--brand-soft); }
.notif-list li.unread .notif-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-right: 7px; vertical-align: 1px; }
.notif-title { font-weight: 650; }
.notif-list .row { margin-top: 6px; }
#toasts { top: 18px; right: 18px; bottom: auto; }
.lead-toast { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 5px solid var(--green); width: 340px; max-width: calc(100vw - 32px); display: grid; gap: 4px; padding: 14px 16px; }
.lead-toast strong { font-size: 15px; }
.lead-toast .btn { margin-top: 6px; }
.toast-close { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.conn-banner { position: fixed; z-index: 80; top: 0; left: 50%; transform: translateX(-50%); margin-top: 10px; padding: 9px 16px; border-radius: 999px; background: #92400e; color: #fff; font-weight: 600; font-size: 13px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 24px); text-align: center; }
.desktop-offer { position: fixed; z-index: 65; right: 18px; bottom: 18px; width: min(380px, calc(100vw - 32px)); display: grid; gap: 10px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; }
@media (max-width: 900px) {
  .notif-panel { top: calc(64px + env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; max-height: calc(100vh - 150px); }
  #toasts { top: calc(66px + env(safe-area-inset-top)); left: 12px; right: 12px; bottom: auto; }
  .lead-toast { width: auto; }
  .desktop-offer { left: 12px; right: 12px; width: auto; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
}

/* ---------- lead distribution ---------- */
.share { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.share-bar { width: 90px; height: 8px; flex-shrink: 0; }
.share-bar .track { fill: #eef2f7; }
.share-bar .fill { fill: var(--brand); }
.link-btn { font: inherit; font-weight: 700; color: var(--brand); background: var(--brand-soft); border: 0; border-radius: 8px; padding: 3px 10px; cursor: pointer; min-width: 40px; }
.link-btn:hover { background: #e0e7ff; }
.link-btn:disabled { color: var(--muted); background: transparent; cursor: default; }
tr.total-row td { background: var(--surface-2); font-weight: 700; border-top: 2px solid var(--line); }
.warnings .notice { margin: 8px 0 0; }
.notice-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.notice-action .btn { flex-shrink: 0; }
.sync-stats { display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 2px 12px; }
.sync-stats .muted { grid-column: 1 / -1; }

/* ---------- per-sheet lead tabs ---------- */
.sheet-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 8px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.sheet-tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; scroll-snap-align: start; box-shadow: var(--shadow); }
.sheet-tab:hover { border-color: #c7d2fe; color: var(--ink); }
.sheet-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab-count { min-width: 24px; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; text-align: center; }
.sheet-tab.active .tab-count { background: rgba(255, 255, 255, .22); color: #fff; }
.tab-summary { margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 900px) { .sheet-tabs { margin: 0 -14px 8px; padding: 2px 14px 10px; } .tab-summary .stat { padding: 10px 12px; } }

/* ---------- fast calling workspace ---------- */
.ws-head { margin-bottom: 10px; }
.ws-head h1 { margin: 0; }
.sheet-tabs.compact { margin-bottom: 4px; padding-bottom: 6px; }
.sheet-tabs.compact .sheet-tab { padding: 5px 12px; font-size: 13px; box-shadow: none; }
.summary-line { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.chip { display: inline-flex; gap: 5px; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.chip.green b { color: var(--green); } .chip.amber b { color: var(--amber); } .chip.red b { color: var(--red); }
details.filter-panel { margin-bottom: 12px; }
details.filter-panel > summary { cursor: pointer; display: inline-flex; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; list-style: none; }
details.filter-panel > summary::-webkit-details-marker { display: none; }
details.filter-panel > summary::after { content: " ▾"; color: var(--muted); }
details.filter-panel[open] > summary::after { content: " ▴"; }
details.filter-panel .filters { margin-top: 8px; display: flex !important; }
.btn-xs { min-height: 30px; padding: 3px 9px; font-size: 12.5px; border-radius: 8px; }
.btn-call.btn-xs { min-height: 30px; padding: 3px 10px; box-shadow: none; }
.ws-table td, .ws-table th { padding: 8px 10px; }
.ws-table tbody tr.ws-row { cursor: pointer; }
.ws-table tr.ws-row.active td { background: #eef2ff; }
.ws-table tr.ws-row.done td { color: var(--muted); }
.ws-table tr.ws-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.phone-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.phone-big { font-size: 15.5px; font-weight: 700; color: var(--ink); letter-spacing: .02em; }
.row-note { font-size: 12px; color: var(--muted); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ws-actions { display: flex; gap: 4px; flex-wrap: wrap; }
tr.ws-panel > td { background: #f8f9ff; border-bottom: 2px solid #c7d2fe; padding: 12px 14px; }
.ws-panel-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ws-panel-actions kbd { margin-left: 4px; }
.ws-panel-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(260px, 2fr); gap: 16px; align-items: start; }
.kv.compact { grid-template-columns: 110px 1fr; gap: 4px 10px; margin: 0; font-size: 13px; }
.ws-note { display: flex; gap: 6px; margin-bottom: 8px; }
.ws-note input { min-height: 36px; }
.ws-notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ws-notes li { display: flex; flex-direction: column; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.ws-edit { background: var(--surface); border: 1px solid #c7d2fe; border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.ws-edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.ws-edit-grid .field.wide { grid-column: 1 / -1; }
kbd { font: 600 11px ui-monospace, Consolas, monospace; padding: 1px 6px; border-radius: 5px; border: 1px solid #cbd5e1; border-bottom-width: 2px; background: #f8fafc; color: var(--ink-2); }
.btn-success kbd, .btn-warn kbd, .btn-danger kbd { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.4); color: #fff; }
.kbd-table td { padding: 6px 8px; border: 0; }
@media (max-width: 900px) {
  .ws-head .row { width: 100%; }
  .ws-head .btn-primary { flex: 1; }
  .kbd-btn, .ws-panel-actions kbd { display: none; }
  .ws-panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .table-wrap tr.ws-panel { padding: 10px; background: #f8f9ff; border-color: #c7d2fe; }
  .table-wrap tr.ws-panel > td { display: block; text-align: left; padding: 0; border: 0; background: transparent; }
  .table-wrap tr.ws-panel > td::before { display: none; }
  .table-wrap tr.ws-row.active { border-color: var(--brand); }
  .phone-cell { justify-content: flex-end; }
  .ws-table td[data-label=""] .ws-actions .btn { flex: 1 1 45%; min-height: 40px; }
}

/* ---------- Main City autocomplete ---------- */
.city-picker { position: relative; }
.cp-box { position: relative; }
.cp-box .cp-input { padding-right: 34px; }
.cp-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 50%; background: #eef2f7; color: var(--ink-2); font-size: 16px; line-height: 1; cursor: pointer; }
.cp-clear:hover { background: #e2e8f0; }
.cp-list { position: absolute; z-index: 90; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; max-height: 300px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.cp-list li[role=option] { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.cp-list li[role=option][aria-selected="true"], .cp-list li[role=option]:hover { background: var(--brand-soft); }
.cp-name { font-weight: 600; color: var(--ink); }
.cp-state { font-size: 12px; color: var(--muted); }
.cp-alias { font-size: 12px; color: var(--brand-ink); }
.cp-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.cp-more button { width: 100%; padding: 8px; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.cp-msg { color: var(--muted); margin-top: 3px; }
.cp-msg:empty { display: none; }
.city-picker.cp-invalid .cp-input { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.city-picker.cp-invalid .cp-msg { color: var(--red); font-weight: 600; }
@media (max-width: 760px) { .cp-list { max-height: 40vh; } .cp-list li[role=option] { padding: 12px 10px; } }

/* ---------- redesign: shared components ---------- */
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head .cell-sub { margin-top: 3px; }
.toast.ok { background: var(--green-strong); }
.toast { font-size: 13.5px; }
/* Horizontal bar lists (sizes come from SVG attributes; the CSP forbids inline style attributes) */
.bars { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.bars li { display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.bars .bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bars svg { width: 100%; height: 10px; display: block; }
.bars .track { fill: #eef2f7; } .bars .fill { fill: var(--brand); }
.bars .bar-val { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack { width: 100%; height: 14px; display: block; margin: 6px 0 10px; }
.stack .s-del { fill: var(--green); } .stack .s-pend { fill: #fbbf24; } .stack .s-fail { fill: var(--red); } .stack .s-none { fill: #eef2f7; }
.legend .l-del { color: var(--green); } .legend .l-pend { color: #f59e0b; } .legend .l-fail { color: var(--red); }
.chart-empty { padding: 26px 10px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line-2); border-radius: 10px; }
/* Lead sources table */
.src-table table { min-width: 1180px; }
.src-table td:first-child { min-width: 190px; }
.src-table .product-cell { min-width: 180px; max-width: 240px; }
.src-table .people-cell { min-width: 200px; }
.src-table .sync-cell { min-width: 150px; }
/* Employees table */
.emp-table table { min-width: 980px; }
.emp-table .btn-group { justify-content: flex-end; }
@media (max-width: 900px) {
  .page-head h1 { display: none; } /* the top bar shows the page title */
  .page-head { margin-bottom: 12px; }
  .page-sub { margin: 0; }
  .page-actions { width: 100%; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat.kpi { padding: 12px; }
  .stat.kpi .value { font-size: 20px; }
  .stat-icon { width: 30px; height: 30px; }
  .bars li { grid-template-columns: minmax(90px, 38%) 1fr auto; }
}
@media (max-width: 760px) {
  .src-table table, .emp-table table { min-width: 0; }
  .src-table td:first-child, .src-table .product-cell, .src-table .people-cell, .src-table .sync-cell { min-width: 0; max-width: none; }
  .table-wrap td .btn-group { flex-wrap: wrap; justify-content: flex-start; }
}
.row-note svg.icon, .small svg.icon, .btn-xs svg.icon { width: 13px; height: 13px; vertical-align: -2px; }
.btn-lg svg.icon { width: 18px; height: 18px; }
/* Employees: manage panel */
.manage { display: grid; gap: 14px; }
.manage .kv.compact { margin: 0; }
.manage-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
tr.clickable:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
@media (max-width: 900px) { .ws-head .page-sub { display: none; } }
.card-head > div:first-child { flex: 1 1 240px; min-width: 0; }
.legend + h3 { margin-top: 20px; }
.emp-table table { min-width: 900px; }
.emp-table td:last-child { width: 1%; white-space: nowrap; }
/* Wide sources table: the sheet name stays visible while scrolling sideways */
.src-table th:first-child, .src-table td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.src-table th:first-child { background: var(--surface-2); }
@media (max-width: 760px) {
  .table-wrap td.m-hide { display: none; }
  .src-table th:first-child, .src-table td:first-child { position: static; box-shadow: none; }
}
@media (max-width: 760px) { .emp-table table { min-width: 0; } }
.cell-sub { overflow-wrap: anywhere; }
.foot-actions .btn svg.icon { width: 15px; height: 15px; }
/* Tablets: the sidebar collapses to an icon rail (labels stay available as tooltips and to screen readers) */
@media (min-width: 901px) and (max-width: 1200px) {
  .sidebar { width: 72px; }
  .brand { flex-direction: column; gap: 10px; padding: 16px 0 10px; }
  .brand > div, .me > div:not(.avatar), .foot-actions .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .brand .bell { margin: 0; }
  .nav { padding: 4px 10px 12px; }
  .nav a { justify-content: center; padding: 9px 0; }
  .nav a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-group { font-size: 0; padding: 0; margin: 8px 6px 6px; border-top: 1px solid rgba(255, 255, 255, .1); }
  .nav-group:first-child { margin-top: 0; border-top: 0; }
  .sidebar-foot { padding: 10px 8px 14px; }
  .me { justify-content: center; }
  .foot-actions { grid-template-columns: 1fr; gap: 6px; }
  .foot-actions .btn { padding: 5px 0; }
  .content { padding: 24px 24px 36px; }
  .notif-panel { left: 88px; }
}
.btn.is-current { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.is-current:disabled { opacity: .75; }
button.chip { font: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
button.chip:hover { border-color: #a5b4fc; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.on b { color: #fff !important; }
/* Next lead to call */
.next-card { background: var(--surface); border: 1px solid #c7d2fe; border-left: 4px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin: 4px 0 14px; }
.next-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.next-head h2 { margin: 0; font-size: 15px; }
.next-main { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(200px, 1.6fr); gap: 8px 20px; margin-bottom: 12px; }
.next-name { font-size: 18px; font-weight: 700; }
.next-empty { margin: 0; }
.next-card .ws-panel-inner { border-top: 1px dashed var(--line); padding-top: 12px; }
.list-title { font-size: 14px; margin: 4px 0 8px; color: var(--ink-2); }
.ws-table tr.ws-row.is-next td { background: #f5f7ff; }
.chip.blue b { color: var(--blue); }
@media (max-width: 900px) { .next-main { grid-template-columns: 1fr; } }
.btn-warn kbd { background: #fff; border-color: #fcd34d; color: var(--amber-ink); }
.row-note.retry { color: var(--ink-2); }
.row-note.retry.due { color: var(--red); font-weight: 600; }
.card-head h2 .badge { margin-left: 6px; vertical-align: 2px; }
/* Worker lead source priority editor */
.prio-list { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 6px; }
.prio-list li { display: grid; grid-template-columns: 32px 1fr auto auto auto; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.prio-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 12.5px; }
.prio-name { font-weight: 600; min-width: 0; }
/* Products, WooCommerce picker and worker product panel */
.prod-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); flex-shrink: 0; }
.prod-thumb.empty { display: grid; place-items: center; color: var(--muted); }
.prod-thumb.empty svg.icon { width: 18px; height: 18px; }
.woo-pick { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 14px; background: var(--surface-2); }
.wp-results { list-style: none; margin: 6px 0; padding: 4px; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.wp-hit { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; font: inherit; color: var(--ink); }
.wp-hit:hover, .wp-hit:focus-visible { background: var(--brand-soft); }
.wp-card { display: flex; gap: 10px; align-items: center; padding: 8px; background: var(--surface); border: 1px solid #c7d2fe; border-radius: 10px; }
.wp-card > div { flex: 1; min-width: 0; }
.prod-panel { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.prod-panel.missing, .prod-strip.missing { background: var(--amber-soft); border-color: #fcd34d; color: var(--amber-ink); }
.prod-main { min-width: 160px; flex: 1; }
.prod-figs { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; }
.prod-figs > div { display: grid; }
.prod-figs dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.prod-figs dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.prod-figs .total dd { font-size: 17px; color: var(--green-strong); }
.prod-figs .qty { display: flex; align-items: center; gap: 8px; }
.prod-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; padding: 8px 12px; margin: 0 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.prod-strip .prod-thumb { width: 28px; height: 28px; }
