:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1a2230;
  --muted: #64708a;
  --border: #dde3ec;
  --primary: #2563eb;
  --primary-solid: #2563eb;   /* background of buttons and badges with white text on them */
  --primary-text: #ffffff;
  --info-text: #1d4ed8;       /* text on --info-bg */
  --danger: #b91c1c;
  --danger-solid: #b91c1c;    /* background of destructive buttons with white text on them */
  --ok: #15803d;
  --warn: #b45309;
  --ok-bg: #dcfce7;
  --warn-bg: #fef3c7;
  --err-bg: #fee2e2;
  --info-bg: #dbeafe;
  --radius: 10px;
  color-scheme: light;
}
/* theme.js sets data-theme on <html>: from the saved choice, else from the OS setting */
:root[data-theme='dark'] {
  --bg: #0f141c;
  --surface: #171e29;
  --surface-2: #1d2532;
  --text: #e4e9f1;
  --muted: #93a0b5;
  --border: #2c3647;
  --primary: #4f8bff;
  --primary-solid: #2563eb;
  --info-text: #8db4ff;
  --danger: #f87171;
  --danger-solid: #b91c1c;
  --ok: #4ade80;
  --warn: #fbbf24;
  --ok-bg: #12381f;
  --warn-bg: #3b2c0a;
  --err-bg: #3f1515;
  --info-bg: #142a4d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
code, pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow: auto; max-height: 360px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 650; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.logo {
  width: 28px; height: 28px; border-radius: 7px; background: var(--primary-solid); color: var(--primary-text);
  display: grid; place-items: center; font-weight: 800;
}
.logo.mark { background: #0b1026; padding: 2px; box-sizing: border-box; }  /* the Data Manager's M mark (as on the sign-in page) */
.logo.mark svg { display: block; width: 100%; height: 100%; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.conn-picker { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.conn-picker select { min-width: 220px; }
.btn.icon { display: inline-grid; place-items: center; padding: 6px 8px; line-height: 0; }
.btn.icon svg { display: none; }
:root[data-theme-choice='auto'] .icon-auto, :root[data-theme-choice='light'] .icon-sun, :root[data-theme-choice='dark'] .icon-moon { display: block; }

.tabs { display: flex; align-items: center; gap: 4px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 6px 0 4px; }
.tab-sep { width: 1px; align-self: stretch; margin: 10px 8px; background: var(--border); }
.tab {
  border: 0; background: none; color: var(--muted); padding: 12px 11px; cursor: pointer; font: inherit; font-weight: 550;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
.panel { display: none; }
.panel.active { display: block; }
.hidden { display: none !important; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.card h3 { font-size: 14px; margin: 16px 0 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.step {
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary-solid); color: var(--primary-text);
  display: inline-grid; place-items: center; font-size: 12px;
}
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 12px 0; }
.grid-form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-form.inner { margin-top: 10px; }
.grid-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: 13px; }
.grid-form label.check { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 8px; }
.span2 { grid-column: 1 / -1; }
details summary { cursor: pointer; color: var(--muted); }
.url-preview { font-size: 12.5px; }
.grid-form .field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-weight: 550; font-size: 13px; }
.grid-form textarea { width: 100%; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
table.data td.dt-lines { white-space: pre-line; vertical-align: top; }
.grouping-box { margin-top: 12px; }
.grouping-table select { min-width: 180px; }
.share-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 16px; max-height: 260px; overflow: auto; margin-top: 10px; }
.share-list label.check { display: flex; align-items: center; gap: 8px; }
.badge.admin { background: var(--info-bg); color: var(--info-text); border-color: transparent; margin-left: 4px; }

.combo { position: relative; }
.combo input { width: 100%; }
.combo-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; margin: 0; padding: 4px; list-style: none;
  max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
}
.combo-menu li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 6px;
  cursor: pointer; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px;
}
.combo-menu li:hover, .combo-menu li.active { background: var(--surface-2); }
.combo-menu li.empty { cursor: default; font-family: inherit; color: var(--muted); }
.combo-menu li.empty:hover { background: none; }
.combo-menu li button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 4px; font: inherit; }
.combo-menu li button:hover { color: var(--danger); background: var(--err-bg); }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 0; border-color: var(--primary); }
input[type=checkbox] { width: 16px; height: 16px; }
.hint { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); font-size: 11px; cursor: help; }

