:root {
  /* WhatsApp's palette: white and light grey, its greens, the beige chat background, the light-green outgoing bubble */
  --paper: #f0f2f5;
  --surface: #ffffff;
  --ink: #111b21;
  --muted: #667781;
  --line: #e9edef;
  --hair: #f0f2f5;
  --bot: #008069;        /* text, links, icons, buttons */
  --green: #1daa61;      /* badges, the active tab */
  --bot-tint: #d9fdd3;   /* outgoing bubbles, what's selected */
  --wall: #efeae2;       /* behind a chat */
  --tick: #53bdeb;       /* the blue ✓✓ */
  --you: #008069;
  --you-tint: #d9fdd3;
  --alert: #ea0038;
  --alert-tint: #fde8ec;
  --warn: #b7791f;
  --radius: 12px;
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Hebrew", "Helvetica Neue", Arial, sans-serif;
  --text: var(--display);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--text); }
a { color: var(--bot); }
[hidden] { display: none !important; }  /* a class that sets display must never un-hide an element */
:focus-visible { outline: 3px solid var(--bot); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
.muted, small { color: var(--muted); }
small { font-size: .85em; font-weight: 400; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar */
.bar { display: flex; align-items: center; gap: 2rem; padding: .9rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font: 700 1.35rem/1 var(--display); color: var(--ink); text-decoration: none; white-space: nowrap; }
.bar nav { display: flex; gap: .3rem; flex: 1; overflow-x: auto; }
.bar nav a { padding: .45rem .8rem; border-radius: 999px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.bar nav a:hover { background: var(--paper); }
.bar nav a[aria-current="page"] { background: var(--bot-tint); color: #0a6b53; font-weight: 600; }
.out button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; }
main { max-width: 1120px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.flash { background: var(--bot-tint); border-inline-start: 4px solid var(--bot); padding: .7rem 1rem; border-radius: 6px; margin: 0 0 1.5rem; }
.flash.warn { background: var(--alert-tint); border-color: var(--alert); }
.group { scroll-margin-top: 5.5rem; }  /* opened at a section: clear of the sticky bar */
.error { color: var(--alert); }
.empty { color: var(--muted); }
.okline { color: var(--bot); font-weight: 600; }

/* ---------- the diary: appointments by day, clean */
.cal { max-width: 720px; margin: 0 auto; }
.cal-src { color: var(--muted); font-size: .9rem; margin: 0 .25rem .1rem; }
.cal-src b { color: var(--ink); font-weight: 600; }
.cal [data-calfilter] { margin: 0 0 .6rem; }
.calday { margin: 0 0 1rem; }
.calday h3 { display: flex; align-items: baseline; gap: .6rem; margin: 0 .25rem .45rem; font-size: 1.05rem; }
.calday h3 small { color: var(--muted); font-size: .85rem; font-weight: 400; }
.calday ol { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: 0 1px 0 var(--line); overflow: hidden; }
.calday li + li { border-top: 1px solid var(--line); }
.calday li > a, .calday li > div { display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; color: inherit; text-decoration: none; min-height: 56px; }
.calday li > a:hover { background: var(--paper); }
.calday .t { display: grid; width: 3.2rem; flex: none; font-variant-numeric: tabular-nums; line-height: 1.2; }
.calday .t b { font-size: 1.05rem; }
.calday .t small { color: var(--muted); font-size: .8rem; }
.calday .n { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.calday .n b { font-weight: 500; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calday .n small { font-size: .8rem; }
.calday .by-bot { color: var(--bot); }
.calday .by-hand { color: var(--muted); }
.calday li.done { opacity: .55; }
.calday .chev { width: 18px; height: 18px; flex: none; fill: none; stroke: #b0bec5; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cal-empty { text-align: center; padding: 2.5rem 1rem; background: var(--surface); border-radius: var(--radius); }
.cal .wa-banner { margin: 0 0 1rem; }
.cal-log { margin-top: 1.5rem; }
.cal-log summary { cursor: pointer; color: var(--muted); font-size: .92rem; padding: .4rem .25rem; }
.activity { list-style: none; padding: .2rem 1rem; margin: .4rem 0 0; background: var(--surface); border-radius: var(--radius); }
.activity li { padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.activity li:last-child { border-bottom: 0; }
.activity time { display: block; color: var(--muted); font-size: .78rem; direction: ltr; text-align: end; }
.activity li.k-alert { color: var(--alert); }

/* ---------- the chats, like WhatsApp */
main:has(> .wa) { max-width: none; padding: 0; }
.wa { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); height: calc(100vh - 67px); background: var(--surface); }
.wa .list { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); background: var(--surface); }
.wa-top { padding: .6rem .75rem 0; }
.wa-search { display: flex; align-items: center; gap: .6rem; margin: 0; height: 38px; padding: 0 .8rem; border-radius: 10px; background: var(--paper); font-weight: 400; }
.wa-search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.wa-search input { border: 0; background: none; padding: 0; min-height: 0; height: 100%; font-size: .95rem; outline: none; }
.wa-search:focus-within { box-shadow: 0 0 0 2px var(--bot); }
.wa-search input::-webkit-search-cancel-button { display: none; }
.wa-chips { display: flex; gap: .5rem; padding: .6rem 0 .5rem; overflow-x: auto; scrollbar-width: none; }
.wa-chips button { flex: none; border: 0; border-radius: 999px; background: var(--paper); color: var(--muted); padding: .35rem .85rem; font: 500 .9rem var(--text); cursor: pointer; }
.wa-chips button[aria-pressed="true"] { background: var(--bot-tint); color: #0a6b53; font-weight: 600; }
.wa-banner { display: grid; gap: .1rem; margin: .1rem .75rem .5rem; padding: .7rem .9rem; border-radius: 10px; background: #fff6d6; color: #5c4400; text-decoration: none; font-size: .92rem; }
.wa-banner.bad { background: var(--alert-tint); color: #8a0022; }
.wa-banner span { text-decoration: underline; }
.wa-today { display: grid; grid-template-columns: 49px 1fr auto; gap: 0 .9rem; align-items: center; padding: .55rem 1rem; color: inherit; text-decoration: none; }
.wa-today .ic { width: 49px; display: grid; place-items: center; color: var(--bot); }
.wa-today .ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wa-today b { display: block; font-weight: 600; }
.wa-today small { color: var(--muted); font-size: .85rem; }
.wa-today .chev { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wa-today:hover { background: var(--paper); }
.rows { flex: 1; overflow-y: auto; }
.rows button { position: relative; display: grid; grid-template-columns: 49px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: .9rem; align-items: center;
  width: 100%; padding: .6rem 1rem; background: none; border: 0; text-align: start; font: inherit; color: inherit; cursor: pointer; }
.rows button::after { content: ""; position: absolute; bottom: 0; inset-inline: calc(1rem + 49px + .9rem) 0; border-bottom: 1px solid var(--line); }
.rows button:hover, .rows button[aria-current="true"] { background: var(--paper); }
.av { grid-row: 1 / span 2; width: 49px; height: 49px; display: block; }
.av svg { width: 100%; height: 100%; display: block; }
.av img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; background: #dfe5e7; }
.av.sm { width: 40px; height: 40px; flex: none; }
.rows .nm { font-size: 1.02rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows time { font-size: .76rem; color: var(--muted); }
.rows time.hot { color: var(--green); font-weight: 600; }
.rows .pv { display: flex; align-items: center; gap: .25rem; min-width: 0; color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .end { justify-self: end; }
.ticks { width: 16px; height: 11px; flex: none; color: var(--tick); }
.badge { font-style: normal; display: inline-block; background: var(--green); color: #fff; border-radius: 999px; font: 700 .72rem/1 var(--text); padding: .3rem .55rem; }
.badge.you { background: var(--bot-tint); color: #0a6b53; }
.badge.quiet { background: var(--paper); color: var(--muted); font-weight: 600; }
.wa-empty { padding: 1.5rem 1rem; text-align: center; }
.count { font-style: normal; display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .3rem; margin-inline-start: .35rem; border-radius: 999px; background: var(--green); color: #fff; font-size: .72rem; font-weight: 700; vertical-align: .1em; }

/* a chat: the beige background, white bubbles in, light-green bubbles out, the time and ✓✓ inside */
/* left to right, like WhatsApp: names and previews start at the avatar, Hebrew inside reads right to left */
.wa .rows .nm, .wa .rows .pv > span, .wa-today > span, .thread header > div { text-align: left; }
.msg .tx { display: block; }
.rows .pv > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phonehead.ltr { text-align: left; }
.wa .thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wall); }
.wa-pick { margin: auto; }
.thread header { display: flex; align-items: center; gap: .8rem; padding: .55rem 1rem; background: var(--paper); border-bottom: 1px solid var(--line); }
.thread header > div { display: grid; min-width: 0; }
.thread header h3 { margin: 0; font-size: 1.02rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread header a[href^="tel:"] { text-decoration: none; font-size: .82rem; justify-self: start; }
/* the person's appointments, pinned under the chat's header (like a pinned message in WhatsApp) */
.pinbar { display: flex; align-items: center; gap: .7rem; padding: .5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.pinbar svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--bot); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pinbar span { display: grid; min-width: 0; }
.pinbar b { font-weight: 500; font-size: .92rem; }
.pinbar small { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgs { flex: 1; overflow-y: auto; padding: 1rem 6%; display: flex; flex-direction: column; gap: .2rem; }
.msg { position: relative; max-width: 65%; padding: .35rem .6rem .25rem; border-radius: 8px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); white-space: pre-wrap; word-wrap: break-word; font-size: .95rem; line-height: 1.4; }
.msg.in { align-self: flex-start; background: var(--surface); border-start-start-radius: 0; }
.msg.out, .msg.owner { align-self: flex-end; background: var(--bot-tint); border-start-end-radius: 0; }
.msg .who { display: block; font-size: .78rem; font-weight: 600; color: var(--bot); }
.msg.owner .who { color: #7f66ff; }
.msg time { display: flex; justify-content: flex-end; align-items: center; gap: .2rem; font-size: .68rem; color: var(--muted); direction: ltr; margin-top: .1rem; }
.daychip, .sys { align-self: center; margin: .5rem 0; padding: .3rem .7rem; border-radius: 8px; font-size: .78rem; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.daychip { background: var(--surface); color: var(--muted); }
.sys { background: #fff5c4; color: #54656f; text-align: center; max-width: 85%; }
.waitline { display: flex; align-items: flex-start; gap: .8rem; padding: .65rem 1rem; background: #fff6d6; border-top: 1px solid #f1e3b0; font-size: .9rem; }
.waitline > div { flex: 1; min-width: 0; }
.waitline span { color: var(--muted); }
.waitline p { margin: .15rem 0 0; color: #54656f; }
.linkbtn { flex: none; border: 0; background: none; padding: .15rem 0; color: var(--bot); font: 600 .9rem var(--text); cursor: pointer; white-space: nowrap; }
/* the bottom of a chat: the bot's switch for this chat, then the one thing to do — reply on WhatsApp */
.thread .take { display: grid; gap: .6rem; padding: .7rem 1rem; background: var(--surface); border-top: 1px solid var(--line); }
.botswitch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0; font-weight: 400; cursor: pointer; }
.botswitch > span { display: grid; min-width: 0; }
.botswitch b { font-weight: 600; font-size: .95rem; }
.botswitch small { color: var(--muted); font-size: .82rem; }
input[type="checkbox"][role="switch"] { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 51px; height: 31px; min-height: 0; padding: 0; margin: 0;
  border: 0; border-radius: 999px; background: #e9e9eb; cursor: pointer; transition: background .2s; }
input[type="checkbox"][role="switch"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
input[type="checkbox"][role="switch"]:checked { background: var(--green); }
input[type="checkbox"][role="switch"]:checked::after { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { input[type="checkbox"][role="switch"], input[type="checkbox"][role="switch"]::after { transition: none; } }
a.primary.wa-reply { display: grid; place-items: center; background: var(--bot); color: #fff; text-decoration: none; border-radius: 999px; padding: .6rem 1.2rem; font-weight: 600; min-height: 46px; }
a.primary.wa-reply:hover { background: #006e5a; }

/* ---------- forms */
.group { background: var(--surface); border-radius: var(--radius); padding: 1.6rem 1.8rem; margin: 0 0 1.5rem; box-shadow: 0 1px 0 var(--line); }
label { display: grid; gap: .3rem; margin: 0 0 1rem; font-weight: 600; align-content: start; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
input, textarea, select { font: inherit; font-weight: 400; color: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; width: 100%; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--bot); }
input[type="time"] { direction: ltr; text-align: center; -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; }
input[type="time"]::-webkit-date-and-time-value { text-align: center; }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }

/* ---------- the phone bar: install the app, then turn on notifications */
.phonebar { background: var(--bot-tint); border-bottom: 1px solid var(--line); padding: .8rem 1rem; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.phonebar p { margin: 0; flex: 1 1 16rem; }
.phonebar .share { width: 1.05em; height: 1.05em; vertical-align: -.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.phonebar .later { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: .4rem .2rem; }

/* ---------- choosing people: tags, and a search list */
.pick { margin-bottom: 1rem; }
.pick .lbl { display: block; font-weight: 600; margin-bottom: .45rem; }
.chips { list-style: none; margin: 0 0 .55rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; min-height: 2rem; align-items: center; }
.chips:empty::before { content: attr(data-empty); color: var(--muted); font-size: .95rem; }
.chips li { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .3rem .2rem .75rem; border-radius: 999px; background: var(--bot-tint); font-size: .95rem; }
[data-pick="deny"] .chips li { background: var(--alert-tint); }
.chips bdi, .options bdi { color: var(--muted); font-variant-numeric: tabular-nums; }
.chips .x { border: 0; background: none; font: inherit; font-size: 1.15rem; line-height: 1; width: 1.7rem; height: 1.7rem; border-radius: 50%; cursor: pointer; color: var(--muted); }
.chips .x:hover { background: #1e2a2e14; color: var(--ink); }
.combo { position: relative; }
.combo input::-webkit-search-cancel-button { display: none; }  /* the tags have their own × */
.options { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 10; margin: 0; padding: .3rem 0; list-style: none; max-height: 18rem; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px #1e2a2e24; }
.options li { display: flex; align-items: baseline; gap: .6rem; padding: .5rem .85rem; cursor: pointer; }
.options li[aria-selected="true"] { background: var(--bot-tint); }
.options li bdi { margin-inline-start: auto; }
.options li small { color: var(--muted); }
.options .none { color: var(--muted); cursor: default; }
.nameless { background: var(--paper); border-radius: var(--radius); padding: 1rem 1.2rem; margin: .5rem 0 1rem; }
.nameless > p { margin: 0 0 .7rem; }
.nameless .both { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.nameless summary { cursor: pointer; color: var(--bot); padding: .2rem 0; }
.nameless ul { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 20rem; overflow-y: auto; }
.nameless li { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.nameless li bdi { font-variant-numeric: tabular-nums; margin-inline-end: auto; }
.nameless li button { padding: .25rem .8rem; font-size: .92rem; }
.nameless [data-after] { margin: .6rem 0 0; }
legend { font-weight: 600; margin-bottom: .4rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 1rem; margin-top: 1rem; align-items: end; }  /* fields line up when a label wraps */
.hours { border-collapse: collapse; }
.hours th { text-align: start; padding: .3rem 1rem .3rem 0; font-weight: 600; width: 5rem; }
.hours td { padding: .3rem .5rem; }
.hours td label { margin: 0; }
.hours tr:has(input[type="checkbox"]:not(:checked)) input[type="time"] { opacity: .4; }  /* a closed day's hours don't count */
button.primary { background: var(--bot); color: #fff; border: 0; border-radius: 999px; padding: .6rem 1.4rem; font: 600 1rem var(--text); cursor: pointer; }
button.primary:hover { background: #006e5a; }
button.ghost { background: none; border: 1px solid var(--line); border-radius: 999px; padding: .4rem 1rem; font: inherit; color: var(--ink); cursor: pointer; }
button.ghost.you { border-color: var(--you); color: var(--you); }
.qr { display: block; margin: 1rem 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; }

/* ---------- test chat */
.testchat { background: var(--surface); border-radius: var(--radius); box-shadow: 0 1px 0 var(--line); display: flex; flex-direction: column; height: calc(100vh - 260px); min-height: 380px; }
.testchat .log { flex: 1; overflow-y: auto; padding: 1.2rem; display: flex; flex-direction: column; gap: .5rem; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
.testchat .log:empty::before { content: "כתבו הודעה כמו לקוח, למשל: היי, אפשר תור ביום ראשון?"; color: var(--muted); margin: auto; text-align: center; }
.testchat .msg.out { background: var(--bot-tint); }
.testchat .msg.in { background: var(--paper); border: 0; }
.testchat .compose { display: flex; gap: .6rem; padding: .8rem; border-top: 1px solid var(--line); }
.testchat .tools { font-size: .72rem; color: var(--muted); }

/* ---------- Settings: a quick index */
.index { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.5rem; position: sticky; top: 67px; z-index: 4; background: var(--paper); padding: .6rem 0; box-shadow: 0 1px 0 var(--line); }
.index a[aria-current="true"] { background: var(--bot-tint); border-color: transparent; color: #0a6b53; font-weight: 600; }
body:has(.index) .group { scroll-margin-top: 8.5rem; }  /* a section opens below the top bar and the pinned row */
.index a { padding: .4rem .85rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .92rem; white-space: nowrap; }
.index a:hover { border-color: var(--bot); }

/* ---------- phone-only pieces, hidden on a computer */
.phonehead, .tabs, .signout, .thread .back { display: none; }

/* ---------- the phone: an app, with its tabs at the bottom.
   One scale: title 30 · card title 18 · body 16 · label 14 · hint 13 · caption 12 (px).
   One rhythm: 16 gutters and card padding, 12 between cards, 14 corners, 44 fields, 48 main buttons. */
@media (max-width: 820px) {
  :root { --radius: 14px; }
  body { font-size: 16px; line-height: 1.5; padding-top: env(safe-area-inset-top); }
  body::before { content: ""; position: fixed; top: 0; inset-inline: 0; height: env(safe-area-inset-top); background: var(--paper); z-index: 25; }  /* under the clock: nothing scrolls through */
  h2 { font-size: 1.125rem; }
  h3 { font-size: 1.125rem; }
  .bar, .pagetitle { display: none; }
  .phonehead { display: block; padding: 1rem 1rem .25rem; }
  .phonehead span { display: block; color: var(--muted); font-size: .8125rem; font-weight: 600; }
  .phonehead h1 { font-size: 1.875rem; line-height: 1.15; margin: .1rem 0 0; }
  main { padding: .75rem 1rem calc(5.25rem + env(safe-area-inset-bottom)); }
  main > p.muted, .group > p.muted { font-size: .875rem; }
  .flash { font-size: .9375rem; padding: .625rem .875rem; margin-bottom: .75rem; }

  /* the tab bar */
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
    background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--line); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); }
  .tabs a { display: grid; justify-items: center; align-content: center; gap: .1rem; min-height: 49px; color: var(--muted); text-decoration: none; font-size: .6875rem; font-weight: 600; -webkit-tap-highlight-color: transparent; }
  .tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabs a[aria-current="page"] { color: var(--bot); }
  .phonebar { padding: .75rem 1rem; font-size: .875rem; }

  /* form parts */
  label { font-size: .875rem; gap: .35rem; margin-bottom: .875rem; }
  label small, .pick .lbl small { font-size: .8125rem; font-weight: 400; }
  input, textarea, select { font-size: 16px; min-height: 44px; padding: .5rem .75rem; border-radius: 10px; }
  textarea { min-height: 5.5rem; line-height: 1.45; }
  input[type="time"]::-webkit-calendar-picker-indicator { display: none; }  /* a tap opens the phone's own picker */
  label.check { display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; align-items: start; font-size: 1rem; margin-bottom: .75rem; }
  label.check input { margin-top: .3rem; min-height: 0; }
  label.check small { grid-column: 2; }
  button.primary { min-height: 48px; font-size: 1rem; }
  button.ghost { min-height: 40px; font-size: .9375rem; padding: .35rem .9rem; }

  /* cards: one look */
  .group, .activity, .chats, .testchat { border-radius: var(--radius); }
  .group { padding: 1rem; margin-bottom: .75rem; scroll-margin-top: calc(env(safe-area-inset-top) + .75rem); }
  .group h3 { font-size: 1.125rem; margin-bottom: .875rem; }
  .group button.primary { width: 100%; }

  /* the chats: the list is home; a chat opens over it like a new screen */
  main:has(> .wa) { padding: 0 0 calc(4.5rem + env(safe-area-inset-bottom)); }
  .wa { display: block; height: auto; background: var(--surface); }
  .wa .list { border: 0; }
  .wa-top { padding: .25rem 1rem 0; }
  .wa-search { height: 36px; }
  .wa-banner { margin: .25rem 1rem .5rem; }
  .rows { overflow: visible; }
  .rows button { padding: .55rem 1rem; }
  .wa .thread { display: none; }
  .wa.open .list { display: none; }
  .wa.open .thread { display: flex; position: fixed; inset: 0; z-index: 30; padding-top: env(safe-area-inset-top); }
  .thread header { padding: .35rem .75rem .35rem .5rem; gap: .5rem; background: var(--surface); }
  .thread .back { display: inline-grid; place-items: center; width: 40px; height: 44px; margin-inline-start: -.25rem; border: 0; background: none; color: var(--bot); cursor: pointer; }
  .thread .back svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  .msgs { padding: .75rem .6rem; }
  .msg { max-width: 82%; }
  .thread .take { padding: .55rem .75rem calc(.55rem + env(safe-area-inset-bottom)); }
  .thread .take a.wa-reply { min-height: 48px; }
  .waitline { padding: .55rem 1rem; }
  .tabs a { position: relative; }
  .tabs .count { position: absolute; top: .2rem; inset-inline-end: calc(50% - 1.35rem); margin: 0; }
  body:has(.wa) .phonehead { background: var(--surface); padding-bottom: .5rem; }
  body:has(.wa) { background: var(--surface); }

  /* test chat: fills the screen, the typing box at the bottom */
  .testchat { height: calc(100dvh - 15.75rem - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 300px; }
  .testchat .log { padding: .875rem .75rem; }
  .testchat .compose { padding: .625rem; gap: .5rem; }
  .testchat .compose button { min-height: 44px; padding: 0 1.1rem; }

  /* settings */
  .index { flex-wrap: nowrap; overflow-x: auto; margin: 0 -1rem .75rem; padding: .5rem 1rem; scrollbar-width: none; gap: .375rem; top: env(safe-area-inset-top); }
  body:has(.index) .group { scroll-margin-top: calc(env(safe-area-inset-top) + 3.75rem); }
  .index::-webkit-scrollbar { display: none; }
  .index a { font-size: .875rem; padding: .375rem .75rem; }
  .pick .lbl { font-size: .875rem; }
  .chips:empty::before { font-size: .875rem; }
  .nameless { padding: .875rem; font-size: .9375rem; }
  .nameless .both button { flex: 1 1 auto; }
  .signout { display: block; margin: .25rem 0 1rem; }
  .signout button { width: 100%; min-height: 48px; color: var(--alert); border-color: var(--alert-tint); background: var(--surface); }
}

/* ---------- Settings: when the bot needs you — the notification on this device, then WhatsApp as well */
.pushbox { background: var(--paper); border-radius: 10px; padding: .75rem .9rem; margin: 0 0 1.1rem; }
.pushbox [data-status] { margin: 0 0 .6rem; }
.pushbox .both { display: flex; flex-wrap: wrap; gap: .5rem; }
.pushbox .both button:not([hidden]) { flex: 1 1 auto; }
label.short input { max-width: 8rem; }

/* ---------- Settings: how the bot talks — the basics (locked) and the owner's rules (a list) */
.builtin { background: var(--paper); border-radius: 10px; padding: .7rem .9rem; margin: 0 0 1.1rem; }
.builtin summary { cursor: pointer; font-weight: 600; font-size: .92rem; color: #3b4a54; }
.builtin summary small { font-weight: 400; color: var(--muted); }
.builtin ul { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .3rem; }
.builtin li { position: relative; padding-inline-start: 1.4rem; font-size: .9rem; color: #3b4a54; }
.builtin li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--green); font-weight: 700; }
.lbl { font-weight: 600; margin: 0 0 .5rem; }
.rules { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .45rem; }
.rules li { display: flex; align-items: flex-start; gap: .4rem; }
.rules textarea { flex: 1; min-height: 44px; resize: none; overflow: hidden; line-height: 1.45; padding: .55rem .75rem; }
.rules .x { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.3rem; border-radius: 50%; cursor: pointer; }
.rules .x:hover { background: var(--paper); color: var(--alert); }
.addrule { display: block; border: 0; background: none; color: var(--bot); font: 600 .95rem var(--text); padding: .5rem 0; margin: 0 0 1rem; cursor: pointer; }

/* ---------- the test account's simulation */
.simlist { list-style: none; margin: 1rem 0 0; padding: 0; columns: 2 16rem; column-gap: 1.5rem; }
.simlist li { display: flex; justify-content: space-between; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--hair); break-inside: avoid; font-size: .92rem; }
.simlist li span { color: var(--muted); text-align: end; }

/* ---------- login */
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--surface); padding: 2.4rem; border-radius: 14px; width: min(380px, 92vw); box-shadow: 0 1px 0 var(--line); }
.login-card h1 { font-size: 1.8rem; margin-bottom: .2rem; }
.login-card button { width: 100%; margin-top: .5rem; }

/* ---------- small screens */
@media (max-width: 820px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .row4 { grid-template-columns: 1fr 1fr; }  /* a break's from/to stay side by side */
  .hours { width: 100%; table-layout: fixed; }
  .hours th { width: 3.6rem; padding-inline-end: .3rem; }
  .hours td { padding: .3rem .15rem; }
  .hours td:nth-child(2) { width: 4.4rem; }
  .hours input[type="time"] { padding: .5rem .3rem; min-width: 0; }
  .hours input[type="time"]::-webkit-calendar-picker-indicator { display: none; }  /* a tap opens the phone's own picker */
  .hours th { font-size: .9375rem; }
  .hours input[type="time"] { min-height: 40px; text-align: center; }
  .hours label.check { margin: 0; font-size: .9375rem; align-items: center; }
  .hours label.check input { margin: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
