/* Alba CMS — admin design system.
 *
 * Direction: "Estudio". A modern editorial software canvas: neutral off-
 * white surface (no more warm-paper cream), confident violet accent (no
 * more print-vermillion or pastel indigo), gentle ambient shadows (no
 * more letterpress drop-shadows), real radii, lighter typographic ladder.
 * Reads as a contemporary 2026 design product, not a 1990s newspaper
 * and not a soft pastel dashboard. The serif display is still there for
 * page headings — it just doesn't shout at 800 weight anymore.
 *
 * Token strategy: semantic names stay (--accent, --fg, --bg, ...) so old
 * templates render correctly. The values changed; the contract didn't.
 */

:root {
  /* Neutral surface. Off-white background, clean white panels — the
     warm-paper cream is gone. Slightly tinted so the canvas doesn't read
     as a bare browser. Foreground is a real ink black, not letterpress
     deep-warm. */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-soft: #f1f1ee;
  --fg: #0a0a0a;
  --ink-2: #25252a;
  --muted: #6a6a73;
  --muted-2: #94949c;

  /* Borders: clean neutrals. Strong variant is a true near-black for
     primary-button outlines and focus rings. */
  --border: #e4e4e3;
  --border-strong: #1f1f23;
  --rule: #ececea;

  /* Brand + state. The accent is a confident modern VIOLET — used by
     contemporary design tools, vivid enough to read as intentional but
     refined enough not to feel like a 90s primary colour. accent-soft
     is a thin tinted wash, not a pastel block. */
  --accent: #6d28d9;
  --accent-hover: #5b21b6;
  --accent-soft: #ede9fe;
  --accent-strong: #4c1d95;

  --ok: #15803d;
  --ok-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --draft: #a16207;
  --draft-soft: #fef3c7;
  --archived: #525258;
  --archived-soft: #e4e4e7;

  /* Elevation. Soft ambient shadows again — closer to Notion / Linear
     than to letterpress. Modal sits noticeably higher with a generous
     blur. */
  --shadow-1: 0 1px 2px rgba(10, 10, 10, 0.04), 0 1px 1px rgba(10, 10, 10, 0.03);
  --shadow-2: 0 4px 14px rgba(10, 10, 10, 0.07), 0 2px 4px rgba(10, 10, 10, 0.04);
  --shadow-pop: 0 24px 56px rgba(10, 10, 10, 0.18), 0 4px 12px rgba(10, 10, 10, 0.08);

  /* Radii. Generous again — modern software defaults. */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  /* Type stacks. The display stack uses native serifs available on each OS;
     Iowan Old Style + Charter on Apple, Palatino/Cambria on Windows,
     Georgia as universal fallback. Body uses the standard system stack. */
  --font-display: "Iowan Old Style", "Charter", "Palatino", "Cambria", "Georgia", "Times New Roman",
    serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}
*::selection {
  background: var(--accent);
  color: #fff;
}

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  font-feature-settings: "ss01", "kern";
  /* Hairline texture: a faint vertical bar grid that softens the
     off-white. Only visible on large surfaces; never interferes with
     reading. Pure CSS, no asset. */
  background-image: linear-gradient(to right, rgba(26, 26, 23, 0.018) 1px, transparent 1px);
  background-size: 64px 100%;
}

/* Typography ladder. Modern software weights — display serif for h1/h2
   keeps Alba editorial without shouting. h3/h4 sit on the body sans for
   operational density. Lighter than the previous newspaper pass. */
