/* Vantage CRM app styles (P4a U2, design pass). A dense, calm operator tool on desktop and a comfortable one-handed
   app at 375 px.
   System (tests/test_crm_app_page.py checks the sizes and weights):
   - type: Inter only; sizes 13 / 16 / 20 / 25 / 32 px (1.25 ratio); weights 400 (reading) and 600 (scanning);
     line-height 1.1 headings, 1.5 body; -0.02em tracking above 24 px only; tabular figures on counts, money, times.
   - colour: three surfaces (bg, surface, raised), three text colours (ink, ink-2, ink-3), 1 px low-opacity lines
     for structure and one stronger line (--line-ui, >= 3:1) where a border is the only thing marking a control.
     The accent (from /api/session, applyAccent in app.js, only when it reads on the background) marks the current
     selection and the primary action, nothing else. No shadows, no gradients.
   - spacing on a 4 px grid; radius 6 px (controls) and 8 px (containers).
   - motion: hover answers in 80 ms, nothing over 150 ms, no bounce. */
:root {
  --bg: #0B0D10; --surface: #111418; --raised: #181C22;
  --ink: #F2F3F5; --ink-2: #B4B9C4; --ink-3: #8B919E;
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .14); --line-ui: #6B7280;
  --focus: #7DD3FC; --error: #F87171;
  --accent: #F2F3F5; --accent-ink: #0B0D10;
  --r-sm: 6px; --r-md: 8px;
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --tabbar-h: 48px;
  --tabbar-pad: max(16px, env(safe-area-inset-bottom));
  --fast: 80ms;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html.c-locked { overflow: hidden; }
body { background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 16px; font-weight: 400; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; min-height: 100vh; min-height: 100dvh;
  font-feature-settings: "cv11"; }
h1, h2, h3, p, ul, ol, li, dl, dt, dd, form { margin: 0; padding: 0; list-style: none; font: inherit; }
button, input, textarea, select { font: inherit; color: inherit; margin: 0; -webkit-tap-highlight-color: transparent; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.c-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.c-noscript { padding: 48px 16px; color: var(--ink-2); text-align: center; }
.c-num { font-variant-numeric: tabular-nums; }

/* ---- buttons, inputs (dense by default; 44 px on touch and on phones) ---- */
.c-btn { appearance: none; -webkit-appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 32px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--raised);
  color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.5; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color var(--fast) linear, border-color var(--fast) linear, color var(--fast) linear; }
.c-btn:hover { border-color: var(--line-ui); }
.c-btn:disabled, .c-btn[aria-busy="true"] { opacity: .5; cursor: default; }
.c-btn svg { width: 16px; height: 16px; flex: none; }
.c-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.c-btn-primary:hover { border-color: var(--ink); }
.c-btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.c-btn-quiet:hover { background: var(--raised); border-color: transparent; color: var(--ink); }
.c-btn-sm { min-height: 28px; padding: 0 8px; }
.c-btn-wide { width: 100%; }
.c-icon-btn { appearance: none; display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0;
  border-radius: var(--r-sm); border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background-color var(--fast) linear, color var(--fast) linear; }
.c-icon-btn:hover { background: var(--raised); color: var(--ink); }
.c-icon-btn svg { width: 20px; height: 20px; }
.c-link { appearance: none; background: none; border: 0; padding: 8px 0; color: var(--ink-2); font-size: 13px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; transition: color var(--fast) linear; }
.c-link:hover { color: var(--ink); }
.c-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.c-input, .c-select { display: block; width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-ui); background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.5;
  transition: border-color var(--fast) linear; }
.c-input::placeholder { color: var(--ink-3); opacity: 1; }
.c-input:hover, .c-select:hover { border-color: var(--ink-3); }
/* inputs show the ring on any focus (a date field's inner segment never matches :focus-visible on the input) */
.c-input:focus, .c-select:focus, .c-input:focus-within { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.c-input:disabled { opacity: .6; }
.c-textarea { resize: vertical; min-height: 88px; }
.c-select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238B919E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 12px center; background-size: 12px 12px; background-repeat: no-repeat; }
.c-select-sm { min-height: 28px; padding: 0 28px 0 8px; font-size: 13px; background-position: right 8px center; }
.c-select:disabled { opacity: .5; cursor: default; }

