/* App fonts (loaded only on pages that use this stylesheet — the lander is self-contained and
   keeps its own Helvetica). fridaymap.com uses the paid Adobe fonts Stolzl (geometric sans) +
   Adelle (slab serif); these are close FREE stand-ins: Outfit (≈ Stolzl) body, Zilla Slab
   (≈ Adelle) headings. */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300..800&family=Zilla+Slab:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  /* Giant Goldfish palette: #69D2E7 #A7DBD8 #E0E4CC #F38630 #FA6900 */
  --bg: #f7f4e8;        /* light cream (from E0E4CC) */
  --ink: #2a2018;       /* warm near-black */
  --muted: #857a68;     /* warm muted */
  --line: #e6e2ce;      /* soft cream border */
  --accent: #fa6900;    /* red-orange (primary) */
  --accent-dark: #e05d00;
  --panel: #ffffff;
  --page: #fa6900;      /* orange page background */
  --bar: #f2700f;       /* orange for the bars */
  --bar-edit: #f2700f;  /* edit bar matches the top bar (same colour) */
  --on-bg: #fff4e6;     /* light text on orange */
  /* Palette accents for reuse */
  --gold: #f38630;      /* amber */
  --sky: #69d2e7;       /* sky blue */
  --teal: #a7dbd8;      /* pale teal */
  --cream: #e0e4cc;     /* cream */
}

* {
  box-sizing: border-box;
}

html, body {
  /* Never let a stray wide element make the whole page scroll sideways on mobile. */
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "stolzl", sans-serif;
  font-weight: 400;
  font-style: normal;  color: var(--on-bg);
  background: var(--page);

}

/* Slab-serif headings (≈ Adelle) over the geometric-sans body (the wordmark keeps its Helvetica). */
h1, h2, h3, h4, h5, h6 {
  font-family: "stolzl", sans-serif;
  font-weight: 500;
  letter-spacing: -0.01em;
}

h2 {
  padding-top: 2rem;
}

.app-header {
  width: 100%;
  border-bottom: 1px solid rgba(255, 244, 230, 0.18);
  background: var(--bar); /* dark orange, white text */
}

.header-inner {
  width: 90%;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  color: #fff4e6;
  /* Match the lander's big "GOATEDWEBSITE.COM" wordmark style, incl. its amber extrusion. */
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-shadow: -0.14em 0.14em 0 #9c3e1c;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  white-space: nowrap;
}
.brand-mark {
  width: 1.35em;
  height: 1.35em;
  flex: 0 0 auto;
  /* Light "whitey-orange" version of the favicon so it reads on the orange bar (no tile),
     with the same hard extrusion shadow as the wordmark (drop-shadow = text-shadow for SVG). */
  filter: drop-shadow(-0.14em 0.14em 0 #9c3e1c);
}

/* Brand alone on the left; everything else clusters on the far right. */
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-grid {
  margin: 0;
  display: flex;
  gap: 8px;
}

.github-button:hover { background: var(--accent-dark); }

/* "Your site" standalone button — shown in the top bar on desktop; a warm-white extruded pill
   with orange text. (On mobile it's hidden and the dropdown's "Your site" row shows instead.) */
.header-site-link {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  color: var(--accent);
  background: #fff4e6;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transform: translateY(-3px);
  box-shadow: 0 3px 0 #a84f0d;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.header-site-link:hover { transform: translateY(0); box-shadow: 0 0 0 #a84f0d; }
.header-site-ic { width: 15px; height: 15px; flex: 0 0 auto; }
/* "No live site" — muted, not clickable. */
.header-site-link.is-disabled,
.header-site-link.is-disabled:hover {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  cursor: default;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}
/* The dropdown's "Your site" row is redundant on desktop (the top-bar button covers it). The
   descendant selector outweighs the base .header-menu-item { display:flex } rule below. */
.header-menu-panel .header-menu-site { display: none; }

/* Header "Sign up" — white on the orange bar (primary sign-up CTA). */
.header-btn:not(.header-btn--ghost) { background: #fff; color: var(--accent); }
.header-btn:not(.header-btn--ghost):hover { background: var(--on-bg); }

/* Right-side account cluster: username + a generic dropdown icon, or log in / sign up. */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-username {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}
.header-btn--ghost {
  background: transparent;
  color: #fff4e6;
  border: 1px solid rgba(255, 244, 230, 0.3);
}
.header-btn--ghost:hover { background: rgba(255, 244, 230, 0.12); }

/* Account dropdown — opens on hover of the icon (or the menu), closes when the cursor leaves. */
.header-menu {
  position: relative;
  display: flex;
  align-items: center;
}

/* One merged box: username + hamburger icon; the whole box opens the menu on hover. */
.header-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  min-width: 150px;
  max-width: 240px;
  padding: 0 12px;
  border: 1px solid rgba(255, 244, 230, 0.5);
  border-radius: 8px;
  background: transparent;
  color: var(--on-bg);
  font: inherit;
  cursor: pointer;
}
.header-menu-btn:hover { background: rgba(255, 244, 230, 0.14); }
.header-menu-btn .header-username { flex: 1; text-align: left; color: var(--on-bg); }
.header-menu-btn svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--on-bg); }

