/*
  Qimma Desk design system (decision 93): the owner's boards in docs/design turned into tokens and
  components. One stylesheet for both directions: layout uses logical properties (inline/block,
  start/end), so dir="rtl" mirrors everything. Colours are custom properties on <body>, redefined for
  the dark theme (data-theme="dark", or "system" with a dark preference). No inline styles anywhere:
  the Content-Security-Policy forbids them; per-page geometry goes in a nonce'd <style> block.
*/

/* ---------- tokens ---------- */
body {
    --ground: #F3F4F6;
    --surface: #FFFFFF;
    --ink: #111827;
    --ink-hover: #2A3447;
    --on-ink: #FFFFFF;
    --muted: #555E6C;
    --border: #D3D7DE;
    --border-soft: #ECEEF1;
    --input-border: #B8BEC8;
    --hover: #F3F4F6;
    --subtle: #F8F9FA;
    --accent: #2F6BFF;
    --accent-hover: #1F58E6;
    --on-accent: #FFFFFF;
    --link: #1E4FD6;
    --link-hover: #163FAF;
    --amber: #F5A524;
    --on-amber: #111827;
    --amber-bg: #FFF6E0;
    --amber-border: #EBD8A8;
    --amber-text: #5C4206;
    --amber-strong: #3D2C04;
    --green: #15803D;
    --green-bg: #E2F3E8;
    --green-text: #14532D;
    --green-border: #7CC59A;
    --done-bg: #ECEEF1;
    --done-text: #4A5260;
    --done-border: #C2C8D1;
    --closed-bg: #DDE1E6;
    --danger: #B42318;
    --on-danger: #FFFFFF;
    --cancel-border: #8A919C;
    --error-bg: #FDECEA;
    --error-border: #E5A29B;
    --error-text: #7A1A12;
    --bubble-out: #D9FDD3;
    --bubble-out-text: #111B21;
    --bubble-who: #2E5C35;
    --bubble-time: #4F6352;
    --grid-line: #E8EBEF;
    --hatch-a: #F3F4F6;
    --hatch-b: #E9ECEF;
    --break-a: #F6F7F8;
    --break-b: #ECEEF1;
    --scrim: rgba(17, 24, 39, 0.28);
    --brand-ground: #0E1524;
    --brand-text: #EEF1F6;
    --brand-muted: #A3ADBE;
    --brand-line: #27334E;
    --brand-grid: #1B2540;
    --brand-accent: #6E97FF;

    --font-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-ar: 'IBM Plex Sans Arabic', 'IBM Plex Sans', 'Segoe UI', Tahoma, sans-serif;
    --font-display: 'Bricolage Grotesque', 'IBM Plex Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --font-mark: 'Inter', 'IBM Plex Sans', system-ui, sans-serif;
    --radius: 6px;
    --track: -0.02em;
    color-scheme: light;
}

