/* =====================================================================
   COMPONENTS — built ONLY from tokens.css. No raw colours or sizes here.
   Layout uses logical properties (inline/block) so Arabic RTL works.
   Screens in screens/*.html only combine these classes.
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
}
html[lang="ar"] body { font-family: var(--font-arabic); }

a { color: var(--color-link); }
a:hover { color: var(--color-link-hover); }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }   /* phone numbers, refs */
.nowrap { white-space: nowrap; }
.table td.ltr { white-space: nowrap; }
.muted { color: var(--color-text-muted); }
.soft { color: var(--color-text-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Typography ---------- */
.t-title { font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); }
.t-title-lg { font-size: var(--text-3xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); line-height: var(--leading-tight); }
.t-h2 { font-size: var(--text-xl); font-weight: var(--weight-semibold); }
.t-h3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.t-meta { font-size: var(--text-md); color: var(--color-text-muted); }
.t-label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.t-sentence { font-size: var(--text-xl); font-weight: var(--weight-medium); line-height: 1.4; max-inline-size: 720px; }

/* ---------- Layout ---------- */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-inline-size: 0; }
.row-top { align-items: flex-start; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }

/* App shell: sidebar + main; sidebar stacks on small screens */
.app { display: flex; flex-wrap: wrap; min-block-size: 100vh; }
.sidebar {
  flex: 1 1 var(--sidebar-w); max-inline-size: 260px;
  background: var(--color-surface);
  border-inline-end: var(--border-width) solid var(--color-border);
  padding: var(--space-6) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-6);
}
.main {
  flex: 999 1 560px; min-inline-size: 0;
  padding: var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-6);
  max-inline-size: var(--content-max);
}
@media (max-width: 720px) {
  .sidebar { max-inline-size: none; flex-basis: 100%; border-inline-end: 0; border-block-end: var(--border-width) solid var(--color-border); padding: var(--space-4); }
  .main { padding: var(--space-4); }
}

.brand { display: flex; align-items: center; gap: var(--space-3); padding-inline: var(--space-2); font-weight: var(--weight-bold); font-size: var(--text-lg); }
a.brand { text-decoration: none; color: inherit; }
.brand-mark { inline-size: 32px; block-size: 32px; border-radius: var(--radius-sm); background: var(--color-primary); color: var(--color-text-on-primary); display: grid; place-items: center; }

.nav { display: flex; flex-direction: column; gap: var(--space-1); }
.nav-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px var(--space-3); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--color-text-soft); font-size: var(--text-base);
}
.nav-link:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.nav-link[aria-current="page"] { background: var(--color-surface-sunken); color: var(--color-text); font-weight: var(--weight-semibold); }
.nav-count { font-weight: var(--weight-semibold); color: var(--heat-hot-text); }

/* Mobile screen frame (mockups only) */
.phone {
  inline-size: 390px; max-inline-size: 100%; min-block-size: 844px; margin-inline: auto;
  background: var(--color-bg); display: flex; flex-direction: column;
  border: var(--border-width) solid var(--color-border); border-radius: var(--radius-xl); overflow: hidden;
}
.phone-body { flex: 1; padding: var(--space-1) var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.mobile-header { padding: var(--space-5) var(--space-5) var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); }

.bottom-nav {
  block-size: 72px; background: var(--color-surface); border-block-start: var(--border-width) solid var(--color-border);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center;
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-text-muted); text-decoration: none; }
.bottom-nav a[aria-current="page"] { color: var(--color-text); font-weight: var(--weight-semibold); }

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--space-4); }
.breadcrumb { font-size: var(--text-md); color: var(--color-text-muted); }