h1,
h2,
h3,
h4 {
  color: var(--fg);
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.018em;
}
h1 {
  font-size: clamp(1.85rem, 2.4vw + 1rem, 2.4rem);
  letter-spacing: -0.022em;
  line-height: 1.15;
}
h2 {
  font-size: 1.3rem;
}
h3 {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}
h4 {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
p {
  margin: 0 0 0.75rem;
}
p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover {
  text-decoration: underline;
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 0.12em 0.4em;
  border-radius: var(--r-sm);
}

/* Tabular numerals everywhere a number lives — counts, sizes, dates. */
.tabular,
.meta,
.muted.small,
.media-meta,
td,
.page-counts,
.save-status {
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout shell ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.6rem;
  /* Solid fallback first; @supports-aware translucent layer applies on
     browsers with both color-mix() and backdrop-filter, which is the
     overwhelming majority but not 100%. Avoids a transparent topbar on
     legacy engines. */
  background: var(--surface);
  /* Hairline rule — modern apps default to 1 px, not editorial 2 px. */
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
@supports (backdrop-filter: blur(0)) and (background: color-mix(in srgb, white, transparent)) {
  .topbar {
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(160%) blur(6px);
    -webkit-backdrop-filter: saturate(160%) blur(6px);
  }
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}
.brand::before {
  /* A small typographic mark for the wordmark — restrained, not a logo. */
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateY(-0.04em);
}
/* Sans suffix beside the serif wordmark — quiet typographic counterpoint. */
.brand-suffix {
  margin-left: 0.45rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.78em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.user {
  font-size: 0.9rem;
  color: var(--ink-2);
}
.user em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.1em 0.45em;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-left: 0.3em;
}

.container {
  max-width: 64rem; /* 1024px */
  margin: 2.5rem auto 4rem;
  padding: 0 1.5rem;
}
.container.narrow {
  max-width: 28rem;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.muted.small {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Eyebrow label — small uppercase signifier above a section heading.
   Quietly editorial; pairs with serif h2. */
.eyebrow {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

/* Back-link row above a page title. Sits flush with the container. */
.back-link {
  margin: 0 0 1.2rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.back-link a {
  color: var(--muted);
}
.back-link a:hover {
  color: var(--accent);
}

/* ---------- Page hero (used on dashboard, site detail, etc.) ---------- */

.hero {
  margin: 0 0 2.5rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.hero-text > * + * {
  margin-top: 0.25rem;
}
.hero h1 {
  margin: 0;
}
.hero-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}
.hero-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-1);
}
.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}
.card.narrow {
  max-width: 28rem;
  margin: 4rem auto 0;
  padding: 2rem 1.8rem;
}

.cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1rem;
}
/* Dashboard site cards — distinct treatment so they feel like
   destinations, not generic list items. */
.site-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.35rem 1.4rem 1.2rem;
  box-shadow: var(--shadow-1);
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  overflow: hidden;
}
.site-card::before {
  /* Top accent bar — coloured by status via [data-status]. */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--border-strong);
}
.site-card[data-status="live"]::before {
  background: var(--ok);
}
.site-card[data-status="draft"]::before {
  background: var(--draft);
}
.site-card[data-status="archived"]::before {
  background: var(--archived);
}
.site-card:hover,
.site-card:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.site-card a {
  display: block;
  color: var(--fg);
  text-decoration: none;
}
.site-card a:hover {
  text-decoration: none;
}
.site-card a::after {
  /* Whole-card click target — lets the badge/meta inside stay non-link. */
  content: "";
  position: absolute;
  inset: 0;
}
.site-card h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.45rem;
  letter-spacing: -0.01em;
}
.site-card .site-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.site-card .site-meta code {
  background: var(--surface-soft);
  color: var(--ink-2);
  border: 1px solid var(--border);
}
.site-card .site-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-2);
  display: inline-block;
}

/* ---------- Sections — visual rhythm without identical boxes ---------- */

main section {
  margin-bottom: 2rem;
}
.section {
  /* A canonical content section: title + optional eyebrow + body, with
     a hairline separator at the top instead of a box. Calmer than a
     stack of identical .card elements. */
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.section:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}
.section h2 {
  margin: 0 0 0.5rem;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.section-head h2 {
  margin: 0;
}

/* Grid of two columns for site-detail; collapses on narrow viewports. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
@media (max-width: 720px) {
  .split {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ---------- Buttons ---------- */

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  border-radius: var(--r-sm);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  transition: background 120ms ease, border-color 120ms ease, transform 60ms ease;
}
button:hover,
.btn:hover {
  background: var(--surface-soft);
  border-color: var(--ink-2);
  text-decoration: none;
}
button:active,
.btn:active {
  transform: translateY(1px);
}
button.primary,
.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.primary:hover,
.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button.danger,
.btn.danger,
.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: var(--surface);
}
button.danger:hover,
.btn.danger:hover,
.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}
button.small,
.btn.small {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
}
button.ghost,
.btn.ghost {
  border-color: transparent;
  background: transparent;
}
button.ghost:hover,
.btn.ghost:hover {
  background: var(--surface-soft);
  border-color: var(--border);
}

/* Focus-visible — every interactive element keeps a clear keyboard ring. */
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
a:focus-visible,
.pill:focus-visible,
.media-item:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

form.inline {
  display: inline;
}

/* ---------- Inputs ---------- */

label {
  display: block;
  margin-bottom: 1rem;
}
label > span {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--ink-2);
}
input[type="email"],
input[type="password"],
input[type="text"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font: inherit;
  background: var(--surface);
  color: var(--fg);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
/* Custom chevron for native <select> — the OS-default arrow looks out of
   place against the refined surface. SVG is inlined via data: URI so it
   matches the muted ink tone and stays self-hosted. */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%236e6e68' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 10px 6px;
}
select::-ms-expand {
  display: none;
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--ink-2);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}
textarea {
  font-family: var(--font-body);
  line-height: 1.5;
  resize: vertical;
}
input[type="file"] {
  padding: 0.45rem 0.5rem;
  background: var(--surface-soft);
  cursor: pointer;
}
/* Multi-column form grid — used on create-site and similar wider forms. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem 1.5rem;
  margin-bottom: 1.2rem;
}
.form-grid label {
  margin: 0;
}

/* ---------- Badges + pills + chips ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18em 0.6em;
  /* Soft tinted pill — modern dashboard treatment. The colour family is
     applied via the variant rules below using --*-soft backgrounds. */
  border-radius: 999px;
  border: 0;
  background: var(--archived-soft);
  color: var(--archived);
  vertical-align: middle;
  font-feature-settings: "kern";
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  opacity: 0.9;
}
.badge-live,
.badge-published {
  background: var(--ok-soft);
  color: var(--ok);
}
.badge-draft {
  background: var(--draft-soft);
  color: var(--draft);
}
.badge-archived {
  background: var(--archived-soft);
  color: var(--archived);
}

