/* QRFlow design system — tokens transcribed from design.md (single source; no raw values elsewhere). */
@font-face { font-family: "Suisse Sub"; src: url(../fonts/inter-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Suisse Sub"; src: url(../fonts/inter-latin-500-normal.woff2) format("woff2"); font-weight: 450 600; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(../fonts/geist-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(../fonts/geist-mono-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --color-ember-orange: #ff4d00;
  --color-ember-glow-light: #fcddcc;
  --color-ember-wash-deep: #febec2;
  --color-ember-wash: #fff4ee;
  --color-ember-action: #d43d00;       /* filled controls carrying white text: 4.6:1 (WCAG AA). #ff4d00 alone is 3.3:1 */
  --color-ember-text: #c23a00;         /* Ember for small text on white: AA contrast (5.0:1) */
  --color-gridline: #e5e7eb;
  --color-ink: #262626;
  --color-vellum: #f9f9f9;
  --color-slate: #727272;              /* 4.8:1 on white — AA for body */
  --color-graphite: #616161;
  --color-ash: #949494;
  --color-stone: #c7c7c7;
  --color-mist: #b5b5b5;
  --color-pebble: #838383;
  --surface-canvas: #ffffff;

  --font-suisse: "Suisse", "Suisse Sub", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-geist-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --text-caption: 10px; --text-xs: 12px; --text-sm: 13px; --text-body: 14px; --text-md: 16px;
  --text-heading-sm: 20px; --text-heading: 24px; --text-kpi: 32px; --text-heading-lg: 40px; --text-display: 52px; --text-display-xl: 60px;

  --s4: 4px; --s8: 8px; --s12: 12px; --s16: 16px; --s20: 20px; --s24: 24px; --s28: 28px; --s32: 32px;
  --s40: 40px; --s48: 48px; --s56: 56px; --s64: 64px; --s72: 72px;

  --page-max-width: 1200px; --section-gap: 96px; --card-padding: 24px; --element-gap: 12px; --rail: 240px;

  --radius-inputs: 8px; --radius-xl: 12px; --radius-cards: 16px; --radius-full: 999px;

  --shadow-subtle: rgb(249, 249, 249) 0 0 0 6px;
  --shadow-xl: rgba(0,0,0,.02) 0 40px 48px -20px, rgba(0,0,0,.03) 0 32px 32px -20px, rgba(0,0,0,.03) 0 16px 24px -12px, rgba(0,0,0,.03) 0 0 0 1px;
  --shadow-xl-2: rgba(0,0,0,.03) 0 24px 32px -12px, rgba(0,0,0,.03) 0 16px 24px -8px, rgba(0,0,0,.03) 0 8px 16px -4px, rgba(0,0,0,.03) 0 0 0 1px;
  --shadow-subtle-3: rgb(253, 253, 253) 0 0 0 8px;
  --glow: 0 0 0 6px var(--color-ember-glow-light);
  --focus: 0 0 0 3px var(--color-ember-glow-light), 0 0 0 1px var(--color-ember-orange);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-suisse); font-size: var(--text-body); line-height: 1.5; color: var(--color-ink); background: var(--surface-canvas); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-weight: 500; margin: 0; letter-spacing: 0; }
h1 { font-size: var(--text-heading-lg); line-height: 1.1; letter-spacing: -0.005em; }
h2 { font-size: var(--text-heading); line-height: 1.2; }
h3 { font-size: var(--text-heading-sm); line-height: 1.33; }
h4 { font-size: var(--text-md); line-height: 1.4; }
p { margin: 0; }
a { color: var(--color-ink); text-underline-offset: 3px; }
a:hover { color: var(--color-ink); text-decoration-color: var(--color-ember-orange); }
img, svg { max-width: 100%; }
code, .mono { font-family: var(--font-geist-mono); font-size: var(--text-sm); }
.muted { color: var(--color-slate); }
.small { font-size: var(--text-xs); letter-spacing: .01em; }
.caption { font-size: var(--text-caption); letter-spacing: .02em; text-transform: uppercase; color: var(--color-slate); font-family: var(--font-geist-mono); }
.accent { color: var(--color-ember-orange); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--color-ink); color: #fff; padding: 8px 14px; border-radius: var(--radius-full); }
.skip-link:focus { top: 12px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 14px; height: 14px; flex: none; }
hr { border: 0; border-top: 1px solid var(--color-gridline); margin: var(--s24) 0; }
[hidden] { display: none !important; }

/* ---------- buttons (pill tier 999px) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 18px; border-radius: var(--radius-full);
  font: 500 var(--text-body)/1.2 var(--font-suisse); letter-spacing: .01em; border: 1px solid var(--color-gridline); background: #fff; color: var(--color-ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.btn:hover { background: var(--color-vellum); }
.btn-primary { background: var(--color-ember-action); border-color: var(--color-ember-action); color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { background: #bf3700; color: #fff; }
.btn-dark { background: var(--color-ink); border-color: var(--color-ink); color: #fff; }
.btn-dark:hover { background: #111; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--color-vellum); }
.btn-danger { color: var(--color-ink); border-color: var(--color-ink); }
.btn-danger:hover { background: var(--color-ink); color: #fff; }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: var(--text-sm); }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { color: var(--color-stone); background: var(--color-vellum); border-color: var(--color-gridline); box-shadow: none; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; }

/* ---------- forms (8px tier) ---------- */
.field { display: grid; gap: 6px; margin-bottom: var(--s16); align-content: start; }
.field > label, .label { font-weight: 500; font-size: var(--text-sm); }
.hint { font-size: var(--text-xs); color: var(--color-slate); letter-spacing: .01em; }
.field-error { font-size: var(--text-xs); color: var(--color-ember-text); display: flex; gap: 6px; align-items: flex-start; }
.field-error::before { flex: none; margin-top: 1px; }
.field-error::before { content: "!"; display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--color-ember-orange); color: #fff; font: 600 10px/1 var(--font-suisse); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel], input[type=number], input[type=search],
input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--color-gridline); border-radius: var(--radius-inputs); background: #fff;
  font: 400 var(--text-body)/1.4 var(--font-suisse); color: var(--color-ink); }