/* ---------- Card ---------- */
.card {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.card-sm { padding: var(--space-4); }
.card-flush { padding: 0; overflow: hidden; }
.card-section { padding: var(--space-4) var(--space-5); border-block-end: var(--border-width) solid var(--color-divider); }
.card-quiet { background: var(--color-surface-muted); border-color: transparent; }
a.card { text-decoration: none; color: inherit; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-block-size: var(--control-h-md); padding-inline: var(--space-4);
  border-radius: var(--radius-md); border: var(--border-width) solid var(--color-border-strong);
  background: var(--color-surface); color: var(--color-text);
  font-size: var(--text-base); font-weight: var(--weight-semibold);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--duration) var(--ease);
}
.btn:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-on-primary); }
.btn-primary:hover { background: var(--color-primary-hover); color: var(--color-text-on-primary); }
.btn-lg { min-block-size: var(--control-h); font-size: 15px; }
.btn-sm { min-block-size: var(--control-h-sm); padding-inline: var(--space-3); font-size: var(--text-md); }
.btn-block { inline-size: 100%; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-icon { inline-size: var(--control-h-md); padding: 0; border-radius: var(--radius-pill); }
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.btn-row > .btn.grow { flex: 1; }

/* Choice chips (outcomes, filters) */
.choice {
  min-block-size: var(--control-h-sm); padding-inline: var(--space-3);
  border-radius: var(--radius-pill); border: var(--border-width) solid var(--color-border-strong);
  background: var(--color-surface); color: var(--color-text); font-size: var(--text-md); cursor: pointer;
}
.choice[aria-pressed="true"] { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-on-primary); font-weight: var(--weight-semibold); }
/* Same chip as a link (filters, aria-current) or as a label around a radio/checkbox (forms without JS) */
a.choice, label.choice { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; position: relative; }
a.choice:hover, label.choice:hover { color: var(--color-text); border-color: var(--color-text-muted); }
a.choice[aria-current="true"], a.choice[aria-current="page"], label.choice:has(input:checked) { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-on-primary); font-weight: var(--weight-semibold); }
label.choice > input { position: absolute; opacity: 0; inline-size: 1px; block-size: 1px; margin: 0; }
label.choice:has(input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.choice-count { color: inherit; opacity: 0.7; font-variant-numeric: tabular-nums; }
.btn-lg.choice, .choice-lg { min-block-size: var(--control-h); padding-inline: var(--space-4); }

/* ---------- Status chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1); flex-shrink: 0;
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  padding: var(--space-1) 10px; border-radius: var(--radius-pill); white-space: nowrap;
  background: var(--heat-cooled-bg); color: var(--heat-cooled-text);
}
.chip-hot { background: var(--heat-hot-bg); color: var(--heat-hot-text); }
.chip-warm { background: var(--heat-warm-bg); color: var(--heat-warm-text); }
.chip-cooled { background: var(--heat-cooled-bg); color: var(--heat-cooled-text); }
.chip-none { background: var(--color-surface-sunken); color: var(--color-text-muted); }
.chip-ok { background: var(--status-ok-bg); color: var(--status-ok-text); }
.chip-fixed { background: var(--status-fixed-bg); color: var(--status-fixed-text); }
.chip-error { background: var(--status-error-bg); color: var(--status-error-text); }
.chip-info { background: var(--status-info-bg); color: var(--status-info-text); }

.dot { inline-size: 12px; block-size: 12px; border-radius: var(--radius-xs); display: inline-block; flex-shrink: 0; }
.dot-hot { background: var(--heat-hot); }
.dot-warm { background: var(--heat-warm); }
.dot-cooled { background: var(--heat-cooled); }
.dot-none { background: var(--heat-none); }

/* ---------- Heat bar ---------- */
.heat-bar { block-size: 6px; border-radius: var(--radius-pill); background: var(--heat-track); overflow: hidden; }
.heat-bar > span { display: block; block-size: 100%; border-radius: inherit; background: var(--heat-cooled); }
.heat-bar.hot > span { background: var(--heat-hot); }
.heat-bar.warm > span { background: var(--heat-warm); }

/* ---------- Progress / usage ---------- */
.progress { block-size: 8px; border-radius: var(--radius-pill); background: var(--color-border); overflow: hidden; }
.progress > span { display: block; block-size: 100%; background: var(--color-primary); }

/* ---------- Lead card (Call today) ---------- */
.lead { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.lead-name { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.lead-why { font-size: var(--text-base); line-height: var(--leading-normal); }
.lead-outcomes { border-block-start: var(--border-width) solid var(--color-divider); padding-block-start: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.lead.is-done { opacity: 0.6; }
.lead-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.lead-title { display: flex; flex-direction: column; gap: 2px; min-inline-size: 0; }
.lead-label { font-size: var(--text-md); font-weight: var(--weight-medium); color: var(--color-text-muted); }

/* ---------- Heat grid ---------- */
.heat-grid { display: grid; grid-template-columns: repeat(auto-fill, var(--tile)); gap: var(--space-1); }
.heat-grid > i, .heat-grid > a { display: block; inline-size: var(--tile); block-size: var(--tile); border-radius: var(--radius-xs); background: var(--heat-none); }
.heat-grid > .h { background: var(--heat-hot); }
.heat-grid > .w { background: var(--heat-warm); }
.heat-grid > .c { background: var(--heat-cooled); }
.heat-grid > a:hover, .heat-grid > a:focus-visible { outline: 2px solid var(--color-text); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-5); font-size: var(--text-md); color: var(--color-text-soft); }
.legend span { display: inline-flex; align-items: center; gap: var(--space-2); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.table { inline-size: 100%; min-inline-size: 720px; border-collapse: collapse; font-size: var(--text-base); }
.table th { text-align: start; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-muted); padding: var(--space-3); }
.table td { padding: 14px var(--space-3); border-block-start: var(--border-width) solid var(--color-divider); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-inline-start: var(--space-5); }
.table th:last-child, .table td:last-child { padding-inline-end: var(--space-5); }
.cell-title { font-weight: var(--weight-semibold); }
.table th a { color: inherit; text-decoration: none; }
.table th a:hover { color: var(--color-text); }
.cell-sub { font-size: var(--text-sm); color: var(--color-text-muted); }
.cell-was { font-size: var(--text-sm); color: var(--color-text-muted); text-decoration: line-through; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.hint { font-size: var(--text-sm); color: var(--color-text-muted); }
.input, .select, .textarea {
  min-block-size: var(--control-h-md); padding: 10px var(--space-3);
  border-radius: var(--radius-md); border: var(--border-width) solid var(--color-border-strong);
  background: var(--color-surface); color: var(--color-text);
}
.textarea { min-block-size: 96px; resize: vertical; }
.check { display: flex; align-items: center; gap: var(--space-2); min-block-size: var(--control-h-sm); font-size: var(--text-base); }
.check input { inline-size: 18px; block-size: 18px; accent-color: var(--color-primary); }

/* Switch */
.switch { position: relative; display: inline-flex; inline-size: 44px; block-size: 26px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch span { inline-size: 100%; block-size: 100%; border-radius: var(--radius-pill); background: var(--color-border-strong); transition: background var(--duration) var(--ease); }
.switch span::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; inline-size: 20px; block-size: 20px; border-radius: 50%; background: var(--color-surface); box-shadow: var(--shadow-sm); transition: transform var(--duration) var(--ease); }
.switch input:checked + span { background: var(--color-primary); }
.switch input:checked + span::after { transform: translateX(18px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-18px); }

/* ---------- Stepper (import, onboarding) ---------- */
.stepper { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; margin: 0; }
.stepper li { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-md); color: var(--color-text-muted); padding-inline-end: var(--space-3); }
.stepper li b { inline-size: 24px; block-size: 24px; border-radius: 50%; display: grid; place-items: center; font-size: var(--text-sm); background: var(--color-surface-sunken); color: var(--color-text-muted); }
.stepper li[aria-current="step"] { color: var(--color-text); font-weight: var(--weight-semibold); }
.stepper li[aria-current="step"] b, .stepper li.done b { background: var(--color-primary); color: var(--color-text-on-primary); }

/* ---------- Banner ---------- */
.banner { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--status-info-bg); color: var(--status-info-text); font-size: var(--text-md); }
.banner-warn { background: var(--heat-warm-bg); color: var(--heat-warm-text); }

/* ---------- Timeline (recipient activity) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 20px 1fr auto; gap: var(--space-3); padding-block: var(--space-3); border-block-start: var(--border-width) solid var(--color-divider); align-items: start; }
.timeline li:first-child { border-block-start: 0; }
.timeline .tl-dot { inline-size: 10px; block-size: 10px; border-radius: 50%; margin-block-start: 6px; background: var(--heat-cooled); }
.timeline .tl-dot.hot { background: var(--heat-hot); }
.timeline .tl-dot.call { background: var(--color-primary); }

/* ---------- Plan cards ---------- */
.plan { display: flex; flex-direction: column; gap: var(--space-4); }
.plan.is-current { border: 2px solid var(--color-primary); }
.plan-price { font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }
.plan-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-md); color: var(--color-text-soft); }
.plan-list li::before { content: "✓"; color: var(--status-ok); font-weight: var(--weight-bold); margin-inline-end: var(--space-2); }