.pills {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-2);
  background: var(--surface);
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.pill:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
  color: var(--fg);
  text-decoration: none;
}
.pill.active {
  background: var(--fg);
  color: var(--surface);
  border-color: var(--fg);
}
.pill em {
  font-style: normal;
  opacity: 0.7;
  font-size: 0.85em;
}

/* ---------- Flash banners ---------- */

.flash {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 1.1rem;
  border-radius: var(--r-md);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.flash::before {
  /* Coloured side bar — gives the banner editorial weight without
     drowning the page in coloured backgrounds. */
  content: "";
  position: absolute;
  left: 0;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: currentColor;
}
.flash-ok {
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 22%, var(--border));
  color: var(--ok);
}
.flash-error {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
  color: var(--danger);
}

.error {
  color: var(--danger);
  margin-bottom: 1rem;
}

/* ---------- Tables ---------- */

table.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
table.table th,
table.table td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}
table.table tr:last-child td {
  border-bottom: 0;
}
table.table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface-soft);
}
table.table tbody tr:hover {
  background: var(--surface-soft);
}
table.table td {
  font-size: 0.95rem;
}
table.table td a {
  font-weight: 500;
}

/* ---------- Page editor ---------- */

.page-edit-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.page-edit-header h1 {
  margin: 0;
}

/* Compact variant — single row: back-arrow + title + status badge + meta
   on the left, actions on the right. Takes ~64 px instead of ~200 px. */
.page-edit-header-compact {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
}
.page-edit-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}
.page-edit-title h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28rem;
}
.page-edit-back {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  text-decoration: none;
  padding: 0.2rem 0.4rem;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.page-edit-back:hover {
  background: var(--surface-soft);
  color: var(--fg);
  text-decoration: none;
}
.page-edit-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 900px) {
  .page-edit-header-compact {
    flex-wrap: wrap;
  }
  .page-edit-meta {
    display: none;
  }
}
.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.save-status {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.save-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  opacity: 0.8;
}
.save-status[data-kind="ok"] {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 25%, var(--border));
}
.save-status[data-kind="pending"] {
  color: var(--draft);
  background: var(--draft-soft);
  border-color: color-mix(in srgb, var(--draft) 25%, var(--border));
}
.save-status[data-kind="error"] {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 25%, var(--border));
}

/* Generic data-kind colour for sibling status pills (upload, alt, picker)
   so success/error read at a glance. Specific rules above still win. */
[data-kind="ok"] {
  color: var(--ok);
}
[data-kind="pending"] {
  color: var(--draft);
}
[data-kind="error"] {
  color: var(--danger);
}

/* Editor page — escapes the `.container` max-width on this page only.
   The user complained the preview was cramped at 64rem; here we let it
   grow to 1800px on big monitors while keeping the same comfortable
   gutters on smaller screens. */
.editor-page {
  width: calc(100vw - 3rem);
  max-width: 1800px;
  margin-left: calc(50% - min(50vw, 900px) + 0rem);
  margin-right: 0;
}
@media (max-width: 1100px) {
  .editor-page {
    width: 100%;
    max-width: none;
    margin-left: 0;
  }
}

/* Editor layout — preview is the primary surface (~80% on a wide
   monitor), block list is a fixed narrow lane on the left. Block list
   still scrolls independently and shows the full hierarchy. */
.editor {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 1100px) {
  .editor {
    grid-template-columns: 1fr;
  }
}

/* Block selected from the preview iframe — gets a violet ring + smooth
   transition so it's obvious which block in the editor matches what
   you just clicked on the right. The ring fades after ~2 s. */