textarea { min-height: 96px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23727272' stroke-width='1.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; }
input::placeholder, textarea::placeholder { color: var(--color-stone); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-ember-orange); box-shadow: 0 0 0 3px var(--color-ember-glow-light); }
input:disabled, select:disabled, textarea:disabled { background: var(--color-vellum); color: var(--color-stone); }
[aria-invalid="true"] { border-color: var(--color-ember-orange) !important; }
input.mono, .mono input { font-family: var(--font-geist-mono); font-size: var(--text-sm); }
input[type=color] { width: 44px; height: 40px; padding: 3px; border: 1px solid var(--color-gridline); border-radius: var(--radius-inputs); background: #fff; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--color-ember-orange); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--text-body); cursor: pointer; min-height: 24px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--color-ember-orange); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s16); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 var(--s16); }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=text] { flex: 1; font-family: var(--font-geist-mono); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 500; padding: 0; margin-bottom: 8px; }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--color-slate); pointer-events: none; }
.search input { border-radius: var(--radius-full); padding-left: 40px; }

/* chips / segmented pills */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 14px; border-radius: var(--radius-full); border: 1px solid var(--color-gridline); background: #fff; font-size: var(--text-sm); font-weight: 500; }
.chip input:checked + span { background: var(--color-ember-wash); border-color: var(--color-ember-orange); color: var(--color-ember-text); }
.chip input:focus-visible + span { box-shadow: var(--focus); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--color-gridline); border-radius: var(--radius-full); background: #fff; flex-wrap: wrap; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 14px; border-radius: var(--radius-full); text-decoration: none; font-weight: 500; font-size: var(--text-sm); color: var(--color-slate); border: 0; background: none; cursor: pointer; }
.seg a[aria-current="true"], .seg button[aria-pressed="true"] { background: var(--color-ember-wash); color: var(--color-ember-text); }
.seg a:hover { color: var(--color-ink); }

/* ---------- surfaces (16px tier) ---------- */
.card { background: #fff; border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); padding: var(--card-padding); min-width: 0; }
.card-vellum { background: var(--color-vellum); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--s16); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: var(--text-md); }
.card + .card { margin-top: var(--s16); }
.stack > * + * { margin-top: var(--s16); }
.stack-sm > * + * { margin-top: var(--s8); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s16); align-items: start; }
.split-even { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s16); align-items: start; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--color-gridline); background: #fff; display: flex; flex-direction: column; padding: 16px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; text-decoration: none; font-weight: 500; font-size: 15px; }
.logo-mark { width: 24px; height: 24px; }
.nav { display: grid; gap: 2px; }
.nav-label { padding: 18px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: 10px; text-decoration: none; font-weight: 500; color: var(--color-ink); }
.nav a .icon { color: var(--color-slate); }
.nav a:hover { background: var(--color-vellum); }
.nav a[aria-current="page"] { background: var(--color-vellum); }
.nav a[aria-current="page"] .icon { color: var(--color-ember-orange); }
.rail-foot { margin-top: auto; padding: 12px 0 4px; border-top: 1px solid var(--color-gridline); position: sticky; bottom: -16px; background: #fff; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 var(--s32); border-bottom: 1px solid var(--color-gridline); background: #fff; }
.topbar .search { flex: 1; max-width: 420px; }
.kbd { font-family: var(--font-geist-mono); font-size: 11px; color: var(--color-slate); background: var(--color-vellum); border: 1px solid var(--color-gridline); border-radius: 6px; padding: 1px 6px; }
.topbar .search .kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--color-vellum); border: 1px solid var(--color-gridline); display: grid; place-items: center; font-weight: 500; font-size: 13px; }
.content { width: 100%; max-width: calc(var(--page-max-width) + 2 * var(--s32)); padding: var(--s32); margin: 0 auto; }
.menu-toggle { display: none; }
.verify-banner { background: var(--color-vellum); border-bottom: 1px solid var(--color-gridline); padding: 10px var(--s32); font-size: var(--text-sm); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s16); margin-bottom: var(--s32); flex-wrap: wrap; }
.page-head h1 { font-size: var(--text-heading-lg); }
.page-head p { margin-top: 8px; color: var(--color-slate); font-size: var(--text-md); max-width: 620px; }
.page-head.compact { margin-bottom: var(--s24); }
.page-head.compact h1 { font-size: 32px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: var(--text-sm); color: var(--color-slate); margin-bottom: 10px; }
.crumbs a { color: var(--color-slate); text-decoration: none; }
.crumbs a:hover { color: var(--color-ink); }
.section-label { display: flex; align-items: center; gap: 8px; font: 400 12px/1.3 var(--font-geist-mono); color: var(--color-slate); text-transform: uppercase; letter-spacing: .02em; padding-left: 10px; border-left: 2px solid var(--color-ember-orange); }
.section-label::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--color-ember-orange); }

/* tabs (QR detail sections) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-gridline); margin-bottom: var(--s24); overflow-x: auto; scrollbar-width: thin; }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 12px 12px; min-height: 44px; text-decoration: none; font-weight: 500; color: var(--color-slate); white-space: nowrap; }
.tabs a:hover { color: var(--color-ink); }
.tabs a[aria-current="page"] { color: var(--color-ink); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--color-ember-orange); border-radius: 2px; }
.tabs .count { font: 500 11px var(--font-geist-mono); color: var(--color-slate); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--element-gap); margin-bottom: var(--s16); }
.kpi { background: #fff; border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); padding: var(--card-padding); display: grid; gap: 12px; }
.kpi-label { display: flex; align-items: center; justify-content: space-between; color: var(--color-slate); font-size: var(--text-sm); }
.kpi-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--color-ember-orange); background: #fff; box-shadow: 0 0 0 4px var(--color-ember-wash); }
.kpi-value { font-size: var(--text-kpi); line-height: 1; letter-spacing: -0.01em; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi-change { font-size: var(--text-xs); color: var(--color-slate); display: flex; gap: 6px; align-items: center; }
.delta { font-family: var(--font-geist-mono); color: var(--color-ink); }
.delta.up::before { content: "▲ "; font-size: 9px; color: var(--color-ember-orange); }
.delta.down::before { content: "▼ "; font-size: 9px; color: var(--color-slate); }

/* ---------- status pills (no extra chroma) ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; min-height: 22px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500; letter-spacing: .01em; background: var(--color-vellum); color: var(--color-graphite); border: 1px solid var(--color-gridline); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-mist); }
.pill.active { background: var(--color-ember-wash); color: var(--color-ember-text); border-color: var(--color-ember-glow-light); }
.pill.active::before { background: var(--color-ember-orange); }
.pill.paused::before { background: transparent; border: 1.5px solid var(--color-graphite); width: 5px; height: 5px; }
.pill.completed::before { background: var(--color-ink); }
.pill.deleted { text-decoration: line-through; }
.pill.plain::before { display: none; }
.tag { display: inline-flex; padding: 2px 8px; border-radius: var(--radius-full); background: var(--color-ember-action); color: #fff; font-size: 12px; font-weight: 500; }
.type-badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-slate); }

/* ---------- tables ---------- */
.table-wrap { border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); overflow-x: auto; background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.data th { text-align: left; font-weight: 500; color: var(--color-slate); padding: 12px 16px; border-bottom: 1px solid var(--color-gridline); background: var(--color-vellum); white-space: nowrap; font-size: var(--text-xs); letter-spacing: .01em; }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--color-gridline); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fcfcfc; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data a { text-decoration: none; font-weight: 500; }
table.data a:hover { text-decoration: underline; }
.cell-sub { display: block; font-size: var(--text-xs); color: var(--color-slate); font-weight: 400; }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: var(--s16); }
.toolbar .search { width: 260px; }
.toolbar select { width: auto; min-width: 140px; border-radius: var(--radius-full); }
.toolbar .spacer { flex: 1; }

/* ---------- QR library ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--element-gap); }
.qr-card { border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.qr-card-thumb { display: grid; place-items: center; background: var(--color-vellum); border-bottom: 1px solid var(--color-gridline); padding: 20px; aspect-ratio: 1 / .82; }
.qr-card-thumb img { width: 132px; height: auto; }
.qr-card-body { padding: 16px; display: grid; gap: 8px; flex: 1; }
.qr-card-title { font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: var(--text-xs); color: var(--color-slate); gap: 8px; }
.qr-card-actions { display: flex; gap: 4px; padding: 8px 12px 12px; flex-wrap: wrap; }
.dest { font-family: var(--font-geist-mono); font-size: 12px; color: var(--color-slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.thumb-sm { width: 44px; height: 44px; border: 1px solid var(--color-gridline); border-radius: 8px; padding: 3px; background: #fff; }

/* ---------- QR detail ---------- */
.identity { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s24); align-items: start; }
.preview-frame { background: var(--color-vellum); border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); padding: 20px; display: grid; place-items: center; }
.preview-frame img, .preview-frame svg { width: 100%; height: auto; max-width: 320px; }
.shortlink { display: flex; align-items: center; gap: 8px; border: 1px solid var(--color-gridline); border-radius: var(--radius-full); padding: 4px 4px 4px 16px; background: #fff; box-shadow: var(--shadow-subtle); max-width: 520px; }
.shortlink code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; font-size: var(--text-sm); }
.kv dt { color: var(--color-slate); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.order-list { list-style: none; padding: 0; margin: 0; counter-reset: ord; }
.order-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--color-gridline); }
.order-list li:first-child { border-top: 0; }
.order-list li::before { counter-increment: ord; content: counter(ord); font: 500 12px var(--font-geist-mono); color: var(--color-slate); width: 24px; height: 24px; border: 1px solid var(--color-gridline); border-radius: 50%; display: grid; place-items: center; }
.order-list li.inactive { opacity: .55; }
.order-list li.fallback::before { content: "↳"; }