/* ---- sign-in and full-screen messages ---- */
.c-center { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.c-panel { width: 100%; max-width: 400px; }
.c-panel-logo { height: 32px; width: auto; max-width: 180px; object-fit: contain; object-position: left; margin-bottom: 40px; }
.c-brandword { display: block; font-size: 16px; font-weight: 600; margin-bottom: 40px; }
.c-h1 { font-size: 25px; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; }
.c-h2 { display: flex; align-items: baseline; gap: 8px; font-size: 16px; line-height: 1.5; font-weight: 600; }
.c-h3 { font-size: 13px; line-height: 1.5; font-weight: 600; }
.c-sub { color: var(--ink-2); margin-top: 8px; max-width: 66ch; }
.c-field { margin-top: 16px; }
.c-form-msg { margin-top: 16px; font-size: 13px; color: var(--ink-2); }
.c-form-msg:empty { display: none; }
.c-form-msg.is-error { color: var(--ink); }
.c-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.c-actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---- status lines: monochrome icon + text, never colour alone ---- */
.c-status, .c-form-msg { display: flex; align-items: flex-start; gap: 8px; }
.c-status svg, .c-form-msg svg, .c-mark svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.c-status { font-size: 13px; color: var(--ink-2); }
.c-status:empty { display: none; }
.c-status.is-err { color: var(--ink); }
.c-mark { display: inline-flex; align-items: center; gap: 4px; }

/* ---- header + tabs (a bottom bar on phones, in the header on wide screens) ---- */
.c-chrome:empty { display: none; }
.c-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; min-height: 48px; background: var(--bg);
  border-bottom: 1px solid var(--line); padding: max(8px, env(safe-area-inset-top)) 16px 8px; }
.c-head-brand { flex: none; min-width: 0; }
.c-logo { height: 24px; width: auto; max-width: 140px; object-fit: contain; object-position: left; }
.c-logoword { font-size: 13px; font-weight: 600; }
.c-head-user { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.c-who { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.c-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-between; gap: 0;
  background: var(--surface); border-top: 1px solid var(--line-2); padding: 0 4px var(--tabbar-pad); }
.c-tab { appearance: none; position: relative; display: flex; align-items: center; justify-content: center; gap: 4px; min-height: var(--tabbar-h);
  flex: 1 1 auto; padding: 0 4px; border: 0; background: transparent; color: var(--ink-3); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: color var(--fast) linear, background-color var(--fast) linear; }
.c-tab:hover { color: var(--ink); }
.c-tab[aria-current="page"] { color: var(--ink); }
.c-tab[aria-current="page"]::after { content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 2px; background: var(--accent); border-radius: 2px; }
.c-badge { min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.c-main { max-width: 1200px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar-h) + var(--tabbar-pad) + 32px); }
@media (max-width: 420px) { .c-who { display: none; } }
@media (min-width: 900px) {
  .c-tabs { position: static; justify-content: flex-start; gap: 4px; background: transparent; border: 0; padding: 0; }
  .c-tab { flex: none; min-height: 32px; padding: 0 12px; border-radius: var(--r-sm); }
  .c-tab:hover { background: var(--raised); }
  .c-tab[aria-current="page"] { background: var(--raised); }
  .c-tab[aria-current="page"]::after { top: auto; bottom: -8px; left: 12px; right: 12px; }
  .c-main { padding: 24px 24px 48px; }
}

/* ---- page parts ---- */
.c-pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; margin-bottom: 16px; }
.c-pagehead .c-h1 { font-size: 20px; letter-spacing: 0; }
.c-pagehead-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.c-pagehead-tools .c-select { width: auto; min-width: 160px; min-height: 28px; padding-top: 0; padding-bottom: 0; font-size: 13px; }
.c-section { margin-top: 24px; }
.c-section > .c-h2 { margin-bottom: 8px; }
.c-count { color: var(--ink-3); font-weight: 400; font-size: 13px; font-variant-numeric: tabular-nums; }
.c-note { margin: 8px 0; color: var(--ink-3); font-size: 13px; max-width: 66ch; }
.c-empty { padding: 12px 16px; border-radius: var(--r-md); border: 1px dashed var(--line-2); color: var(--ink-3); font-size: 13px; }
.c-empty p { max-width: 66ch; }
.c-empty .c-h2 { color: var(--ink); margin-bottom: 4px; }
.c-empty.is-error { color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

/* ---- lists: stacked cards on phones, one dense table-like block from 640 px ---- */
.c-list { display: flex; flex-direction: column; gap: 8px; }
.c-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); text-align: left; color: inherit; }
button.c-row { appearance: none; cursor: pointer; transition: background-color var(--fast) linear, border-color var(--fast) linear; }
button.c-row:hover { background: var(--raised); }
.c-row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; text-align: left; appearance: none;
  background: transparent; border: 0; padding: 0; color: inherit; cursor: pointer; }