.block[data-block].block-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-md);
  animation: block-flash 2200ms ease-out forwards;
}
@keyframes block-flash {
  0% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.editor-blocks {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* Live preview pane — treated as the destination/source-of-truth.
   Inner "browser chrome" gives it a premium feel without being cute. */
.editor-preview {
  position: sticky;
  top: 5rem; /* Below the sticky topbar */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.preview-bar {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.preview-bar::before {
  /* Three faux window controls — quiet textural cue. */
  content: "";
  width: 38px;
  height: 9px;
  background:
    radial-gradient(circle, var(--border-strong) 0 3.5px, transparent 4px) 0 50% / 13px 9px no-repeat,
    radial-gradient(circle, var(--border-strong) 0 3.5px, transparent 4px) 50% 50% / 13px 9px no-repeat,
    radial-gradient(circle, var(--border-strong) 0 3.5px, transparent 4px) 100% 50% / 13px 9px no-repeat;
  flex-shrink: 0;
}
/* Preview frame wrap — centers the iframe AND constrains its width based
   on the viewport switcher. Tablet + mobile widths are emulated by
   narrowing the iframe; the inner page reflows responsively because the
   theme is real CSS. Desktop drops back to fill the column. */
.preview-frame-wrap {
  background: var(--bg);
  padding: 1rem 0.6rem;
  display: flex;
  justify-content: center;
}
.editor-preview[data-viewport="desktop"] .preview-frame-wrap {
  padding: 0;
  background: var(--surface);
}
.editor-preview iframe {
  width: 100%;
  height: 72vh;
  border: 0;
  display: block;
  background: #fff;
  transition: width 160ms ease, max-width 160ms ease;
}
.editor-preview[data-viewport="tablet"] iframe {
  /* 820 px ~= iPad portrait. Falls back to 100% if the column is narrower
     than that (small laptops in mobile-stacked mode). */
  max-width: 820px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2);
  border-radius: var(--r-md);
}
.editor-preview[data-viewport="mobile"] iframe {
  max-width: 390px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2);
  border-radius: var(--r-lg);
}

/* Viewport switcher buttons — three glyphs in a segmented group. Glyphs
   are drawn in CSS to avoid loading icon fonts/svg files. Active state
   uses the vermillion accent so the user always knows which viewport
   they're seeing. */
.viewport-switcher {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-left: auto;
}
.vp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3rem 0.65rem;
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--border-strong);
  border-radius: 0;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-body);
}
.vp-btn:last-child {
  border-right: 0;
}
.vp-btn:hover {
  background: var(--surface-soft);
  color: var(--fg);
}
.vp-btn-active,
.vp-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}
.vp-btn-active:hover,
.vp-btn[aria-pressed="true"]:hover {
  background: var(--accent-hover);
  color: #fff;
}
.vp-icon {
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 1.5px;
  position: relative;
  flex-shrink: 0;
}
.vp-icon-desktop {
  border-bottom-width: 3px;
}
.vp-icon-tablet {
  width: 11px;
  height: 14px;
  border-radius: 2px;
}
.vp-icon-mobile {
  width: 8px;
  height: 13px;
  border-radius: 2px;
}
.vp-icon-mobile::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 1px;
  background: currentColor;
}
/* Hide labels on narrow columns so the switcher stays compact. */
@media (max-width: 1240px) {
  .vp-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
.preview-bar-label {
  white-space: nowrap;
}

/* Block list — the workshop side. */
.block-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.block:hover {
  border-color: var(--border-strong);
}
.block-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-soft);
  border-radius: var(--r-md) var(--r-md) 0 0;
  cursor: pointer;
  user-select: none;
}
.block-collapsed .block-bar {
  border-bottom-color: transparent;
  border-radius: var(--r-md);
}
.block-type-chip {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1em 0.55em;
  white-space: nowrap;
  flex-shrink: 0;
}
.block-hint {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.block-hint:empty::before {
  content: "Sin contenido aún";
  color: var(--muted-2);
  font-weight: 400;
  font-style: italic;
}
.block-bar-spacer {
  flex-shrink: 0;
}
.block-collapse-toggle {
  background: none;
  border: 0;
  padding: 0.2rem 0.35rem;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-sm);
}
.block-collapse-toggle:hover {
  background: var(--surface);
  color: var(--fg);
}
.block-collapse-chevron {
  display: inline-block;
  transition: transform 160ms ease;
  font-size: 0.8rem;
  line-height: 1;
}
.block-collapsed .block-collapse-chevron {
  transform: rotate(-90deg);
}
.block-collapsed .editor-body {
  display: none;
}
.drag-handle {
  cursor: grab;
  color: var(--muted-2);
  font-size: 1.1em;
  user-select: none;
  padding: 0 0.25rem;
}
.drag-handle:active {
  cursor: grabbing;
}
.block-type {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--fg);
}
.remove-block {
  padding: 0.1rem 0.55rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--muted);
  border: 1px solid transparent;
  background: transparent;
}
.remove-block:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 25%, var(--border));
}
.editor-body {
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.editor-body .field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.editor-body fieldset.field {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.9rem;
  margin: 0;
}
.editor-body legend {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.4em;
}
.editor-body label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.editor-body label.cb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
  font-size: 0.9em;
}
.editor-body input[type="text"],
.editor-body textarea,
.editor-body select {
  width: 100%;
}
.editor-body .row {
  display: flex;
  gap: 0.5rem;
}
.editor-body .row > * {
  flex: 1;
}
.editor-body .small {
  font-size: 0.8em;
}

