/* Companion Sites — the visual editor (web/sites).
   CHROME ONLY: layout, inspector, dialogs — all on agent.css tokens (--bg,
   --surface, --accent, …). The site preview inside .ed-preview renders and
   themes itself via /s/_lib/site.css + siteRender.js; nothing in this file
   styles site content except the selection outlines on [data-section-id]. */

/* ---------------------------------------------------------------------
   Topbar rows (list vs editor) — both live inside the shared .topbar
   --------------------------------------------------------------------- */
.tb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  width: 100%;
  min-width: 0;
}
.tb-left, .tb-right {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}
.tb-right { flex: none; }
.tb-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--text-2);
  font-size: 16px;
  text-decoration: none;
  flex: none;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.tb-back:hover { background: var(--surface-2); color: var(--text); }
.tb-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.slug-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  transition: border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.slug-pill:hover { border-color: var(--border-strong); color: var(--text); }

/* Autosave status dot */
.save-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  flex: none;
}
.save-dot i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--live);
  flex: none;
}
/* Grayscale states: settled = solid black; in-motion = gray; trouble =
   hollow ring (the label text carries the words). */
.save-dot[data-state="saving"] i,
.save-dot[data-state="blocked"] i { background: var(--text-3); }
.save-dot[data-state="offline"] i,
.save-dot[data-state="error"] i { background: transparent; border: 2px solid var(--border-strong); }
.save-dot em { font-style: normal; }
@media (max-width: 560px) { .save-dot em { display: none; } }

.btn-publish {
  border: none;
  border-radius: var(--r-pill);
  height: 34px;
  padding: 0 18px;
  background: var(--accent-gradient);
  color: var(--text-on-accent);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex: none;
  transition: filter var(--dur-1) var(--ease-out);
}
.btn-publish:hover { filter: brightness(1.06); }
/* Live page matches the draft — the button rests quiet until an edit. */
.btn-publish.is-published {
  background: var(--surface-2);
  color: var(--live);
  border: 1px solid var(--border);
}
.btn-publish.is-published:hover { filter: none; background: var(--surface-3); }
.btn-publish:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.overflow-menu button.danger { color: var(--danger); }
.overflow-menu button.danger:hover { background: var(--surface-3); }

/* ---------------------------------------------------------------------
   List view — "Your pages"
   --------------------------------------------------------------------- */
.list-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: calc(var(--topbar-h) + var(--s-10)) var(--s-6) var(--s-16);
}
.list-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.2;
}
.list-sub { font-size: 14px; color: var(--text-2); margin-top: var(--s-2); }
.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-8);
}
.site-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  text-decoration: none;
  color: var(--text);
  min-height: 200px;
  overflow: hidden;
  transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.site-card:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
/* Palette thumbnail — bleeds to the card edges, mirrors the editorial hero
   (bottom-anchored title + accent rule). */