.c-row.c-row-main { align-items: stretch; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); }
.c-row-main.is-static { cursor: default; }
.c-row-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.c-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-row-who { color: var(--ink-2); font-weight: 400; }
.c-row-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.c-row-snip { color: var(--ink-2); font-size: 13px; max-width: 66ch; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.c-row-actions { display: flex; gap: 8px; flex: none; }
.c-row .c-status { font-size: 13px; }
.c-wait { color: var(--ink); font-weight: 600; }
.c-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.c-ch { flex: none; display: inline-flex; color: var(--ink-3); }
.c-ch svg { width: 16px; height: 16px; }
.c-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 13px; font-weight: 400; }
.c-chip svg { width: 16px; height: 16px; }
.c-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.c-tag { padding: 0 8px; border-radius: var(--r-sm); background: var(--raised); color: var(--ink-2); font-size: 13px; }
@media (max-width: 639px) {
  .c-row-title { font-size: 16px; }
  .c-row:has(.c-row-actions) { flex-direction: column; align-items: stretch; }
  .c-row-actions .c-btn { flex: 1; }
}
@media (min-width: 640px) {
  .c-list { gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
  .c-list > li + li { border-top: 1px solid var(--line); }
  .c-list .c-row, .c-list .c-row.c-row-main { min-height: 32px; padding: 4px 12px; border: 0; border-radius: 0; background: transparent; font-size: 13px; }
  .c-list button.c-row:hover, .c-list .c-row:has(> button.c-row-main:hover) { background: var(--raised); }
  .c-list .c-row-main { flex-direction: row; align-items: center; gap: 12px; }
  .c-list .c-row-title { flex: 0 1 15rem; min-width: 6rem; }
  .c-layer .c-list .c-row-title { flex-basis: 10rem; }
  .c-list .c-row-snip { flex: 1 1 auto; display: block; white-space: nowrap; max-width: none; }
  .c-list .c-row-sub { flex: none; margin-left: auto; flex-wrap: nowrap; justify-content: flex-end; text-align: right; }
  .c-list .c-tags { flex: none; flex-wrap: nowrap; }
  .c-list .c-row-main > .c-status { flex: none; }
}

/* ---- skeletons: flat blocks the size of what they stand for ---- */
.c-skel { border-radius: var(--r-md); background: var(--raised); animation: c-pulse 1.2s ease-in-out infinite alternate; }
.c-skel-row { height: 72px; }
.c-skel-title { height: 28px; width: 160px; }
.c-skel-bar { height: 16px; width: 96px; border-radius: var(--r-sm); }
.c-skel-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin-bottom: 16px; }
@media (min-width: 640px) {
  .c-list[aria-busy="true"] { gap: 0; background: var(--surface); }
  .c-list[aria-busy="true"] .c-skel-row { height: 32px; border-radius: 0; background: transparent; position: relative; }
  .c-list[aria-busy="true"] .c-skel-row + .c-skel-row { border-top: 1px solid var(--line); }
  .c-list[aria-busy="true"] .c-skel-row::before { content: ""; position: absolute; left: 12px; top: 12px; width: 40%; height: 8px;
    border-radius: 4px; background: var(--raised); }
  .c-list[aria-busy="true"] .c-skel-row { animation: c-pulse 1.2s ease-in-out infinite alternate; }
}
@keyframes c-pulse { from { opacity: 1; } to { opacity: .55; } }

/* ---- search ---- */
.c-search { position: relative; margin-bottom: 12px; }
.c-search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--ink-3); pointer-events: none; }
.c-search .c-input { padding-left: 36px; }
.c-results > .c-btn-wide { margin-top: 12px; }

/* ---- pipeline board (the one place the page may scroll sideways) ---- */
.c-board { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px;
  -webkit-overflow-scrolling: touch; }
