/* ═══════════════════════════════════════════════════════════════════════════
   CMS APP LAYOUT — shell, views and editor. Uses tokens + components only.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Shell ────────────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; --dock-inset: 0px; }
.app.has-subnav { --dock-inset: var(--subnav-w); }
/* Second-level navigation (Settings sections, Asset folders). Same items as the
   main nav, but on the page colour, with the section's name as its title. */
/* Layout trick: the grid stays sidebar | main exactly like every other page, so the content
   is centred in the same area and starts at the same x. The subnav sits on top of the left
   edge of that area, and the content's left margin is the larger of "where it normally starts"
   and "just past the subnav" — so it only narrows once the subnav would touch it. */
.subnav { display: none; }
.app.has-subnav .subnav { grid-column: 2; grid-row: 1; justify-self: start; align-self: start; width: var(--subnav-w); z-index: calc(var(--z-sticky) + 1); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 0 12px 14px; background: var(--bg); border-right: 1px solid var(--border); overflow-y: auto; }
.app.has-subnav .main { grid-column: 2; grid-row: 1; }
.app.has-subnav .topbar { margin-left: var(--subnav-w); }
.app.has-subnav .content { max-width: none; margin-left: max(var(--subnav-w), (100% - var(--content-max)) / 2); margin-right: max(0px, (100% - var(--content-max)) / 2); width: auto; }
.subnav-title { display: flex; align-items: center; flex: none; height: var(--topbar-h); padding: 0 10px; margin-bottom: 4px; font-size: var(--text-xl); font-weight: var(--weight-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subnav .nav-item { padding-left: calc(10px + var(--depth, 0) * 16px); }
.subnav .nav-item .nav-text { overflow: hidden; text-overflow: ellipsis; }
.subnav .nav-item.drop { background: var(--nav-hover); box-shadow: inset 0 0 0 1.5px var(--brand); }
/* Collapsible items: the icon is a toggle button laid over the link's icon slot. */
.nav-row { position: relative; }
.nav-row:hover > .nav-item:not([aria-current="page"]) { background: var(--nav-hover); color: var(--text); }
.nav-icon-slot { flex: none; width: 17px; height: 17px; }
.nav-toggle { position: absolute; top: 6px; left: calc(6px + var(--depth, 0) * 16px); width: 25px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-xs); background: none; color: var(--text-muted); cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast); }
.nav-toggle:hover { background: var(--nav-active); color: var(--text); }
.nav-row:has(> [aria-current="page"]) > .nav-toggle { color: var(--primary-text); }
.subnav-foot { margin-top: auto; padding-top: 8px; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--space-1); padding: 0 12px 14px; background: var(--nav-bg); border-right: 1px solid var(--border); overflow: hidden; }
/* Same row as the editor bar and the top bar: 60px tall, content starting 12px from the edge. */
.sb-project { display: flex; align-items: center; gap: 10px; flex: none; height: var(--topbar-h); padding: 0; margin-bottom: 2px; color: var(--text); text-decoration: none !important; }
.sb-project:hover .name { text-decoration: underline; text-underline-offset: 3px; }
.sb-project .logo { width: 32px; height: 32px; flex: none; display: grid; place-items: center; }
/* Name + domain stack to exactly the mark's 32px height, so the text never towers over it. */
.sb-project .name { display: block; font-weight: var(--weight-bold); font-size: var(--text-sm); line-height: 16px; }
.sb-project .url { display: block; font-size: var(--text-2xs); line-height: 16px; color: var(--text-subtle); -webkit-text-stroke: var(--small-stroke) currentColor; }
.sb-search { position: relative; display: flex; align-items: center; margin-bottom: 8px; }
.sb-search > .i { position: absolute; left: 10px; color: var(--text-subtle); pointer-events: none; }
.sb-search input { width: 100%; height: 34px; padding: 0 30px 0 32px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text); font: inherit; font-size: var(--text-md); outline: none; transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.sb-search input::placeholder { color: var(--text-subtle); }
.sb-search input:hover { border-color: var(--border-strong); }
.sb-search input:focus { border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.sb-search input::-webkit-search-cancel-button { display: none; }
.sb-search .sb-clear { position: absolute; right: 4px; --btn-h: 26px; }
.sb-nav { display: grid; gap: var(--space-1); align-content: start; }
.sb-results { display: grid; gap: 2px; align-content: start; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.sb-results .nav-item { height: auto; min-height: 36px; padding-top: 6px; padding-bottom: 6px; white-space: normal; }
.sb-results .nav-item .res-sub { display: block; font-size: var(--text-xs); color: var(--text-subtle); -webkit-text-stroke: var(--small-stroke) currentColor; }
.sb-results .nav-item .res-text { min-width: 0; line-height: 1.3; }
.sb-results .nav-item .res-text b { display: block; font-weight: var(--weight-regular); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-results .nav-item[aria-selected="true"] { background: var(--nav-active); color: var(--text); }
.sb-empty { padding: 10px; color: var(--text-subtle); font-size: var(--text-sm); }
.sb-label { padding: 14px 10px 6px; color: var(--text-subtle); white-space: nowrap; -webkit-text-stroke: var(--small-stroke) currentColor; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius-md); color: var(--text-muted); font-weight: var(--weight-regular); -webkit-text-stroke: var(--small-stroke) currentColor; text-decoration: none !important; white-space: nowrap; transition: background var(--duration-fast), color var(--duration-fast); }
.nav-item:hover { background: var(--nav-hover); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--nav-active); color: var(--text); font-weight: var(--weight-bold); -webkit-text-stroke: 0; }
.nav-item[aria-current="page"] .i { color: var(--primary-text); }
.nav-item .nav-count { margin-left: auto; }
.sb-footer { margin-top: auto; display: grid; gap: 4px; }
.sb-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: var(--radius-md); background: none; cursor: pointer; text-align: left; }
.sb-user:hover, .sb-user[aria-expanded="true"] { background: var(--nav-hover); }
.sb-user .who { min-width: 0; line-height: 1.25; }
.sb-user .who b { display: block; font-size: var(--text-md); }
.sb-user .who span { font-size: var(--text-xs); color: var(--text-subtle); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--space-3); height: var(--topbar-h); padding: 0 var(--space-3) 0 var(--space-4); /* right = editor bar (12px), so View site and Publish sit at the same spot */ background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px) saturate(1.4); border-bottom: 1px solid transparent; transition: border-color var(--duration-base); }
.topbar.scrolled { border-bottom-color: var(--border); }
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--space-6) var(--space-8) var(--space-16); }
.content-wide { max-width: var(--content-max); } /* kept for compatibility — every page now shares one width */
/* Page header — identical on every page: one title (no subtitle), on a 36px line so the
   top-right actions share its top edge. */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4) var(--space-6); flex-wrap: wrap; margin-bottom: var(--space-6); min-height: 36px; }
