/* Prevail VC admin dashboard — minimal, system-fonts, no framework. */
:root {
  --bg:       #f7f7f5;
  --surface:  #ffffff;
  --ink:      #1a1a1a;
  --muted:    #777771;
  --border:   #e3e3e0;
  --accent:   #1454e8;
  --ember:    #c64a26;
  --shadow:   0 1px 2px rgba(0,0,0,0.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; letter-spacing: 0.02em; }
/* Hidden until /me says which site is active, so a tenant never flashes the default site's name. */
.brand--pending { visibility: hidden; }
.site-switcher {
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
}
.nav { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
}
.nav a:hover { background: #ececea; }
.nav a.active { background: var(--ink); color: var(--surface); }
.logout {
  background: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  margin-left: 8px;
}
.logout:hover { color: var(--ember); border-color: var(--ember); }

/* ---------- Layout ---------- */
.main {
  padding: 32px 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}
.view { display: none; }

/* View switching driven entirely by data-view on #app. */
.app[data-view="loading"]  .view-loading  { display: block; }
.app[data-view="login"]    .topbar        { display: none; }
.app[data-view="login"]    .view-login    { display: flex; justify-content: center; align-items: center; min-height: 80vh; }
.app[data-view="leads"]      .view-leads      { display: block; }
.app[data-view="portfolio"]  .view-portfolio  { display: block; }
.app[data-view="transactions"] .view-transactions { display: block; }
.app[data-view="analytics"]  .view-analytics  { display: block; }
.app[data-view="heatmap"]    .view-heatmap    { display: block; }
.app[data-view="settings"]   .view-settings   { display: block; }
.app[data-view="content"]    .view-content    { display: block; }
.app[data-view="realtime"]   .view-realtime   { display: block; }
.app[data-view="errors"]     .view-errors     { display: block; }
.app[data-view="compliance"] .view-compliance { display: block; }
.app[data-view="editor"]     .view-editor     { display: block; }
.app[data-view="seo"]        .view-seo        { display: block; }
.app[data-view="proposals"]  .view-proposals  { display: block; }
.app[data-view="health"]     .view-health     { display: block; }
.app[data-view="command"]    .view-command    { display: block; }

h1 { margin: 0 0 8px; font-weight: 600; font-size: 22px; }
.meta { color: var(--muted); margin: 0 0 24px; font-size: 13px; }
.error { color: var(--ember); margin: 0; font-size: 13px; }

/* ---------- Cards / login ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.login-card { max-width: 360px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0 0 4px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login-card input {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button {
  background: var(--ink);
  color: var(--surface);
  border: 0;
  padding: 10px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
}
.login-card button:hover { background: var(--accent); }

/* ---------- Leads table ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.leads-table { width: 100%; border-collapse: collapse; }
.leads-table th,
.leads-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
.leads-table th { font-weight: 600; background: #f1f1ef; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.leads-table tbody tr:last-child td { border-bottom: 0; }
.leads-table tbody tr:hover { background: #fafaf8; }
.leads-table a { color: var(--ink); text-decoration: none; }
.leads-table a:hover { color: var(--accent); }
.leads-table .sent   { color: var(--accent); font-weight: 600; }
.leads-table .unsent { color: var(--ember);  font-weight: 600; }

.pager { display: flex; gap: 12px; margin-top: 16px; justify-content: flex-end; }
.pager button {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.pager button:hover:not([disabled]) { border-color: var(--accent); color: var(--accent); }
.pager button[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ---------- Settings rows ---------- */
.settings-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.settings-row h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.settings-row .key {
  color: var(--muted);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  margin-bottom: 12px;
}
.settings-row .row-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) {
  .settings-row .row-fields { grid-template-columns: 1fr; }
}
.settings-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.settings-row input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.settings-row input:focus { outline: none; border-color: var(--accent); }
.settings-row .save-status { font-size: 12px; color: var(--muted); margin-top: 10px; min-height: 16px; }
.settings-row .save-status.success { color: var(--accent); }
.settings-row .save-status.error   { color: var(--ember); }

/* ---------- Site mode (coming-soon toggle) ---------- */
.site-mode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.site-mode-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.mode-badge {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}
.mode-badge.mode-on  { background: #fff3ec; color: var(--ember); border: 1px solid #f5d2bf; }
.mode-badge.mode-off { background: #eef5ff; color: var(--accent); border: 1px solid #cfdfff; }

.site-mode-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch-slider {
  position: absolute;
  inset: 0;
  background: #d4d4d0;
  border-radius: 999px;
  transition: background 0.18s ease;
  cursor: pointer;
}
.switch-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-slider { background: var(--ember); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
.switch input:disabled + .switch-slider { opacity: 0.55; cursor: wait; }
.switch input:focus-visible + .switch-slider { outline: 2px solid var(--accent); outline-offset: 2px; }

.switch-label {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  min-width: 64px;
}
.site-mode-status { margin-top: 0; min-height: 0; }

/* Portfolio CRUD UI — view header (title + add button), inline action buttons
   per row, expanding editor panel below the table.
   Shipped 2026-06-19 evening alongside the CSRF-gated mutation endpoints. */
.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.view-head h1 { margin-bottom: 4px; }
.view-head .meta { margin: 0; }

.btn-primary {
  background: var(--ink);
  color: var(--surface);
  border: 1px solid var(--ink);
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--border); }

.btn-link {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}
.btn-link:hover { color: var(--ink); }
.btn-link--danger { color: #b54043; }
.btn-link--danger:hover { color: #862a2d; }
.row-actions { white-space: nowrap; }
.row-actions .btn-link { margin-right: 4px; }

.editor-panel {
  margin-top: 32px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.editor-panel h2 {
  margin: 0 0 16px;
  font-size: 18px;
}
.editor-form { display: flex; flex-direction: column; gap: 20px; }

/* Transactions: map-pin editor (form + clickable footprint map) */
.pin-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
@media (max-width: 960px) { .pin-editor { grid-template-columns: minmax(0, 1fr); } }
.pin-editor__advanced { margin-top: 16px; font-size: 13px; }
.pin-editor__advanced summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }
.editor-grid__full { grid-column: 1 / -1; }
#pinMap {
  width: 100%; height: auto; display: block; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; cursor: crosshair; touch-action: none;
}
#pinMap:focus-visible { outline: 2px solid var(--accent, #2f5bd3); outline-offset: 2px; }
#pinMap .pm-land { fill: var(--surface); stroke: var(--muted); stroke-width: 0.8; stroke-linejoin: round; }
#pinMap .pm-pin { fill: var(--muted); opacity: 0.75; }
#pinMap .pm-label { font-size: 8px; fill: var(--muted); font-family: inherit; pointer-events: none; }
#pinMap .pm-new { fill: #c0392b; stroke: #fff; stroke-width: 1.2; }
#pinMap .pm-new-ring { fill: none; stroke: #c0392b; stroke-width: 1; opacity: 0.45; }
#pinMap .pm-new-label { font-size: 9px; font-weight: 600; fill: #c0392b; font-family: inherit; pointer-events: none; }
.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}
.editor-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.editor-grid label small {
  font-weight: 400;
  font-size: 11px;
  opacity: 0.75;
}
.editor-grid input[type="text"],
.editor-grid input[type="url"],
.editor-grid input[type="number"],
.editor-grid textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
}
.editor-grid input:read-only {
  background: var(--border);
  cursor: not-allowed;
  color: var(--muted);
}
.editor-grid textarea { resize: vertical; min-height: 80px; }
.editor-grid__full { grid-column: 1 / -1; }
.editor-checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  color: var(--ink) !important;
}
.editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
@media (max-width: 720px) {
  .editor-grid { grid-template-columns: 1fr; }
  .view-head { flex-direction: column; align-items: stretch; gap: 12px; }
}

/* Filter tabs above the portfolio table (All / Active / Exited). */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: fit-content;
}
.filter-tab {
  background: transparent;
  border: 0;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  font-weight: 500;
}
.filter-tab:hover { color: var(--ink); }
.filter-tab.active { background: var(--ink); color: var(--surface); }

