/* Landing Page Editor — app chrome only. Nothing here can reach the page you
   are editing: the preview lives in an iframe with its own document. */

:root {
  --bg: #0f1117;
  --bg-raised: #171a23;
  --bg-input: #0b0d13;
  --border: #262b38;
  --border-strong: #364055;
  --text: #e7eaf1;
  --text-dim: #9aa3b6;
  --accent: #3884ff;
  --accent-dim: #22508f;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Several components below set display:flex, which would otherwise beat the
   UA stylesheet's [hidden] rule and leave every modal on screen. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button { font-family: inherit; font-size: inherit; }
code { font-family: var(--mono); font-size: .92em; }

/* ------------------------------------------------------------------ login */
.login-body {
  display: grid;
  place-items: center;
  overflow: auto;
}

.login-card {
  width: min(380px, calc(100vw - 32px));
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}

.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.login-card label { font-size: 12px; color: var(--text-dim); }

/* ----------------------------------------------------------------- header */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.brand { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.brand-mark { color: var(--accent); font-size: 18px; }
.brand-name { font-weight: 600; white-space: nowrap; }

.chip {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.chip-ok { color: var(--ok); border-color: rgba(34, 197, 94, .35); }
.chip-bad { color: var(--bad); border-color: rgba(239, 68, 68, .4); }

.header-file {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.current-path {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dirty-flag {
  font-size: 11px;
  color: var(--warn);
  border: 1px solid rgba(245, 158, 11, .4);
  border-radius: 999px;
  padding: 1px 8px;
  flex: 0 0 auto;
}

.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.header-history { display: flex; gap: 2px; }

/* Publishing is irreversible, so it is deliberately not styled as the primary
   action — prominent enough to find without hunting, distinct enough from Save
   that the two are never confused. */
.btn-publish {
  border-radius: var(--radius);
  padding: 6px 13px;
  border: 1px solid var(--ok);
  background: rgba(34, 197, 94, .16);
  color: #8df0b3;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-publish:hover { background: var(--ok); color: #06210f; }

/* --------------------------------------------------------------- controls */
.btn-primary, .btn-secondary, .btn-ghost {
  border-radius: var(--radius);
  padding: 6px 13px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #4a90ff; }
.btn-secondary { background: var(--bg-input); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-dim); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); }

.btn-primary:disabled, .btn-secondary:disabled { opacity: .45; cursor: not-allowed; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius);
  width: 30px;
  height: 30px;
  cursor: pointer;
  flex: 0 0 auto;
}
.btn-icon:hover { color: var(--text); border-color: var(--border-strong); }

input[type="text"], input[type="url"], input[type="search"], input[type="password"], input[type="file"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 10px;
  width: 100%;
  font-family: inherit;
  font-size: 13px;
}
input:focus { outline: 2px solid var(--accent-dim); outline-offset: 0; border-color: var(--accent-dim); }

.login-card button[type="submit"] {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 9px;
  cursor: pointer;
  margin-top: 6px;
}

.toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.toggle input { accent-color: var(--accent); }

.muted { color: var(--text-dim); font-size: 13px; margin: 0; }
.hint { color: var(--text-dim); font-size: 11.5px; margin: 4px 0 0; line-height: 1.45; }
.error-text { color: var(--bad); font-size: 13px; margin: 12px 0 0; }
.row { display: flex; gap: 6px; margin-top: 6px; }

/* ------------------------------------------------------------------ layout */
.app-body { flex: 1 1 auto; display: flex; min-height: 0; }

.sidebar {
  width: 300px;
  flex: 0 0 auto;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-head { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); }

.tree { padding: 6px 0; flex: 0 1 auto; min-height: 120px; overflow-y: auto; }

.sidebar-section { border-top: 1px solid var(--border); padding: 10px; }
.sidebar-section h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin: 0 0 8px;
}

.tree-list { list-style: none; margin: 0; padding: 0; }

.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 10px 4px 8px;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  border-radius: 4px;
}
.tree-row:hover { background: rgba(255, 255, 255, .05); }
.tree-row.is-active { background: var(--accent-dim); color: #fff; }
.tree-row-disabled { color: var(--text-dim); cursor: default; opacity: .55; }
.tree-row-disabled:hover { background: transparent; }

.tree-caret { width: 10px; color: var(--text-dim); font-size: 10px; }
.tree-icon { width: 16px; text-align: center; flex: 0 0 auto; }
.tree-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-meta { font-size: 10.5px; color: var(--text-dim); flex: 0 0 auto; font-family: var(--mono); }

.tree-status { color: var(--text-dim); font-size: 12px; padding: 6px 12px; margin: 0; line-height: 1.5; }
.tree-error { padding: 12px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.zone-list { max-height: 260px; overflow-y: auto; }
.zone-summary { font-size: 11px; color: var(--text-dim); margin: 0 0 6px; font-family: var(--mono); }
.zone-row.is-active { background: var(--accent-dim); color: #fff; }
.zone-text .tree-icon { color: #7aa7ff; }
.zone-image .tree-icon { color: #4ade80; }
.zone-video .tree-icon { color: #fbbf24; }

/* ----------------------------------------------------------------- preview */
.workspace { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }

.preview-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  flex: 0 0 auto;
}

.preview-widths { display: flex; gap: 4px; }
.btn-fullscreen { padding: 4px 10px; font-size: 12.5px; }

/* ------------------------------------------------------- full-screen preview
   The page as a visitor sees it: header and sidebar out of the way, the iframe
   filling the window. Still fully editable — the floating toolbar is positioned
   against the preview, so it follows automatically. */
body.is-fullscreen .app-header,
body.is-fullscreen .sidebar { display: none; }

body.is-fullscreen .preview-bar {
  opacity: .25;
  transition: opacity .15s ease;
}
body.is-fullscreen .preview-bar:hover { opacity: 1; }

.fullscreen-exit {
  position: fixed;
  z-index: 70;
  top: 10px;
  right: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text);
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  opacity: .35;
  transition: opacity .15s ease;
}
.fullscreen-exit:hover { opacity: 1; }
.btn-width {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
}
.btn-width.is-active { background: var(--accent-dim); color: #fff; border-color: var(--accent-dim); }

.preview-note { font-size: 11.5px; color: var(--text-dim); margin-left: auto; font-family: var(--mono); }
.note-ok { color: var(--ok); }
.note-warn { color: var(--warn); }

.preview-shell {
  flex: 1 1 auto;
  position: relative;
  background: #23262f;
  overflow: auto;
  display: flex;
  justify-content: center;
}

#preview {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: block;
}

.preview-empty, .preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
  color: var(--text-dim);
  text-align: center;
  padding: 24px;
}
.preview-empty h2 { color: var(--text); margin: 0; font-size: 17px; }
.preview-empty p { max-width: 380px; line-height: 1.5; margin: 0; }

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- toolbar */
/* ---------------------------------------------------------------- edit bar
   Docked above the preview, never floating. The floating version depended on
   the window width, the iframe geometry and a per-frame measurement, and when
   any of those was wrong the toolbar was simply absent — the one thing a
   toolbar must never be. This row is always in the same place. It sits inside
   .workspace rather than the header so it survives full-screen mode. */
.edit-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 12px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}

.edit-bar-target {
  font-size: 11.5px;
  color: var(--text-dim);
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40%;
}
.edit-bar.is-active .edit-bar-target { color: var(--accent); }

.edit-bar-tools { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }

.edit-bar-tools button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 5px;
  min-width: 30px;
  height: 28px;
  padding: 0 7px;
  cursor: pointer;
  font-size: 13px;
}
.edit-bar-tools button:hover:not(:disabled) { background: rgba(255, 255, 255, .08); border-color: var(--border-strong); }
.edit-bar-tools button.is-active { background: var(--accent-dim); color: #fff; }
/* Dimmed rather than removed, so the row never changes shape and the controls
   are always where you last saw them. */
.edit-bar-tools button:disabled { opacity: .3; cursor: default; }

.btn-addblock { font-weight: 600; color: var(--accent) !important; }
.btn-addblock:disabled { color: var(--text-dim) !important; }

.toolbar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.toolbar-items { display: flex; align-items: center; gap: 2px; }

/* ------------------------------------------------------------------ modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 80;
}

.modal {
  position: fixed;
  z-index: 90;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}
.modal-wide { width: min(900px, calc(100vw - 32px)); }

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal header h2 { margin: 0; font-size: 15px; }

.modal-body { padding: 16px; overflow-y: auto; }

.modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; }

.media-current {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}
.media-current .label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 3px; }
.media-current code { color: var(--text); font-size: 11.5px; }

.progress { height: 5px; background: var(--bg-input); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }

/* -------------------------------------------------------------------- diff */
.diff { font-family: var(--mono); font-size: 11.5px; }
.diff-section { margin-bottom: 20px; }
.diff-section h3 { font-size: 12px; margin: 0 0 2px; font-family: var(--font); }
.diff-section-muted { opacity: .72; }

.diff-hunk {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 8px;
  overflow: hidden;
}
.diff-loc { background: var(--bg-input); color: var(--text-dim); padding: 3px 8px; font-size: 10.5px; }

.diff-line {
  padding: 2px 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.diff-add { background: rgba(34, 197, 94, .12); color: #a7f3c0; }
.diff-del { background: rgba(239, 68, 68, .12); color: #fca5a5; }

/* ------------------------------------------------------------------ toasts */
.toast-stack {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(440px, calc(100vw - 32px));
}

.toast {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 10px 34px 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  overflow-wrap: anywhere;
}
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--bad); }
.toast-warn { border-left-color: var(--warn); }
.toast-info { border-left-color: var(--accent); }

.toast-close {
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
}
.toast-close:hover { color: var(--text); }

@media (max-width: 900px) {
  .sidebar { width: 240px; }
  .header-file { display: none; }
}

/* ------------------------------------------------------- login: 2FA steps */
.login-card h2 { font-size: 16px; margin: 0 0 8px; }
.login-card section { display: block; }

.notice-text {
  color: var(--accent);
  font-size: 12.5px;
  margin: 12px 0 0;
  line-height: 1.5;
}

.enrol-qr-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0 10px;
}
.enrol-qr-wrap img {
  /* QR codes need a light background to scan reliably in a dark UI. */
  background: #fff;
  padding: 10px;
  border-radius: 10px;
  max-width: 100%;
}

.secret-block {
  display: block;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .06em;
  overflow-wrap: anywhere;
  margin: 6px 0 14px;
  user-select: all;
}

.recovery-list {
  list-style: none;
  margin: 14px 0;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  font-family: var(--mono);
  font-size: 13px;
  user-select: all;
}

.confirm-row { margin: 14px 0; }
.block { width: 100%; }

/* ----------------------------------------------------------------- admin */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.admin-main { flex: 1 1 auto; overflow-y: auto; padding: 20px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 16px; margin: 0; }
.panel-foot { margin-top: 12px; display: flex; align-items: center; gap: 12px; }

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
.filters select, .filters input { min-width: 150px; }

select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255, 255, 255, .03); }

.row-disabled { opacity: .5; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }

.mono-cell { font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.muted-text { color: var(--text-dim); }

.btn-mini {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-mini:hover { color: var(--text); border-color: var(--border-strong); }

/* Lights up once something is selected, so the fixed way to add a block is as
   obvious as the ＋ on the floating toolbar — and still there when it is not. */
.btn-mini.is-armed:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.badge {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge-admin { color: var(--accent); border-color: var(--accent-dim); }
.badge-action { font-family: var(--mono); }
.badge-bad { color: var(--bad); border-color: rgba(239, 68, 68, .4); }

a.btn-ghost, a.btn-secondary { text-decoration: none; display: inline-block; }

/* ------------------------------------------------- phase 2: fleet + pages */
.droplet-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
  max-width: 220px;
}
.droplet-select:disabled { opacity: .6; }

.chip-warn { color: var(--warn); border-color: rgba(245, 158, 11, .4); }

.badge-draft { color: var(--warn); border-color: rgba(245, 158, 11, .45); }
.badge-published { color: var(--ok); border-color: rgba(34, 197, 94, .45); }

.readonly-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(245, 158, 11, .12);
  border-bottom: 1px solid rgba(245, 158, 11, .35);
  color: #fcd9a1;
  font-size: 12.5px;
}
.readonly-banner strong { color: var(--warn); flex: 0 0 auto; }
.readonly-banner span { flex: 1 1 auto; }
/* The banner says to duplicate, so it also offers it — otherwise the only
   route to the action is hovering the right row in the sidebar. */
.readonly-banner button { flex: 0 0 auto; font-size: 12px; padding: 4px 10px; }

/* Not a warning about a deliberate state — something the editor cannot do. */
.banner-alert {
  background: rgba(239, 68, 68, .12);
  border-bottom-color: rgba(239, 68, 68, .4);
  color: #f6b8b8;
}
.banner-alert strong { color: var(--bad); }

.page-group { margin-bottom: 10px; }
.page-group-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin: 8px 0 4px;
  padding: 0 10px;
}
.page-row .tree-name { font-family: var(--mono); font-size: 12px; }

/* Tracked-link warning in the review modal */
.link-section-alert {
  border: 1px solid rgba(245, 158, 11, .45);
  background: rgba(245, 158, 11, .07);
  border-radius: var(--radius);
  padding: 12px;
}
.link-section-alert h3 { color: var(--warn); }
.link-changes {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

/* Link editor: affiliate controls */
.radio-row { display: flex; gap: 16px; margin-top: 4px; }
.radio-row .toggle { cursor: pointer; }
#link-preview { color: var(--accent); }

/* Expert photo presets */
.preset-row { display: flex; gap: 10px; margin-top: 6px; }
.preset-card {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}
.preset-card:hover { border-color: var(--border-strong); }
.preset-card.is-active { border-color: var(--accent); background: rgba(56, 132, 255, .1); }
.preset-card img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--bg-raised);
}
.preset-card em { font-style: normal; font-size: 10px; color: var(--text-dim); }
.preset-custom-mark {
  width: 56px; height: 56px; line-height: 56px;
  border-radius: 50%; background: var(--bg-raised);
  border: 1px dashed var(--border-strong); color: var(--text-dim); font-size: 20px;
}

/* ------------------------------------------------- page rows: duplicate etc.
   The open target and the row actions are siblings rather than nested: a
   <button> cannot legally contain buttons, and nesting them breaks keyboard
   activation as well as validity. Actions stay hidden until the row is hovered
   or something inside it has focus, so a 57-page list is not a wall of icons —
   but :focus-within keeps them reachable by keyboard alone. */
.page-item { display: flex; align-items: center; }
.page-item .page-row { flex: 1 1 auto; min-width: 0; }

.page-actions {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
  padding-right: 6px;
  /* Legible at rest rather than invisible until hover. Publishing was
     effectively hidden behind a hover you had to know about. */
  opacity: .55;
  transition: opacity .12s ease;
}
.page-item:hover .page-actions,
.page-item:focus-within .page-actions { opacity: 1; }

/* The end of the workflow, so it reads as an action rather than a glyph. */
.btn-row[data-action="publish"] {
  opacity: 1;
  color: #fff;
  background: var(--ok);
  border-color: transparent;
  font-weight: 700;
  padding: 4px 8px;
}
.btn-row[data-action="publish"]:hover:not(:disabled) {
  background: #34d571;
  color: #06210f;
  border-color: transparent;
}

.btn-row {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 4px 5px;
}
.btn-row:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); background: var(--bg-input); }
.btn-row:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-row:disabled { opacity: .3; cursor: not-allowed; }
.btn-row-danger:hover:not(:disabled) { color: var(--bad); border-color: rgba(239, 68, 68, .45); }