.c-col { flex: 0 0 min(82%, 300px); scroll-snap-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.c-col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.c-col-meta { color: var(--ink-3); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-col-empty { color: var(--ink-3); font-size: 13px; padding: 8px 0; }
.c-cards { display: flex; flex-direction: column; gap: 8px; }
.c-card { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 12px; border-radius: var(--r-sm); background: var(--raised); border: 1px solid var(--line); font-size: 13px; }
.c-card.is-pending { opacity: .6; }
.c-card-name { appearance: none; align-self: flex-start; border: 0; background: none; padding: 4px 0; color: var(--ink); text-align: left; font-weight: 600; cursor: pointer; }
.c-card-name:hover { text-decoration: underline; text-underline-offset: 4px; }
.c-card-meta { display: flex; gap: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.c-card-note { color: var(--ink-2); }
.c-card .c-select-sm { margin-top: 4px; }
@media (min-width: 900px) { .c-board { margin: 0; padding-left: 0; padding-right: 0; } .c-col { flex-basis: 280px; } }

/* ---- layers (contact, thread, forms): full screen on phones, a side sheet on wide screens ---- */
.c-layers:empty { display: none; }
.c-layer { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--bg); }
.c-layer-head { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: max(8px, env(safe-area-inset-top)) 8px 8px; border-bottom: 1px solid var(--line); }
.c-layer-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-layer-body { flex: 1; overflow-y: auto; padding: 16px 16px max(24px, env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
@media (min-width: 900px) {
  .c-layer { left: auto; width: min(560px, 100%); border-left: 1px solid var(--line-2); background: var(--surface); }
  .c-layer.is-full { left: 0; width: auto; border-left: 0; background: var(--bg); }
  .c-layer .c-list, .c-layer .c-dl { background: var(--bg); }
  .c-layer .c-composer-slot { background: var(--surface); }
}
.c-contact-top { margin-bottom: 16px; }
.c-contact-top .c-chip { margin-top: 8px; }
.c-dl { display: grid; gap: 4px; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.c-dl-row { display: grid; grid-template-columns: 96px 1fr; align-items: baseline; gap: 12px; }
.c-dl dt { color: var(--ink-3); }
.c-dl dd { min-width: 0; overflow-wrap: anywhere; }
.c-form { display: flex; flex-direction: column; gap: 8px; }
.c-form-inline { margin-top: 12px; }
.c-form-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) { .c-form-grid { grid-template-columns: 220px 1fr; } }
.c-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.c-form-foot.is-stack { flex-direction: column; align-items: stretch; margin-top: 20px; }

/* ---- thread + composer ---- */
.c-threadwrap { display: flex; flex-direction: column; gap: 12px; min-height: 100%; }
.c-thread-older { display: flex; justify-content: center; }
.c-thread-older:empty { display: none; }
.c-thread { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.c-msg { max-width: min(85%, 66ch); padding: 8px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.c-msg.is-out { align-self: flex-end; background: var(--raised); border-color: var(--line-2); }
.c-msg.is-in { align-self: flex-start; }
.c-msg-subject { font-weight: 600; margin-bottom: 4px; }
.c-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.c-msg-meta { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.c-msg-meta svg { width: 16px; height: 16px; flex: none; color: var(--ink); }
.c-composer-slot { position: sticky; bottom: 0; background: var(--bg); padding-top: 8px; }
.c-composer { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-2); }
.c-composer-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.c-composer-top:empty { display: none; }
.c-count-line { display: block; color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.c-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line-ui); }
.c-seg button { appearance: none; border: 0; background: transparent; color: var(--ink-2); min-height: 28px; padding: 0 12px; border-radius: 4px;
  cursor: pointer; font-size: 13px; font-weight: 600; transition: background-color var(--fast) linear, color var(--fast) linear; }
.c-seg button:hover { color: var(--ink); }
.c-seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---- automations ---- */
.c-autos { display: flex; flex-direction: column; gap: 12px; }
.c-auto { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.c-auto-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.c-auto-head .c-h3 { font-size: 16px; }
.c-switch-wrap { flex: none; display: inline-flex; align-items: center; min-height: 32px; cursor: pointer; }
.c-switch { appearance: none; -webkit-appearance: none; position: relative; width: 44px; height: 24px; border-radius: 12px; border: 1px solid var(--line-ui);
  background: var(--bg); cursor: pointer; transition: background-color var(--fast) linear, border-color var(--fast) linear; }
.c-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2);
  transition: transform var(--fast) linear; }
.c-switch:checked { background: var(--accent); border-color: var(--accent); }
.c-switch:checked::after { transform: translateX(20px); background: var(--accent-ink); }
.c-switch:disabled { opacity: .45; cursor: default; }
.c-steps { display: flex; flex-direction: column; gap: 8px; }
.c-step { padding: 8px 12px; border-radius: var(--r-sm); background: var(--raised); }
.c-step-body { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 66ch; }
.c-more > summary { display: inline-flex; align-items: center; min-height: 32px; color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer;
  list-style: none; transition: color var(--fast) linear; }
.c-more > summary::-webkit-details-marker { display: none; }
.c-more > summary:hover { color: var(--ink); }
.c-more[open] > summary { color: var(--ink); }
.c-params { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.c-params .c-field { margin-top: 8px; }
.c-params .c-btn { align-self: flex-start; margin-top: 8px; }
.c-field-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.c-field-switch .c-label { margin-bottom: 0; }
.c-auto-opts { display: flex; flex-direction: column; gap: 4px; padding: 8px 0 0; border-top: 1px solid var(--line); }
.c-auto-opts .c-field { margin-top: 0; }
.c-field-switch.is-under { padding-left: 16px; border-left: 1px solid var(--line-2); margin-left: 4px; }
.c-field-switch:has(.c-switch:disabled) .c-label { color: var(--ink-3); }

/* ---- D19 texting acknowledgement (a full-screen sheet at every width) ---- */
.c-ack { width: 100%; max-width: 560px; margin: 0 auto; padding-top: 8px; }
.c-ack-text { font-size: 16px; line-height: 1.5; max-width: 66ch; }
.c-ack .c-status.is-err { margin-bottom: 16px; }
.c-check-row { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-top: 24px; padding: 8px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; cursor: pointer; }
.c-check { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 20px; height: 20px; margin: 0;
  border-radius: 4px; border: 1px solid var(--line-ui); background: var(--bg); cursor: pointer;
  transition: background-color var(--fast) linear, border-color var(--fast) linear; }
.c-check:checked { background: var(--accent); border-color: var(--accent); }
.c-check:checked::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--accent-ink);
  border-width: 0 2px 2px 0; transform: rotate(45deg); }
.c-check:disabled { opacity: .5; cursor: default; }

/* ---- toast ---- */
.c-toast-region { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--tabbar-pad) + 12px); z-index: 60;
  display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.c-toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: 520px; width: 100%; padding: 4px 4px 4px 16px;
  border-radius: var(--r-md); background: var(--raised); border: 1px solid var(--line-ui); }
.c-toast-text { flex: 1; font-size: 13px; }
@media (min-width: 900px) { .c-toast-region { bottom: 24px; } }

/* ---- touch: every target at least 44 px ---- */
@media (pointer: coarse) {
  .c-btn, .c-btn-sm, .c-input, .c-select, .c-select-sm, .c-tab, .c-seg button, .c-link, .c-card-name, .c-switch-wrap, .c-more > summary { min-height: 44px; }
  .c-icon-btn { width: 44px; height: 44px; }
  .c-pagehead-tools .c-select { min-height: 44px; }
  .c-btn-sm { padding: 0 12px; }
  .c-row-main, .c-row.c-row-main, .c-list .c-row, .c-list .c-row.c-row-main { min-height: 44px; }
  .c-link { display: inline-flex; align-items: center; }
  .c-card-name { display: inline-flex; align-items: center; }
  .c-dl a { display: inline-flex; align-items: center; min-height: 44px; }
  /* phones never zoom on focus: every field and select is at least 16 px (the small ones included) */
  input, select, textarea, .c-input, .c-select, .c-select-sm, .c-card .c-select-sm, .c-pagehead-tools .c-select { font-size: 16px; }
}
@media (max-width: 639px) {
  .c-btn { font-size: 16px; min-height: 44px; }
  .c-btn-sm { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .c-skel, .c-list[aria-busy="true"] .c-skel-row { animation: none; }
  .c-btn, .c-icon-btn, .c-tab, .c-switch, .c-switch::after, .c-check, .c-input, .c-select, button.c-row, .c-seg button { transition: none; }
}
