/* MauText app styles. Tokens live in tokens.css; use only its scales (type, radius, spacing, motion).
   Shared classes are listed with usage in CLAUDE.md, "UI rules". Page modules never add their own CSS. */
@import url(/assets/tokens.css);
@font-face { font-family: 'Geist'; src: url(/assets/fonts/geist.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url(/assets/fonts/geist-mono.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--tx); }
body { font: 400 var(--fs-md)/var(--lh-md) var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-2xl); line-height: var(--lh-2xl); font-weight: 600; letter-spacing: -.015em; }
h2 { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; }
h3 { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; }
.title-xl { font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 600; letter-spacing: -.01em; }
a { color: var(--tx); text-decoration: underline; text-decoration-color: var(--line-input); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--tx3); }
:focus-visible { outline: 2px solid transparent; box-shadow: var(--ring); border-radius: var(--r-xs); }
.mono { font-family: var(--mono); font-size: var(--fs-xs); }
.muted { color: var(--tx2); } .faint { color: var(--tx3); } .tx { color: var(--tx); }
.tx-success { color: var(--success); } .tx-danger, .list .who .tx-danger { color: var(--danger); }
.small { font-size: var(--fs-xs); line-height: var(--lh-xs); }
.stack { display: flex; flex-direction: column; gap: var(--s4); } .stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s2); } .grow { flex: 1; min-width: 0; } .wrap { flex-wrap: wrap; }
.row-end { justify-content: flex-end; } .row-top { align-items: flex-start; } .row-bottom { align-items: flex-end; }
.hidden { display: none !important; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* small helpers that replace inline styles */
.m0 { margin: 0; } .mt-1 { margin-top: var(--s1); } .mt-2 { margin-top: var(--s2); } .mt-3 { margin-top: var(--s3); }
.ta-r { text-align: right; } .ta-c { text-align: center; } .nowrap { white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; } .break { word-break: break-all; } .bg-raised { background: var(--raised); }
.w-xs { max-width: 160px; } .w-sm { max-width: 240px; } .w-md { max-width: 320px; } .w-lg { max-width: 480px; } .w-form { max-width: 720px; }
.ol-steps { margin: 0; padding-left: var(--s5); display: grid; gap: var(--s2); }

/* ---------- buttons: sm 28 / md 32 / lg 40 / icon 32; 44px tap area ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: 32px; padding: 0 var(--s3); border-radius: var(--r-sm);
  border: 1px solid var(--line-input); background: var(--panel); box-shadow: var(--sh-1); color: var(--tx); font: inherit; font-size: var(--fs-md); font-weight: 500; line-height: 1; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { border-radius: var(--r-sm); }
.btn::after { content: ''; position: absolute; inset: -6px 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: none; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--tx2); }
.btn-ghost:hover { color: var(--tx); background: var(--hover); }
.btn-danger { color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-danger-solid { background: var(--danger-solid); border-color: var(--danger-solid); color: var(--on-danger-solid); box-shadow: none; }
.btn-danger-solid:hover { background: var(--danger-solid); filter: brightness(1.08); }
.btn-sm { height: 28px; padding: 0 var(--s2); font-size: var(--fs-sm); }
.btn-sm::after { inset: -8px 0; }
.btn-lg { height: 40px; padding: 0 var(--s4); }
.btn-lg::after { inset: -2px 0; }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn-icon::after { inset: -6px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::before { content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid var(--tx3); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-primary.busy::before { border-color: var(--on-accent); border-top-color: transparent; }
.btn-danger-solid.busy::before { border-color: var(--on-danger-solid); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
/* the legend is floated so it lays out as the first flex item (and padding-top works on grouped fieldsets) */
legend { float: left; width: 100%; padding: 0; margin: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; color: var(--tx); }
fieldset + fieldset { padding-top: var(--s4); border-top: 1px solid var(--line); }
.fieldset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s4); }
.fieldset-grid > .span-2 { grid-column: 1 / -1; }
.label { display: block; font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 500; color: var(--tx2); margin-bottom: var(--s1); }
.input { width: 100%; height: 36px; padding: 0 var(--s3); border: 1px solid var(--line-input); border-radius: var(--r-sm); background: var(--panel); color: var(--tx); font: inherit; font-size: var(--fs-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.input::placeholder { color: var(--tx3); }
.input:focus, .input:focus-visible { outline: 0; border-color: var(--accent); box-shadow: var(--input-ring); border-radius: var(--r-sm); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[disabled], .input[readonly] { background: var(--raised); color: var(--tx2); }
select.input { appearance: none; padding-right: var(--s8); background-repeat: no-repeat; background-position: right var(--s3) center; background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385858F' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E"); }
textarea.input { height: auto; min-height: 80px; padding: var(--s2) var(--s3); resize: vertical; line-height: var(--lh-md); }
.pw { position: relative; } .pw .input { padding-right: var(--s16); }
.pw-eye { position: absolute; right: var(--s1); top: var(--s1); height: 28px; padding: 0 var(--s2); border: 0; border-radius: var(--r-xs); background: transparent; color: var(--tx2); font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.pw-eye:hover { color: var(--tx); background: var(--hover); }
.hint { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--tx3); margin-top: var(--s1); }
.field-error { display: flex; align-items: center; gap: var(--s1); font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--danger); margin-top: var(--s1); }
.field-error .i { width: 12px; height: 12px; }
input[type="checkbox"], input[type="radio"] { appearance: none; flex: none; width: 16px; height: 16px; margin: 0; border: 1px solid var(--line-input); border-radius: var(--r-xs); background: var(--panel);
  display: inline-grid; place-content: center; cursor: pointer; position: relative; transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
input[type="radio"] { border-radius: var(--r-full); }
input[type="checkbox"]::before { content: ''; width: 10px; height: 10px; background: var(--on-accent); transform: scale(0); transition: transform var(--dur-fast) var(--ease);
  clip-path: polygon(14% 44%, 0 59%, 40% 100%, 100% 21%, 86% 7%, 40% 70%); }
input[type="radio"]::before { content: ''; width: 6px; height: 6px; border-radius: var(--r-full); background: var(--on-accent); transform: scale(0); transition: transform var(--dur-fast) var(--ease); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]::after, input[type="radio"]::after { content: ''; position: absolute; inset: -14px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }
.check { display: flex; gap: var(--s2); align-items: flex-start; font-size: var(--fs-md); color: var(--tx2); cursor: pointer; }
.check input { margin-top: 2px; }
.check .small { display: block; color: var(--tx3); }
.meter { height: 4px; border-radius: var(--r-full); background: var(--line); overflow: hidden; margin-top: var(--s2); }
.meter > i { display: block; height: 100%; width: 0; background: var(--danger); transition: width var(--dur-slow) var(--ease), background var(--dur-slow) var(--ease); }
.code-inputs { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s2); }
.code-inputs input { height: 48px; text-align: center; font: 600 var(--fs-xl) var(--mono); padding: 0; }

/* ---------- alerts: info / warn / danger / success, each with a 16px icon ---------- */
.alert { display: flex; align-items: flex-start; gap: var(--s2); padding: var(--s3); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--raised); font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--tx); }
.alert > .i { margin-top: 2px; }
.alert > .grow > b, .alert > b { font-weight: 600; }
.alert-info { border-color: var(--info-line); background: var(--info-bg); } .alert-info > .i { color: var(--info); }
.alert-warn { border-color: var(--warning-line); background: var(--warning-bg); } .alert-warn > .i { color: var(--warning); }
.alert-error, .alert-danger { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }
.alert-ok, .alert-success { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.alert-error > .i, .alert-danger > .i, .alert-ok > .i, .alert-success > .i { color: inherit; }

/* ---------- surfaces ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-pad { padding: var(--s5); }
.card-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head > .grow { min-width: 200px; }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }

/* badge(text, tone): 20px, r-xs, 12/500 */
.badge { display: inline-flex; align-items: center; gap: var(--s1); height: 20px; padding: 0 var(--s2); border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--raised); font-size: var(--fs-xs); line-height: 1; font-weight: 500; color: var(--tx2); white-space: nowrap; vertical-align: middle; }
.b-success { color: var(--success); background: var(--success-bg); border-color: var(--success-line); }
.b-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }
.b-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.b-info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
/* statusPill: 8px dot, hollow when neutral */
.pill { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 500; white-space: nowrap; color: var(--tx); }
.pill::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: var(--r-full); background: var(--dot, transparent); box-shadow: inset 0 0 0 1.5px var(--dot, var(--tx3)); }
.p-green, .p-success { --dot: var(--accent); } .p-red, .p-danger { --dot: var(--danger); } .p-amber, .p-warning { --dot: var(--warning); } .p-info { --dot: var(--info); }
.kbd { font: var(--fs-xs)/var(--lh-xs) var(--mono); padding: 0 var(--s1); border: 1px solid var(--line-input); border-radius: var(--r-xs); color: var(--tx3); }