/* ----------------------------------------------------- irreversible actions */
.btn-danger {
  border-radius: var(--radius);
  padding: 6px 13px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  background: var(--bad);
  color: #fff;
  font-weight: 600;
}
.btn-danger:hover:not(:disabled) { background: #f05a5a; }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }

/* Deliberately loud. Publishing is the one action in this app with no undo. */
.danger-note {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid rgba(239, 68, 68, .4);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: rgba(239, 68, 68, .07);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
}
.danger-note strong { color: var(--bad); display: block; margin-bottom: 3px; }

.slug-status { font-family: var(--mono); font-size: 11.5px; margin: 8px 0 0; }
.slug-status.is-free { color: var(--ok); }
.slug-status.is-taken { color: var(--bad); }
.slug-status.is-checking { color: var(--text-dim); }

/* --------------------------------------------------- item controls (toolbar)
   Duplicate / reorder / delete for repeatable units — pros, cons, image
   blocks. Hidden unless the caret is inside one, so a page headline never
   offers a delete button for something that cannot be re-added. */
.toolbar-items { display: inline-flex; gap: 2px; align-items: center; }
.toolbar-items button:disabled { opacity: .3; cursor: not-allowed; }
.edit-bar-tools .toolbar-danger:hover:not(:disabled) { color: var(--bad); }

.btn-secondary-danger { border-color: rgba(239, 68, 68, .4); }
.btn-secondary-danger:hover:not(:disabled) { color: var(--bad); border-color: var(--bad); }

/* ------------------------------------------------- duplication progress
   The copy is one server call with no byte-level progress to report, so the
   bar is honestly indeterminate — it says "working", while the text alongside
   carries the facts that are actually known (how much, how long). */
.copy-progress { margin-top: 12px; }
.progress-indeterminate {
  width: 40% !important;
  animation: lpe-indeterminate 1.1s ease-in-out infinite;
}
@keyframes lpe-indeterminate {
  0%   { margin-left: 0; }
  50%  { margin-left: 60%; }
  100% { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-indeterminate { animation: none; width: 100% !important; opacity: .5; }
}

/* ------------------------------------------------------------- add a block
   New blocks are copies of ones already on the page, so a type is disabled
   when the page has no example to copy — better than inventing markup that
   would not match the template. */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-head h2 { margin: 0; }

.block-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.block-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}
.block-card:hover:not(:disabled) { border-color: var(--accent); background: rgba(56, 132, 255, .1); }
.block-card:disabled { opacity: .35; cursor: not-allowed; }
.block-icon { font-size: 20px; line-height: 1; color: var(--text-dim); }
.block-card:hover:not(:disabled) .block-icon { color: var(--accent); }

/* Detection quality. Amber when part of the page could not be read — the
   number is the share of the page's text that ended up editable. */
.zone-summary-warn { color: var(--warn); }