/* Status badges in the portfolio list. */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-badge--active {
  background: #eef5ff;
  color: var(--accent);
  border: 1px solid #cfdfff;
}
.status-badge--exited {
  background: #f3eefe;
  color: #6a3fb8;
  border: 1px solid #d8c9f5;
  text-transform: none;
  letter-spacing: 0.02em;
}
.status-badge--ok {
  background: #e9f6ee;
  color: #1f6b3a;
  border: 1px solid #c7e5d2;
}
.status-badge--pending {
  background: #f7f7f5;
  color: var(--muted);
  border: 1px solid var(--border);
}

/* Status dropdown in the editor form — match input styling. */
.editor-grid select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
}

/* Exit-details fieldset — appears when status=Exited. */
.editor-fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  margin: 0;
  background: var(--bg);
}
.editor-fieldset legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  padding: 0 8px;
}
.editor-fieldset legend small {
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

/* Change-password form in Settings view. Inline 3-field layout that wraps
   to a stack on narrow screens. */
.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}
.password-form label small {
  font-weight: 400;
  font-size: 11px;
  opacity: 0.7;
  margin-left: 6px;
}
.password-form input[type="password"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.password-form input[type="password"]:focus { outline: none; border-color: var(--accent); }
.password-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
}
@media (max-width: 720px) {
  .password-form { grid-template-columns: 1fr; }
}

/* Analytics view — KPI cards row + a stack of section tables. */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.kpi-card__label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 4px;
}
.kpi-card__value {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.1;
  font-feature-settings: 'tnum' 1;
}
.kpi-card__sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.analytics-h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 28px 0 8px;
  letter-spacing: 0.02em;
}
.analytics-h2 small {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}
.cell-url {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11.5px;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

/* View-head right-side actions cluster (Analytics: Refresh + Reset). */
.view-head__actions { display: flex; gap: 8px; align-items: center; }

.btn-danger {
  background: #b54043;
  color: #fff;
  border: 1px solid #b54043;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-danger:hover { background: #862a2d; border-color: #862a2d; }
.btn-danger:disabled { opacity: 0.55; cursor: wait; }

/* Excluded IPs panel on Analytics. */
.exclude-ips {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.exclude-ips__head h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.exclude-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}
.exclude-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}
.exclude-chip code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--ink);
}
.exclude-chip__x {
  background: transparent;
  border: 0;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
}
.exclude-chip__x:hover { color: #b54043; }
.exclude-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.exclude-form input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  min-width: 220px;
}
.exclude-form input[type="text"]:focus { outline: none; border-color: var(--accent); }

/* Heatmap view — URL/device/window controls + iframe stage + scroll/CTA panels. */
.heatmap-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.heatmap-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.heatmap-controls select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
  min-width: 220px;
}
.heatmap-controls #heatmapUrl { min-width: 380px; max-width: 540px; font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; }

/* The stage holds an iframe + an absolutely-positioned canvas overlay.
   The iframe is sized to its content height after load, so the canvas covers
   the full document and no scroll-sync is required. */