/* ---------- Dark panel (bot / alert preview) ---------- */
.panel-dark { background: var(--color-panel-dark); border-radius: var(--radius-xl); padding: var(--space-6); display: flex; flex-direction: column; gap: 14px; color: var(--color-panel-dark-text); }
.bubble { background: var(--color-panel-dark-raised); border-radius: 14px; padding: var(--space-3) 14px; font-size: var(--text-md); }
.bubble-light { background: var(--color-surface); color: var(--color-text); border-radius: 14px; padding: var(--space-4); display: flex; flex-direction: column; gap: 10px; }

/* ---------- Printed ticket ---------- */
.ticket { display: flex; background: var(--color-surface); border: var(--border-width) solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }
.ticket-main { flex: 1; padding: var(--space-6); display: flex; flex-direction: column; gap: 14px; }
.ticket-stub { inline-size: 140px; padding: var(--space-6) var(--space-4); display: flex; flex-direction: column; justify-content: space-between; background: var(--color-surface-sunken); border-inline-start: 2px dashed var(--color-border-strong); }
.qr { inline-size: 132px; block-size: 132px; padding: var(--space-2); border: var(--border-width) solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-paper); flex-shrink: 0; display: block; }

/* ---------- Letter editor ---------- */
.paper { aspect-ratio: 210 / 297; inline-size: 100%; max-inline-size: 520px; background: var(--color-paper); color: var(--color-paper-text); box-shadow: var(--shadow-overlay); border-radius: var(--radius-xs); position: relative; padding: 8%; font-size: 11px; line-height: 1.5; }
.paper-line { block-size: 8px; border-radius: 4px; background: var(--color-paper-line); margin-block-end: 10px; }
.drop-box { position: absolute; border: 2px dashed var(--color-focus); border-radius: var(--radius-sm); background: var(--color-focus-tint); display: grid; place-items: center; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-focus); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: var(--space-12) var(--space-6); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.checklist li { display: flex; gap: var(--space-3); align-items: center; font-size: var(--text-base); }
.checklist li i { inline-size: 20px; block-size: 20px; border-radius: 50%; border: 2px solid var(--color-border-strong); flex-shrink: 0; }
.checklist li.done i { background: var(--status-ok); border-color: var(--status-ok); }
.checklist li.done span { color: var(--color-text-muted); text-decoration: line-through; }