/* avatars: initials or a logo; .av-sq for company logos */
.av-sm, .av-md { flex: none; display: inline-grid; place-items: center; border-radius: var(--r-full); background: var(--raised); color: var(--tx2); font-weight: 600; overflow: hidden; }
.av-sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.av-md { width: 40px; height: 40px; font-size: var(--fs-sm); }
.av-sq { border-radius: var(--r-md); border: 1px solid var(--line); }
.av-sm img, .av-md img { width: 100%; height: 100%; object-fit: cover; }

/* skeletons per shape */
.skel { display: block; height: 14px; background: var(--skel); border-radius: var(--r-xs); animation: pulse 1.6s ease-in-out infinite; }
.skel-av { width: 32px; height: 32px; border-radius: var(--r-full); flex: none; }
.skel-tile { height: 96px; border-radius: var(--r-lg); }
.skel-bubble { height: 36px; width: 55%; border-radius: var(--r-lg); }
.skel-bubble.out { align-self: flex-end; width: 40%; }
@keyframes pulse { 50% { opacity: .45; } }

/* empty state: icon tile, 16/600 title, 14 line, one action */
.empty { padding: var(--s10) var(--s5); text-align: center; color: var(--tx2); display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.empty h3 { font-size: var(--fs-lg); line-height: var(--lh-lg); color: var(--tx); }
.empty p { font-size: var(--fs-md); line-height: var(--lh-md); color: var(--tx2); max-width: 400px; }
.empty > .btn, .empty > .row { margin-top: var(--s2); }
.empty-icon { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--raised); border: 1px solid var(--line); color: var(--tx2); margin: 0 auto var(--s2); }

