:root {
  --bg: #f4f6f9; --panel: #fff; --line: #e3e7ee; --text: #1c2431; --muted: #5b6474; /* A11Y-05: ≥5.9:1 on white and #f8fafc (was #6b7686 at ~4.4:1 on tinted panels) */
  --primary: #0f766e; --primary-2: #115e59; --danger: #b42318; --ok: #15803d; --warn: #b45309;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
header { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; gap: 8px; }
.brand { font-weight: 700; font-size: 18px; }
.brand span { color: var(--muted); font-weight: 400; font-size: 14px; margin-inline-start: 8px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--text); padding: 8px 12px; border-radius: 8px; }
nav a.active, nav a:hover { background: #e6f4f1; color: var(--primary); }
main { padding: 20px 24px; max-width: 1300px; margin: 0 auto; }
.hidden { display: none !important; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 560px) { .cards { grid-template-columns: repeat(3, 1fr); } .cards .card { padding: 10px 8px; } .cards .card .n { font-size: 22px; } .cards .card .l { font-size: 11px; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card .n { font-size: 26px; font-weight: 700; color: var(--primary); }
.card .l { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-convo { display: grid; grid-template-columns: 320px 1fr; gap: 16px; height: calc(100vh - 140px); }
@media (max-width: 900px) { .grid2, .grid-convo { grid-template-columns: 1fr; height: auto; } }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.tbl th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.tbl tr:last-child td { border-bottom: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:hover, .list li.active { background: #f0f7f6; }
.list .t { font-weight: 600; }
.list .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
textarea { width: 100%; min-height: 60px; }
.btn { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.btn:hover { background: #f3f5f8; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--danger); border-color: #f1c4c0; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef1f5; color: var(--muted); }
.badge.confirmed { background: #e6f4ea; color: var(--ok); }
.badge.cancelled { background: #fdecea; color: var(--danger); }
.badge.completed { background: #e8f0fe; color: #1a56db; }
.badge.no_show { background: #fef3e2; color: var(--warn); }
.badge.handoff { background: #fef3e2; color: var(--warn); }
.muted { color: var(--muted); }
.chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.chat-body { flex: 1; overflow: auto; padding: 16px; background: #eef1f5; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 75%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; line-height: 1.5; }
.msg.in { background: #fff; align-self: flex-start; }
.msg.out { background: #d9f5ef; align-self: flex-end; }
.msg.sys { background: transparent; color: var(--muted); font-size: 12px; align-self: center; }
.msg .ts { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
/* the newest message sits just above the composer, as in every messaging app */
.chat-body > :first-child { margin-block-start: auto; }
.daysep { align-self: center; margin: 6px 0 2px; }
.daysep span { background: rgba(255,255,255,.75); color: var(--muted); font-size: 12px; padding: 3px 12px; border-radius: 999px; }
.chat-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-foot input { flex: 1; }
.cards-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.doc-card h3 { margin: 0 0 6px; }
.doc-card .hrs { font-size: 13px; color: var(--muted); margin: 8px 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form-grid input, .form-grid select, .form-grid textarea { color: var(--text); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 20px; width: 100%; max-width: 640px; max-height: 90vh; overflow: auto; }
.modal-box h3 { margin-top: 0; }
.hours-grid { display: grid; grid-template-columns: 90px 1fr 1fr 40px; gap: 6px; align-items: center; margin: 4px 0; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 30; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: flex; gap: 4px; align-items: center; background: #f3f5f8; padding: 4px 8px; border-radius: 8px; font-size: 13px; }

/* F5.6 usage & cost */
.meter { margin: 10px 0; }
.meter .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.meter .row b { color: var(--text); font-variant-numeric: tabular-nums; }
.meter .bar { height: 10px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width .3s; }
.meter.warn .bar i { background: var(--warn); } .meter.bad .bar i { background: var(--danger); }
.banner { padding: 12px 14px; border-radius: 10px; margin: 10px 0; font-size: 14px; line-height: 1.5; }
.banner.bad { background: #fdecea; color: #7f1d1d; border: 1px solid #f1c4c0; }
.banner.warn { background: #fef3e2; color: #7c3a00; border: 1px solid #f5d8a8; }
.banner.ok { background: #e6f4ea; color: #14532d; border: 1px solid #bfe3c7; }
.billing { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.billing td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.billing td:last-child { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; direction: ltr; }
.billing tr.total td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--line); }
.inline-edit { display: inline-flex; gap: 6px; align-items: center; margin-inline-start: 8px; }
.inline-edit input { width: 90px; padding: 4px 8px; }
fieldset.group { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 4px; margin: 6px 0; }
fieldset.group legend { padding: 0 6px; color: var(--muted); font-size: 13px; }
fieldset.group .hint { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; margin: -4px 0 8px; }

/* US-132 inbox */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip .count { background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 7px; font-size: 12px; font-variant-numeric: tabular-nums; }
.chip.on .count { background: rgba(255,255,255,.25); }
.convo-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.convo-list li .t { grid-column: 1; } .convo-list li .s { grid-column: 1; }
.convo-list li .meta { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.unread { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; align-items: center; justify-content: center; }
.convo-list li.handoff { border-inline-start: 3px solid var(--warn); }
@media (max-width: 900px) { .grid-convo { grid-template-rows: 40vh 1fr; } .convo-list { max-height: 40vh; } }

/* US-122 FAQ + US-212 holidays */
.holiday-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.faq-list { display: grid; gap: 12px; }
.faq-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; }
.faq-card.off { background: var(--line-2); border-style: dashed; } /* not opacity: it drops muted text under 4.5:1 */
.faq-q { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; flex-wrap: wrap; }
.faq-a p { margin: 0 0 4px; color: var(--text); line-height: 1.6; }
.faq-a p:empty, .faq-q span:empty { display: none; }
.faq-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.empty { text-align: center; padding: 40px 16px; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.export-only { max-width: 720px; margin: 40px auto; }

/* =====================================================================
   US-402 v2 layer — design tokens, sidebar (desktop), tab bar (phone),
   responsive tables, 44 px touch targets. Overrides the rules above.
   ===================================================================== */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --line: #e6e8ec; --line-2: #eef0f3; --text: #111827; --muted: #5b6574;
  --primary: #0f766e; --primary-2: #0b5f59; --primary-soft: #e7f4f2; --primary-ink: #0b4f4a;
  --danger: #b42318; --ok: #157f3c; --warn: #a15c07;
  --radius: 14px; --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(16,24,40,.05); --shadow-2: 0 8px 24px rgba(16,24,40,.08);
  --side: 240px; --tab: 64px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
}
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.55; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
input, select, textarea, .btn, .chip { font-family: var(--font); }
h2 { font-weight: 600; letter-spacing: -.005em; }
:focus-visible { outline: 3px solid rgba(15,118,110,.35); outline-offset: 2px; border-radius: 8px; }

/* ---- shell ---- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; min-width: 0; }
.brand .logo { width: 33px; height: 30px; flex: none; display: block; } /* the Tayeb leaf mark (public/brand) */
.brand b { color: #1F3557; letter-spacing: .2px; }
.brand b { font-weight: 700; }
.brand #clinicName { margin: 0; color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
nav#mainNav { display: flex; gap: 2px; }
nav#mainNav a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--muted); padding: 10px 12px; border-radius: 10px; font-weight: 500; min-height: 44px; }
nav#mainNav a:hover { background: var(--line-2); color: var(--text); }
nav#mainNav a.active { background: var(--primary-soft); color: var(--primary-ink); }
nav#mainNav a.active .ic { stroke: var(--primary); }
.icon-btn { display: none; }
main { padding: 20px; max-width: 1240px; margin: 0 auto; }

/* desktop: sidebar on the inline-start side */
@media (min-width: 1024px) {
  .topbar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side); flex-direction: column; align-items: stretch; justify-content: flex-start;
    padding: 14px 12px; border-bottom: 0; border-inline-end: 1px solid var(--line); background: var(--panel); backdrop-filter: none; gap: 12px; }
  .brand { padding: 0 8px; flex-wrap: wrap; row-gap: 2px; }
  .brand #clinicName { flex-basis: 100%; padding-inline-start: 42px; margin-top: -6px; font-size: 13px; }
  /* flex-wrap:wrap from the base `nav` rule turned this column into a multi-column list: once the
     items stopped fitting the height (16 of them since Growth/Inventory/Records), the overflow wrapped
     into a second column OUTSIDE the sidebar, on top of the page. Never wrap; scroll. */
  nav#mainNav { flex-direction: column; flex-wrap: nowrap; flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; scrollbar-width: thin; }
  /* a half-cut row at the edge should read as "there is more below" — but only while there IS more
     below, otherwise the last item looks permanently broken (it did: Settings, at 900px tall). */
  nav#mainNav.more-below { mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent 100%); }
  nav#mainNav a { flex: none; min-height: 36px; padding: 6px 12px; } /* a mouse does not need the 44px touch target */
  .navlbl { margin: 8px 12px 2px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .navlbl:first-of-type { margin-top: 8px; }
  /* Sign-out lives in the footer beside the language switch, so the section list keeps the height. */
  .side-foot { flex-shrink: 0; }
  main { margin-inline-start: var(--side); max-width: none; padding: 28px 32px; }
  main > section { max-width: 1180px; margin-inline: auto; }
  .tabbar { display: none !important; }
}

/* phone + tablet: slim top bar, bottom tab bar, "more" sheet */
@media (max-width: 1023.98px) {
  nav#mainNav { display: none; }
  body.more-open nav#mainNav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: fixed; inset-inline: 8px; bottom: calc(var(--tab) + 8px + env(safe-area-inset-bottom));
    background: var(--panel); border-radius: 18px; padding: 12px; box-shadow: var(--shadow-2); z-index: 40; border: 1px solid var(--line); }
  body.more-open nav#mainNav a { flex-direction: column; justify-content: center; text-align: center; gap: 6px; font-size: 13px; min-height: 76px; background: var(--line-2); }
  body.more-open nav#mainNav a.active { background: var(--primary-soft); }
  .scrim { position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 30; }
  .tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 35; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tab) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { all: unset; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 500; color: var(--muted); cursor: pointer; min-height: 44px; -webkit-tap-highlight-color: transparent; }
  .tabbar a.active, .tabbar button[aria-expanded="true"] { color: var(--primary); }
  .tabbar a.active .ic { stroke-width: 2.1; }
  main { padding: 14px 14px calc(var(--tab) + 24px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--tab) + 16px + env(safe-area-inset-bottom)); }
}

/* ---- surfaces ---- */
.panel, .card, .tbl, .convo-list, .faq-card { border-color: var(--line); box-shadow: var(--shadow-1); }
.panel { border-radius: var(--radius); padding: 18px; }
.panel h2 { font-size: 16px; margin-bottom: 14px; }
.cards { gap: 12px; }
.card { border-radius: var(--radius); padding: 14px 16px; }
.card .n { font-size: 26px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; }
.card .l { font-size: 13px; color: var(--muted); }
.grid2 { gap: 16px; }
@media (max-width: 1023.98px) { .grid2 { grid-template-columns: 1fr; } }

/* dashboard on phone: KPIs as a swipeable strip, today's list first */
@media (max-width: 760px) {
  #view-dashboard { display: flex; flex-direction: column; gap: 14px; }
  #view-dashboard .statgrp .cards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -14px; padding: 2px 14px 6px; scrollbar-width: none; order: 0; }
  #view-dashboard .statgrp .cards::-webkit-scrollbar { display: none; }
  #view-dashboard .card { flex: 0 0 42%; scroll-snap-align: start; padding: 12px; }
  #view-dashboard .card .n { font-size: 22px; }
}

/* ---- controls: 44 px targets on touch screens ---- */
input, select, textarea { border-color: var(--line); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; font-size: 15px; }
/* a checkbox is not a text field: the 44px minimum was stretching it to 13x44 and turning every
   pick-chip into an oval. The touch target is the label around it, which keeps its own 44px. */
input[type=checkbox], input[type=radio] { min-height: 0; width: 18px; height: 18px; padding: 0; accent-color: var(--primary); }
textarea { min-height: 88px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(15,118,110,.15); }
.btn { border-radius: var(--radius-sm); padding: 10px 16px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; text-decoration: none; color: var(--text); transition: background .15s, border-color .15s; }
.btn.primary { box-shadow: 0 1px 2px rgba(15,118,110,.3); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
.chip { min-height: 40px; padding: 8px 14px; }
@media (pointer: coarse) { .btn.sm { min-height: 44px; padding: 8px 14px; } .chip { min-height: 44px; } .form-grid .check input, input[type=checkbox] { width: 22px; height: 22px; min-height: 22px; } .form-grid .check { min-height: 44px; } }
.toolbar { gap: 10px; }
@media (max-width: 760px) {
  .toolbar > input[type=search], .toolbar > select, .toolbar > label { flex: 1 1 100%; }
  .toolbar .btn { flex: 1 1 auto; }
  .form-row > * { flex: 1 1 100%; }
}

/* ---- responsive tables → cards on phones (labels set by app.js from <th>) ---- */
.tbl { border-radius: var(--radius); overflow: hidden; }
.tbl th { font-weight: 600; font-size: 12.5px; letter-spacing: .01em; background: #fafbfc; }
.tbl td { font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover td { background: #fbfcfd; }
@media (max-width: 760px) {
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl { background: transparent; border: 0; box-shadow: none; }
  .tbl thead { display: none; }
  .tbl tbody { display: grid; gap: 10px; }
  .tbl tr { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 14px; box-shadow: var(--shadow-1); }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line-2); text-align: start; min-height: 40px; }
  .tbl td:last-child { border-bottom: 0; }
  .tbl td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; flex: none; }
  .tbl td:empty { display: none; }
  .tbl td[colspan] { justify-content: center; color: var(--muted); }
  .tbl td[colspan]::before { content: none; }
}

/* ---- conversations ---- */
.chat-foot { flex-wrap: wrap; }
.chat-foot input { flex: 1 1 220px; }
@media (max-width: 760px) {
  .grid-convo { grid-template-rows: auto; height: auto; }
  .convo-list { max-height: 44vh; }
  .chat { min-height: 60vh; }
  .chat-foot .btn { flex: 1 1 40%; }
  .msg { max-width: 88%; }
}
.msg { border-radius: 14px; box-shadow: var(--shadow-1); }
.msg.out { background: #dcf3ee; }

/* ---- modal as a bottom sheet on phones ---- */
@media (max-width: 760px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { border-radius: 20px 20px 0 0; max-height: 92vh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
}
.modal-box { box-shadow: var(--shadow-2); }
.badge { font-weight: 500; padding: 3px 10px; }
.empty { border-radius: var(--radius); }
@media (max-width: 1023.98px) { .tabbar button.active { color: var(--primary); } }
@media (pointer: coarse) { .btn.sm, .btn.sm.icon { min-width: 44px; } .seg button { min-height: 44px; } input.search { min-height: 44px; } a.pmeta { display: inline-flex; align-items: center; min-height: 44px; } #publicLink { display: inline-flex; align-items: center; min-height: 44px; } }
@media (max-width: 760px) {
  #view-dashboard > * { min-width: 0; }
  #apTable td:first-child { display: none; }
  #apTable td:nth-child(2) { font-weight: 600; }
}
@media (max-width: 1023.98px) { .tabbar a.active { background: none; } .tabbar a.active .ic { background: var(--primary-soft); border-radius: 999px; padding: 2px 14px; width: 52px; height: 28px; box-sizing: border-box; } }
@media (max-width: 1023.98px) { .tabbar { grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; } .tabbar a, .tabbar button { min-width: 0; overflow: hidden; } .tabbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } }
.grid2 > *, .grid-convo > * { min-width: 0; } @media (max-width: 1023.98px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1023.98px) { body.more-open .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; z-index: 45; } }
@media (max-width: 1023.98px) { body.more-open nav#mainNav a.pri { display: none; } .navlbl { display: none; } }
.modal { z-index: 50; } .toast { z-index: 60; }
.login .brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login .logo { width: 44px; height: 40px; flex: none; display: block; }
.login h1 { color: #1F3557; }
body:has(form.login) { background: radial-gradient(1200px 600px at 50% -10%, #F6F2E8 0%, #F6F2E8 40%, var(--bg, #f6f7f9) 100%); } /* brand cream behind sign-in */
.login { box-shadow: var(--shadow-2); }
.login button { width: 100%; }
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* =====================================================================
   #213 v3 layer — redesign: centre card, language switch, booking drawer,
   reports revamp, add-ons, custom fields. Appends/overrides the above.
   ===================================================================== */
.centre-card { display: none; }
.side-foot { display: flex; align-items: center; gap: 8px; }
.langsw { display: flex; background: var(--line-2); border-radius: 10px; padding: 4px; gap: 4px; }
.lang { all: unset; box-sizing: border-box; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); font-family: var(--font); }
.lang.on { background: #fff; color: var(--text); box-shadow: var(--shadow-1); }
.lang:focus-visible { outline: 3px solid rgba(15,118,110,.35); }
.main-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.main-top .grow, .grow { flex: 1 1 auto; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.linkbtn { all: unset; cursor: pointer; color: var(--primary); font-weight: 600; font-family: var(--font); min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
.linkbtn:hover { text-decoration: underline; }
.small { font-size: 12.5px; }

@media (min-width: 1024px) {
  .centre-card { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fafbfc; margin: 0 4px; }
  .centre-card b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .centre-card span { font-size: 12px; }
  .side-foot { margin-top: 4px; padding: 0 4px; }
  .langsw { flex: 1; }
}
@media (max-width: 1023.98px) {
  .side-foot { order: 2; }
  .topbar .centre-card { display: none; }
  body.more-open .side-foot { position: fixed; bottom: calc(var(--tab) + 260px); inset-inline-end: 16px; z-index: 46; }
}

/* ---- new booking drawer ---- */
.drawer { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 48; display: flex; justify-content: flex-end; }
.drawer-box { background: var(--panel); width: min(560px, 100%); height: 100%; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-2); }
@media (max-width: 760px) { .drawer { align-items: flex-end; justify-content: stretch; } .drawer-box { width: 100%; height: 94%; border-radius: 20px 20px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); } }
.nb-head { display: flex; align-items: center; justify-content: space-between; }
.nb-head h3 { margin: 0; font-size: 18px; }
.nb-head .mx { inline-size: 44px; block-size: 44px; min-height: 44px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none; } /* v8 UI matrix: the close button was 34×27 on phones */
.lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 8px; }
.nb-search { display: flex; flex-direction: column; gap: 8px; }
.nb-results { display: flex; flex-direction: column; gap: 6px; }
.nb-res { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-family: var(--font); }
.nb-res:hover { border-color: var(--primary); background: var(--primary-soft); }
.nb-sel, .nb-newcus { display: flex; align-items: center; gap: 10px; border: 1px solid var(--primary); background: var(--primary-soft); border-radius: 12px; padding: 10px 12px; flex-wrap: wrap; }
.nb-newcus input { flex: 1 1 180px; }
.nb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.nb-card { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-family: var(--font); min-height: 44px; }
.nb-card:hover { border-color: var(--primary); }
.nb-card.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.nb-card.dis { opacity: .5; cursor: not-allowed; }
.nb-card.sm { min-height: 40px; }
.nb-days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.nb-day { all: unset; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 1px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer; font-family: var(--font); min-width: 72px; }
.nb-day b { font-size: 16px; }
.nb-day i { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; }
.nb-day.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.nb-day.dis { opacity: .5; cursor: not-allowed; }
.nb-group { margin-bottom: 6px; }
.nb-slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.nb-slot { all: unset; box-sizing: border-box; min-width: 72px; min-height: 40px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.nb-slot:hover { border-color: var(--primary); }
.nb-slot.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.nb-sum { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; }
.nb-sum > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.nb-sum > div:last-child { border-bottom: 0; }
.btn.full { width: 100%; min-height: 48px; font-size: 15.5px; }
.nb-ok { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin: auto 0; padding: 30px 0; }
.nb-ok .okic { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 30px; font-weight: 700; }
.nb-actions { display: flex; gap: 10px; }

/* ---- reports revamp ---- */
.pill { font: inherit; font-family: var(--font); font-size: 13.5px; font-weight: 500; padding: 8px 14px; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.pill.on { background: var(--primary); color: #fff; border-color: var(--primary); }
#rpBar { align-items: center; }
#rpBar input[type=date] { min-height: 40px; padding: 6px 10px; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 8px; overflow-x: auto; }
.bar-col { flex: 1 1 0; min-width: 22px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.bar-col .v { font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-col .bar-i { width: 100%; max-width: 44px; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar-col .d { font-size: 11px; color: var(--muted); white-space: nowrap; line-height: 1.25; text-align: center; }
@media (max-width: 560px) { .bar-col .d { font-size: 10px; } .bar-col { min-width: 30px; } }
.share { height: 10px; background: var(--line-2); border-radius: 999px; min-width: 70px; overflow: hidden; }
.share i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.share.big { flex: 1; height: 12px; }
.srcrow { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.srcrow span { width: 110px; flex: none; font-size: 13.5px; }
.srcrow b { width: 44px; text-align: end; font-variant-numeric: tabular-nums; }
#rpKpis .card .s { font-size: 12px; margin-top: 2px; }

/* ---- add-ons ---- */
.ao-card { display: flex; flex-direction: column; gap: 8px; }
.ao-card.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset, var(--shadow-1); }
.ao-top { display: flex; align-items: center; gap: 10px; }
.ao-top h3 { margin: 0; font-size: 16px; flex: 1; }
.ao-ico { font-size: 22px; }
.ao-card .btn { align-self: flex-start; }
#aoTrial .banner { margin-top: 0; }

/* ---- custom fields ---- */
.cf-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.cf-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; flex-wrap: wrap; }
.cf-row b { min-width: 140px; }
.cf-row .muted { flex: 1; font-size: 13px; }
/* #284 team rows: name, address and what the person sees are three facts, not one run-on line */
#tmList .cf-row { align-items: flex-start; }
#tmList .cf-main { display: grid; gap: 2px; flex: 1 1 200px; min-width: 0; }
#tmList .cf-main .muted { flex: none; }
#tmList .cf-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#tmList .cf-act { display: flex; gap: 6px; align-items: center; margin-inline-start: auto; }
.cf-row.off { border-style: dashed; background: var(--line-2); } /* A11Y-05: "inactive" shown by border+fill, not opacity, which dropped text to 3.96:1 */

/* ---- people directory (HR, 22 Oct) — rows an owner can scan, not cards full of absence ---- */
.hr-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.statline { display: flex; gap: 8px; flex-wrap: wrap; }
.statline .stat { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 14px; min-width: 104px; cursor: pointer; font: inherit; color: inherit; text-align: start; }
.statline .stat b { font-size: 20px; line-height: 1.1; }
.statline .stat span { font-size: 12px; color: var(--muted); }
.statline .stat.on { border-color: var(--primary); background: var(--primary-soft); }
.statline .stat.warn b { color: var(--warn); }
.hr-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
input.search { min-height: 40px; flex: 1 1 180px; min-width: 150px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--panel); font: inherit; }
.panel.flush { padding: 0; overflow: hidden; }
table.people { width: 100%; }
table.people th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; text-align: start; padding: 10px 14px; }
table.people td { vertical-align: baseline; text-align: start; padding: 10px 14px; } /* #469: one line across the row, as .tbl */
table.people th:nth-child(1), table.people td:nth-child(1) { width: 30%; }
table.people th:nth-child(2), table.people td:nth-child(2) { width: 16%; }
table.people th:nth-child(3), table.people td:nth-child(3) { width: 26%; }
table.people th:nth-child(4), table.people td:nth-child(4) { width: 22%; }
table.people .rt { text-align: end; width: 6%; white-space: nowrap; }
.ic.sm { width: 16px; height: 16px; }
.prow.flag td:first-child { border-inline-start: 3px solid var(--warn); } /* logical: an inset shadow does not mirror in RTL */
.prow.off { background: var(--line-2); } /* not opacity: it drops muted text under 4.5:1 */
.prow:hover { background: var(--line-2); }
.person { display: flex; align-items: center; gap: 10px; }
.pname { font-weight: 600; }
.pmeta { font-size: 12px; color: var(--muted); text-decoration: none; }
a.pmeta:hover { color: var(--primary); }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: 14px; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
td.chips { display: table-cell; }
td.chips .chip { margin-inline-end: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; background: var(--line-2); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.chip.ok { background: #e7f4ec; color: var(--ok); }
.chip.warn { background: #fef3e2; color: var(--warn); }
.chip.more { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.rowacts { display: inline-flex; gap: 4px; opacity: .25; transition: opacity .12s; }
.prow:hover .rowacts, .prow:focus-within .rowacts { opacity: 1; }
.btn.icon { padding: 6px 8px; line-height: 1; }
td.pad { padding: 22px 16px; }
@media (hover: none) { .rowacts { opacity: 1; } }
/* phone: the directory becomes cards, because a 5-column table is unusable at 390px */
@media (max-width: 760px) {
  table.people thead { display: none; }
  table.people, table.people tbody, table.people tr, table.people td { display: block; width: auto; }
  table.people tr.prow { border-bottom: 1px solid var(--line); padding: 10px 12px; }
  table.people td { border: 0; padding: 2px 0; }
  table.people td.rt { text-align: start; padding-top: 8px; }
  .prow.flag td:first-child { border-inline-start: 0; }
  .prow.flag { border-inline-start: 3px solid var(--warn); }
}

/* ---- a locked feature explains itself and can be switched on where you stand (21 Oct) ---- */
.locked-panel { display: flex; flex-direction: column; gap: 10px; max-width: 560px; }
.locked-head { display: flex; align-items: center; gap: 10px; }
.locked-head h3 { margin: 0; flex: 1; font-size: 17px; }
.locked-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ao-card.flash { outline: 2px solid var(--primary); outline-offset: 2px; transition: outline-color .3s; }

/* `hidden` must win over a component's own display (the global "new booking" button stayed visible
   on screens that hide it, because .btn sets display:inline-flex). */
[hidden] { display: none !important; }
/* the pinned sign-out sat on top of the last nav item instead of below it */
.side-foot a.logout { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.side-foot a.logout:hover { background: var(--line-2); color: var(--text); }
@media (min-width: 1024px) { .side-foot { flex-wrap: nowrap; justify-content: space-between; } }

/* ---- team cards (22 Oct): who, when, what they do — in that order ---- */
.staff-card { display: flex; flex-direction: column; gap: 12px; }
.staff-card.off { background: var(--line-2); border-style: dashed; } /* not opacity: it drops muted text under 4.5:1 */
.staff-head { display: flex; align-items: center; gap: 10px; }
.staff-head h3 { margin: 0; font-size: 16px; }
.staff-id { flex: 1; min-width: 0; }
.wk { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--line-2); border-radius: 10px; }
.wk.none { color: var(--warn); font-size: 13px; background: #fef3e2; }
.wk-dots { display: flex; gap: 4px; }
.wk-dot { width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; font-size: 11px; font-weight: 600;
  background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.wk-dot.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.wk-text { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--text); }
.wk-part b { font-weight: 600; }
.wk-part.off { color: var(--muted); }
.staff-svc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rowacts.always { opacity: 1; }
.btn.icon.danger svg { stroke: var(--danger); }

/* ---- Calendar: staff down the columns, the day down the side (21 Oct) ------------------------- */
.cal-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-when { display: flex; align-items: center; gap: 6px; }
.cal-when strong { font-size: 16px; margin-inline-start: 6px; }
.btn.icon { min-width: 34px; padding: 6px 10px; font-size: 16px; line-height: 1; }
.cal-spacer { flex: 1; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 2px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; min-height: 36px; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.08); }

.cal-scroll { position: relative; overflow: auto; max-height: 66vh; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.cal-heads { display: flex; position: sticky; top: 0; z-index: 4; background: var(--panel); border-bottom: 1px solid var(--line); }
.cal-corner { flex: none; width: 58px; position: sticky; inset-inline-start: 0; z-index: 5; background: var(--panel); border-inline-end: 1px solid var(--line); }
.cal-head { flex: 1 0 var(--colw, 160px); min-width: var(--colw, 160px); height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; padding: 0 6px; border-inline-start: 1px solid var(--line-2); overflow: hidden; white-space: nowrap; }
.cal-head .is-today { color: var(--primary); }
.cal-rows { display: flex; }
.cal-rail { flex: none; width: 58px; position: sticky; inset-inline-start: 0; z-index: 3; background: var(--panel); border-inline-end: 1px solid var(--line); }
.cal-h { position: absolute; inset-inline: 0; border-top: 1px dashed var(--line); }
.cal-h span { position: absolute; top: -8px; inset-inline-end: 6px; font-size: 11px; color: var(--muted); background: var(--panel); padding: 0 2px; font-variant-numeric: tabular-nums; }
.cal-col { flex: 1 0 var(--colw, 160px); min-width: var(--colw, 160px); position: relative; border-inline-start: 1px solid var(--line-2); cursor: copy; }
.cal-closed { position: absolute; inset-inline: 0; background: repeating-linear-gradient(135deg, var(--line-2) 0 6px, transparent 6px 12px); opacity: .7; }
.cal-off { position: absolute; inset-inline: 2px; border-radius: 6px; background: repeating-linear-gradient(135deg, #fde7e7 0 7px, #fbd5d5 7px 14px); }
.cal-now { position: absolute; inset-inline: 0; border-top: 2px solid var(--danger); z-index: 3; pointer-events: none; }
.cal-now span { position: absolute; top: -9px; inset-inline-start: 2px; font-size: 10px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 4px; padding: 0 4px; }
.cal-ev { position: absolute; inset-inline: 3px; z-index: 2; display: flex; flex-direction: column; gap: 1px; overflow: hidden;
  text-align: start; border: 0; border-inline-start: 3px solid var(--primary); background: var(--primary-soft); color: var(--primary-ink);
  border-radius: 8px; padding: 3px 6px; font: inherit; font-size: 12px; line-height: 1.25; cursor: pointer; }
.cal-ev:hover { filter: brightness(.97); box-shadow: 0 2px 6px rgba(16,24,40,.12); }
.cal-ev .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-ev .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev .s { opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.tight { flex-direction: row; align-items: center; gap: 5px; }
.cal-ev.tight .s { display: none; }
.cal-ev.st-completed { border-inline-start-color: var(--ok); background: #eaf6ec; color: #14532d; }
.cal-ev.st-no_show { border-inline-start-color: var(--warn); background: #fef3e2; color: #7c4a03; }
.cal-key { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.cal-key .k { width: 12px; height: 12px; border-radius: 4px; background: var(--primary-soft); border-inline-start: 3px solid var(--primary); display: inline-block; }
.cal-key .k.st-completed { background: #eaf6ec; border-inline-start-color: var(--ok); }
.cal-key .k.st-no_show { background: #fef3e2; border-inline-start-color: var(--warn); }
.cal-key .k-closed { background: repeating-linear-gradient(135deg, var(--line-2) 0 4px, transparent 4px 8px); border: 1px solid var(--line); }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.appt-detail { display: grid; gap: 6px; margin: 10px 0 14px; }
.appt-detail > div { display: flex; gap: 10px; align-items: baseline; border-bottom: 1px solid var(--line-2); padding-bottom: 6px; }
.appt-detail b { flex: none; width: 110px; color: var(--muted); font-weight: 600; font-size: 13px; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 1023.98px) { .cal-scroll { max-height: 60vh; } .cal-head { font-size: 12px; } .cal-corner, .cal-rail { width: 46px; } }


/* ---- dialogs that read like a form, not a wall of inputs (21 Oct) ---- */
.sheet { display: flex; flex-direction: column; gap: 4px; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.sheet-head h3 { margin: 0; }
.sheet-head p { margin: 2px 0 0; }
.fs { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.fs:last-of-type { border-bottom: 0; }
.fs > h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.fs > h4 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.chips.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.pick label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; min-height: 36px; }
.chips.pick label:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.hours-list { display: grid; gap: 6px; }
.adv summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 0; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }

/* An empty table says what the panel is for, instead of a lone dash. */
.tempty { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 28px 16px; }
.tempty b { font-size: 14px; }
.tempty .muted { font-size: 13px; max-width: 46ch; }
.tbl .rt { text-align: end; white-space: nowrap; }
.tbl tbody tr:hover .rowacts, .tbl tbody tr:focus-within .rowacts { opacity: 1; }

/* Settings is sectioned: 30 fields in one slab had no shape, and Save was 2,400px down. */
.sgrp { margin-bottom: 14px; }
.sgrp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.sgrp-head h3 { margin: 0; font-size: 16px; }
.sgrp-head p { margin: 0; flex: 1 1 260px; font-size: 13px; }
.sgrp-head .btn { margin-inline-start: auto; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.check-row .check { flex: 0 1 auto; }
.sublbl { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
.sublbl .muted { font-size: 13px; }
.pb-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.pb-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-row select, .pb-row input { min-width: 0; }
.pb-row select { flex: 0 1 160px; }
.pb-row input[type=time] { flex: 0 1 130px; }
.publicrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 -6px 18px rgba(16, 24, 40, .06); margin-bottom: 14px; }

.ao-ico .ic, .locked-head .ic { width: 22px; height: 22px; stroke: var(--primary); }
.bsep { color: var(--muted); margin: 0 8px; }

/* The owner's home: 13 flat tiles with three bare dashes read as broken. Grouped by period,
   with connections shown as a status chip instead of a number that does not exist. */
.statgrp { margin-bottom: 14px; }
.statgrp > h4 { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.statgrp .cards { margin-bottom: 0; }
.card .sub { font-size: 12px; margin-top: 2px; }
.card .nodata { font-size: 15px; font-weight: 500; color: var(--muted); }
.card .grade { font-size: 14px; color: var(--muted); font-weight: 600; }
.connrow { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.conn { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }

.tbl tfoot td { border-top: 2px solid var(--line); background: var(--line-2); }

/* Inventory: a workspace with sub-tabs, because stock, assets, orders and suppliers are four jobs. */
.invtabs { margin-bottom: 14px; }
.toolbar.wrap { flex-wrap: wrap; gap: 8px; align-items: center; }
.todo { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.todo:last-child { border-bottom: 0; }
.todo > div { display: grid; gap: 2px; }
.todo .muted { font-size: 13px; }
.todo .btn { margin-inline-start: auto; flex: none; }
.sc-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.sc-facts b { color: var(--text); }
.sc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.poline { display: grid; grid-template-columns: 1.6fr 1.4fr 80px 110px 44px; gap: 6px; margin-bottom: 6px; align-items: center; }
.rcrow { display: flex; gap: 8px; align-items: center; }
.rcrow select { flex: 1 1 200px; }
.rcrow input { flex: 0 1 120px; }
@media (max-width: 760px) { .poline { grid-template-columns: 1fr 1fr; } }

/* the inventory toolbar keeps search on the left, filters in the middle and actions together */
.toolbar.wrap .search { flex: 1 1 240px; min-width: 200px; }
.toolbar.wrap .chips { flex: 0 1 auto; }
.toolbar.wrap .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }
.toolbar.wrap select { min-width: 150px; }
.tbl td.sup { max-width: 170px; }
/* #469: cells line up on their first line of text — a name link, a status pill, a small "2 full pay" and a button all share
   one baseline, and a cell that wraps to two lines still starts level with its neighbours */
.tbl td, .tbl th { vertical-align: baseline; }
.tbl .nowrap, .tbl .mono, .tbl td.ltr { white-space: nowrap; }
table.people td:first-child { min-width: 180px; }
.rowacts { opacity: .45; }

.tbl td.lim { min-width: 190px; }

.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 42ch; }

/* six sub-tabs do not fit a phone: let the strip scroll rather than the page */
.invtabs { overflow-x: auto; scrollbar-width: none; }
.invtabs::-webkit-scrollbar { display: none; }
.invtabs .seg { flex: 0 0 auto; }
@media (max-width: 760px) { .invtabs .seg button { white-space: nowrap; } }

/* Touch targets, last word (these rules are defined after the components they fix, so they win). */
@media (pointer: coarse) {
  .seg button { min-height: 44px; }
  input.search { min-height: 44px; }
  a.pmeta { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ───────────── HR (#283) ───────────── */
:is(#view-hr, #view-me) .kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
:is(#view-hr, #view-me) .kv:last-child { border-bottom: 0; }
:is(#view-hr, #view-me) .kv.total { border-top: 2px solid var(--line); border-bottom: 0; margin-top: 4px; padding-top: 10px; font-size: 15px; }
:is(#view-hr, #view-me) .kv > span:first-child { min-width: 0; }
:is(#view-hr, #view-me) .tbl-wrap { overflow-x: auto; }
:is(#view-hr, #view-me) .num { font-variant-numeric: tabular-nums; }
:is(#view-hr, #view-me) .hot { color: var(--danger, #b42318); }
:is(#view-hr, #view-me) .cold { color: var(--warn); }
:is(#view-hr, #view-me) .chip.off { background: var(--line-2); color: var(--muted); }
:is(#view-hr, #view-me) .warnbox { background: color-mix(in srgb, var(--warn) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line)); border-radius: 10px; padding: 10px 12px; }
:is(#view-hr, #view-me) .grid2 { margin-bottom: 16px; }
:is(#view-hr, #view-me) .hr-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
:is(#view-hr, #view-me) .hr-split > * { min-width: 0; }
:is(#view-hr, #view-me) .cards .card .n { font-size: 22px; overflow-wrap: anywhere; }
:is(#view-hr, #view-me) .panel h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
:is(#view-hr, #view-me) .panel h3 .btn { margin-inline-start: auto; }
:is(#view-hr, #view-me) .cards.mini { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin: 8px 0; }
:is(#view-hr, #view-me) .cards.mini .card .n { font-size: 20px; }
:is(#view-hr, #view-me) .prow.click { cursor: pointer; }
:is(#view-hr, #view-me) .prow.click:hover td { background: var(--line-2); }
:is(#view-hr, #view-me) .inline { display: inline-flex; align-items: center; gap: 8px; }

/* needs your attention: severity is a stripe on the reading edge, so it mirrors in Arabic */
:is(#view-hr, #view-me) .hr-att { border-inline-start: 3px solid transparent; padding-inline-start: 10px; }
:is(#view-hr, #view-me) .hr-att.high { border-inline-start-color: var(--danger, #b42318); }
:is(#view-hr, #view-me) .hr-att.medium { border-inline-start-color: var(--warn); }
:is(#view-hr, #view-me) .hr-att.low { border-inline-start-color: var(--line); }
:is(#view-hr, #view-me) .hr-att .sev { display: none; }

:is(#view-hr, #view-me) .hr-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
:is(#view-hr, #view-me) .hr-bar { display: grid; grid-template-columns: minmax(0, 7em) 1fr auto; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
:is(#view-hr, #view-me) .hr-bar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:is(#view-hr, #view-me) .hr-bar .track { block-size: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
:is(#view-hr, #view-me) .hr-bar .track i { display: block; block-size: 100%; background: var(--primary); border-radius: 99px; }
:is(#view-hr, #view-me) .hr-trend { display: flex; align-items: flex-end; gap: 6px; block-size: 140px; padding-top: 8px; }
:is(#view-hr, #view-me) .hr-trend .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; block-size: 100%; min-width: 0; }
:is(#view-hr, #view-me) .hr-trend .col i { display: block; inline-size: 100%; max-inline-size: 36px; background: color-mix(in srgb, var(--primary) 75%, var(--panel)); border-radius: 6px 6px 2px 2px; }
:is(#view-hr, #view-me) .hr-trend .col span { font-size: 11px; color: var(--muted); }
:is(#view-hr, #view-me) .hr-dual { display: grid; gap: 3px; margin-bottom: 2px; }
:is(#view-hr, #view-me) .hr-dual span { display: block; block-size: 7px; border-radius: 99px; min-inline-size: 2px; }
:is(#view-hr, #view-me) .hr-dual .rev { background: var(--primary); }
:is(#view-hr, #view-me) .hr-dual .cost { background: color-mix(in srgb, var(--muted) 45%, var(--panel)); }
:is(#view-hr, #view-me) th.wide { min-width: 180px; }

/* the profile */
:is(#view-hr, #view-me) .hr-head2 { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
:is(#view-hr, #view-me) .hr-head2 .who { flex: 1 1 260px; min-width: 0; display: grid; gap: 4px; }
:is(#view-hr, #view-me) .hr-head2 h2 { margin: 0; font-size: 20px; }
:is(#view-hr, #view-me) .hr-head2 .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
:is(#view-hr, #view-me) .hr-head2 .facts { display: flex; gap: 20px; flex-wrap: wrap; }
:is(#view-hr, #view-me) .hr-head2 .facts > div { display: grid; gap: 2px; }
:is(#view-hr, #view-me) .avatar.lg { inline-size: 56px; block-size: 56px; font-size: 20px; flex: none; }
:is(#view-hr, #view-me) .hr-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
:is(#view-hr, #view-me) .hr-card.superseded { background: var(--line-2); }
:is(#view-hr, #view-me) .hr-task { display: flex; align-items: center; gap: 8px; padding: 6px 0; min-height: 40px; }
:is(#view-hr, #view-me) .hr-task .muted { margin-inline-start: auto; }
:is(#view-hr, #view-me) .hr-list { margin: 6px 0; padding-inline-start: 18px; }
:is(#view-hr, #view-me) .stars { color: #b7791f; letter-spacing: 1px; }
:is(#view-hr, #view-me) .settle { margin-top: 12px; }
#modalBox .hr-form fieldset, #modalBox fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0 0 12px; min-width: 0; }
#modalBox legend { padding: 0 6px; font-weight: 600; font-size: 13px; color: var(--muted); }
#modalBox .hr-goal { display: grid; grid-template-columns: 1fr 70px; gap: 8px; margin-bottom: 6px; }
#modalBox .hr-impact .cards.mini { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
#modalBox .hr-impact .card .n { font-size: 20px; }
#modalBox .hr-impact .warnbox { background: color-mix(in srgb, var(--warn) 9%, var(--panel)); border-radius: 8px; padding: 8px 10px; }
#modalBox .payslip .ps-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
#modalBox .payslip tr.total td { border-top: 2px solid var(--line); font-weight: 600; }
@media print {
  body * { visibility: hidden !important; }
  #modalBox .payslip, #modalBox .payslip * { visibility: visible !important; }
  #modalBox .payslip { position: absolute; inset: 0 auto auto 0; inline-size: 100%; }
  .noprint { display: none !important; }
}

/* #289 rota grid, and the "new version" bar */
#view-hr table.rota th, #view-hr table.rota td { vertical-align: top; }
#view-hr table.rota td.rota-cell { min-inline-size: 84px; cursor: pointer; }
#view-hr table.rota td:first-child { min-inline-size: 150px; }
#view-hr table.rota td.rota-cell:hover { background: var(--line-2); }
#view-hr table.rota td.rota-cell .chip { min-height: 32px; padding: 4px 8px; font-size: 12px; margin: 2px 0; }
#view-hr table.rota td.rota-cell .badge { display: inline-block; margin-bottom: 2px; }
.update-bar { position: fixed; inset-inline: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  max-inline-size: 520px; margin-inline: auto; padding: 10px 14px; border-radius: 12px; background: var(--ink, #1d2939); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
@media (min-width: 900px) { .update-bar { bottom: 20px; } }

#view-me .cards.mini { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
@media (max-width: 600px) { #view-me .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ================= #291 dialog shell and forms ================= */
.modal { background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); }
.modal-box { padding: 0; display: flex; flex-direction: column; overflow: hidden; max-width: 680px; border-radius: 16px; border: 1px solid var(--line); }
.modal-box > .mh { display: flex; align-items: flex-start; gap: 12px; padding: 18px 24px 14px; border-bottom: 1px solid var(--line-2); background: var(--panel); flex-wrap: wrap; }
.modal-box > .mh h3 { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.35; flex: 1 1 auto; min-width: 0; }
.modal-box > .mh .sub { flex: 1 0 100%; order: 3; margin: -2px 0 0; color: var(--muted); font-size: 13px; }
.modal-box > .mh .mx { order: 2; inline-size: 36px; block-size: 36px; min-height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; margin-inline-start: auto; }
.modal-box > .mh .mx:hover { background: var(--line-2); color: var(--text); }
.modal-box > .mb { padding: 20px 24px 24px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.modal-box > .mf { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--line); background: #fafbfc; }
.modal-box > .mf .btn { min-width: 104px; justify-content: center; }
.modal-box > .mf .btn.primary { order: 3; }
.modal-box > .mf:has(.btn.primary) .btn.danger { order: -1; margin-inline-end: auto; }

/* fields: label above, quiet, consistent */
.modal-box .form-grid { gap: 16px 16px; }
.modal-box .form-grid label, .modal-box label { font-size: 13px; font-weight: 550; color: var(--text); gap: 6px; }
.modal-box .form-grid label > input, .modal-box .form-grid label > select, .modal-box .form-grid label > textarea { font-weight: 400; }
.modal-box input, .modal-box select, .modal-box textarea { inline-size: 100%; background: #fff; border: 1px solid #d5dae1; transition: border-color .15s, box-shadow .15s; }
.modal-box input:hover, .modal-box select:hover, .modal-box textarea:hover { border-color: #b9c1cc; }
.modal-box input:focus, .modal-box select:focus, .modal-box textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.modal-box input[type=checkbox], .modal-box input[type=radio] { inline-size: 18px; }
.modal-box .form-grid .check { font-weight: 500; background: var(--line-2); border-radius: 10px; padding: 10px 12px; }
.modal-box textarea { min-height: 84px; resize: vertical; }
.modal-box .hint, .modal-box p.muted.small { font-size: 12.5px; color: var(--muted); }

/* sections instead of boxes */
#modalBox fieldset, #modalBox .hr-form fieldset, .modal-box fieldset.group { border: 0; border-top: 1px solid var(--line-2); border-radius: 0; padding: 18px 0 6px; margin: 0; display: block; grid-column: 1 / -1; min-width: 0; }
#modalBox fieldset:has(> label) { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#modalBox fieldset > .form-grid { margin-top: 12px; clear: both; }
#modalBox fieldset:first-of-type { border-top: 0; padding-top: 0; }
#modalBox legend { float: inline-start; inline-size: 100%; grid-column: 1 / -1; padding: 0; margin: 0 0 2px; font-size: 14px; font-weight: 650; color: var(--primary-ink); letter-spacing: .01em; }
#modalBox fieldset > legend + * { clear: both; }
#modalBox fieldset > .full, #modalBox fieldset > .hint { grid-column: 1 / -1; }

/* long forms open as a side panel */
.modal.drawer { justify-content: flex-end; align-items: stretch; padding: 0; }
.modal.drawer .modal-box { max-width: 600px; inline-size: 100%; max-height: none; block-size: 100%; border-radius: 0; border-block: 0; border-inline-end: 0; animation: tyDrawer .18s ease-out; }
@keyframes tyDrawer { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
[dir=rtl] .modal.drawer .modal-box { animation-name: tyDrawerRtl; }
@keyframes tyDrawerRtl { from { transform: translateX(-24px); opacity: .6; } to { transform: none; opacity: 1; } }

@media (max-width: 700px) {
  .modal-box > .mh { padding: 16px 16px 12px; }
  .modal-box > .mb { padding: 16px; }
  .modal-box > .mf { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-box > .mf .btn { flex: 1 1 0; }
  #modalBox fieldset:has(> label) { grid-template-columns: 1fr; }
  .modal.drawer { align-items: flex-end; }
  .modal.drawer .modal-box { block-size: 94vh; border-radius: 20px 20px 0 0; max-width: none; animation: none; }
}
.modal-box .req { color: var(--danger); font-weight: 700; }
.modal-box label .hint { font-weight: 400; display: block; }
/* #291 overview: attention grouped by type */
#view-hr .att-group { border: 1px solid var(--line-2); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
#view-hr .att-group > .att-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fafbfc; font-weight: 600; }
#view-hr .att-group > .att-h .dot { inline-size: 8px; block-size: 8px; border-radius: 99px; background: var(--line); flex: 0 0 auto; }
#view-hr .att-group.high > .att-h .dot { background: var(--danger); } #view-hr .att-group.medium > .att-h .dot { background: var(--warn); }
#view-hr .att-group > .att-h .badge { margin-inline-start: auto; }
#view-hr .att-group .todo { padding: 10px 14px; border-top: 1px solid var(--line-2); border-inline-start: 0; }
#view-hr .att-group .todo b { font-weight: 550; }
#view-hr .att-group .more { display: block; inline-size: 100%; padding: 8px 14px; border: 0; border-top: 1px solid var(--line-2); background: none; color: var(--primary); font: inherit; font-size: 13px; cursor: pointer; text-align: start; }
.modal-box input[type=file] { border: 1.5px dashed #c5ccd6; background: #fafbfc; padding: 14px; min-height: 64px; cursor: pointer; color: var(--muted); }
.modal-box input[type=file]:hover { border-color: var(--primary); background: var(--primary-soft); }
.modal-box input[type=file]::file-selector-button { font: inherit; font-weight: 550; color: var(--primary-ink); border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; margin-inline-end: 12px; cursor: pointer; }
#modalBox .kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
#modalBox .kv:last-child { border-bottom: 0; }
#modalBox .panel > b:first-child { display: block; margin-bottom: 4px; }

/* ================= #296 reports, owner dashboard, module dashboards ================= */
.rx-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.rx-bar-wrap { display: grid; gap: 4px; margin-top: 10px; }
.rx-ctl { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
.rx-ctl select, .rx-ctl input { min-height: 40px; padding: 6px 10px; min-width: 150px; }
.rx-range { align-self: center; }
.rx-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; margin-bottom: 16px; }
.card.rx-kpi { text-align: start; font: inherit; cursor: pointer; display: grid; gap: 4px; align-content: start; transition: border-color .15s, box-shadow .15s; }
.card.rx-kpi:hover { border-color: var(--primary); box-shadow: var(--shadow-2); }
.card.rx-kpi .l { font-size: 13px; color: var(--muted); font-weight: 550; }
.card.rx-kpi .n { font-size: 24px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.card.rx-kpi.sm .n { font-size: 20px; }
.rx-cmp { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rx-d { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rx-d.sm { font-size: 11.5px; padding: 0 6px; }
.rx-d.good { background: #e6f4ea; color: #0f6b30; } .rx-d.bad { background: #fdecea; color: #9b1c12; } .rx-d.flat { background: var(--line-2); color: var(--muted); }
.rx-chart svg { inline-size: 100%; block-size: 220px; display: block; }
.rx-chart .g { stroke: var(--line-2); stroke-width: 1; } .rx-chart .t { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.rx-chart path.c0 { fill: none; stroke: var(--primary); stroke-width: 2.5; } .rx-chart path.c1 { fill: none; stroke: #98a2b3; stroke-width: 2; stroke-dasharray: 5 4; }
.rx-chart path.c2 { fill: none; stroke: #b45309; stroke-width: 2; } .rx-chart path.a { fill: color-mix(in srgb, var(--primary) 10%, transparent); stroke: none; }
.rx-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.rx-legend i { display: inline-block; inline-size: 14px; block-size: 3px; border-radius: 2px; margin-inline-end: 6px; vertical-align: middle; }
.rx-legend i.c0 { background: var(--primary); } .rx-legend i.c1 { background: #98a2b3; } .rx-legend i.c2 { background: #b45309; }
.rx-hbars { display: grid; gap: 8px; }
.rx-hb { display: grid; grid-template-columns: minmax(0, 9em) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.rx-hb .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-hb .trk { display: grid; gap: 3px; } .rx-hb .trk i { display: block; block-size: 9px; border-radius: 99px; background: var(--primary); }
.rx-hb .trk i.s1 { background: #98a2b3; } .rx-hb .trk i.s2 { background: #b45309; }
.rx-three { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.rx-three .panel h3 { margin-top: 0; }
.rx-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.rx-group h3 { margin: 0 0 8px; display: flex; gap: 8px; align-items: center; }
.rx-item { display: grid; gap: 2px; inline-size: 100%; text-align: start; background: none; border: 0; border-top: 1px solid var(--line-2); padding: 10px 4px; font: inherit; cursor: pointer; color: var(--text); }
.rx-item:hover b { color: var(--primary); }
.rx-lock { display: block; margin-top: 8px; font-size: 13px; color: var(--muted); text-decoration: none; }
.rx-head h2 { margin: 0 0 4px; } .rx-head p { margin: 0; }
.rx-tbl th.sortable { cursor: pointer; user-select: none; }
.rx-tbl tr.rx-total td { font-weight: 700; background: #fafbfc; border-top: 2px solid var(--line); }
.rx-tbl td.rt, .rx-tbl th.rt { text-align: end; }
.rx-sum { margin-bottom: 14px; }
.rx-export { position: relative; }
.rx-export .menu { display: none; position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; z-index: 10; min-inline-size: 170px; }
.rx-export.open .menu { display: grid; }
.rx-export .menu a, .rx-export .menu button { display: block; text-align: start; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.rx-export .menu a:hover, .rx-export .menu button:hover { background: var(--line-2); }
.rx-preview { white-space: pre-wrap; background: #f6f7f9; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; font: inherit; font-size: 13px; line-height: 1.7; max-block-size: 260px; overflow: auto; margin: 6px 0 0; }
.mstrip { margin-bottom: 14px; }
.mstrip-in { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.mstrip-in > .card { flex: 1 1 170px; min-inline-size: 0; }
.mstrip-in > .mstrip-more { flex: 0 0 auto; }
.mstrip-more { font: inherit; font-weight: 600; color: var(--primary); background: var(--primary-soft); border: 0; border-radius: var(--radius); padding: 0 16px; cursor: pointer; min-height: 44px; }
.mstrip-note { margin: 6px 2px 0; }
@media (max-width: 700px) { .mstrip-in > .card { flex: 1 1 calc(50% - 10px); } .mstrip-in > .mstrip-more { flex: 1 1 100%; } .rx-ctl select, .rx-ctl input { min-width: 0; inline-size: 100%; } .rx-bar .rx-ctl { flex: 1 1 140px; } }
@media print { nav, header, .tabbar, .toolbar, .invtabs, .rx-bar-wrap .rx-bar, .mstrip, #globalNew { display: none !important; } .panel { break-inside: avoid; border: 0; } }

/* ── Invoicing (#297) ── */
.chip.bad { background: #fdecea; color: #9b1c12; }
.chip.info { background: #e8f0fe; color: #1a4fa0; }
.chip.off { background: var(--line-2); color: var(--muted); }
.chip.sm { font-size: 11px; padding: 0 6px; }
.bx-tbl tr.click, .rx-tbl tr.click { cursor: pointer; }
.bx-tbl tr.click:hover td { background: var(--primary-soft); }
.bx-late { color: #9b1c12; font-size: 12px; font-weight: 650; }
.bx-soon { color: var(--warn); font-size: 12px; font-weight: 650; }
.bx-state { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bx-state p { flex-basis: 100%; margin: 4px 0 0; }
.bx-sums { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.bx-sum-i { display: flex; flex-direction: column; gap: 2px; background: var(--line-2); border-radius: 10px; padding: 8px 12px; }
.bx-sum-i span { font-size: 12px; color: var(--muted); }
.bx-sum-i b { font-size: 15px; }
.bx-sum-i.strong { background: var(--primary-soft); }
.bx-sum-i.strong b { font-size: 18px; color: var(--primary); }
.bx-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.bx-lines { font-size: 13.5px; }
.bx-lines td, .bx-lines th { padding: 8px 6px; }
.bx-li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.bx-li:last-child { border-bottom: 0; }
.bx-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.bx-hist li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bx-line { display: grid; grid-template-columns: 1.2fr 1fr 1fr 70px 100px 90px 110px 36px; gap: 6px; align-items: end; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.bx-line label { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; color: var(--muted); }
.bx-line label span { white-space: nowrap; }
.bx-line .bxDelL { align-self: center; }
.modal.drawer .bx-line { grid-template-columns: 1fr 1fr; }
.modal.drawer .bx-line > select.bxSvc { grid-column: 1 / -1; }
.modal.drawer .bx-line .bxDelL { justify-self: end; }
.bx-ph { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bx-ph h4 { margin: 0; }
.bx-set .panel { margin-bottom: 12px; }
.bx-set .lbl { margin: 0 0 8px; }
@media (max-width: 760px) {
  .bx-line { grid-template-columns: 1fr 1fr; }
  .bx-line > select.bxSvc { grid-column: 1 / -1; }
  #invTable th:nth-child(2), #invTable td:nth-child(2) { display: none; }
}
.bx-stack { display: grid; gap: 14px; }
.bx-stack td.rt { white-space: nowrap; }
tr.bx-more td { text-align: center; padding: 10px; }
.form-grid label.check-row { flex-direction: row; align-items: center; gap: 8px; display: flex; }
@media (max-width: 760px), (pointer: coarse) { .rx-ctl select, .rx-ctl input, .rx-bar select, .rx-bar input, .bx-line input, .bx-line select { min-height: 44px; } }

/* ── Finance (#298) ── */
.fx-two { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.fx-side { display: grid; gap: 14px; }
.fx-side .panel, .fx-two > .panel { margin: 0; }
.fx-scroll { overflow-x: auto; }
.fx-neg { color: #9b1c12; }
.card.rx-kpi.neg .n { color: #9b1c12; }
.card.rx-kpi.warn { border-color: #f3c98b; }
.fx-bud { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; margin-bottom: 10px; }
.fx-bud-h { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.fx-bud .meter { block-size: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.fx-bud .meter i { display: block; block-size: 100%; border-radius: 99px; }
.fx-cash { display: flex; align-items: flex-end; gap: 10px; padding: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.fx-cm { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fx-cb { display: flex; align-items: flex-end; gap: 3px; block-size: 90px; }
.fx-cb i { display: block; inline-size: 14px; border-radius: 4px 4px 0 0; min-block-size: 2px; }
.fx-cb i.in, .fx-cash .rx-legend i.in { background: var(--primary); }
.fx-cb i.out, .fx-cash .rx-legend i.out { background: #e0a43a; }
.fx-cash .rx-legend { margin-inline-start: auto; display: flex; gap: 12px; }
.fx-cash .rx-legend i { display: inline-block; inline-size: 10px; block-size: 10px; border-radius: 3px; margin-inline-end: 4px; }
.fx-links { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-bgt { font-size: 13px; min-inline-size: 1100px; }
.fx-bgt th[scope=row] { text-align: start; white-space: nowrap; font-weight: 600; position: sticky; inset-inline-start: 0; background: var(--panel); }
.fx-bgt td { padding: 4px; vertical-align: baseline; } .fx-bgt th[scope=row] { vertical-align: baseline; } /* #469: label, figures and total on one line */
.fx-bgt input { inline-size: 76px; padding: 6px; font-size: 13px; text-align: end; }
.fx-act { display: block; font-size: 11px; color: var(--muted); text-align: end; padding-inline-end: 4px; }
.fx-grp td { background: var(--line-2); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 960px) { .fx-two { grid-template-columns: 1fr; } }
.fx-cash-t { inline-size: 100%; margin: 0 0 4px; }
.fx-bgt input { min-height: 34px; block-size: 34px; padding: 4px 6px; }
#fxTable td:first-child { white-space: nowrap; }

/* ── #265 staff photos ── */
img.avatar.photo { object-fit: cover; background: var(--line-2); padding: 0; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.tm-photo { display: grid; gap: 6px; }
.tm-photo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tm-photo-row label.btn { cursor: pointer; }

/* records phase 1: case file — legal confirmations and smart filling */
.rc-terms { white-space: pre-line; background: var(--line-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.6; max-height: 40vh; overflow: auto; margin: 8px 0 12px; }
.rc-check { align-items: flex-start !important; font-size: 13.5px; line-height: 1.5; }
.rc-check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.rc-warn { color: var(--warn); }
.rc-notice { font-size: 13.5px; border: 1px solid var(--line); border-inline-start: 3px solid var(--warn); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rc-notice.ok { border-inline-start-color: var(--ok); color: var(--ok); }
.rc-row { display: block; }
.rc-row > div + div { margin-top: 4px; }
.rc-visit { font-weight: 600; color: var(--primary-2); }
.rc-ai { display: flex; flex-direction: column; gap: 6px; background: #eef7f6; border: 1px solid #cfe6e3; border-radius: 10px; padding: 10px 12px; }
.rc-ai.off { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--line-2); border-color: var(--line); }
.rc-ai textarea { width: 100%; }
.rc-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rc-tools .btn { min-height: 44px; }
#rcMic[aria-pressed="true"] { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.rc-set { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.rc-set summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.rc-set .rc-check { display: flex; gap: 8px; margin-top: 10px; }
.tm-hist select { max-width: 100%; min-height: 44px; }
.tm-hist { align-items: center; }

/* forms review: ⓘ help, AR/EN twins, AI fill */
.fh-btn, .fx-tr { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-inline-start: 4px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; vertical-align: middle; font-size: 13px; line-height: 1; }
.fh-btn:hover, .fh-btn[aria-expanded="true"], .fx-tr:hover { color: var(--primary); background: #e6f4f1; }
.fh-btn:focus-visible, .fx-tr:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* touch screens: a 44 px tap area around the same small icon; the negative margin keeps the label row its normal height */
@media (pointer: coarse), (max-width: 1023.98px) { .fh-btn, .fx-tr { width: 44px; height: 44px; margin-block: -10px; margin-inline-start: -6px; margin-inline-end: -10px; } }
.fh-pop { display: block; margin: 2px 0 6px; padding: 8px 10px; border-radius: 8px; background: #f1f7f6; border: 1px solid #cfe6e3; color: var(--text); font-size: 13px; font-weight: 400; line-height: 1.55; white-space: normal; }
.fh-pop[hidden] { display: none; }
input.fx-ai, textarea.fx-ai, select.fx-ai { background: #fffbea; border-color: #e9cf72; }
.fx-busy { background-image: linear-gradient(90deg, transparent, #eef7f6, transparent); background-size: 200% 100%; animation: fxShimmer 1.1s linear infinite; }
@keyframes fxShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .fx-busy { animation: none; } }
.fx-aibar { display: flex; flex-direction: column; gap: 6px; background: #eef7f6; border: 1px solid #cfe6e3; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.fx-airow { display: flex; gap: 8px; }
.fx-airow input { flex: 1; min-width: 0; min-height: 44px; }
.fx-airow .btn { min-height: 44px; }
.spec-pick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.svc-group { margin-top: 8px; }
.svc-group > .muted { display: block; margin-bottom: 4px; font-size: 12.5px; }
.fx-lrow { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.check > .fx-lrow, label.check .fx-lrow { display: inline; }
.spec-pick label.chip { flex-direction: row; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; color: var(--text); font-weight: 500; }
.spec-pick label.chip input { width: 18px; height: 18px; margin: 0; }

/* ================= Stream E (release fixes, Oct 2026): dialogs, errors, phone sheet, a11y ================= */
/* UX-H1: the stacked "+ Specialty / Insurer / Payment method" dialog is a real dialog */
.fx-stack { position: fixed; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(16, 24, 40, .45); }
.fx-stack-box { background: var(--panel); color: var(--text); inline-size: 100%; max-inline-size: 560px; max-block-size: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.fx-stack-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line-2); }
.fx-stack-head h3 { margin: 0; flex: 1; font-size: 17px; font-weight: 650; }
.fx-stack-head .mx { inline-size: 44px; block-size: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none; }
.fx-stack-body { padding: 16px 20px; overflow: auto; flex: 1 1 auto; min-block-size: 0; }
.fx-stack-body .form-grid { gap: 14px; }
.fx-stack-body label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; color: var(--text); margin-bottom: 10px; }
.fx-stack-body .form-grid label { margin-bottom: 0; }
.fx-stack-body label.check { flex-direction: row; align-items: center; background: var(--line-2); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
.fx-stack-body input:not([type=checkbox]):not([type=radio]), .fx-stack-body select, .fx-stack-body textarea { inline-size: 100%; font-weight: 400; }
.fx-stack-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); background: #fafbfc; position: sticky; bottom: 0; }
.fx-stack-foot .btn { min-inline-size: 104px; }
.e-ask { margin: 0; line-height: 1.7; }
@media (max-width: 760px) {
  .fx-stack { align-items: flex-end; padding: 0; }
  .fx-stack-box { max-inline-size: none; border-radius: 20px 20px 0 0; max-block-size: 92vh; }
  .fx-stack-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .fx-stack-foot .btn { flex: 1 1 0; }
}
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.solid:hover { background: #912018; }
/* UX-H2: errors in words, next to the field */
.e-banner { background: #fdecea; color: #7f1d1d; border: 1px solid #f1c4c0; border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-size: 14px; line-height: 1.55; }
.e-bad, .modal-box .e-bad, .fx-stack-body .e-bad { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(180, 35, 24, .14) !important; }
.e-fieldmsg { display: block; color: var(--danger); font-size: 12.5px; font-weight: 500; margin-top: 2px; }
.req { color: var(--danger); font-weight: 700; }
.toast { display: flex; align-items: center; gap: 12px; max-inline-size: min(92vw, 560px); line-height: 1.45; }
.toast.err { background: #7f1d1d; }
.toast-act { all: unset; cursor: pointer; font-weight: 700; text-decoration: underline; min-block-size: 44px; min-inline-size: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; color: #a7f3d0; font-family: var(--font); }
.toast-act:focus-visible { outline: 2px solid #fff; border-radius: 6px; }
/* UX-H3: on a phone, the language switch and sign-out get their own row at the foot of the "More" sheet */
@media (max-width: 1023.98px) {
  body.more-open nav#mainNav > .side-foot { position: static; grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; margin-top: 2px; border-top: 1px solid var(--line-2); }
  body.more-open nav#mainNav > .side-foot a.logout { flex-direction: row; min-height: 44px; background: none; font-size: 14px; }
  .topbar > .side-foot { display: none; }
}
/* keyboard: a skip link that appears on focus */
.skip-link { position: absolute; inset-inline-start: 8px; top: -80px; z-index: 100; background: var(--primary); color: #fff; padding: 10px 16px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 10px; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 8px; }
main:focus { outline: none; }
.modal-box > .mh h2 { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.35; flex: 1 1 auto; min-width: 0; }
/* M-16: Settings section index */
.set-nav { position: sticky; top: 0; z-index: 6; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding: 8px 2px 10px; margin-bottom: 8px; background: var(--bg); }
.set-nav a { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.set-nav a:hover, .set-nav a:focus-visible { border-color: var(--primary); color: var(--primary-ink); }
@media (max-width: 1023.98px) { .set-nav { top: 52px; } }
/* M-12: row actions are always readable (opacity .45 made them 2.9:1), chip greens a shade darker */
.rowacts, .tbl tbody tr .rowacts { opacity: 1; }
.chip.ok, .chip.ok.sm, .badge.confirmed { color: #0f6a31; }
/* M-14: phone cards — a gap between label and value, no label on the actions cell */
@media (max-width: 760px) {
  table.people td[data-label]::before { content: attr(data-label); display: inline-block; color: var(--muted); font-size: 12.5px; margin-inline-end: 8px; min-inline-size: 72px; }
  table.people td:first-child::before, table.people td.rt::before { content: none; }
}
/* M-11: time off shows visible From / To labels */
.to-f { display: inline-flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
@media (max-width: 760px) { .form-row > .to-f { flex: 1 1 100%; } .to-f input { inline-size: 100%; } }
.nb-hint { flex: 1 0 100%; }
.pt-hist .lbl { display: block; margin-top: 4px; }
.pt-id bdi { unicode-bidi: isolate; }
.inbox-empty { margin: auto; max-inline-size: 52ch; }
/* F-18: 44px touch targets on phones for status filters, budget cells, rota chips and checkboxes */
@media (pointer: coarse) {
  .statline .stat { min-height: 44px; justify-content: center; }
  .fxB, .fx-bgt input.fxB { min-height: 44px; block-size: 44px; }
  .chip { min-width: 44px; justify-content: center; }
  #modalBox a.ltr, #view-hr a.ltr, #modalBox .kv a { display: inline-flex; align-items: center; min-height: 44px; }
  #view-hr table.rota td.rota-cell .chip { min-height: 44px; padding: 8px 10px; }
  input[type=checkbox], .form-grid .check input, .modal-box input[type=checkbox] { width: 24px; height: 24px; min-height: 24px; inline-size: 24px; }
}
/* M-2: at 1366×860 the whole sidebar fits (Plan & add-ons and Settings were clipped, with no cue) */
@media (min-width: 1024px) {
  nav#mainNav a { min-height: 34px; padding: 5px 12px; }
  .navlbl { margin: 6px 12px 0; }
  .topbar { gap: 8px; padding-block: 12px; }
  nav#mainNav.more-below { box-shadow: inset 0 -12px 10px -10px rgba(16,24,40,.18); }
}
@media (min-width: 1024px) and (max-height: 780px) { .centre-card { display: none; } }
/* UX-0549: a person's name in the payroll and HR tables stays on one or two lines */
#view-hr .tbl td:first-child { min-inline-size: 170px; }
#view-hr .tbl td:first-child .linkbtn { white-space: normal; overflow-wrap: normal; }
/* M-9: customer combobox */
.e-combo { position: relative; z-index: 3; margin-top: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-2); max-block-size: 300px; overflow: auto; }
.e-opt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; min-height: 44px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.e-opt:last-child { border-bottom: 0; }
.e-opt:hover, .e-opt.on { background: var(--primary-soft); }
.e-none { padding: 10px 12px; }
/* UX-0542: the long staff form folds Services and Hours (open for a new member) */
details.fs-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; }
details.fs-fold > summary::-webkit-details-marker { display: none; }
details.fs-fold > summary::before { content: "▸"; color: var(--muted); font-size: 12px; transition: transform .15s; }
[dir=rtl] details.fs-fold > summary::before { content: "◂"; }
details.fs-fold[open] > summary::before { transform: rotate(90deg); }
[dir=rtl] details.fs-fold[open] > summary::before { transform: rotate(-90deg); }
details.fs-fold > summary h4 { margin: 0; }
/* UX-0507 / UX-0534: a sideways strip fades at its far edge while it continues */
.e-morex { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
[dir=rtl] .e-morex { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
#modalBox:focus, #drawerBox:focus, .fx-stack-box:focus { outline: none; }

/* Integration (UX-0533 / UX-M13): the budget grid stays a real table on a phone and scrolls sideways
   (the generic "table becomes cards" rule and .panel.flush overflow:hidden made its inputs unreachable) */
@media (max-width: 760px) {
  table.tbl.fx-bgt { display: table; width: auto; background: var(--panel); }
  table.tbl.fx-bgt thead { display: table-header-group; }
  table.tbl.fx-bgt tbody { display: table-row-group; }
  table.tbl.fx-bgt tr { display: table-row; }
  table.tbl.fx-bgt td, table.tbl.fx-bgt th { display: table-cell; width: auto; }
  table.tbl.fx-bgt td::before { content: none; }
  .panel.flush.fx-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── #373 add-on trials ── */
.ao-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.ao-card.trial { border-color: #f3c98b; }
.banner.ao-trial-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: #fef3e2; color: #7a4a00; border-color: #f3c98b; margin-bottom: 12px; }
.locked-panel .muted.small { margin: 8px 0 0; }

/* #381 desk payments: one row per part (method, amount, reference) */
.pay-part{display:grid;grid-template-columns:minmax(140px,1.2fr) minmax(100px,.8fr) minmax(120px,1fr) auto;gap:8px;align-items:end;margin:6px 0}
.pay-part .ppX{margin-bottom:4px;justify-self:end;width:auto;min-width:36px}
.pay-bal{margin:4px 0 10px}
.pay-acts{margin:4px 0 10px}
@media (max-width:640px){.pay-part{grid-template-columns:1fr 1fr}.pay-part label:nth-child(3){grid-column:1/-1}}

/* G-27: customer notes on the card */
.pt-notes .note-box { background: #fff8e6; border: 1px solid #f3dca0; border-radius: 10px; padding: 8px 10px; font-size: 13.5px; white-space: normal; }
/* G-35: the decision per affected booking needs room for "Reschedule to Wed, 11 Nov, 14:00" */
.toAct { min-width: 280px; max-width: 100%; }
@media (max-width: 640px) { .toAct { min-width: 0; width: 100%; } }
/* G-33: the front-desk queue strip above Today's appointments */
.queue-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chip.err { background: #fdecea; color: #b42318; }
/* G-34: inbox workflow */
.chat-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.chat-tools select { max-width: 180px; }
.msg.note { background: #fff8e6; border: 1px dashed #f3dca0; align-self: center; max-width: 90%; font-size: 13px; }
.note-box-wrap { display: flex; gap: 6px; margin: 8px 0 0; } .note-box-wrap textarea { flex: 1; }
.chip.tiny { font-size: 11px; padding: 1px 6px; }
.qr-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; } .qr-list .qr { display: flex; flex-direction: column; align-items: flex-start; text-align: start; }
/* G-29: several services in one visit */
.nb-pos { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px; background: var(--accent, #0f766e); color: #fff; font-size: 11px; text-align: center; margin-inline-end: 2px; }
.nb-chain-hint { margin: -4px 0 8px; }
/* G-43 setup checklist */
.setup-card .su-bar { height: 6px; background: var(--line); border-radius: 3px; margin: 4px 0 10px; } .setup-card .su-bar i { display: block; height: 100%; background: var(--accent, #0f766e); border-radius: 3px; }
.su-list { margin: 0; padding-inline-start: 18px; columns: 2; font-size: 14px; } .su-list li { margin: 0; break-inside: avoid; } .su-list li.done { color: var(--muted); }
.su-list li a { display: inline-block; min-height: 44px; line-height: 44px; } /* phone: a 44px tap target (UI smoke) */
@media (max-width: 640px) { .su-list { columns: 1; } }
/* G-32 series */
.nb-repeat { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; padding-inline: 1px; } .nb-repeat label { flex: 1 1 140px; min-width: 0; }
.nb-card b { display: flex; align-items: center; gap: 4px; } .nb-x { margin-inline-start: auto; font-size: 12px; font-weight: 400; color: var(--muted, #5f6f76); padding: 2px 4px; }
/* G-38 family members */
.pt-deps .chip { margin: 2px 4px 2px 0; } .dp-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; } .dp-form input, .dp-form select { flex: 1 1 120px; }
.nb-for { display: block; margin: 6px 0 2px; }
/* HR attendance "show all" (UI smoke 10 Nov): a 44px tap target on a phone */
#hrPane button.more { min-height: 44px; }
/* Owner cockpit: support requests in the centre dashboard */
.sp-t { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; } .sp-r { margin-top: 6px; padding: 6px 8px; background: var(--primary-soft, #e2f3ef); border-radius: 8px; font-size: 14px; }
.sp-nps { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 12px; } .sp-nps-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; } .sp-nps-b { min-width: 44px; min-height: 44px; padding: 0; } .sp-nps-ends { display: flex; justify-content: space-between; }
/* #435 (Hassan, 12 Nov): Support and Log out overlapped in the 240px sidebar footer. Language sits on its own row;
   Support and Log out share the row under it, each with its own half. */
@media (min-width: 1024px) {
  .side-foot { flex-wrap: wrap; justify-content: flex-start; row-gap: 6px; }
  .side-foot .langsw { flex: 0 0 auto; }
  .side-foot a.logout { flex: 1 1 calc(50% - 4px); min-width: 0; justify-content: center; padding-inline: 8px; }
  .side-foot .langsw + a.logout { margin-inline-start: 0; }
  .side-foot::after { content: none; }
  .side-foot .langsw { margin-inline-end: 100%; }
}
/* Gap 4 (12 Nov): a confirmation that needs words, and the Removed list */
.e-askf { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 13px; font-weight: 550; }
.e-askf input { min-height: 44px; }
#binList .tbl td { vertical-align: top; }
/* Gap 1 and 2 (12 Nov): emergency banner on the case file; one switch per area on the Team form */
.rc-em { background: #fff3d6; border: 1px solid #f0d58a; color: #5c3d00; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.rc-lite-acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.tm-areas { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 12px 0 0; min-width: 0; }
.tm-areas legend { font-weight: 650; font-size: 14px; padding: 0 6px; }
.tm-area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; margin-top: 8px; }
.tm-area { display: flex; flex-direction: row !important; align-items: center; gap: 8px; min-height: 40px; font-weight: 500; font-size: 14px; cursor: pointer; }
.tm-area.locked { color: var(--muted); cursor: default; }
.tm-area input { inline-size: 18px !important; flex: none; }
/* Gap 3 (12 Nov): the line manager's list in My HR; who a pending request waits for */
.me-team-h { padding: 16px 18px 12px; } .me-team-h h3 { margin: 0 0 4px; } .me-team-h p { margin: 0; }
.me-team-none { padding: 4px 18px 18px; margin: 0; }
.lv-wait { display: inline-block; margin-top: 2px; }
/* Gap 5 (12 Nov): the owner's Activity list */
.act-filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 14px; }
.act-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; min-width: 180px; flex: 1 1 180px; max-width: 280px; }
.act-more { margin: 12px 0 0; text-align: center; }
/* #445 (12 Nov): Settings shows one section at a time — a grouped list at the side, the chosen section beside it */
#view-settings.set-2col:not(.hidden) { display: grid; grid-template-columns: 252px minmax(0, 1fr); column-gap: 28px; align-items: start; }
#view-settings.set-2col > * { grid-column: 2; min-width: 0; max-width: 940px; }
#view-settings.set-2col > .set-side { grid-column: 1; grid-row: 1 / span 40; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 12px; }
.set-side .set-gt { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 14px 10px 4px; }
.set-side .set-g:first-of-type .set-gt { padding-top: 8px; }
.set-side a { display: flex; width: 100%; box-sizing: border-box; align-items: center; min-height: 40px; padding: 6px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14.5px; line-height: 1.3; }
.set-side a:hover, .set-side a:focus-visible { background: var(--bg); }
.set-side a[aria-current="true"] { background: #e6f4f1; color: var(--primary); font-weight: 650; }
.set-side .set-pick { display: none; }
#view-settings .sec-off { display: none !important; }
#view-settings.set-2col .sgrp { margin-top: 0; }
#view-settings.set-2col .sgrp-head h3 { font-size: 19px; }
#view-settings.set-2col .sgrp-head h3:focus { outline: none; }
@media (max-width: 1023.98px) {
  #view-settings.set-2col:not(.hidden) { display: block; }
  #view-settings.set-2col > .set-side { position: static; max-height: none; border: 0; background: none; padding: 0; margin-bottom: 12px; }
  .set-side .set-g { display: none; }
  .set-side .set-pick { display: flex; flex-direction: column; gap: 6px; font-weight: 650; font-size: 14px; }
  .set-side .set-pick select { min-height: 48px; font-size: 16px; width: 100%; }
}
#actTbl td:nth-child(3) { min-width: 170px; } #actTbl td:nth-child(4) { min-width: 180px; }
/* Pilot guide A7 (13 Nov): moving a booking from the desk */
.mv-slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.mv-slot { min-width: 84px; min-height: 44px; }
.mv-slot.on { background: var(--primary); color: #fff; border-color: var(--primary); }
/* 13 Nov alignment review — every label line is the same height (a help ⓘ is 24 px), so fields in one row stay level */
.form-grid label > .e-lbl, .form-grid label > .fx-lrow, .fg > label > .e-lbl, .fg > label > .fx-lrow { min-height: 24px; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; }
/* 13 Nov alignment review — `.pad` was defined for table cells only, so headings, notes and toolbars given it inside a full-width
   (flush) panel sat against the panel's edge. One rule gives all of them the panel's own inner spacing. */
.panel.flush > h3.pad, .panel.flush > h3:not(.pad):first-child, .panel.flush > .toolbar.pad, .panel.flush > p.pad, .panel.flush > div.pad,
.panel.flush > .toolbar:first-child { padding: 16px 18px 12px; margin: 0; }
.panel.flush > .toolbar.pad h3, .panel.flush > .toolbar:first-child h3 { margin: 0; }
p.pad:not(.panel.flush > p), div.pad:not(.panel.flush > div) { padding: 14px 18px; }
/* an empty list says so, in the panel's spacing — not a bare "—" against the edge */
.e-none { color: var(--muted); font-size: 14px; padding: 14px 18px; margin: 0; }
.panel:not(.flush) > .e-none, .panel:not(.flush) .e-none { padding: 6px 0; }
td.e-none { padding: 18px; text-align: start; }
/* the 12-month budget grid scrolls sideways on every screen size (desktop cut it off: .panel.flush hides overflow) */
.panel.flush.fx-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 13 Nov alignment review — phone cards: a cell holding two parts (a name and its TRN, an amount and "of which overdue") ran off
   the right edge and was cut. The parts now wrap under the value, right-aligned; the label stays on the left. */
@media (max-width: 760px) {
  .tbl td[data-label] { flex-wrap: wrap; justify-content: flex-end; text-align: end; row-gap: 2px; }
  .tbl td[data-label]::before { margin-inline-end: auto; text-align: start; }
  .tbl td > * { max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
  .tbl td > br { display: none; }
}
/* figure strips (We owe / of which overdue, receipts by method …): on a phone the boxes share the row evenly, two to a line */
@media (max-width: 760px) { .statline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } .statline .stat { min-width: 0; } }
/* setup checklist: mark and step on one line; an open step is a clear link, not a default blue line that broke under its mark */
.su-list li { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.su-list li::marker { content: none; }
.su-list { list-style: none; padding-inline-start: 0; counter-reset: su; }
.su-list li::before { counter-increment: su; content: counter(su) "."; color: var(--muted); min-inline-size: 18px; font-variant-numeric: tabular-nums; }
.su-mark { inline-size: 16px; text-align: center; flex: none; }
.su-list li a { display: inline-flex; align-items: center; min-height: 44px; line-height: 1.35; color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
/* the Today figure strips start in line with the headings above them (the first card snapped against the screen edge) */
@media (max-width: 760px) { #view-dashboard .statgrp .cards { scroll-padding-inline: 14px; } }

/* #469: a status pill in a table never breaks over two lines ("in 13 / days") */
.tbl .chip, .tbl .badge { white-space: nowrap; }
/* #469: HR → Leave shows "Pending" and "Upcoming" as two tables of the same columns, one under the other: same widths, so
   the columns line up from one to the next */
@media (min-width: 761px) {
  .lv-tbl { table-layout: fixed; min-width: 720px; }
  .lv-tbl th:nth-child(1) { width: 24%; } .lv-tbl th:nth-child(2) { width: 13%; } .lv-tbl th:nth-child(3), .lv-tbl th:nth-child(4) { width: 14%; }
  .lv-tbl th:nth-child(5) { width: 8%; } .lv-tbl th:nth-child(6) { width: 13%; } .lv-tbl th:nth-child(7) { width: 14%; }
}
/* #469: two columns of panels: each panel is as tall as what it holds (a short panel next to a long one was stretched into a
   big empty white box) */
.grid2 { align-items: start; }
/* Reports → Usage: figures never break mid-number, the cap field sits under its label, the bill lines up on one line per row */
.meter .row b { white-space: nowrap; padding-inline-start: 8px; }
#usageBox .inline-edit { display: flex; margin: 6px 0 4px; }
table.billing td { vertical-align: baseline; }
table.billing td:last-child { white-space: nowrap; text-align: end; }
/* #469: card figures stay on one line (app.js shrinks a long one to fit its card) */
.card .n { white-space: nowrap; }
.cards > .card { min-width: 0; } /* a long figure shrinks inside its card; it never widens the row */
:is(#view-hr, #view-me) .cards .card .n { overflow-wrap: normal; }
/* #469: the customer-list column widths (30 / 16 / 26 / 22 %) are for a list of 5 columns; a wider table (stock: 10 columns)
   squeezed its later columns into three-line cells and pushed the row buttons out of sight — size those by content */
table.people:has(thead th:nth-child(7)) :is(th, td) { width: auto; }
table.people:has(thead th:nth-child(7)) td.sup { min-width: 120px; }
/* wide lists (stock: ten columns, offers: nine): text stays readable; if the table is still wider than the screen it scrolls
   sideways and the row buttons stay pinned at the end, always in view */
@media (min-width: 761px) {
  .pin-acts { overflow: visible; } /* the table clips its corners; sticky needs the scroll box above it */
  .stock-tbl td.sup { white-space: nowrap; max-width: none; }
  .pin-acts th:last-child, .pin-acts td.rt { position: sticky; inset-inline-end: 0; background: var(--panel); box-shadow: -8px 0 8px -8px rgba(15, 23, 42, .18); }
  [dir=rtl] .pin-acts th:last-child, [dir=rtl] .pin-acts td.rt { box-shadow: 8px 0 8px -8px rgba(15, 23, 42, .18); }
  .pin-acts th:last-child { background: #fafbfc; }
  .offers-tbl td.lim { min-width: 140px; }
}
/* HR → Settings, document register (a narrow side panel): the expiry badge keeps its width, names and document types wrap */
.reg-tbl td:last-child { width: 1%; white-space: nowrap; text-align: end; }
/* HR → Attendance: "Today" (names + a button) takes the narrower side, the month summary (five figures) the wider one */
#hrPane .grid2.att-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
/* HR → Rota: nine columns share the width evenly, so "Hours this week" is never cut off */
#view-hr table.rota { table-layout: fixed; }
#view-hr table.rota th:first-child { width: 17%; }
#view-hr table.rota th { white-space: normal; }
/* #469: in a narrow panel a long column heading wraps onto two lines instead of pushing the last column out of sight */
#hrPane .att-grid .tbl th { white-space: normal; }
.reg-tbl td { padding-inline: 8px; } #view-hr .reg-tbl td:first-child { min-width: 0; }
.reg-tbl .linkbtn { white-space: normal; text-align: start; }
/* #469: a single checkbox with its label: the box stays beside its text (on a phone it dropped onto a line of its own) and a
   long label wraps under itself, with its "?" help button, inside the screen */
label.check-row:has(> input[type=checkbox]:first-child) { flex-wrap: nowrap; align-items: center; gap: 8px; min-width: 0; }
label.check-row:has(> input[type=checkbox]:first-child) > .fx-lrow { display: block; min-width: 0; flex: 1 1 auto; } /* text wraps, the "?" flows after it */
/* #479 (14 Nov): New booking → staff as one compact list (only those who offer the visit), "Any staff" first, next free time */
.nb-staff { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.nb-st { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 48px; cursor: pointer; font-family: var(--font); border-top: 1px solid var(--line); }
.nb-st:first-child { border-top: 0; }
.nb-st:hover { background: var(--bg, #f8fafc); }
.nb-st:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.nb-st.on { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
[dir=rtl] .nb-st.on { box-shadow: inset -3px 0 0 var(--primary); }
.nb-st-n { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.nb-st-n b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-st-t { white-space: nowrap; color: var(--primary); font-weight: 600; }
.nb-st-t.muted { color: var(--muted); font-weight: 400; }
.nb-any { background: var(--primary-soft); color: var(--primary); }
.nb-back { margin-top: 6px; min-height: 32px; font-weight: 500; }
/* #480 (14 Nov): the booking drawer is a scrolling flex column — a child that scrolls sideways (the day strip) or clips
   (the staff list) was squeezed to a sliver when the drawer filled up, so the days could not be seen or tapped */
.drawer-box > * { flex-shrink: 0; }
#nbGo.is-need { opacity: .72; }
.e-flash { animation: eFlash 1.2s ease-out; }
@keyframes eFlash { 0%, 40% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: 0 0 0 0 transparent; } }
.nb-day > span { white-space: nowrap; }
.nb-day { min-width: 76px; }

/* #507 voice replies: voice picker and the two sample buttons, aligned with the fields around them */
.vr-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 16px; align-items: end; }
.vr-row[hidden] { display: none; }
.vr-row .vr-try { display: flex; flex-direction: column; gap: 6px; }
.vr-row .vr-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.vr-row .hint { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) { .vr-row { grid-template-columns: 1fr; } }