/* Icons: inline SVG, stroke = currentColor */
.icon { inline-size: 20px; block-size: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[dir="rtl"] .icon-dir { transform: scaleX(-1); }

/* ---------- Platform admin ---------- */
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); background: var(--color-admin); color: var(--color-text-on-admin); font-size: var(--text-md); font-weight: var(--weight-semibold); }
.chip-admin { background: var(--color-admin-bg); color: var(--color-admin-text); }
.brand-mark.admin { background: var(--color-admin); color: var(--color-text-on-admin); }

/* ---------- Stat tiles (admin overview) ---------- */
.stat { display: flex; flex-direction: column; gap: var(--space-1); }
.stat-value { font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; }
.stat-label { font-size: var(--text-md); color: var(--color-text-muted); }
.stat-row { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-8); }

/* Picture + text side by side (QR card); text drops below on narrow cards */
.media { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-start; }
.media > :last-child { flex: 1 1 200px; min-inline-size: 0; }

/* ---------- Danger ---------- */
.btn-danger { color: var(--status-error-text); border-color: var(--status-error); }
.btn-danger:hover { background: var(--status-error-bg); color: var(--status-error-text); }
.card-danger { border-color: var(--status-error); }

/* ---------- Usage meter in tables ---------- */
.meter { display: flex; flex-direction: column; gap: var(--space-1); min-inline-size: 120px; }
.meter .progress { block-size: 6px; }
.meter.over .progress > span { background: var(--status-error); }