.site-card-thumb {
  height: 72px;
  margin: calc(var(--s-5) * -1) calc(var(--s-5) * -1) var(--s-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 14px 10px;
  overflow: hidden;
}
.site-card-thumb-name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-card-thumb-rule {
  width: 22px;
  height: 2px;
  border-radius: 1px;
  margin-top: 6px;
}
/* Title leads, then slug + status. */
.site-card-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.site-card-slugrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.site-card-slug {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.site-card-meta {
  margin-top: auto;
  font-size: 12px;
  color: var(--text-2);
}
.new-card-plus { font-size: 20px; line-height: 1; }
.site-card.new-card {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
}
.site-card.new-card:hover { color: var(--accent); border-color: var(--accent-deep); background: transparent; }
.site-card.skel {
  border-style: solid;
  animation: card-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes card-pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

.list-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-12) var(--s-6);
}
.list-empty h2 { font-family: var(--font-serif); font-weight: 500; font-size: 22px; }
.list-empty p { font-size: 14px; color: var(--text-2); max-width: 380px; }
.list-empty .btn-primary { width: auto; padding: 0 var(--s-8); margin-top: var(--s-2); }

/* ---------------------------------------------------------------------
   Editor split — preview left, inspector right
   --------------------------------------------------------------------- */
.ed-main {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
}
/* Recessed canvas — a step darker than the app bg with a faint dot grid so
   the page reads as a document sitting on a workspace (a dark-themed site no
   longer dissolves into the editor bg). */
.ed-preview-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  min-width: 0;
  padding: var(--s-6);
  background: #D0D0D0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.12) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* The "device": chrome strip + framed viewport. Desktop caps at an honest
   small-laptop width; Mobile is a true 390px viewport where site.css's 640px
   breakpoints actually fire. */
.ed-device {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1160px;
  height: 100%;
  transition: max-width var(--dur-2) var(--ease-out);
}
.ed-device[data-vw="mobile"] { max-width: 390px; }

.ed-chrome {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: 40px;
  padding: 0 12px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}
.ed-chrome-dots { display: flex; gap: 6px; flex: none; }
.ed-chrome-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--surface-3);
}
.ed-chrome-addr {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ed-viewport-toggle {
  flex: none;
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
}
.ed-viewport-toggle button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.ed-viewport-toggle button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

.ed-preview {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 2px solid var(--border-strong);
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  background: var(--surface);
  display: block;
  box-shadow: var(--shadow-float);
}

/* Inspector */
.ed-inspector {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
}
.insp-tabs {
  display: flex;
  gap: var(--s-1);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.insp-tabs button {
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.insp-tabs button:hover { color: var(--text); }
.insp-tabs button[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.insp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--s-4) var(--s-5) var(--s-10);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.insp-note { font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* Section list (nothing selected) */
.sec-list { display: flex; flex-direction: column; gap: var(--s-2); }
.sec-row {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3);
}
.sec-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 2px 0;
}
.sec-row-type {
  font-size: 10px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.sec-row-heading {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sec-row-main:hover .sec-row-heading { color: var(--accent); }
/* Rows read as content until you intend to act — the reorder/remove controls
   fade in on hover (and on keyboard focus). */
.sec-row:hover { border-color: var(--border-strong); }
.sec-row .icon-btn { opacity: 0; transition: opacity var(--dur-1) var(--ease-out); }
.sec-row:hover .icon-btn,
.sec-row .icon-btn:focus-visible { opacity: 1; }
.sec-row:hover .icon-btn:disabled { opacity: 0.3; cursor: default; }
.sec-empty-hint { font-size: 12px; color: var(--text-3); font-style: italic; }

.add-section-btn { width: 100%; margin-top: var(--s-1); }

/* Section form */
.sf-head { display: flex; align-items: center; gap: var(--s-2); }
.sf-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: var(--r-sm);
}
.sf-back:hover { color: var(--text); background: var(--surface-2); }
.sf-type {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.sf-footer { margin-top: var(--s-2); display: flex; justify-content: flex-start; }
.sf-footer .btn-ghost { padding-left: 0; }

/* Group divider inside a section form (e.g. the Motion controls). */
.sf-group-label {
  margin: var(--s-5) 0 var(--s-1);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* List editors (embeds / gallery / shows / links) */
.item-list { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-2); }
.item-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.item-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
}
.item-controls .icon-btn { font-size: 13px; }
.input-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }

.embed-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 8px 8px 12px;
}
.embed-provider { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; text-transform: capitalize; flex: none; }
.embed-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.embed-id {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.add-row { display: flex; gap: var(--s-2); margin-top: var(--s-2); }
.add-row .brief-input { flex: 1 1 auto; min-width: 0; }
.add-row .btn-secondary { flex: none; }
.field-error { font-size: 12px; color: var(--danger); margin-top: var(--s-1); }
.cap-note { font-size: 11px; color: var(--text-3); margin-top: var(--s-1); }

/* Gallery rows */
.g-row { flex-direction: row; align-items: center; }
.g-thumb {
  width: 44px; height: 44px;
  flex: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
}
.g-row .brief-input { flex: 1 1 auto; min-width: 0; }
.g-row .item-controls { flex: none; }

/* Single-image field (hero / about / og image) */
.img-field { margin-top: var(--s-2); }
.img-thumb {
  display: block;
  width: 100%;
  height: 120px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  margin-bottom: var(--s-2);
  padding: 0;
  cursor: pointer;
  transition: filter var(--dur-1) var(--ease-out);
}
.img-thumb:hover { filter: brightness(1.06); }
.img-actions { display: flex; gap: var(--s-2); }
/* Empty image field — a drop target, not a lone button. */
.img-drop {
  width: 100%;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  padding: var(--s-4);
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.img-drop:hover, .img-drop.over { border-color: var(--accent-deep); color: var(--text); }
.img-drop.over { background: var(--surface-2); }

/* Theme tab */
.theme-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-2);
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.theme-swatch[aria-pressed="true"] { color: var(--text); }
/* Specimen tile — the palette shown as a real page: bg, text set in the
   preset's own head font, and the accent as a dot. */
.swatch-tile {
  position: relative;
  width: 100%;
  height: 56px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: box-shadow var(--dur-1) var(--ease-out);
}
.theme-swatch:hover .swatch-tile { box-shadow: 0 0 0 1px var(--border-strong); }
.theme-swatch[aria-pressed="true"] .swatch-tile { box-shadow: 0 0 0 2px var(--accent); }
.swatch-aa {
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}
.swatch-dot {
  position: absolute;
  left: 8px; bottom: 8px;
  width: 10px; height: 10px;
  border-radius: 50%;
}
.swatch-name { padding-left: 2px; }
.accent-row { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-2); }
.accent-row input[type="color"] {
  width: 44px; height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
}
.accent-hex { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); text-transform: uppercase; }
.accent-hex.is-default { color: var(--text-3); text-transform: none; }