.page-head > :first-child { flex: 1 1 320px; min-width: 0; }
.page-head .h-page { line-height: 36px; }
.page-head p { color: var(--text-muted); margin-top: 4px; max-width: 64ch; }
.head-back { display: flex; align-items: center; gap: 8px; margin-left: -8px; }
.page-head .actions { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.toolbar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.toolbar .input-wrap { width: 280px; max-width: 100%; }
.view-enter { animation: viewIn var(--duration-slow) var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.mobile-only { display: none !important; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; --dock-inset: 0px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: var(--z-drawer); transform: translateX(-105%); transition: transform var(--duration-slow) var(--ease-out); box-shadow: var(--shadow-xl); }
  .app.mobile-open .sidebar { transform: none; }
  .app.mobile-open::after { content: ''; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: var(--overlay); animation: fade var(--duration-base); }
  .content { padding: var(--space-4) var(--space-4) var(--space-16); }
  .topbar { padding-left: var(--space-2); }
  .mobile-only { display: inline-flex !important; }
  /* Second-level nav becomes a scrollable strip under the top bar. */
  .app.has-subnav { display: flex; flex-direction: column; }
  .app.has-subnav .main { display: contents; }
  .app.has-subnav .topbar { order: 0; margin-left: 0; }
  .app.has-subnav .subnav { order: 1; position: static; width: auto; min-width: 0; align-self: stretch; z-index: auto; height: auto; flex-direction: row; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
  .app.has-subnav .content { order: 2; margin: 0; }
  .subnav-title, .subnav-foot { display: none !important; }
  .subnav .nav-item { flex: none; padding: 0 12px; }
  .nav-row { flex: none; }
  .nav-toggle { left: 8px; }
  .topbar .btn-secondary span { display: none; }
  .float-dock { left: 0 !important; right: 0 !important; }
}

/* ── Floating action bars (unsaved settings, asset selection) ────────────────
   Fixed to the bottom of the viewport and centred on the content column (same
   maths as .content), so they never jump with page length. */
.float-dock { position: fixed; z-index: 40; bottom: 20px; display: flex; justify-content: center; pointer-events: none;
  left: calc(var(--sidebar-w) + max(var(--dock-inset), (100vw - var(--sidebar-w) - var(--content-max)) / 2));
  right: max(0px, (100vw - var(--sidebar-w) - var(--content-max)) / 2); }
.float-bar { pointer-events: auto; display: flex; align-items: center; gap: var(--space-2); padding: 6px 6px 6px 16px; border-radius: var(--radius-lg); background: var(--surface-inverse); color: var(--text-inverse); box-shadow: var(--shadow-xl); animation: toastIn var(--duration-slow) var(--ease-spring); }
.float-bar > span { display: inline-flex; align-items: center; gap: 8px; margin-right: 6px; }
.float-bar .btn-ghost, .float-bar .btn-ghost:hover:not(:disabled) { color: var(--text-inverse); }
.float-bar .btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,.14); }
/* While its popover or dialog is open, a float-bar button keeps its dark look (never the light "expanded" fill). */
.float-bar .btn-ghost[aria-expanded="true"], .float-bar .btn-ghost[aria-pressed="true"] { background: rgba(255,255,255,.2); color: var(--text-inverse); }
.float-bar .btn:focus-visible { box-shadow: 0 0 0 2px var(--surface-inverse), 0 0 0 4px rgba(255,255,255,.7); }

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2s var(--ease-out) 1; }
@keyframes wave { 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40%, 100% { transform: rotate(0); } }
.stat-card { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-card .stat-value { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: var(--weight-black); letter-spacing: -.015em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card .stat-label { color: var(--text-muted); font-size: var(--text-sm); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-4); margin-top: var(--space-4); }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.list-row { display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-6); text-decoration: none !important; color: var(--text); transition: background var(--duration-fast); }
.list-row:hover { background: var(--surface-hover); }
.list-row .meta { font-size: var(--text-xs); color: var(--text-subtle); }
.feed { display: grid; }
.feed-item { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 10px var(--space-6); font-size: var(--text-md); position: relative; }
.feed-item:not(:last-child)::before { content: ''; position: absolute; left: calc(var(--space-6) + 11.5px); top: 40px; bottom: -6px; width: 1px; background: var(--border-strong); } /* centred under the 24px avatar */
.feed-item .when { font-size: var(--text-xs); color: var(--text-subtle); }
.site-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: hidden; } /* preview | details, 50/50 */
.site-hero .site-thumb { height: 260px; border-bottom: 0; border-right: 1px solid var(--border); }
.site-hero .site-thumb iframe { transform: scale(var(--thumb-s, .4)); }
.site-hero .site-info { display: flex; flex-direction: column; gap: 14px; padding: var(--space-6); min-width: 0; }
.site-hero .site-info .name { font-size: var(--text-xl); font-weight: var(--weight-bold); }
.site-hero .site-info .url { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); }
.site-hero .site-info .actions { margin-top: auto; display: flex; gap: var(--space-2); flex-wrap: wrap; }
@media (max-width: 800px) { .site-hero { grid-template-columns: 1fr; } .site-hero .site-thumb { border-right: 0; border-bottom: 1px solid var(--border); } }
.quiet-feed { display: grid; gap: 2px; }
.quiet-feed .q-item { display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding: 8px 0; color: var(--text-subtle); font-size: var(--text-sm); -webkit-text-stroke: var(--small-stroke) currentColor; }
.quiet-feed .q-item b { font-weight: var(--weight-regular); color: var(--text-muted); }
.quiet-feed .q-item .when { display: block; font-size: var(--text-xs); }
.quiet-feed .avatar { opacity: .75; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-8) 0 var(--space-3); }
.section-title h2 { font-size: var(--text-lg); font-weight: var(--weight-bold); }