.header-menu-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 100%;        /* never wider than the box itself */
  margin-top: 6px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(24, 32, 27, 0.14);
  z-index: 300;
  display: none;
  flex-direction: column;
}
/* Bridge the gap so moving from the box to the panel keeps the hover. */
.header-menu::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 8px;
}
.header-menu:hover .header-menu-panel,
.header-menu:focus-within .header-menu-panel { display: flex; }

.header-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.header-menu-item:hover { background: var(--bg); }
.header-menu-logout { color: #b73535; }
/* "No live site" — shown but not clickable. */
.header-menu-item.is-disabled { color: var(--muted); cursor: default; }
.header-menu-item.is-disabled:hover { background: none; }
.header-menu-item.is-disabled .header-menu-ic { color: var(--muted); }

.header-menu-ic {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--muted);
}
.header-menu-logout .header-menu-ic { color: #b73535; }

/* Mobile: move "Your site" into the dropdown so the bar is just the wordmark + the account
   menu. Collapse the menu to its icon (hide the username) and use the full width so the
   wordmark keeps its full size and nothing wraps to a second line. */
@media (max-width: 560px) {
  .header-inner { width: 100%; padding: 10px 14px; gap: 10px; flex-wrap: nowrap; }
  .header-site-link { display: none !important; }  /* lives in the dropdown on mobile */
  .header-menu-panel .header-menu-site { display: flex; }  /* ...where this row now shows */
  .header-menu-btn { min-width: 0; padding: 0 9px; }
  .header-menu-btn .header-username { display: none; }
  /* Panel is normally as wide as the button; the icon-only button is too narrow, so give the
     menu its own width (anchored to the right edge, it opens leftward). */
  .header-menu-panel { width: auto; min-width: 180px; }
  /* Keep the logged-out CTAs compact so they fit alongside the wordmark too. */
  .header-btn { padding: 0 12px; }
}

.status-item {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.status-item dt {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.status-item dd {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-item dd::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

.status-item[data-state="ok"] dd::before {
  background: #14824f;
}

.status-item[data-state="pending"] dd::before {
  background: #c47a16;
}

.status-item[data-state="bad"] dd::before {
  background: #b73535;
}

.shell {
  width: min(100%, 760px);
  min-height: calc(100vh - 78px);
  margin: 0 auto;
  padding: 32px 20px;
  display: grid;
  place-items: center;
}

.panel {
  width: min(100%, 520px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(24, 32, 27, 0.10);
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  margin: 0 0 28px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.button,
.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.button {
  padding: 0 18px;
  color: white;
  background: var(--accent);
  border: none;
}

.panel > .button {
  width: 100%;
}

.panel > .button + .button {
  margin-top: 10px;
}

.button:hover {
  background: var(--accent-dark);
}

.github-button {
  width: 100%;
  margin-top: 22px;
  background: #24292f;
}

/* Landing / marketing entry page */
.landing {
  width: min(100%, 600px);
  text-align: center;
  padding: 48px 40px;
}

.landing-title {
  font-size: 2.6rem;
  margin-bottom: 16px;
}

.landing-sub {
  margin: 0 auto 28px;
  max-width: 460px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 1.05rem;
}

.landing-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.landing-actions .button {
  width: auto;
  min-width: 180px;
  margin: 0;
}

.landing-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 460px;
  margin: 18px auto 0;
  text-align: left;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}

.landing-consent-text {
  cursor: pointer;
}

/* Sign-up page */
.signup {
  width: min(100%, 560px);
  text-align: center;
  padding: 44px 40px;
}

.signup .landing-consent {
  margin: 24px auto;
}

.signup-back {
  display: inline-block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.signup-back:hover {
  color: var(--ink);
}

.landing-consent input {
  margin-top: 2px;
  flex: none;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.landing-consent a {
  color: var(--accent);
  font-weight: 600;
}

.landing-consent-flash {
  color: var(--ink);
}
.landing-consent-flash input {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.button.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Publishing / loading page */
.publishing {
  text-align: center;
}

.publishing-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin: 24px 0 16px;
}

.publishing-bar-fill {
  height: 100%;
  width: 8%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.6s ease;
}

.publishing-status {
  margin: 0 0 8px;
  color: var(--ink);
  font-weight: 600;
}

.publishing-tip {
  margin: 0;
  min-height: 1.3em;
  color: var(--muted);
  font-size: 0.85rem;
}

.publishing-fallback {
  display: inline-block;
  margin-top: 20px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.publishing-fallback:hover {
  text-decoration: underline;
}

.notice {
  margin: -8px 0 18px;
  padding: 12px 14px;
  border: 1px solid #d8d0c2;
  border-radius: 8px;
  background: #fbf7ed;
  color: #594b2f;
  line-height: 1.45;
}

.template-picker {
  margin: 4px 0 22px;
  max-height: min(60vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.field-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.template-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.template-option {
  width: 100%;
  min-height: 148px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: end;
  gap: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.template-option:hover,
.template-option[data-selected="true"] {
  border-color: var(--accent);
}

.template-option[data-selected="true"] {
  background: linear-gradient(180deg, #f6fffb 0%, #ffffff 72%);
  box-shadow: inset 0 0 0 1px rgba(250, 105, 0, 0.04);
}

.template-option::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 60px;
  background:
    linear-gradient(135deg, rgba(250, 105, 0, 0.12), rgba(24, 32, 27, 0)),
    linear-gradient(180deg, rgba(24, 32, 27, 0.04), rgba(24, 32, 27, 0));
}

.template-name {
  position: relative;
  font-size: 0.98rem;
  font-weight: 800;
}

.template-description {
  position: relative;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}


.status {
  min-height: 22px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.result {
  display: grid;
  gap: 12px;
}

.primary-link,
.secondary-link {
  width: 100%;
  min-width: 0;
  padding: 0 14px;
  overflow-wrap: anywhere;
}

.primary-link {
  color: white;
  background: var(--accent);
}

.secondary-link {
  color: var(--accent-dark);
  border: 1px solid var(--line);
}

@media (max-width: 520px) {
  .status-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 26px;
  }

  h1 {
    font-size: 2rem;
  }
}

/* On the editor page the body is a viewport-tall flex column: the app-header takes its
   natural height and the editor fills the exact remainder. A *definite* height (not
   min-height) is required so the nested flex:1 → iframe heights resolve and the iframe
   actually fills — otherwise it collapses and the orange page background shows below. */
body.pe-editing {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.pe-editing > [data-view="editor"] {
  flex: 1 1 auto;
  min-height: 0;
}

[data-view="editor"] {
  width: 100%;
  display: flex;
  flex-direction: column;
}

[data-view="editor"].hidden {
  display: none !important;
}

.editor-header {
  position: relative;
  padding: 10px 20px;
  /* No bottom border: the white active tab meets the white page below with no orange line. */
  background: var(--bar-edit);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  /* One row: the tab strip shrinks to stay beside the controls (see .editor-page-tabs).
     On narrow screens a media query stacks the controls above the tabs instead. */
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* ---- Dark-orange edit bar: recolor its controls to light-on-orange.
   (Dropdown panels that open below the bar are white cards and keep their
   own dark text — only the in-bar triggers are recolored here.) ---- */
/* Page tabs look like browser tabs sitting at the bottom of the bar: the open page is a
   solid white tab; the others are white-outlined and let the orange bar show through. */
.editor-header .editor-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  min-width: 0; /* allow the tab to shrink so many tabs stay on one row */
  overflow: hidden; /* keep contents inside a tight tab (icons never spill off) */
  color: var(--on-bg);
  background: transparent;
  border: 1px solid rgba(255, 244, 230, 0.5);
  border-radius: 9px 9px 0 0;
  transition: flex-basis 0.2s ease, flex-grow 0.2s ease,
    background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Momentary state used to measure natural tab widths (see updateTabCrowding). */
.pe-tabs-measuring .editor-tab { flex: 0 0 auto; }

/* Crowded strip (too many tabs to fit): they shrink to equal widths, and hovering one
   smoothly magnifies it — glide across the "forest" to read/click any tab. */
.pe-tabs-crowded .editor-tab { flex: 1 1 0; }
.pe-tabs-crowded .editor-tab:hover,
.pe-tabs-crowded .editor-tab--active { flex-basis: 6.5rem; flex-grow: 1.6; }
/* The "+ add page" tab stays a fixed size — it must not stretch or magnify on hover. */
.pe-tabs-crowded .editor-tab-add { flex: 0 0 auto; }
.pe-tabs-crowded .editor-tab-add:hover { flex-basis: auto; flex-grow: 0; }

/* Tight tabs: hide the per-tab icons so they can't slide off the tab. The magnified
   (hovered / open) tab has room, so its icons reappear. */
.pe-tabs-crowded .editor-tab-icon,
.pe-tabs-crowded .editor-tab-homemark { display: none; }
.pe-tabs-crowded .editor-tab:hover .editor-tab-icon,
.pe-tabs-crowded .editor-tab--active .editor-tab-icon,
.pe-tabs-crowded .editor-tab:hover .editor-tab-homemark,
.pe-tabs-crowded .editor-tab--active .editor-tab-homemark { display: inline-flex; }
.editor-header .editor-tab:hover {
  background: rgba(255, 244, 230, 0.16);
  color: var(--on-bg);
  border-color: var(--on-bg);
}
/* The open tab takes the user's page background so it reads as connected to the page below
   (--tab-bg is set from the preview's actual background; defaults to white). */
.editor-header .editor-tab--active {
  background: var(--tab-bg, #fff);
  color: var(--accent);
  border-color: var(--tab-bg, #fff);
}
.editor-header .editor-tab-add { color: var(--on-bg); }
.editor-header .editor-tab-add:hover { background: rgba(255, 244, 230, 0.16); color: var(--on-bg); }
.editor-header .editor-tab-icon { color: rgba(255, 244, 230, 0.85); }
.editor-header .editor-tab--active .editor-tab-icon { color: var(--muted); }

.editor-header .editor-addblock-btn {
  color: var(--on-bg);
  border-color: rgba(255, 244, 230, 0.55);
}
.editor-header .editor-addblock-btn:hover { background: rgba(255, 244, 230, 0.14); }

.editor-header .editor-icon-btn {
  color: var(--on-bg);
  border-color: rgba(255, 244, 230, 0.3);
}
.editor-header .editor-icon-btn:hover:not(:disabled) {
  background: rgba(255, 244, 230, 0.14);
  border-color: rgba(255, 244, 230, 0.6);
}
.editor-header .editor-icon-btn:disabled { color: rgba(255, 244, 230, 0.45); }

.editor-header .editor-settings-btn {
  color: var(--on-bg);
  border-color: rgba(255, 244, 230, 0.4);
}
.editor-header .editor-settings-btn:hover,
.editor-header .editor-settings-btn[aria-expanded="true"] {
  background: rgba(255, 244, 230, 0.16);
  color: var(--on-bg);
}

.editor-header .editor-view-btn { color: rgba(255, 244, 230, 0.7); }
.editor-header .editor-view-btn:hover { color: var(--on-bg); }
.editor-header .editor-view-btn.editor-view-on {
  background: rgba(255, 244, 230, 0.18);
  color: var(--on-bg);
}

.editor-header .editor-publish-status { color: rgba(255, 244, 230, 0.85); }

/* "save" + "publish" read as two halves of one button — same cream/ghost colours, rounded on
   the outer edges with a sharp split in the middle. Both extruded: rest raised above the
   baseline and sink down flush (aligned with the bar's other controls) when pressed. */
.editor-header .editor-actions > .button {
  background: transparent;
  color: var(--on-bg);
  border: 1px solid rgba(255, 244, 230, 0.55);
  transform: translateY(-5px);
  box-shadow: 0 5px 0 rgba(255, 244, 230, 0.6);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.editor-header .editor-actions > .button:hover:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 0 0 rgba(255, 244, 230, 0.6);
  background: rgba(255, 244, 230, 0.14);
}
.editor-header .editor-actions > .button:disabled { opacity: 0.55; }

/* Split shape: save (left, draft) rounds the left edge; publish (right) the right edge.
   Fixed min-widths (text centred) so status text like "publishing…" / "no changes" never
   resizes the buttons and shifts the rest of the toolbar. */
#editor-savedraft-btn {
  border-radius: 8px 0 0 8px;
  margin-right: -10px; /* trims the toolbar gap down to a slim split */
  justify-content: center;
}
#editor-save-btn {
  border-radius: 0 8px 8px 0;
  justify-content: center;
}
/* Loading/status labels render smaller (with a smaller spinner) so longer messages like
   "publishing…" don't balloon the buttons and shove the toolbar around. */
#editor-save-btn[data-publish-state],
#editor-savedraft-btn[data-busy] { font-size: 0.72rem; letter-spacing: 0.01em; }

.editor-page-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  /* One row that shrinks the tabs to fit (Chrome-style) rather than wrapping to a 2nd row.
     overflow: hidden (not auto) so there's no scrollbar — crowded tabs collapse instead. */
  flex: 0 1 auto;
  flex-wrap: nowrap;
  overflow: hidden;
  min-width: 0;
  align-self: flex-end;
  margin-bottom: -10px; /* let the tabs meet the bar's bottom edge, like a browser tab strip */
}

/* Home tab doubles as the browser tab: clickable favicon (left) + name + home mark (right). */
.editor-tab-favicon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 3px;
  object-fit: cover;
  cursor: pointer;
}
.editor-tab-favicon:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.editor-tab-homemark {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  opacity: 0.75;
}
.editor-tab-homemark svg { width: 14px; height: 14px; }

.editor-newpage-pop {
  position: absolute;
  top: calc(100% - 4px);
  left: 20px;
  z-index: 210;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(24, 32, 27, 0.16);
}

.editor-newpage-pop.hidden {
  display: none !important;
}

.editor-newpage-pop input {
  width: 180px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
}

.editor-newpage-pop input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.editor-newpage-pop .button {
  min-height: 34px;
  width: auto;
  padding: 0 14px;
}

.editor-newpage-error {
  color: #b73535;
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 150px;
}

.editor-tab-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-transform: none;
}

.editor-tab-home svg {
  width: 14px;
  height: 14px;
}

/* Page tabs: name (left) · rename pencil (right) · delete × (right) */
.editor-tab-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.editor-tab-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inline rename: the label becomes an editable white field right inside the tab. */
.editor-tab-label.editor-tab-editing {
  cursor: text;
  outline: none;
  background: #fff;
  color: var(--ink);
  border-radius: 5px;
  padding: 2px 6px;
  margin: 0 -6px; /* cancels the horizontal padding so the tab doesn't grow when editing */
  min-width: 34px;
  text-transform: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.editor-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--muted);
  opacity: 0;
  flex-shrink: 0;
}

.editor-tab-icon svg {
  width: 10px;
  height: 10px;
}

.editor-tab:hover .editor-tab-icon,
.editor-tab--active .editor-tab-icon {
  opacity: 0.6;
}

/* Delete × stays slightly visible even when the tab isn't hovered. */

.editor-tab-del:hover {
  background: #f0d8d8;
  color: #b73535;
  opacity: 1;
}

.editor-tab-rename:hover {
  background: rgba(250, 105, 0, 0.14);
  color: var(--accent);
  opacity: 1;
}

.editor-del-confirm {
  background: #b73535;
}

.editor-del-confirm:hover {
  background: #9a2b2b;
}

.editor-delpage-cancel {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

#editor-delpage-text {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.editor-tab[draggable="true"] {
  cursor: grab;
}

.pe-tab-dragging {
  opacity: 0.45;
}

/* Home slot highlighted while dragging: drop a page here to make it the home page */
.editor-tab-home.pe-home-droptarget {
  background: rgba(250, 105, 0, 0.1);
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  color: var(--accent);
}

/* Drop indicator: a clear vertical line in the gap between tabs */
.pe-tab-drop-before::before,
.pe-tab-drop-after::after {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.pe-tab-drop-before::before {
  left: -4px;
}

.pe-tab-drop-after::after {
  right: -4px;
}

.editor-tab {
  position: relative;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.editor-tab:hover {
  background: var(--bg);
  color: var(--ink);
}

.editor-tab--active {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--accent);
}

.editor-tab-add {
  font-weight: 800;
  color: var(--accent);
  padding: 5px 11px;
  text-transform: none;
}

.editor-tab-add:hover {
  background: rgba(250, 105, 0, 0.08);
  color: var(--accent);
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.editor-actions > .button {
  width: auto;
  padding: 0 18px;
  min-height: 38px;
}

.button-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.button-secondary:hover {
  background: rgba(250, 105, 0, 0.08);
}

.button-secondary:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Publish lifecycle shown on the publish button itself (see setPublishStatus): a spinner
   while publishing, green when the build finishes, red if it fails. */
#editor-save-btn[data-publish-state="publishing"]::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border: 1.5px solid rgba(255, 244, 230, 0.35);
  border-top-color: var(--on-bg);
  border-radius: 50%;
  display: inline-block;
  vertical-align: -1px;
  animation: editor-spin 0.7s linear infinite;
}
/* "Published" uses the button's normal text colour (same as "Saving…", "Publishing…", etc.). */
#editor-save-btn[data-publish-state="error"] { color: #b73535; }
/* Keep the label full-strength while the button is showing a (disabled) status. */
.editor-header .editor-actions > #editor-save-btn[data-publish-state]:disabled { opacity: 1; }
/* Sink the publish button while it's working — it reads as pressed-and-held, not just greyed. */
.editor-header .editor-actions > #editor-save-btn[data-publish-state="publishing"] {
  transform: translateY(0);
  box-shadow: 0 0 0 rgba(255, 244, 230, 0.6);
}

@keyframes editor-spin {
  to { transform: rotate(360deg); }
}

.editor-addblock-wrap {
  position: relative;
}

.editor-addblock-wrap.hidden {
  display: none !important;
}

.editor-addblock-btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.editor-addblock-btn:hover {
  background: rgba(250, 105, 0, 0.06);
}

.editor-addblock-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  z-index: 200;
  min-width: 160px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 32px rgba(24, 32, 27, 0.14);
  display: none; /* opens on click (see .open) */
}

.editor-addblock-wrap.open .editor-addblock-menu {
  display: block;
}

.editor-addblock-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.editor-addblock-menu button:hover {
  background: var(--bg);
}

.editor-history {
  display: flex;
  gap: 4px;
}

.editor-icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 1.05rem;
  cursor: pointer;
  flex-shrink: 0;
}
.editor-icon-btn svg { width: 15px; height: 15px; display: block; }

.editor-icon-btn:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--muted);
}

.editor-icon-btn:disabled {
  color: var(--muted);
  opacity: 0.5;
  cursor: default;
}

.editor-settings-wrap {
  position: relative;
}

.editor-settings-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.editor-settings-btn:hover,
.editor-settings-btn[aria-expanded="true"] {
  background: var(--bg);
  color: var(--ink);
}

.editor-settings-btn svg {
  width: 17px;
  height: 17px;
}

.editor-layout-wrap.hidden {
  display: none !important;
}

.editor-settings-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 248px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 34px rgba(24, 32, 27, 0.16);
  padding: 14px;
  z-index: 200;
  display: none; /* opens on hover */
  flex-direction: column;
  gap: 14px;
}

.editor-settings-wrap:hover .editor-settings-panel {
  display: flex;
}

/* Transparent bridge over the gap between the button and the panel so hover stays open. */
.editor-settings-wrap::after {
  content: "";
  position: absolute;
  top: 100%;
  left: -6px;
  right: -6px;
  height: 8px;
}

.settings-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Empty hint text (e.g. no favicon chosen yet) shouldn't add height and throw off spacing. */
.settings-hint:empty {
  display: none;
}

.settings-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.settings-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.settings-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: #fff;
}

.settings-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.settings-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 4px 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
}
.settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(24, 32, 27, 0.25);
}
.settings-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(24, 32, 27, 0.25);
}