/* ---------------------------------------------------------------------
   Modal — create page, add section, publish confirm, slug edit, delete
   --------------------------------------------------------------------- */
.sm-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0,0,0,0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  opacity: 0;
  animation: sm-fade var(--dur-2) var(--ease-out) forwards;
}
.sm-dialog {
  width: 100%;
  max-width: 460px;
  max-height: min(85vh, 85dvh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-panel);
  padding: var(--s-6);
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  animation: sm-rise var(--dur-2) var(--ease-out) 40ms forwards;
}
@keyframes sm-fade { to { opacity: 1; } }
@keyframes sm-rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .sm-overlay, .sm-dialog { animation-duration: 1ms; }
}
/* Cancel/Reset are not destructive — a red hover here would mislead. Red
   stays only on genuinely destructive ghosts (Remove section/image). */
.sm-actions .btn-ghost:hover,
.accent-row .btn-ghost:hover { color: var(--text); background: var(--surface-2); }
/* Destructive confirm — a real danger button, not gray-with-red-text. */
.btn-danger {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  color: var(--danger);
  border-radius: var(--r-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}
.btn-danger:hover { background: var(--surface-3); }
.sm-title { font-family: var(--font-serif); font-weight: 500; font-size: 20px; line-height: 1.3; }
.sm-sub { font-size: 13px; color: var(--text-2); margin-top: var(--s-1); line-height: 1.5; }
.sm-actions { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-6); }
.sm-actions .btn-primary { width: auto; padding: 0 var(--s-6); height: 40px; line-height: 40px; }
.sm-url {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-top: var(--s-4);
  word-break: break-all;
}

/* Template picker inside the create dialog */
.tpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.tpl-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3);
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.tpl-card:hover { border-color: var(--border-strong); }
.tpl-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--surface-3); }
.tpl-label { font-size: 13px; font-weight: 600; color: var(--text); }
.tpl-hint { font-size: 11px; color: var(--text-2); line-height: 1.45; }