/* ── Analytics ────────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
.kpi .kpi-label { color: var(--text-muted); font-size: var(--text-sm); -webkit-text-stroke: var(--small-stroke) currentColor; }
.kpi .kpi-value { font-size: var(--text-3xl); font-weight: var(--weight-black); line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .kpi-trend { font-size: var(--text-xs); color: var(--text-subtle); -webkit-text-stroke: var(--small-stroke) currentColor; }
.kpi .kpi-trend[data-dir="up"] { color: var(--success-text); }
.kpi .kpi-trend[data-dir="down"] { color: var(--danger-text); }
@media (max-width: 700px) { .kpis { grid-template-columns: 1fr; gap: var(--space-4); } }
.chart { position: relative; margin-top: var(--space-5); }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .bar { fill: var(--navy-400); transition: fill var(--duration-fast); }
.chart .col { outline: none; cursor: default; }
.chart .bar[data-on] { fill: var(--primary); }
.chart .col:focus-visible .hit { stroke: var(--border-focus); stroke-width: 2; }
.chart-table { margin-top: var(--space-3); }
.chart-table summary { cursor: pointer; width: fit-content; }
.chart-table table { margin-top: var(--space-2); }
.chart .axis { fill: var(--text-subtle); font-size: 11px; }
.chart .grid { stroke: var(--border); }
.chart-tip { position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 8px)); padding: 6px 9px; border-radius: var(--radius-sm); background: var(--surface-inverse); color: var(--text-inverse); font-size: var(--text-xs); white-space: nowrap; pointer-events: none; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.barlist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.barlist .bl-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; padding: 0 10px; border-radius: var(--radius-sm); font-size: var(--text-sm); }
.barlist .bl-row::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: inherit; background: var(--navy-50); }
.barlist .bl-row > * { position: relative; min-width: 0; }
.barlist .bl-row .bl-v { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.site-card { overflow: hidden; }
.site-thumb { position: relative; height: 180px; overflow: hidden; background: var(--bg-subtle); border-bottom: 1px solid var(--border); }
.site-thumb iframe { width: 1440px; height: 900px; border: 0; transform: scale(.28); transform-origin: 0 0; pointer-events: none; }
.site-thumb .live-pill { position: absolute; top: 12px; left: 12px; }

/* ── Pages list ───────────────────────────────────────────────────────────── */
.page-title-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title-cell .t { font-weight: var(--weight-semibold); }
.page-title-cell .s { font-size: var(--text-xs); color: var(--text-subtle); font-family: var(--font-mono); }
.mini-score { display: inline-flex; align-items: center; gap: 8px; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.template { display: grid; gap: 10px; padding: 10px; border: 1.5px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; text-align: left; transition: all var(--duration-fast); }
.template:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.template[aria-pressed="true"] { border-color: var(--brand); box-shadow: var(--focus-ring); }
.template .thumb { height: 84px; border-radius: var(--radius-sm); background: var(--bg-subtle); display: grid; gap: 4px; padding: 8px; align-content: start; }
.template .thumb i { display: block; height: 8px; border-radius: 3px; background: var(--surface-active); }
.template .thumb i.hero { height: 22px; background: var(--primary-soft); }
.template b { font-size: var(--text-sm); }
.template span { font-size: var(--text-xs); color: var(--text-subtle); }

/* ── Editor ───────────────────────────────────────────────────────────────── */
.editor { display: grid; grid-template-rows: var(--topbar-h) minmax(0, 1fr); height: 100vh; overflow: hidden; background: var(--bg); }
.editor-bar { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3); background: var(--surface); border-bottom: 1px solid var(--border); min-width: 0; }
.editor-bar .title-input { font-weight: var(--weight-semibold); font-size: var(--text-base); border: 1px solid transparent; background: none; padding: 5px 8px; border-radius: var(--radius-sm); min-width: 60px; max-width: 280px; color: var(--text); outline: none; field-sizing: content; }
.editor-bar .title-input:hover { background: var(--surface-hover); }
.editor-bar .title-input:focus { border-color: var(--border-focus); box-shadow: var(--focus-ring); background: var(--surface); }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-subtle); white-space: nowrap; padding: 0 6px; }
.save-state[data-state="saving"] .dot { background: var(--amber-500); animation: pulse 1s infinite; }
.save-state[data-state="saved"] .dot { background: var(--green-500); }
.save-state[data-state="error"] { color: var(--danger-text); }
.save-state[data-state="error"] .dot { background: var(--red-500); }
@keyframes pulse { 50% { opacity: .3; } }
.editor-body { display: grid; grid-template-columns: 272px minmax(0, 1fr) 360px; min-height: 0; }
.editor-body.no-left { grid-template-columns: 0 minmax(0, 1fr) 360px; }
.editor-body.no-left .outline { visibility: hidden; }
/* Below 1000px the preview and both panels don't fit: show a message instead of a squeezed editor. */
.editor-narrow { display: none; }
@media (max-width: 999px) {
  .editor { grid-template-rows: minmax(0, 1fr); }
  .editor > :not(.editor-narrow) { display: none !important; }
  .editor-narrow { display: grid; place-items: center; padding: var(--space-6) var(--space-4); }
  .editor-narrow .empty { max-width: 420px; }
}
.segmented button[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.panel-head { display: flex; align-items: center; gap: var(--space-2); padding: 12px 14px; border-bottom: 1px solid var(--border); min-height: 52px; }
.panel-head h2 { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.panel-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.outline { border-right: 1px solid var(--border); }
.outline-list { list-style: none; margin: 0; padding: 8px; display: grid; gap: 2px; }
.ol-item { position: relative; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 4px; border-radius: var(--radius-md); cursor: pointer; border: 1px solid transparent; user-select: none; transition: background var(--duration-fast), border-color var(--duration-fast); }
.ol-item:hover { background: var(--surface-hover); }
.ol-item[aria-selected="true"] { background: var(--primary-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.ol-item.hidden-block { opacity: .5; }
.ol-item .grip { cursor: grab; color: var(--text-disabled); padding: 4px 0; display: flex; }
.ol-item .grip:active { cursor: grabbing; }
.ol-item .ol-text { min-width: 0; flex: 1; line-height: 1.25; }
.ol-item .ol-text b { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.ol-item .ol-text span { display: block; font-size: var(--text-xs); color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-item .ol-actions { display: none; gap: 0; }
.ol-item:hover .ol-actions, .ol-item[aria-selected="true"] .ol-actions, .ol-item:focus-within .ol-actions { display: flex; }
.ol-item .btn-icon { --btn-h: 26px; }
.ol-item.dragging { opacity: .4; }
.ol-item.drop-before::before, .ol-item.drop-after::after { content: ''; position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 2px; background: var(--brand); }
.ol-item.drop-before::before { top: -2px; } .ol-item.drop-after::after { bottom: -2px; }
.ol-add { display: flex; align-items: center; justify-content: center; gap: 6px; width: calc(100% - 16px); margin: 4px 8px 12px; height: 40px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); background: none; color: var(--text-muted); font-weight: var(--weight-semibold); cursor: pointer; transition: all var(--duration-fast); }
.ol-add:hover { border-color: var(--brand); color: var(--primary-text); background: var(--primary-soft); }
.ol-chrome { display: flex; align-items: center; gap: 8px; margin: 0 8px; padding: 8px 10px; font-size: var(--text-xs); color: var(--text-subtle); border-radius: var(--radius-sm); background: var(--bg-subtle); }
.ol-chrome a { margin-left: auto; font-weight: var(--weight-semibold); }

.canvas { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--bg-subtle); }
.canvas-bar { display: flex; align-items: center; justify-content: center; gap: var(--space-2); padding: 10px; }
.canvas-url { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--radius-full); background: var(--surface); border: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-subtle); max-width: 360px; box-shadow: var(--shadow-xs); }
.canvas-stage { flex: 1; min-height: 0; display: flex; justify-content: center; padding: 0 20px 20px; overflow: auto; }
.frame { width: 100%; height: 100%; background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); /* a real border, so it shows on every side incl. the top */ overflow: hidden; transition: width var(--duration-slow) var(--ease-out); }
.frame[data-device="tablet"] { width: 820px; flex: none; }
.frame[data-device="mobile"] { width: 390px; flex: none; border: 0; border-radius: 28px; box-shadow: var(--shadow-xl), 0 0 0 8px var(--sand-900), 0 0 0 9px var(--border); margin-top: 8px; height: calc(100% - 16px); }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

.inspector { border-left: 1px solid var(--border); }
.inspector .tabs { padding: 0 10px; }
.insp-section { padding: 16px; border-bottom: 1px solid var(--border); }
.insp-section:last-child { border-bottom: 0; }
.insp-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); -webkit-text-stroke: var(--small-stroke) currentColor; color: var(--text-subtle); }
.insp-section > summary::-webkit-details-marker { display: none; }
.insp-section > summary .i { transition: transform var(--duration-base); }
.insp-section[open] > summary { margin-bottom: 14px; }
.insp-section[open] > summary .i { transform: rotate(90deg); }
.insp-head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.insp-head b { display: block; font-size: var(--text-base); }
.insp-head span { font-size: var(--text-xs); color: var(--text-subtle); }
.insp-empty { padding: 32px 20px; text-align: center; color: var(--text-muted); display: grid; gap: 12px; justify-items: center; }
.inspector .field + .field { margin-top: var(--space-4); }
.md-toolbar { display: flex; gap: 2px; padding: 4px; border: 1px solid var(--border-strong); border-bottom: 0; border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--bg-subtle); }
.md-toolbar + .textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.md-toolbar .btn-icon { --btn-h: 26px; }
.link-field { display: grid; grid-template-columns: 1fr 1.2fr; gap: 6px; }
.image-field { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
.image-field .thumb { width: 56px; height: 44px; border-radius: var(--radius-sm); background: var(--bg-subtle) center/cover no-repeat; flex: none; display: grid; place-items: center; color: var(--text-subtle); border: 1px solid var(--border); }
.image-field .meta { min-width: 0; flex: 1; font-size: var(--text-xs); color: var(--text-subtle); }
.image-field .meta b { display: block; font-size: var(--text-sm); color: var(--text); font-weight: var(--weight-medium); }
.list-field { display: grid; gap: 6px; }
.list-item { border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
.list-item > summary { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; cursor: pointer; list-style: none; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.list-item > summary::-webkit-details-marker { display: none; }
.list-item > summary .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item > summary .btn-icon { --btn-h: 24px; }
.list-item[open] > summary { border-bottom: 1px solid var(--border); }
.list-item .list-body { padding: 12px; }
.icon-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.icon-picker button { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--bg-subtle); color: var(--text-muted); cursor: pointer; }
.icon-picker button:hover { color: var(--text); border-color: var(--border-strong); }
.icon-picker button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary-text); border-color: var(--brand); }

