/* Doorbell — single stylesheet, light + dark, no build step. */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #14161a;
  --text-2: #4a505a;
  --muted: #6b717c;
  --brand: #1f6feb;
  --brand-ink: #ffffff;
  --brand-soft: #e8f0fe;
  --logo-ink: #ffffff;
  --ok: #137333; --ok-soft: #e6f4ea;
  --warn: #8a5300; --warn-soft: #fef3dc;
  --err: #b3261e; --err-soft: #fce8e6;
  --info: #1b5fc4; --info-soft: #e8f0fe;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --bubble-out: #1f6feb; --bubble-out-ink: #fff;
  --bubble-in: #eef0f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 14px;
  --radius-sm: 9px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111214;
    --surface: #1a1b1e;
    --surface-2: #232529;
    --border: #2c2f34;
    --border-strong: #3b3f46;
    --text: #f1f2f4;
    --text-2: #c3c6cc;
    --muted: #9298a2;
    --brand: #4c8dff;
    --brand-ink: #0b1220;
    --brand-soft: #1b2a44;
    --logo-ink: #0b1220;
    --ok: #6dd58c; --ok-soft: #173322;
    --warn: #f2b84b; --warn-soft: #3a2c10;
    --err: #ff8a80; --err-soft: #3d1c1a;
    --info: #8ab4ff; --info-soft: #1b2a44;
    --series-1: #3987e5;
    --series-2: #d95926;
    --bubble-out: #2f6fdf; --bubble-out-ink: #fff;
    --bubble-in: #26292e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111214; --surface: #1a1b1e; --surface-2: #232529; --border: #2c2f34; --border-strong: #3b3f46;
  --text: #f1f2f4; --text-2: #c3c6cc; --muted: #9298a2; --brand: #4c8dff; --brand-ink: #0b1220; --brand-soft: #1b2a44; --logo-ink: #0b1220;
  --ok: #6dd58c; --ok-soft: #173322; --warn: #f2b84b; --warn-soft: #3a2c10; --err: #ff8a80; --err-soft: #3d1c1a; --info: #8ab4ff; --info-soft: #1b2a44;
  --series-1: #3987e5; --series-2: #d95926; --bubble-out: #2f6fdf; --bubble-out-ink: #fff; --bubble-in: #26292e; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75em; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; }