.btn {
  font: inherit; font-weight: 550; padding: 7px 14px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary-solid); border-color: var(--primary-solid); color: var(--primary-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn { white-space: nowrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.table-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--border); border-radius: 8px; margin-top: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
table.data td { white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
table.mapping { margin-top: 8px; }
table.mapping td { padding: 5px 8px; }
table.mapping select, table.mapping input { width: 100%; }
table.mapping td.sample { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.mapping tr.mapped td:first-child { font-weight: 650; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.err { background: var(--err-bg); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info-text); border-color: transparent; }

.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; min-width: 100px; }
.progress > div { height: 100%; background: var(--primary-solid); transition: width .3s; }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; min-width: 110px; }
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 12px; }

.notice { padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.err { background: var(--err-bg); color: var(--danger); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.info { background: var(--info-bg); }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(440px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0,0,0,.15); word-break: break-word; }
.toast.err { border-left: 4px solid var(--danger); }
.toast.ok { border-left: 4px solid var(--ok); }

.grid-form label small { font-weight: 400; color: var(--muted); font-size: 12px; }
textarea { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; resize: vertical; }
.pull-box { margin-top: 12px; padding: 10px 14px; border: 1px dashed var(--border); border-radius: 8px; }
.pull-box summary { color: var(--text); }
.pull-box .pull-box { background: var(--surface); }
.contents { display: contents; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input { flex: 1; min-width: 0; }
.input-row .btn { flex: none; }
.fp-list { list-style: none; margin: 8px 0; padding: 0; max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.fp-list li + li { border-top: 1px solid var(--border); }
.fp-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; background: none; color: var(--text);
  font: inherit; text-align: left; cursor: pointer; }
.fp-item:hover, .fp-item:focus-visible { background: var(--surface-2); }
.fp-ico { flex: none; width: 16px; text-align: center; color: var(--muted); }
.fp-empty { padding: 12px; }
.fp-where code { word-break: break-all; }
.fp-new { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.fp-new input { flex: 1; min-width: 0; }
.fo-note code { word-break: break-all; }
.sync-save { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--border); }
.results-panel { margin-top: 14px; }
.picker { margin-top: 8px; }
.picker .row-between { gap: 10px; }
.picker .pk-filter { flex: 1; }
.picker .table-wrap { max-height: 320px; }
.weekdays { display: flex; gap: 14px; flex-wrap: wrap; }
.weekdays label { flex-direction: row !important; align-items: center; gap: 6px; font-weight: 500; }
.checks { list-style: none; padding: 0; margin: 8px 0 0; }
.checks li { padding: 3px 0; }
.checks li b { display: inline-block; min-width: 18px; }
.ok-text { color: var(--ok); }
.err-text { color: var(--danger); }
.warn-text { color: var(--warn); }

.param-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 6px; }

@media (max-width: 760px) {
  .topbar, .tabs, main { padding-left: 16px; padding-right: 16px; }
  .grid-form, .grid-form.three { grid-template-columns: 1fr; }
  .conn-picker select { min-width: 0; }
  table.mapping thead { display: none; }
  table.mapping tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); padding: 6px 0; }
  table.mapping td { border: 0; }
}

/* ---- run workflow: steps, summary, confirmation dialog ------------------------------------------------------------ */
.page-head { margin-bottom: 12px; }
.page-head h2 { font-size: 18px; margin: 0 0 4px; }
details.how summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.how[open] summary { margin-bottom: 4px; }
details.how p { margin: 4px 0 0; max-width: 90ch; }

.composer { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; margin-bottom: 16px; }
.composer .steps { min-width: 0; }
.composer .steps .step-card { margin-bottom: 12px; }
.step-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px !important; font-size: 15px !important; }
.step-head .muted { font-weight: 400; }
.step-card .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.step-card textarea { width: 100%; }
.step-card .grid-form { margin: 0; }
.step-card .weekdays { margin: 6px 0 8px; }
.step-card .params-block { margin-top: 12px; }
.step-card .grid-form.inner { margin-top: 8px; }
.step .n { display: inline; }
.step-card.done .step { background: var(--ok); }
.step-card.done .step .n { display: none; }
.step-card.done .step::after { content: '\2713'; font-weight: 700; }
#ra-review-hint, #cp-review-hint { margin: 0; }