/* Card-edit (cards_grid sub-items): tinted to read as nested. */
.cards-edit {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.card-edit {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Read-only block list (viewer role). */
.block-list-readonly {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 1.2rem 1.4rem;
}
.block-list-readonly ol {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}
.block-list-readonly li {
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.block-list-readonly li:last-child {
  border-bottom: 0;
}
.block-summary li > span:nth-child(2) {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--fg);
}

/* Editor empty state — shown on a brand-new page with zero blocks. */
.block-empty {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 2.5rem 2rem;
  text-align: center;
}
.block-empty .eyebrow {
  margin: 0 0 0.5rem;
}
.block-empty p {
  color: var(--muted);
  max-width: 28rem;
  margin: 0.4rem auto;
}
.block-empty h3 {
  margin: 0.4rem 0 0.2rem;
  font-size: 1.15rem;
  color: var(--ink, var(--fg));
}
.block-empty-art {
  margin: 0 auto 0.4rem;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.block-empty-quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 1.2rem auto 0;
  max-width: 36rem;
}
@media (max-width: 640px) {
  .block-empty-quick {
    grid-template-columns: 1fr;
  }
}
.block-empty-shortcut {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.block-empty-shortcut:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px -8px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}
.block-empty-shortcut:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.block-empty-shortcut strong {
  font-size: 0.92rem;
}
/* Hide the empty state the moment editor.js inserts a real .block sibling.
   :has() is supported in all current browsers; the fallback is a
   superfluous (but harmless) hint above the new block. */
.block-list:has(.block) .block-empty {
  display: none;
}

/* "+ Añadir bloque" — was a thin row; now a confident full-width band. */
.add-block {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.8rem 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  margin-top: 0.3rem;
}
.add-block select {
  flex: 1;
}
.block-ghost {
  opacity: 0.4;
}

/* ---------- Media library ---------- */

.media-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}
.media-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-1);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.media-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
}
.media-item img {
  width: 100%;
  height: 11rem;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: repeating-linear-gradient(45deg, var(--surface-soft) 0 6px, var(--bg) 6px 12px);
}
.media-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0 0.2rem 0.2rem;
}
.media-meta code {
  font-size: 0.72rem;
  word-break: break-all;
  background: var(--surface-soft);
  color: var(--ink-2);
  border: 1px solid var(--border);
  padding: 0.12em 0.4em;
}
.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.media-actions button {
  padding: 0.32rem 0.6rem;
  font-size: 0.8rem;
}
/* Upload form on the media library — single row, input + button side-by-side. */
.upload-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.upload-form input[type="file"] {
  flex: 1 1 16rem;
  width: auto;
}

/* Alt-by-locale editor: refined inline panel, not a utility form. */
.alt-edit {
  margin-top: 0.7rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  box-shadow: inset 0 1px 0 var(--surface);
}
.alt-edit label {
  display: block;
  margin: 0 0 0.6rem;
}
.alt-edit label span {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.alt-edit input[type="text"] {
  padding: 0.45rem 0.6rem;
  font-size: 0.92rem;
}
.alt-edit .row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

/* Pagination — assertive but quiet, tabular numbers. */
.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.pagination .btn {
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.pagination .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--surface-soft);
  color: var(--muted);
  border-color: var(--border);
}
.pagination .muted.small {
  letter-spacing: 0.04em;
}

/* ---------- Image picker modal ---------- */

.image-picker-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.image-picker-row input[type="text"] {
  flex: 1;
}
.image-picker-row .pick-image {
  white-space: nowrap;
  background: var(--surface);
}

.image-picker-modal {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, #1a1a17 55%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.image-picker-modal[hidden] {
  display: none;
}
.picker-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: min(60rem, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.picker-header h2 {
  margin: 0;
  font-size: 1.1rem;
}
.picker-close {
  background: transparent;
  border: 1px solid transparent;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  border-radius: var(--r-sm);
}
.picker-close:hover {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--fg);
}
.picker-upload {
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-soft);
}
.picker-drop {
  flex: 1;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 1.1rem 1rem;
  text-align: center;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 0.92rem;
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}
.picker-drop input[type="file"] {
  display: none;
}
.picker-drop:hover {
  border-color: var(--accent);
}
.picker-drop.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.picker-grid-wrap {
  padding: 1rem 1.3rem 1.3rem;
  overflow-y: auto;
}
.picker-grid-wrap .media-item {
  cursor: pointer;
  padding: 0.4rem;
}
.picker-grid-wrap .media-item img {
  height: 9rem;
}
.picker-grid-wrap .media-item:hover,
.picker-grid-wrap .media-item:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: var(--shadow-2);
}

/* ---------- Site configuration forms (locales / domains / status) ---------- */

.row-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.8rem;
}
.row-form input[type="text"],
.row-form select {
  width: auto;
  flex: 1 1 14rem;
}
.inline-actions {
  display: inline-flex;
  gap: 0.35rem;
  margin-left: 0.6rem;
}

.domains-list,
.locales-list,
.translations-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.translations-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.translations-list li:last-child {
  border-bottom: 0;
}
.translations-list li > code {
  min-width: 3.5rem;
  text-align: center;
}
.domains-list li,
.locales-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.domains-list li:last-child,
.locales-list li:last-child {
  border-bottom: 0;
}
.locale-info,
.domain-info {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--ink-2);
}

/* details/summary used for owner-only config sections — feel like an
   editorial accordion, not a default disclosure widget. */
