/* My Front Desk. Shares the palette and type of /site.css (docs/03-brand.md):
   navy #16202E, orange #F26A21 as the only accent, flat surfaces, 1px rules,
   4px radius on controls. Orange text on white fails contrast, so small orange
   text uses --link (#C2410C), and labels on orange buttons are navy. */

:root {
  --ink: #16202E;
  --body: #39424a;
  --mut: #5e6a72;
  --faint: #8a949b;
  --ground: #f3f0ea;
  --card: #ffffff;
  --soft: #f7f4ef;
  --line: #e3ddd4;
  --line-strong: #d3ccc1;
  --accent: #F26A21;
  --accent-tint: #fdeee4;
  --link: #C2410C;
  --navy: #16202E;
  --ok: #1b6b45;
  --ok-bg: #e5f4ec;
  --warn: #8a3b0c;
  --warn-bg: #fdeee4;
  --danger: #9d1c14;
  --danger-bg: #fbe9e7;
  --side-w: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f3f6f8; --body: #c9d2d8; --mut: #b4bec6; --faint: #87939b;
    --ground: #0e1216; --card: #1b2229; --soft: #151b21; --line: #2d3740; --line-strong: #3a4651;
    --accent-tint: #3a2516; --link: #F59A62; --ok: #8fd0ae; --ok-bg: #173028;
    --warn: #ffc49e; --warn-bg: #3a2516; --danger: #ffb4a8; --danger-bg: #3a1d1a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #f3f6f8; --body: #c9d2d8; --mut: #b4bec6; --faint: #87939b;
  --ground: #0e1216; --card: #1b2229; --soft: #151b21; --line: #2d3740; --line-strong: #3a4651;
  --accent-tint: #3a2516; --link: #F59A62; --ok: #8fd0ae; --ok-bg: #173028;
  --warn: #ffc49e; --warn-bg: #3a2516; --danger: #ffb4a8; --danger-bg: #3a1d1a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--body);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15.5px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-family: Archivo, "IBM Plex Sans", sans-serif; color: var(--ink); margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 10px; }
a { color: var(--link); }
button { font: inherit; color: inherit; }
svg { flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lab { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--mut); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 60; background: var(--accent); color: var(--navy); font-family: Archivo, sans-serif; font-weight: 800; text-decoration: none; padding: 10px 14px; border-radius: 4px; }
.skip:focus { top: 12px; }

/* Brand */
.mark { width: 36px; height: 36px; display: block; }
.word { font-family: Archivo, sans-serif; font-weight: 800; font-size: 17px; letter-spacing: -0.02em; color: var(--ink); }
.word span { color: var(--accent); }
:root[data-theme="dark"] .mark rect { fill: #2a3744; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mark rect { fill: #2a3744; } }

/* Boot and spinner */
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } * { scroll-behavior: auto !important; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px 18px; background: var(--accent); color: var(--navy); border: 0; border-radius: 4px; font-family: Archivo, sans-serif; font-weight: 800; font-size: 1rem; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.05); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.small { width: auto; padding: 9px 14px; font-size: .9rem; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); font-weight: 700; }
.linkish { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; }
.icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--card); border-radius: 8px; cursor: pointer; color: var(--mut); }
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Sign in */
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px 16px; }
.signin-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 6px; padding: 30px 28px 24px; }
.brandrow { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.signin h1 { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.035em; margin-bottom: 6px; }
.lede { color: var(--mut); margin-bottom: 22px; }
.signin label { display: block; font-weight: 600; color: var(--ink); font-size: .92rem; margin-bottom: 6px; }
.signin input { width: 100%; padding: 12px 13px; font: inherit; font-size: 16px; color: var(--ink); background: var(--soft); border: 1px solid var(--line-strong); border-radius: 4px; margin-bottom: 14px; }
.signin input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.fine { font-size: .85rem; color: var(--mut); margin: 12px 0 0; }
.form-err { font-size: .9rem; color: var(--danger); margin: 12px 0 0; }
.sent { text-align: left; padding: 4px 0 0; }
.sent h2 { font-size: 1.2rem; margin-bottom: 8px; }
#signin-verifying { display: flex; align-items: center; gap: 12px; }
#signin-verifying p { margin: 0; }
.help { font-size: .85rem; color: var(--mut); margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.demo-link { font-size: .85rem; margin: 8px 0 0; }

/* App shell */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px 16px; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 8px 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 6px; text-decoration: none; color: var(--body); font-weight: 500; font-size: .95rem; }
.nav a svg, .tabbar a svg, .side-out svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--soft); color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--navy); font: 700 11.5px/20px "IBM Plex Sans", sans-serif; text-align: center; }
.side-help { margin-top: auto; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); font-size: .86rem; }
.side-help p { margin: 6px 0 8px; color: var(--mut); }
.side-help a { display: block; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.side-out { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--mut); font-weight: 500; text-align: left; }
.side-out:hover { background: var(--soft); color: var(--ink); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line); }
.top-title { min-width: 0; }
.top h1 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.03em; }
.shop-name { margin: 0; font-size: .88rem; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; font-size: .82rem; font-weight: 600; border: 1px solid var(--line); background: var(--soft); color: var(--mut); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pill.live { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.pill.live::before { background: var(--ok); }
.pill.setup { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.pill.setup::before { background: var(--accent); }
.acct { position: relative; }
.avatar-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; font: 700 .85rem Archivo, sans-serif; cursor: pointer; }
:root[data-theme="dark"] .avatar-btn { background: #2a3744; }
.menu { position: absolute; right: 0; top: 46px; min-width: 220px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px; z-index: 30; }
.menu-email { font-size: .82rem; color: var(--mut); padding: 8px 10px 10px; margin: 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 4px; color: var(--ink); text-decoration: none; cursor: pointer; font-size: .92rem; }
.menu a:hover, .menu button:hover { background: var(--soft); }

.banner { margin: 16px 28px 0; padding: 11px 14px; border-radius: 6px; background: var(--accent-tint); color: var(--ink); font-size: .9rem; border: 1px solid transparent; }
.banner.err { background: var(--danger-bg); color: var(--danger); }
.content { padding: 22px 28px 48px; outline: none; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em; }
.view-head p { margin: 4px 0 0; color: var(--mut); font-size: .92rem; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 15px 16px 14px; min-width: 0; }
.stat .num { font-family: Archivo, sans-serif; font-weight: 800; font-size: 1.75rem; letter-spacing: -0.035em; color: var(--ink); line-height: 1.1; margin: 6px 0 2px; }
.stat .num small { font-size: .9rem; font-weight: 700; color: var(--mut); letter-spacing: 0; }
.stat .sub { font-size: .82rem; color: var(--mut); margin: 0; }
.meter { height: 6px; border-radius: 3px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.over i { background: var(--danger); }

/* Cards and grids */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 1.05rem; font-weight: 700; }
.card-head a { font-size: .86rem; font-weight: 600; text-decoration: none; }
.card-body { padding: 0 18px 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; padding: 0 18px 12px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 220px; max-width: 340px; }
.search svg { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; }
.search input, .select { width: 100%; padding: 9px 12px 9px 35px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); color: var(--ink); font: inherit; font-size: 15px; }
.select { width: auto; padding-left: 12px; padding-right: 30px; flex: none; }

/* Call table */
.table-wrap { overflow-x: auto; }
table.calls { width: 100%; border-collapse: collapse; font-size: .9rem; }
.calls th { text-align: left; font: 600 11px/1.2 "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--mut); padding: 10px 12px; background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
.calls th:first-child, .calls td:first-child { padding-left: 18px; }
.calls th:last-child, .calls td:last-child { padding-right: 14px; }
.calls td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.calls tr.row { cursor: pointer; }
.calls tr.row:hover td { background: var(--soft); }
.calls tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.who { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.who b { display: block; color: var(--ink); font-weight: 600; }
.who small { display: block; color: var(--mut); font-size: .8rem; }
.av { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font: 700 .78rem Archivo, sans-serif; color: var(--ink); background: var(--soft); border: 1px solid var(--line); flex: none; }
.calls td.c-reason { width: 100%; max-width: 0; }
.reason { color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { white-space: nowrap; color: var(--body); }
.when small { display: block; color: var(--mut); font-size: .8rem; }
.more { width: 32px; height: 32px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--mut); display: inline-flex; align-items: center; justify-content: center; }
.more:hover { background: var(--line); color: var(--ink); }
.more svg { width: 18px; height: 18px; fill: currentColor; }
.empty { padding: 26px 18px 30px; color: var(--mut); text-align: center; font-size: .93rem; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; font-family: Archivo, sans-serif; }
.load-more { display: flex; justify-content: center; padding: 14px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--mut); border: 1px solid var(--line); }
.badge.booked { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.urgent { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.message { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.badge.transferred { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.badge.returned { background: var(--ok-bg); color: var(--ok); border-color: transparent; }

/* Mini calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px 6px; }
.cal-head h3 { font-size: 1.05rem; font-weight: 700; }
.cal-nav { display: flex; gap: 4px; }
.cal-nav button { width: 30px; height: 30px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--mut); display: inline-flex; align-items: center; justify-content: center; }
.cal-nav button:hover { background: var(--soft); color: var(--ink); }
.cal-nav svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cal-month { font-size: .86rem; color: var(--mut); padding: 0 18px 8px; font-weight: 600; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 0 12px 10px; text-align: center; }
.cal .dow { font: 600 10.5px/1 "IBM Plex Mono", monospace; letter-spacing: .08em; color: var(--faint); padding: 6px 0 8px; }
.cal button { position: relative; aspect-ratio: 1 / 1; max-height: 38px; border: 0; background: none; border-radius: 6px; font: 500 .85rem "IBM Plex Sans", sans-serif; color: var(--body); cursor: pointer; }
.cal button:hover { background: var(--soft); }
.cal button.out { color: var(--faint); opacity: .55; }
.cal button.today { color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--line-strong); }
.cal button.sel { background: var(--navy); color: #fff; font-weight: 700; box-shadow: none; }
:root[data-theme="dark"] .cal button.sel { background: var(--accent); color: var(--navy); }
.cal button.has::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); transform: translateX(-50%); }
.agenda { border-top: 1px solid var(--line); }
.agenda-item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.agenda-item:last-child { border-bottom: 0; }
.agenda-item:hover { background: var(--soft); }
.agenda-time { flex: none; width: 66px; font: 600 .82rem "IBM Plex Mono", monospace; color: var(--ink); padding-top: 2px; }
.agenda-time small { display: block; color: var(--mut); font-weight: 400; font-size: .74rem; }
.agenda-what b { display: block; color: var(--ink); font-weight: 600; font-size: .92rem; }
.agenda-what small { display: block; color: var(--mut); font-size: .82rem; }
.notice { margin: 0 18px 16px; padding: 11px 13px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line); font-size: .86rem; color: var(--mut); }
.notice strong { color: var(--ink); }

/* Messages */
.tabs { display: flex; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 9px 4px 10px; margin-right: 12px; font-size: .88rem; font-weight: 600; color: var(--mut); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.msg { display: flex; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.msg:last-child { border-bottom: 0; }
.msg:hover { background: var(--soft); }
.msg-main { min-width: 0; flex: 1; }
.msg-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.msg-top b { color: var(--ink); font-weight: 600; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-top time { flex: none; font-size: .76rem; color: var(--mut); }
.msg-sum { color: var(--mut); font-size: .86rem; margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg.done .msg-top b { color: var(--mut); font-weight: 500; }
.msg-list.big .msg { padding: 16px 18px; }
.msg-list.big .msg-sum { display: block; -webkit-line-clamp: unset; overflow: visible; }
.msg-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Settings */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
dl.kv { margin: 0; padding: 0 18px 8px; }
.kv div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.kv dt { color: var(--mut); }
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(14, 18, 22, .45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--card); border-left: 1px solid var(--line-strong); z-index: 50; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.2rem; font-weight: 800; }
.drawer-body { padding: 18px 20px 36px; overflow-y: auto; }
.d-who { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.d-who .av { width: 46px; height: 46px; font-size: .95rem; }
.d-who b { display: block; font-family: Archivo, sans-serif; font-size: 1.15rem; color: var(--ink); }
.d-who a { font-weight: 600; text-decoration: none; }
.d-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 18px; }
.d-actions .btn { width: auto; }
.d-sum { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 13px 14px; margin-bottom: 16px; color: var(--ink); }
.d-sum .lab { display: block; margin-bottom: 6px; }
.transcript { margin-top: 16px; }
.transcript summary { cursor: pointer; font-weight: 600; color: var(--ink); padding: 8px 0; }
.turn { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.turn b { font: 600 .74rem "IBM Plex Mono", monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--mut); padding-top: 2px; }
.turn.agent b { color: var(--link); }
.raw { white-space: pre-wrap; font: .85rem/1.6 "IBM Plex Mono", monospace; color: var(--body); background: var(--soft); border-radius: 6px; padding: 12px; }

.tabbar { display: none; }
.noscript { max-width: 420px; margin: 80px auto; padding: 0 16px; }

/* Responsive */
@media (max-width: 1180px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .grid > .stack:last-child { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
}
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .app { grid-template-columns: minmax(0, 1fr); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .side { display: none; }
  .top { padding: 11px 16px; }
  .top h1 { font-size: 1.08rem; }
  .pill { padding: 5px 9px; font-size: .76rem; }
  #refresh-btn { display: none; }
  .banner { margin: 12px 16px 0; }
  .content { padding: 16px 16px 32px; }
  .stats { gap: 10px; }
  .stat { padding: 12px 13px; }
  .stat .num { font-size: 1.45rem; }
  .card-head, .toolbar, .card-body { padding-left: 14px; padding-right: 14px; }
  .search { max-width: none; }
  /* Calls table turns into stacked rows */
  table.calls thead { display: none; }
  table.calls, .calls tbody, .calls tr, .calls td { display: block; width: 100%; }
  .calls tr.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .calls td { padding: 0 !important; border: 0; }
  .calls td.c-who { grid-column: 1; }
  .calls td.c-when { grid-column: 2; grid-row: 1; text-align: right; }
  .calls td.c-reason { grid-column: 1 / -1; padding-left: 44px !important; }
  .calls td.c-out { grid-column: 1 / -1; padding: 6px 0 0 44px !important; }
  .calls td.c-more { display: none; }
  .calls tr.unread td:first-child { box-shadow: none; }
  .calls tr.unread { box-shadow: inset 3px 0 0 var(--accent); }
  .calls td.c-reason { max-width: none; }
  .reason { white-space: normal; }
  .who { min-width: 0; }
  .kv div { grid-template-columns: 1fr; gap: 2px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 2px; text-decoration: none; color: var(--mut); font-size: .7rem; font-weight: 600; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"] svg { stroke: var(--link); }
  .tabbar .count { position: absolute; top: 0; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 17px; font-size: 10.5px; line-height: 17px; padding: 0 5px; }
  .drawer { width: 100%; border-left: 0; }
}
@media (max-width: 420px) {
  .stat .num { font-size: 1.3rem; }
  .stat .sub { font-size: .76rem; }
  .stat .lab { font-size: 10px; letter-spacing: .1em; }
}
@media (max-width: 340px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .top-right .pill { display: none; }
}

/* Settings form */
.sform { padding: 4px 18px 16px; }
.sform label { display: block; font-weight: 600; color: var(--ink); font-size: .9rem; margin: 12px 0 6px; }
.sform input[type="text"], .sform input[type="tel"], .sform input[type="time"], .sform select { width: 100%; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink); background: var(--soft); border: 1px solid var(--line-strong); border-radius: 4px; }
.sform input:focus, .sform select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.sform .days { display: flex; flex-wrap: wrap; gap: 6px; }
.sform .days label { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 4px; font-weight: 500; cursor: pointer; }
.sform .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sform .actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.sform .saved { color: var(--mut); font-size: .88rem; }
.steps-list { margin: 0; padding: 0 18px 14px 36px; font-size: .92rem; color: var(--ink); }
.steps-list li { margin: 6px 0; }
.setup-banner { margin: 0 0 18px; padding: 14px 16px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line-strong); font-size: .95rem; }
.setup-banner a.btn { margin-top: 10px; }
