/* FawriChat dashboard. Colours are tokens (light + dark); spacing uses logical properties so Arabic mirrors. */
:root {
  --bg: #F3F5F7; --surface: #FFFFFF; --surface-2: #F6F8F9; --line: #E2E7EB; --line-strong: #CCD5DB;
  --ink: #15222B; --ink-2: #3A4A55; --muted: #667682;
  --accent: #0F6E6A; --accent-ink: #FFFFFF; --accent-soft: #E3F1EF; --accent-line: #BCDDD8;
  --warn: #85560A; --warn-soft: #FDF1DA; --warn-line: #EFCF92;
  --bad: #B03F37; --bad-soft: #FBECEA; --ok: #146B45; --ok-soft: #DFF2E7; --now: #D2463A;
  --shadow: 0 1px 2px rgba(16, 32, 40, 0.06), 0 12px 32px -16px rgba(16, 32, 40, 0.28);
  --font: "Manrope", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Manrope", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D1418; --surface: #141E24; --surface-2: #1A262D; --line: #24323B; --line-strong: #34454F;
    --ink: #E3EAEE; --ink-2: #C1CDD4; --muted: #8FA0AB;
    --accent: #3FB5AC; --accent-ink: #052220; --accent-soft: #11302D; --accent-line: #1E5550;
    --warn: #E9B75C; --warn-soft: #33281A; --warn-line: #5B4524;
    --bad: #EC8A80; --bad-soft: #3A1F1D; --ok: #5FCD91; --ok-soft: #13301F; --now: #F06B60;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[dir="rtl"] body { font-family: var(--font-ar); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; }
[dir="rtl"] .icon.dir { transform: scaleX(-1); }
.section-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
[dir="rtl"] .section-label, [dir="rtl"] .nav-label { letter-spacing: 0; }
.boot { height: 100%; display: grid; place-items: center; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
a.btn { text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.07); }
.btn-danger { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); filter: brightness(0.97); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-icon { width: 38px; padding: 0; }
.btn-block { width: 100%; height: 44px; }
.link-btn { background: none; border: 0; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; justify-self: center; cursor: pointer; font-weight: 600; }
input, select, textarea { height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); min-width: 0; }
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field.inline { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field-hint, .form-note { font-size: 12.5px; color: var(--muted); }
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-lead { font-size: 14.5px; }
.form-error { color: var(--bad); font-weight: 600; font-size: 13px; }
.search-input { width: min(320px, 100%); }
.search-input.big { width: 100%; height: 46px; font-size: 16px; margin-bottom: 12px; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.5; }
.pill-neutral { background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 800; flex: none; object-fit: cover; }
.badge { font-style: normal; background: var(--now); color: #fff; font-size: 10.5px; font-weight: 800; border-radius: 999px; min-width: 18px; padding: 0 5px; line-height: 18px; text-align: center; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.chips button.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chips button.attn:not(.on) { border-color: var(--warn-line); color: var(--warn); }
.chips .count { opacity: 0.75; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 48px 16px; color: var(--muted); max-width: 420px; margin: 0 auto; }
.empty h3 { color: var(--ink); font-size: 16px; }
.empty-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.spinner { display: grid; place-items: center; padding: 40px; }
.spinner span { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.shell { height: 100%; }
.shell-desktop { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.shell-tablet { display: grid; grid-template-columns: 72px minmax(0, 1fr); }
.main { overflow: auto; min-width: 0; height: 100%; }
.shell-phone .main { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
.sidebar { background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; padding: 16px 12px 12px; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 18px; letter-spacing: -0.02em; padding: 2px 8px 14px; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--font-ar); font-size: 17px; font-weight: 700; }
.logo-word b { color: var(--accent); font-weight: 800; }
.biz { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 4px; display: grid; }
.biz b { font-size: 13.5px; }
.biz small { color: var(--muted); font-size: 11.5px; }
.nav-group { display: grid; gap: 1px; margin-top: 10px; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 4px 10px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 13.5px;
  background: none; border: 0; width: 100%; cursor: pointer; text-align: start; position: relative; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.on { background: var(--accent-soft); color: var(--accent); }
.nav-text { flex: 1; }
.sidebar-foot { margin-top: auto; display: grid; gap: 1px; padding-top: 12px; border-top: 1px solid var(--line); }
.me { display: flex; gap: 9px; align-items: center; padding: 8px 10px 2px; }
.me span { display: grid; }
.me small { color: var(--muted); font-size: 11.5px; }
.sidebar.compact { align-items: center; padding: 12px 8px; }
.sidebar.compact .logo { padding: 2px 0 12px; }
.sidebar.compact .nav-group { margin-top: 8px; }
.sidebar.compact .nav-item { width: 46px; height: 42px; justify-content: center; padding: 0; }
.sidebar.compact .nav-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sidebar.compact .badge { position: absolute; top: 2px; inset-inline-end: 2px; }
.sidebar.compact .sidebar-foot { justify-items: center; }
.tabs { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabs a, .tabs button { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); background: none; border: 0; padding: 4px; text-decoration: none; cursor: pointer; }
.tabs .on { color: var(--accent); }
.tab-icon { position: relative; display: grid; }
.tab-icon .badge { position: absolute; top: -4px; inset-inline-start: 14px; }
.more { display: grid; gap: 4px; }
.more .nav-group { margin-top: 6px; }

/* ---------- screens ---------- */
.screen { padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.shell-phone .screen { padding: 14px 16px 24px; gap: 12px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h1 { font-size: 22px; font-weight: 800; }
.shell-phone .topbar h1 { font-size: 20px; }
.daynav { display: flex; gap: 6px; align-items: center; }
.date-input { width: 150px; }
.shell-phone .date-input { display: none; }
.shell-phone .topbar { justify-content: space-between; }
.topbar-actions { margin-inline-start: auto; display: flex; gap: 8px; }
.shell-phone .topbar-actions { display: none; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 28px; }
.stats > div { display: grid; }
.stats b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 12.5px; }
.shell-phone .stats { flex-wrap: nowrap; overflow-x: auto; gap: 8px; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.shell-phone .stats > div { flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.shell-phone .stats b { font-size: 16px; }

/* Today: grid */
.today-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.today-body.with-detail { grid-template-columns: minmax(0, 1fr) 360px; }
.grid-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; max-height: calc(100dvh - 176px); }
.grid { display: grid; grid-template-columns: 58px repeat(var(--cols), minmax(170px, 1fr)); }
.grid-corner, .grid-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.grid-corner { inset-inline-start: 0; z-index: 4; }
.grid-head { display: flex; gap: 9px; align-items: center; padding: 10px 12px 12px; border-inline-start: 1px solid var(--line); min-width: 0; }
.grid-head span { display: grid; min-width: 0; }
.grid-head b { font-size: 13.5px; }
.grid-head small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.util { position: absolute; inset-inline: 12px; bottom: 5px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.util::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--u); background: var(--accent); border-radius: 3px; }
.grid-times { position: sticky; inset-inline-start: 0; z-index: 2; background: var(--surface); }
.grid-times span { position: absolute; inset-inline-end: 8px; transform: translateY(3px); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.grid-col { position: relative; border-inline-start: 1px solid var(--line); cursor: cell;
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px calc(var(--hour) / 2), color-mix(in srgb, var(--line) 45%, transparent) calc(var(--hour) / 2) calc(var(--hour) / 2 + 1px), transparent calc(var(--hour) / 2 + 1px) var(--hour)); }
.grid-col > .off { position: absolute; inset-inline: 0; cursor: default; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px); }
.grid-col > .off span { position: absolute; top: 14px; inset-inline: 0; text-align: center; color: var(--muted); font-weight: 700; font-size: 12px; }
.block { position: absolute; inset-inline: 4px; border-radius: 9px; padding: 5px 8px; text-align: start; display: flex; flex-direction: column; gap: 1px; overflow: hidden; cursor: pointer;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink); font-size: 12px; line-height: 1.3; }
.block:hover { filter: brightness(0.98); }
.block.st-pending_deposit { background: var(--warn-soft); border-color: var(--warn-line); }
.block.st-no_show { background: var(--bad-soft); border-color: transparent; opacity: 0.8; }
.block.st-no_show b { text-decoration: line-through; }
.block.sel { box-shadow: 0 0 0 2px var(--accent); z-index: 1; }
.block-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; min-width: 0; }
.block-top b { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block-top .pill { font-size: 10px; padding: 0 6px; }
.block-meta { color: var(--ink-2); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.block.short { padding: 2px 8px; justify-content: center; }
.block.short .block-meta, .block.short .pill { display: none; }
.now-line { position: absolute; inset-inline: 0; height: 2px; background: var(--now); z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; inset-inline-start: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--now); }

/* Today: detail */
.detail-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; position: sticky; top: 0; max-height: calc(100dvh - 176px); overflow: auto; }
.detail { display: grid; gap: 14px; }
.detail-pills { display: flex; gap: 6px; flex-wrap: wrap; min-height: 20px; }
.detail-title { font-size: 21px; font-weight: 800; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.answers-kv { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.sheet .detail-title { display: none; } /* the sheet header already names the service */
.cust-card { display: flex; gap: 11px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.cust-card span { display: grid; min-width: 0; }
.cust-card small { color: var(--muted); font-size: 12px; }
.cust-card.big { border: 0; padding: 0; }
.cust-card.big b { font-size: 16px; }
.detail-actions { display: grid; gap: 8px; }
.action-row { display: flex; flex-wrap: wrap; gap: 6px; }
.action-row .btn { flex: 1 1 auto; }
.confirm { background: var(--warn-soft); border-radius: 12px; padding: 12px; display: grid; gap: 10px; font-size: 13px; color: var(--ink); }

/* Today: phone list */
.daylist { display: grid; gap: 12px; }
.agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.agenda-item { width: 100%; display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 11px 12px; text-align: start; cursor: pointer; }
.agenda-item.st-pending_deposit { border-color: var(--warn-line); }
.agenda-item.st-no_show { opacity: 0.7; }
.agenda-time { display: grid; font-weight: 800; font-variant-numeric: tabular-nums; }
.agenda-time small, .agenda-main small { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.agenda-main { display: grid; min-width: 0; }
.agenda-main b, .agenda-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-pills { display: grid; gap: 4px; justify-items: end; }
.now-row { display: flex; align-items: center; gap: 8px; color: var(--now); font-size: 11.5px; font-weight: 800; padding: 0 4px; }
.now-row::after { content: ""; flex: 1; height: 2px; background: var(--now); border-radius: 2px; }
.fab { position: fixed; inset-inline-end: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; border-radius: 18px; border: 0; z-index: 15;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: var(--shadow); cursor: pointer; }

/* ---------- inbox ---------- */
.screen.inbox { padding: 0; gap: 0; display: grid; height: 100%; min-height: 0; }
.inbox-desktop { grid-template-columns: 340px minmax(0, 1fr) 320px; }
.inbox-tablet { grid-template-columns: 300px minmax(0, 1fr); }
.inbox-phone { display: block; }
.convlist { background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; height: 100%; }
.convlist-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 18px 16px 10px; }
.convlist-head h1 { font-size: 22px; font-weight: 800; }
.convlist .chips { padding: 0 16px 12px; flex-wrap: wrap; }
.convs { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.conv-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line);
  border-inline-start: 3px solid transparent; color: var(--ink); text-decoration: none; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.sel { background: var(--accent-soft); }
.conv-item.attn { border-inline-start-color: var(--warn); }
.conv-main { display: grid; min-width: 0; }
.conv-main b, .conv-prev { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-prev { color: var(--muted); font-size: 12.5px; }
.conv-meta { display: grid; gap: 4px; justify-items: end; }
.conv-meta time { color: var(--muted); font-size: 11px; }
.conv { display: flex; flex-direction: column; min-height: 0; height: 100%; min-width: 0; }
.inbox-phone .conv { height: 100dvh; }
.shell-phone .screen.inbox.has-conv { position: fixed; inset: 0; z-index: 30; background: var(--bg); }
.conv-empty { display: grid; place-items: center; }
.conv-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.conv-who { display: grid; flex: 1; min-width: 0; }
.conv-who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-who small { color: var(--muted); font-size: 12px; justify-self: start; }
.conv-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
.reply { display: grid; gap: 8px; }
.reply textarea { width: 100%; }
.reply-actions { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bot-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); flex-wrap: wrap; }
.bot-note span { display: inline-flex; gap: 8px; align-items: center; }
.ctx { background: var(--surface); border-inline-start: 1px solid var(--line); overflow-y: auto; padding: 20px 18px; }
.context { display: grid; gap: 14px; align-content: start; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.mini-stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.mini-stats dt { color: var(--muted); font-size: 11.5px; }
.mini-stats dd { margin: 0; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.ctx-bookings { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ctx-bookings li { display: flex; justify-content: space-between; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.ctx-bookings a { display: grid; color: var(--ink); text-decoration: none; min-width: 0; }
.ctx-bookings small { color: var(--muted); font-size: 11.5px; }

/* messages */
.thread { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: min(80%, 520px); padding: 8px 12px 5px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; line-height: 1.45; }
.bubble.in { align-self: flex-start; border-start-start-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--accent-soft); border-color: var(--accent-line); border-start-end-radius: 4px; }
.bubble.out.team { background: var(--ok-soft); border-color: transparent; }
.bubble-who { display: flex; gap: 4px; align-items: center; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble time { display: block; text-align: end; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.answers { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; font-size: 12.5px; }
.answers dt { color: var(--muted); text-transform: capitalize; }
.answers dd { margin: 0; font-weight: 600; }
.opts { display: grid; gap: 6px; margin-top: 8px; }
.opts.row { display: flex; flex-wrap: wrap; }
.opt { display: grid; text-align: start; border: 1px solid var(--accent-line); background: var(--surface); border-radius: 10px; padding: 7px 11px; font-size: 13px; color: var(--accent); font-weight: 700; cursor: pointer; }
.opt small { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.opt.static { color: var(--ink-2); cursor: default; border-style: dashed; }
.opt.link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; justify-self: start; }
.photos { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 4px; }
.photos figure { margin: 0; display: grid; gap: 2px; font-size: 11.5px; font-weight: 700; }
.photos img { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; }
.photos small { display: block; color: var(--muted); font-weight: 600; }
.flow { display: grid; gap: 8px; margin-top: 8px; }

/* bot tester */
.sim-top { display: flex; gap: 8px; align-items: end; }
.sim-top .field { flex: 1; }
.sim-thread { background: var(--bg); border-radius: 14px; padding: 14px; margin-top: 12px; min-height: 280px; }
.sim-compose { display: flex; gap: 8px; width: 100%; }
.sim-compose input { flex: 1; }

/* customers */
.cust-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cust-list li + li { border-top: 1px solid var(--line); }
.cust-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; color: var(--ink); text-decoration: none; }
.cust-row:hover { background: var(--surface-2); }
.cust-main { display: grid; min-width: 0; }
.cust-main small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-stats { display: flex; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; }
.shell-phone .cust-row { grid-template-columns: 40px minmax(0, 1fr); }
.shell-phone .cust-stats { grid-column: 2; flex-wrap: wrap; }

/* search */
.results { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 2px; }
.results button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 8px; background: none; border: 0; border-radius: 10px; text-align: start; cursor: pointer; }
.results button:hover { background: var(--surface-2); }
.results span { display: grid; }
.results small { color: var(--muted); font-size: 12px; }
.result-time { font-weight: 800; min-width: 92px; }

/* ---------- set-up, records and admin screens ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.page-title { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; max-width: 72ch; }
.page-title h1 { font-size: 22px; font-weight: 800; }
.shell-phone .page-title h1 { font-size: 20px; }
.page-title p { font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.shell-phone .page-actions { width: 100%; }
.shell-phone .page-actions > * { flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.shell-phone .toolbar .search-input { width: 100%; }
.banner.info { background: var(--accent-soft); color: var(--ink-2); font-weight: 500; }

.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.rows > li + li { border-top: 1px solid var(--line); }
.row-btn, .row-static { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; text-align: start; color: var(--ink); background: none; border: 0; }
.row-btn { cursor: pointer; }
.row-btn:hover { background: var(--surface-2); }
.row-main { display: grid; gap: 1px; flex: 1; min-width: 0; }
.row-main > b, .row-main > small { overflow-wrap: anywhere; }
.row-main > small { color: var(--muted); font-size: 12.5px; }
.row-time { display: grid; min-width: 86px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 13px; }
.row-time small { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.row-side { display: flex; align-items: center; gap: 8px; flex: none; color: var(--muted); font-size: 12.5px; }
.row-side > .icon:last-child { opacity: 0.5; }
.row-side .btn { height: 32px; padding: 0 10px; font-size: 12.5px; }
.row-side .confirm { font-size: 12.5px; }
[dir="rtl"] .row-side > .icon:last-child { transform: scaleX(-1); }
.row-btn.st-cancelled .row-main b, .row-btn.st-no_show .row-main b { color: var(--muted); }
.rows.compact .row-btn, .rows.compact .row-static { padding: 9px 12px; }
.panel .rows { border-radius: 10px; }
.chip-line { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip-line:empty { display: none; }
.mini-chip { font-size: 11px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.clamp.msg-preview { margin-top: 4px; padding-inline-start: 10px; border-inline-start: 2px solid var(--line-strong); color: var(--ink-2); font-size: 13px; -webkit-line-clamp: 1; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.day-group { display: grid; gap: 8px; }
.shell-phone .row-btn, .shell-phone .row-static { flex-wrap: wrap; gap: 6px 12px; padding: 12px 14px; }
.shell-phone .row-side { flex-wrap: wrap; }
.shell-phone .rows .row-static .row-side { width: 100%; justify-content: flex-start; }
.shell-phone .row-time { min-width: 64px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: grid; gap: 12px; align-content: start; }
.shell-phone .panel { padding: 16px; }
.panel > h2, .panel-head h2 { font-size: 16px; font-weight: 800; }
.panel > h2 + p.muted { margin-top: -6px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px; }
.panel-head > div { display: grid; gap: 4px; flex: 1 1 280px; max-width: 72ch; }
.status-panel { grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-inline-start: 4px solid var(--ok); }
.status-panel.is-bad { border-inline-start-color: var(--bad); background: var(--bad-soft); }
.status-panel > div:first-child { display: grid; gap: 4px; }
.status-panel h2 { font-size: 17px; font-weight: 800; }
.shell-phone .status-panel { grid-template-columns: 1fr; }
details.panel > summary { cursor: pointer; list-style-position: inside; }
details.panel > summary b { font-size: 15px; }
.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; font-size: 12.5px; max-height: 420px; overflow: auto; }
.log-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.log-list li.bad { color: var(--bad); }
.log-list time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 88px; }
.log-list small { flex-basis: 100%; padding-inline-start: 98px; overflow-wrap: anywhere; }
.shell-phone .log-list small { padding-inline-start: 0; }
.locked .empty-icon { background: var(--warn-soft); color: var(--warn); }

/* toggle, segmented control, check chips */
.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background 0.15s; margin-top: 1px; }
.toggle-track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: inset-inline-start 0.15s; }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track::after { inset-inline-start: 19px; }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-text { display: grid; gap: 1px; font-weight: 600; }
.toggle-text small { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.toggle.is-disabled { opacity: 0.55; cursor: not-allowed; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; justify-self: start; max-width: 100%; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 13px; color: var(--ink-2); cursor: pointer; min-height: 32px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 32, 40, 0.12), 0 0 0 1px var(--line); }
.check-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.check-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 12px;
  font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.check-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.check-chip.on::before { content: "✓"; font-weight: 800; }
.check-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
button.check-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; direction: ltr; }
fieldset.group { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
fieldset.group legend { font-size: 12.5px; font-weight: 700; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inline-field { display: flex; gap: 8px; }
.inline-field input { flex: 1; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; display: grid; justify-items: start; }
.danger-zone .confirm { width: 100%; }
.photo-edit { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: center; }
.photo-edit .avatar { grid-row: span 2; }

/* weekly hours */
.week { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.week-day { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 8px 12px; min-height: 52px; flex-wrap: wrap; }
.week-day + .week-day { border-top: 1px solid var(--line); }
.week-day.is-off { background: var(--surface-2); }
.week-name { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; min-width: 130px; }
.week-name input { width: 18px; height: 18px; accent-color: var(--accent); }
.week-times { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.week-times input { width: auto; font-variant-numeric: tabular-nums; }

/* offer cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 8px; align-content: start; }
.card.is-paused { background: var(--surface-2); }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: 0.04em; background: var(--accent-soft); color: var(--accent); border-radius: 7px; padding: 2px 8px; direction: ltr; }
.card .action-row { margin-top: 4px; }
.panel .action-row .btn, .card .action-row .btn { flex: 0 1 auto; }

/* settings: sticky save bar */
.screen.settings { padding-bottom: 96px; }
.settings .panel { max-width: 860px; }
.savebar { position: sticky; bottom: 16px; z-index: 10; align-self: center; display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--bg);
  padding: 8px 8px 8px 16px; padding-inline: 16px 8px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 600; margin-top: -8px;
  transform: translateY(20px); opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; }
.savebar.show { transform: none; opacity: 1; pointer-events: auto; }
.savebar span { margin-inline-end: 6px; }
.savebar .btn:not(.btn-primary) { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.shell-phone .savebar { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: 100%; }
.shell-phone .savebar span { flex: 1; font-size: 13px; }
@media (max-width: 767px) {
  .form-row.three { grid-template-columns: 1fr; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .form-row.three { grid-template-columns: 1fr 1fr; }
}

/* ---------- WhatsApp connection ---------- */
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; box-shadow: 0 0 0 2px var(--surface); }
.sidebar.compact .nav-dot { position: absolute; top: 8px; inset-inline-end: 9px; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner .muted { font-weight: 500; }
.wa-connect { gap: 16px; max-width: 760px; }
.wa-hero { display: flex; gap: 14px; align-items: flex-start; }
.wa-hero > div { display: grid; gap: 4px; }
.wa-hero h2 { font-size: 18px; font-weight: 800; }
.wa-badge { width: 48px; height: 48px; border-radius: 14px; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; flex: none; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 2px 12px; }
.steps li::before { content: counter(step); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.steps li span { font-size: 13px; }
.wa-number { font-weight: 700; margin-top: 4px; }
.wa-number.big { font-size: 22px; font-weight: 800; letter-spacing: 0.01em; }
.status-panel h2 .icon { vertical-align: -3px; color: var(--ok); }
.wa-pending { border-inline-start: 4px solid var(--warn); max-width: 760px; }
.wa-pending > div:first-child { display: grid; gap: 4px; }
.wa-pending h2 { font-size: 17px; font-weight: 800; }
.wa-pin { max-width: 320px; }
.wa-pin input { font-size: 18px; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; text-align: center; }
.wa-kv dd { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wa-ids summary, .wa-tech summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.wa-ids .kv, .wa-tech .kv { margin-top: 10px; }
.wa-ids code, .wa-tech code { font-size: 12.5px; overflow-wrap: anywhere; }
.wa-copy { display: flex; align-items: center; gap: 4px; min-width: 0; }
.wa-copy .btn { height: 30px; width: 30px; }
.whatsapp .panel, .whatsapp .banner { max-width: 860px; }
.wa-pay a { display: inline-flex; gap: 4px; align-items: center; font-weight: 600; }
.shell-phone .wa-number.big { font-size: 19px; }
.shell-phone .wa-hero { flex-direction: column; }

/* ---------- sheet: side drawer, bottom sheet on phones ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(8, 18, 22, 0.45); display: flex; justify-content: flex-end; animation: fade 0.15s ease-out; }
.sheet { background: var(--surface); width: min(440px, 100%); height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: slide 0.2s ease-out; }
.sheet-wide { width: min(560px, 100%); }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 8px 20px; padding-inline: 20px 12px; }
.sheet-head h2 { font-size: 18px; font-weight: 800; }
.sheet-body { flex: 1; overflow-y: auto; padding: 6px 20px 18px; }
.sheet-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0.6; } }
[dir="rtl"] .sheet { animation-name: slide-rtl; }
@keyframes slide-rtl { from { transform: translateX(-24px); opacity: 0.6; } }
@media (max-width: 767px) {
  .sheet-wrap { align-items: flex-end; }
  .sheet, .sheet-wide { width: 100%; height: auto; max-height: 92dvh; border-radius: 20px 20px 0 0; animation: rise 0.22s ease-out; }
  [dir="rtl"] .sheet { animation-name: rise; }
  .sheet-grab { display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 8px auto 0; }
  .sheet-foot .btn { flex: 1; height: 44px; }
  .form-row { grid-template-columns: 1fr; }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0.6; } }

/* ---------- login, toasts ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login-card .logo { padding: 0 0 6px; }
.login-card h1 { font-size: 24px; font-weight: 800; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: max-content; max-width: calc(100% - 32px); }
.shell-phone .toasts { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow); }
.toast-bad { background: var(--bad); color: #fff; }
.toast-warn { background: var(--warn-soft); color: var(--warn); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- businesses, team, support view ---------- */
a.biz { color: var(--ink); text-decoration: none; }
.biz-switch { cursor: pointer; }
.biz-switch:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.biz-switch small { color: var(--accent); }
a.me { color: var(--ink); text-decoration: none; border-radius: 9px; padding: 8px 10px; }
a.me:hover, a.me.on { background: var(--surface-2); }
.support-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 20px;
  background: var(--accent-soft); color: var(--accent); border-bottom: 1px solid var(--accent-line); font-size: 13px; font-weight: 700; }
.support-bar span { flex: 1; min-width: 0; }
.support-bar a { color: var(--accent); font-weight: 800; }
.support-bar.is-paused { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.support-bar.is-paused a { color: var(--bad); }
.row-side.wrap { flex-wrap: wrap; justify-content: flex-end; flex-shrink: 1; min-width: 0; }
.biz-list .row-main { flex: 1 1 200px; }
.shell-phone .biz-list .row-btn, .shell-phone .panel .row-static { flex-wrap: wrap; }
.shell-phone .row-side.wrap { justify-content: flex-start; flex-basis: 100%; }
.is-off-row .row-main b { color: var(--muted); }
.seats { border-inline-start: 4px solid var(--accent); }
.seats.is-full { border-inline-start-color: var(--warn); }
.seats.is-over { border-inline-start-color: var(--bad); }
.seats-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 16px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.seats.is-full .meter span { background: var(--warn); }
.seats.is-over .meter span { background: var(--bad); }
.controls { display: grid; gap: 12px; }
.controls > .section-label { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.controls > .section-label small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.biz-row { display: flex; align-items: center; flex-wrap: wrap; }
.biz-row > .row-btn { flex: 1 1 460px; width: auto; min-width: 0; }
.biz-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-inline-end: 16px; }
.biz-actions .btn { height: 32px; padding: 0 10px; font-size: 12.5px; }
.biz-actions .confirm { font-size: 12.5px; max-width: 360px; padding: 8px 0; }
.shell-phone .biz-actions, .shell-tablet .biz-actions { flex-basis: 100%; padding: 0 12px 12px; }
.danger-panel { border-inline-start: 4px solid var(--bad); }