/* ---------- Funnel (reports) ---------- */
.funnel { display: flex; flex-direction: column; gap: var(--space-2); }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 170px; gap: var(--space-3); align-items: center; }
.funnel-bar { block-size: 28px; min-inline-size: 4px; border-radius: var(--radius-sm); background: var(--color-primary); }
.funnel-bar.hot { background: var(--heat-hot); }

/* =====================================================================
   Added for the app (Task D): pieces the real screens need that the
   mockups did not show. Same rules: tokens only, logical properties.
   ===================================================================== */

/* ---------- App shell: sidebar on desktop, top bar + bottom nav on phones ---------- */
.sidebar-foot { margin-block-start: auto; display: flex; flex-direction: column; gap: var(--space-2); padding-inline: var(--space-3); font-size: var(--text-md); color: var(--color-text-muted); }
.sidebar-foot form { margin: 0; }
.switcher { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.switcher a { color: var(--color-text-muted); text-decoration: none; }
.switcher a[aria-current="true"] { color: var(--color-text); font-weight: var(--weight-semibold); }
.switcher-theme { display: inline-flex; align-items: center; gap: var(--space-1); }
.switcher-theme .icon { inline-size: 16px; block-size: 16px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--color-text-muted); cursor: pointer; text-align: start; }
.link-btn:hover { color: var(--color-link-hover); }