body[data-theme="dark"] {
    --ground: #0E1524;
    --surface: #141D30;
    --ink: #EEF1F6;
    --ink-hover: #D5DBE5;
    --on-ink: #0E1524;
    --muted: #A3ADBE;
    --border: #27334E;
    --border-soft: #222C42;
    --input-border: #3A4766;
    --hover: #1B2640;
    --subtle: #111A2B;
    --accent: #6E97FF;
    --accent-hover: #8FB0FF;
    --on-accent: #0E1524;
    --link: #8FB0FF;
    --link-hover: #B3C9FF;
    --amber-bg: #2A2414;
    --amber-border: #4A3E22;
    --amber-text: #E8C77B;
    --amber-strong: #E8C77B;
    --green: #3FBF7F;
    --green-bg: #143A2B;
    --green-text: #9BE5BA;
    --green-border: #2F7A55;
    --done-bg: #222C42;
    --done-text: #B4BDCC;
    --done-border: #3A4766;
    --closed-bg: #222C42;
    --danger: #F2766B;
    --on-danger: #1A0B0A;
    --cancel-border: #6B7891;
    --error-bg: #3A1A17;
    --error-border: #7A2E27;
    --error-text: #F7B4AD;
    --bubble-out: #005C4B;
    --bubble-out-text: #E9EDEF;
    --bubble-who: #A8E6CF;
    --bubble-time: #9CC9BC;
    --grid-line: #1E2940;
    --hatch-a: #0E1524;
    --hatch-b: #1B2540;
    --break-a: #172036;
    --break-b: #222C42;
    --scrim: rgba(0, 0, 0, 0.55);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    body[data-theme="system"] {
        --ground: #0E1524;
        --surface: #141D30;
        --ink: #EEF1F6;
        --ink-hover: #D5DBE5;
        --on-ink: #0E1524;
        --muted: #A3ADBE;
        --border: #27334E;
        --border-soft: #222C42;
        --input-border: #3A4766;
        --hover: #1B2640;
        --subtle: #111A2B;
        --accent: #6E97FF;
        --accent-hover: #8FB0FF;
        --on-accent: #0E1524;
        --link: #8FB0FF;
        --link-hover: #B3C9FF;
        --amber-bg: #2A2414;
        --amber-border: #4A3E22;
        --amber-text: #E8C77B;
        --amber-strong: #E8C77B;
        --green: #3FBF7F;
        --green-bg: #143A2B;
        --green-text: #9BE5BA;
        --green-border: #2F7A55;
        --done-bg: #222C42;
        --done-text: #B4BDCC;
        --done-border: #3A4766;
        --closed-bg: #222C42;
        --danger: #F2766B;
        --on-danger: #1A0B0A;
        --cancel-border: #6B7891;
        --error-bg: #3A1A17;
        --error-border: #7A2E27;
        --error-text: #F7B4AD;
        --bubble-out: #005C4B;
        --bubble-out-text: #E9EDEF;
        --bubble-who: #A8E6CF;
        --bubble-time: #9CC9BC;
        --grid-line: #1E2940;
        --hatch-a: #0E1524;
        --hatch-b: #1B2540;
        --break-a: #172036;
        --break-b: #222C42;
        --scrim: rgba(0, 0, 0, 0.55);
        color-scheme: dark;
    }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: #F3F4F6; -webkit-text-size-adjust: 100%; }
html:has(> body[data-theme="dark"]) { background: #0E1524; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
}
:lang(ar) { font-family: var(--font-ar); }
[lang="ar"] { line-height: 1.7; }
[lang="ar"] body, body:lang(ar) { --track: 0; --font-display: var(--font-ar); }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
img, svg { flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: var(--radius); background: var(--ink); color: var(--on-ink); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; color: var(--on-ink); }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
:lang(ar) .kicker { font-family: var(--font-ar); letter-spacing: 0; text-transform: none; font-size: 13px; }
.label-sm { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
:lang(ar) .label-sm { font-family: var(--font-ar); letter-spacing: 0; text-transform: none; font-size: 12px; }
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: var(--track); line-height: 1.1; }
:lang(ar) .display { font-weight: 700; line-height: 1.3; }
.h1 { font-size: 40px; }
.h2 { font-size: 22px; letter-spacing: -0.01em; line-height: 1.2; }
:lang(ar) .h2 { letter-spacing: 0; }
.h3 { font-size: 15px; font-weight: 600; }

/* ---------- mark ---------- */
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mark svg { direction: ltr; }
.mark .mark-bracket { stroke: var(--ink); }
.mark .mark-line { stroke: var(--accent); }
.mark .mark-node { fill: var(--accent); }
.wordmark { font-family: var(--font-mark); font-size: 19px; letter-spacing: -0.02em; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.wordmark b { font-weight: 700; }
.wordmark span { font-weight: 400; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: var(--radius);
    font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
    background: var(--surface); color: var(--ink); cursor: pointer;
}
.btn:hover { color: inherit; }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-ink:hover { background: var(--ink-hover); color: var(--on-ink); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { border-color: var(--border); font-weight: 500; padding: 0 14px; }
.btn-ghost:hover { background: var(--hover); }
.btn-outline { border-color: var(--ink); padding: 0 16px; }
.btn-outline:hover { background: var(--hover); }
.btn-link { background: transparent; border-color: transparent; color: var(--link); font-weight: 500; padding: 0 10px; }
.btn-link:hover { color: var(--link-hover); background: transparent; }
/* Text links read as links, as on the boards: underlined, semibold, no side padding (the operator's back links keep their arrow look). */
a.btn-link:not(.op-back) { padding-inline: 0; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.card-pad > a.btn-link, .stack-sm > a.btn-link { align-self: flex-start; }
.btn-danger { border-color: var(--danger); color: var(--danger); background: var(--surface); padding: 0 14px; font-weight: 500; }
.btn-icon { width: 44px; padding: 0; border-color: var(--border); }
.btn-icon:hover { background: var(--hover); }
.btn-bare { border: 0; background: transparent; padding: 0; width: 44px; }
.btn-lg { min-height: 50px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--hover); color: var(--muted); border-color: var(--border); cursor: not-allowed; }
.inline-form { display: inline; margin: 0; }

/* chips and segmented groups (filters are links, so they work without script) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--ink);
    font-size: 13px; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.chip:hover { background: var(--hover); color: var(--ink); }
.chip .count { font-family: var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-current="true"], .chip[aria-pressed="true"], .chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; }
.chip[aria-current="true"] .count, .chip[aria-pressed="true"] .count, .chip.is-on .count { color: var(--on-ink); font-weight: 500; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg > a, .seg > button { display: inline-flex; align-items: center; min-height: 42px; min-width: 44px; justify-content: center; padding: 0 16px; border: 0; background: transparent; color: var(--ink); font-size: 14px; text-decoration: none; }
.seg > a:hover, .seg > button:hover { background: var(--hover); color: var(--ink); }
.seg > [aria-current="true"], .seg > [aria-pressed="true"] { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.seg > [aria-current="true"]:hover, .seg > [aria-pressed="true"]:hover { background: var(--ink); color: var(--on-ink); }
.seg-sm > a, .seg-sm > button { min-height: 36px; padding: 0 10px; font-size: 12px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-needs { background: var(--amber); color: var(--on-amber); }
.badge-bot { height: 20px; padding: 0 7px; border: 1px solid var(--done-border); background: var(--surface); color: var(--ink); font-weight: 400; }
.badge-staff { background: var(--ink); color: var(--on-ink); }
.badge-closed { background: var(--closed-bg); color: var(--done-text); font-weight: 400; }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--amber); color: var(--on-amber); font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 4px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.status-confirmed { background: var(--green-bg); color: var(--green-text); }
.status-confirmed::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.status-completed { background: var(--done-bg); color: var(--done-text); }
.status-noshow { background: var(--danger); color: var(--on-danger); font-weight: 600; }
.status-cancelled { height: 24px; padding: 0 9px; border: 1px dashed var(--cancel-border); color: var(--muted); text-decoration: line-through; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.dot-off { background: var(--danger); }
.dot-danger { background: var(--danger); }
.dot-paused { background: var(--cancel-border); }

/* ---------- layout: shell ---------- */
.shell { display: flex; align-items: stretch; min-height: 100vh; }
.sidebar {
    flex: 0 0 236px; position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto;
    background: var(--surface); border-inline-end: 1px solid var(--border); padding: 24px 16px;
    display: flex; flex-direction: column; gap: 24px;
}
.sidebar .mark { padding: 0 8px; }
.tenant-card { display: flex; flex-direction: column; gap: 2px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); line-height: 1.3; }
.tenant-card .name { font-weight: 600; font-size: 14px; }
.tenant-card .meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
/* Tenant switcher (milestone 10, gap G11): the board's card with an up-down chevron, opening a list below it. */
.tenant-switch { position: relative; }
.tenant-switch > summary { list-style: none; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; background: var(--surface); }
.tenant-switch > summary::-webkit-details-marker { display: none; }
.tenant-switch > summary:hover { background: var(--hover); }
.tenant-switch .tenant-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tenant-switch[open] > summary { border-color: var(--ink); }
.tenant-menu { position: absolute; inset-inline: 0; inset-block-start: calc(100% + 4px); z-index: 30; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.tenant-menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tenant-menu .label-sm { padding: 4px 8px 0; }
.tenant-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); text-align: start; cursor: pointer; font: inherit; }
.tenant-choice:hover { background: var(--hover); }
.tenant-choice .name { font-weight: 600; font-size: 14px; }
.tenant-choice .meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius); color: var(--muted); text-decoration: none; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--hover); color: var(--ink); font-weight: 600; }
.nav a .grow { flex: 1; }
.side-status { display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; border-block: 1px solid var(--border); font-size: 13px; }
.side-status p { display: flex; align-items: center; gap: 8px; }
.side-status .side-number { font-size: 12px; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.side-user .who { flex: 1 1 auto; text-decoration: none; color: var(--ink); }
.side-user .who-text .n { overflow-wrap: anywhere; }
.side-user .seg { flex-shrink: 0; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); font-size: 12px; font-weight: 600; flex-shrink: 0; background: var(--surface); }
.avatar-lg { width: 40px; height: 40px; font-size: 13px; background: var(--hover); border: 0; }
.avatar-xl { width: 44px; height: 44px; font-size: 14px; background: var(--hover); border: 0; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who-text .n { font-size: 13px; font-weight: 600; }
.who-text .r { font-size: 12px; color: var(--muted); }
.side-prefs { display: flex; flex-direction: column; gap: 8px; }
.side-prefs form { display: flex; gap: 8px; flex-wrap: wrap; }
.main { flex: 1 1 auto; min-width: 0; padding: 32px 40px 56px; }
.main-flush { padding: 0; }
.page { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.page-wide { max-width: 1200px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 24px; }
.page-head .titles { display: flex; flex-direction: column; gap: 4px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.topbar, .bottom-nav { display: none; }

/* banners */
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--amber-border); background: var(--amber-bg); color: var(--amber-strong); font-size: 14px; }
.banner p { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.banner-danger { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); }
/* Solid banners from the States board: suspended is ink, WhatsApp disconnected is red; both white text and a white button. */
.banner-ink { background: #111827; border-color: #111827; color: #FFFFFF; }
.banner-alert { background: #B42318; border-color: #B42318; color: #FFFFFF; }
body[data-theme="dark"] .banner-ink { background: #26324D; border-color: #3A4766; }
@media (prefers-color-scheme: dark) { body[data-theme="system"] .banner-ink { background: #26324D; border-color: #3A4766; } }
.banner-ink .btn, .banner-alert .btn { background: #FFFFFF; border-color: #FFFFFF; color: #111827; }
.banner-alert .btn { color: #B42318; }
.banner-ink .btn:hover, .banner-alert .btn:hover { background: #F3F4F6; }
.banner-ink .help, .banner-alert .help { color: inherit; opacity: 0.85; }
:lang(ar) .banner-facts .mono { font-family: var(--font-ar); }
:lang(ar) .pct, :lang(ar) .banner-facts .mono { font-family: var(--font-ar); letter-spacing: 0; }
.banner-ink :focus-visible, .banner-alert :focus-visible { outline-color: #FFFFFF; }
.banner-facts { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; font-size: 13px; }
.banner-facts div { display: flex; gap: 6px; }
.banner-facts dt { font-weight: 400; }
.banner-facts dd { margin: 0; font-weight: 600; }
.bottom-nav.tabs-3 { --tabs: 3; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; border: 1px solid var(--border); background: var(--surface); }
.notice-error { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); }
.notice-warn { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-strong); }
.notice-ok { background: var(--green-bg); border-color: var(--green-border); color: var(--green-text); }
.notice-ink { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.notice-ink a { color: var(--on-ink); }
.notice code, .secret { font-family: var(--font-mono); font-size: 15px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--surface); color: var(--ink); direction: ltr; unicode-bidi: isolate; }

/* ---------- cards, lists, tables ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-clip { overflow: hidden; }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .grow { flex: 999 1 620px; min-width: 0; }
.split > .side { flex: 1 1 280px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; }
.dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { text-align: end; }
.dl-plain dt { color: var(--ink); }
.dl-plain dd { color: var(--muted); }
.dl-left { grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; }
.dl-left dd { text-align: start; }
.list-lines > li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.list-lines > li:last-child { border-bottom: 1px solid var(--border); }
.table-wrap { overflow-x: auto; position: relative; } /* contains .sr-only cells, so they cannot widen the page */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 10px 12px; text-align: start; font-weight: 500; border-bottom: 1px solid var(--border); }
.table th:first-child, .table td:first-child { padding-inline-start: 16px; }
.table th:last-child, .table td:last-child { padding-inline-end: 16px; }
.table td { padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table .num { text-align: end; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table tr.is-editing td { background: var(--subtle); }
.cell-main { display: block; font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--muted); }
.empty-row { padding: 32px 20px; color: var(--muted); text-align: center; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.form-grid-4 .span-2 { grid-column: span 2; }
.form-grid-4 .span-4 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.field-strong { font-size: 14px; font-weight: 500; color: var(--ink); }
.input, .select, .textarea {
    width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: var(--radius);
    background: var(--surface); color: var(--ink); font-size: 15px;
}
.select { padding: 0 10px; }
.textarea { padding: 10px 12px; min-height: 88px; resize: vertical; line-height: 1.5; }
[lang="ar"].textarea, .textarea[lang="ar"], .input[lang="ar"] { line-height: 1.7; }
.input[readonly] { background: var(--hover); border-color: var(--border); font-family: var(--font-mono); font-size: 14px; }
.input-lg { min-height: 48px; font-size: 16px; padding: 0 14px; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"], .input-group[aria-invalid="true"] { border: 2px solid var(--danger); }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--input-border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.input-group .input { border: 0; border-radius: 0; min-height: 42px; }
.input-group .addon { display: inline-flex; align-items: center; padding: 0 10px; background: var(--hover); border-inline-end: 1px solid var(--border); font-family: var(--font-mono); font-size: 14px; color: var(--ink); }
.input-group .btn { border-radius: 0; border: 0; border-inline-start: 1px solid var(--border); min-width: 72px; font-size: 13px; font-weight: 500; }
.field-error { color: var(--danger); font-size: 13px; font-weight: 500; }
.date-field > legend { padding: 0; margin-block-end: 6px; }
.date-parts { display: grid; grid-template-columns: minmax(64px, 0.7fr) minmax(120px, 1.6fr) minmax(80px, 0.9fr); gap: 6px; }
.help { font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; color: var(--ink); }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); flex-shrink: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
.fieldset-box { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; }
.fieldset-box > legend { padding: 0 6px; font-weight: 600; }
.legend { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.legend .n { font-family: var(--font-mono); color: var(--ink); font-weight: 600; margin-inline-end: 6px; }
/* switch: a styled checkbox (role=switch), so it posts with the form */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.switch .track { position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--done-border); flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); }
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track::after { inset-inline-start: auto; inset-inline-end: 3px; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.radio-card { display: flex; align-items: center; gap: 12px; padding: 11px 15px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; color: var(--ink); text-decoration: none; }
.radio-card:hover { background: var(--hover); color: var(--ink); }
.radio-card input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.radio-card.is-on, .radio-card:has(input:checked) { border: 2px solid var(--ink); padding: 10px 14px; }
/* The board's radio circle on the service cards (the cards are links, so the circle is drawn). */
.radio-dot { flex-shrink: 0; width: 18px; height: 18px; border: 1.5px solid var(--input-border); border-radius: 50%; background: var(--surface); }
.radio-card.is-on .radio-dot { border: 5px solid var(--ink); }
.radio-card .body { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.radio-card .aside { text-align: end; font-family: var(--font-mono); font-size: 13px; line-height: 1.35; }
.setup-steps { margin-bottom: 16px; }
.setup-steps ol { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.setup-steps a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted); text-decoration: none; font-size: 14px; }
.setup-steps .is-done a { color: var(--green-text); border-color: var(--green-border); background: var(--green-bg); }
.setup-steps .is-current a { color: var(--on-ink); background: var(--ink); border-color: var(--ink); font-weight: 600; }
.slot-hint p { font-size: 14px; }
.format-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.check-block { align-items: flex-start; padding-block: 6px; }
.check-block input { margin-top: 3px; }
.perm-list { list-style: none; margin: 0; padding: 0; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.perm-row:last-child { border-bottom: 0; }
.suggest-box { padding: 16px; border: 1px solid var(--amber-border); background: var(--amber-bg); border-radius: var(--radius); display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.suggest-q { font-size: 16px; font-weight: 600; color: var(--ink); }
.wa-connection { display: flex; flex-direction: column; gap: 10px; }
.wa-share .row { flex-wrap: nowrap; }
.wa-share .input { flex: 1; min-width: 0; }

/* ---------- empty and error states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 48px 28px; text-align: center; }
.empty h2 { font-size: 22px; font-weight: 600; }
.empty p { max-width: 440px; color: var(--muted); }
.empty .icon { color: var(--muted); }
.empty .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.state-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.state-page .card { width: 100%; max-width: 560px; }
.state-code { font-family: var(--font-mono); font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }
.offline-bar { position: fixed; inset-inline: 16px; bottom: 16px; z-index: 40; max-width: 520px; margin-inline: auto; }

/* ---------- auth (login) ---------- */
.auth { display: flex; flex-wrap: wrap; align-items: stretch; min-height: 100vh; }
.auth-brand {
    flex: 1 1 520px; position: relative; overflow: hidden; min-height: 360px; padding: 48px 56px;
    background: var(--brand-ground); color: var(--brand-text); display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.auth-brand .art { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-brand .art .contour { fill: none; stroke: var(--brand-line); }
.auth-brand .art .gridline { stroke: var(--brand-grid); stroke-dasharray: 2 6; }
.auth-brand .art .node { fill: var(--brand-accent); }
.auth-brand > * { position: relative; }
.auth-brand .mark { color: var(--brand-text); gap: 12px; }
.auth-brand .mark .mark-bracket { stroke: var(--brand-text); }
.auth-brand .mark .mark-line { stroke: var(--brand-accent); }
.auth-brand .mark .mark-node { fill: var(--brand-accent); }
.auth-brand .wordmark { font-size: 26px; }
.auth-brand .wordmark span { color: var(--brand-muted); }
.auth-brand .tagline { max-width: 460px; display: flex; flex-direction: column; gap: 16px; }
.auth-brand .tagline .display { font-size: 40px; line-height: 1.15; }
.auth-brand .tagline p:last-child { font-size: 16px; color: var(--brand-muted); }
.auth-brand .coords { display: flex; justify-content: space-between; gap: 16px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--brand-muted); direction: ltr; }
.auth-main { flex: 1 1 480px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-panel { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 28px; }
.auth-panel .display { font-size: 34px; line-height: 1.2; }
.auth-panel form { display: flex; flex-direction: column; gap: 18px; }
.auth-prefs { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.auth-panel .field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.auth-panel .field-head a { font-size: 14px; font-weight: 400; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.auth-or span { flex: 1; border-top: 1px solid var(--border); }
.auth-done { display: flex; flex-direction: column; gap: 14px; }
.auth-foot { padding-top: 18px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }

/* ---------- Today ---------- */
.needs .needs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--amber-bg); border-bottom: 1px solid var(--amber-border); }
.needs .needs-head .lead { display: flex; align-items: center; gap: 14px; }
.needs .needs-head p { font-size: 14px; color: var(--amber-text); }
.needs-count { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 6px; border-radius: var(--radius); background: var(--amber); color: var(--on-amber); font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.needs-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr) 120px auto; gap: 20px; align-items: center; padding: 16px 20px; }
.needs-row + .needs-row { border-top: 1px solid var(--border); }
.needs-row .quote { font-size: 15px; overflow-wrap: anywhere; }
.needs-row .quote:lang(ar) { font-size: 16px; }
.needs-row .why { font-size: 13px; color: var(--muted); }
.wait { display: flex; flex-direction: column; line-height: 1.3; }
.wait .v { font-family: var(--font-mono); font-weight: 600; font-size: 15px; }
.wait .l { font-size: 12px; color: var(--muted); }
.all-clear { display: flex; align-items: center; gap: 12px; padding: 14px 20px; color: var(--muted); }
.all-clear .ok { color: var(--green); }
.all-clear strong { color: var(--ink); font-weight: 600; }

.appts-cols, .appt { display: grid; grid-template-columns: 92px minmax(0, 1.5fr) minmax(0, 1.25fr) minmax(0, 1fr) 128px 152px; gap: 16px; align-items: center; padding: 8px 20px; }
.appts-cols { padding-block: 10px; border-bottom: 1px solid var(--border); }
.appts-cols span:last-child { text-align: end; }
.appt { min-height: 64px; border-top: 1px solid var(--border); }
.appts > li:first-child.appt { border-top: 0; }
.appt .t { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 500; line-height: 1.3; }
.appt .t small, .next .t small { font-size: 12px; color: var(--muted); font-weight: 500; }
.appt .d { font-family: var(--font-mono); font-size: 12px; color: var(--muted); line-height: 1.3; }
.appt .n { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.appt .n s { color: var(--muted); }
.appt .p { font-size: 12px; color: var(--muted); }
.appt .p .now { color: var(--ink); font-weight: 600; }
.appt .svc { font-size: 14px; }
.appt .staff { font-size: 14px; color: var(--muted); }
.appt .acts { display: flex; justify-content: flex-end; gap: 4px; }
.appt .acts .btn-icon { color: var(--ink); }
.now-line { display: flex; align-items: center; gap: 10px; padding: 6px 20px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.now-line::after { content: ""; flex: 1; border-top: 1.5px solid var(--ink); }
.break-line { padding: 8px 20px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); background: var(--subtle); }
.next { margin: 8px 10px; padding: 14px 10px; border: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.next .lbl { padding: 0 10px; font-size: 13px; font-weight: 600; color: var(--link); display: flex; align-items: center; gap: 8px; }
.next .grid { display: grid; grid-template-columns: 92px minmax(0, 1.5fr) minmax(0, 1.25fr) minmax(0, 1fr) 128px; gap: 16px; align-items: center; padding: 0 10px; }
.next .t { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; line-height: 1.1; }
.next .n { font-size: 18px; font-weight: 600; }
.next .svc { font-size: 15px; font-weight: 500; }
.next .acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 0 10px; }
.row-menu { display: none; position: relative; }
.row-menu summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius); cursor: pointer; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu[open] summary { background: var(--hover); }
.row-menu .menu { position: absolute; inset-inline-end: 0; top: 46px; z-index: 10; min-width: 180px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 2px; }
.row-menu .menu .btn { justify-content: flex-start; width: 100%; border: 0; font-weight: 500; }

/* ---------- Bookings ---------- */
.toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; border-radius: var(--radius); background: var(--ink); color: var(--on-ink); font-size: 14px; }
.toast .msg { display: flex; align-items: center; gap: 10px; }
.toast a, .toast .btn-link { color: var(--on-ink); }
.toast p { display: flex; align-items: center; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar .left, .toolbar .right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.legend-list { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); }
.legend-list li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.swatch-confirmed { background: var(--green-bg); border: 1px solid var(--green-border); }
.swatch-completed { background: var(--done-bg); border: 1px solid var(--done-border); }
.swatch-noshow { background: var(--danger); }
.swatch-cancelled { border: 1px dashed var(--cancel-border); }
.cal-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.cal { display: grid; }
.cal-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; }
a.cal-head:hover { background: var(--hover); color: var(--ink); }
.cal-head .dow { font-size: 13px; font-weight: 600; color: var(--muted); }
.cal-head .num { font-family: var(--font-mono); font-size: 13px; }
.cal-head.is-today .dow { color: var(--ink); }
.cal-head.is-today .num { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 13px; background: var(--ink); color: var(--on-ink); font-weight: 600; }
.cal-head .top { display: flex; align-items: center; gap: 8px; }
.cal-head .sub { font-size: 12px; color: var(--muted); }
.cal-head .lanes { display: grid; margin-top: 4px; font-size: 10px; color: var(--muted); text-align: center; }
.cal-corner { border-bottom: 1px solid var(--border); }
.cal-hours { position: relative; }
.cal-hours span { position: absolute; inset-inline-end: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.cal-col { position: relative; border-inline-start: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 64px); }
.cal-closed { position: absolute; inset: 0; background: repeating-linear-gradient(135deg, var(--hatch-a) 0 6px, var(--hatch-b) 6px 12px); display: flex; align-items: center; justify-content: center; }
.cal-closed span, .cal-break span { padding: 4px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; font-size: 13px; color: var(--muted); }
.cal-break { position: absolute; inset-inline: 0; background: repeating-linear-gradient(135deg, var(--break-a) 0 6px, var(--break-b) 6px 12px); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.cal-break span { border: 0; background: transparent; padding: 0; font-size: 12px; }
.ev { position: absolute; box-sizing: border-box; overflow: hidden; padding: 2px 6px; border-radius: 4px; text-align: start; font-size: 12px; line-height: 1.2; display: flex; flex-direction: column; text-decoration: none; }
.ev .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .t { font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.ev .s { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-confirmed { border: 1px solid var(--green-border); background: var(--green-bg); color: var(--green-text); }
.ev-completed { border: 1px solid var(--done-border); background: var(--done-bg); color: var(--done-text); }
.ev-noshow { background: var(--danger); color: var(--on-danger); }
.ev-cancelled { border: 1px dashed var(--cancel-border); background: var(--surface); color: var(--muted); text-decoration: line-through; }
.ev:hover { filter: brightness(0.97); }
.cal-now { position: absolute; inset-inline: 0; height: 0; border-top: 2px solid var(--ink); z-index: 2; }
.cal-now::before { content: ""; position: absolute; inset-inline-start: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px; }
.filters .field { flex: 1 1 160px; }
.panel-page { display: flex; justify-content: center; }
.panel { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 12px 16px 24px; border-bottom: 1px solid var(--border); }
.panel > .body, .panel > form > .body { padding: 20px 24px; display: flex; flex-direction: column; gap: 24px; }
.panel > footer, .panel > form > footer { padding: 16px 24px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip { min-width: 64px; height: 52px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; text-decoration: none; }
.day-chip:hover { background: var(--hover); color: var(--ink); }
.day-chip .dw { font-size: 12px; color: var(--muted); }
.day-chip .dn { font-family: var(--font-mono); font-size: 15px; }
.day-chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.day-chip[aria-current="true"] .dw { color: var(--on-ink); }
.day-chip[aria-current="true"] .dn { font-weight: 600; }
.day-chip.is-closed { color: var(--muted); }
.slot-group { display: flex; flex-direction: column; gap: 6px; }
.slot-group > p { font-size: 12px; color: var(--muted); }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.slot { position: relative; }
.slot input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.slot span { height: 52px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.slot b { font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
.slot small { font-size: 11px; color: var(--muted); }
.slot input:hover + span { background: var(--hover); }
.slot input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.slot input:checked + span b { font-weight: 600; }
.slot input:checked + span small { color: var(--on-ink); }
.slot input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.dashed-note { padding: 14px; border: 1px dashed var(--input-border); border-radius: var(--radius); font-size: 14px; color: var(--muted); }

/* ---------- Conversations ---------- */
.convo { display: flex; align-items: stretch; height: 100vh; }
.convo-list { flex: 0 0 340px; display: flex; flex-direction: column; background: var(--surface); border-inline-end: 1px solid var(--border); min-height: 0; }
.convo-list .head { padding: 24px 20px 12px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--border); }
.convo-list .head .display { font-size: 28px; line-height: 1.15; }
.search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); }
.page-head .search-wide { width: 280px; max-width: 100%; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 14px; color: var(--ink); min-height: 40px; }
.search input:focus-visible { outline-offset: 4px; }
.convo-items { flex: 1; min-height: 0; overflow-y: auto; }
.convo-group { padding: 14px 20px 6px; }
.convo-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-top: 1px solid var(--border-soft); color: var(--ink); text-decoration: none; }
.convo-item:hover { background: var(--hover); color: var(--ink); }
.convo-item[aria-current="true"] { background: var(--border-soft); }
.convo-item[aria-current="true"] .avatar-lg { background: var(--surface); border: 1px solid var(--border); }
.convo-item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.convo-item .top { display: flex; justify-content: space-between; gap: 8px; }
.convo-item .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-item .time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.convo-item .last { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.thread { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--surface); min-height: 0; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.thread-head h2 { font-size: 17px; font-weight: 600; }
.thread-head .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.thread-head .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.waiting-bar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--amber-bg); border-bottom: 1px solid var(--amber-border); font-size: 14px; color: var(--amber-strong); }
.waiting-bar strong { font-weight: 600; }
.messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column-reverse; background: var(--ground); }
.messages ol { padding: 20px 24px; display: flex; flex-direction: column; gap: 8px; }
.day-sep { align-self: center; margin: 8px 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
:lang(ar) .day-sep { font-family: var(--font-ar); letter-spacing: 0; font-size: 12px; text-transform: none; }
.bubble { max-width: 72%; padding: 8px 12px 6px; border-radius: var(--radius); }
.bubble .text { font-size: 15px; white-space: pre-line; text-align: start; overflow-wrap: anywhere; }
.bubble .time { margin-top: 2px; font-family: var(--font-mono); font-size: 11px; text-align: end; }
.bubble-in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-start-start-radius: 2px; }
.bubble-in .time { color: var(--muted); }
.bubble-out { align-self: flex-end; padding-top: 6px; background: var(--bubble-out); color: var(--bubble-out-text); border-start-end-radius: 2px; }
.bubble-out .who { margin-bottom: 2px; font-size: 12px; font-weight: 600; color: var(--bubble-who); display: flex; align-items: center; gap: 5px; }
.bubble-out .time { color: var(--bubble-time); }
.bubble-staff { background: var(--surface); border: 1px solid var(--ink); color: var(--ink); }
.bubble-staff .who { color: var(--ink); }
.bubble-staff .time { color: var(--muted); }
.bubble-failed { border: 2px dashed var(--danger); }
.bubble .media { font-style: italic; color: var(--muted); }
.sys { align-self: center; max-width: 85%; margin: 4px 0; }
.sys p { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius); font-size: 13px; }
.sys-ok p { background: var(--surface); border: 1px solid var(--border); }
.sys-ok svg { color: var(--green); }
.sys-warn p { background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber-strong); }
.sys-info p { border: 1px dashed var(--input-border); color: var(--muted); }
.sys-err p { background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error-text); }
.composer { border-top: 1px solid var(--border); padding: 14px 20px 16px; background: var(--surface); }
.composer form { display: flex; gap: 10px; align-items: flex-end; }
.composer .field { flex: 1; }
.composer .textarea { min-height: 52px; resize: none; }
.composer .btn { min-height: 52px; padding: 0 20px; }
.composer-note { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border: 1px dashed var(--input-border); border-radius: var(--radius); font-size: 14px; color: var(--muted); }
.cust { flex: 0 0 280px; overflow-y: auto; background: var(--surface); border-inline-start: 1px solid var(--border); padding: 24px 20px; display: flex; flex-direction: column; gap: 20px; }
.cust section { display: flex; flex-direction: column; gap: 10px; }
.cust section + section { padding-top: 18px; border-top: 1px solid var(--border); }
.mini-booking { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; }
a.mini-booking:hover { background: var(--hover); color: var(--ink); }
.convo-empty { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--ground); }

/* ---------- Settings ---------- */
.settings { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.settings-nav { flex: 1 1 220px; max-width: 100%; }
.settings-nav ul { display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--radius); color: var(--ink); font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-decoration: none; }
.settings-nav a:hover { background: var(--hover); color: var(--ink); }
.settings-nav a[aria-current="page"] { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.settings-body { flex: 999 1 560px; min-width: 0; }
.settings-body > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.settings-body > header .display { font-size: 24px; line-height: 1.25; }
.settings-body > header p { margin-top: 4px; font-size: 14px; color: var(--muted); max-width: 620px; }
.settings-body > .content { padding: 24px; display: flex; flex-direction: column; gap: 22px; }
.save-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.list-box { border: 1px solid var(--border); border-radius: var(--radius); }
.list-box > li { padding: 14px 16px; }
.list-box > li + li { border-top: 1px solid var(--border-soft); }
.kb-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.kb-item .q { font-weight: 600; }
.kb-item .a { font-size: 14px; color: var(--muted); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.staff-item { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.4fr) auto minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.staff-item.with-alerts { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) auto minmax(0, 1fr) auto auto; }
.day-pills { display: flex; gap: 3px; direction: ltr; }
:lang(ar) .day-pills { direction: rtl; }
.day-pill { width: 24px; height: 28px; border-radius: 3px; background: var(--ink); color: var(--on-ink); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.day-pill.off { width: 22px; height: 26px; background: transparent; border: 1px dashed var(--cancel-border); color: var(--muted); font-weight: 400; }
.edit-box { padding: 16px; background: var(--subtle); border: 1px solid var(--border); border-radius: var(--radius); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.edit-box .span-2 { grid-column: span 2; }
.edit-box .span-4 { grid-column: 1 / -1; }
.staff-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 4px; background: var(--done-bg); color: var(--done-text); font-size: 12px; }
.hours-scale, .hours-day { display: grid; grid-template-columns: 150px minmax(0, 1fr) 200px; gap: 16px; align-items: center; }
.hours-scale { padding: 0 16px; }
.hours-scale .ticks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--muted); direction: ltr; }
.hours-day { padding: 12px 16px; }
.hours-day .day { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.hours-day .ranges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.range { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.range .input { width: 124px; min-height: 36px; padding: 0 6px; font-family: var(--font-mono); font-size: 14px; }
.range .btn-bare { width: 36px; min-height: 36px; }
.bar { position: relative; height: 14px; border-radius: 3px; background: var(--border-soft); direction: ltr; }
.bar span { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--ink); }
.closure-item { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.affected { margin-top: 2px; font-size: 13px; color: var(--amber-text); display: flex; align-items: center; gap: 6px; }
.affected::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.add-box { padding: 18px; border: 1px dashed var(--input-border); border-radius: var(--radius); }
.summary-box { padding: 14px 16px; background: var(--hover); border-radius: var(--radius); font-size: 15px; }
.export-rows > li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.privacy { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

/* ---------- Simulator ---------- */
.sim { display: flex; flex-wrap: wrap; align-items: stretch; gap: 24px; }
.sim-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.sim-side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 16px; }
.sim-chat { min-height: 360px; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 20px 24px; background: var(--ground); border: 1px solid var(--border); border-radius: var(--radius); }
.sim-chat .bubble { max-width: 80%; }
.sim-chat .meta { font-size: 11px; font-family: var(--font-mono); opacity: 0.85; margin-bottom: 2px; }
.sim-chat details { margin-top: 6px; font-size: 12px; }
.sim-chat details summary { cursor: pointer; font-family: var(--font-mono); }
.sim-chat pre { margin: 4px 0; padding: 8px; overflow-x: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 4px; font-size: 11px; white-space: pre-wrap; word-break: break-word; direction: ltr; text-align: left; }
.sim-chat .tool-label { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.sim-chat .tool-error summary { color: var(--danger); }
.sim-send { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.sim-send .field-grow { flex: 1 1 260px; }
.sim-send .field-narrow { flex: 0 1 160px; }
.sim-status { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px; }
.sim-status-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px; background: var(--done-bg); color: var(--done-text); font-size: 12px; font-weight: 600; }
.sim-status-badge.s-Bot { background: var(--surface); border: 1px solid var(--done-border); color: var(--ink); font-weight: 400; }
.sim-status-badge.s-NeedsHuman { background: var(--amber); color: var(--on-amber); }
.sim-status-badge.s-HumanActive { background: var(--ink); color: var(--on-ink); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .main { padding: 28px 24px 48px; }
    .appts-cols, .appt { grid-template-columns: 80px minmax(0, 1.5fr) minmax(0, 1.2fr) 120px 152px; }
    .appts-cols .c-staff, .appt .staff { display: none; }
    .next .grid { grid-template-columns: 80px minmax(0, 1.5fr) minmax(0, 1.2fr) 120px; }
    .next .grid .staff { display: none; }
}

@media (max-width: 760px) {
    body { font-size: 15px; }
    .shell { display: block; padding-bottom: 72px; }
    .sidebar { display: none; }
    .topbar { position: sticky; top: 0; z-index: 20; display: flex; height: 56px; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
    .topbar .biz { display: flex; align-items: center; gap: 8px; min-width: 0; }
    .topbar .biz-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
    .topbar .biz-text .n { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar .biz-text .s { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
    .topbar .tools { display: flex; }
    .topbar .tools a { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; color: var(--ink); }
    .bottom-nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(var(--tabs, 4), minmax(0, 1fr)); height: 72px; padding-bottom: 8px; background: var(--surface); border-top: 1px solid var(--border); }
    .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 12px; text-decoration: none; }
    .bottom-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
    .bottom-nav .ico { position: relative; display: inline-flex; }
    .bottom-nav .count-pill { position: absolute; top: -6px; inset-inline-end: -12px; min-width: 18px; height: 18px; font-size: 11px; }
    .bottom-nav.tabs-3 { --tabs: 3; }
    .main { padding: 20px 16px 24px; }
    .page { gap: 20px; }
    .h1 { font-size: 32px; }
    .page-head .actions .search-wide, .page-head .actions .btn-new { display: none; }
    .banner { padding: 12px 16px; }
    .form-grid, .form-grid-4, .edit-box { grid-template-columns: minmax(0, 1fr); }
    .form-grid-4 .span-2, .edit-box .span-2 { grid-column: auto; }

    .needs .needs-head { padding: 12px 14px; }
    .needs-count { min-width: 34px; height: 34px; font-size: 18px; }

    .next { margin: 0 0 8px; padding: 14px; }
    .next .grid { grid-template-columns: auto minmax(0, 1fr); padding: 0; }
    .next .grid .svc, .next .grid .staff { grid-column: 2; display: block; font-size: 14px; }
    .next .grid .st { display: none; }
    .next .acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0; }
    .next .acts .btn { padding: 0 6px; font-size: 13px; }

    .table-cards thead { display: none; }

    .convo-list { flex: 1 1 auto; border: 0; }
    .convo.has-thread .convo-list { display: none; }
    .convo:not(.has-thread) .thread, .convo:not(.has-thread) .convo-empty { display: none; }
    .bubble { max-width: 86%; }
    .composer form { flex-direction: column; align-items: stretch; }

    .settings-nav { flex-basis: 100%; }
    .settings.has-section .settings-nav { display: none; }
    .settings:not(.has-section) .settings-body { display: none; }
    .settings-nav .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
    .kb-item, .staff-item, .staff-item.with-alerts, .closure-item { grid-template-columns: minmax(0, 1fr); }
    .hours-scale { display: none; }
    .hours-day { grid-template-columns: minmax(0, 1fr); }
    .hours-day .bar { display: none; }

    .auth-brand { flex-basis: 100%; min-height: 0; padding: 28px 24px; gap: 20px; }
    .auth-brand .tagline .display { font-size: 26px; }
    .auth-brand .tagline p:last-child, .auth-brand .coords { display: none; }
    .auth-main { padding: 28px 20px 40px; }
}

@media (prefers-reduced-motion: no-preference) {
    .btn, .chip, .nav a { transition: background-color 0.12s ease; }
}

@media print {
    .sidebar, .topbar, .bottom-nav, .banner { display: none; }
}

/* direction-aware icons (arrows, chevrons) mirror in RTL; the mark never does */
[dir="rtl"] .flip { transform: scaleX(-1); }
.icon { flex-shrink: 0; }
.grow-space { flex: 1; }
.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.main:focus { outline: none; }
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover { color: var(--link); text-decoration: underline; }
.list-top { padding-top: 10px; border-top: 1px solid var(--border); }
.settings-home { flex: 999 1 560px; min-width: 0; }
/* segmented radio group (slot size) */
.seg-radio { position: relative; display: inline-flex; }
.seg-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-radio span { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 64px; padding: 0 12px; font-size: 14px; }
.seg-radio input:hover + span { background: var(--hover); }
.seg-radio input:checked + span { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.seg-radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 760px) { .seg-radios { display: flex; flex-wrap: wrap; } .seg-radio { flex: 1 1 25%; } .seg-radio span { width: 100%; min-width: 0; } }
/* simulator page frame (Simulator board) */
.sim-top { background: var(--surface); border-bottom: 1px solid var(--border); }
.sim-top-inner { max-width: 1280px; margin: 0 auto; padding: 0 32px; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sim-wrap { max-width: 1280px; margin: 0 auto; padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 20px; }
.sim-try { gap: 8px; }
.sim-phone { flex: 0 0 380px; max-width: 100%; height: 760px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.sim-phone-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.sim-phone-head .n { font-weight: 600; font-size: 15px; }
.sim-avatar { width: 40px; height: 40px; border-radius: 50%; background: #111827; display: inline-flex; align-items: center; justify-content: center; }
.sim-avatar .mark-bracket { stroke: #FFFFFF; }
.sim-avatar .mark-line { stroke: #6E97FF; }
.sim-avatar .mark-node { fill: #6E97FF; }
.sim-phone .sim-chat { flex: 1; max-height: none; min-height: 0; border: 0; border-radius: 0; padding: 14px 12px; }
.sim-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px; background: var(--hover); border-top: 1px solid var(--border); }
.sim-compose .select { width: auto; flex: 0 0 auto; min-height: 44px; font-size: 13px; }
.sim-compose .textarea { min-height: 44px; resize: none; border-radius: 22px; padding: 10px 14px; }
.sim-compose .btn { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
.sim-needs { border-color: var(--amber-border); background: var(--amber-bg); color: var(--amber-strong); }
.sim-bookings { list-style: none; margin: 0; padding: 0 16px 8px; }
.sim-booking { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.sim-booking:last-child { border-bottom: 0; }
.sim-booking-time { flex: 0 0 72px; font-size: 13px; }
.sim-booking-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sim-booking.is-new { margin-inline: -8px; padding-inline: 8px; background: var(--green-bg); border-radius: var(--radius); }
.sim-booking-new { font-size: 12px; font-weight: 600; color: var(--green-text); }
.sim-activity { max-height: 420px; overflow-y: auto; padding: 8px 16px 16px; }
.sim-activity details { padding: 6px 0; border-bottom: 1px solid var(--border-soft); font-size: 12px; }
.sim-activity summary { cursor: pointer; font-family: var(--font-mono); direction: ltr; text-align: start; }
.sim-activity pre { margin: 4px 0; padding: 8px; overflow-x: auto; background: var(--subtle); border: 1px solid var(--border); border-radius: 4px; font-size: 11px; white-space: pre-wrap; word-break: break-word; direction: ltr; text-align: left; }
.sim-activity .tool-label { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.sim-activity .tool-error summary { color: var(--danger); }
@media (max-width: 760px) {
    .sim-top-inner, .sim-wrap { padding-inline: 16px; }
    .sim-phone { flex-basis: 100%; height: 70vh; }
}
.auth-panel form.auth-prefs { flex-direction: row; justify-content: flex-end; }
.wordmark-ar { font-family: var(--font-ar); letter-spacing: 0; direction: rtl; }
a.who { color: inherit; text-decoration: none; border-radius: var(--radius); }
a.who:hover { color: inherit; background: var(--hover); }
.convo-list, .cust { min-width: 0; }
.convo-item, .convo-item .body { min-width: 0; overflow: hidden; }
.topbar .biz { color: var(--ink); text-decoration: none; }
@media (max-width: 760px) {
    .next .acts .inline-form { display: block; }
    .next .acts .btn { width: 100%; }
}
@media (max-width: 760px) { .main.main-flush { padding: 0; } }
.convo-item .time { font-family: var(--font-mono); }
.convo-item .time:lang(ar) { font-family: var(--font-ar); }

/* ---------- Operator area (milestone 7, Operator boards) ----------
   A dark top bar instead of the tenant dashboard's sidebar, so an operator page never looks like a tenant's. */
body { --op-bar: #111827; --op-bar-text: #EEF1F6; --op-bar-muted: #A3ADBE; --op-bar-line: #3A4766; --op-near-text: #8A4B00; --op-over-text: #A1121B; --op-tick: #8A919C; }
body[data-theme="dark"] { --op-bar: #0A0F1C; --op-near-text: var(--amber-text); --op-over-text: var(--danger); }
@media (prefers-color-scheme: dark) { body[data-theme="system"] { --op-bar: #0A0F1C; --op-near-text: var(--amber-text); --op-over-text: var(--danger); } }
.op-bar { background: var(--op-bar); color: var(--op-bar-text); border-bottom: 1px solid var(--brand-line); }
.op-bar-inner { max-width: 1320px; margin: 0 auto; padding: 0 32px; min-height: 60px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.op-brand { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.op-mark { display: inline-flex; align-items: center; gap: 10px; direction: ltr; color: var(--op-bar-text); text-decoration: none; }
.op-mark:hover { color: var(--op-bar-text); }
.op-mark .mark-bracket, .op-auth .mark .mark-bracket { stroke: var(--op-bar-text); }
.op-mark .mark-line { stroke: var(--brand-accent); }
.op-mark .mark-node { fill: var(--brand-accent); }
.op-mark .wordmark { font-size: 17px; }
.op-mark .wordmark span, .op-auth .wordmark span { color: var(--op-bar-muted); }
.op-tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; padding: 2px 6px; border: 1px solid var(--op-bar-line); border-radius: 3px; color: var(--op-bar-muted); direction: ltr; }
.op-nav { display: flex; gap: 4px; }
.op-nav a { display: inline-flex; align-items: center; height: 44px; padding: 0 14px; border-bottom: 2px solid transparent; color: var(--op-bar-muted); font-size: 14px; text-decoration: none; }
.op-nav a:hover { color: var(--op-bar-text); }
.op-nav a[aria-current="page"] { border-bottom-color: var(--op-bar-text); color: #FFFFFF; font-weight: 600; }
.op-side { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 12px; color: var(--op-bar-muted); }
.op-side .internal { display: flex; align-items: center; gap: 8px; }
.op-side .seg { background: transparent; border-color: var(--op-bar-line); }
.op-side .seg > button { color: var(--op-bar-muted); }
.op-side .seg > button:hover { background: rgba(255, 255, 255, 0.06); color: var(--op-bar-text); }
.op-side .seg > [aria-pressed="true"], .op-side .seg > [aria-pressed="true"]:hover { background: var(--op-bar-text); color: #111827; }
.op-side .btn-link { color: var(--op-bar-text); }
.op-side .btn-link:hover { color: #FFFFFF; }
.op-who { color: var(--op-bar-text); font-size: 13px; font-weight: 600; }
.op-main { max-width: 1320px; margin: 0 auto; padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 20px; }
.op-main:focus { outline: none; }
.op-narrow { max-width: 560px; }
.op-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.op-head .muted { margin-top: 2px; }
.op-h1 { font-size: 30px; line-height: 1.2; }
.op-back { align-self: flex-start; margin-inline-start: -10px; margin-bottom: -12px; }
.op-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.op-search { display: flex; align-items: center; gap: 8px; width: 240px; min-height: 40px; padding: 0 10px; border: 1px solid var(--input-border); border-radius: var(--radius); background: var(--surface); color: var(--muted); }
.op-search input { flex: 1; min-width: 0; min-height: 38px; border: 0; background: transparent; font-size: 14px; color: var(--ink); }
.op-field { font-size: 12px; gap: 2px; }
.op-field .select { min-height: 40px; font-size: 14px; }
.op-filters .btn { min-height: 40px; }
.op-check { min-height: 40px; }
.op-stats, .op-stats-phone { margin: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.op-stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.op-stats > div, .op-stats-phone > div { padding: 12px 16px; border-inline-start: 1px solid var(--border-soft); min-width: 0; }
.op-stats > div:first-child, .op-stats-phone > div:first-child { border-inline-start: 0; }
.op-stats dt, .op-stats-phone dt { font-size: 12px; color: var(--muted); }
.op-stats dd, .op-stats-phone dd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 600; white-space: nowrap; }
.op-stats-phone { display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.op-table { min-width: 1100px; }
.op-usage-table { min-width: 960px; }
.op-table td { padding-block: 10px; }
.op-usage-col { width: 240px; }
.op-actions-col { text-align: end; white-space: nowrap; }
.op-num { font-size: 13px; }
.op-conn { display: flex; align-items: center; gap: 6px; }
.op-meter { display: flex; flex-direction: column; gap: 5px; }
.op-meter-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.pct { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.pct.is-near { color: var(--op-near-text); }
.pct.is-over { color: var(--op-over-text); }
.usage-bar { position: relative; display: block; height: 6px; border-radius: 3px; background: var(--border-soft); overflow: hidden; }
.usage-bar-lg { height: 8px; border-radius: 4px; }
.usage-bar > span { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--ink); }
.usage-bar.is-near > span { background: var(--amber); }
.usage-bar.is-over > span { background: var(--danger); }
.usage-bar.tick::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 80%; width: 1px; background: var(--op-tick); }
.badge-active { background: var(--green-bg); color: var(--green-text); font-weight: 500; height: 24px; }
.badge-active::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.badge-trial { border: 1px solid var(--input-border); color: var(--ink); font-weight: 400; }
.badge-suspended { background: var(--ink); color: var(--on-ink); height: 24px; }
.badge-pastdue { background: var(--amber); color: var(--on-amber); }
.badge-ended { border-color: var(--amber-border); background: var(--amber-bg); color: var(--amber-strong); }
.op-toast { margin-bottom: 16px; }
.badge-cancelled { background: var(--closed-bg); color: var(--done-text); font-weight: 400; }
.badge-near { background: var(--amber); color: var(--on-amber); font-size: 11px; }
.badge-over { background: var(--danger); color: var(--on-danger); font-size: 11px; }
.text-danger { color: var(--danger); }
.text-danger:hover { color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.btn-danger-solid:hover { background: var(--danger); color: var(--on-danger); filter: brightness(0.94); }
.op-confirm-row td { padding-top: 0; background: var(--surface); }
.op-confirm { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--subtle); }
.op-confirm-danger { background: var(--error-bg); border-color: var(--error-border); }
.op-confirm-text { flex: 1 1 280px; line-height: 1.45; }
.op-confirm-danger .op-confirm-text .strong { color: var(--error-text); }
.op-confirm-text p:last-child { font-size: 13px; }
.op-reason { flex: 1 1 260px; }
.op-reason .input { min-height: 40px; }
.op-cards { display: none; flex-direction: column; gap: 8px; }
.op-cards > li { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.op-card-top { align-items: flex-start; flex-wrap: nowrap; }
.op-card-title { min-width: 0; line-height: 1.35; }
.op-card-title .strong { font-size: 15px; }
.op-card-actions { display: flex; justify-content: flex-end; }
.op-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.op-legend li { display: flex; align-items: center; gap: 6px; }
.op-legend-end { margin-inline-start: auto; }
.op-swatch { width: 18px; height: 6px; border-radius: 3px; background: var(--ink); }
.op-swatch.is-near { background: var(--amber); }
.op-swatch.is-over { background: var(--danger); }
.op-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.op-figures dt { font-size: 12px; color: var(--muted); }
.op-figures dd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 600; }
.op-list > li { font-size: 14px; }
.op-audit > li { padding: 12px 20px; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 2px; }
.op-audit > li:first-child { border-top: 0; }
.op-audit .help { overflow-wrap: anywhere; }
.op-when { font-size: 12px; }
.op-logins { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.op-steps { list-style: decimal; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.op-steps li { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.op-steps li form { align-self: stretch; }
.op-danger-card { border-color: var(--error-border); }
.op-preview dt { font-weight: 600; color: var(--ink); }
.op-preview dd { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ink); }
.op-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.op-file { padding: 10px; min-height: 48px; }
.op-paste { min-height: 220px; font-size: 13px; }
.op-auth .auth-brand { background: var(--op-bar); }
.op-auth .auth-brand .mark { gap: 12px; flex-wrap: wrap; }
.op-auth .op-tag { font-size: 12px; }
@media (max-width: 1100px) {
    .op-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .op-stats > div:nth-child(5) { border-inline-start: 0; }
    .op-stats > div:nth-child(n+5) { border-top: 1px solid var(--border-soft); }
    .op-stats.op-stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .op-bar-inner { padding: 14px 16px 0; min-height: 0; flex-direction: column; align-items: stretch; gap: 8px; }
    .op-mark .wordmark { display: none; }
    .op-nav a { padding: 0 10px; }
    .op-main { padding: 16px 12px 32px; gap: 14px; }
    .op-h1 { font-size: 24px; }
    .op-filters, .op-search { width: 100%; }
    .op-filters .op-field { flex: 1 1 140px; }
    .op-stats { display: none; }
    .op-stats.op-stats-3 { display: grid; }
    .op-stats-phone { display: grid; }
    .op-stats dd, .op-stats-phone dd { font-size: 18px; }
    .op-stats > div, .op-stats-phone > div { padding: 10px 14px; }
    .op-desktop { display: none; }
    .op-cards { display: flex; }
    .op-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .op-legend-end { margin-inline-start: 0; }
}
/* usage bar widths (no inline styles: CSP) */
.bw-0 { inline-size: 0%; }
.bw-1 { inline-size: 1%; }
.bw-2 { inline-size: 2%; }
.bw-3 { inline-size: 3%; }
.bw-4 { inline-size: 4%; }
.bw-5 { inline-size: 5%; }
.bw-6 { inline-size: 6%; }
.bw-7 { inline-size: 7%; }
.bw-8 { inline-size: 8%; }
.bw-9 { inline-size: 9%; }
.bw-10 { inline-size: 10%; }
.bw-11 { inline-size: 11%; }
.bw-12 { inline-size: 12%; }
.bw-13 { inline-size: 13%; }
.bw-14 { inline-size: 14%; }
.bw-15 { inline-size: 15%; }
.bw-16 { inline-size: 16%; }
.bw-17 { inline-size: 17%; }
.bw-18 { inline-size: 18%; }
.bw-19 { inline-size: 19%; }
.bw-20 { inline-size: 20%; }
.bw-21 { inline-size: 21%; }
.bw-22 { inline-size: 22%; }
.bw-23 { inline-size: 23%; }
.bw-24 { inline-size: 24%; }
.bw-25 { inline-size: 25%; }
.bw-26 { inline-size: 26%; }
.bw-27 { inline-size: 27%; }
.bw-28 { inline-size: 28%; }
.bw-29 { inline-size: 29%; }
.bw-30 { inline-size: 30%; }
.bw-31 { inline-size: 31%; }
.bw-32 { inline-size: 32%; }
.bw-33 { inline-size: 33%; }
.bw-34 { inline-size: 34%; }
.bw-35 { inline-size: 35%; }
.bw-36 { inline-size: 36%; }
.bw-37 { inline-size: 37%; }
.bw-38 { inline-size: 38%; }
.bw-39 { inline-size: 39%; }
.bw-40 { inline-size: 40%; }
.bw-41 { inline-size: 41%; }
.bw-42 { inline-size: 42%; }
.bw-43 { inline-size: 43%; }
.bw-44 { inline-size: 44%; }
.bw-45 { inline-size: 45%; }
.bw-46 { inline-size: 46%; }
.bw-47 { inline-size: 47%; }
.bw-48 { inline-size: 48%; }
.bw-49 { inline-size: 49%; }
.bw-50 { inline-size: 50%; }
.bw-51 { inline-size: 51%; }
.bw-52 { inline-size: 52%; }
.bw-53 { inline-size: 53%; }
.bw-54 { inline-size: 54%; }
.bw-55 { inline-size: 55%; }
.bw-56 { inline-size: 56%; }
.bw-57 { inline-size: 57%; }
.bw-58 { inline-size: 58%; }
.bw-59 { inline-size: 59%; }
.bw-60 { inline-size: 60%; }
.bw-61 { inline-size: 61%; }
.bw-62 { inline-size: 62%; }
.bw-63 { inline-size: 63%; }
.bw-64 { inline-size: 64%; }
.bw-65 { inline-size: 65%; }
.bw-66 { inline-size: 66%; }
.bw-67 { inline-size: 67%; }
.bw-68 { inline-size: 68%; }
.bw-69 { inline-size: 69%; }
.bw-70 { inline-size: 70%; }
.bw-71 { inline-size: 71%; }
.bw-72 { inline-size: 72%; }
.bw-73 { inline-size: 73%; }
.bw-74 { inline-size: 74%; }
.bw-75 { inline-size: 75%; }
.bw-76 { inline-size: 76%; }
.bw-77 { inline-size: 77%; }
.bw-78 { inline-size: 78%; }
.bw-79 { inline-size: 79%; }
.bw-80 { inline-size: 80%; }
.bw-81 { inline-size: 81%; }
.bw-82 { inline-size: 82%; }
.bw-83 { inline-size: 83%; }
.bw-84 { inline-size: 84%; }
.bw-85 { inline-size: 85%; }
.bw-86 { inline-size: 86%; }
.bw-87 { inline-size: 87%; }
.bw-88 { inline-size: 88%; }
.bw-89 { inline-size: 89%; }
.bw-90 { inline-size: 90%; }
.bw-91 { inline-size: 91%; }
.bw-92 { inline-size: 92%; }
.bw-93 { inline-size: 93%; }
.bw-94 { inline-size: 94%; }
.bw-95 { inline-size: 95%; }
.bw-96 { inline-size: 96%; }
.bw-97 { inline-size: 97%; }
.bw-98 { inline-size: 98%; }
.bw-99 { inline-size: 99%; }
.bw-100 { inline-size: 100%; }
.op-main .table th.num { font-family: inherit; font-variant-numeric: normal; }

/* Milestone 10: inline small fields (reminder time), handoff alerts on staff rows, delivery marks. */
.field-inline { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; }
.field-inline .select { width: auto; min-width: 120px; }
.alert-toggle { display: flex; align-items: center; gap: 8px; }
.alert-toggle .label-sm { white-space: nowrap; }
.switch-button { position: relative; width: 56px; height: 40px; border: 0; padding: 0; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.switch-button .track { position: relative; display: inline-block; width: 40px; height: 24px; border-radius: 12px; background: var(--input-border); transition: background .15s; }
.switch-button .track::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF; transition: inset-inline-start .15s; }
.switch-button[aria-checked="true"] .track { background: var(--ink); }
.switch-button[aria-checked="true"] .track::after { inset-inline-start: 19px; }
.switch-button:disabled { cursor: not-allowed; opacity: .5; }
.alert-routes { display: flex; flex-direction: column; gap: 10px; }
.alert-route { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 12px 0; border-block-start: 1px solid var(--border); }
.alert-route .who-text { min-width: 200px; flex: 1 1 200px; }
.alert-route .field { flex: 0 1 220px; }
.msg-undelivered { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); font-size: 12px; font-weight: 600; }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notif-list li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.op-template-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
@media (max-width: 700px) { .op-template-form { grid-template-columns: minmax(0, 1fr); } }
.banner-more { font-size: 14px; }
.banner-more > summary { cursor: pointer; font-weight: 600; }
.banner-more p { margin: 6px 0 0; }

/* ---- React app (milestone 11): the confirmation dialog before a destructive action (native <dialog>, focus kept inside) ---- */
dialog.dialog { width: min(420px, calc(100% - 32px)); margin: auto; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
dialog.dialog::backdrop { background: rgb(17 24 39 / 0.45); }
dialog.dialog .row { margin-block-start: 16px; flex-wrap: wrap; }

/* ---------- milestone 14: side-by-side check against the boards ---------- */
/* A quote in the other script keeps its own direction but lines up with the page, as on the Today boards. */
[dir="ltr"] .needs-row .quote { text-align: left; }
[dir="rtl"] .needs-row .quote { text-align: right; }
.settings-nav .count-pill { margin-inline-start: auto; }
.sim-wrap .page-head .titles { flex: 1 1 480px; min-width: 0; }
.sim-wrap .page-head .titles p.row { display: block; }
.sim-wrap .page-head .titles p.row .badge { margin-inline-end: 8px; vertical-align: 1px; }
.sim-phone { border: 10px solid #111827; border-radius: 36px; background: var(--ground); }
.sim-compose .btn { flex: 0 0 44px; }
@media (max-width: 760px) {
    /* Rows of chips and day tiles scroll sideways on a phone instead of wrapping, as on the phone boards. */
    .convo-list .chips, .panel .chips, .panel .day-chips, .settings-body .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; padding-block: 2px; }
    .convo-list .chips::-webkit-scrollbar, .panel .chips::-webkit-scrollbar, .panel .day-chips::-webkit-scrollbar, .settings-body .chips::-webkit-scrollbar { display: none; }
    .convo-list .chips > *, .panel .chips > *, .panel .day-chips > *, .settings-body .chips > * { flex-shrink: 0; }
    .panel .day-chip { min-width: 56px; }

    /* Settings home on a phone: one grouped list with chevrons (Settings phone board). */
    .settings-nav ul { gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
    .settings-nav li + li a { border-top: 1px solid var(--border-soft); }
    .settings-nav a { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: center; align-items: center; column-gap: 12px; min-height: 76px; padding-block: 12px; padding-inline: 16px 44px; border: 0; border-radius: 0; line-height: 1.35; }
    .settings-nav a::after { content: ""; position: absolute; inset-inline-end: 18px; top: 50%; width: 8px; height: 8px; border-block-start: 1.6px solid var(--muted); border-inline-end: 1.6px solid var(--muted); transform: translateY(-50%) rotate(45deg); }
    [dir="rtl"] .settings-nav a::after { transform: translateY(-50%) rotate(-45deg); }
    .settings-nav .title { grid-column: 1; font-weight: 600; font-size: 15px; }
    .settings-nav .sub { grid-column: 1; }
    .settings-nav .count-pill { grid-column: 2; grid-row: 1 / span 2; }

    .sim-phone { border-width: 6px; border-radius: 28px; }
}

/* ---------- milestone 15: the boards' own layouts (decisions 230-240) ----------
   Which layout a phone gets is decided in React (usePhone, the shell's phone-* class); nothing essential depends on :has(). */
.shell { --tabs-h: 72px; }
.main-col { min-height: 100vh; }
.is-flush .main-col { height: 100vh; height: 100dvh; min-height: 0; }
.shell .main.main-flush { min-height: 0; padding: 0; }
.is-flush .convo { height: 100%; }

/* drawer: a panel at the end side over the dimmed page (Bookings board, New booking) */
dialog.drawer-layer { position: fixed; inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: var(--scrim); color: var(--ink); overflow: hidden; }
dialog.drawer-layer::backdrop { background: transparent; }
body.has-drawer { overflow: hidden; }
.drawer { position: absolute; inset-block: 0; inset-inline-end: 0; width: 440px; max-width: 100%; display: flex; flex-direction: column; background: var(--surface); border-inline-start: 1px solid var(--border); }
.drawer:focus { outline: none; }
.drawer .panel { flex: 1; min-height: 0; max-width: none; border: 0; border-radius: 0; background: transparent; }
.drawer .panel > header { padding-block: 16px; }
.drawer .panel > .body, .drawer .panel > .cust { flex: 1; min-height: 0; overflow-y: auto; }
.drawer .panel > form { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.drawer-booking .panel > form { overflow: hidden; }
.drawer-booking .panel > form > .body { flex: 1; min-height: 0; overflow-y: auto; }
.drawer-booking .panel > footer, .drawer-booking .panel > form > footer { flex-shrink: 0; }
.drawer-booking .display.h2, .panel-page .display.h2 { font-size: 24px; }
.drawer .cust { border: 0; padding: 20px 24px 32px; }
@media (max-height: 520px) { .drawer-booking .panel > form { overflow-y: auto; } .drawer-booking .panel > form > .body { flex: none; overflow: visible; } }
/* Slot tiles: one line of staff name, cut short, as on the boards. */
.slot small { max-width: 100%; padding-inline: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-waiting, .btn-waiting:hover { background: var(--hover); border-color: var(--border); color: var(--muted); }
.service-fold { width: 100%; background: var(--surface); text-align: start; font: inherit; }
.service-fold .icon { transition: transform 0.12s ease; }
.service-fold.is-open .icon { transform: rotate(180deg); }
.phone-group { direction: ltr; }
.phone-group .addon { font-size: 15px; white-space: nowrap; }
.phone-group .input { flex: 1; min-width: 0; font-size: 15px; }
.phone-group:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.phone-group .input:focus-visible { outline: none; }

/* empty-state drawings (States boards) and the suspended banner's details */
.illustration { stroke: var(--ink); }
.illustration .accent { stroke: var(--accent); }
.illustration .accent-fill { fill: var(--accent); stroke: none; }
.illustration .paper { fill: var(--surface); }
.banner-more { flex-basis: 100%; }
.banner-more > summary { display: inline-flex; align-items: center; min-height: 36px; text-decoration: underline; text-underline-offset: 3px; }
.banner-more .when-open, .banner-more[open] .when-closed { display: none; }
.banner-more[open] .when-open { display: inline; }
.paused-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 860px; padding-block: 8px 4px; }
.paused-info .h3 { margin-bottom: 8px; }
.paused-info .works { display: flex; align-items: flex-start; gap: 8px; }
.paused-info .works svg { margin-top: 2px; color: #7CC59A; }
.paused-info .works-no svg { color: #F7B4AD; }
.banner .paused-info p { display: block; font-weight: 400; }
.chat-preview { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius); background: var(--ground); color: var(--ink); }
.banner .chat-preview .help { color: var(--muted); opacity: 1; font-size: 12px; margin: 0; }
.banner .chat-preview .bubble { margin: 0; max-width: 92%; padding: 8px 12px; font-size: 14px; }
.chat-preview .bubble .text { font-size: 14px; }

/* opening hours: the header's "Last saved" and Save, the day's name beside its switch, "Copy … to all open days" */
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.header-actions:empty { display: none; }
.settings-body > header > div:first-child { flex: 1 1 320px; min-width: 0; }
.hours-day .day .switch { gap: 0; }
.hours-day .day-text { display: flex; flex-direction: column; line-height: 1.3; }
.hours-day .day-text label { cursor: pointer; }
.copy-days { min-height: 40px; font-size: 13px; }

/* conversations: the waiting time beside the badge; the filters in one row */
.convo-list { flex-basis: 404px; }
.convo-list .head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.convo-list .chips { flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: thin; padding-block: 2px; margin-block: -2px; }
.convo-list .chip { flex-shrink: 0; min-height: 34px; padding: 0 8px; gap: 4px; }
.convo-item .state { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.convo-item .waited { font-size: 12px; color: var(--muted); }
.cust .btn-block + .btn-block { margin-top: 0; }
@media (max-width: 1240px) { .convo-list { flex-basis: 340px; } .cust { flex-basis: 260px; } .drawer .cust { flex-basis: auto; } }

/* operator: the phone's bar holds the mark, "Qimma Labs only", the ⋮ menu, the title and the tabs */
.op-menu { position: relative; display: block; }
.op-bar-top, .op-internal, .op-bar-title { display: none; }

/* a phone's own screen headers (Bookings, Settings and Opening hours phone boards) */
.phone-head { background: var(--surface); border-bottom: 1px solid var(--border); }

@media (max-width: 760px) {
    .shell.phone-full { --tabs-h: 0px; padding-bottom: 0; }
    .phone-tabs .topbar, .phone-full .topbar, .phone-full .bottom-nav { display: none; }
    .phone-tabs .main, .phone-full .main { padding: 0 16px 24px; }
    .main-col { min-height: calc(100vh - var(--tabs-h)); min-height: calc(100dvh - var(--tabs-h)); }
    .is-flush .main-col { height: calc(100vh - var(--tabs-h)); height: calc(100dvh - var(--tabs-h)); min-height: 0; }
    /* A screen that fills the phone keeps the banner to its one sentence; the rest is on Today. */
    .phone-full .banner { padding-block: 8px; font-size: 13px; }
    .phone-full .banner > :not(p:first-child) { display: none; }
    .paused-info { grid-template-columns: minmax(0, 1fr); }

    .phone-head { margin-inline: -16px; padding-inline: 16px; }
    .phone-head-sticky { position: sticky; top: 0; z-index: 20; }
    .phone-head .titles { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
    .phone-head .display { font-size: 28px; line-height: 1.2; }
    .phone-head .tools { display: flex; flex-shrink: 0; }
    .phone-head-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
    .phone-head > .phone-head-row { margin-inline-end: -8px; }
    .phone-head-titles { padding-block: 18px 14px; }
    .phone-head-titles .h1 { font-size: 28px; line-height: 1.2; }
    header.phone-head-sticky.phone-head-row { padding-block: 6px; padding-inline: 4px 12px; }
    header.phone-head-sticky.phone-head-row .display { flex: 1; min-width: 0; font-size: 20px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    header.phone-head-sticky.phone-head-row .tools { align-items: center; gap: 10px; }
    header.phone-head-sticky.phone-head-row .tools .btn { padding: 0 14px; }
    header.phone-head-sticky.phone-head-row .last-saved { max-width: 92px; font-size: 12px; line-height: 1.25; text-align: end; }

    /* Today (Today phone boards) */
    .pt-titles { display: flex; flex-direction: column; gap: 2px; }
    .pt-titles .muted { font-size: 14px; }
    .needs .needs-head p { font-size: 13px; }
    .needs .needs-head .display { font-size: 19px; }
    .needs .needs-head .lead { gap: 12px; line-height: 1.25; }
    .pt-need { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
    .pt-need + .pt-need { border-top: 1px solid var(--border); }
    .pt-need .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
    .pt-need .waited { flex-shrink: 0; font-size: 13px; color: var(--muted); }
    .pt-need .waited .mono { color: var(--ink); font-weight: 600; }
    :lang(ar) .pt-need .waited .mono, :lang(ar) .phone-strip .mono, :lang(ar) .pt-next .svc .mono { font-family: var(--font-ar); }
    .pt-need .quote { font-size: 15px; overflow-wrap: anywhere; }
    .pt-need .quote:lang(ar) { font-size: 16px; }
    [dir="ltr"] .pt-need .quote { text-align: left; }
    [dir="rtl"] .pt-need .quote { text-align: right; }
    .pt-need .end { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .pt-need .end .btn { flex-shrink: 0; padding: 0 16px; }
    .pt-next { display: flex; flex-direction: column; gap: 10px; }
    .in-chair { display: flex; justify-content: space-between; gap: 12px; padding: 0 2px; font-size: 13px; color: var(--muted); }
    .in-chair a { color: var(--ink); }
    .pt-next .next { margin: 0; }
    .pt-next .next .lbl { padding: 0; gap: 6px; }
    .pt-next .next .grid { gap: 0 14px; align-items: start; line-height: 1.4; }
    .pt-next .next .t { grid-row: 1 / span 4; font-size: 24px; }
    .pt-next .next .t small { display: block; font-size: 13px; }
    .pt-next .next .cell-sub.ltr { display: none; }
    .pt-next .next .svc { font-weight: 400; }
    .pt-next .next .svc .cell-sub { color: inherit; font-size: 13px; }
    .pt-next .next .staff { color: var(--muted); }
    .pt-head { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 600; }
    .pt-head .mono { font-weight: 500; }
    .pt-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 4px 6px 14px; border-top: 1px solid var(--border); }
    [dir="rtl"] .pt-row { padding: 6px 14px 6px 4px; }
    .pt-list > li:first-child { border-top: 0; }
    .pt-row .t { flex: 0 0 52px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 500; line-height: 1.2; }
    .pt-row .t span { font-size: 11px; color: var(--muted); }
    .pt-row .who { display: block; flex: 1; min-width: 0; line-height: 1.35; }
    .pt-row .n { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
    .pt-row .p { font-size: 13px; color: var(--muted); }
    .pt-row.is-cancelled .t, .pt-row.is-cancelled .n { color: var(--muted); }
    .pt-row .end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-inline-end: 10px; }
    .pt-row .status { height: 24px; padding: 0 8px; font-size: 12px; }
    .pt-row .row-menu { display: block; flex-shrink: 0; }
    .pt-row .row-menu .menu .btn { min-height: 44px; }
    .pt-card .card-head { padding: 12px 14px; }
    .pt-card > ol, .fold > ol { margin: 0; }
    .fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 14px; cursor: pointer; }
    .fold > summary::-webkit-details-marker { display: none; }
    .fold .fold-text { display: flex; flex-direction: column; line-height: 1.35; }
    .fold > summary .icon { transition: transform 0.12s ease; margin-inline-end: 2px; }
    .fold[open] > summary .icon { transform: rotate(180deg); }
    .fold[open] > summary { border-bottom: 1px solid var(--border); }
    .fold-body { display: flex; flex-direction: column; gap: 14px; padding: 14px; }
    .fold-body .card { border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 14px 0 0; }
    .fold-body > .card:first-child { border-top: 0; padding-top: 0; }

    /* Conversations (Conversations and Chat phone boards) */
    .convo-list .head { padding: 14px 16px 10px; gap: 10px; }
    .convo-list .head-row { margin-inline-end: -8px; min-height: 44px; }
    .convo-list .chip { min-height: 36px; padding: 0 12px; }
    .convo-list .chips { gap: 6px; scrollbar-width: none; margin-block: 0; }
    .convo-list .convo-group { padding: 12px 16px 6px; }
    .convo-group-needs { background: var(--amber-bg); border-bottom: 1px solid var(--amber-border); }
    .convo-item { padding: 12px 16px; }
    .convo-item .avatar-lg { width: 44px; height: 44px; font-size: 14px; }
    .convo-items .is-waiting .convo-item { background: #FFFCF4; }
    body[data-theme="dark"] .convo-items .is-waiting .convo-item { background: #1A1D22; }
    .convo-items .is-waiting .time { color: var(--ink); font-weight: 600; }
    .convo-items .is-waiting .last { color: var(--ink); font-size: 15px; }
    .thread-head { padding: 6px 4px; flex-wrap: nowrap; }
    .thread-head > .who { flex: 1; gap: 6px; }
    .thread-head .who-text { flex: 1; line-height: 1.3; }
    .thread-head h2 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .thread-head .meta { font-size: 12px; }
    .thread-head .avatar-xl { width: 40px; height: 40px; margin-inline-end: 4px; }
    .phone-strip { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
    .phone-strip.is-waiting { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber-strong); }
    .phone-strip p { display: flex; align-items: center; gap: 8px; font-size: 14px; }
    .phone-strip p > span:last-child { min-width: 0; overflow-wrap: anywhere; }
    .phone-strip .btn { min-height: 48px; font-size: 15px; }
    .messages ol { padding: 16px 12px; }
    .bubble { max-width: 80%; }
    .composer { padding: 10px 12px 12px; }
    .cust { flex-basis: auto; }
    .drawer-customer { width: min(360px, 100% - 40px); }

    /* Bookings (Bookings phone board) */
    .phone-head.phone-head-sticky:not(.phone-head-row) { display: flex; flex-direction: column; gap: 12px; padding-block: 14px 12px; }
    .day-tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-inline: -6px; }
    .day-tile { height: 60px; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1.1; color: var(--ink); text-decoration: none; overflow: hidden; }
    .day-tile:hover { background: var(--hover); color: var(--ink); }
    .day-tile .dw { font-size: 11px; color: var(--muted); white-space: nowrap; }
    .day-tile .dn { font-family: var(--font-mono); font-size: 15px; }
    .day-tile .dc { font-size: 10px; color: var(--muted); }
    .day-tile.is-today .dn { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
    .day-tile.is-closed { color: var(--muted); background: repeating-linear-gradient(135deg, var(--break-a) 0 5px, var(--break-b) 5px 10px); }
    .day-tile[aria-current="true"] { background: var(--ink); color: var(--on-ink); }
    .day-tile[aria-current="true"] .dw, .day-tile[aria-current="true"] .dc { color: var(--on-ink); }
    .day-tile[aria-current="true"] .dn { font-weight: 600; text-decoration: none; }
    .chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; padding-block: 2px; }
    .chips-scroll::-webkit-scrollbar { display: none; }
    .chips-scroll > * { flex-shrink: 0; }
    .day-list { margin-inline: -4px; margin-block-start: -20px; padding-block: 12px 88px; }
    .day-list ol { display: flex; flex-direction: column; gap: 6px; }
    .day-row { display: flex; align-items: stretch; gap: 10px; }
    .day-row > .t { flex: 0 0 52px; padding-top: 6px; font-family: var(--font-mono); font-size: 13px; line-height: 1.2; }
    .day-row.is-past > .t { color: var(--muted); }
    :lang(ar) .day-row > .t span { font-family: var(--font-ar); font-size: 11px; }
    .day-card { flex: 1; min-width: 0; min-height: 56px; display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--ink); text-decoration: none; }
    .day-card:hover { color: inherit; filter: brightness(0.98); }
    .day-card.is-long { min-height: 90px; }
    .day-card .txt { min-width: 0; line-height: 1.35; }
    .day-card .n { display: block; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
    .day-card .p { font-size: 12px; }
    .day-card .st { flex-shrink: 0; align-self: center; font-size: 12px; }
    .day-card .nx { display: block; font-size: 11px; font-weight: 600; color: var(--link); }
    .day-card.is-confirmed { border-color: var(--green-border); background: var(--green-bg); color: var(--green-text); }
    .day-card.is-completed { border-color: var(--done-border); background: var(--done-bg); color: var(--done-text); }
    .day-card.is-noshow { border-color: var(--danger); background: var(--danger); color: var(--on-danger); }
    .day-card.is-noshow .st { font-weight: 600; }
    .day-card.is-cancelled { border: 1px dashed var(--cancel-border); background: var(--surface); color: var(--muted); }
    .day-card.is-cancelled .st { text-decoration: line-through; }
    .day-card.is-next { border: 2px solid var(--accent); background: var(--surface); color: var(--ink); }
    .day-card.is-next .p { color: var(--muted); }
    .day-card.is-next .st { color: var(--green-text); }
    .now-mark { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
    .now-mark > span:first-child { flex: 0 0 52px; }
    .now-mark .line { flex: 1; border-top: 2px solid var(--ink); }
    .day-break { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
    .day-break .t { flex: 0 0 52px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
    .day-break .box { flex: 1; padding: 10px; border-radius: 4px; background: repeating-linear-gradient(135deg, var(--break-a) 0 6px, var(--break-b) 6px 12px); color: var(--muted); font-size: 12px; text-align: center; }
    .fab { position: fixed; inset-inline-end: 16px; bottom: 88px; z-index: 15; display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px; border-radius: 26px; background: var(--ink); color: var(--on-ink); font-size: 15px; font-weight: 600; text-decoration: none; }
    .fab:hover { background: var(--ink-hover); color: var(--on-ink); }
    .phone-head ~ .stack { padding-block: 0 72px; }
    .phone-head ~ .toast, .toast + .phone-head { margin-block-start: 0; }
    .main > .page > .toast { margin-block-start: 12px; }
    .drawer.sheet { inset-block: auto 0; inset-inline: 0; width: auto; max-height: 92%; border: 0; border-radius: 12px 12px 0 0; }
    .drawer.sheet .filters { flex-direction: row; align-items: stretch; padding: 16px 16px 24px; }
    .drawer.sheet .filters .field { flex: 1 1 100%; }
    .drawer.sheet .filters .btn { flex: 1 1 40%; }

    /* New booking (New booking phone board): its own screen, the header and the button in view while the form scrolls */
    .phone-full .panel-page { flex: 1; margin-inline: -16px; margin-bottom: -24px; }
    .panel-page .panel { max-width: none; min-height: 100vh; min-height: 100dvh; border: 0; border-radius: 0; }
    .panel-page .panel > form { flex: 1; display: flex; flex-direction: column; }
    .panel-page .panel > form > .body { flex: 1; gap: 22px; }
    .panel-page .panel > header { position: sticky; top: 0; z-index: 10; padding: 8px 4px 8px 16px; background: var(--surface); }
    [dir="rtl"] .panel-page .panel > header { padding: 8px 16px 8px 4px; }
    .panel-page .display.h2 { font-size: 22px; }
    .panel-page .panel > form > footer { position: sticky; bottom: 0; z-index: 10; padding: 12px 16px 20px; gap: 8px; background: var(--surface); }
    .panel-page .panel > form > footer .muted { font-size: 13px; }
    .panel > header { padding: 12px 8px 12px 16px; }
    .panel > .body, .panel > form > .body { padding: 16px; }
    .panel-page .day-chip { min-width: 60px; height: 56px; }
    .panel-page .input { min-height: 48px; font-size: 16px; }
    .panel-page .input-group .input { min-height: 46px; }

    /* Settings: the list, and a section with its own header (Settings and Opening hours phone boards) */
    .phone-head-titles + .card { margin-block-start: -4px; padding: 14px; }
    .status-line { line-height: 1.5; }
    .settings-screen { display: flex; flex-direction: column; }
    .settings-screen .content { display: flex; flex-direction: column; gap: 16px; padding-block: 16px; }
    .settings { gap: 16px; }
    .settings-body > .hours-scale, .settings-screen .chips { margin-block: 0; }
    .settings-screen .hours-scale { display: none; }
    .settings-screen .list-box { background: var(--surface); }
    .settings-screen .hours-day { display: flex; flex-direction: column; gap: 8px; padding-block: 10px 12px; padding-inline: 16px 8px; }
    .settings-screen .hours-day .day { flex-direction: row-reverse; justify-content: space-between; align-items: center; width: 100%; font-weight: 400; }
    .settings-screen .hours-day .day .switch { width: 56px; justify-content: center; }
    .settings-screen .hours-day .day-sum { font-size: 13px; color: var(--muted); }
    .settings-screen .hours-day .ranges { width: 100%; }
    .settings-screen .hours-day .ranges .muted { font-size: 14px; }
    .settings-screen .hours-day .bar { display: none; }
    .settings-screen .add-shift { min-height: 44px; padding-inline: 0; }
    .range { display: flex; width: 100%; gap: 6px; padding: 0; border: 0; background: transparent; }
    .range label { flex: 1 1 0; min-width: 0; }
    .range .input { width: 100%; min-height: 44px; padding: 0 6px; font-size: 15px; }
    .range .btn-bare { width: 44px; min-height: 44px; flex-shrink: 0; }
    .copy-days { width: 100%; min-height: 46px; background: var(--surface); font-size: 14px; }

    /* Operator (Operator phone board) */
    .op-bar-inner { padding: 14px 16px 0; min-height: 0; gap: 8px; }
    .op-bar-top { display: flex; align-items: center; gap: 8px; }
    .op-bar-top .op-mark { flex: 0 0 auto; }
    .op-internal { display: block; margin-inline-start: auto; font-size: 12px; color: var(--op-bar-muted); }
    .op-bar-title { display: block; }
    .op-bar-title .op-h1 { color: var(--op-bar-text); overflow-wrap: anywhere; }
    .op-bar .op-menu { margin: -10px -10px -10px 0; }
    [dir="rtl"] .op-bar .op-menu { margin: -10px 0 -10px -10px; }
    .op-menu summary { color: var(--op-bar-text); }
    .op-menu[open] summary { background: rgba(255, 255, 255, 0.08); }
    .op-menu .menu { padding: 12px; gap: 10px; color: var(--ink); }
    .op-menu .seg { align-self: flex-start; border-color: var(--border); }
    .op-menu .seg > [aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
    .op-menu .op-who { display: block; color: var(--ink); }
    .op-menu .btn-link { justify-content: flex-start; color: var(--link); padding-inline: 0; }
    .op-bar .op-nav { margin-inline: -4px; }
}
/* Touch: nothing to press is smaller than 44 px. Chips and names keep the board's size and get a taller area around it. */
@media (max-width: 760px) {
    .btn-sm, .op-filters .btn, .copy-days, .check, .op-check, .seg > a, .seg > button, .seg-sm > a, .seg-sm > button, .banner-more > summary, .sim-activity summary { min-height: 44px; }
    .sim-activity summary { display: flex; align-items: center; }
    .switch-button { height: 44px; }
    .topbar .biz { min-height: 44px; }
    .op-bar-top .op-mark { min-height: 44px; margin-block: -10px; }
    .chip, .pt-row .who, .pt-next .next .n, .in-chair a, .op-card-title, .cell-main { position: relative; }
    .chip::after, .pt-row .n a::after, .pt-next .next .n a::after, .in-chair a::after, .op-card-title a::after, a.cell-main::after { content: ""; position: absolute; inset-inline: 0; inset-block: -12px; }
    .chip::after { inset-block: -5px; }
    .chips-scroll, .convo-list .chips, .panel .chips, .settings-body .chips, .settings-screen .chips { padding-block: 5px; margin-block: -5px; }
    .op-filters { gap: 10px 14px; }
}
@media (max-width: 760px) and (prefers-color-scheme: dark) {
    body[data-theme="system"] .convo-items .is-waiting .convo-item { background: #1A1D22; }
}
/* With the keyboard open there is little height left: what floats joins the page instead of covering it. */
@media (max-width: 760px) and (max-height: 460px) {
    .bottom-nav { position: static; }
    .shell { --tabs-h: 0px; padding-bottom: 0; }
    .fab { position: static; margin: 8px 0 16px; align-self: flex-start; }
    .phone-head-sticky, .panel-page .panel > header, .panel-page .panel > form > footer { position: static; }
}
/* Arabic words are not set in the mono font (dates and waiting times). */
:lang(ar) .wait .v, :lang(ar) .mini-booking .mono { font-family: var(--font-ar); }
