/* The console of planning.design (the soft-forge-cms language shared with Soft Forge Ads) over tokens.css, the
   variables exported from the design with `ud export --format tokens --tokens-format css`. Dark is
   [data-theme="dark"] on <html>, set by index.js from the system or the reader's choice. */
:root {
  --font: Inter, "Adwaita Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Adwaita Mono", ui-monospace, monospace;
  --topbar: 48px;
  --sidebar: 240px;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 6px rgba(0, 0, 0, .04);
  --shadow-3: 0 7px 22px rgba(0, 0, 0, .18);
  --info: var(--palette-info-600);
  --info-subtle: var(--palette-info-50);
  color-scheme: light;
  font: 15px/22px var(--font);
  color: var(--color-text-primary);
  background: var(--color-bg-canvas);
}
[data-theme="dark"] { color-scheme: dark; --info: var(--palette-info-300); --info-subtle: var(--palette-info-900); --shadow-3: 0 7px 22px rgba(0, 0, 0, .5); }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--color-bg-canvas); }
[hidden] { display: none !important; }
a { color: var(--color-text-link); }
h1 { font-size: 27px; line-height: 34px; margin: 0; letter-spacing: -.25px; }
h2 { font-size: 16px; line-height: 22px; margin: 0 0 12px; }
h3 { font-size: 15px; line-height: 20px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: 13px; }
code { background: var(--color-bg-surface-sunken); padding: 1px 5px; border-radius: var(--radius-sm); }
:focus-visible { outline: var(--size-focus-ring) solid var(--color-border-focus); outline-offset: 2px; }
.icon { display: inline-block; flex: none; width: var(--icon-size, 16px); height: var(--icon-size, 16px); background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.muted { color: var(--color-text-secondary); }
.small { font-size: 13px; line-height: 18px; }
.grow { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* shell */
x-app-shell-view { display: grid; grid-template-rows: var(--topbar) minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--color-bg-surface); border-bottom: 1px solid var(--color-border-default); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: inherit; text-decoration: none; margin-right: 16px; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--color-bg-brand); color: var(--color-text-on-brand); }
.switcher { position: relative; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: var(--size-control-md); padding: 0 12px; border-radius: var(--radius-md);
  background: var(--color-bg-surface-sunken); color: inherit; font: 600 14px/20px var(--font); border: 0; cursor: pointer; white-space: nowrap; }
.pill .muted { font-weight: 400; }
.pill:hover { background: var(--color-bg-surface-hover); }
.icon-button { display: inline-grid; place-items: center; width: var(--size-control-md); height: var(--size-control-md); border-radius: var(--radius-md);
  border: 0; background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.icon-button:hover { background: var(--color-bg-surface-hover); color: var(--color-text-primary); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-full); background: var(--color-bg-brand-subtle);
  color: var(--color-text-brand); font: 600 12px/16px var(--font); border: 0; cursor: pointer; flex: none; }
.kbd { font: 12px/16px var(--font); color: var(--color-text-muted); border: 1px solid var(--color-border-default); border-radius: var(--radius-xs); padding: 0 4px; }
.shell-body { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 0; }
.sidebar { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--color-bg-surface-sunken); border-right: 1px solid var(--color-border-default); overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius-md); color: var(--color-text-secondary);
  text-decoration: none; font: 500 14px/20px var(--font); }
.nav-item:hover { background: var(--color-bg-surface-hover); color: var(--color-text-primary); }
.nav-item[aria-current="page"] { background: var(--color-bg-surface-selected); color: var(--color-text-brand); font-weight: 600; }
.nav-item .count { margin-left: auto; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 4px 0; border-top: 1px solid var(--color-border-default); min-width: 0; }
.sidebar-user .who { min-width: 0; font-size: 13px; line-height: 18px; }
.sidebar-user .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.content { flex: 1; overflow-y: auto; padding: 32px; min-height: 0; }
.content > * { max-width: 1400px; }
.bottom-tabs { display: none; }
.scrim { position: fixed; inset: 0; background: var(--color-bg-overlay); z-index: 30; }

/* page parts */
.page-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header .title { flex: 1; min-width: 240px; }
.page-header .subtitle { color: var(--color-text-secondary); margin-top: 4px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stack { display: grid; gap: 16px; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.split { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); align-items: start; }
.card { background: var(--color-bg-surface); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); padding: 16px; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.stat .label { font-size: 13px; color: var(--color-text-secondary); }
.stat .value { font: 700 27px/34px var(--font); margin: 4px 0; }
.stat .note { font-size: 13px; color: var(--color-text-secondary); }
.facts { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--color-text-secondary); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 48px 16px; color: var(--color-text-secondary); }
.empty .icon { --icon-size: 32px; margin-bottom: 8px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--size-control-md); padding: 0 14px;
  border-radius: var(--radius-md); border: 1px solid transparent; font: 600 14px/20px var(--font); cursor: pointer; white-space: nowrap;
  background: var(--color-bg-surface-sunken); color: var(--color-text-primary); text-decoration: none; }