.settings-action-btn {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  text-align: left;
}

.settings-action-btn:hover {
  background: var(--bg);
}

/* Filled action buttons in the settings panel (favicon, custom domain, reset to template)
   — coloured so they're clearly distinct from the neutral page-title input. */
.settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.settings-ic { width: 15px; height: 15px; flex: 0 0 auto; }

.settings-btn:hover {
  background: var(--accent-dark);
}

/* Reset to template — a destructive action, so it's set apart from the others in red. */
.settings-btn--danger {
  background: #b73535;
}
.settings-btn--danger:hover {
  background: #9c2b2b;
}

/* Centered page-title field. */
.settings-item--center {
  align-items: center;
}
.settings-item--center .settings-input {
  text-align: center;
}

/* Right-aligned action row for confirmation modals. */
.pe-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.pe-modal-actions .button {
  width: auto;
  min-height: 0;
  padding: 10px 18px;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 10px 0;
}

/* Custom-domain modal */
.pe-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pe-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 32, 27, 0.45);
}

.pe-modal-card {
  position: relative;
  width: min(100%, 520px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(24, 32, 27, 0.25);
}

.pe-modal-x {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.pe-modal-x:hover { color: var(--ink); }

.pe-modal-title {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.pe-modal-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.pe-modal-steps {
  margin: 0 0 18px;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
}

.pe-modal-steps code,
.pe-modal-sub code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
}

.pe-modal-row {
  display: flex;
  gap: 8px;
}

.pe-modal-row input {
  flex: 1;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: #fff;
}
.pe-modal-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.pe-modal-row .button {
  width: auto;
  min-height: 0;
  padding: 0 18px;
}

.pe-modal-remove {
  margin-top: 14px;
  border: none;
  background: transparent;
  color: #b3261e;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.pe-modal-remove:hover { text-decoration: underline; }

.editor-domain-dns {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.editor-domain-dns-title {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
}

.editor-domain-dns-rows {
  margin: 0 0 8px;
  padding: 8px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre;
  overflow-x: auto;
}

.editor-domain-dns-note {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.settings-danger-link {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.settings-danger-link:hover {
  color: #b73535;
  text-decoration: underline;
}

.editor-frame-wrap {
  flex: 1;
  display: flex;      /* iframe (and, when open, the AI drawer) stretch to fill the height */
  min-height: 0;
}

#editor-iframe {
  flex: 1 1 auto;
  width: auto;
  border: none;
  display: block;
  background: #fff;
}

/* Mobile preview: constrain the iframe to a phone width, centered on a neutral backdrop */
.editor-frame-wrap.pe-mobile {
  background: #c9cfc8;
  display: flex;
  justify-content: center;
}

.editor-frame-wrap.pe-mobile #editor-iframe {
  flex: 0 0 auto;   /* stay a phone-width column, centered — don't grow to fill */
  width: 390px;
  max-width: 100%;
  border-left: 1px solid rgba(24, 32, 27, 0.18);
  border-right: 1px solid rgba(24, 32, 27, 0.18);
  box-shadow: 0 0 40px rgba(24, 32, 27, 0.2);
}

/* ---- AI assistant: edit-bar toggle + right-side chat drawer ---------------------------- */
.editor-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 244, 230, 0.5);
  background: transparent;
  color: var(--on-bg);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.editor-ai-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.editor-ai-btn:hover { background: rgba(255, 244, 230, 0.14); }
.editor-ai-btn[aria-pressed="true"] { background: #fff4e6; color: var(--accent); border-color: #fff4e6; }

/* When the drawer is open, the preview and drawer share the row. */
.editor-frame-wrap.pe-ai-open { display: flex; align-items: stretch; }
.editor-frame-wrap.pe-ai-open #editor-iframe { flex: 1 1 auto; width: auto; }
/* Mobile preview + drawer open together: keep the phone-width iframe (the pe-ai-open rule
   above would otherwise stretch it), centered in the space left of the drawer. */
.editor-frame-wrap.pe-mobile.pe-ai-open #editor-iframe {
  flex: 0 0 auto;
  width: 390px;
  margin: 0 auto;
}

.editor-ai-drawer {
  display: none;
  flex: 0 0 380px;
  max-width: 90vw;
  min-height: 0;      /* stretches to the full editor height (no fixed 65vh gap below) */
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(24, 32, 27, 0.08);
}
.editor-frame-wrap.pe-ai-open .editor-ai-drawer { display: flex; }

.ai-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.ai-drawer-title { font-size: 0.9rem; font-weight: 800; color: var(--ink); }
.ai-close-btn {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}
.ai-close-btn:hover { color: var(--ink); }

.ai-usage { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.ai-usage-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bg);
  overflow: hidden;
  margin-bottom: 5px;
}
.ai-usage-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.3s ease;
}
.ai-usage.is-low .ai-usage-bar span { background: #c47a16; }
.ai-usage.is-empty .ai-usage-bar span { background: #b73535; }
.ai-usage-text { font-size: 0.72rem; color: var(--muted); }

.ai-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.86rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ai-msg--user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg--assistant { align-self: flex-start; background: var(--bg); color: var(--ink); border-bottom-left-radius: 4px; }
.ai-msg--error { align-self: flex-start; background: #fdecec; color: #b73535; border-bottom-left-radius: 4px; }
.ai-msg--typing { color: var(--muted); font-style: italic; }
.ai-msg--metered { cursor: help; } /* hover shows the tokens this request used (title) */

/* While the paywall is shown there's no chat: collapse the (empty) message area + composer so
   the paywall sits just under the header instead of being pushed to — and off — the bottom.
   A scroll only appears if the panel is genuinely too short for the card. */
.editor-ai-drawer.pe-ai-paywall #ai-messages,
.editor-ai-drawer.pe-ai-paywall #ai-composer,
.editor-ai-drawer.pe-ai-paywall .ai-disclaimer { display: none; }
.editor-ai-drawer.pe-ai-paywall #ai-paywall {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ai-paywall {
  margin: 14px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  text-align: center;
  box-shadow: 0 12px 30px rgba(24, 32, 27, 0.08);
}
.ai-paywall-badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(250, 105, 0, 0.1);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.ai-paywall h3 { margin: 0 0 10px; font-size: 1.28rem; line-height: 1.2; font-weight: 800; color: var(--ink); }
.ai-paywall-tag { margin: 0 0 14px; font-size: 0.95rem; font-weight: 700; line-height: 1.4; color: var(--ink); }
.ai-paywall-lead { margin: 0 0 14px; font-size: 0.92rem; color: var(--muted); line-height: 1.5; }
.ai-paywall-feats {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: inline-block;
  text-align: left;
}
.ai-paywall-feats li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 7px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink);
}
.ai-paywall-feats li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 900;
}
.ai-paywall-value { margin: 0 0 14px; font-size: 0.85rem; color: var(--muted); line-height: 1.45; }
.ai-paywall .ai-price { margin: 0 0 12px; color: var(--ink); font-size: 1.05rem; }
.ai-paywall .ai-price strong { font-size: 1.9rem; color: var(--accent); }
.ai-paywall .button { width: 100%; min-height: 44px; font-size: 0.95rem; }
.ai-paywall-status { display: block; margin-top: 10px; font-size: 0.78rem; color: var(--muted); }
.ai-paywall-ast { color: var(--accent); font-weight: 800; }
.ai-paywall-fineprint {
  margin: auto 0 0;      /* pushed to the bottom of the (flex-column) paywall */
  padding-top: 16px;
  max-width: 270px;
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: center;
  color: var(--muted);
}
.ai-paywall-fineprint a { color: var(--muted); text-decoration: underline; }
.ai-paywall-fineprint a:hover { color: var(--ink); }