.serp { padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); font-family: Arial, sans-serif; }
.serp .site { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.serp .site img, .serp .site .fav { width: 26px; height: 26px; border-radius: 50%; background: var(--bg-subtle); padding: 4px; }
.serp .site b { display: block; color: var(--text); font-weight: 400; font-size: 14px; }
.serp .ttl { display: block; margin-top: 8px; color: #1a0dab; font-size: 19px; line-height: 1.3; }
.serp .desc { margin-top: 4px; color: #4d5156; font-size: 13.5px; line-height: 1.55; }
.social-card { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.social-card .img { aspect-ratio: 1.91; background: var(--bg-subtle) center/cover no-repeat; display: grid; place-items: center; color: var(--text-subtle); }
.social-card .txt { padding: 10px 12px; border-top: 1px solid var(--border); }
.social-card .txt small { font-size: 12px; color: var(--text-subtle); }
.social-card .txt b { display: block; font-size: var(--text-md); margin-top: 2px; }

/* Element library */
/* The library fills the whole sheet: categories on the left (divider runs to the bottom), the grid scrolls,
   and the "turned off" note stays pinned at the bottom. */
.modal-body:has(> .lib) { padding: 0; display: flex; overflow: hidden; }
.lib { flex: 1; min-height: 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 0; }
.lib-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.lib-search { padding: 16px 16px 0; flex: none; }
.lib-foot { flex: none; display: flex; align-items: center; gap: 6px; margin: 0; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-raised); }
.lib-cats { padding: 12px; border-right: 1px solid var(--border); display: grid; align-content: start; gap: 2px; overflow-y: auto; }
.lib-cats button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-weight: var(--weight-medium); color: var(--text-muted); display: flex; justify-content: space-between; }
.lib-cats button:hover { background: var(--surface-hover); color: var(--text); }
.lib-cats button[aria-pressed="true"] { background: var(--surface-active); color: var(--text); font-weight: var(--weight-semibold); }
.lib-grid { flex: 1; min-height: 0; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; align-content: start; overflow-y: auto; }
.lib-card { display: grid; gap: 10px; padding: 10px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; transition: all var(--duration-base) var(--ease-out); }
.lib-card:hover, .lib-card:focus-visible { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lib-card .art { height: 96px; border-radius: var(--radius-md); overflow: hidden; }
.lib-card b { font-size: var(--text-md); }
.lib-card p { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.4; }
@media (max-width: 700px) { .lib { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); } .lib-cats { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); } }

/* Element thumbnails (pure CSS sketches of each element) */
.art { position: relative; background: var(--bg-subtle); padding: 10px; display: grid; gap: 5px; align-content: center; }
.art i { display: block; height: 6px; border-radius: 3px; background: var(--border-strong); }
.art i.h { height: 10px; width: 70%; background: var(--text-subtle); opacity: .55; }
.art i.c { margin-inline: auto; }
.art i.b { height: 12px; width: 34%; border-radius: 6px; background: var(--brand); opacity: .9; }
.art i.g { background: var(--primary); opacity: .85; }
.art .r { display: flex; gap: 5px; }
.art .r > * { flex: 1; }
.art .box { height: 34px; border-radius: 5px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong); }
.art .img { border-radius: 5px; background: var(--primary-soft-hover); }