/* ---------- designer ---------- */
.designer { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s24); align-items: start; }
.designer-preview { position: sticky; top: 88px; }
.designer-preview .preview-frame { min-height: 340px; }
.preview-meta { display: flex; justify-content: space-between; font: 400 12px var(--font-geist-mono); color: var(--color-slate); margin-top: 10px; }
details.panel { border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); background: #fff; }
details.panel + details.panel { margin-top: var(--s12); }
details.panel > summary { list-style: none; cursor: pointer; padding: 16px var(--card-padding); display: flex; align-items: center; justify-content: space-between; font-weight: 500; min-height: 52px; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: ""; width: 9px; height: 9px; border-right: 1.5px solid var(--color-slate); border-bottom: 1.5px solid var(--color-slate); transform: rotate(45deg); margin-top: -4px; }
details.panel[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.panel > .panel-body { padding: 0 var(--card-padding) var(--card-padding); }
.summary-hint { font-weight: 400; color: var(--color-slate); font-size: var(--text-xs); margin-left: auto; margin-right: 14px; }
.issues { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.issues li { display: flex; gap: 8px; align-items: flex-start; font-size: var(--text-xs); padding: 10px 12px; border-radius: var(--radius-inputs); border: 1px solid var(--color-gridline); background: #fff; }
.issues li.error { border-color: var(--color-ember-orange); background: var(--color-ember-wash); }
.issues li .icon { width: 15px; height: 15px; color: var(--color-ember-orange); }
.issues li strong { font-weight: 500; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-num { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--color-gridline); display: grid; place-items: center; font: 500 12px var(--font-geist-mono); color: var(--color-slate); }

/* type selector */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--element-gap); }
.type-card { display: grid; gap: 10px; padding: 24px; border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); background: var(--color-vellum); text-decoration: none; transition: border-color .15s, background .15s; }
.type-card:hover { background: #fff; border-color: var(--color-mist); }
.type-card .ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--color-ember-orange); background: #fff; border: 1px solid var(--color-gridline); }
.type-card .ic .icon { width: 22px; height: 22px; }
.type-card strong { font-weight: 500; font-size: var(--text-md); }

/* ---------- time timeline ---------- */
.timeline { position: relative; border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); background: #fff; padding: 16px 16px 8px; }
.tl-axis { display: grid; grid-template-columns: repeat(12, 1fr); font: 400 11px var(--font-geist-mono); color: var(--color-slate); margin-left: 120px; }
.tl-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; min-height: 34px; }
.tl-name { font-size: var(--text-xs); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.tl-track { position: relative; height: 18px; background-image: linear-gradient(to right, var(--color-gridline) 1px, transparent 1px); background-size: calc(100% / 12) 100%; border-radius: 4px; }
.tl-bar { position: absolute; top: 2px; height: 14px; border-radius: var(--radius-full); background: var(--color-stone); }
.tl-bar.on { background: var(--color-ember-orange); }
.tl-bar.off { background: var(--color-stone); }
.tl-now { position: absolute; top: 8px; bottom: 8px; width: 0; border-left: 1.5px dashed var(--color-ember-orange); }
.tl-now span { position: absolute; top: -4px; left: 4px; font: 500 10px var(--font-geist-mono); color: var(--color-ember-text); white-space: nowrap; }

/* rules */
.rule-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 0; border-top: 1px solid var(--color-gridline); }
.rule-row:first-child { border-top: 0; padding-top: 0; }
.rule-row .prio { font: 500 12px var(--font-geist-mono); color: var(--color-slate); border: 1px solid var(--color-gridline); border-radius: var(--radius-full); padding: 2px 8px; }
.cond { display: inline-flex; gap: 4px; align-items: center; font: 400 12px var(--font-geist-mono); background: var(--color-vellum); border: 1px solid var(--color-gridline); border-radius: var(--radius-full); padding: 2px 10px; margin: 2px 4px 2px 0; }
.cond-row { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 12px; border: 1px solid var(--color-gridline); border-radius: var(--radius-xl); background: var(--color-vellum); margin-bottom: 8px; }
.cond-row .sub { display: grid; gap: 8px; }
.map { height: 320px; border: 1px solid var(--color-gridline); border-radius: var(--radius-xl); overflow: hidden; background: var(--color-vellum); }
.active-now { display: inline-flex; align-items: center; gap: 6px; font: 500 11px var(--font-geist-mono); color: var(--color-ember-text); text-transform: uppercase; letter-spacing: .04em; }
.active-now::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-ember-orange); box-shadow: 0 0 0 3px var(--color-ember-glow-light); }

/* simulator */
.trace { list-style: none; padding: 0; margin: 12px 0 0; font: 400 12px/1.5 var(--font-geist-mono); }
.trace li { padding: 8px 0; border-top: 1px dashed var(--color-gridline); display: grid; grid-template-columns: 80px 1fr; gap: 10px; }
.trace .match { color: var(--color-ember-text); font-weight: 500; }
.sim-result { margin-top: 12px; padding: 14px; border-radius: var(--radius-xl); border: 1px solid var(--color-gridline); background: var(--color-vellum); }

/* ---------- charts (analytical, no fills) ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--color-gridline); stroke-width: 1; }
.chart .axis text { fill: var(--color-slate); font: 400 10px var(--font-geist-mono); }
.chart .line { fill: none; stroke: var(--color-ember-orange); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line2 { fill: none; stroke: var(--color-mist); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .dot { fill: #fff; stroke: var(--color-ember-orange); stroke-width: 1.5; }
.legend { display: flex; gap: 16px; font-size: var(--text-xs); color: var(--color-slate); }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 2px; background: var(--color-ember-orange); vertical-align: middle; margin-right: 6px; }
.legend span.alt::before { background: var(--color-mist); }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: var(--text-sm); }
.bar-row .bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-value { font-variant-numeric: tabular-nums; color: var(--color-slate); font-size: var(--text-xs); }
.bar-track { grid-column: 1 / -1; height: 4px; background: var(--color-vellum); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--color-ink); border-radius: 4px; }
.bar-row:first-child .bar-fill { background: var(--color-ember-orange); }
.analytics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--element-gap); }

/* activity feed */
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 11px 0; border-top: 1px solid var(--color-gridline); font-size: var(--text-sm); }
.feed li:first-child { border-top: 0; }
.feed li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-mist); transform: translateY(-1px); }
.feed time { font: 400 11px var(--font-geist-mono); color: var(--color-slate); white-space: nowrap; }

/* ---------- feedback ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-xl); border: 1px solid var(--color-gridline); background: #fff; margin-bottom: var(--s16); font-size: var(--text-sm); box-shadow: var(--shadow-xl-2); }
.flash .icon { color: var(--color-ember-orange); margin-top: 1px; }
.flash.error { border-color: var(--color-ember-orange); background: var(--color-ember-wash); }
.flash button { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--color-slate); padding: 0 4px; min-height: 24px; }
.empty { text-align: center; padding: 56px 24px; border: 1px dashed var(--color-gridline); border-radius: var(--radius-cards); background: var(--color-vellum); display: grid; gap: 10px; justify-items: center; }
.empty .ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1px solid var(--color-gridline); color: var(--color-ember-orange); }
.empty h3 { font-size: var(--text-md); }
.empty p { color: var(--color-slate); max-width: 420px; }
.notice { padding: 12px 16px; border-radius: var(--radius-xl); background: var(--color-vellum); border: 1px solid var(--color-gridline); font-size: var(--text-sm); display: flex; gap: 10px; align-items: flex-start; }
.notice .icon { color: var(--color-slate); }
.skeleton { background: linear-gradient(90deg, var(--color-vellum), #f1f1f1, var(--color-vellum)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.pager { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: var(--s16); font-size: var(--text-sm); color: var(--color-slate); }

/* dialog */
dialog { border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow-xl); color: var(--color-ink); }
dialog::backdrop { background: rgba(38,38,38,.32); }
.dialog-body { padding: var(--card-padding); }
.dialog-body h2 { font-size: var(--text-heading-sm); margin-bottom: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px var(--card-padding); border-top: 1px solid var(--color-gridline); background: var(--color-vellum); border-radius: 0 0 var(--radius-cards) var(--radius-cards); }