.ai-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.ai-composer textarea {
  flex: 1;
  resize: none;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  background: #fff;
  max-height: 140px;
}
.ai-composer textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ai-composer .button { padding: 0 16px; min-height: 38px; align-self: flex-end; }
.ai-composer.is-disabled { opacity: 0.55; pointer-events: none; }
.ai-disclaimer {
  margin: 0;
  padding: 0 14px 10px;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--muted);
  text-align: center;
}

.editor-viewtoggle {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.editor-view-btn {
  width: 32px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.editor-view-btn svg {
  width: 17px;
  height: 17px;
}

.editor-view-btn:hover {
  color: var(--ink);
}

.editor-view-btn.editor-view-on {
  background: var(--bg);
  color: var(--accent);
}

@media (max-width: 600px) {
  /* Stack into two full-width rows: controls on top, tabs below (column-reverse puts the
     actions — last in the DOM — at the top). */
  .editor-header {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  /* Actions: a tidy wrapping row of controls (not a full-width column). */
  .editor-actions {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
  }
  /* save + publish grow to fill the last row and stay comfortably tappable. */
  #editor-savedraft-btn,
  #editor-save-btn {
    flex: 1 1 auto;
    min-height: 40px;
  }
  /* Tabs scroll sideways (no hover-magnify on touch), kept at a tappable size. */
  .editor-page-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    align-self: stretch;
    margin-bottom: 0;
    padding-bottom: 2px;
  }
  .editor-header .editor-tab { flex: 0 0 auto; }
  /* The device-preview toggle is redundant on a phone; hide it to save room. */
  .editor-viewtoggle {
    display: none;
  }
}