/* Versions */
.version { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 12px 0; }
.version:not(:last-child)::before { content: ''; position: absolute; left: 15.5px; top: 46px; bottom: -10px; width: 1px; background: var(--border); }
.version .vnum { width: 32px; height: 32px; display: grid; place-items: center; color: var(--text-muted); } /* bare icon on the timeline — no tinted circle */
.version[data-kind="publish"] .vnum { color: var(--success-text); }
.version[data-kind="current"] .vnum { color: var(--primary-text); }
.version .vnote { font-weight: var(--weight-semibold); }
.version .vmeta { font-size: var(--text-xs); color: var(--text-subtle); display: flex; gap: 6px; align-items: center; margin-top: 2px; flex-wrap: wrap; }
.version .vactions { display: flex; gap: 4px; margin-top: 8px; }
.diff { display: grid; gap: 6px; }
.diff-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-md); background: var(--bg-subtle); font-size: var(--text-sm); }
.diff-row .tag { flex: none; font-size: var(--text-xs); font-weight: var(--weight-bold); padding: 2px 6px; border-radius: 4px; }
.diff-row[data-kind="added"] .tag { background: var(--success-soft); color: var(--success-text); }
.diff-row[data-kind="removed"] .tag { background: var(--danger-soft); color: var(--danger-text); }
.diff-row[data-kind="changed"] .tag { background: var(--warning-soft); color: var(--warning-text); }
.diff-row[data-kind="moved"] .tag { background: var(--info-soft); color: var(--info-text); }
.diff-row del { color: var(--danger-text); }
.diff-row ins { color: var(--success-text); text-decoration: none; }

/* Publish dialog */
.publish-hero { display: flex; align-items: center; gap: 20px; padding: 16px; border-radius: var(--radius-xl); background: var(--bg-subtle); border: 1px solid var(--border); }
.publish-hero .h-card { font-size: var(--text-lg); }