/* Template wireframe — a 56px sketch of the page shape. */
.tpl-wf {
  width: 100%;
  height: 56px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.wf-bar { display: block; height: 4px; border-radius: 1px; background: var(--surface-3); }
.wf-title { height: 8px; width: 60%; background: var(--text-3); }
.wf-wide { height: 7px; width: 100%; }
.wf-row { width: 85%; }
.wf-video { height: 16px; width: 100%; background: var(--surface-3); border-radius: 2px; }
.wf-center { align-self: center; }
.wf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.wf-cell { height: 12px; border-radius: 1px; background: var(--surface-3); }

/* Add-section sheet rows */
.type-rows { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s-3); }
.type-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}
.type-row:hover { background: var(--surface-2); }
.type-row-label { font-size: 14px; font-weight: 600; color: var(--text); }
.type-row-hint { font-size: 12px; color: var(--text-2); }

/* ---- Insert library -------------------------------------------------
   The asset panel. Tabs across the top, a grid of presets under them, the
   blank section types below as the fallback. Tokens only — no new colours,
   no gradients on a data surface (ui-spec §de-gradient). */
/* ---- Stock photo sheet -----------------------------------------------
   openStockPicker() builds .sheet-backdrop > .sheet and appends it to <body>,
   and NOTHING ever styled those three classes. So it mounted as a static block
   at the end of normal flow: display:block, visibility:visible, opacity:1,
   position:static, z-index:auto — perfectly "open" and completely invisible
   behind a fixed-position app.

   That is why the Unsplash picker could never be confirmed by clicking it. The
   endpoint was correct the whole time; the button really did open the sheet;
   the sheet had nowhere to be. Only the containers were missing — the results
   grid reuses .theme-swatches/.theme-swatch, which were already styled.

   Layering follows the convention in agent.css: topbar 50 < this 90 < toast 100. */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  background: rgba(0, 0, 0, .45);
}
.sheet {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  width: min(720px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.sheet-head h3 { margin: 0; font-size: 16px; color: var(--text); }

/* ---- New-page picker -------------------------------------------------
   The template grid scrolls inside the dialog rather than pushing Title and
   Create page below the fold. With 37 templates the actions were several
   screens down, so creating a page meant scrolling past every card to reach
   the button. */
.tpl-scroll {
  max-height: 42vh;
  overflow-y: auto;
  margin-top: var(--s-3);
  padding-right: var(--s-2);
}
/* Two cells instead of six — a sticky sequence is a pair, not a contact sheet. */
.wf-grid-2 { grid-template-columns: repeat(2, 1fr); }
/* Shapes the sketch uses that the old six-key version never needed. */
.wf-hero { height: 14px; width: 70%; }
.wf-quote { height: 5px; width: 55%; margin: 0 auto; }
.wf-half { height: 5px; width: 48%; }
.wf-cta { height: 9px; width: 40%; margin: 0 auto; }
.wf-marquee { height: 4px; width: 100%; }

.insert-lib { margin-top: var(--s-3); }
.insert-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
}
.insert-tab {
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.insert-tab:hover { color: var(--text); background: var(--surface-2); }
.insert-tab.is-on { color: var(--text); background: var(--surface-2); }
.insert-status { font-size: 12px; color: var(--text-2); padding: var(--s-3) 0; }
.insert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  margin-top: var(--s-2);
  /* Eight categories, up to ten each — the panel scrolls rather than the
     whole dialog, so the tabs stay reachable while browsing. */
  max-height: 46vh;
  overflow-y: auto;
}
.insert-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.insert-tile:hover { background: var(--surface-2); border-color: var(--text-2); }
.insert-tile-name { font-size: 13px; font-weight: 600; color: var(--text); }
.insert-tile-hint { font-size: 11px; line-height: 1.35; color: var(--text-2); }
.insert-blank-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-top: var(--s-4);
}
@media (max-width: 640px) {
  .insert-grid { grid-template-columns: minmax(0, 1fr); max-height: 40vh; }
}