.btn:hover { background: var(--color-bg-surface-hover); }
.btn.primary { background: var(--color-bg-brand); color: var(--color-text-on-brand); }
.btn.primary:hover { background: var(--color-bg-brand-hover); }
.btn.tertiary { background: transparent; color: var(--color-text-link); }
.btn.tertiary:hover { background: var(--color-bg-brand-subtle); }
.btn.danger { background: var(--color-status-danger); color: var(--color-text-on-status); }
.btn.danger:hover { background: var(--color-status-danger-hover); }
.btn.small { height: var(--size-control-sm); padding: 0 10px; font-size: 13px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; pointer-events: none; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--color-text-link); cursor: pointer; text-decoration: underline; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; }
.field-label { font-weight: 600; font-size: 14px; }
.field-hint { font-size: 13px; color: var(--color-text-secondary); }
.input, select.input, textarea.input { font: inherit; color: inherit; background: var(--color-bg-input); border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md); padding: 6px 12px; min-height: var(--size-control-md); width: 100%; }
.input:focus { outline: var(--size-focus-ring) solid var(--color-border-focus); outline-offset: -1px; border-color: var(--color-border-focus); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--radius-full); font: 600 12px/16px var(--font);
  white-space: nowrap; background: var(--color-bg-surface-sunken); color: var(--color-text-secondary); }
.badge.draft, .badge.warning { background: var(--color-status-warning-subtle); color: var(--color-status-warning-text); }
.badge.in_review, .badge.info { background: var(--info-subtle); color: var(--info); }
.badge.scheduled, .badge.brand { background: var(--color-bg-brand-subtle); color: var(--color-text-brand); }
.badge.published, .badge.success { background: var(--color-status-success-subtle); color: var(--color-status-success-text); }
.badge.archived { background: var(--color-bg-surface-sunken); color: var(--color-text-muted); }
.badge.danger { background: var(--color-status-danger-subtle); color: var(--color-status-danger); }
.badge.count { background: var(--color-bg-inverse); color: var(--color-text-inverse); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; border: 1px solid transparent; }
.alert .icon { margin-top: 3px; }
.alert-info { background: var(--color-bg-brand-subtle); color: var(--color-text-brand); }
.alert-success { background: var(--color-status-success-subtle); color: var(--color-status-success-text); border-color: var(--color-status-success-border); }
.alert-warning { background: var(--color-status-warning-subtle); color: var(--color-status-warning-text); border-color: var(--color-status-warning-border); }
.alert-danger { background: var(--color-status-danger-subtle); color: var(--color-status-danger); }
.alert strong { display: block; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-lg); background: var(--color-bg-surface-sunken); max-width: 100%; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius-md); border: 0; background: transparent;
  color: var(--color-text-secondary); font: 500 14px/20px var(--font); cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--color-bg-surface); color: var(--color-text-primary); font-weight: 600; box-shadow: var(--shadow-1); }

/* tables */
.table-wrap { background: var(--color-bg-surface); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 600 12px/16px var(--font); color: var(--color-text-secondary); background: var(--color-bg-surface-sunken); padding: 12px 16px; white-space: nowrap; }
.table td { padding: 10px 16px; border-top: 1px solid var(--color-border-subtle); height: var(--size-table-row); vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--color-bg-surface-hover); }
.table td.actions { text-align: right; white-space: nowrap; }
.table .indent { display: inline-block; }