/* code block with a copy button */
.code-block { display: flex; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raised); min-width: 0; }
.code-block pre { flex: 1; min-width: 0; margin: 0; padding: var(--s3); font: var(--fs-xs)/var(--lh-sm) var(--mono); white-space: pre; overflow-x: auto; color: var(--tx); }
.code-block.wrap pre { white-space: pre-wrap; word-break: break-all; }
/* the copy button has its own column, so it never covers the code */
.code-block > .btn { flex: none; margin: var(--s1); }

/* ---------- lists: name + one line, status, ONE button ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.bleed, .list.bleed { margin-left: calc(-1 * var(--s5)); margin-right: calc(-1 * var(--s5)); }
.list > li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); min-height: 48px; }
.list > li:has(.who span) { min-height: 64px; }
.list > li:last-child { border-bottom: 0; }
.list .who { flex: 1; min-width: 0; }
.list .who b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .who span { display: block; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--tx3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .st { text-align: right; font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--tx3); display: flex; flex-direction: column; align-items: flex-end; gap: var(--s1); }
.list .st .pill { justify-content: flex-end; }
.list.wrap-text .who span { white-space: normal; }
.list > li.click { cursor: pointer; transition: background var(--dur-fast) var(--ease); } .list > li.click:hover { background: var(--hover); }
.list .who .badge-test { display: inline-flex; width: auto; margin-left: var(--s2); vertical-align: 1px; }

/* "Needs you": one row per thing, one action each */
.needs-list { list-style: none; margin: 0; padding: 0; }
.needs-list > li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); min-height: 56px; }
.needs-list > li:last-child { border-bottom: 0; }
.needs-list .ni { flex: none; width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--raised); color: var(--tx2); }
.needs-list .ni.warn { background: var(--warning-bg); color: var(--warning); }
.needs-list .ni.danger { background: var(--danger-bg); color: var(--danger); }
.needs-list .ni.info { background: var(--info-bg); color: var(--info); }
.needs-list .ni.ok { background: var(--success-bg); color: var(--success); }
.needs-list .who { flex: 1; min-width: 0; }
.needs-list .who b { display: block; font-weight: 500; }
.needs-list .who span { display: block; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--tx3); }

/* setup checklist with a progress bar */
.progress { height: 8px; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width var(--dur-slow) var(--ease); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist > li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); min-height: 56px; }
.checklist > li:last-child { border-bottom: 0; }
.checklist .tick { flex: none; width: 20px; height: 20px; border-radius: var(--r-full); border: 1.5px solid var(--line-input); display: grid; place-items: center; color: transparent; }
.checklist .tick .i { width: 12px; height: 12px; stroke-width: 2.4; }
.checklist > li.done .tick { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.checklist > li.done .who b { color: var(--tx3); text-decoration: line-through; text-decoration-color: var(--line-input); }
.checklist .who { flex: 1; min-width: 0; }
.checklist .who b { display: block; font-weight: 500; }
.checklist .who span { display: block; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--tx3); }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .chev { transition: transform var(--dur) var(--ease); }
details.card[open] > summary .chev { transform: rotate(180deg); }

/* webhook events: a group per kind with select-all */
.event-group { display: flex; flex-direction: column; gap: var(--s2); }
.event-group + .event-group { padding-top: var(--s4); border-top: 1px solid var(--line); }
.event-group > .row:first-child { justify-content: space-between; }
.event-group .check span { display: block; }