.topbar {
  display: none; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface); border-block-end: var(--border-width) solid var(--color-border);
  font-size: var(--text-md);
}
.topbar .brand { margin-inline-end: auto; padding-inline: 0; font-size: var(--text-base); }
.topbar form { margin: 0; }
.topbar .switcher-label { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar .switcher-theme { min-inline-size: var(--control-h-sm); min-block-size: var(--control-h-sm); justify-content: center; }
.bottom-nav a[aria-current="page"] .icon { stroke-width: 2.2; }

@media (max-width: 720px) {
  .app > .sidebar { display: none; }
  .topbar { display: flex; }
  .app-body { padding-block-end: calc(72px + env(safe-area-inset-bottom)); }
  .bottom-nav.is-fixed { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 10; block-size: auto; min-block-size: 72px; padding-block-end: env(safe-area-inset-bottom); }
}
@media (min-width: 721px) {
  .bottom-nav.is-fixed { display: none; }
  .app > .sidebar { position: sticky; inset-block-start: 0; block-size: 100vh; overflow-y: auto; }
}

/* Single centred column for sign-in pages and errors */
.auth { min-block-size: 100vh; display: flex; flex-direction: column; align-items: center; padding: var(--space-6) var(--space-4); gap: var(--space-6); }
.auth > .card { inline-size: 100%; max-inline-size: 420px; }
.auth-head { inline-size: 100%; max-inline-size: 420px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

/* ---------- Banners (errors, success) ---------- */
.banner-error { background: var(--status-error-bg); color: var(--status-error-text); }
.banner-ok { background: var(--status-ok-bg); color: var(--status-ok-text); }
.banner a { color: inherit; }

/* ---------- Facts: label / value list (recipient, export job) ---------- */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4); margin: 0; font-size: var(--text-base); }
.facts dt { color: var(--color-text-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Grids for form fields ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.split-wide { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
@media (max-width: 900px) { .split, .split-wide { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Form helpers ---------- */
.fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.group { border: var(--border-width) solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4) var(--space-4); margin: 0; display: flex; flex-direction: column; gap: var(--space-3); min-inline-size: 0; }
.group legend { font-size: var(--text-md); font-weight: var(--weight-semibold); padding-inline: var(--space-1); }
.input-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.input-row > .input, .input-row > .select { flex: 1 1 200px; min-inline-size: 0; }
.input:disabled, .select:disabled, .textarea:disabled, .btn:disabled { opacity: 0.55; cursor: not-allowed; }
input[type="file"].input { padding-block: 9px; }

/* Radio card (export format) */
.option { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border: var(--border-width) solid var(--color-border-strong); border-radius: var(--radius-md); cursor: pointer; }
.option input { margin-block-start: 3px; accent-color: var(--color-primary); }
.option:has(input:checked) { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); }

/* Disclosure (collapsed form sections) */
.disclosure > summary { cursor: pointer; font-weight: var(--weight-semibold); min-block-size: var(--control-h-sm); display: flex; align-items: center; }
.disclosure[open] > summary { margin-block-end: var(--space-4); }

/* "or" divider between sign-in options */
.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--color-text-muted); font-size: var(--text-md); }
.divider::before, .divider::after { content: ""; flex: 1; border-block-start: var(--border-width) solid var(--color-divider); }

/* Inline code / link text */
.code { font-family: var(--font-mono); font-size: var(--text-md); background: var(--color-surface-sunken); padding: 2px var(--space-2); border-radius: var(--radius-xs); overflow-wrap: anywhere; }

/* Prepared message text (follow-up) */
.message { background: var(--color-surface-sunken); border-radius: var(--radius-md); padding: var(--space-3); font-size: var(--text-md); white-space: pre-line; }
.pre { white-space: pre-line; }

/* Text link inside a table cell or title */
.title-link { color: var(--color-text); text-decoration: none; font-weight: var(--weight-semibold); }
.title-link:hover { color: var(--color-link-hover); }
.cell-was { text-decoration: line-through; }
.cell-changed { text-decoration: underline dotted var(--status-fixed); text-underline-offset: 3px; cursor: help; }
.table td.num, .table th.num { text-align: end; }
.table .center { text-align: center; }
.table tr.is-muted td { color: var(--color-text-muted); }
.table tr.is-editing td { background: var(--color-surface-sunken); }

/* Sentence with coloured counts (import summary, panel) */
.t-hot { color: var(--heat-hot-text); }
.t-ok { color: var(--status-ok-text); }
.t-fixed { color: var(--status-fixed-text); }
.t-error { color: var(--status-error-text); }
.t-overdue { color: var(--status-error-text); font-weight: var(--weight-semibold); }

/* ---------- Side drawer (campaign panel) ---------- */
.drawer { margin: 0; margin-inline-start: auto; block-size: 100vh; max-block-size: 100vh; inline-size: min(420px, 100vw); border: 0; padding: var(--space-6) var(--space-5); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-overlay); }
.drawer::backdrop { background: var(--color-panel-dark); opacity: 0.4; }
.drawer-close { position: absolute; inset-block-start: var(--space-2); inset-inline-end: var(--space-2); }
.drawer-body { display: flex; flex-direction: column; gap: var(--space-4); padding-block-start: var(--space-2); }