/* the editor: Markdown beside the live preview */
.editor-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--color-bg-surface); height: calc(100vh - 290px); min-height: 420px; }
.editor-split > .md-slot, .editor-split > .preview-slot { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.editor-split x-app-markdown-editor-view, .editor-split x-app-preview-pane-view { flex: 1; }
.md-editor { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--color-border-default); }
.md-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--color-border-default); flex-wrap: wrap; }
.md-toolbar .icon-button { width: 30px; height: 30px; }
.md-body { flex: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: 0; }
.md-gutter { margin: 0; padding: 12px 8px 12px 12px; font: 13px/20px var(--mono); color: var(--color-text-muted); text-align: right; overflow: hidden; user-select: none; background: var(--color-bg-surface); }
.md-text { border: 0; outline: none; resize: none; padding: 12px 16px 12px 8px; font: 13px/20px var(--mono); color: var(--color-text-primary); background: var(--color-bg-surface); white-space: pre-wrap; tab-size: 2; min-height: 0; }
.preview-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.preview-bar { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 12px; border-bottom: 1px solid var(--color-border-default); }
.preview-bar .tab { height: 26px; padding: 0 10px; font-size: 13px; }
.preview-stage { flex: 1; display: flex; justify-content: center; background: var(--color-bg-surface-sunken); min-height: 0; }
.preview-stage iframe { width: 100%; height: 100%; border: 0; background: #FFFFFF; transition: width .2s ease-out; }
.preview-pane.full { height: calc(100vh - 290px); min-height: 480px; border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); overflow: hidden; background: var(--color-bg-surface); }
.revisions { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.revision-list { display: grid; gap: 4px; padding: 8px; max-height: calc(100vh - 290px); overflow-y: auto; }
.revision { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--radius-md); cursor: pointer; color: inherit; font: inherit; font-size: 14px; }
.revision[aria-selected="true"] { background: var(--color-bg-surface-selected); }
.diff-lines { margin: 0; font: 13px/20px var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: calc(100vh - 360px); overflow-y: auto; }
.diff-add { display: block; background: var(--color-status-success-subtle); color: var(--color-status-success-text); }
.diff-del { display: block; background: var(--color-status-danger-subtle); color: var(--color-status-danger); text-decoration: line-through; text-decoration-color: rgba(192, 28, 40, .4); }
.diff-fold { display: block; color: var(--color-text-muted); font-style: italic; }
.serp-card { font-family: Arial, sans-serif; }
.serp-title { color: #1A0DAB; font-size: 19px; line-height: 26px; margin: 2px 0; }
[data-theme="dark"] .serp-title { color: #8AB4F8; }
.share-card { border: 1px solid var(--color-border-default); border-radius: var(--radius-md); overflow: hidden; max-width: 420px; }
.share-image { aspect-ratio: 1200 / 630; display: grid; place-items: center; background: var(--color-bg-surface-sunken); }
.share-image img { width: 100%; height: 100%; object-fit: cover; }

/* overlays */
.palette-backdrop { position: fixed; inset: 0; background: var(--color-bg-overlay); z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette { width: 640px; max-width: 100%; background: var(--color-bg-surface-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); overflow: hidden; border: 1px solid var(--color-border-default); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--color-border-default); color: var(--color-text-secondary); }
.palette-input input { flex: 1; height: 52px; border: 0; background: transparent; font: 16px/24px var(--font); color: var(--color-text-primary); outline: none; }
.palette-list { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow-y: auto; }
.palette-group { font: 600 12px/16px var(--font); color: var(--color-text-muted); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .04em; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); cursor: pointer; color: var(--color-text-primary); }
.palette-item[aria-selected="true"] { background: var(--color-bg-surface-selected); color: var(--color-text-brand); }
.palette-item .hint { margin-left: auto; font-size: 13px; color: var(--color-text-muted); }
.menu { position: absolute; z-index: 40; min-width: 220px; background: var(--color-bg-surface-raised); border: 1px solid var(--color-border-default); border-radius: var(--radius-md);
  box-shadow: var(--shadow-3); padding: 6px; display: grid; }
.menu button, .menu a { display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border: 0; background: none; color: var(--color-text-primary);
  font: 14px/20px var(--font); border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; }
.menu button:hover, .menu a:hover, .menu [aria-current="true"] { background: var(--color-bg-surface-hover); }
.menu .separator { height: 1px; background: var(--color-border-default); margin: 4px 0; }
.toast-area { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast-area .alert { box-shadow: var(--shadow-3); }

/* sign-in, sign-up and the wizard: a card on the canvas */
.auth { min-height: 100vh; display: grid; grid-template-rows: var(--topbar) 1fr; grid-template-columns: minmax(0, 1fr); }
.auth-body { display: grid; place-items: center; grid-template-columns: minmax(0, 1fr); padding: 32px 16px; }
.card.auth-card { width: 420px; max-width: 100%; padding: 32px; box-shadow: var(--shadow-1); }
.auth-card h1 { margin: 12px 0 8px; }
.divider { height: 1px; background: var(--color-border-default); margin: 4px 0; }
.app { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card.wide { max-width: 960px; width: 100%; }
.app > .card:not(.wide) { max-width: 640px; width: 100%; padding: 32px; }
.brand { font-weight: 600; color: var(--color-text-brand); font-size: 13px; letter-spacing: .02em; text-transform: uppercase; margin-bottom: 4px; }
.code { font: 13px/20px var(--mono); white-space: pre-wrap; word-break: break-all; background: var(--color-bg-surface-sunken); border-radius: var(--radius-md); padding: 12px; margin: 8px 0 0; }
.wizard-header { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--color-border-default); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; font-size: 13px; color: var(--color-text-secondary); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li.current { color: var(--color-text-primary); font-weight: 600; }
.steps li.done { color: var(--color-status-success-text); }
.step-number { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 9999px; border: 1px solid var(--color-border-default); font-size: 12px; }
.steps li.current .step-number { background: var(--color-bg-brand); border-color: var(--color-bg-brand); color: var(--color-text-on-brand); }
.steps li.done .step-number { background: var(--color-status-success); border-color: var(--color-status-success); color: #FFFFFF; }
.choices { display: grid; gap: 10px; margin: 12px 0 16px; }
.choice { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--color-border-default); border-radius: var(--radius-md); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--color-border-brand); background: var(--color-bg-brand-subtle); }
.choice input { margin-top: 4px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.button { font: inherit; font-weight: 600; padding: 6px 16px; border-radius: var(--radius-md); border: 1px solid transparent; background: var(--color-bg-surface-sunken); color: var(--color-text-primary); cursor: pointer; }
.button.primary { background: var(--color-bg-brand); color: var(--color-text-on-brand); }
.button.primary:hover { background: var(--color-bg-brand-hover); }
.button:disabled { opacity: .5; cursor: default; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.row-end { display: flex; align-items: center; gap: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.panel { border: 1px solid var(--color-border-default); border-radius: var(--radius-md); padding: 16px; }
.list { margin: 0; padding-left: 18px; }

/* phone: the sidebar becomes a drawer behind "More", the bottom tabs carry the four first views */
@media (max-width: 720px) {
  x-app-shell-view { grid-template-rows: var(--topbar) minmax(0, 1fr) 64px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar .wide-only, .logo .wide-only { display: none; }
  .logo { margin-right: 0; }
  .shell-body { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 35; top: 0; bottom: 0; left: 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease-out; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-3); }
  .content { padding: 16px; }
  .bottom-tabs { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--color-bg-surface); border-top: 1px solid var(--color-border-default); }
  .bottom-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--color-text-secondary); text-decoration: none;
    font: 500 12px/16px var(--font); background: none; border: 0; cursor: pointer; min-height: var(--size-touch-target); }
  .bottom-tab[aria-current="page"] { color: var(--color-text-brand); }
  .page-header .actions { width: 100%; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .split { grid-template-columns: 1fr; }
  .editor-split { grid-template-columns: minmax(0, 1fr); height: auto; }
  .editor-split .md-editor { height: 60vh; border-right: 0; }
  .editor-split .preview-slot { display: none; }
  .revisions { grid-template-columns: 1fr; }
  .table .wide-only { display: none; }
  .card.auth-card { padding: 20px; }
  .steps { gap: 12px; }
}

/* dialogs */
dialog.dialog { border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); background: var(--color-bg-surface-raised); color: inherit;
  box-shadow: var(--shadow-3); padding: 0; width: 520px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); }
dialog.dialog.wide { width: 960px; }
dialog.dialog::backdrop { background: var(--color-bg-overlay); }
.dialog-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 0 20px; }
.dialog-head h2 { flex: 1; margin: 0; }
.dialog-body { padding: 16px 20px 20px; overflow-y: auto; }