/* ── Assets ───────────────────────────────────────────────────────────────── */
.tree { position: sticky; top: calc(var(--topbar-h) + 12px); padding: 8px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { padding-left: 14px; }
.tree-item { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-muted); font-weight: var(--weight-medium); border: 1px solid transparent; }
.tree-item:hover { background: var(--surface-hover); color: var(--text); }
.tree-item[aria-current="true"] { background: var(--primary-soft); color: var(--primary-text); font-weight: var(--weight-semibold); }
.tree-item.drop { border-color: var(--brand); background: var(--primary-soft); }
.tree-item .count { margin-left: auto; font-size: var(--text-xs); color: var(--text-subtle); }
.tree-item .caret { width: 16px; display: grid; place-items: center; margin-left: -4px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); grid-auto-rows: max-content; gap: var(--space-3); }
.asset { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); overflow: hidden; cursor: pointer; transition: all var(--duration-base) var(--ease-out); user-select: none; text-align: left; padding: 0; }
.asset:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.asset[aria-selected="true"] { border-color: var(--brand); box-shadow: var(--focus-ring); }
.asset .thumb { aspect-ratio: 4/3; display: grid; place-items: center; background-color: var(--bg-subtle); background-image: linear-gradient(45deg, var(--surface-active) 25%, transparent 25%, transparent 75%, var(--surface-active) 75%), linear-gradient(45deg, var(--surface-active) 25%, transparent 25%, transparent 75%, var(--surface-active) 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; color: var(--text-subtle); overflow: hidden; }
.asset .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.asset .info { display: grid; gap: 2px; padding: 8px 10px 10px; min-width: 0; }
/* Always exactly two lines: the name and one line of facts — both cut with "…" when too long. */
.asset .info b, .asset .info .meta { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset .info b { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.asset .info .meta { font-size: var(--text-xs); color: var(--text-subtle); }
.asset .sel { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 6px; background: var(--surface); border: 1.5px solid var(--border-strong); display: grid; place-items: center; opacity: 0; transition: opacity var(--duration-fast); color: transparent; }
.asset:hover .sel, .asset[aria-selected="true"] .sel, .selecting .asset .sel { opacity: 1; }
.asset[aria-selected="true"] .sel { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.asset .warn { position: absolute; top: 8px; right: 8px; }
.folder-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: all var(--duration-base); text-align: left; font: inherit; color: inherit; }
.folder-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.folder-card.drop { border-color: var(--brand); background: var(--primary-soft); }
.folder-card b { display: block; font-weight: var(--weight-semibold); }
.folder-card span { font-size: var(--text-xs); color: var(--text-subtle); }
.upload-queue { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast); width: 320px; }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 8px 0; font-size: var(--text-sm); }
.upload-row .progress { grid-column: 1 / -1; height: 4px; }
.asset-preview { display: grid; place-items: center; min-height: 220px; max-height: 320px; border-radius: var(--radius-lg); background-color: var(--bg-subtle); background-image: linear-gradient(45deg, var(--surface-active) 25%, transparent 25%, transparent 75%, var(--surface-active) 75%), linear-gradient(45deg, var(--surface-active) 25%, transparent 25%, transparent 75%, var(--surface-active) 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; overflow: hidden; }
.asset-preview img { max-height: 320px; object-fit: contain; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: var(--text-sm); }
.kv dt { color: var(--text-subtle); }
.kv dd { margin: 0; text-align: right; font-weight: var(--weight-medium); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.full-drop { position: fixed; inset: 0; z-index: var(--z-modal); display: none; place-items: center; background: color-mix(in srgb, var(--brand) 10%, transparent); backdrop-filter: blur(2px); border: 3px dashed var(--brand); pointer-events: none; }
.full-drop.on { display: grid; }
.full-drop > div { padding: 24px 32px; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-xl); font-weight: var(--weight-semibold); display: flex; align-items: center; gap: 12px; font-size: var(--text-lg); }

/* ── Elements view ────────────────────────────────────────────────────────── */
.el-card { display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.el-card .art { height: 120px; border-bottom: 1px solid var(--border); }
.el-card .el-body { padding: 16px; display: grid; gap: 6px; align-content: start; }
.el-card .el-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-subtle); }
.el-card.disabled .art, .el-card.disabled .el-body { opacity: .5; }
pre.code { margin: 0; padding: 16px; border-radius: var(--radius-lg); background: var(--sand-900); color: #F3EDE7; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; overflow-x: auto; }
pre.code .c { color: #8F857C; } pre.code .k { color: var(--navy-300); } pre.code .s { color: #9BE3B4; }

/* ── Members ──────────────────────────────────────────────────────────────── */
.role-matrix th, .role-matrix td { text-align: center; }
.role-matrix th:first-child, .role-matrix td:first-child { text-align: left; }
.role-matrix .yes { color: var(--success-text); }
.role-matrix .no { color: var(--text-disabled); }
.role-option { display: flex; gap: 12px; padding: 12px; border: 1.5px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; transition: all var(--duration-fast); }
.role-option:hover { border-color: var(--border-strong); }
.role-option:has(input:checked) { border-color: var(--brand); background: var(--primary-soft); }
.role-option input { margin-top: 3px; accent-color: var(--primary); }
.role-option b { display: block; }
.role-option span { font-size: var(--text-sm); color: var(--text-muted); }
.email-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); cursor: text; }
.email-chips:focus-within { border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.email-chips input { flex: 1; min-width: 160px; border: 0; outline: none; background: none; height: 30px; font: inherit; color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: var(--radius-full); background: var(--surface-active); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.chip.invalid { background: var(--danger-soft); color: var(--danger-text); }
.chip button { border: 0; background: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: inherit; }
.chip button:hover { background: rgba(127,127,127,.2); }

/* ── Settings ─────────────────────────────────────────────────────────────── */
.settings-section { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: var(--space-8); padding: var(--space-6); }
.settings-section + .settings-section { border-top: 1px solid var(--border); }
.settings-section .desc h3 { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.settings-section .desc p { color: var(--text-muted); font-size: var(--text-sm); margin-top: 4px; }
@media (max-width: 1100px) { .settings-section { grid-template-columns: 1fr; gap: var(--space-4); } }
.nav-editor { display: grid; gap: 6px; }
.nav-editor-row { display: grid; grid-template-columns: 20px 1fr 1.3fr 30px; gap: 6px; align-items: center; }
.nav-editor-row .grip { color: var(--text-disabled); cursor: grab; }
.font-option { padding: 14px; border: 1.5px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; display: grid; gap: 4px; background: var(--surface); text-align: left; }
.font-option:hover { border-color: var(--border-strong); }
.font-option[aria-pressed="true"] { border-color: var(--brand); box-shadow: var(--focus-ring); }
.font-option .sample { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.font-option span { font-size: var(--text-xs); color: var(--text-subtle); }

/* ── Login ────────────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-8) var(--space-4); }
.auth-form { width: 100%; display: grid; place-items: center; }
.auth-form > div { width: 100%; max-width: 400px; }
.auth-head { text-align: center; justify-items: center; }
.auth-sent { text-align: center; justify-items: center; }
.auth-sent .btn { justify-self: stretch; }
.auth-sent-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-sunken, var(--sand-50)); color: var(--text); }
.member-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; text-align: left; transition: all var(--duration-fast); }
.member-pick:hover { border-color: var(--brand); transform: translateX(2px); }
.member-pick .who { flex: 1; min-width: 0; }
.member-pick .who b { display: block; }
.member-pick .who span { font-size: var(--text-xs); color: var(--text-subtle); }
.project-mark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: var(--weight-black); font-size: var(--text-xl); }
/* Project mark: the site's favicon (or logo); default is a #FFFDFA circle with a hairline so it reads on paper. */
.pmark { display: inline-grid; place-items: center; flex: none; overflow: hidden; }
.pmark img { width: 100%; height: 100%; object-fit: contain; }
.pmark-default { border-radius: 50%; background: var(--sand-25); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--primary-text); font-weight: var(--weight-black); }

.tr-shared { opacity: .6; }
.tr-shared + .field, .field + .tr-shared, .tr-shared + .tr-shared { margin-top: var(--space-5); }

.lang-row { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); }

/* ── Page tree ────────────────────────────────────────────────────────────────
   Every row keeps its icon in the same column; nesting is shown by indentation
   and a thin elbow line, and a parent expands from a small pill after its title —
   so there's never an arrow in front of some icons and a gap in front of others. */
.pages-table .page-title-cell { position: relative; padding-left: calc(var(--depth, 0) * 28px); }
/* Tree guides. --x = the depth whose icon centre the line runs through (cell padding 16 + 28 per level + half the 20px icon).
   Lines run 1px past the cell so they cover the row border and read as one continuous line. */
.pages-table td.tree-cell { position: relative; }
.tree-g { position: absolute; left: calc(16px + var(--x) * 28px + 10px - .75px); top: 0; bottom: -1px; width: 0; border-left: 1.5px solid var(--border-strong); pointer-events: none; }
.g-tee::after { content: ""; position: absolute; left: 0; top: 50%; width: 13px; border-top: 1.5px solid var(--border-strong); transform: translateY(-.75px); }
.g-elbow { bottom: auto; height: calc(50% + .75px); width: 13px; border-bottom: 1.5px solid var(--border-strong); border-bottom-left-radius: 7px; }
.g-down { top: calc(50% + 12px); }
.pages-table .t { display: flex; align-items: center; gap: 6px; }
.sub-toggle { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 6px 0 8px; border: 0; border-radius: var(--radius-full); background: var(--chip-neutral); color: var(--chip-neutral-text); font: inherit; font-size: var(--text-xs); font-weight: var(--weight-bold); cursor: pointer; transition: background var(--duration-fast); }
.sub-toggle:hover { background: var(--sand-300); text-decoration: none; }
.sub-toggle:focus-visible { text-decoration: none; }
.sub-toggle .i { transition: transform var(--duration-base) var(--ease-out); }
.sub-toggle[aria-expanded="true"] .i { transform: rotate(180deg); }
.mini-score { font-size: var(--text-sm); font-weight: var(--weight-regular); gap: 8px; }
.type-pick { display: grid; gap: 6px; }
.type-option { display: block; cursor: pointer; }
.type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-option > span { display: grid; grid-template-columns: 18px 1fr; gap: 2px 10px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-lg); transition: border-color var(--duration-fast), background var(--duration-fast); }
.type-option > span .i { color: var(--text-muted); }
.type-option > span .small { grid-column: 2; font-size: var(--text-xs); line-height: 1.35; }
.type-option:hover > span { border-color: var(--border-strong); }
.type-option input:checked + span { border-color: var(--brand); background: var(--primary-soft); }
.type-option input:checked + span .i { color: var(--primary-text); }
.type-option input:focus-visible + span { box-shadow: var(--focus-ring); }

/* Real element previews: rendered at 1200px by the site renderer, scaled to fit. */
.el-preview { position: relative; overflow: hidden; background: #fff; }
.el-preview iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.el-card .el-preview { border-bottom: 1px solid var(--border); cursor: pointer; }
.lib-card .el-preview { border-radius: var(--radius-md); }
.lib-card .el-preview::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--border); pointer-events: none; }

/* ── Editor: posts, translations ── */
.editor-body.is-post { grid-template-columns: 400px minmax(0, 1fr) 340px; }
.post-fields .textarea[data-path="body"] { min-height: 320px !important; }
.ol-empty { padding: 12px; text-align: center; list-style: none; }
.tr-banner { display: flex; gap: 8px; align-items: flex-start; margin: 0 8px 8px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--text); font-size: var(--text-sm); line-height: var(--leading-snug); }
.tr-banner .i { color: var(--primary-text); margin-top: 1px; }
.inspector .tr-banner { margin: 12px 12px 4px; }
.lang-switch button { min-width: 38px; justify-content: center; font-weight: var(--weight-bold); -webkit-text-stroke: 0; }
.tr-progress { display: grid; grid-template-columns: 90px 1fr 36px; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; }
.tr-progress:hover { background: var(--surface-hover); }
.tr-progress .progress { height: 6px; }