/* ---------- public / marketing ---------- */
.pub-nav { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 24px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--color-gridline); }
.pub-nav nav { display: flex; gap: 24px; margin: 0 auto; }
.pub-nav nav a { text-decoration: none; font-weight: 500; }
.pub-nav .right { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.wrap { max-width: var(--page-max-width); margin: 0 auto; padding: 0 24px; }
.graph-paper { background-color: #fff; background-image: linear-gradient(var(--color-gridline) 1px, transparent 1px), linear-gradient(90deg, var(--color-gridline) 1px, transparent 1px); background-size: 48px 48px; background-position: center top; }
.hero { padding: 96px 0 72px; text-align: center; }
.hero-inner { background: #fff; display: inline-block; padding: 40px 32px; border-radius: var(--radius-cards); }
.hero .badge-line { display: inline-flex; align-items: center; gap: 8px; font: 400 12px var(--font-geist-mono); color: var(--color-slate); border: 1px solid var(--color-gridline); border-radius: var(--radius-full); padding: 4px 12px 4px 4px; margin-bottom: 24px; background: #fff; }
.hero h1 { font-size: var(--text-display-xl); line-height: 1; letter-spacing: -0.01em; max-width: 820px; margin: 0 auto; }
.hero p.lead { font-size: var(--text-md); color: var(--color-slate); max-width: 560px; margin: 20px auto 0; }
.hero .btn-row { justify-content: center; margin-top: 32px; }
.url-bar { display: flex; align-items: center; gap: 4px; max-width: 560px; margin: 32px auto 0; border: 1px solid var(--color-gridline); border-radius: var(--radius-full); padding: 6px 6px 6px 20px; background: #fff; box-shadow: var(--shadow-subtle); text-align: left; }
.url-bar code { flex: 1; color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-bar .chipx { font: 500 12px var(--font-geist-mono); background: var(--color-vellum); border-radius: var(--radius-full); padding: 4px 10px; color: var(--color-ink); }
.url-bar .go { width: 36px; height: 36px; border-radius: 50%; background: var(--color-ember-action); color: #fff; display: grid; place-items: center; }
.section { padding: var(--section-gap) 0 0; }
.section h2.display { font-size: var(--text-display); line-height: 1.07; letter-spacing: -0.005em; margin-top: 16px; max-width: 760px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); overflow: hidden; margin-top: 40px; }
.feature { padding: 32px 24px; text-align: center; border-right: 1px solid var(--color-gridline); border-bottom: 1px solid var(--color-gridline); background: var(--color-vellum); display: grid; gap: 10px; justify-items: center; }
.feature:nth-child(3n) { border-right: 0; }
.feature:nth-last-child(-n+3) { border-bottom: 0; }
.feature .ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1px solid var(--color-gridline); color: var(--color-ember-orange); }
.feature h3 { font-size: var(--text-md); }
.feature p { color: var(--color-slate); }
.code-window { border: 1px solid var(--color-gridline); border-radius: 8px; background: var(--color-vellum); box-shadow: var(--shadow-subtle-3); overflow: hidden; }
.code-window .bar { height: 40px; display: flex; align-items: center; gap: 6px; padding: 0 14px; border-bottom: 1px solid var(--color-gridline); }
.code-window .bar i { width: 6px; height: 6px; border-radius: 50%; background: var(--color-gridline); }
.code-window .bar span { margin: 0 auto; font: 400 12px var(--font-geist-mono); color: var(--color-slate); }
.code-window pre { margin: 0; padding: 20px; font: 400 13px/1.57 var(--font-geist-mono); overflow-x: auto; }
.code-window .k { color: var(--color-ember-text); }
.code-window .c { color: var(--color-graphite); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--element-gap); margin-top: 40px; }
.steps .card { background: var(--color-vellum); }
.foot { margin-top: var(--section-gap); border-top: 1px solid var(--color-gridline); padding: 32px 0; color: var(--color-slate); font-size: var(--text-sm); }
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 48px 16px; }
.auth-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); padding: 32px; box-shadow: var(--shadow-xl); }
.auth-card h1 { font-size: var(--text-heading); margin-bottom: 6px; }
.auth-card .sub { color: var(--color-slate); margin-bottom: 24px; }
.auth-card .btn-primary { width: 100%; margin-top: 8px; }
.auth-alt { margin-top: 20px; text-align: center; font-size: var(--text-sm); color: var(--color-slate); }
.visitor { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--color-vellum); }
.visitor .card { max-width: 440px; text-align: center; display: grid; gap: 12px; justify-items: center; padding: 40px 28px; }
.visitor .status-code { font: 500 12px var(--font-geist-mono); color: var(--color-slate); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .designer { grid-template-columns: minmax(0, 1fr) 320px; }
  .analytics-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-xl); }
  .rail.open { transform: none; }
  .rail-backdrop { position: fixed; inset: 0; background: rgba(38,38,38,.28); z-index: 40; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 24px 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split-even, .designer { grid-template-columns: 1fr; }
  .designer-preview { position: static; order: -1; }
  .features { grid-template-columns: 1fr 1fr; }
  .feature:nth-child(3n) { border-right: 1px solid var(--color-gridline); }
  .feature:nth-child(2n) { border-right: 0; }
  .feature:nth-last-child(-n+3) { border-bottom: 1px solid var(--color-gridline); }
  .feature:nth-last-child(-n+2) { border-bottom: 0; }
  .steps { grid-template-columns: 1fr 1fr; }
  .pub-nav nav { display: none; }
}
@media (max-width: 640px) {
  h1, .page-head h1 { font-size: 30px; }
  .hero h1 { font-size: 40px; }
  .section h2.display { font-size: 32px; }
  .kpis, .analytics-grid, .grid-2, .grid-3, .features, .steps { grid-template-columns: 1fr; }
  .feature { border-right: 0 !important; border-bottom: 1px solid var(--color-gridline) !important; }
  .identity { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .topbar .search { display: none; }
  .toolbar .search, .toolbar select { width: 100%; }
  .cond-row { grid-template-columns: 1fr; }
  .tl-row { grid-template-columns: 80px 1fr; }
  .tl-axis { margin-left: 80px; }
  .tl-axis span:nth-child(odd) { visibility: hidden; }
  .btn, .chip span, .seg a, .nav a { min-height: 44px; }
  /* Tables → stacked rows */
  table.stack-mobile thead { display: none; }
  table.stack-mobile, table.stack-mobile tbody, table.stack-mobile tr, table.stack-mobile td { display: block; width: 100%; }
  table.stack-mobile tr { border-bottom: 1px solid var(--color-gridline); padding: 10px 0; }
  table.stack-mobile td { border: 0; padding: 4px 16px; text-align: left !important; }
  table.stack-mobile td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 110px; color: var(--color-slate); font-size: var(--text-xs); }
  .auth-card { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print { .rail, .topbar, .btn, .tabs { display: none !important; } .shell { display: block; } }

/* grid/flex children must be allowed to shrink below their content width (long URLs, codes) */
.split > *, .split-even > *, .designer > *, .identity > *, .grid-2 > *, .grid-3 > *, .kpis > *, .analytics-grid > * { min-width: 0; }
.shortlink code { min-width: 0; }
.page-head > * { min-width: 0; max-width: 100%; }

.rule-row { grid-template-columns: minmax(0, 1fr); }
.rule-row > .btn-row { grid-column: 1; justify-content: flex-start !important; gap: 2px; }
.leaflet-control-attribution a { text-decoration: underline; }
.field > *, input, select, textarea { min-width: 0; max-width: 100%; }
.url-bar code .accent { color: var(--color-ember-text); }
.leaflet-container .leaflet-control-attribution a { text-decoration: underline !important; color: var(--color-ink) !important; }

/* v1.1 — heatmap, map, access */
.heatmap-wrap { overflow-x: auto; }
table.heatmap { border-collapse: separate; border-spacing: 2px; font: 400 10px var(--font-geist-mono); color: var(--color-slate); }
table.heatmap th { font-weight: 400; padding: 0 4px 0 0; text-align: left; white-space: nowrap; }
table.heatmap thead th { text-align: center; padding: 0 0 4px; }
table.heatmap td { width: 22px; height: 18px; background: var(--color-vellum); border-radius: 3px; padding: 0; position: relative; }
table.heatmap td span:first-child { position: absolute; inset: 0; border-radius: 3px; background: var(--color-ember-orange); }
.scan-map { height: 340px; border: 1px solid var(--color-gridline); border-radius: var(--radius-xl); overflow: hidden; background: var(--color-vellum); }
.meter { height: 6px; background: var(--color-vellum); border-radius: 6px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--color-ember-orange); }
@font-face { font-family: "Poppins"; src: url(../fonts/poppins-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url(../fonts/inter-latin-500-normal.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }

/* v1.2 — pattern picker */
.pattern-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.pattern-opt { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 4px 6px; border: 1px solid var(--color-gridline); border-radius: var(--radius-xl); background: #fff; cursor: pointer; text-align: center; }
.pattern-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pattern-opt:hover { border-color: var(--color-mist); }
.pattern-opt:has(input:checked) { border-color: var(--color-ember-orange); background: var(--color-ember-wash); box-shadow: 0 0 0 3px var(--color-ember-glow-light); }
.pattern-opt:has(input:focus-visible) { box-shadow: var(--focus); }
.pattern-thumb { width: 44px; height: 44px; display: block; }
.pattern-thumb svg { width: 44px; height: 44px; display: block; }
.pattern-name { font-size: 11px; line-height: 1.25; color: var(--color-ink); }

/* v1.2 — mobile fixes */
.hero-inner { display: block; max-width: 100%; }
.hero .badge-line { max-width: 100%; white-space: normal; text-align: left; line-height: 1.4; }
.hero h1, .hero p.lead { overflow-wrap: break-word; }
.url-bar { max-width: min(560px, 100%); }
.url-bar code { min-width: 0; }
.period-form input[type=date] { width: auto; }
@media (max-width: 640px) {
  .hero { padding: 40px 0 32px; }
  .hero-inner { padding: 24px 4px; }
  .hero h1 { font-size: 36px; line-height: 1.08; }
  .hero .btn-row .btn { flex: 1 1 100%; }
  .url-bar .chipx { display: none; }
  .wrap { padding: 0 16px; }
  .period-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; border-radius: var(--radius-xl); }
  .period-seg a { justify-content: center; padding: 5px 4px; border-radius: 10px; font-size: 12px; text-align: center; }
  .period-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .period-form input[type=date] { width: 100% !important; }
  .period-form .btn { grid-column: 1 / -1; width: 100%; }
  .page-head { margin-bottom: 20px; }
  .toolbar .seg:not(.period-seg) { width: auto; }
  .pattern-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
}

/* v1.3 — layout fixes */
:is(.split, .split-even, .analytics-grid, .grid-2, .grid-3, .kpis, .designer, .identity) > *, :is(.split, .split-even, .analytics-grid, .grid-2, .grid-3, .kpis, .designer, .identity) > .card { margin-top: 0; }
.split { align-items: start; }
/* cards in the same analytics row share the height of the tallest (content stays at the top) */
.analytics-grid { align-items: stretch; }

.qr-card-actions { flex-wrap: nowrap; align-items: center; }
.qr-card-actions .btn-icon { margin-left: auto; }
.qr-card-actions .btn-icon ~ form .btn-icon { margin-left: 0; }
.qr-card-actions form.inline { display: inline-flex; }
.btn-icon { padding-left: 10px; padding-right: 10px; }
.nav-count { margin-left: auto; font: 500 11px var(--font-geist-mono); background: var(--color-vellum); border: 1px solid var(--color-gridline); border-radius: 999px; padding: 1px 7px; color: var(--color-slate); }
.table-empty { text-align: center; color: var(--color-slate); padding: 32px 16px !important; }
.logo-mark { width: 26px; height: 26px; flex: none; }
.notice[hidden] { display: none; }
.notice.warn { background: var(--color-ember-wash); border-color: var(--color-ember-glow-light); }
table.heatmap { width: 100%; table-layout: fixed; }
table.heatmap td { width: auto; height: 20px; }
table.heatmap th:first-child { width: 34px; }
.split.stretch { align-items: stretch; }
.split.stretch > .card { display: flex; flex-direction: column; }
.split.stretch > .card > .scan-map { flex: 1; min-height: 300px; }
.split.stretch > .stack { display: flex; flex-direction: column; }
.split.stretch > .stack > .card:last-child { flex: 1 0 auto; }
.stack > *, .split > .stack > * { min-width: 0; }
.table-wrap { max-width: 100%; }
@media (max-width: 640px) { form .table-wrap table.data input, form .table-wrap table.data select { min-width: 96px; } }
.tl-now.end span { left: auto; right: 4px; }

/* Geo rule zone editor (v1.4) */
.zone-card { border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); padding: 12px; margin-bottom: 10px; background: #fff; }
.zone-card.selected { border-color: var(--color-ember-orange); box-shadow: 0 0 0 2px var(--color-ember-wash); }
.zone-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.zone-head > input:not([type]) { flex: 1 1 160px; min-width: 0; }
.zone-card .grid-3 { margin-top: 8px; }
.zone-card textarea { width: 100%; }
.vertex-handle { background: #fff; border: 2px solid var(--color-ember-orange); border-radius: 50%; box-sizing: border-box; }

/* v1.4.1 — compact weekday tags (Time Schedule); selected days keep the orange chip style */
.chips-compact { gap: 4px; }
.chips-compact .chip span { min-height: 26px; padding: 2px 8px; font: 400 12px var(--font-geist-mono); }

/* v1.5 — Lead Gate form */
.visitor .lead-card { text-align: left; justify-items: stretch; }
.visitor .lead-card h1, .visitor .lead-card > p.muted { text-align: center; }
.lead-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* v1.5 — Leads */
.kv-row { display: contents; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pill.repeat-tag { background: var(--color-vellum); color: var(--color-slate); border: 1px solid var(--color-gridline); font-weight: 500; }
.funnel { display: grid; gap: 10px; }
.funnel-step { display: grid; grid-template-columns: 150px minmax(0, 1fr) 90px; gap: 12px; align-items: center; font-size: var(--text-sm); }
.funnel-bar { height: 12px; border-radius: var(--radius-full); background: var(--color-gridline); overflow: hidden; }
.funnel-bar span { display: block; height: 100%; border-radius: var(--radius-full); background: var(--color-ember-orange); }
.funnel-bar.muted span { background: var(--color-stone); }
@media (max-width: 640px) { .funnel-step { grid-template-columns: 1fr 70px; } .funnel-step .funnel-bar { grid-column: 1 / -1; grid-row: 2; } }

/* v1.7.1 — pattern picker: one grid, five per row on desktop, SAFE / EXPERIMENTAL label on every card */
.pattern-badge { display: block; margin-top: 2px; font: 500 10px var(--font-geist-mono); letter-spacing: .02em; text-transform: uppercase; color: var(--color-slate); }

/* v1.5 — MapLibre Geo Rules maps */
.vertex-handle { width: 14px; height: 14px; cursor: grab; }
.zone-label { font: 500 11px/1.2 var(--font-geist-mono); color: var(--color-ink); background: rgba(255,255,255,.92); border: 1px solid var(--color-ember-orange);
  border-radius: var(--radius-full); padding: 2px 8px; white-space: nowrap; pointer-events: none; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.zone-label.off { border-color: var(--color-stone); color: var(--color-slate); }
.map-down { display: grid; place-items: center; background: var(--color-vellum); }
.map-note { padding: 16px; margin: 0; text-align: center; }
.map-note-over { position: absolute; inset: auto 12px 12px 12px; background: rgba(255,255,255,.95); border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); z-index: 2; }
.maplibregl-ctrl-attrib { font-size: 11px; }
.pattern-grid.pattern-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* ten cards divide evenly into fives or twos: five per row where there is room, otherwise two (never a lone card) */
@media (max-width: 560px) { .pattern-grid.pattern-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pattern-badge-safe { color: var(--color-success-text, #1b6b3a); }
.pattern-badge-experimental { color: var(--color-ember-text); }

/* v1.8 — Help Center */
.help-search { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.help-search input[type=search] { flex: 1 1 240px; min-width: 0; }
.help-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.help-cats a { padding: 6px 12px; border: 1px solid var(--color-gridline); border-radius: var(--radius-full); text-decoration: none; color: var(--color-ink); font-size: 14px; min-height: 32px; display: inline-flex; align-items: center; }
.help-cats a[aria-current="page"] { border-color: var(--color-ember-orange); color: var(--color-ember-text); background: rgba(255, 77, 0, .06); }
.help-list { padding-left: 18px; margin: 0 0 20px; } .help-list li { margin: 6px 0; }
.help-faq { border-bottom: 1px solid var(--color-gridline); padding: 10px 0; } .help-faq summary { cursor: pointer; font-weight: 500; min-height: 32px; display: flex; align-items: center; }
.help-faq summary:focus-visible, .help-guide summary:focus-visible { outline: 2px solid var(--color-ember-orange); outline-offset: 2px; }
.help-cat-h { margin: 20px 0 4px; }
.help-steps { padding-left: 22px; } .help-steps li { margin: 4px 0; }
.help-guide { margin: 8px 0 24px; } .help-guide summary { cursor: pointer; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 32px; }
.help-chat { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bubble { margin: 0; padding: 10px 14px; border-radius: 14px; max-width: min(560px, 100%); overflow-wrap: anywhere; }
.bubble-helper { background: var(--color-vellum); align-self: flex-start; } .bubble-you { background: rgba(255, 77, 0, .1); align-self: flex-end; }
.help-options { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.help-wrap { max-width: 760px; } .help-article .help-a { font-size: 17px; }
.help-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--color-gridline); }
.help-support { margin-top: 24px; }
.help-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--color-slate); text-decoration: none; border: 1px solid var(--color-gridline); border-radius: var(--radius-full); padding: 2px 10px 2px 6px; vertical-align: middle; min-height: 28px; }
.help-link:hover, .help-link:focus-visible { color: var(--color-ember-text); border-color: var(--color-ember-orange); }
h1 .help-link, h1 + .help-link { margin-left: 8px; font-weight: 400; }
.tabs-row { display: flex; align-items: center; gap: 12px; } .tabs-row .tabs { flex: 1 1 auto; min-width: 0; }
.help-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--color-paper, #fff); border-left: 1px solid var(--color-gridline); box-shadow: -8px 0 24px rgba(0,0,0,.08); padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; z-index: 60; }
.help-panel-close { float: right; }

/* v1.9.0 — Help Center redesign (all rules scoped to help-* classes) */
.help-hero { padding: 8px 0 4px; }
.help-hero h1 { margin-bottom: 4px; }
.help-hero .help-search { margin: 16px 0 10px; }
.help-hero .help-search input[type=search] { font-size: 16px; min-height: 48px; padding: 0 16px; border-radius: var(--radius-full); }
.help-hero .help-search .btn { min-height: 48px; border-radius: var(--radius-full); }
.help-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 16px; }
.help-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border-radius: var(--radius-full); background: var(--color-vellum); color: var(--color-ink); text-decoration: none; font-size: 13px; border: 1px solid transparent; }
.help-chip:hover, .help-chip:focus-visible { border-color: var(--color-ember-orange); color: var(--color-ember-text); }
.help-count { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: var(--radius-full); background: var(--color-vellum); font-size: 12px; text-align: center; }
.help-cats a[aria-current="page"] .help-count { background: #ffffff; }   /* ember text on white: 5.0:1 (AA) */
.help-h2 { font-size: 18px; margin: 20px 0 10px; }
.help-cards { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.help-cards > .help-card { margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.help-card p { margin: 0; }
.help-card-title { font-weight: 600; color: var(--color-ink); text-decoration: none; }
.help-card-title:hover, .help-card-title:focus-visible { color: var(--color-ember-text); text-decoration: underline; }
.help-tag { align-self: flex-start; font-size: 12px; padding: 2px 8px; border-radius: var(--radius-full); background: var(--color-vellum); color: var(--color-slate); }
.help-empty p { margin: 6px 0; }
.help-guide summary { gap: 12px; }
.help-guide-icon { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255, 77, 0, .1); color: var(--color-ember-text); flex: none; }
.help-feedback .btn.is-selected { border-color: var(--color-ember-orange); background: rgba(255, 77, 0, .08); color: var(--color-ember-text); }
.help-feedback-status { flex-basis: 100%; margin: 0; font-weight: 500; min-height: 1.2em; }
.help-feedback-status.is-ok { color: var(--color-success-text, #1b6b3a); }
.help-feedback-status.is-error { color: var(--color-ember-text); }
.help-related { margin-top: 24px; }

/* v1.9.0 — Circular QR Studio controls */
.circle-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 560px) { .circle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.circle-grid .pattern-thumb img { width: 100%; height: auto; display: block; }
.preview-png { width: 100%; max-width: 320px; height: auto; display: block; margin: 0 auto; }
.scan-status { margin: 8px 0 0; font-weight: 500; min-height: 1.2em; }
.scan-status[data-tone="ok"] { color: var(--color-success-text, #1b6b3a); }
.scan-status[data-tone="warn"] { color: var(--color-ember-text); }
[data-classic-only][hidden], [data-circular-only][hidden] { display: none !important; }   /* v1.9.1: layout-aware controls */

/* v1.9.1 — Help Center refinement: editorial, text-led navigation; fewer capsules (scoped to help-* classes) */
.help-hero .help-search input[type=search] { border-radius: var(--radius-inputs); }
.help-hero .help-search .btn { border-radius: var(--radius-inputs); }
.help-chips { gap: 0; margin: 0 0 20px; }
.help-chips > .muted { margin-right: 10px; }
.help-chip { min-height: 0; padding: 4px 0; border: 0; border-radius: 0; background: none; color: var(--color-ink); font-size: 14px; text-decoration: underline; text-decoration-color: var(--color-gridline); text-underline-offset: 3px; }
.help-chip:hover { color: var(--color-ember-text); text-decoration-color: currentColor; border: 0; }
.help-chip:focus-visible { outline: 2px solid var(--color-ember-orange); outline-offset: 2px; border-radius: 2px; }
.help-chip + .help-chip::before { content: "·"; display: inline-block; margin: 0 10px; color: var(--color-slate); text-decoration: none; }
nav.help-cats { gap: 4px 22px; padding: 2px 0 10px; margin-bottom: 20px; border-bottom: 1px solid var(--color-gridline); font-family: var(--font-geist-mono); }
nav.help-cats a { padding: 6px 0 4px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--color-ink); font-size: 13px; letter-spacing: .01em; }
nav.help-cats a:hover { color: var(--color-ember-text); }
nav.help-cats a:focus-visible { outline: 2px solid var(--color-ember-orange); outline-offset: 2px; }
nav.help-cats a[aria-current="page"] { border: 0; border-bottom: 2px solid var(--color-ember-orange); background: none; color: var(--color-ember-text); }
nav.help-cats .help-count, nav.help-cats a[aria-current="page"] .help-count { min-width: 0; margin-left: 4px; padding: 0; background: none; border-radius: 0; color: var(--color-slate); font-size: 12px; }
nav.help-cats a[aria-current="page"] .help-count { color: var(--color-ember-text); }
nav.help-cats .help-count::before { content: "("; } nav.help-cats .help-count::after { content: ")"; }
.help-cards > .help-card { border: 0; border-top: 2px solid var(--color-ink); border-radius: 0; box-shadow: none; padding: 14px 2px 6px; background: none; }
.help-cards { gap: 20px 28px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.help-faq { padding: 0; }
.help-faq > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; min-height: 44px; }
.help-faq > summary::-webkit-details-marker { display: none; }
.help-faq > summary::after { content: "+"; flex: none; width: 24px; text-align: center; font-family: var(--font-geist-mono); font-size: 18px; line-height: 1; color: var(--color-slate); }
.help-faq[open] > summary::after { content: "−"; color: var(--color-ember-text); }
.help-faq[open] > summary { color: var(--color-ember-text); }
.help-faq > :not(summary) { margin: 0 40px 12px 0; }
.help-cat-h { margin: 22px 0 2px; font-family: var(--font-geist-mono); }

/* ---------- v1.10.0 ---------- */
/* DEF-112: keyboard focus and in-page jumps never land under the sticky 64 px header */
html { scroll-padding-top: 80px; }
/* DEF-111: the sidebar's sticky "Create QR" footer must not cover a focused nav link */
.rail { scroll-padding-bottom: 72px; }
/* UI-05 / DEF-082–085: full URLs wrap anywhere instead of overflowing or being cut off; Copy sits beside them */
.url-full { font-family: var(--font-geist-mono); font-size: 12px; overflow-wrap: anywhere; word-break: break-word; white-space: normal; min-width: 0; }
.url-cell { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.url-cell .url-full, .url-cell .dest { flex: 1 1 auto; min-width: 0; }
.url-cell .btn { flex: 0 0 auto; }
.head-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; min-width: 0; max-width: 100%; }
.head-link .caption { flex-basis: 100%; }
.head-link code { flex: 1 1 200px; min-width: 0; }
.page-head h1 { overflow-wrap: anywhere; }
.page-head.compact { flex-wrap: wrap; }
.page-head.compact > div:first-child { min-width: 0; flex: 1 1 320px; }
/* list views keep two-line truncation (owner decision) with the full value in the title and a Copy action */
.dest-2 { font-family: var(--font-geist-mono); font-size: 12px; color: var(--color-slate); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
/* required / optional guidance */
.req { color: var(--color-ember-text, #b2410c); margin-left: 2px; }
.opt { color: var(--color-slate); font-weight: 400; font-size: var(--text-xs); }
/* DEF-107 public footer / DEF-108 compact authenticated utility footer */
.pub-foot-inner { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; }
.pub-foot nav, .app-foot nav { display: flex; flex-wrap: wrap; gap: 4px 4px; }
.pub-foot nav a, .app-foot nav a { color: var(--color-slate); text-decoration: none; padding: 10px 8px; min-height: 44px; display: inline-flex; align-items: center; }
.pub-foot nav a:hover, .app-foot nav a:hover { color: var(--color-ink); text-decoration: underline; }
.app-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; align-items: center; padding: 8px var(--s32); border-top: 1px solid var(--color-gridline); color: var(--color-slate); font-size: var(--text-xs); }
.main { display: flex; flex-direction: column; min-width: 0; }
.main > .content { flex: 1 0 auto; }
pre[tabindex]:focus-visible { outline: 2px solid var(--color-ember-orange); outline-offset: 2px; }
@media (max-width: 960px) {
  /* DEF-111: a closed drawer is removed from the Tab order (not just moved off-screen) */
  .rail { visibility: hidden; transition: transform .2s, visibility 0s linear .2s; }
  .rail.open { visibility: visible; transition: transform .2s; }
  .app-foot { padding: 8px 16px; }
}
@media (prefers-reduced-motion: reduce) { .rail, .rail.open { transition: none; } }
/* D3 edit-conflict notice */
.conflict { border: 1px solid var(--color-ember-orange); border-radius: var(--radius-md, 12px); background: #fff7f2; padding: 16px; margin-bottom: 16px; display: grid; gap: 10px; }
.conflict h2 { font-size: 16px; display: flex; gap: 8px; align-items: center; margin: 0; }
.conflict-mine dd { margin-bottom: 6px; }
/* UI-17 full-screen sign-in / sign-up */
.auth-screen { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(280px, 5fr) 7fr; background: #fff; }
.auth-side { background: var(--color-vellum, #faf8f5); border-right: 1px solid var(--color-gridline); padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.auth-side .brand { padding: 0; font-size: 20px; }
.auth-side-line { font-size: 20px; line-height: 1.4; color: var(--color-ink); max-width: 30ch; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px 24px; min-width: 0; }
.auth-main > * { width: min(420px, 100%); }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.auth-top a.small { min-height: 44px; display: inline-flex; align-items: center; }
.auth-brand-sm { padding: 0; visibility: hidden; }
.auth-screen .auth-wrap { min-height: 0; padding: 0; display: block; }
.auth-screen .auth-card { width: 100%; box-shadow: none; border: 0; padding: 0; }
.auth-links { display: flex; gap: 8px; justify-content: center; }
.auth-links a { color: var(--color-slate); padding: 10px 8px; min-height: 44px; display: inline-flex; align-items: center; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 36px; }
@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-brand-sm { visibility: visible; }
  .auth-main { justify-content: flex-start; padding: 16px 16px 32px; }
}
@media (max-width: 640px) { .pw-toggle { min-height: 40px; } }
/* probe findings (v1.9.1 baseline) */
/* DEF-084 / DEF-100 / DEF-101: hidden column labels are absolutely positioned; keep them inside the scrolling wrapper so tables never widen the page */
.table-wrap { position: relative; }
/* DEF-110: condition cards never push their Remove button past the edge */
.cond-row > * { min-width: 0; }
.cond-row .sub input, .cond-row .sub select { max-width: 100%; }
/* WCAG 2.2 2.5.8 target size (≥24 px): breadcrumbs, public header links, card-head links, sliders, file pickers */
.crumbs a, .pub-nav nav a, .card-head a.small, .card-head a:not(.btn) { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 0; }
input[type=range] { min-height: 24px; }
input[type=file] { min-height: 32px; }
@media (max-width: 1024px) { .crumbs a, .card-head a.small { min-height: 44px; } }
/* scroll regions made keyboard-reachable by app.js get a visible focus ring */
[data-scroll-region]:focus-visible { outline: 2px solid var(--color-ember-orange); outline-offset: 2px; }
/* DEF-099: Diagnostics log lines wrap instead of being clipped; checks table values wrap */
pre.log { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; }
.table-wrap td.mono { overflow-wrap: anywhere; }
/* DEF-089: Apply + Reset stay together */
.toolbar-actions { display: inline-flex; gap: 8px; flex: 0 0 auto; }
/* DEF-088: compact three-up counters */
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.mini-stats > div { border: 1px solid var(--color-gridline); border-radius: var(--radius-xl, 12px); padding: 8px 10px; min-width: 0; }
.mini-stats dt { font-size: var(--text-xs); color: var(--color-slate); }
.mini-stats dd { margin: 0; font: 500 18px var(--font-geist-mono); }
@media (max-width: 640px) {
  /* DEF-086: empty states proportionate on phones */
  .empty { padding: 24px 16px; gap: 8px; }
  .empty .ic { width: 36px; height: 36px; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn { flex: 1 1 0; }
}
.help-members { margin-top: 12px; display: grid; gap: 8px; border-left: 3px solid var(--color-ember-orange); }
.help-members-list { margin: 0; padding-left: 18px; color: var(--color-slate); }
/* QR-LIST-04: destination and permanent short link labelled separately on cards */
.card-line { display: grid; gap: 2px; min-width: 0; }
/* DEF-109: card actions wrap instead of overlapping when the card is narrow */
.qr-card-actions { flex-wrap: wrap; row-gap: 4px; }
.qr-card-actions .btn { white-space: nowrap; }
/* PAGE-02: history grouped by day */
.feed-day { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--color-slate); margin: 16px 0 4px; }
.feed-day:first-of-type { margin-top: 0; }
.period-lbl { font-size: var(--text-xs); color: var(--color-slate); align-self: center; }
.period-shown { flex-basis: 100%; margin: 0; }
/* DEF-110 / UI-06: the rule editor needs room; list and form stack until there is enough width for both */
@media (max-width: 1279px) { .rules-split { grid-template-columns: minmax(0, 1fr); } }
/* condition cards follow the width of the form they sit in (not the window) */
.rules-split > * { container-type: inline-size; }
@container (max-width: 560px) {
  .cond-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cond-row > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}
/* small targets left by the probe: card titles and inline "All" links */
.qr-card-title, .help-card-title { display: block; min-height: 24px; line-height: 24px; }
.card-head a.small { padding: 2px 6px; min-width: 24px; justify-content: center; }
/* Typed-DELETE dialog on short screens (e.g. phone with the keyboard open): body scrolls, actions stay in view */
dialog[open] { display: flex; flex-direction: column; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: hidden; }
dialog .dialog-body { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
dialog .dialog-actions { flex: 0 0 auto; }
/* PAGE-02: audit log grouped by day (also in the phone stacked layout) */
table.data tr.day-row th { text-align: left; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--color-slate); background: var(--color-vellum); padding: 8px 16px; }
@media (max-width: 640px) { table.stack-mobile tr.day-row, table.stack-mobile tr.day-row th { display: block; width: 100%; } table.stack-mobile tr.day-row { padding: 0; } }
/* DATA-12 campaign QR assignment: touch-friendly checklist */
.attach-form { display: grid; gap: 12px; margin-top: 16px; }
.check-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 320px; overflow-y: auto; border: 1px solid var(--color-gridline); border-radius: var(--radius-xl, 12px); }
.check-list li + li { border-top: 1px solid var(--color-gridline); }
.check-list label.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 12px; margin: 0; cursor: pointer; }
.check-list label.check input { margin-top: 3px; flex: 0 0 auto; }
.check-list .cell-sub { display: block; }
/* DEF-105 (interim — the original defect description is not available): public lead form on phones.
   16 px text avoids iOS Safari zooming the page when a field is focused; small phones get less double padding. */
.visitor .lead-card input:not([type=checkbox]):not([type=radio]), .visitor .lead-card select, .visitor .lead-card textarea { font-size: 16px; }
@media (max-width: 360px) { .visitor { padding: 12px; } .visitor .card { padding: 24px 16px; } }

/* ---------- v1.10.0 step 7: 44 × 44 px touch targets on touch screens only (pointer: coarse) ----------
   Component by component (audit §1.4). Mouse / trackpad screens keep the existing sizes (24 px minimum already met).
   Real size (padding / min-height) is used where neighbours sit close; layout grows instead of hit areas overlapping. */
@media (pointer: coarse) {
  /* buttons, segmented controls, sidebar / drawer nav (extends the existing <= 640 px rule to touch tablets) */
  .btn, .seg a, .nav a { min-height: 44px; }
  .btn-icon { min-width: 44px; }
  /* form fields (not checkboxes, radios, sliders, colour or file pickers, which are handled below) */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=hidden]), select { min-height: 44px; }
  /* chips and checkbox labels: the whole label is the target */
  .chip { min-height: 44px; }
  label.check { min-height: 44px; align-items: center; }   /* keeps its existing block-level flex layout */
  .chip span { min-height: 44px; display: inline-flex; align-items: center; }
  /* Help: popular-search chips, category links, contextual Help link */
  .help-chip, .help-cats a, .help-link { min-height: 44px; display: inline-flex; align-items: center; }
  /* links that are headings or navigation */
  .qr-card-title, .help-card-title { display: flex; align-items: center; min-height: 44px; }
  .pub-nav nav a, .brand { min-height: 44px; display: inline-flex; align-items: center; }
  .crumbs a { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .app-foot nav a, .pub-foot nav a { min-width: 44px; justify-content: center; }
  summary { min-height: 44px; display: flex; align-items: center; }
  /* designer controls */
  input[type=range] { min-height: 44px; }
  input[type=color] { min-height: 44px; }
  input[type=file] { min-height: 44px; }
  input[type=file]::file-selector-button { min-height: 44px; }
  /* map zoom buttons (MapLibre's own controls, styled only — the map technology is unchanged) */
  .maplibregl-map .maplibregl-ctrl-group button { width: 44px; height: 44px; }   /* beats MapLibre's own equal-specificity rule, loaded later */
  .chip span { min-width: 44px; justify-content: center; }   /* single-character chips (weekdays 1–7) */
  .pub-nav nav a, .card-head a.small { min-width: 44px; justify-content: center; }
  .help-guide summary { min-height: 44px; }
}

/* ---------- v1.10.0 step 7 follow-up: touch sidebar bottom space (pointer: coarse only) ----------
   At the end of the scrolling sidebar the last link sat flush (0 px) against the sticky "Create QR" footer (61 px).
   Extra space after the last menu group lets every link rest fully clear of the footer; focus scrolling keeps the same
   clearance; the sidebar height follows the visible viewport so mobile browser toolbars never hide its end.
   Sticky footer, link sizes and desktop / mouse layouts are unchanged. */
@media (pointer: coarse) {
  .rail { height: 100vh; height: 100dvh; scroll-padding-bottom: 85px; }
  .rail > nav.nav:last-of-type { padding-bottom: 16px; }
}

/* ---------- Public homepage responsive refinements (scoped to .landing and the public header / footer) ---------- */
/* Public header: compact, script-free menu below 960 px (the inline product nav is hidden there) */
.pub-menu { display: none; position: relative; }
.pub-menu summary { list-style: none; cursor: pointer; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; color: var(--color-ink); }
.pub-menu summary::-webkit-details-marker { display: none; }
.pub-menu summary:focus-visible { outline: 2px solid var(--color-ember-orange); outline-offset: 2px; }
.pub-menu[open] summary { background: var(--color-vellum); }
.pub-menu nav { position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px; display: flex; flex-direction: column; padding: 6px; background: #fff; border: 1px solid var(--color-gridline); border-radius: var(--radius-cards); box-shadow: var(--shadow-xl); z-index: 30; }
.pub-menu nav a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 8px; text-decoration: none; font-weight: 500; color: var(--color-ink); }
.pub-menu nav a:hover, .pub-menu nav a:focus-visible { background: var(--color-vellum); }
.pub-menu .pub-menu-signin { display: none; border-top: 1px solid var(--color-gridline); border-radius: 0 0 8px 8px; }
@media (max-width: 960px) { .pub-menu { display: block; } }
@media (max-width: 640px) { .pub-nav { padding: 0 16px; gap: 12px; } }
@media (max-width: 420px) { .pub-nav .pub-signin { display: none; } .pub-menu .pub-menu-signin { display: flex; } }
/* Public footer: centred, evenly wrapped links on phones */
@media (max-width: 640px) { .pub-foot-inner { flex-direction: column; align-items: center; text-align: center; gap: 4px; } .pub-foot nav { justify-content: center; } }

/* Sections: keep the side margins (.section's padding shorthand removed .wrap's side padding between 641 and ~1248 px) */
.landing .section { padding: clamp(56px, 8vw, 96px) 24px 0; max-width: calc(var(--page-max-width) + 48px); }   /* desktop content width unchanged (1200 px) */
@media (max-width: 640px) { .landing .section { padding-left: 16px; padding-right: 16px; } }
/* Hero: a contained card on the grid instead of a near full-width white panel */
.landing .hero-inner { max-width: 880px; margin: 0 auto; border: 1px solid var(--color-gridline); }
.landing .hero { padding-left: 24px; padding-right: 24px; }   /* .hero's padding shorthand removed .wrap's side padding on tablets */
@media (max-width: 640px) { .landing .hero { padding-left: 16px; padding-right: 16px; } .landing .hero-inner { padding: 24px 16px; } }
/* Features: hairline grid via 1 px gaps — 3 columns / 2 columns (last card spans) / compact icon-left list */
.landing .features { gap: 1px; background: var(--color-gridline); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.landing .feature { border: 0 !important; }
@media (max-width: 699px) {
  .landing .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing .feature:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 479px) {
  .landing .features { grid-template-columns: minmax(0, 1fr); margin-top: 28px; }
  .landing .feature { grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: auto auto; justify-items: start; align-items: start; text-align: left; column-gap: 14px; row-gap: 2px; padding: 16px; }
  .landing .feature .ic { grid-row: 1 / span 2; }
  .landing .feature h3, .landing .feature p { margin: 0; }
}
/* Routing: balanced two columns from 760 px, centred vertically; code fits small screens */
.landing #routing .split-even { align-items: center; }
@media (max-width: 960px) { .landing #routing .split-even { margin-top: 28px !important; } .landing #routing .stack { max-width: 680px; } }   /* stacked below 960 px (code needs the width) */
@media (max-width: 559px) { .landing .code-window pre { font-size: 12px; padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; } }   /* wrap instead of cutting off */
/* How it works: equal, aligned cards — 4 / 2 / 1 columns (the app-wide .card + .card margin offset cards 2–4) */
.landing .steps .card { margin-top: 0; }
@media (max-width: 959px) { .landing .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 559px) { .landing .steps { grid-template-columns: minmax(0, 1fr); margin-top: 28px; } .landing .steps .card { padding: 16px 18px; } }

/* ---------- Sign-in / sign-up / password pages (full-screen auth layout only): header at the top, form centred, links at the bottom ---------- */
/* The previous rules centred header + form + links as one block (desktop) or stacked them at the top (<= 860 px). Auto margins on the
   first and last items share the free height equally, so the form is centred; min-height (not height) keeps short screens and an open
   keyboard scrolling naturally. The footer stays in normal flow (no fixed positioning). */
.auth-main { justify-content: flex-start; padding: 24px 24px calc(20px + env(safe-area-inset-bottom, 0px)); }
.auth-main > .auth-top { margin-bottom: auto; }
.auth-main > .auth-links { margin-top: auto; }
@media (max-width: 860px) { .auth-main { padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)); } }
@media (min-width: 861px) and (max-height: 820px) { .auth-main { padding-top: 16px; padding-bottom: 12px; gap: 12px; } }   /* sign-up fits 800 px tall laptops */