/* ---------- tabs (primary) and seg (second level) ---------- */
.tabs { display: flex; gap: var(--s4); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; height: 40px; margin-bottom: -1px; color: var(--tx2); text-decoration: none; font-size: var(--fs-md); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.tabs a:hover { color: var(--tx); }
.tabs a[aria-current="page"] { color: var(--tx); border-bottom-color: var(--accent); }
.tabs a:focus-visible { border-radius: var(--r-xs); }
.seg { display: inline-flex; gap: var(--s1); padding: var(--s1); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--raised); max-width: 100%; overflow-x: auto; scrollbar-width: none; vertical-align: middle; }
.seg > a, .seg > button { display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); height: 28px; padding: 0 var(--s3); border: 0; border-radius: var(--r-xs); background: none; color: var(--tx2); font: inherit; font-size: var(--fs-sm); font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.seg > a:hover, .seg > button:hover { color: var(--tx); }
.seg > [aria-current="page"], .seg > [aria-pressed="true"] { background: var(--panel); color: var(--tx); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.seg-block { display: flex; } .seg-block > * { flex: 1; }

/* breadcrumb: WhatsApp / +230 … */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s2); font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--tx3); }
.crumbs a { color: var(--tx2); text-decoration: none; }
.crumbs a:hover { color: var(--tx); }
.crumbs .sep { color: var(--line-input); }
.crumbs [aria-current="page"] { color: var(--tx3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- tiles and KPIs ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s3); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s3); }
.tile { padding: var(--s4); }
dialog .tiles { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s2); }
dialog .tile { padding: var(--s3); } dialog .tile .v { font-size: var(--fs-xl); line-height: var(--lh-xl); }
.tile .k { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--tx2); }
.tile .v { font-size: var(--fs-kpi); line-height: var(--lh-kpi); font-weight: 600; margin-top: var(--s1); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .d { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--tx3); margin-top: var(--s1); }
.tile-link { display: block; color: inherit; text-decoration: none; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.tile-link:hover { border-color: var(--line-input); background: var(--hover); }

/* ---------- dialog: 56px head, 20px body, foot; sm 400 / md 520 / lg 680; a bottom sheet on phones ---------- */
dialog { padding: 0; border: 1px solid var(--sh-line); border-radius: var(--r-lg); background: var(--panel); color: var(--tx); box-shadow: var(--sh-3);
  width: min(520px, calc(100vw - var(--s8))); max-height: calc(100dvh - var(--s8)); flex-direction: column; overflow: hidden; }
dialog[open] { display: flex; animation: dlg-in var(--dur) var(--ease); }
dialog.closing { animation: dlg-out var(--dur-fast) var(--ease) forwards; }
dialog.dlg-sm { width: min(400px, calc(100vw - var(--s8))); }
dialog.dlg-lg { width: min(680px, calc(100vw - var(--s8))); }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); animation: fade-in var(--dur) var(--ease); }
dialog.closing::backdrop { animation: fade-out var(--dur-fast) var(--ease) forwards; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes dlg-out { to { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.dlg-head { flex: none; display: flex; align-items: center; gap: var(--s2); height: 56px; padding: 0 var(--s3) 0 var(--s5); border-bottom: 1px solid var(--line); }
.dlg-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-body { flex: 1 1 auto; min-height: 0; padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); overflow-y: auto; }
.dlg-foot { flex: none; display: flex; justify-content: flex-end; align-items: center; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }
.dlg-foot .spacer { flex: 1; }

/* popover menu (account menu, kebab menus) */
.pop { position: fixed; width: 236px; z-index: 30; padding: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--sh-2); display: grid; gap: 0; animation: fade-in var(--dur) var(--ease); }
.pop-who { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); margin-bottom: var(--s1); display: grid; min-width: 0; }
.pop-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-who span { font-size: var(--fs-xs); color: var(--tx3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-i { display: flex; align-items: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s3); border: 0; border-radius: var(--r-md); background: none; color: var(--tx); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.pop-i:hover, .pop-i:focus-visible { background: var(--hover); outline: 0; box-shadow: none; }
.pop-i .i { color: var(--tx2); }
.pop-i.danger, .pop-i.danger .i { color: var(--danger); }

/* toast: bottom-right on a computer, top-centre on a phone */
#toasts { position: fixed; bottom: var(--s6); right: var(--s6); z-index: 100; display: flex; flex-direction: column; gap: var(--s2); align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s3); max-width: 400px; background: var(--panel); border: 1px solid var(--line); padding: var(--s3) var(--s4); border-radius: var(--r-md); box-shadow: var(--sh-2); font-size: var(--fs-md); animation: toast-in var(--dur) var(--ease); }
.toast > .i { color: var(--tx2); }
.toast.t-success > .i { color: var(--success); } .toast.t-danger > .i { color: var(--danger); } .toast.t-warning > .i { color: var(--warning); } .toast.t-info > .i { color: var(--info); }
.toast .btn { margin-left: var(--s2); }
.toast.out { animation: fade-out var(--dur-fast) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- account pages: centred card, max 400px ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--s8) var(--s4); background: radial-gradient(600px 300px at 50% 0, var(--glow), transparent); }
.bar + .auth { min-height: calc(100dvh - var(--s8)); }
.auth-card { width: 100%; max-width: 400px; padding: var(--s8); }
.auth-card h1 { font-size: var(--fs-xl); line-height: var(--lh-xl); margin-bottom: var(--s1); }
.auth-foot { margin-top: var(--s4); text-align: center; color: var(--tx2); font-size: var(--fs-sm); }
/* brand: the speech-bubble mark. <span class="logo"><img src="/assets/brand/logo.png" alt=""> MauText</span>; an empty <i> shows the mark too. */
.logo { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; font-size: var(--fs-md); color: var(--tx); text-decoration: none; min-width: 0; }
.logo img, .logo i { flex: none; width: 20px; height: 20px; display: inline-block; }
.logo i { background: url(/assets/brand/logo.png) center / contain no-repeat; }
.auth > .logo { margin-bottom: var(--s6); }

/* ---------- app shell ---------- */
.app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); flex: 1; min-height: 0; transition: grid-template-columns var(--dur-slow) var(--ease); }
.aside { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.side-head { position: relative; display: flex; align-items: center; gap: var(--s1); height: 56px; padding: 0 var(--s2); flex: none; }
.aside .ws { display: flex; align-items: center; gap: var(--s2); width: 100%; height: 40px; padding: 0 var(--s2); border: 0; border-radius: var(--r-sm); background: none; color: var(--tx); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.aside .ws:hover { background: var(--hover); }
.aside .ws .av { width: 24px; height: 24px; border-radius: var(--r-full); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 600; font-size: var(--fs-xs); flex: none; }
.aside .ws b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.aside .ws .sw-who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: var(--lh-xs); }
.aside .ws .sw-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.aside .ws .sw-who small { color: var(--tx3); font-size: var(--fs-xs); font-weight: 400; }
.aside .ws .i { color: var(--tx3); flex: none; }
.side-hide { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: none; color: var(--tx3); cursor: pointer; }
.side-hide:hover { background: var(--hover); color: var(--tx); }
.side-find { display: flex; align-items: center; gap: var(--s2); margin: 0 var(--s2) var(--s2); height: 36px; padding: 0 var(--s2) 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--tx3); flex: none; cursor: text; }
.side-find:focus-within { border-color: var(--accent); box-shadow: var(--input-ring); }
.side-find-i { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--tx); font: inherit; outline: 0; }
.side-find-i:focus-visible { box-shadow: none; }
.side-find-i::-webkit-search-cancel-button { display: none; }
.side-find kbd { flex: none; min-width: 20px; height: 20px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r-xs); color: var(--tx3); font: 500 var(--fs-xs) var(--font); }
.side-links { display: flex; flex-direction: column; gap: var(--s1); padding: 0 var(--s2) var(--s2); overflow-y: auto; min-height: 0; flex: 1; }
.side-grp { flex: none; margin: var(--s4) var(--s3) var(--s1); font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--tx3); }
.side-grp[hidden], .side-spacer[hidden], .nav a[hidden] { display: none; }
.side-spacer { flex: 1 0 16px; }
.side-sep { height: 1px; margin: var(--s2) var(--s2); background: var(--line); flex: none; }
.nav a, .nav > span { display: flex; align-items: center; gap: var(--s3); min-height: 36px; padding: 0 var(--s3); border-radius: var(--r-sm); color: var(--tx); text-decoration: none; font-weight: 500; flex: none; transition: background var(--dur-fast) var(--ease); }
.nav a .i { color: var(--tx2); }
.nav a:hover { background: var(--hover); color: var(--tx); }
.nav a[aria-current="page"] { background: var(--raised); color: var(--tx); }
.nav a[aria-current="page"] .i { color: var(--accent-tx); }
.nav > span { color: var(--tx3); cursor: default; }
.nav .soon { margin-left: auto; font-size: var(--fs-xs); font-style: normal; color: var(--tx3); border: 1px solid var(--line-input); border-radius: var(--r-xs); padding: 0 var(--s1); line-height: var(--lh-xs); }
.side-hide:focus-visible, .aside .ws:focus-visible, .nav a:focus-visible, .foot-b:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--r-sm); }
/* unread count on a nav link: solid accent; .warn when a person is needed */
.nav-badge { margin-left: auto; height: 18px; min-width: 18px; padding: 0 6px; border-radius: var(--r-full); font-size: 11px; line-height: 18px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; color: var(--on-accent); background: var(--accent); }
.nav-badge.warn { color: var(--warning); background: var(--warning-bg); box-shadow: inset 0 0 0 1px var(--warning-line); }
.nav-badge[hidden] { display: none; }
.side-foot { display: flex; align-items: center; gap: var(--s1); padding: var(--s2) var(--s2) var(--s3); border-top: 1px solid var(--line); flex: none; min-width: 0; }
.side-foot .me { min-width: 0; }
.side-foot .me-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .me-mail { font-size: var(--fs-xs); color: var(--tx3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-av { flex: none; width: 28px; height: 28px; border-radius: var(--r-full); display: grid; place-items: center; background: var(--raised); font-size: var(--fs-xs); font-weight: 600; }
.side-icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--tx3); }
.side-icon:hover { background: var(--hover); color: var(--tx); }
.foot-b { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: none; color: var(--tx2); cursor: pointer; }
.foot-b:hover { background: var(--hover); color: var(--tx); }
.bell { position: relative; }
.bell.has::after { content: ''; position: absolute; top: var(--s2); right: var(--s2); width: 8px; height: 8px; border-radius: var(--r-full); background: var(--accent); }
@media (min-width: 761px) {
.shell.side-off { grid-template-columns: 64px minmax(0, 1fr); }
.shell.side-off .nav-l, .shell.side-off .sw-who, .shell.side-off .ws > .i, .shell.side-off .side-grp, .shell.side-off .nav-badge, .shell.side-off .side-find-i, .shell.side-off .side-find kbd { display: none; }
.shell.side-off .side-head { flex-direction: column; height: auto; padding: var(--s2) 0; gap: var(--s2); }
.shell.side-off .aside .ws { width: auto; justify-content: center; }
.shell.side-off .side-find { justify-content: center; margin: 0 var(--s2) var(--s2); padding: 0; }
.shell.side-off .nav a { justify-content: center; padding: 0; }
.shell.side-off .side-foot { flex-direction: column; padding: var(--s2) 0 var(--s3); }
}