.heatmap-stage {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 auto;
  width: 100%;
  max-width: 1280px;
  min-height: 360px;
}
.heatmap-stage iframe {
  width: 100%;
  border: 0;
  display: block;
  background: #fff;
}
.heatmap-stage canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}
@media (max-width: 900px) { .heatmap-grid { grid-template-columns: 1fr; } }
.heatmap-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.scroll-chart, .cta-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.scroll-chart__row, .cta-bars__row {
  display: grid;
  grid-template-columns: 80px 1fr 60px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.scroll-chart__row code, .cta-bars__row code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  color: var(--muted);
}
.scroll-chart__bar, .cta-bars__bar {
  height: 14px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.scroll-chart__fill {
  height: 100%;
  background: linear-gradient(90deg, #1454e8, #4A8FFF);
}
.cta-bars__fill {
  height: 100%;
  background: linear-gradient(90deg, #C64A26, #E47B43);
}
.scroll-chart__value, .cta-bars__value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 500;
}

/* Diagnostics row above the heatmap stage. Tells the admin at a glance
   whether events are actually flowing — surfaces the per-type count for
   the picked URL. The empty state suggests the fix path. */
.heatmap-diag {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.diag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.diag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}
.diag-chip strong { color: var(--ink); font-weight: 600; font-feature-settings: 'tnum' 1; }
.diag-chip em { color: var(--muted); font-style: normal; }
.diag-chip.error { background: #fff3ec; border-color: #f5d2bf; color: var(--ember); }
.diag-empty {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}
.diag-empty strong { display: block; margin-bottom: 4px; }

/* Layer toggle reuses .filter-tabs styling from the portfolio filter, but
   embedded inside a label so it aligns with the other controls. */
.heatmap-controls .filter-tabs { margin-top: 0; }
.heatmap-controls label > .filter-tabs { display: inline-flex; padding: 2px; }

/* Section attention panel spans both columns of the grid. */
.heatmap-panel--full { grid-column: 1 / -1; }

/* Override the multiply blend on the canvas — for hover gradients with
   blue/green palettes, multiply mutes the colors against the iframe's
   light backgrounds. Normal blend lets the gradient opacity control
   visibility directly. */
.heatmap-stage canvas { mix-blend-mode: normal; }

/* ---------- Compliance view ---------- */
.compliance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.compliance-toggle { margin: 8px 0 12px; }
.compliance-findings { display: flex; flex-direction: column; gap: 14px; }
.compliance-finding {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 14px 16px;
}
.compliance-finding.tier-1 { border-left-color: #b03338; }
.compliance-finding.tier-2 { border-left-color: #e0a13f; }
.compliance-finding.tier-3 { border-left-color: #4A8FFF; }
.compliance-finding__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.compliance-finding__title { font-weight: 600; font-size: 14px; color: var(--ink); }
.compliance-finding__page  { margin-left: auto; font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }
.compliance-finding__cite  { margin-top: 4px; font-size: 11px; color: var(--muted); font-family: 'SF Mono', Menlo, Consolas, monospace; }
.compliance-finding__desc  { margin: 8px 0 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.compliance-finding__hit {
  display: grid;
  grid-template-columns: 80px 1fr 120px;
  gap: 12px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-top: 6px;
  align-items: center;
}
.compliance-finding__hit.acked { opacity: 0.5; }
.compliance-finding__line    { font-size: 11px; color: var(--muted); font-family: 'SF Mono', Menlo, Consolas, monospace; }
.compliance-finding__snippet { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
.compliance-tier {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.compliance-tier--hard     { background: #b03338; color: #fff; }
.compliance-tier--required { background: #e0a13f; color: #1a1a1a; }
.compliance-tier--review   { background: #4A8FFF22; color: #4A8FFF; border: 1px solid #4A8FFF55; }
.compliance-tier--ok       { background: #2f9e4422; color: #2f9e44; border: 1px solid #2f9e4455; }
.compliance-tier--fail     { background: #b0333822; color: #b03338; border: 1px solid #b0333855; }

/* ---------- Content view ---------- */
.content-add-form { display: flex; flex-direction: column; gap: 12px; }
.content-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 180px;
  gap: 12px;
}
@media (max-width: 720px) {
  .content-add-grid { grid-template-columns: 1fr; }
}
.content-add-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.content-add-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
}
.content-add-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.content-entries { display: flex; flex-direction: column; gap: 18px; margin-top: 16px; }
.content-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.content-group h3 {
  margin: 0 0 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.content-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.content-row:first-of-type { border-top: none; }
@media (max-width: 720px) {
  .content-row { grid-template-columns: 1fr; }
}
.content-row__key {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.content-row__key code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  word-break: break-all;
}
.content-row__updated { font-size: 11px; color: var(--muted); }
.content-row__value { display: flex; flex-direction: column; gap: 8px; }
.content-row__value textarea,
.content-row__value input,
.content-row__value select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
.content-row__value textarea { resize: vertical; min-height: 60px; }
.content-row__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Realtime view ---------- */
.realtime-status {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.realtime-status[data-state="live"]    { color: #2f9e44; border-color: #2f9e4455; }
.realtime-status[data-state="pending"] { color: #e0a13f; border-color: #e0a13f55; }
.realtime-status[data-state="off"]     { color: var(--muted); }
.nav-badge--live {
  background: #2f9e44;
}
.realtime-stream {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  min-height: 300px;
  max-height: 70vh;
  overflow-y: auto;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
}
.realtime-row {
  display: grid;
  grid-template-columns: 90px 130px 1fr 1fr;
  gap: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.realtime-row:last-child { border-bottom: none; }
.realtime-row__ts   { color: var(--muted); }
.realtime-row__type { color: var(--accent, #4A8FFF); font-weight: 600; }
.realtime-row__url  { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.realtime-row__meta { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Errors view ---------- */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  background: var(--ember, #b03338);
  color: #fff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}
/* Honor the HTML `hidden` attribute even though .nav-badge sets display.
   And hide an empty badge as belt-and-suspenders so a stale render that
   forgets to set hidden doesn't surface a bare red dot. */
.nav-badge[hidden],
.nav-badge:empty { display: none !important; }
.errors-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.errors-toggle input { margin: 0; }
/* The display set on these two beats the browser's own rule for the hidden attribute, so the
   toggles stayed visible for people who may not use them and the Authenticator code box was
   always shown. Say it again here. */
.errors-toggle[hidden],
.login-card label[hidden],
.filter-tabs[hidden] { display: none; }

/* ---------- Retention panel (Analytics view) ---------- */
.retention-row {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.retention-row__head h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.retention-row__head .meta { margin: 0; }
.retention-row__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.retention-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.retention-stat__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.retention-stat__value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}
.retention-row__last {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}
.retention-row__actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ---------- Analytics grouping ---------- */
/* Tab strip shared by Overview, Heatmap and Realtime. It shows on those three views only. The
   script sets [hidden] when the caller can reach fewer than two of them. */
.section-tabs { display: none; margin-bottom: 20px; }
.app[data-view="analytics"] .section-tabs:not([hidden]),
.app[data-view="heatmap"]   .section-tabs:not([hidden]),
.app[data-view="realtime"]  .section-tabs:not([hidden]) { display: flex; }
.filter-tabs a.filter-tab { display: inline-flex; align-items: center; text-decoration: none; }
.filter-tabs a.filter-tab[hidden] { display: none; }

.analytics-h2--first { margin-top: 0; }
.analytics-h3 { font-size: 13px; font-weight: 600; margin: 20px 0 6px; }
.analytics-h3 small { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
.analytics-note { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.heatmap-grid--summary { margin-top: 0; }

.analytics-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.analytics-devices .cta-bars { margin-top: 0; }
.analytics-devices .cta-bars__row { grid-template-columns: 80px 1fr 120px; }

/* The two closed groups at the foot of the page (Extra data, Setup and maintenance). */
.analytics-extra + .analytics-extra { margin-top: 12px; }
.analytics-extra > .meta { margin: 8px 0 16px; }
.analytics-extra .retention-row { margin-top: 0; }
.analytics-danger {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid #e6c4c5;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.analytics-danger h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.analytics-danger .meta { margin: 0; }
/* These set a display, which beats the browser rule for the hidden attribute. */
.analytics-danger[hidden],
.retention-row[hidden],
.exclude-ips[hidden] { display: none; }

/* Raw per-type event counts on the Heatmap page sit in a closed group. */
.diag-details > summary { cursor: pointer; font-size: 12px; color: var(--muted); user-select: none; }
.diag-details[open] > summary { margin-bottom: 10px; }
.diag-row--warn { margin-bottom: 8px; }

/* ===== Visual Editor view ===== */
.editor-stage {
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  min-height: 600px;
  display: flex;
}
.editor-stage iframe {
  width: 100%;
  height: 78vh;
  border: 0;
  background: #fff;
  display: block;
}

/* ===== Content view (layman-friendly card list) ===== */
.content-empty-state {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 36px 28px;
  text-align: center;
  background: var(--bg);
  margin: 8px 0 20px;
}
.content-empty-state h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}
.content-empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.content-group {
  margin-bottom: 28px;
}
.content-group__head {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 14px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.content-group__count {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.content-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.content-card__summary {
  display: grid;
  grid-template-columns: 180px 1fr 110px 130px;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
}
.content-card__what {
  display: flex; align-items: center; gap: 8px;
}
.content-card__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.content-card__type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.content-card__type--text  { background: rgba(74,108,255,0.12); color: #6f8aff; }
.content-card__type--html  { background: rgba(255,196,37,0.16); color: #d99800; }
.content-card__type--image { background: rgba(74,222,128,0.14); color: #2fa356; }
.content-card__preview {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.content-card__preview-img {
  width: 28px; height: 28px;
  object-fit: contain;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.content-card__preview-url {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.content-card__when {
  font-size: 12px;
  color: var(--muted);
}
.content-card__actions {
  display: flex; gap: 10px; justify-content: flex-end;
}
.content-card__editor {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.content-card__textarea,
.content-card__input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  margin-top: 12px;
  resize: vertical;
}
.content-card__textarea:focus,
.content-card__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27,117,188,0.18);
}
.content-card__editor-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
}
.content-advanced {
  margin-top: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--bg);
}
.content-advanced > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  user-select: none;
  padding: 4px 0;
}
.content-advanced[open] > summary {
  margin-bottom: 8px;
  color: var(--ink);
}
@media (max-width: 800px) {
  .content-card__summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .content-card__actions {
    justify-content: flex-start;
  }
}

/* ===== Home page stats editor ===== */
.home-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 4px;
}
.home-stats-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.home-stats-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.home-stats-card__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.home-stats-card__input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
}
.home-stats-card__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27,117,188,0.18);
}
.home-stats-card__desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
@media (max-width: 720px) {
  .home-stats-grid { grid-template-columns: 1fr; }
}

/* ---------- Modal + toast ---------- */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 20, 18, 0.45);
  animation: modal-fade-in 120ms ease-out;
}
.modal-root[hidden] { display: none; }

@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.08);
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  animation: modal-pop-in 140ms ease-out;
}
.modal__head {
  padding: 20px 24px 4px;
}
.modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}
.modal__body {
  padding: 8px 24px 4px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}
.modal__body p:first-child { margin-top: 0; }
.modal__body p:last-child  { margin-bottom: 0; }
.modal__fields {
  padding: 12px 24px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal__field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.modal__field input,
.modal__field textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
}
.modal__field input:focus,
.modal__field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 84, 232, 0.18);
}
.modal__field-hint { font-size: 12px; color: var(--muted); }
.modal__field-error { font-size: 12px; color: var(--ember); }
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 20px 24px;
}

.toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 48px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.45;
  min-width: 220px;
  max-width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toast-in 180ms ease-out;
}
.toast--success { background: #1f6b3a; }
.toast--error   { background: #8a2a2c; }
.toast--info    { background: var(--ink); }
.toast--leaving { animation: toast-out 180ms ease-in forwards; }
.toast__msg { flex: 1; }
.toast__close {
  background: none;
  border: 0;
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-top: 1px;
}
.toast__close:hover { color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 600px) {
  .toast-root { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

/* ---------- SEO / PageSpeed ---------- */

.seo-keynotice {
  background: #fff7e6;
  border: 1px solid #f0d9a6;
  color: #6b4d18;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.seo-keynotice code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.seo-keynotice a { color: var(--accent); }

.seo-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.seo-summary__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.seo-summary__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.seo-summary__value {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.seo-summary__sub {
  font-size: 12px;
  color: var(--muted);
}

.seo-url-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seo-url-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.seo-url-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.seo-url-card__path {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  word-break: break-all;
}
.seo-url-card__path a {
  color: inherit;
  text-decoration: none;
}
.seo-url-card__path a:hover { color: var(--accent); }
.seo-url-card__head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.seo-strategies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) {
  .seo-strategies { grid-template-columns: 1fr; }
}

.seo-strategy {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  background: var(--bg);
}
.seo-strategy__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.seo-strategy__scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.seo-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.seo-score__num {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.seo-score__name {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.seo-score--good   .seo-score__num { color: #1f6b3a; }
.seo-score--mid    .seo-score__num { color: #b58108; }
.seo-score--bad    .seo-score__num { color: #b54043; }
.seo-score--null   .seo-score__num { color: var(--muted); font-weight: 500; }
.seo-score--good { border-color: #c7e5d2; background: #f1faf4; }
.seo-score--mid  { border-color: #ecdaa8; background: #fdf6e3; }
.seo-score--bad  { border-color: #ecc6c8; background: #fbeeef; }

.seo-vitals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 12px;
}
.seo-vital {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.seo-vital__name {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.seo-vital__value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.seo-strategy__error {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ember);
  padding: 8px 10px;
  background: #fbeeef;
  border: 1px solid #ecc6c8;
  border-radius: 4px;
}

.seo-url-card__fetched {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}
.seo-url-card__fetched--never { font-style: italic; }

/* ---------- Users (Settings → admin-only sub-panel) ---------- */
.users-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.user-card--disabled { opacity: 0.55; }
.user-card__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.user-card__name strong { font-size: 15px; }
.user-card__handle {
  font-size: 12px; color: var(--muted); margin-left: 8px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}
.user-card__role {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  border: 1px solid var(--border);
}
.user-card__role--admin       { background: #eef5ff; color: var(--accent); border-color: #cfdfff; }
.user-card__role--reviewer    { background: #f3e9ff; color: #5b21b6; border-color: #ddc9fb; }
.user-card__role--contributor { background: #f5f5f3; color: var(--muted); }
.user-card__role--disabled    { background: #fbeeef; color: var(--ember); border-color: #ecc6c8; }
.user-card__role--mfa         { background: #ecfbf3; color: #058150; border-color: #c4ebd6; }
.user-card__meta {
  font-size: 12px; color: var(--muted); margin: 6px 0 12px;
}
/* Per-site module toggles (Settings > Sites) */
.site-modules__label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); margin: 4px 0 8px;
}
.site-modules {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px 14px; margin-bottom: 12px;
}
.site-module {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink); cursor: pointer;
}
.site-module input { cursor: pointer; }
.site-modules__actions { display: flex; align-items: center; gap: 12px; }
.site-modules__actions .save-status { margin-top: 0; }
.ac-routing { margin-top: 16px; }
.ac-routing__fields { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.ac-routing__field { display: flex; align-items: center; gap: 6px; }
.ac-routing__field input { width: 9ch; }
.lead-path__finding { margin-top: 4px; }
.lead-path__finding--error { color: #b3261e; }
.lead-path__finding--warn { color: #8a5a00; }
.user-card__actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.user-card__actions select {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); font-size: 13px;
}
.user-add-form { background: var(--surface); }
.user-add-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px; margin: 12px 0 16px;
}
.user-add-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.user-add-grid label small { font-size: 11px; color: var(--muted); font-weight: normal; }
.user-add-grid input, .user-add-grid select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); font-size: 14px; color: var(--ink);
}
.user-add-grid input:focus, .user-add-grid select:focus { outline: none; border-color: var(--accent); }
.user-add-grid__full { grid-column: 1 / -1; }
.user-add-actions { display: flex; align-items: center; gap: 12px; }

/* ---------- Proposed edits ---------- */
.proposals-list { display: flex; flex-direction: column; gap: 14px; }
.proposals-empty {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 36px 24px; text-align: center; color: var(--muted);
}
.proposals-empty h3 { margin: 0 0 8px; color: var(--ink); }
.proposal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.proposal-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.proposal-card__title { flex: 1; font-size: 14px; }
.proposal-card__badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  border: 1px solid var(--border);
}
.proposal-card__badge--pending    { background: #fff7e6; color: #b45309; border-color: #fbe2b0; }
.proposal-card__badge--approved   { background: #ecfbf3; color: #058150; border-color: #c4ebd6; }
.proposal-card__badge--rejected   { background: #fbeeef; color: var(--ember); border-color: #ecc6c8; }
.proposal-card__badge--withdrawn  { background: #f5f5f3; color: var(--muted); }
.proposal-card__badge--superseded { background: #f5f5f3; color: var(--muted); font-style: italic; }
.proposal-card__meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.proposal-card__note {
  font-size: 13px; color: var(--ink); margin-bottom: 12px;
  padding: 8px 12px; background: var(--bg); border-left: 3px solid var(--border); border-radius: 0 4px 4px 0;
}
.proposal-diff {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 12px 0;
}
@media (max-width: 760px) { .proposal-diff { grid-template-columns: 1fr; } }
.proposal-diff__side {
  border: 1px solid var(--border); border-radius: 4px; overflow: hidden;
  background: var(--bg);
}
.proposal-diff__side--proposed { border-color: #cfdfff; }
.proposal-diff__h {
  font-size: 11px; padding: 6px 10px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
  font-weight: 600;
}
.proposal-diff__side--proposed .proposal-diff__h { color: var(--accent); background: #f6f9ff; border-bottom-color: #cfdfff; }
.proposal-diff__body {
  padding: 10px 12px; max-height: 280px; overflow: auto;
}
.proposal-diff__body--empty { color: var(--muted); font-style: italic; padding: 14px 12px; }
.proposal-diff__pre {
  margin: 0; font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px; white-space: pre-wrap; word-break: break-word; color: var(--ink);
}
.proposal-diff__img {
  max-width: 100%; max-height: 200px; display: block;
  border: 1px solid var(--border); border-radius: 4px;
}
.proposal-diff__url {
  font-size: 11px; color: var(--muted); margin-top: 6px;
  font-family: 'SF Mono', Menlo, Consolas, monospace; word-break: break-all;
}
.proposal-card__actions {
  display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap;
}
.proposal-card__closed {
  font-size: 12px; color: var(--muted); margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
}

/* ---------- Bulk edit (Word round-trip) ---------- */
.bulk-edit { display: flex; flex-direction: column; gap: 24px; }
.bulk-edit__intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.bulk-edit__intro h2 { font-size: 16px; margin: 0 0 8px; }
.bulk-edit__intro .meta { margin: 0 0 12px; }
.bulk-edit__rules {
  margin: 0; padding-left: 20px;
  color: var(--muted); font-size: 13px; line-height: 1.6;
}
.bulk-edit__rules code {
  background: var(--bg); padding: 1px 5px; border-radius: 3px;
  font-size: 12px;
}

.bulk-edit__step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.bulk-edit__step h3 {
  margin: 0 0 14px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.bulk-edit__summary {
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--ink);
}
.bulk-edit__summary strong { color: var(--accent); }
.bulk-edit__diff-actions {
  display: flex; gap: 8px; margin-bottom: 12px;
}

.bulk-edit__diff {
  display: flex; flex-direction: column; gap: 12px;
  max-height: 600px; overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg);
}

.bulk-diff__row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.bulk-diff__head {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 10px;
}
.bulk-diff__head input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
}
.bulk-diff__tag {
  display: inline-block;
  background: var(--ink); color: var(--surface);
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 3px;
  letter-spacing: 0.04em;
}
.bulk-diff__page {
  font-weight: 500;
  color: var(--ink);
}
.bulk-diff__key {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bulk-diff__pill {
  font-size: 10px;
  color: var(--ember);
  background: rgba(198, 74, 38, 0.08);
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bulk-diff__cells {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bulk-diff__cell {
  background: var(--bg);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.bulk-diff__cell h4 {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.bulk-diff__cell--before { border-left: 3px solid #d4a017; }
.bulk-diff__cell--after  { border-left: 3px solid var(--accent); }
.bulk-diff__cell div { word-wrap: break-word; }
@media (max-width: 900px) {
  .bulk-diff__cells { grid-template-columns: 1fr; }
}

/* =========================================================
   Press Desk (press-desk.js). For the press owner and every admin.
   ========================================================= */
.app[data-view="press"] .view-press { display: block; }
.app[data-view="email"]      .view-email      { display: block; }
.pd-back { margin: 0 0 8px; font-size: 13px; }
.pd-back a, .pd-sub a, .pd-note a { color: var(--accent); }
.pd-h1 { overflow-wrap: anywhere; }
.pd-sub { margin: 28px 0 8px; font-size: 15px; }
.pd-link { text-decoration: none; display: inline-block; }
.pd-title { color: var(--ink); font-weight: 600; text-decoration: none; }
.pd-title:hover { color: var(--accent); }
.pd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.view-head .pd-actions { margin-top: 0; }
.pd-note { background: #fff8e1; border: 1px solid #ecd9a0; border-radius: 6px; padding: 8px 12px; font-size: 13px; margin: 0 0 16px; }
.pd-warn { border-color: #e0b4a6; background: #fdf3ef; }
.pd-fact-line { font-size: 16px; line-height: 1.5; margin: 0 0 8px; }
.pd-chip { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 10px; background: #ececea; color: #55554f; }
.pd-chip--candidate { background: #e6eefc; color: #1a4fb8; }
.pd-chip--held { background: #fff1cf; color: #805c00; }
.pd-chip--rejected { background: #f3dcdc; color: #862a2d; }
.pd-chip--draft { background: #ececea; color: #55554f; }
.pd-chip--audited { background: #dff3e6; color: #1f6b3a; }
.pd-chip--published { background: #1f6b3a; color: #fff; }
.pd-chip--unpublished { background: #f3dcdc; color: #862a2d; }
.pd-chip--owner { background: #fff1cf; color: #805c00; }
.pd-chip--intel { background: #e6eefc; color: #1a4fb8; }
.pd-chip--tier1, .pd-chip--tier2 { background: #f3dcdc; color: #862a2d; }
.pd-chip--tier3 { background: #fff1cf; color: #805c00; }
.pd-chip--audit-clear { background: #dff3e6; color: #1f6b3a; }
.pd-chip--audit-review { background: #fff1cf; color: #805c00; }
.pd-chip--audit-blocked { background: #f3dcdc; color: #862a2d; }
.pd-form__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 8px 0; }
.pd-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.pd-field input, .pd-field select, .pd-field textarea, .pd-ack input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); box-sizing: border-box;
}
.pd-field input:focus, .pd-field select:focus, .pd-field textarea:focus, .pd-ack input:focus { outline: none; border-color: var(--accent); }
.pd-field input:disabled, .pd-field textarea:disabled { background: #f1f1ef; color: var(--muted); }
.pd-textarea { resize: vertical; line-height: 1.5; }
.pd-field small { color: var(--muted); }
.pd-fact { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 0 0 12px; background: var(--surface); }
.pd-fact__head { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; }
.pd-fact__head .btn-ghost { margin-left: auto; padding: 4px 10px; font-size: 12px; }
.pd-sources-pick { display: flex; flex-wrap: wrap; gap: 12px; }
.pd-check-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink); flex-direction: row; }
.pd-passage { margin: 6px 0 0; padding: 4px 10px; border-left: 3px solid var(--border); color: var(--muted); font-size: 13px; }
.pd-sources td, .pd-queue td { vertical-align: top; }
.pd-sources td:nth-child(3) a { overflow-wrap: anywhere; color: var(--accent); }
.pd-check { border-left: 4px solid var(--border); padding: 6px 12px; margin: 0 0 8px; background: var(--surface); border-radius: 0 6px 6px 0; }
.pd-check--ok { border-left-color: #1f6b3a; }
.pd-check--fail { border-left-color: #862a2d; background: #fdf3f3; }
.pd-check--info { border-left-color: #1a4fb8; }
.pd-check__title { font-weight: 600; font-size: 14px; }
.pd-check__items { margin: 6px 0 0 18px; padding: 0; font-size: 13px; }
.pd-mark { display: inline-block; width: 18px; text-align: center; font-weight: 700; }
.pd-finding { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 0 0 10px; background: var(--surface); }
.pd-finding--tier1, .pd-finding--tier2 { border-left: 4px solid #862a2d; }
.pd-finding--tier3 { border-left: 4px solid #d4a017; }
.pd-snippet { background: var(--bg); border-radius: 4px; padding: 8px 10px; font-size: 13px; line-height: 1.5; margin: 8px 0; overflow-wrap: anywhere; }
.pd-ack { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.pd-accepted { color: #1f6b3a; font-size: 13px; margin: 8px 0 0; }
.pd-blockers { background: #fdf3f3; border: 1px solid #e8c4c4; border-radius: 6px; padding: 8px 12px; margin: 10px 0; font-size: 13px; }
.pd-blockers ul { margin: 4px 0 0 18px; padding: 0; }
.pd-audit-head { margin: 0 0 8px; }
.pd-frame { width: 100%; height: 760px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.pd-body { margin-top: 4px; }
.pd-hero__current { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; margin: 0 0 12px; }
.pd-hero__thumb { width: 240px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); }
.pd-hero__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 12px 0; }
.pd-hero__card { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.pd-hero__card .pd-hero__thumb { width: 100%; }
.pd-hero__card--best { border-color: #1f6b3a; }
.pd-hero__head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pd-hero__card .meta, .pd-hero__current .meta { margin: 0; overflow-wrap: anywhere; }
.pd-hero__rights { display: flex; flex-direction: column; gap: 8px; }
.pd-hero__rights .pd-field { margin: 0; }
.pd-hero__page { color: var(--accent); font-size: 13px; }
.pd-hero__manual { margin-top: 16px; }
.pd-hero__need { margin: 0; }
.pd-hero__need[hidden] { display: none; }
/* A disabled button on the Press Desk is "not ready yet", so it shows the not-allowed cursor. The wait cursor (the spinning
   loader) is only for a button that is waiting for the server. It carries data-busy. */
.view-press .btn-primary:disabled, .view-press .btn-danger:disabled { cursor: not-allowed; }
.view-press .btn-primary[data-busy]:disabled, .view-press .btn-danger[data-busy]:disabled { cursor: wait; }
/* The one-off press scan on the queue: the button on one line, then the text that says when the scan runs. */
.pd-scan { flex-wrap: nowrap; align-items: center; margin: 0 0 16px; }
.pd-scan .btn-primary { flex: none; white-space: nowrap; }
.pd-scan .meta { flex: 1; min-width: 0; margin: 0; }
/* ".settings-row label" (above) stacks a label in a column. A checkbox with its text stays in a row. */
.settings-row .pd-check-inline { flex-direction: row; font-size: 13px; color: var(--ink); gap: 6px; }
.pd-tabs { margin: 16px 0; }
.pd-facts { margin-top: 8px; }
.pd-history td, .pd-versions td, .pd-holdings td { font-size: 13px; }
=======
/* ---------- Command Center (platform-host admins) ---------- */
.cmd-summary { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.cmd-summary.is-ok  { color: var(--accent); }
.cmd-summary.is-bad { color: var(--ember); }
.cmd-h2 { font-size: 15px; font-weight: 600; margin: 28px 0 8px; }
.cmd-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.cmd-pill--ok   { color: var(--accent); }
.cmd-pill--bad  { color: var(--ember); }
.cmd-pill--idle { color: var(--muted); }
.view-command .save-status.success { color: var(--accent); }
.view-command .save-status.error   { color: var(--ember); }
.view-seo .save-status.success { color: var(--accent); }
.view-seo .save-status.error { color: var(--ember); }
.presence-muted { opacity: 0.55; }
.cmd-alerts { max-width: 560px; display: flex; flex-direction: column; gap: 10px; }
.cmd-alerts .meta { margin: 0; }
.cmd-alerts .meta.is-bad { color: var(--ember); }
.cmd-label { font-size: 13px; color: var(--muted); }
.cmd-alerts textarea {
  font: inherit; font-size: 13px; padding: 8px 10px; resize: vertical;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: inherit;
}
.cmd-cell-url { max-width: 320px; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.site-monitor { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 12px 0 4px; }

/* ---------- Email Studio (email-studio.js) ---------- */
.pd-chip--checked { background: #dff3e6; color: #1f6b3a; }
.pd-chip--approved { background: #1f6b3a; color: #fff; }
.pd-chip--cancelled, .pd-chip--superseded { background: #f3dcdc; color: #862a2d; }
.es-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; max-width: 760px; }
.es-label { font-size: 13px; font-weight: 600; }
.es-help { font-size: 12px; color: var(--muted, #6b6b66); }
.es-field input[type="text"], .es-field textarea, .es-field select { width: 100%; box-sizing: border-box; }
.es-fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin: 0 0 16px; }
.es-fieldset legend { font-weight: 600; padding: 0 6px; }
.es-obj { padding-left: 12px; border-left: 2px solid var(--border); }
.es-item { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 6px; }
.es-item > :first-child { flex: 1; }
.es-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.es-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 16px 0; border-bottom: 1px solid var(--border); }
.es-tab { padding: 6px 12px; text-decoration: none; color: var(--ink); border-radius: 6px 6px 0 0; }
.es-tab--on { background: var(--border); font-weight: 600; }
.es-paras li { margin: 0 0 8px; line-height: 1.5; }
.es-ok { background: #eef8f1; }
.es-bad { background: #fdf3ef; }
.es-previews { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.es-frame { border: 1px solid var(--border); border-radius: 8px; background: #fff; height: 900px; }
.es-frame--desk { width: 700px; max-width: 100%; }
.es-frame--phone { width: 390px; max-width: 100%; }

/* Email Studio chat (the assistant): the chat on the left, the live preview of the email on the right. */
.es-chat { display: grid; grid-template-columns: minmax(360px, 5fr) minmax(320px, 6fr); gap: 20px; align-items: start; }
.es-chat__talk { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.es-chat__log { display: flex; flex-direction: column; gap: 10px; max-height: 62vh; overflow-y: auto; padding: 4px 2px; }
.es-chat__form textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; }
.es-chat__status { margin-left: 8px; }
.es-chat__suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.es-chat__suggest button { text-align: left; white-space: normal; }
.es-msg { border-radius: 10px; padding: 10px 12px; max-width: 92%; }
.es-msg--user { align-self: flex-end; background: #eaf0fd; }
.es-msg--assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.es-msg__who { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.es-msg__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.es-step { display: flex; gap: 8px; align-items: baseline; padding-left: 4px; font-size: 13px; color: var(--muted); }
.es-step__mark { color: #17663a; font-weight: 700; }
.es-step--bad .es-step__mark { color: #a3122e; }
.es-chat__preview { position: sticky; top: 12px; min-width: 0; }
.es-chat__preview-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.es-chat__frame { width: 100%; height: 72vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
@media (max-width: 1000px) {
  .es-chat { grid-template-columns: 1fr; }
  .es-chat__preview { position: static; }
  .es-msg { max-width: 100%; }
}

/* Email Studio composer (the start screen and the chat screen): a text box, the + button for files, a chip for each
   file, and Send. A file that a person drags over the composer gives it a dashed border. */
.es-start { margin: 0 0 24px; max-width: 860px; }
.es-start .es-chat__suggest { margin-top: 4px; }
.es-compose { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.es-compose:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(20, 84, 232, 0.15); }
.es-compose textarea { width: 100%; box-sizing: border-box; border: 0; outline: none; resize: vertical; font: inherit; background: transparent; padding: 2px 0; }
.es-compose textarea:disabled { background: transparent; color: var(--muted); }
.es-compose--drop { border-style: dashed; border-color: var(--accent); background: #f3f7fe; }
.es-compose__bar { display: flex; align-items: center; gap: 8px; }
.es-compose__status { flex: 1; min-width: 0; }
.es-compose input[type="file"], .es-files[hidden] { display: none; }
.es-plus { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; }
.es-files { display: flex; flex-wrap: wrap; gap: 6px; }
.es-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 4px 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-size: 13px; }
.es-file--busy { background: #f7f7f5; }
.es-file--sent { padding-right: 10px; }
.es-file__name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.es-file__size, .es-file__note { color: var(--muted); font-size: 12px; white-space: nowrap; }
.es-file__remove { padding: 0 7px; border: 0; border-radius: 50%; font-size: 15px; line-height: 1.4; }
.es-msg__files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.es-recent { list-style: none; margin: 0 0 8px; padding: 0; max-width: 860px; }
.es-recent li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); }

/* Email Studio, the analyst package: the readiness review, the role notes, the guide (recipe cards and the GSX
   examples), the recipe inputs of a picked type, the E8 audience, and the analyst check boxes of the settings. */
/* A control that the person cannot use (for example an owner step for an analyst) looks off. */
.view-email .btn-ghost:disabled, .view-email .btn-primary:disabled, .view-email .btn-danger:disabled { opacity: 0.55; cursor: not-allowed; }
.view-email .es-field input:disabled, .view-email .es-field textarea:disabled, .view-email .es-field select:disabled,
.view-email .pd-actions input:disabled, .view-email .pd-actions select:disabled { background: #f1f1ef; color: var(--muted); }
.es-chip--done { background: #dff3e6; color: #1f6b3a; }
.es-chip--open { background: #fff1cf; color: #805c00; }
.es-chip--blocked { background: #f3dcdc; color: #862a2d; }
.es-chip--info { background: #e6eefc; color: #1a4fb8; }
.es-ready { margin: 0 0 20px; }
.es-ready__top { margin: 0 0 8px; }
.es-ready__row--next td { font-weight: 600; }
.es-ready__row--next td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.es-role-note { border-left: 3px solid var(--accent); }
.es-need ul, .es-card ul, .es-card ol { margin: 4px 0 8px; padding-left: 20px; }
.es-need .meta { margin: 4px 0 0; }
.es-audience { margin: 0 0 12px; }
.es-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin: 0 0 16px; }
.es-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; min-width: 0; overflow-wrap: anywhere; }
.es-card__title { margin: 0 0 4px; font-size: 16px; }
.es-card .es-label { margin: 8px 0 0; }
.es-card p { margin: 4px 0; }
.es-house-rules li { margin: 0 0 8px; line-height: 1.5; max-width: 860px; }
.es-lines { list-style: none; padding-left: 0; margin: 0 0 16px; }
.es-lines li { padding: 4px 0; border-bottom: 1px solid var(--border); line-height: 1.5; overflow-wrap: anywhere; }
.es-fields { list-style: none; padding-left: 0; margin: 0; }
.es-fields li { margin: 0 0 4px; overflow-wrap: anywhere; }
.es-fields .es-mono { color: var(--muted); }
.es-checks { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; }
.es-check { display: flex; gap: 8px; align-items: baseline; }
@media (max-width: 600px) {
  .es-cards { grid-template-columns: 1fr; }
}