/* Slug edit row */
.slug-edit-row { display: flex; align-items: center; gap: var(--s-1); margin-top: var(--s-4); }
.slug-prefix { font-family: var(--font-mono); font-size: 13px; color: var(--text-2); flex: none; }
.slug-edit-row .brief-input { font-family: var(--font-mono); font-size: 13px; }

/* Toast with an inline action (agent.css has .toast + .toast-action) */
.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  opacity: 0;
  transform: translate(-50%, 8px);
  animation: toast-in var(--dur-2) var(--ease-out) forwards;
}
.toast.toast-leave { animation: toast-out var(--dur-2) var(--ease-out) forwards; }
@keyframes toast-in { to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation-duration: 1ms; }
}

/* Prose fields (About body, meta description) want readable sans, not the
   12.5px mono the brief templates use. */
.insp-body textarea.brief-input {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 120px;
}

/* ---------------------------------------------------------------------
   Mobile — preview stacks above the inspector
   --------------------------------------------------------------------- */
@media (max-width: 860px) {
  .ed-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 46%);
  }
  .ed-preview-wrap { padding: var(--s-3); }
  .ed-inspector {
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .tb-title { max-width: 120px; }
}

/* Style tab: display-face specimen rows */
.face-list { display: flex; flex-direction: column; gap: 4px; margin-top: var(--s-2); }
.face-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 8px 12px; cursor: pointer; text-align: left;
  transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.face-row:hover { border-color: var(--border-strong); }