/* media library and picker */
.media-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.media-layout.with-panel { grid-template-columns: minmax(0, 1fr) 360px; }
.media-panel { position: sticky; top: 0; max-height: calc(100vh - 120px); overflow-y: auto; }
.media-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.media-grid.picker { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 55vh; overflow-y: auto; padding: 2px; }
.media-tile { background: var(--color-bg-surface); border: 1px solid var(--color-border-default); border-radius: var(--radius-md); padding: 8px; cursor: pointer; min-width: 0; }
.media-tile:hover { border-color: var(--color-border-strong, var(--color-border-focus)); }
.media-tile[aria-selected="true"] { border-color: var(--color-border-focus); box-shadow: 0 0 0 2px var(--color-border-focus); }
.media-thumb { aspect-ratio: 16 / 10; display: grid; place-items: center; background: var(--color-bg-surface-sunken); border-radius: var(--radius-sm); overflow: hidden; color: var(--color-text-secondary); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-name { margin-top: 8px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-preview { aspect-ratio: 16 / 10; display: grid; place-items: center; background: var(--color-bg-surface-sunken); border-radius: var(--radius-md); overflow: hidden; color: var(--color-text-secondary); }
.media-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.upload-line { padding: 10px 12px; }
.upload-line progress { width: 100%; height: 6px; margin-top: 6px; accent-color: var(--color-bg-brand); }
.upload-line.failed { border-color: var(--color-status-danger); }
.upload-line.failed .state { color: var(--color-status-danger); }
.drop-hint { margin-top: 16px; display: flex; gap: 6px; align-items: center; }
.drop-overlay { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: var(--color-bg-overlay); color: var(--color-text-inverse); font: 600 18px/24px var(--font); text-align: center; pointer-events: none; }
.picker-foot { display: flex; gap: 8px; align-items: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* menus, forms, users, settings */
.drag-handle { display: inline-flex; color: var(--color-text-muted); cursor: grab; margin-right: 8px; vertical-align: middle; }
.menu-table tr.dragging td { opacity: .5; }
.menu-table tr.drop td { box-shadow: inset 0 2px 0 var(--color-border-focus); }
.menu-table .icon-button { width: 28px; height: 28px; }
.menu-table .icon-button:disabled { opacity: .35; cursor: default; }
.other-menus { display: flex; gap: 8px; flex-wrap: wrap; }
.table tr.unread td { font-weight: 600; }
.table tr.unfold td { background: var(--color-bg-surface-sunken); }
.field-row { padding: 10px 12px; }
.role-select { width: auto; min-height: 30px; padding: 2px 8px; }
.invitation-line { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--color-border-subtle); flex-wrap: wrap; }
.invitation-line:first-of-type { border-top: 0; }
.danger-zone { border-color: var(--color-status-danger-subtle); }
.danger-line { display: flex; align-items: center; gap: 16px; padding: 10px 0; border-top: 1px solid var(--color-border-subtle); flex-wrap: wrap; }
.danger-line:first-of-type { border-top: 0; }
a.tab { text-decoration: none; }

@media (max-width: 720px) {
  .media-layout.with-panel { grid-template-columns: minmax(0, 1fr); }
  .media-panel { position: fixed; z-index: 35; inset: auto 0 64px 0; max-height: 70vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-3); }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dialog.dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

/* appearance: the gallery, the live preview beside the customiser, the build log */
.appearance-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.theme-gallery { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.theme-card.active { border-color: var(--color-border-brand); }
.theme-shot { aspect-ratio: 16 / 10; display: grid; place-items: center; background: var(--color-bg-surface-sunken); border-radius: var(--radius-md); overflow: hidden; color: var(--color-text-secondary); }
.theme-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.appearance-preview .preview-pane.full { height: 560px; min-height: 0; }
.customiser { position: sticky; top: 0; max-height: calc(100vh - 120px); overflow-y: auto; }
.build-live { display: flex; align-items: center; gap: 10px; }
.build-live .dot { width: 10px; height: 10px; border-radius: 9999px; background: var(--color-text-muted); flex: none; }
.build-live[data-state="idle"] .dot { background: var(--color-status-success); }
.build-live[data-state="queued"] .dot, .build-live[data-state="running"] .dot { background: var(--color-bg-brand); animation: pulse 1s ease-in-out infinite alternate; }
.build-live[data-state="problem"] .dot { background: var(--color-status-warning, #E5A50A); }
.build-live[data-state="offline"] .dot { background: var(--color-status-danger); }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .build-live .dot { animation: none !important; } }
.route-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
@media (max-width: 1100px) { .appearance-layout { grid-template-columns: minmax(0, 1fr); } .customiser { position: static; max-height: none; } }

/* the line above the content: acting in a tenant, a plan over its quota (#77, #79) */
.shell-banner { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--color-status-warning-border); background: var(--color-status-warning-subtle); color: var(--color-status-warning-text); }
.shell-banner.info { background: var(--color-status-info-subtle); color: var(--color-status-info-text); border-color: var(--color-status-info-border); }
.shell-banner.danger { background: var(--color-status-danger-subtle); color: var(--color-status-danger-text); border-color: var(--color-status-danger-border); }
.shell-banner .grow { flex: 1; }
.shell-banner[hidden] { display: none; }

/* Billing (board #81): the usage meters and the plan cards */
.meter-bar { height: 6px; margin-top: 6px; border-radius: 3px; background: var(--color-bg-surface-sunken); overflow: hidden; }
.meter-bar > span { display: block; height: 100%; background: var(--color-bg-brand); border-radius: 3px; }
.meter.warning .meter-bar > span { background: var(--color-status-warning); }
.meter.danger .meter-bar > span { background: var(--color-status-danger); }
.plan-cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.plan-card { display: flex; flex-direction: column; }
.plan-card.current { border-color: var(--color-border-focus); }
.plan-card.selected { box-shadow: 0 0 0 2px var(--color-border-focus); }
.plan-features { margin: 8px 0 0; padding-left: 18px; color: var(--color-text-secondary); flex: 1; }
.plan-features li { margin: 2px 0; }
.signup-plans { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.signup-plans label { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--color-border-default); border-radius: var(--radius-md); cursor: pointer; }
.signup-plans label:has(input:checked) { border-color: var(--color-border-focus); background: var(--color-bg-brand-subtle); }
.signup-plans input { position: absolute; opacity: 0; pointer-events: none; }

/* Stats (board #83): the chart in SVG with the tokens, the stat tiles */
.stats-chart { width: 100%; height: auto; display: block; }
.stats-chart .bar { fill: var(--color-bg-brand); opacity: 0.85; }
.stats-chart .bar:hover { opacity: 1; }
.stats-chart .line { fill: none; stroke: var(--color-text-primary); stroke-width: 2; }
.stats-chart .grid { stroke: var(--color-border-default); stroke-width: 1; }
.stats-chart .tick { fill: var(--color-text-muted); font: 11px var(--font); }
.stat-value { font-size: 28px; font-weight: 600; margin-top: 4px; }
.legend { display: inline-block; width: 12px; height: 8px; margin: 0 4px 0 8px; vertical-align: middle; }
.legend.bar { background: var(--color-bg-brand); }
.legend.line { height: 2px; background: var(--color-text-primary); }
.table.compact td { padding: 6px 8px; }
.table .num { text-align: right; white-space: nowrap; }
.table .ellipsis { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Assistant (board #86, planning.design "Assistant — desktop"): the thread, the quick actions, the proposals */
.assistant-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.assistant-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.assistant-aside { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.assistant-aside h2 { margin: 0 0 4px; font-size: 16px; }
.assistant-aside hr { border: 0; border-top: 1px solid var(--color-border-default); margin: 8px 0; width: 100%; }
.quick-actions { gap: 6px; }
.quick-actions .btn.quick { width: 100%; justify-content: center; font-size: 13px; }
.assistant-thread { display: flex; flex-direction: column; gap: 12px; }
.turn { padding: 12px; border-radius: var(--radius-md); }
.turn-user { background: var(--color-bg-brand-subtle); }
.turn-assistant { background: var(--color-bg-surface); border: 1px solid var(--color-border-default); }
.turn-text { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn .thinking { display: inline-flex; align-items: center; gap: 4px; }
.proposal { display: flex; flex-direction: column; gap: 8px; }
.proposal-head { display: flex; align-items: center; gap: 8px; }
.proposal-body .diff-lines { max-height: 420px; }
.proposal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proposal-choices { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.proposal-choices li > span { display: inline-block; }
.proposal-choices li { display: list-item; }
.proposal-choices li .btn { margin-left: 8px; }
.proposal-alt { margin: 0; font-style: italic; }
.assist-menu { position: relative; }
.assist-menu .menu { right: 0; top: calc(100% + 4px); }
.assistant-rules td, .assistant-rules th { text-align: left; }
@media (max-width: 960px) { .assistant-layout { grid-template-columns: 1fr; } .assistant-aside { position: static; } }
.generate-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.generate-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--color-border-default); border-radius: var(--radius-md); }
.generate-list li.done { border-color: var(--color-status-success); }
.generate-list li.failed { border-color: var(--color-status-danger); }
.generate-list li.writing { background: var(--color-bg-brand-subtle); }

/* Settings › Platform (board #149) */
.settings-section .setting { margin-bottom: 14px; }
.settings-section .field-label code { font-weight: 600; }
.settings-section .field-label .badge { margin-left: 4px; }
.setting .field-error { color: var(--color-status-danger-text); font-size: 13px; }
.secret-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.secret-field .input { flex: 1 1 220px; }
.restart-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.restart-banner .grow { flex: 1; }
.node-overrides .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.wizard .key-step code { word-break: break-all; }

/* Platform › Node › Nodes: the map cards and the join steps (board #199, #245) */
.node-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.node-card { display: flex; flex-direction: column; gap: 10px; }
.join-steps { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.join-steps li { flex: 1; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--color-bg-surface-hover); color: var(--color-text-secondary, inherit); text-align: center; }
.join-steps li.done { background: var(--color-status-success-subtle); color: var(--color-status-success-text); }
.join-steps li.current { background: var(--color-status-warning-subtle); color: var(--color-status-warning-text); font-weight: 600; }
.checks { list-style: none; padding: 0; display: grid; gap: 4px; }
@media (max-width: 640px) { .node-cards { grid-template-columns: 1fr; } }

/* Sign in with Soft Forge Payments, the wizard's pairing step (board #200) */
.btn.sso { justify-content: center; }
.pairing-code { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 12px; }
.pairing-code code.big { font-size: 24px; letter-spacing: 2px; font-weight: 600; }
.pairing-card { margin-bottom: 16px; }

/* Platform › HTTP (board #117) */
.http-host, .http-upstream { padding: 8px 0; border-bottom: 1px solid var(--color-border-subtle, var(--color-border)); }
.http-locations { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.http-locations li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.token-once { white-space: pre-wrap; word-break: break-all; user-select: all; }
/* The template store (board #109): the gallery's cards, the detail's demo frame and buy panel */
.template-filters { justify-content: space-between; }
.template-filters .search-field { display: inline-flex; align-items: center; gap: 6px; height: var(--size-control-md, 36px); padding: 0 10px; border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md); background: var(--color-bg-surface); min-width: 220px; }
.template-filters .search-field input { border: 0; outline: 0; background: transparent; font: inherit; color: inherit; width: 100%; }
.template-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.template-card { display: flex; flex-direction: column; padding: 16px; gap: 12px; }
.template-cover { display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: var(--radius-md); overflow: hidden; background: var(--color-bg-surface-sunken); }
.template-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.template-body { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.template-name { font-size: 16px; }
.template-price { font-size: 20px; font-weight: 600; }
.template-price.large { font-size: 28px; }
.template-description { color: var(--color-text-secondary); margin: 4px 0 0; flex: 1; }
.template-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.template-actions .btn.primary { flex: 1; justify-content: center; }
.template-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.template-demo { padding: 0; overflow: hidden; }
.template-demo .demo-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--color-border-default); }
.template-demo iframe { display: block; width: 100%; height: 560px; border: 0; background: #fff; }
.template-shots { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.template-shots img { width: 100%; border-radius: var(--radius-md); display: block; }
.template-changelog, .template-licence { white-space: pre-wrap; margin: 0; max-height: 320px; overflow: auto; }
.template-buy .field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
@media (max-width: 960px) { .template-detail { grid-template-columns: 1fr; } .template-demo iframe { height: 420px; } }
/* The template store's conflicts and updates (board #110) */
.template-conflict { border-top: 1px solid var(--color-border-default); padding: 8px 0; }
.template-conflict summary { cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.template-conflict .diff-lines { max-height: 360px; margin-top: 8px; }
.template-review { border-top: 1px solid var(--color-border-default); padding: 12px 0; display: grid; gap: 8px; }
.template-review:first-of-type { border-top: 0; }
.template-review textarea { width: 100%; }

/* Platform › HTTP › Dashboard (board #128): the frames "Platform HTTP dashboard" of planning.design */
.http-dashboard { display: flex; flex-direction: column; gap: 16px; }
.http-dashboard .grow { flex: 1; }
.http-bar { flex-wrap: wrap; }
.http-alerts { display: flex; flex-direction: column; gap: 8px; }
.http-alerts .alert { align-items: center; }
.http-alerts .alert .small { display: block; color: var(--color-text-secondary); }
.http-kpis { display: grid; gap: 16px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.http-charts { display: grid; gap: 16px; grid-template-columns: 2fr 1fr; }
.http-panels { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.http-tops { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.http-dashboard h3 { margin: 0 0 8px; font: 700 15px/20px var(--font); }
.http-dashboard h4 { margin: 12px 0 6px; font: 600 12px/16px var(--font); color: var(--color-text-secondary); }
.http-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--color-text-secondary); }
.http-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.http-top { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.http-top li { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.http-top li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.http-blocks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.http-blocks li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.http-log { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; }
.http-log-line code { font: 13px/20px var(--font-mono, monospace); white-space: pre; }
.http-log-line.danger code { color: var(--color-status-danger-text); }
.http-log-line.warning code { color: var(--color-status-warning-text); }
.table.compact th, .table.compact td { padding: 8px 8px; }
@media (max-width: 900px) {
  .http-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .http-charts, .http-panels { grid-template-columns: 1fr; }
}

/* Platform (ADR-010 §8, #245): the sidebar's groups, the page's breadcrumb, the panels' tabs (a list on a phone) */
.nav-group { margin: 12px 10px 4px; font: 600 11px/16px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-secondary); }
.nav-group:first-child { margin-top: 0; }
.breadcrumb { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; color: var(--color-text-secondary); }
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:last-of-type, .breadcrumb > span:last-child { color: var(--color-text-primary); font-weight: 600; }
.panel-tabs { margin-bottom: 16px; }
.panel-picker { display: none; margin-bottom: 16px; }
.platform-stats .stat .label { display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.platform-stats .stat .value { display: inline-block; margin-right: 8px; }
.platform-alerts .alert { margin-top: 12px; }
.platform-alerts .alert .grow, .fleet-notes .alert .grow, .node-problem .grow { flex: 1; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--color-text-muted); vertical-align: middle; }
.dot.success { background: var(--color-status-success); } .dot.warning { background: var(--color-status-warning); } .dot.danger { background: var(--color-status-danger); }
.table-foot { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--color-border-default); }
.fleet-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.fleet-toolbar .search { flex: 0 1 320px; } .fleet-toolbar select { width: auto; }
.node-card { cursor: pointer; }
.node-unreachable { text-align: center; padding: 40px 16px; display: grid; justify-items: center; gap: 8px; }
.node-unreachable .actions { display: flex; gap: 8px; justify-content: center; }
.code.terminal { background: var(--color-bg-inverse); color: var(--color-text-inverse); }
.rollout-steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 16px 0; flex-wrap: wrap; }
.rollout-steps li { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 140px; font: 600 12px/16px var(--mono); text-transform: uppercase; }
.rollout-steps .step-number { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); }
.rollout-steps li.done .step-number { background: var(--color-bg-brand); color: var(--color-text-on-brand); border-color: transparent; }
.rollout-steps li.current .step-number { background: var(--color-bg-inverse); color: var(--color-text-inverse); }
.network-map { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.network-region { border: 1px solid var(--color-border-default); border-radius: var(--radius-md); padding: 10px 14px; min-width: 180px; display: grid; gap: 4px; }
.network-node.down { color: var(--color-status-danger-text); } .network-node.degraded { color: var(--color-status-warning-text); }
.network-link { flex: 1; min-width: 60px; border-bottom: 1px solid var(--color-border-strong); padding-bottom: 2px; }
.policy-table .input { min-width: 90px; }
.policy-table .check { display: inline-flex; margin-right: 8px; }
fieldset.field { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
/* Node stage 2 (#246): the explorer's tree and document, the JSON editors */
.explorer { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 0; padding: 0; }
.explorer-tree { border-right: 1px solid var(--color-border-default); padding: 12px 8px; max-height: 70vh; overflow: auto; }
.explorer-main { padding: 16px; min-width: 0; }
.doc-tree { list-style: none; margin: 0; padding: 0; }
.doc-node { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; padding: 5px 8px; border-radius: var(--radius-sm); font: inherit; color: inherit; cursor: pointer; text-align: left; }
.doc-node:hover { background: var(--color-bg-surface-hover); }
.doc-node.current { background: var(--color-bg-surface-selected); font-weight: 600; }
.doc-node span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.json-editor { width: 100%; font: 13px/20px var(--mono); margin-top: 8px; }
.query-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 16px; }
@media (max-width: 720px) {
  .explorer { grid-template-columns: 1fr; }
  .explorer-tree { border-right: 0; border-bottom: 1px solid var(--color-border-default); max-height: 40vh; }
  .query-form { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .panel-tabs { display: none; }
  .panel-picker { display: block; }
  .rollout-steps li { min-width: 100%; }
}

/* the unified setup wizard (board #247; planning.design "Setup / …" frames) */
.app > .card.wizard { max-width: 760px; padding: 40px; }
.wizard-brand { display: flex; align-items: center; gap: 10px; }
.wizard-brand strong { font-size: 16px; }
.wizard .steps { flex-wrap: wrap; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.wizard .steps li + li::before { content: ""; width: 32px; height: 1px; background: var(--color-border-strong, var(--color-border-default)); margin-right: 4px; }
.wizard .step-number { border-radius: var(--radius-sm); }
.wizard .steps li.current .step-number { background: var(--color-bg-inverse); border-color: var(--color-bg-inverse); color: var(--color-text-inverse); }
.wizard .steps li.done .step-number { background: var(--color-bg-brand); border-color: var(--color-bg-brand); }
.wizard .steps li.done { color: var(--color-text-primary); }
.wizard-body { display: grid; gap: 16px; }
.wizard-body h1 { margin: 0; }
.wizard-body h2 { margin: 8px 0 0; font-size: 16px; }
.wizard-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.wizard-foot { text-align: center; margin: 16px 0 0; }
.choices.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 0; }
.field-pair { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.wizard .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-secondary); }
.wizard .pairing-card { display: grid; gap: 12px; background: var(--color-bg-surface-sunken); margin: 0; }
.wizard .pairing-code code.big { font-size: 40px; line-height: 48px; letter-spacing: 3px; font-weight: 700; }
.wizard .pairing-code.expired code.big { color: var(--color-text-muted); }
.wizard .waiting { display: flex; align-items: center; gap: 8px; margin: 0; }
.wizard .key-card { display: grid; gap: 12px; }
.wizard .key-card h2 { margin: 0 0 4px; }
.wizard .key-card p { margin: 0; }
.wizard .key-card > .btn { justify-self: start; }
.wizard .development summary { cursor: pointer; }
.wizard .join-progress { display: grid; gap: 12px; background: var(--color-bg-surface-sunken); }
.wizard .join-progress .steps li + li::before { width: 24px; }
.wizard .https-hosts { display: grid; gap: 8px; margin: 0; }
.wizard .https-hosts legend { font-weight: 600; padding: 0 4px; }
.wizard .https-hosts .badge { margin-left: auto; }
.setup-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.setup-checks li { display: flex; align-items: center; gap: 10px; }
.wizard .ready { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 8px 0; }
.wizard .ready-mark { display: grid; place-items: center; width: 72px; height: 72px; background: var(--color-status-success-subtle); color: var(--color-status-success-text); }
.wizard .ready-actions { flex-wrap: wrap; justify-content: center; }
@media (max-width: 720px) {
  .app > .card.wizard { padding: 20px 16px; }
  .wizard .steps li + li::before { display: none; }
  .wizard .pairing-code code.big { font-size: 28px; line-height: 36px; }
}

/* Platform › HTTP (board #248; frames "HTTP / …" of #241): Routes with the location editor, Upstreams,
   Certificates, Listener, Versions and Import */
.segmented { display: inline-flex; border: 1px solid var(--color-border-strong, var(--color-border-default)); border-radius: var(--radius-sm); overflow: hidden; flex-wrap: wrap; }
.segmented button { font: 600 12px/16px var(--font); letter-spacing: .06em; text-transform: uppercase; padding: 8px 12px; min-height: 32px; border: 0; background: transparent; color: var(--color-text-primary); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--color-border-default); }
.segmented button[aria-pressed="true"], .segmented button[aria-checked="true"] { background: var(--color-bg-inverse); color: var(--color-text-inverse); }
.search-field { display: flex; align-items: center; gap: 8px; position: relative; flex: 1 1 260px; }
.search-field .icon { position: absolute; left: 12px; color: var(--color-text-secondary); }
.search-field .input { width: 100%; padding-left: 36px; }
.routes-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.routes, .versions { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.host-list, .version-list { display: grid; gap: 4px; }
.host-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; text-align: left; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: inherit; font: inherit; cursor: pointer; }
.host-item:hover { background: var(--color-bg-surface-hover); }
.host-item[aria-current="true"] { border-color: var(--color-border-brand); background: var(--color-bg-brand-subtle); }
.host-item .host-name { font-weight: 600; overflow-wrap: anywhere; }
.host-item > .small { grid-column: 1 / -1; }
.host-list > .btn { justify-self: start; margin-top: 8px; }
.host-detail { display: grid; gap: 16px; min-width: 0; }
.host-head { display: flex; align-items: flex-start; gap: 12px; }
.host-head h2 { margin: 0 0 4px; font-size: 20px; }
.host-head p { margin: 0; }
form.dry-run { display: flex; gap: 8px; flex-wrap: wrap; }
.dry-run-card { background: var(--color-bg-surface-sunken); border: 1px solid var(--color-border-default); border-radius: var(--radius-md); padding: 16px; margin: 0; }
.table.locations tr.matched td { background: var(--color-bg-brand-subtle); }
.drawer-layer { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .25); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(600px, 100%); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--color-bg-surface); box-shadow: var(--shadow-3); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 12px; border-bottom: 1px solid var(--color-border-default); }
.drawer-head h2 { margin: 0; font-size: 20px; }
.drawer-body { overflow: auto; padding: 20px 24px; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--color-border-default); }
.header-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.input.inline { display: inline-block; width: auto; min-width: 220px; height: 28px; padding: 2px 8px; }
.input.narrow { width: 80px; }
.input.invalid { border-color: var(--color-status-danger); }
.field-error { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--color-status-danger); }
.btn.danger-outline { background: transparent; color: var(--color-status-danger); border: 1px solid var(--color-status-danger); }
.btn.danger-outline:hover { background: var(--color-status-danger-subtle); }
.field-pair.four { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.upstream-form > .card, .upstream-form > .grid { margin: 0; }
.upstream-form .card h2 { margin: 0 0 4px; font-size: 16px; }
.chips-field { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.chips-field legend { margin-bottom: 6px; }
.chip-check { display: inline-flex; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { font: 600 12px/16px var(--mono); padding: 4px 8px; border-radius: var(--radius-sm); background: var(--color-bg-surface-sunken); color: var(--color-text-secondary); cursor: pointer; }
.chip-check input:checked + span { background: var(--color-bg-brand-subtle); color: var(--color-text-brand); }
.chip-check input:focus-visible + span { outline: var(--size-focus-ring) solid var(--color-border-focus); }
.cert-cards { margin-top: 20px; align-items: start; }
.stack { display: grid; gap: 12px; }
.version-detail { display: grid; gap: 16px; }
.version-detail h2 { margin: 0; font-size: 16px; }
.diff-text { min-height: 160px; max-height: 480px; overflow: auto; }
.choices.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.import-steps { margin-bottom: 16px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.wizard-actions .alert { flex: 1 1 320px; }
@media (max-width: 900px) {
  .routes, .versions { grid-template-columns: minmax(0, 1fr); }
  .host-list, .version-list { grid-auto-flow: row; }
}
@media (max-width: 720px) {
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .header-row { grid-template-columns: 1fr; }
}

/* the plain lists of the dialogs (the DNS plan, #259) */
.plain { list-style: none; padding: 0; margin: 8px 0; }
.plain li { padding: 4px 0; border-bottom: 1px solid var(--color-border-subtle, transparent); }

/* the editor's Metadata tab (cms #345): the page's params as YAML */
.metadata-split { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
textarea.metadata-text { width: 100%; min-height: 420px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 20px; tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
textarea.metadata-text[aria-invalid="true"] { border-color: var(--color-status-danger); }
.metadata-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--color-text-secondary); }
.metadata-status.is-error { color: var(--color-status-danger); }
.metadata-status ul { flex-basis: 100%; margin: 4px 0 0; padding-left: 20px; }
.metadata-example { margin: 8px 0; padding: 12px; background: var(--color-bg-input); border: 1px solid var(--color-border-default); border-radius: var(--radius-md, 6px); white-space: pre; overflow-x: auto; }
@media (max-width: 900px) { .metadata-split { grid-template-columns: 1fr; } }