/* ── Publish popover (Lovable-style) ── */
.publish-pop .popover-head h2 { display: flex; align-items: center; gap: 10px; }
.pub-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--status-draft); flex: none; }
.pub-dot[data-status="published"] { background: var(--status-published); }
.pub-dot[data-status="changed"] { background: var(--status-changed); }
.publish-pop .popover-body { padding-top: 4px; }
.pub-sub { margin-bottom: 14px; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; color: var(--primary-text); font-weight: var(--weight-bold); cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 4px; }
.pub-diff { margin: -6px 0 14px; max-height: 200px; overflow-y: auto; }
.pub-label { font-weight: var(--weight-bold); margin-bottom: 8px; }
.pub-box { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); overflow: hidden; }
.pub-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 10px 8px 14px; background: none; border: 0; font: inherit; color: var(--text); text-align: left; }
.pub-row + .pub-row { border-top: 1px solid var(--border); }
.pub-row .truncate .subtle { font-weight: var(--weight-regular); }
.pub-row-btn { cursor: pointer; padding-right: 14px; transition: background var(--duration-fast); }
.pub-row-btn:hover { background: var(--surface-hover); }
.pub-row-btn > .i:first-child { color: var(--text-muted); }
.pub-row-btn > .i:last-child { color: var(--text-subtle); }
.pub-fav { width: 20px; height: 20px; border-radius: 5px; object-fit: contain; flex: none; }
.pub-seo { margin-top: 6px; border-radius: var(--radius-md); min-height: 44px; }
.pub-foot { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: 16px; }
.pub-back { margin-bottom: 2px; }
.pub-done { display: grid; justify-items: center; gap: 8px; padding: 12px 0 6px; text-align: center; }
.pub-done h3 { font-size: var(--text-lg); font-weight: var(--weight-bold); margin-top: 6px; }
.pub-done .btn { margin-top: 6px; }