.face-row[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.face-name { font-size: 17px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.face-hint { flex: none; font-size: 11px; color: var(--text-3); }

/* Preview toolbar: Play-motion button */
.ed-play-btn {
  flex: none;
  border: 0; background: transparent;
  color: var(--text-2);
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.ed-play-btn:hover { background: var(--surface-2); color: var(--text); }
.ed-play-btn:active { background: var(--surface-3); }

/* --- Duplicate on the site card ------------------------------------------- */
.site-card { position: relative; }
.card-dup {
  align-self: flex-start;
  margin-top: var(--s-2);
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.card-dup:hover { color: var(--text); border-color: var(--border-strong); }
.card-dup:disabled { opacity: 0.6; cursor: default; }

/* --- Paste row in the add-section sheet ------------------------------------ */
.type-row-paste { border-style: dashed; }

/* --- Link-preview card (Meta tab) ------------------------------------------ */
.og-card-wrap { margin-bottom: var(--s-5); }
.og-card {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.og-card-img {
  aspect-ratio: 1.91 / 1;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
}
.og-card-img-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-3);
}
.og-card-text { padding: var(--s-3) var(--s-4); }
.og-card-host {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.og-card-title {
  font-weight: 700;
  font-size: 14px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.og-card-desc {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Save-status chip is clickable when it has something to say ------------ */
#ed-status[data-state="blocked"], #ed-status[data-state="error"] { cursor: pointer; }

/* --- History modal ---------------------------------------------------------- */
.rev-list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
  margin-top: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.rev-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px 14px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
}
.rev-row:last-child { border-bottom: 0; }
.rev-row:hover { background: var(--surface-2); }
.rev-row.is-active { background: var(--text); color: var(--surface); }
.rev-row.is-active .rev-when { color: var(--surface); opacity: 0.7; }
.rev-who { font-weight: 700; }
.rev-when { color: var(--text-2); white-space: nowrap; }

/* --- Focal-point picker ----------------------------------------------------- */
.img-thumb-focus { cursor: crosshair; position: relative; }
.g-thumb { position: relative; cursor: crosshair; border: 0; padding: 0; }
.img-focus-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* --- Touch: hover-revealed controls must simply be visible ------------------ */
@media (hover: none) {
  .sec-row .icon-btn,
  .item-controls .icon-btn { opacity: 1; }
  .card-dup { opacity: 1; }
}

/* --- Press-kit file rows ---------------------------------------------------- */
.file-kind {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* --- Plan bar + paywall ------------------------------------------------------
   Level 3 ($5/month) is the first thing Clubs sells. The vocabulary is the
   brand's: hard 2px black borders, greyscale, offset shadow instead of glow —
   a paywall that looks like the rest of the room, not like a growth team
   visited. Nothing here uses a hue to signal urgency. */

.plan-bar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-top: var(--s-6);
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 4px;
}
/* Unpaid state earns the strong border — it's the one that needs reading. */
.plan-bar.needs-plan {
  border-color: var(--border-strong);
  box-shadow: var(--accent-glow);
}
.plan-bar-text {
  flex: 1 1 260px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}
.plan-bar-text strong { color: var(--text); font-weight: 700; }
.plan-bar-cta { flex: none; width: auto; padding: 0 var(--s-5); height: 38px; line-height: 38px; }

/* A Publish button you can still press — it opens the paywall. Hollow rather
   than filled, so it reads as "not yet" without being disabled. */
.btn-publish.needs-plan {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border-strong);
}
.btn-publish.needs-plan:hover { background: var(--surface-2); filter: none; }

.pw-dialog { max-width: 460px; }
/* A paywall must always show its exit. .sm-dialog caps at 85vh and scrolls,
   which on a short window pushes "Not now" below the fold — a wall with no
   visible door. Sticking the action row to the bottom of the scrollport keeps
   the way out on screen at every height. */
.pw-dialog .sm-actions {
  position: sticky;
  bottom: calc(var(--s-6) * -1); /* cancel the dialog's own bottom padding */
  margin-top: var(--s-4);
  padding: var(--s-3) 0;
  background: var(--surface);
}
.pw-path {
  margin-top: var(--s-5);
  padding: var(--s-5);
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}
.pw-path-head { display: flex; align-items: baseline; gap: var(--s-1); }
.pw-price { font-family: var(--font-serif); font-size: 34px; font-weight: 500; line-height: 1; }
.pw-per { font-size: 13px; color: var(--text-2); }
.pw-path-head2 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.2;
}
.pw-path-note { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-top: var(--s-2); }
.pw-cta { width: 100%; margin-top: var(--s-4); }

/* "or" as a ruled divider — the two paths are alternatives, not a ladder. */
.pw-or {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-5);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.pw-or::before, .pw-or::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border);
}

/* Three dots, because three is a number you can see at a glance. A percentage
   bar would turn "one more friend" into arithmetic. */
.pw-dots { display: flex; gap: var(--s-2); margin-top: var(--s-3); }
.pw-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
}
.pw-dot.on { background: var(--accent); }
.pw-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-top: var(--s-2);
}

@media (max-width: 560px) {
  .plan-bar { align-items: flex-start; }
  .plan-bar-cta { width: 100%; }
}

/* --- Site tab (header / footer / rhythm) ------------------------------------ */
.insp-section-label {
  margin-top: var(--s-6);
  margin-bottom: var(--s-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  border-top: 2px solid var(--border);
  padding-top: var(--s-4);
}
.insp-body > .insp-section-label:first-child { margin-top: 0; border-top: 0; padding-top: 0; }

.insp-toggle {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  font-size: 13px;
  cursor: pointer;
}
.insp-toggle input { accent-color: var(--accent); width: 15px; height: 15px; }

/* One nav link: label, target picker, remove. The picker carries its own
   empty label inside a list, so it collapses to just the control. */
.nav-link-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--s-2);
  align-items: start;
  margin-top: var(--s-2);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
}
.nav-link-row .brief-field { margin: 0; }
.nav-link-row .brief-label:empty { display: none; }
.nav-link-row .brief-input { margin-top: 0 !important; }
.nav-link-row .icon-btn { align-self: center; }