details.section-acc {
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
details.section-acc summary {
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  background: var(--surface-soft);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}
details.section-acc summary::-webkit-details-marker {
  display: none;
}
/* Disclosure glyph built from CSS shapes — a horizontal bar plus a
   rotating vertical bar — so it renders identically regardless of which
   serif/sans the user's OS exposes for U+2212. */
details.section-acc summary::after {
  content: "";
  margin-left: auto;
  width: 12px;
  height: 12px;
  position: relative;
  flex-shrink: 0;
  background: linear-gradient(var(--muted) 0 0) center / 100% 1.5px no-repeat,
    linear-gradient(var(--muted) 0 0) center / 1.5px 100% no-repeat;
  transition: transform 150ms ease, opacity 150ms ease;
}
details.section-acc[open] summary::after {
  /* Hide the vertical bar — leaves the horizontal one as a "−". */
  background: linear-gradient(var(--muted) 0 0) center / 100% 1.5px no-repeat;
}
details.section-acc[open] summary {
  border-bottom: 1px solid var(--border);
}
details.section-acc > :not(summary) {
  padding: 1rem 1.1rem 1.1rem;
}

/* Default details (still used in editor templates) — softer treatment. */
details {
  margin-bottom: 1rem;
}
details > summary {
  cursor: pointer;
  padding: 0.35rem 0;
}
details[open] > summary {
  margin-bottom: 0.5rem;
}

/* ---------- Page counts pill (site detail "Páginas" section) ---------- */

.page-counts {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  color: var(--ink-2);
  margin: 0 0 0.8rem;
}
.page-counts strong {
  font-weight: 600;
  color: var(--fg);
}
.page-counts .pc-divider {
  width: 1px;
  height: 1rem;
  background: var(--border);
  display: inline-block;
}

/* ---------- Action panels (site detail destination cards) ---------- */

.action-panel {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: var(--shadow-1);
  text-decoration: none;
  color: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.action-panel:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
  text-decoration: none;
}
.action-panel .eyebrow {
  margin: 0 0 0.25rem;
}
.action-panel h3 {
  font-family: var(--font-display);
  margin: 0 0 0.35rem;
}
.action-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Stacks of action panels (sidebar config). */
.panel-stack {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
/* Two-column grid of destination panels — used on site detail "Trabajo". */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 0.5rem 0 0;
}
/* Hosting split: preview URL + domains list side by side. */
.hosting-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 2rem;
  margin-top: 0.5rem;
}
@media (max-width: 720px) {
  .hosting-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Spacing utilities — used by templates to keep things lined up. */
.card-spaced {
  margin-top: 2.5rem;
}
.card-spaced-sm {
  margin-top: 1.5rem;
}
.pills-spaced {
  margin-bottom: 1.2rem;
}

/* ---------- Login + error pages ---------- */

.login-card .eyebrow {
  margin: 0 0 0.25rem;
}
.login-card h1 {
  font-size: 1.8rem;
  margin: 0 0 1.4rem;
}

.error-card {
  text-align: center;
  margin-top: 5rem;
  padding: 3rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.error-status {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 600;
  margin: 0;
  color: var(--accent);
  letter-spacing: -0.04em;
  line-height: 1;
}
.error-card h1 {
  font-size: 1.5rem;
  margin: 0.5rem 0 0.5rem;
}
.error-card p {
  margin: 0 auto 1.2rem;
  max-width: 30rem;
}

/* ---------- Responsive tail ---------- */

@media (max-width: 700px) {
  .container {
    margin: 1.5rem auto 3rem;
    padding: 0 1rem;
  }
  .hero {
    padding-bottom: 1.2rem;
    margin-bottom: 1.8rem;
  }
  .topbar {
    padding: 0.75rem 1rem;
  }
  .editor-preview iframe {
    height: 55vh;
  }
}
@media (max-width: 480px) {
  .editor-body .row {
    flex-direction: column;
    align-items: stretch;
  }
  .editor-body .row > * {
    flex: none;
  }
  .image-picker-row {
    flex-wrap: wrap;
  }
  .picker-grid-wrap .media-item img {
    height: 7.5rem;
  }
  h1 {
    font-size: 1.7rem;
  }
}

/* Reduced motion — strip transitions for users who request it. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .site-card:hover,
  .media-item:hover,
  .action-panel:hover {
    transform: none;
  }
}

/* ---------- Block-type picker (modal opened by `+ Añadir bloque`) ---------- */

/* "+ Añadir bloque" button — sans, calmer weight, modern CTA proportions. */
.block-add-btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0;
  padding: 0.6rem 1.1rem;
}
.block-add-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2em;
  height: 1.2em;
  font-size: 1.1em;
  line-height: 1;
  margin-right: 0.3em;
}

/* Modal scaffolding — same overlay treatment as the image picker so
   the two pickers feel consistent. */
.block-picker-modal {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--fg) 55%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
}
.block-picker-modal[hidden] {
  display: none;
}
.block-picker-card {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--r-lg);
  width: min(58rem, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.block-picker-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.1rem 1.4rem 0.6rem;
}
.block-picker-header h2 {
  margin: 0;
}
.block-picker-close {
  background: none;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  color: var(--ink-2);
}
.block-picker-close:hover {
  color: var(--accent);
  background: none;
}
.block-picker-lede {
  padding: 0 1.4rem 1rem;
  margin: 0;
}

/* Grid of tiles — one per block type. Each tile is a button containing
   an SVG schematic of what the block lays out + a name + a 1-line
   description. The schematic is the differentiator: text labels alone
   left users guessing. */