.ic.big { width: 40px; height: 40px; opacity: .5; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Top bar & tabs ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner, .tabs-inner { max-width: 1160px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 16px; }
.topbar-inner { height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; font-size: 1.05rem; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; color: var(--brand); }
.switcher select { min-width: 200px; max-width: 280px; padding: 7px 30px 7px 10px; font-weight: 550; }
.biz-name { font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { color: var(--text-2); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.tabs { border-top: 1px solid var(--border); }
.tabs-inner { gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 11px 12px; color: var(--text-2); font-weight: 550; font-size: .92rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-size: .72rem; font-weight: 700; }

.demo-banner { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 8px 20px; background: var(--warn-soft); color: var(--warn); font-size: .87rem; border-bottom: 1px solid var(--border); text-align: left; }
.demo-banner a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ---------- Layout ---------- */
.container { max-width: 1160px; margin: 0 auto; padding: 26px 20px 60px; }
.container-narrow { max-width: 460px; padding-top: 8vh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 2px; }
.page-head p { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card.narrow { max-width: 520px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.empty { padding: 24px 8px; text-align: center; }
.callout { background: var(--info-soft); border-color: transparent; color: var(--text); box-shadow: none; padding: 14px 18px; }
.callout.warn { background: var(--warn-soft); }
.inline-list { display: inline; padding: 0; margin: 0; list-style: none; }
.inline-list li { display: inline; }
.inline-list li + li::before { content: " · "; color: var(--muted); }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 .92rem var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn .ic { width: 16px; height: 16px; }

label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--text); min-width: 0; }
.hint { font-weight: 450; color: var(--muted); font-size: .8rem; }
input, select, textarea { font: 400 .95rem var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 11px; width: 100%; min-width: 0; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
input:disabled { background: var(--surface-2); color: var(--muted); }
input[type=file] { padding: 7px; font-size: .85rem; }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 450; font-size: .9rem; color: var(--text-2); }
label.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.grid-form.inner { margin-top: 8px; }
.span-2 { grid-column: 1 / -1; }
.sub-fieldset { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; }
.sub-fieldset legend { font-weight: 600; font-size: .88rem; padding: 0 6px; }
.counter { font-weight: 400; font-size: .78rem; color: var(--muted); }
.settings .card h2 { margin-bottom: 14px; }
.sticky-save { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 35%); display: flex; justify-content: flex-end; }

.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .92rem; background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.flash-error { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-err { background: var(--err-soft); color: var(--err); }
.pill-info { background: var(--info-soft); color: var(--info); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg a { padding: 5px 12px; border-radius: 7px; color: var(--text-2); font-weight: 600; font-size: .85rem; text-transform: capitalize; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-sm a { padding: 3px 9px; font-size: .8rem; }

/* ---------- Auth ---------- */
.auth-card { padding: 30px; }
.auth-card h1 { font-size: 1.4rem; }
.auth-brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 1.1rem; margin-bottom: 22px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.stat.accent { background: linear-gradient(135deg, var(--brand-soft), var(--surface) 75%); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.stat-label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: .84rem; font-weight: 600; }
.stat-label .ic { width: 16px; height: 16px; color: var(--muted); }
.stat-value { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: .8rem; }
.value-note { margin: -4px 0 18px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--text); font-size: .92rem; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-grid .card { margin-bottom: 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.s1, .bar.s1 { background: var(--series-1); }
.sw.s2, .bar.s2 { background: var(--series-2); }
.chart { position: relative; height: 230px; margin: 8px 0 4px; padding-left: 28px; }
.chart-grid { position: absolute; inset: 0 0 26px 28px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid span { border-top: 1px solid var(--border); position: relative; height: 0; }
.chart-grid span:last-child { border-top-color: var(--border-strong); }
.chart-grid span::before { content: attr(data-v); position: absolute; right: calc(100% + 6px); top: -8px; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-cols { position: absolute; inset: 0 0 0 28px; display: grid; grid-template-columns: repeat(8, 1fr); }
.chart-col { position: relative; display: flex; flex-direction: column; align-items: center; outline: none; border-radius: 6px; }
.chart-col .bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 18%; margin-bottom: 26px; }
.bar { flex: 1; max-width: 16px; min-height: 0; border-radius: 4px 4px 0 0; transition: opacity .12s; }
.chart-x { position: absolute; bottom: 4px; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.chart-col:hover, .chart-col:focus-visible { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.chart-col:hover::after, .chart-col:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% - 20px); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); font-size: .75rem; padding: 6px 9px; border-radius: 7px; width: max-content; max-width: 220px; white-space: normal; z-index: 3; pointer-events: none; box-shadow: var(--shadow); }
.chart-col:first-child:hover::after, .chart-col:first-child:focus-visible::after { left: 0; transform: none; }
.chart-col:last-child:hover::after, .chart-col:last-child:focus-visible::after { left: auto; right: 0; transform: none; }
.table-view summary { cursor: pointer; color: var(--text-2); font-size: .84rem; margin-top: 6px; }
.table-view table { margin-top: 10px; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.activity li:first-child { border-top: 0; padding-top: 2px; }
.act-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.act-ic .ic { width: 16px; height: 16px; }
.act-missed { background: var(--err-soft); color: var(--err); }
.act-in { background: var(--info-soft); color: var(--info); }
.act-review { background: var(--warn-soft); color: var(--warn); }
.act-out { background: var(--ok-soft); color: var(--ok); }
.act-body { flex: 1; min-width: 0; font-size: .9rem; }
.act-body a { color: var(--text); font-weight: 600; }
.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.activity time { white-space: nowrap; }

.demo { margin-top: 18px; border-style: dashed; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ---------- Agency ---------- */
.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 18px; }
.biz-card { color: var(--text); margin: 0; transition: border-color .12s, transform .12s; }
.biz-card:hover { text-decoration: none; border-color: var(--brand); }
.biz-card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.biz-card-head h3 { margin: 0; }
.biz-card-head p { margin: 0; }
.avatar { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 750; flex: none; font-size: .95rem; }
.avatar.sm { width: 34px; height: 34px; border-radius: 50%; font-size: .8rem; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; }
.mini-stats dt { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.mini-stats dd { margin: 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.row-stats { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; height: calc(100vh - 190px); min-height: 480px; }
.inbox .card { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.conv-list { padding: 14px 8px; }
.conv-list .card-head { padding: 0 10px; }
.conv-list ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.conv { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; color: var(--text); }
.conv:hover { background: var(--surface-2); text-decoration: none; }
.conv.on { background: var(--brand-soft); }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-snippet { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-name, .conv.unread .conv-snippet { color: var(--text); font-weight: 700; }
.card.thread { padding: 0; overflow: hidden; }
.thread-empty { display: grid !important; place-items: center; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.thread-head h2 { margin: 0; }
.thread-head p { margin: 0; }
.thread-head .pill { margin-left: auto; }
.back-link { display: none; }
.bubbles { list-style: none; margin: 0; padding: 18px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: min(78%, 520px); display: flex; flex-direction: column; }
.bubble-body { padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .93rem; }
.bubble.in { align-self: flex-start; }
.bubble.in .bubble-body { background: var(--bubble-in); border-bottom-left-radius: 5px; }
.bubble.out { align-self: flex-end; align-items: flex-end; }
.bubble.out .bubble-body { background: var(--bubble-out); color: var(--bubble-out-ink); border-bottom-right-radius: 5px; }
.bubble.err .bubble-body { background: var(--err-soft); color: var(--err); }
.bubble-meta { font-size: .72rem; color: var(--muted); margin-top: 3px; padding: 0 4px; }
.event { align-self: center; display: inline-flex; gap: 6px; align-items: center; font-size: .78rem; color: var(--muted); background: var(--surface-2); padding: 4px 11px; border-radius: 999px; }
.event .ic { width: 13px; height: 13px; }
.st-mock { color: var(--warn); }
.st-failed, .st-blocked, .st-unknown { color: var(--err); }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.composer textarea { flex: 1; resize: none; }

/* ---------- Reviews ---------- */
.reviews-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.reviews-grid .card { margin-bottom: 0; }
.reviews-grid + .card, .reviews-grid + .compliance { margin-top: 18px; }
.csv { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.csv summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--text-2); }
.csv form { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; width: 1%; }
.cell-main { font-weight: 600; }
.feedback { list-style: none; padding: 0; margin: 0; }
.feedback li { padding: 12px 0; border-top: 1px solid var(--border); }
.feedback li:first-child { border-top: 0; }
.feedback p { margin: 4px 0; }
.compliance { margin-top: 18px; max-width: 760px; }
.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.people li:first-child { border-top: 0; }
.people li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Outbox ---------- */
.outbox { list-style: none; padding: 0; margin: 0; }
.outbox li { padding: 14px 0; border-top: 1px solid var(--border); }
.outbox li:first-child { border-top: 0; padding-top: 0; }
.outbox-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.outbox-head time { margin-left: auto; }
.outbox-body { white-space: pre-wrap; overflow-wrap: anywhere; font: .9rem/1.5 var(--font); margin: 6px 0 0; background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .reviews-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .container { padding: 18px 16px 48px; }
  .container-narrow { padding-top: 24px; }
  .topbar-inner, .tabs-inner { padding: 0 16px; gap: 10px; }
  .topbar-inner { height: 54px; }
  .brand span { display: none; }
  .switcher { flex: 1; min-width: 0; }
  .switcher select { min-width: 0; width: 100%; max-width: none; }
  .biz-name { flex: 1; min-width: 0; }
  .who { display: none; }
  .tab { padding: 10px 9px; font-size: .86rem; gap: 5px; }
  .tab .ic { width: 16px; height: 16px; }
  .demo-banner { padding: 8px 16px; font-size: .8rem; justify-content: flex-start; }
  .demo-banner .ic { display: none; }
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; border-radius: 12px; }
  .stats, .stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 1.6rem; }
  .grid-form, .row-2, .demo-grid { grid-template-columns: minmax(0, 1fr); }
  .chart { height: 200px; }
  .chart-col .bars { padding: 0 8%; }
  .chart-x { font-size: .62rem; }
  .chart-col:nth-child(even) .chart-x { visibility: hidden; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); row-gap: 10px; }
  .row-stats { grid-template-columns: repeat(4, 1fr); padding: 10px; }
  .row-stats dd { font-size: 1rem; }
  .row-stats dt { font-size: .64rem; }
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 180px); min-height: 420px; }
  .inbox.has-thread .conv-list { display: none; }
  .inbox:not(.has-thread) .thread { display: none !important; }
  .back-link { display: inline-flex; padding-left: 4px; }
  .thread-head { padding: 10px 12px; gap: 8px; }
  .bubbles { padding: 14px 12px; }
  .bubble { max-width: 88%; }
  .composer { padding: 10px; }
  .composer .btn span { display: none; }
  /* Review table becomes stacked cards */
  .rr-table thead { display: none; }
  .rr-table, .rr-table tbody, .rr-table tr, .rr-table td { display: block; width: 100%; }
  .rr-table tr { padding: 12px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .rr-table tr:last-child { border-bottom: 0; }
  .rr-table td { border: 0; padding: 0; }
  .rr-table td[data-label="Customer"] { grid-column: 1; }
  .rr-table td[data-label="Status"] { grid-column: 2; grid-row: 1; text-align: right; }
  .rr-table td[data-label="When"] { grid-column: 1; color: var(--muted); }
  .rr-table td[data-label="Clicks"] { grid-column: 2; grid-row: 2; text-align: right; }
  .rr-table td[data-label="Clicks"]::after { content: " clicks"; color: var(--muted); font-size: .8rem; }
  .rr-table td.actions { grid-column: 1 / -1; text-align: left; width: auto; }
  .rr-table td.actions:empty { display: none; }
  .page-head { margin-bottom: 14px; }
  .sticky-save .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (forced-colors: active) { .bar { border: 1px solid CanvasText; } .bar.s2 { background: repeating-linear-gradient(135deg, CanvasText 0 2px, Canvas 2px 5px); } }
.mt { margin-top: 16px; }
.sticky-save { border-top: 1px solid transparent; }
@media (max-width: 720px) {
  .tabs-inner { padding: 0 8px; gap: 0; }
  .tab { padding: 10px 7px; font-size: .84rem; }
  .tab .ic { display: none; }
  .inbox { height: calc(100dvh - 180px); }
}

/* ---------- Booking (Pro) ---------- */
.biz-card-head .plan-pill { margin-left: auto; align-self: flex-start; }
.booking-stats { margin-top: -4px; }
.btn-lg { padding: 13px 18px; font-size: 1rem; }
.btn-danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, var(--border-strong)); }
.btn-danger:hover { background: var(--err-soft); }
.danger-text { color: var(--err); }
.btn.disabled { opacity: .35; pointer-events: none; }
.grow { flex: 1; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
textarea.code, input.code { font: .82rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.upgrade { max-width: 720px; padding: 28px; }
.upgrade h1 { margin-top: 12px; }
.checklist { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .ic { color: var(--ok); margin-top: 2px; }

.agenda-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.agenda-bar .date-jump { margin-left: auto; flex-wrap: nowrap; }
.agenda-bar .date-jump input { width: auto; padding: 6px 9px; }
.day-list { padding: 10px; display: grid; gap: 8px; }
.appt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "time name pill" "time meta pill"; gap: 0 14px; align-items: center;
  padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); border-left: 4px solid var(--brand); background: var(--surface); color: var(--text); }
.appt:hover { text-decoration: none; background: var(--surface-2); }
.appt-time { grid-area: time; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .92rem; }
.appt-name { grid-area: name; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-meta { grid-area: meta; color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt .pill { grid-area: pill; }
.appt.st-confirmed { border-left-color: var(--ok); }
.appt.st-completed { border-left-color: var(--border-strong); }
.appt.st-no_show { border-left-color: var(--err); }
.appt.st-cancelled { border-left-color: var(--warn); opacity: .65; }
.appt.st-cancelled .appt-name { text-decoration: line-through; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
.week-day { padding: 10px; margin: 0; display: grid; gap: 6px; min-height: 140px; align-content: start; }
.week-day.is-today { border-color: var(--brand); }
.week-day-head { display: flex; align-items: baseline; gap: 6px; color: var(--text-2); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 0 2px 4px; }
.week-day-head strong { font-size: 1.15rem; color: var(--text); letter-spacing: 0; }
.week-day.is-today .week-day-head strong { color: var(--brand); }
.week .appt { grid-template-columns: minmax(0, 1fr); grid-template-areas: "time" "name" "meta" "pill"; padding: 7px 8px; gap: 1px; font-size: .84rem; }
.week .appt .appt-time { font-size: .8rem; }
.week .appt .appt-time .muted { display: none; }
.week .appt .pill { justify-self: start; margin-top: 3px; }
.week-empty { margin: 4px 2px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0 0 12px; }
.kv dt { font-size: .74rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .03em; }
.kv dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.action-list { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.action-list form { display: contents; }
.msg-log { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.msg-log li { padding: 8px 0; border-top: 1px solid var(--border); }
.msg-log div { overflow-wrap: anywhere; }
.narrow-form { max-width: 760px; }
.demo-booking { border-top: 1px dashed var(--border-strong); padding-top: 16px; }
.svc-admin { list-style: none; padding: 0; margin: 0 0 6px; }
.svc-admin li { border-top: 1px solid var(--border); padding: 10px 0; }
.svc-admin li:first-child { border-top: 0; }
.svc-admin summary { cursor: pointer; }
.svc-admin form { margin-top: 12px; }
.staff-hours { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; display: grid; gap: 12px; justify-items: start; }
.staff-hours .grid-form { width: 100%; align-items: end; }
.hours-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 8px 14px; width: 100%; }
.hours-grid label { flex-direction: row; align-items: center; gap: 10px; font-weight: 550; }
.hours-grid label span { width: 86px; flex: none; color: var(--text-2); }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input span { display: flex; align-items: center; padding: 0 9px; background: var(--surface-2); border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-weight: 450; }
.prefix-input input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.row.inner { margin-top: 10px; align-items: flex-end; }

/* Public booking page: mobile first */
.book-body .container-narrow { max-width: 600px; padding-top: 28px; }
.book-embed { }
.book-body.public .container-narrow:has(.book-embed) { padding: 12px 12px 24px; }
.book-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.book-biz { font-weight: 750; font-size: 1.1rem; }
.book h1 { font-size: 1.3rem; margin: 18px 0 12px; }
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 6px; counter-reset: step; }
.steps li { flex: 1; font-size: .78rem; font-weight: 600; color: var(--muted); padding-top: 8px; border-top: 3px solid var(--border); counter-increment: step; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li::before { content: counter(step) ". "; }
.steps li.done { border-top-color: color-mix(in srgb, var(--brand) 45%, var(--border)); color: var(--text-2); }
.steps li.on { border-top-color: var(--brand); color: var(--brand); }
.svc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.svc { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); color: var(--text); min-height: 64px; }
.svc:hover { text-decoration: none; border-color: var(--brand); }
.svc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.svc-name { font-weight: 650; font-size: 1rem; }
.svc-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: .85rem; color: var(--text-2); white-space: nowrap; }
.chev { font-size: 1.5rem; color: var(--muted); line-height: 1; }
.picked { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 12px 0 0; }
.picked > div { min-width: 0; display: flex; flex-direction: column; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-2); font-size: .88rem; font-weight: 600; background: var(--surface); }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.date-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.date-nav > .btn { padding: 8px 9px; align-self: stretch; }
.dates { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.date { display: flex; flex-direction: column; align-items: center; padding: 7px 0 6px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); line-height: 1.15; }
.date:hover { text-decoration: none; border-color: var(--brand); }
.date.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.date.off { opacity: .4; border-style: dashed; background: transparent; }
.d-wd, .d-mo { font-size: .66rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.d-day { font-size: 1.1rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.slots-title { margin: 22px 0 4px; }
.slot-group { margin: 12px 0 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; }
.slots { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.slot { display: block; text-align: center; padding: 11px 6px; border-radius: 10px; border: 1px solid var(--brand); color: var(--brand); font-weight: 650; background: var(--surface); font-variant-numeric: tabular-nums; }
.slot:hover { text-decoration: none; background: var(--brand); color: var(--brand-ink); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.consent { background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); }
.resched { margin: 12px 0 0; }
.appt-card { text-align: center; padding: 28px 20px; margin-top: 8px; }
.appt-card h1 { margin-top: 6px; }
.appt-card.is-cancelled .appt-when { text-decoration: line-through; color: var(--muted); }
.appt-when { font-size: 1.15rem; font-weight: 700; margin: 4px 0; }
.done-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto; }
.done-mark .ic { width: 30px; height: 30px; }
.center-row { justify-content: center; margin-top: 14px; }
.book-foot { text-align: center; margin-top: 26px; }
.book .card { margin-top: 12px; }

@media (max-width: 1020px) {
  .week { grid-template-columns: minmax(0, 1fr); }
  .week-day { min-height: 0; }
  .week .appt { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "time name pill" "time meta pill"; gap: 0 12px; padding: 9px 12px; }
  .week .appt .pill { justify-self: end; margin-top: 0; }
  .week-empty { display: none; }
}
@media (max-width: 720px) {
  .kv { grid-template-columns: minmax(0, 1fr); }
  .agenda-bar .date-jump { margin-left: 0; }
  .appt { gap: 0 10px; padding: 10px 12px; }
  .appt-time .muted { display: none; }
  .hours-grid { grid-template-columns: minmax(0, 1fr); }
  .book-body .container-narrow { padding: 16px 16px 40px; }
  .dates { gap: 4px; }
  .date { padding: 6px 0 5px; }
  .d-day { font-size: 1rem; }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .svc { padding: 14px; }
}
.nowrap { white-space: nowrap; }
@media (max-width: 720px) {
  .booking-stats .stat:first-child { grid-column: auto; }
}
@media (max-width: 720px) {
  .hours-grid label { flex-direction: column; align-items: stretch; gap: 4px; }
  .hours-grid label span { width: auto; }
}
.notice { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.consent-fields { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0; }
.consent-fields .check.inline { display: inline-flex; margin-right: 12px; }
.consent-log ul { margin: 6px 0 0; padding-left: 18px; }