/* Starting-point library — grouped, because a flat grid of 37 is a wall. */
.tpl-group {
  margin-top: var(--s-5);
  margin-bottom: var(--s-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.tpl-group:first-child { margin-top: var(--s-2); }

/* ---------------------------------------------------------------------
   Inbox — messages the caller's pages received (#/inbox). Threads left,
   open thread + reply right; stacked under 900px. agent.css tokens only.
   --------------------------------------------------------------------- */
.ibx-shell {
  max-width: 1060px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-5) var(--s-9);
}
.ibx-head { margin-bottom: var(--s-5); }
.ibx-scope {
  display: inline-flex;
  gap: var(--s-1);
  margin-top: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 2px;
}
.ibx-scope-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  padding: 5px 14px;
  cursor: pointer;
}
.ibx-scope-btn[aria-selected="true"] { background: var(--surface-2); color: var(--text); }

.ibx-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  color: var(--text);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--r-pill);
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: 2px;
}

.ibx-panes {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: var(--s-5);
  align-items: start;
}
.ibx-threads {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.ibx-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  cursor: pointer;
  min-width: 0;
}
.ibx-row:last-child { border-bottom: 0; }
.ibx-row:hover, .ibx-row.open { background: var(--surface-2); }
.ibx-row.skel { height: 58px; cursor: default; }
.ibx-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  border: 1px solid var(--text-2);
  flex: none;
}
.ibx-dot.on { background: var(--text); border-color: var(--text); }
.ibx-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.ibx-row-sender {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ibx-row-sender.unread { font-weight: 700; }
.ibx-row-preview {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ibx-row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: none;
}
.ibx-row-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
.ibx-flag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.ibx-thread {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 320px;
  max-height: calc(100vh - 220px);
}
.ibx-thread-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.ibx-back {
  display: none;
  background: transparent;
  border: 0;
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}
.ibx-thread-who { min-width: 0; flex: 1 1 auto; }
.ibx-thread-sender { font-family: var(--font-serif); font-weight: 500; font-size: 16px; color: var(--text); }
.ibx-thread-addr, .ibx-thread-site {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.ibx-thread-actions { display: flex; gap: var(--s-2); flex: none; }
.ibx-action {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-2);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
}
.ibx-action:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong, var(--border)); }
.ibx-action:disabled { opacity: 0.5; cursor: default; }

.ibx-msgs {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.ibx-msg {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  max-width: 44em;
}
.ibx-msg.out { align-self: flex-end; background: var(--surface-2); }
.ibx-msg-meta {
  display: flex;
  gap: var(--s-3);
  align-items: baseline;
  margin-bottom: 4px;
}
.ibx-msg-from { font-size: 12px; font-weight: 700; color: var(--text); }
.ibx-msg-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-2); }
.ibx-msg-subject { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ibx-msg-flag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  border: 1px dashed var(--border);
  border-radius: 3px;
  padding: 3px 6px;
  margin-bottom: 6px;
}
.ibx-msg-body { font-size: 14px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }

.ibx-composer {
  display: flex;
  gap: var(--s-3);
  align-items: flex-end;
  padding: var(--s-3) var(--s-4) var(--s-4);
  border-top: 1px solid var(--border);
}
.ibx-reply-input { flex: 1 1 auto; min-width: 0; resize: vertical; }
.ibx-send { width: auto; padding: 0 18px; flex: none; }
.ibx-empty-note { font-size: 13px; color: var(--text-2); padding: var(--s-4); }

@media (max-width: 900px) {
  .ibx-panes { grid-template-columns: 1fr; }
  .ibx-panes .ibx-thread { display: none; }
  .ibx-panes.thread-open .ibx-thread { display: flex; }
  .ibx-panes.thread-open .ibx-threads { display: none; }
  .ibx-back { display: inline-flex; }
}