.block-picker-grid {
  list-style: none;
  margin: 0;
  padding: 0 1.4rem 1.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  overflow-y: auto;
}
.block-picker-tile {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 0.9rem 0.9rem 1rem;
  cursor: pointer;
  text-align: left;
  align-items: stretch;
  width: 100%;
  font: inherit;
  color: var(--fg);
  transition: transform 100ms ease, box-shadow 100ms ease, border-color 100ms ease;
}
.block-picker-tile:hover,
.block-picker-tile:focus-visible {
  border-color: var(--accent);
  box-shadow: 2px 2px 0 var(--accent);
  transform: translate(-2px, -2px);
}
.block-picker-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--surface-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.block-picker-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}
.block-picker-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.block-picker-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.block-picker-desc {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

@media (max-width: 600px) {
  .block-picker-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Page edit: locale chips in the header ---------- */

.page-edit-locales {
  display: inline-flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  align-items: center;
  margin-left: 0.4rem;
}
.locale-chip {
  display: inline-flex;
  align-items: center;
  font: 500 0.72rem / 1 var(--font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25em 0.65em;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
}
.locale-chip:hover {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border-strong);
  text-decoration: none;
}
.locale-chip-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: default;
}
.locale-chip-active:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.locale-chip-add {
  border-style: dashed;
  color: var(--accent);
  background: transparent;
}
.locale-chip-add:hover {
  background: var(--accent-soft);
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* ---------- Page settings drawer ---------- */

.page-settings-drawer {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.page-settings-drawer[hidden] {
  display: none;
}
.page-settings-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--fg) 35%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: auto;
}
.page-settings-panel {
  position: relative;
  width: min(28rem, 100%);
  max-height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  animation: page-settings-slide 220ms cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes page-settings-slide {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
.page-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
.page-settings-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.page-settings-close {
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  color: var(--muted);
  border-radius: var(--r-sm);
}
.page-settings-close:hover {
  color: var(--fg);
  background: var(--surface-soft);
}
.page-settings-section {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--rule);
}
.page-settings-section:last-child {
  border-bottom: 0;
}
.page-settings-section h3 {
  margin: 0 0 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.page-settings-field {
  display: block;
  margin-bottom: 0.85rem;
}
.page-settings-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 0.3rem;
}
.page-settings-field input[type="text"] {
  width: 100%;
}
.page-settings-actions {
  margin-top: 0.6rem;
}
.page-settings-translations {
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.page-settings-translations li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  background: var(--surface-soft);
  border-radius: var(--r-sm);
}
.page-settings-translations li a,
.page-settings-translations li strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-settings-section-danger {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

/* ---------- Page-create starter templates ---------- */

.page-template-fieldset {
  border: 0;
  padding: 0;
  margin: 1.4rem 0 0.6rem;
}
.page-template-fieldset legend {
  font-weight: 500;
  font-size: 0.92rem;
  margin-bottom: 0.7rem;
  color: var(--fg);
  padding: 0;
}
.page-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.7rem;
}
.page-template-tile {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.7rem 0.7rem 0.85rem;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 100ms ease;
  position: relative;
}
.page-template-tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.page-template-tile input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.page-template-tile:has(input[type="radio"]:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.page-template-preview {
  display: block;
  background: var(--surface-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.page-template-preview svg {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
}
.page-template-name {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.005em;
}
.page-template-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

/* ---------- palette editor (site config) ---------- */
/* Three swatch tiles + 8 quick presets. Lives inside the existing
   `details.section-acc` so it folds away by default. The live-preview
   "Aa" square shows the readable-text colour the renderer will compute
   (white or near-black, picked by relative luminance). */
.palette-form {
  display: grid;
  gap: 1.2rem;
  margin-top: .8rem;
}
.palette-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 720px) {
  .palette-grid {
    grid-template-columns: 1fr;
  }
}
.palette-swatch {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  background: #fff;
  display: grid;
  gap: 0.55rem;
}
.palette-label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.palette-preview {
  height: 5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 1.8rem / 1 system-ui, sans-serif;
  letter-spacing: 0.02em;
}
.palette-input-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.5rem;
  align-items: center;
}
.palette-input-row input[type="color"] {
  width: 100%;
  height: 2.2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 0;
  cursor: pointer;
}
.palette-input-row input[type="text"] {
  font-family: ui-monospace, SFMono-Regular, monospace;
  text-transform: lowercase;
}
.palette-contrast {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.palette-contrast[data-level="aaa"] {
  color: #15803d;
}
.palette-contrast[data-level="aa"] {
  color: #1d4ed8;
}
.palette-contrast[data-level="low"] {
  color: #b91c1c;
}

.palette-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding-top: .4rem;
  border-top: 1px dashed var(--border);
}
.palette-presets > .muted {
  width: 100%;
  margin: 0 0 .2rem;
}
.palette-preset {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}
.palette-preset:hover {
  border-color: var(--accent);
}
.palette-preset-swatches {
  display: inline-flex;
  gap: 0.12rem;
}
.palette-preset-swatches i {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  display: block;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Row of actions under the palette form — primary save + ghost reset. */
.palette-actions {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
}

/* ---------- block colour-role ---------- */
/* Top-of-form swatch radio group: 3 circular swatches tinted with the
   site's actual palette colours (emitted as --admin-site-{role} CSS vars
   at the top of admin-page-edit.njk). When the user clicks one, the
   block's data-color-role attribute updates so the bar-dot reflects the
   choice without expanding the block. */
.field-color-role {
  margin: 0 0 0.9rem;
  padding: 0.6rem 0.75rem;
  background: var(--soft, #f6f8fb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.field-color-label {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.role-swatches {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.role-swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.role-swatch input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.role-swatch-dot {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}
.role-swatch-primary .role-swatch-dot {
  background: var(--admin-site-primary, #2563eb);
}
.role-swatch-secondary .role-swatch-dot {
  background: var(--admin-site-secondary, #f59e0b);
}
.role-swatch-tertiary .role-swatch-dot {
  background: var(--admin-site-tertiary, #10b981);
}
.role-swatch:hover {
  border-color: var(--border);
}
.role-swatch:has(input:checked) {
  border-color: var(--accent);
  background: #eef2ff;
}
.role-swatch:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tiny coloured dot in the collapsed block bar — reads the block's
   current data-color-role attribute and shows the matching palette
   colour. Only the 6 blocks with roles get a dot; the rest hide it. */
.block-role-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  display: inline-block;
}
.block[data-color-role="primary"] .block-role-dot {
  background: var(--admin-site-primary, #2563eb);
}
.block[data-color-role="secondary"] .block-role-dot {
  background: var(--admin-site-secondary, #f59e0b);
}
.block[data-color-role="tertiary"] .block-role-dot {
  background: var(--admin-site-tertiary, #10b981);
}
/* Hide the dot for block types that don't expose a role. */
.block[data-block-type="spacer"] .block-role-dot,
.block[data-block-type="embed"] .block-role-dot,
.block[data-block-type="gallery"] .block-role-dot,
.block[data-block-type="divider"] .block-role-dot,
.block[data-block-type="nav_links"] .block-role-dot,
.block[data-block-type="faq"] .block-role-dot,
.block[data-block-type="testimonials"] .block-role-dot,
.block[data-block-type="rich_text"] .block-role-dot {
  display: none;
}
/* Same blocks: hide the colour-role field if the schema doesn't expose
   it. (Defensive — the partial is only included by the 6 affected
   editor templates, but if someone wires it elsewhere by mistake the
   row won't appear.) */
.block[data-block-type="spacer"] .field-color-role,
.block[data-block-type="embed"] .field-color-role,
.block[data-block-type="gallery"] .field-color-role,
.block[data-block-type="divider"] .field-color-role,
.block[data-block-type="nav_links"] .field-color-role,
.block[data-block-type="faq"] .field-color-role,
.block[data-block-type="testimonials"] .field-color-role,
.block[data-block-type="rich_text"] .field-color-role {
  display: none;
}

/* ---------- drag-and-drop image upload ---------- */
/* The image-field fieldset (and the inline cards_grid / gallery
   picker rows) accept a dropped file. Highlight kicks in via the
   `image-dragover` class while a drag is hovering. The drop hint
   stays hidden by default and only animates in on dragenter. */
[data-image-dropzone] {
  position: relative;
  transition: border-color 100ms ease, background 100ms ease;
}
[data-image-dropzone].image-dragover {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.image-drop-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.6;
  font-style: italic;
}
[data-image-dropzone].image-dragover .image-drop-hint {
  opacity: 1;
  color: var(--accent);
  font-style: normal;
  font-weight: 600;
}
.image-upload-status {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
}
.image-upload-status[data-kind="pending"] {
  color: var(--muted);
}
.image-upload-status[data-kind="ok"] {
  color: #15803d;
}
.image-upload-status[data-kind="error"] {
  color: #b91c1c;
}

/* ---------- block picker search ---------- */
.block-picker-search-field {
  display: block;
  margin: 0.4rem 0 1rem;
}
.block-picker-search-field input[type="search"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  background: var(--bg, #fff);
}
.block-picker-search-field input[type="search"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.block-picker-empty {
  text-align: center;
  color: var(--muted);
  padding: 1.6rem 1rem;
  margin: 0;
  font-size: 0.92rem;
}
/* Visually-hidden helper for accessible labels. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- href validation warning ---------- */
/* Tiny inline hint surfaced under a CTA href input when the editor
   types `/something` that doesn't match any existing page slug on
   this site. Doesn't block save — Zod still accepts any safe path —
   just nudges the user before they publish a dead link. */
.href-warning {
  display: block;
  margin: 0.3rem 0 0;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
  border-left: 2px solid #f59e0b;
  border-radius: 4px;
  line-height: 1.4;
}
input.has-missing-target {
  border-color: #f59e0b;
}

/* "Reintentar" button shown inside the status pill after autosave
   retries are exhausted. Inline so it stays in the user's eye-line
   instead of buried in a banner; styled as a subtle link-ish button. */
.save-status-retry {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.save-status-retry:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