.sb-search .sb-clear[hidden] { display: none; }
.outline-list { grid-template-columns: minmax(0, 1fr); }
.outline-list > li { min-width: 0; }
/* Wide filter groups scroll sideways on small screens instead of widening the page. */
.toolbar .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.toolbar .segmented button { flex: none; }

/* Editor: the outline (and the post fields) start 8px below the panel header, in every language. */
.outline .panel-scroll { padding-top: 8px; }
/* Icon-only buttons with no background at all (e.g. the editor's panel toggle). */
.lang-btn { gap: 6px; }
.lang-btn .i:last-child { color: var(--text-subtle); }

/* Dashboard bottom row: two equal columns. Recent activity is the same timeline as the
   Activity page (avatars on a vertical line), but quiet: grey text, no card, and an
   extra inset on the left when it sits beside "Continue editing". */
.dash-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-6); margin-top: var(--space-8); align-items: start; }
.quiet-activity { padding-left: var(--space-6); }
.quiet-activity .qa-head { display: flex; align-items: center; justify-content: space-between; min-height: 30px; margin: 18px 0 6px; }
.quiet-activity .feed-item { padding: 8px 0; color: var(--text-subtle); font-size: var(--text-sm); -webkit-text-stroke: var(--small-stroke) currentColor; }
.quiet-activity .feed-item:not(:last-child)::before { left: 11.5px; top: 36px; }
.quiet-activity .feed-item b { font-weight: var(--weight-regular); color: var(--text-muted); }
.quiet-activity .feed-item .when a { color: inherit; }
.quiet-activity .avatar { opacity: .8; }
@media (max-width: 1000px) { .dash-split { grid-template-columns: 1fr; } .quiet-activity { padding-left: 0; } }
/* SEO page: placeholder for the site score while pages are being checked. */
.score-wait { display: grid; place-items: center; flex: none; border-radius: 50%; border: 9px solid var(--surface-sunken); color: var(--text-subtle); }
/* Editor → SEO → Advanced: the automatic structured data, read-only. */
.ld-auto { margin-top: 6px; }
.ld-pre { margin-top: 6px; max-height: 260px; overflow: auto; padding: 10px 12px; border-radius: var(--radius-md); background: var(--surface-sunken); font-size: var(--text-xs); line-height: 1.5; white-space: pre; }
/* SEO page → Redirects */
.redir-list { display: grid; gap: 8px; }
.redir-row { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr) 32px; align-items: center; gap: 8px; }
.redir-head .label { margin: 0; }
.redir-arrow { display: grid; place-items: center; color: var(--text-subtle); }
.redir-err { grid-column: 1 / -1; }
.ld-field { grid-template-columns: minmax(0, 1fr); }
/* Image picker: the sheet's full height, folders and images scroll on their own (design rule 27). */
.picker-sheet .modal-body { display: flex; flex-direction: column; overflow: hidden; }
.picker-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
.picker-tree { position: static; padding: 0; min-height: 0; overflow-y: auto; }
.picker-main { display: flex; flex-direction: column; gap: var(--space-4); min-height: 0; }
.picker-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 2px; align-content: start; }
@media (max-width: 700px) { .picker-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); } .picker-tree { max-height: 140px; } }