.main { min-width: 0; min-height: 0; overflow-y: auto; }
@media (min-width: 761px) { .main { scrollbar-gutter: stable; } }
.page { max-width: 1120px; margin: 0 auto; padding: var(--s6) var(--s6) var(--s12); display: flex; flex-direction: column; gap: var(--s5); }
.page.narrow, .page:has(> .narrow) { max-width: 720px; }
@media (min-width: 1280px) { .page { padding: var(--s8) var(--s10) var(--s16); } }
/* page head: h1, an optional line under it, actions on the right (at most one primary) */
.page-head, .ph { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.page-head > .grow, .ph > .grow { flex: 1 1 220px; }
.page-head p, .ph p { margin-top: var(--s1); color: var(--tx2); font-size: var(--fs-md); }
.page-head + .tabs, .ph + .tabs { margin-top: calc(-1 * var(--s1)); }
.topbar { display: none; align-items: center; gap: var(--s2); height: var(--bar-h); padding: 0 var(--s3); border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.topbar-title, .topbar .logo { flex: 1; min-width: 0; font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { display: flex; align-items: center; justify-content: center; gap: var(--s3); flex-wrap: wrap; min-height: 32px; padding: var(--s1) var(--s4); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 500; text-align: center; }
.bar-amber { background: var(--amber-bar); color: var(--on-amber); }
.bar-amber a { color: inherit; text-decoration-color: currentColor; font-weight: 600; }
.bar-note { background: var(--raised); border-bottom: 1px solid var(--line); color: var(--tx2); }
.bar-note a { color: var(--tx); font-weight: 600; }
.scrim { display: none; }

/* ---------- inbox: list | thread | details ---------- */
.main:has(.inbox) { overflow: hidden; scrollbar-gutter: auto; }
.main:has(.inbox) > .page { max-width: none; padding: 0; gap: 0; height: calc(100% - var(--bar-h)); }
.main:has(.inbox) > .page > * { height: 100%; min-height: 0; }
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; height: calc(100dvh - var(--bar-h)); min-height: 0; background: var(--bg); }
.main .inbox { height: 100%; }
.inbox-list, .inbox-thread, .inbox-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.inbox-list { border-right: 1px solid var(--line); }
.inbox-thread { background: var(--bg); }
.inbox-side { border-left: 1px solid var(--line); overflow-y: auto; }
.inbox-head { flex: none; display: flex; align-items: center; gap: var(--s2); min-height: 56px; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; }
.inbox-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-tools { flex: none; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.inbox-rows { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0; }
.inbox-list-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s1) var(--s3); align-items: center; width: 100%; min-height: 64px; padding: var(--s3) var(--s4); border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--tx); font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.inbox-list-row:hover { background: var(--hover); }
.inbox-list-row[aria-current="true"], .inbox-list-row[aria-current="page"], .inbox-list-row[aria-selected="true"] { background: var(--raised); }
.inbox-list-row > .av-sm, .inbox-list-row > .av-md { grid-row: span 2; }
.inbox-list-row .ilr-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-list-row.unread .ilr-name { font-weight: 600; }
.inbox-list-row .ilr-time { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--tx3); justify-self: end; }
.inbox-list-row.unread .ilr-time { color: var(--accent-tx); }
.inbox-list-row .ilr-preview { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--tx3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-list-row .ilr-meta { display: flex; align-items: center; gap: var(--s1); justify-self: end; }
.inbox-list-row .ilr-window { grid-column: 2 / -1; font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--warning); }
.count-pill { display: inline-grid; place-items: center; height: 18px; min-width: 18px; padding: 0 6px; border-radius: var(--r-full); background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; line-height: 18px; font-variant-numeric: tabular-nums; }
.initials-chip { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-full); background: var(--raised); border: 1px solid var(--line); color: var(--tx2); font-size: 11px; font-weight: 600; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); background: var(--bg); }
.bubble { align-self: flex-start; max-width: min(75%, 560px); padding: var(--s2) var(--s3); border-radius: var(--r-lg); border-bottom-left-radius: var(--r-xs); background: var(--panel); border: 1px solid var(--line); color: var(--tx); font-size: var(--fs-md); line-height: var(--lh-md); white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: var(--sh-1); }
.bubble.out { align-self: flex-end; background: var(--bubble-out); border-color: transparent; border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-xs); }
.bubble.note { align-self: center; background: var(--warning-bg); border-color: var(--warning-line); max-width: 90%; font-size: var(--fs-sm); }
.bubble.failed { border-color: var(--danger-line); }
.bubble-meta { display: flex; align-items: center; justify-content: flex-end; gap: var(--s1); margin-top: var(--s1); font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--tx3); white-space: nowrap; }
.bubble-meta .i { width: 14px; height: 14px; }
.bubble-meta .read { color: var(--info); } .bubble-meta .fail { color: var(--danger); }
.day-sep { align-self: center; display: flex; align-items: center; gap: var(--s3); width: 100%; margin: var(--s2) 0; font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--tx3); }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.composer { flex: none; position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: var(--s2); padding: var(--s3) var(--s4); padding-bottom: max(var(--s3), env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
.composer textarea.input, .composer .input { flex: 1; min-height: 36px; max-height: 160px; height: 36px; padding: var(--s2) var(--s3); resize: none; field-sizing: content; overflow-y: auto; }
.composer-note { flex: 1; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--tx2); }
.window-chip { display: inline-flex; align-items: center; gap: var(--s1); height: 24px; padding: 0 var(--s2); border-radius: var(--r-full); border: 1px solid var(--line); background: var(--raised); color: var(--tx2); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }
.window-chip.warn { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-line); }
.window-chip.closed { color: var(--tx3); }
.window-chip .i { width: 12px; height: 12px; }
.inbox-side-body { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s4); }
.inbox-back { display: none; }
@media (max-width: 1279px) {
  .inbox { grid-template-columns: 320px minmax(0, 1fr); }
  .inbox-side { display: none; }
  .inbox-side.open { display: flex; position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 100vw); z-index: 25; box-shadow: var(--sh-3); animation: slide-in var(--dur-slow) var(--ease); }
}
@keyframes slide-in { from { transform: translateX(16px); opacity: 0; } }
@media (max-width: 767px) {
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox .inbox-thread { display: none; }
  .inbox.show-thread .inbox-list { display: none; }
  .inbox.show-thread .inbox-thread { display: flex; }
  .inbox-list { border-right: 0; }
  .inbox-back { display: inline-flex; }
  .inbox-side.open { width: 100vw; }
  .bubble { max-width: 85%; }
}