.summary { position: sticky; top: 12px; margin-bottom: 0; }
.summary h3 { margin-top: 0; }
.summary-tenant { margin-bottom: 8px; }
.tenant-name { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 650; font-size: 13px; background: var(--info-bg); color: var(--info-text); }
.env-tag { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 750; letter-spacing: .05em; }
.env-tag.env-prod { background: var(--err-bg); color: var(--danger); }
.env-tag.env-test { background: var(--ok-bg); color: var(--ok); }
.env-tag.env-other { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.summary-list { margin: 0 0 10px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.summary-list dt { color: var(--muted); }
.summary-list dd { margin: 0; overflow-wrap: anywhere; }
.summary-status { margin: 10px 0; }
.summary .actions .btn { flex: 1 1 auto; }
.btn.solid-danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn.solid-danger:hover { filter: brightness(1.12); border-color: var(--danger-solid); }
.btn.is-busy { position: relative; opacity: .7; cursor: progress; }
.btn.is-busy::after { content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 8px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-busy::after { animation-duration: 3s; } }

body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(8, 12, 20, .55); }
.modal { width: min(580px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface);
  color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: 0 18px 60px rgba(0,0,0,.4); }
.modal h2 { margin: 0 0 12px; font-size: 18px; }
.modal-body { overflow: auto; min-height: 0; }
.modal-require { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-weight: 550; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.confirm-list { margin: 0 0 8px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.confirm-list dt { color: var(--muted); }
.confirm-list dd { margin: 0; overflow-wrap: anywhere; }
.confirm-targets .table-wrap { max-height: 250px; }

@media (max-width: 980px) {
  .composer { grid-template-columns: 1fr; }
  .summary { position: static; }
}

/* ---- tables: filter bar, sortable headers ---------------------------------------------------------------------------- */
.dt-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.dt-bar .dt-filter { flex: 1 1 220px; max-width: 360px; }
.dt-bar + .table-wrap { margin-top: 8px; }
table.sortable th { cursor: pointer; user-select: none; white-space: nowrap; }
table.sortable th:hover { color: var(--text); }
table.sortable th[aria-sort]::after { content: ' \25B2'; font-size: 9px; }
table.sortable th[aria-sort='descending']::after { content: ' \25BC'; }
.progress-line { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.progress-line .progress { flex: 0 1 260px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }

.dt-const { display: none; }
.dt-const-note { margin: 8px 0 0; overflow-wrap: anywhere; }

/* ---- readiness checklist, empty states ------------------------------------------------------------------------------- */
.checklist { list-style: none; margin: 8px 0 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .grow { flex: 1; min-width: 0; }
.checklist .grow small { display: block; color: var(--muted); }
.check-ico { width: 22px; height: 22px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; }
.check-ico.ok { background: var(--ok-bg); color: var(--ok); }
.check-ico.todo { background: var(--warn-bg); color: var(--warn); }
.empty-state { text-align: center; padding: 26px 16px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }
.empty-state h3 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.empty-state p { margin: 0 auto; max-width: 60ch; }
.empty-state .btn { margin-top: 12px; }

@media (max-width: 760px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; padding-top: 6px; padding-bottom: 2px; }
  .tab-sep { display: none; }
  .tab-group { flex-basis: 100%; padding: 6px 0 0; }
}

/* ---- run progress, follow-up ------------------------------------------------------------------------------------------ */
.run-progress { margin-top: 6px; min-width: 150px; }
.run-progress .progress { height: 6px; min-width: 120px; }
.followup { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.checks-inline { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0; }
.checks-inline label { display: inline-flex; align-items: center; gap: 6px; }
.auto-note { margin-right: 8px; }
.card-head h3 { margin: 0; }

/* ---- leave some out ---------------------------------------------------------------------------------------------------- */
.leave-out { margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.leave-out > summary { color: var(--text); font-weight: 550; }
.leave-body { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.leave-body label { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: 13px; }
.leave-body label.check { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 500; }
.leave-body input[type=number] { width: 5.5em; }
.leave-body textarea { width: 100%; }

/* ---- saved audiences --------------------------------------------------------------------------------------------------- */
.audience-box { padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.audience-box label.inline-label { flex-direction: row; align-items: center; gap: 8px; }
.audience-manager { margin-top: 10px; }
.aud-list { list-style: none; margin: 0 0 6px; padding: 0; }
.aud-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); }

/* ---- rollouts ----------------------------------------------------------------------------------------------------------- */
.rollout-box { margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--border); }
.rollout-box label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 550; }
.wave-line { padding: 2px 0; }
.wave-line + .wave-line { border-top: 1px dotted var(--border); }

/* ---- saved exports, configuration ---------------------------------------------------------------------------------------- */
table.kv th { text-align: left; width: 110px; color: var(--muted); font-weight: 600; }
ol.howto { margin: 12px 0 8px; padding-left: 22px; }
ol.howto li { margin: 4px 0; }
hr.thin { border: 0; border-top: 1px dotted var(--border); margin: 6px 0; }
.cfg-section { margin: 14px 0 4px; font-size: 14px; }
tr.cfg-off td { color: var(--muted); }
.grid-form.one { grid-template-columns: 1fr; margin-top: 0; }
.mode-choice { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.mode-choice legend { font-weight: 550; font-size: 13px; padding: 0 4px; }
.grid-form .mode-choice label.check { align-items: flex-start; align-self: stretch; padding-bottom: 0; font-weight: 400; }
.mode-choice input[type=radio] { margin-top: 3px; }
label.inline-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
#library-list td { vertical-align: top; }
.fx-clear-label { margin-top: 4px; font-weight: 400; }

/* ---- signed-in user in the top bar (the sign-in page has its own login.css) -------------------------------------------- */
.user-menu { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }

/* ---- reports ------------------------------------------------------------------------------------------------------------ */
#rep-list td { vertical-align: top; }
.rep-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 10px 0 4px; }
.rep-choice {
  display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px 16px; cursor: pointer; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.rep-choice span { color: var(--muted); font-size: 13px; }
.rep-choice:hover, .rep-choice.active { border-color: var(--primary); }
.rep-choice.active { box-shadow: inset 0 0 0 1px var(--primary); }
.rep-source-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px 12px; margin-bottom: 10px; align-items: end; }
.rep-source-row label { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: 13px; }
.rep-source-row .btn { margin-bottom: 4px; }
.rep-template { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.rep-template h3 { margin: 0 0 2px; }
.rep-template pre { max-height: 160px; margin: 6px 0; }
.rep-query { padding: 8px 0; border-top: 1px dashed var(--border); }
.rep-query .actions { align-items: center; }
.rep-section { border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px; padding: 10px 14px; margin: 10px 0; background: var(--surface-2); }
.rep-section .grid-form { margin: 8px 0 4px; }
.rep-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rep-section-head b { font-size: 13px; }
.rep-cols { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rep-cols button { font: inherit; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; }
.rep-cols button:hover { border-color: var(--primary); }
.rep-sample { margin-top: 6px; }
@media (max-width: 760px) {
  .rep-choices { grid-template-columns: 1fr; }
  .rep-source-row { grid-template-columns: 1fr; }
}
.rep-section.is-heading { border-left-color: var(--muted); background: var(--surface); }
.where-row { display: grid; grid-template-columns: minmax(0, 2fr) 70px minmax(0, 1fr) auto; gap: 6px; margin: 6px 0; }
.rep-more { margin-top: 8px; }
.rep-more .o-where { margin-top: 6px; }

/* ---- guide: how-tos with screenshots (the guide page and the help panel) --------------------------------------------- */
.help-btn { white-space: nowrap; }
.help-row { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.page-head .help-btn { margin-left: 8px; vertical-align: middle; }
.g-intro { color: var(--muted); font-size: 15px; margin: 4px 0 14px; }
.g-howto { margin: 18px 0 26px; }
.g-howto h3 { font-size: 17px; margin: 0 0 10px; }
.g-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.g-step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.g-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--primary-solid); color: var(--primary-text); }
.g-text p { margin: 3px 0 0; line-height: 1.55; }
.g-tip, .g-warn { margin-top: 8px !important; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.g-tip { background: var(--info-bg); }
.g-warn { background: var(--warn-bg); color: var(--warn); }
.g-tip b, .g-warn b { margin-right: 4px; }
.g-shot { display: block; margin-top: 10px; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: zoom-in;
  background: var(--surface-2); max-width: 100%; }
.g-shot img { display: block; max-width: 100%; height: auto; }
.g-shot:hover { border-color: var(--primary); }
.g-lightbox { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; padding: 3vmin; background: rgba(4, 8, 16, .85);
  cursor: zoom-out; }
.g-lightbox.open { display: grid; }
.g-lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.help-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(4, 8, 16, .35); opacity: 0; pointer-events: none; transition: opacity .25s; }
.help-backdrop.open { opacity: 1; pointer-events: auto; }
.help-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(560px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -20px 0 50px rgba(0, 0, 0, .25);
  transform: translateX(105%); transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.help-panel.open { transform: none; }
.hp-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.hp-head > div { flex: 1; }
.hp-head h2 { margin: 0; font-size: 18px; }
.hp-body { overflow-y: auto; padding: 6px 18px 30px; }
@media (prefers-reduced-motion: reduce) { .help-panel, .help-backdrop { transition: none; } }