/* ---------- product choice cards ---------- */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s3); }
.choice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); cursor: pointer; text-align: left; color: var(--tx); font: inherit; transition: border-color var(--dur-fast) var(--ease); }
.choice:hover { border-color: var(--line-input); }
.choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.choice b { display: block; font-weight: 600; margin-bottom: 2px; }
.choice span { color: var(--tx2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.steps { display: flex; gap: var(--s2); } .steps i { flex: 1; height: 4px; border-radius: var(--r-full); background: var(--line); } .steps i.on { background: var(--accent); }

/* ---------- charts ---------- */
.chart { width: 100%; height: 140px; display: block; }
.chart rect { fill: var(--accent); }
.chart rect.zero { fill: var(--line-input); }
.period-custom[hidden] { display: none; }
.funnel { display: flex; flex-direction: column; gap: var(--s3); }
.funnel .f { display: grid; grid-template-columns: 150px 1fr 48px; gap: var(--s3); align-items: center; font-size: var(--fs-sm); }
.funnel .f div { height: 8px; border-radius: var(--r-full); background: var(--line); overflow: hidden; } .funnel .f div i { display: block; height: 100%; background: var(--accent); }

.codes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); border: 1px dashed var(--line-input); border-radius: var(--r-md); }

/* ---------- detail pages: label/value pairs ---------- */
.back { display: inline-flex; align-items: center; gap: var(--s1); color: var(--tx2); font-size: var(--fs-sm); text-decoration: none; }
.back:hover { color: var(--tx); }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6); }
.kv { display: grid; gap: var(--s4); margin: 0; }
.kv dt { font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 500; color: var(--tx2); }
.kv dd { margin: var(--s1) 0 0; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; }
.rows { margin: 0; }
.rows > div { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.rows > div:last-child { border-bottom: 0; }
.rows dt { color: var(--tx2); } .rows dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.copy { border: 0; background: none; color: var(--tx3); cursor: pointer; padding: var(--s1); border-radius: var(--r-xs); display: inline-grid; place-items: center; min-width: 28px; min-height: 28px; position: relative; }
.copy::after { content: ''; position: absolute; inset: -8px; }
.copy:hover { color: var(--tx); background: var(--raised); }

/* ---------- Try it (sandbox) ---------- */
.join-desk { display: grid; grid-template-columns: 1fr auto; gap: var(--s6); align-items: start; }
.how { margin: 0; padding-left: var(--s5); display: grid; gap: var(--s3); }
.qr { width: 168px; height: 168px; padding: var(--s2); background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.qr svg { width: 100%; height: 100%; display: block; }
.join-code { display: inline-flex; align-items: center; gap: var(--s1); padding: var(--s1) var(--s1) var(--s1) var(--s3); border: 1px solid var(--line); border-radius: var(--r-full); background: var(--raised); min-height: 44px; font-size: var(--fs-lg); color: var(--tx); margin-top: var(--s2); word-break: break-all; }
.waiting { display: flex; align-items: center; gap: var(--s2); margin: 0; color: var(--tx2); font-size: var(--fs-sm); }
.live-dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--accent); animation: live 1.6s ease-in-out infinite; }
@keyframes live { 50% { opacity: .3; } }
.done-mark { width: 40px; height: 40px; border-radius: var(--r-full); display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }

/* "Advanced" disclosure: small, quiet, at the bottom of a card */
.adv { font-size: var(--fs-xs); color: var(--tx3); }
.adv summary { cursor: pointer; display: inline-block; min-height: 28px; line-height: 28px; }
.adv summary:hover { color: var(--tx); }
.adv > p { margin-top: var(--s1); }

/* ---------- phone: ≤760px ---------- */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; transition: none; }
  .aside { position: fixed; z-index: 20; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease); }
  .side-hide { display: none; }
  .shell.menu .aside { transform: none; }
  .shell.menu .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: var(--scrim); }
  .topbar { display: flex; }
  .page { padding: var(--s4) var(--s4) var(--s12); gap: var(--s4); }
  h1 { font-size: var(--fs-xl); line-height: var(--lh-xl); }
  .list > li, .needs-list > li, .checklist > li { padding: var(--s3) var(--s4); }
  .list .who span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .card-pad { padding: var(--s4); } .card-head { padding: var(--s3) var(--s4); }
  .bleed, .list.bleed { margin-left: calc(-1 * var(--s4)); margin-right: calc(-1 * var(--s4)); }
  .card-foot { padding: var(--s3) var(--s4); }
  /* the top bar already shows the page title */
  .main:has(.topbar-title) .page-head h1, .main:has(.topbar-title) .ph h1, .inbox-list .inbox-head h2 { display: none; }
  .inbox-list .inbox-head { justify-content: flex-end; }
  .main:has(.topbar-title) .page-head:not(:has(p, button, a, input, select)) { display: none; }
  .main:has(.inbox.show-thread) > .topbar { display: none; }
  .main:has(.inbox.show-thread) > .page { height: 100%; }
  .tabs { mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .tabs.at-end { mask-image: none; }
  .auth-card { padding: var(--s5); }
  .hide-sm { display: none; }
  .head-actions { flex-basis: 100%; }
  .head-actions .btn { flex: 1; }
  .funnel .f { grid-template-columns: 110px 1fr 40px; }
  .cols2, .fieldset-grid { grid-template-columns: 1fr; }
  .join-desk { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tile .v { font-size: var(--fs-xl); line-height: var(--lh-xl); }
  .seg { display: flex; flex-wrap: wrap; } .seg > * { flex: 1; }
  /* dialogs become bottom sheets */
  dialog, dialog.dlg-sm, dialog.dlg-lg { width: 100%; max-width: 100%; margin: auto 0 0; max-height: calc(100dvh - var(--s8)); border-radius: 16px 16px 0 0; border-bottom: 0; }
  dialog[open] { animation: sheet-in var(--dur-slow) var(--ease); }
  dialog.closing { animation: sheet-out var(--dur-fast) var(--ease) forwards; }
  .dlg-head { padding-left: var(--s4); }
  .dlg-body { padding: var(--s4); }
  .dlg-foot { padding: var(--s3) var(--s4); padding-bottom: max(var(--s3), env(safe-area-inset-bottom)); }
  .dlg-foot .btn { flex: 1; }
  .dlg-foot .btn-ghost, .dlg-foot .spacer { flex: none; }
  #toasts { top: var(--s3); bottom: auto; right: var(--s4); left: var(--s4); align-items: center; }
  .toast { width: 100%; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after, dialog::backdrop { animation: none !important; transition: none !important; } }
