.app {
  display: grid;
  grid-template-rows: var(--context-h) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Ambient aurora — a whisper of brand colour breathing behind everything.
   Fixed + detached from scroll; workspaces render transparently over it. */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(620px 420px at 82% -8%, rgba(139, 92, 246, 0.07), transparent 65%),
    radial-gradient(560px 400px at -6% 106%, rgba(236, 72, 153, 0.05), transparent 65%),
    radial-gradient(480px 360px at 50% 55%, rgba(244, 63, 94, 0.025), transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: auroraDrift 60s var(--ease-in-out) infinite alternate;
}
@keyframes auroraDrift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-2.5%, 1.5%) scale(1.06); }
}
body.light-theme::before {
  background:
    radial-gradient(620px 420px at 82% -8%, rgba(139, 92, 246, 0.055), transparent 65%),
    radial-gradient(560px 400px at -6% 106%, rgba(236, 72, 153, 0.04), transparent 65%),
    radial-gradient(480px 360px at 50% 55%, rgba(99, 102, 241, 0.02), transparent 70%);
}

.context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.35);
  -webkit-backdrop-filter: blur(14px) saturate(1.35);
  border-bottom: 1px solid var(--border);
  height: var(--context-h);
  flex-shrink: 0;
  position: relative; z-index: 20;
}
.context-bar .cb-left,
.context-bar .cb-center,
.context-bar .cb-right {
  display: flex; align-items: center; gap: var(--space-2);
}
.context-bar .cb-center { flex: 1; justify-content: center; }
.context-bar .cb-right { justify-content: flex-end; }

.breadcrumb { display: flex; align-items: center; gap: var(--space-1); font-size: 13px; color: var(--muted); }
.breadcrumb a { color: var(--muted); cursor: pointer; }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb .sep { color: var(--dim); }
.breadcrumb .current { color: var(--text); font-weight: 500; }

.brandmark {
  display: flex; align-items: center; gap: var(--space-2);
  font-weight: 800; font-size: 17px; letter-spacing: -0.02em;
  color: var(--text);
}
.brandmark .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gradient-brand); flex-shrink: 0; }
.brandmark .ember-dot { width: 5px; height: 5px; background: var(--ember); flex-shrink: 0; }
.brandmark .em-dot-tld { color: var(--ember); }

.main {
  display: grid;
  grid-template-columns: auto 1fr;
  overflow: hidden;
  min-height: 0;
}
.main.nav-hidden { grid-template-columns: 0 1fr; }

.nav-panel {
  width: var(--nav-w);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: var(--space-4) var(--space-3);
  gap: var(--space-1);
  overflow: visible;
  position: relative; /* anchors the sliding nav-indicator pill */
  transition: width 0.2s var(--ease-in-out);
  z-index: 10;
}
.nav-panel.collapsed { width: var(--nav-w-collapsed); padding: var(--space-4) var(--space-2); }

/* Edge tab — half-pill on the panel's right edge; the chevron flips as the
   panel opens/closes. Always visible, always in the same place. */
.nav-toggle {
  position: absolute;
  right: -11px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 84px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 12;
  padding: 0;
  box-shadow: var(--shadow-1);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), height var(--dur) var(--ease);
}
.nav-toggle:hover { color: var(--violet); border-color: var(--violet); box-shadow: var(--shadow-2); height: 96px; }
.nav-toggle:active { transform: translateY(-50%) scale(0.94); transition-duration: var(--dur-fast); }
.nav-toggle .nt-icon { display: flex; align-items: center; justify-content: center; }
.nav-toggle .nt-icon svg { width: 12px; height: 12px; transform: rotate(-90deg); transition: transform 240ms var(--ease-out); }
.nav-panel.collapsed .nav-toggle .nt-icon svg { transform: rotate(90deg); }
.light-theme .nav-toggle { background: #ffffff; }
.nav-section { margin-top: var(--space-4); padding: 0 var(--space-3); }
.nav-section .tiny { padding: var(--space-2) var(--space-3); }
.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  border: none; background: transparent; width: 100%; text-align: left;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { color: var(--text); background: var(--surface-2); }
/* The active indicator is ONE pill that slides between items (JS-driven
   top/height). Replaces the per-item static ::before bar. */
.nav-indicator {
  position: absolute;
  left: 3px;
  width: 3px;
  border-radius: 2px;
  background: var(--gradient-brand);
  opacity: 0;
  z-index: 1;
  transition: top 280ms var(--spring), height 280ms var(--spring), opacity var(--dur) var(--ease);
}
.nav-item .nav-lock { margin-left: auto; color: var(--dim); }
.nav-item .nav-badge { margin-left: auto; }
.nav-panel.collapsed .nav-item { justify-content: center; padding: 10px; }
.nav-panel.collapsed .nav-item .nav-label,
.nav-panel.collapsed .nav-item .nav-lock,
.nav-panel.collapsed .nav-item .nav-badge,
.nav-panel.collapsed .nav-section .tiny,
.nav-panel.collapsed .nav-section { display: none; }
.nav-spacer { flex: 1; }

.nav-site-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.nav-site-card:hover { border-color: var(--ember); box-shadow: 0 0 0 3px var(--info-bg); }
.nav-site-avatar {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--gradient-brand);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.nav-site-info { min-width: 0; flex: 1; }
.nav-site-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-site-url { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.nav-panel.collapsed .nav-site-info { display: none; }
.nav-panel.collapsed .nav-site-card { justify-content: center; padding: var(--space-2); }

.nav-item .icon.tier-amber { color: #F59E0B; }
.nav-item .icon.tier-violet { color: #8B5CF6; }

.nav-panel.collapsed .nav-item { position: relative; }
.nav-panel.collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ember);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  z-index: 300;
  box-shadow: var(--shadow-3);
}
.nav-panel.collapsed .nav-item:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}
.nav-panel.collapsed .nav-site-card { position: relative; }
.nav-panel.collapsed .nav-site-card::after {
  content: attr(data-site-name);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ember);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
  z-index: 300;
  box-shadow: var(--shadow-3);
}
.nav-panel.collapsed .nav-site-card:hover::after { opacity: 1; }

.canvas-host {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: transparent; /* the body's ambient aurora breathes through */
  z-index: 1;
}
/* Direction-aware workspace slide: the incoming view arrives from the
   direction of travel, the outgoing drifts away. Transform + opacity only. */
.workspace {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transform: translateX(0);
  transition: opacity var(--dur) var(--ease), transform var(--dur-slow) var(--ease-out);
}
.workspace.active { opacity: 1; pointer-events: auto; }
.workspace.exit-left { transform: translateX(-14px); }
.workspace.exit-right { transform: translateX(14px); }
.workspace.enter-from-left { transform: translateX(-14px); transition: none; }
.workspace.enter-from-right { transform: translateX(14px); transition: none; }
.host-scroll { position: absolute; inset: 0; overflow-y: auto; padding: var(--space-6) var(--space-7); }
.host-fill { position: absolute; inset: 0; }
.workspace-scroll { flex: 1; overflow-y: auto; padding: var(--space-6) var(--space-7); }
.workspace-narrow { max-width: 640px; margin: 0 auto; }
.workspace-head { margin-bottom: var(--space-5); }
.workspace-head .h1 { margin-bottom: var(--space-2); }
.workspace-head .small { max-width: 620px; }

/* Staggered arrivals — freshly rendered grid children rise in sequence. */
.pages-grid > *,
.cl-grid > *,
.media-workspace-grid > *,
.article-template-grid > *,
.create-media-grid > * { animation: rise-in var(--dur-slow) var(--ease-out) backwards; }
.pages-grid > *:nth-child(2), .cl-grid > *:nth-child(2), .media-workspace-grid > *:nth-child(2), .article-template-grid > *:nth-child(2), .create-media-grid > *:nth-child(2) { animation-delay: 30ms; }
.pages-grid > *:nth-child(3), .cl-grid > *:nth-child(3), .media-workspace-grid > *:nth-child(3), .article-template-grid > *:nth-child(3), .create-media-grid > *:nth-child(3) { animation-delay: 60ms; }
.pages-grid > *:nth-child(4), .cl-grid > *:nth-child(4), .media-workspace-grid > *:nth-child(4), .article-template-grid > *:nth-child(4), .create-media-grid > *:nth-child(4) { animation-delay: 90ms; }
.pages-grid > *:nth-child(5), .cl-grid > *:nth-child(5), .media-workspace-grid > *:nth-child(5), .article-template-grid > *:nth-child(5), .create-media-grid > *:nth-child(5) { animation-delay: 120ms; }
.pages-grid > *:nth-child(6), .cl-grid > *:nth-child(6), .media-workspace-grid > *:nth-child(6), .article-template-grid > *:nth-child(6), .create-media-grid > *:nth-child(6) { animation-delay: 150ms; }
.pages-grid > *:nth-child(7), .cl-grid > *:nth-child(7), .media-workspace-grid > *:nth-child(7), .article-template-grid > *:nth-child(7), .create-media-grid > *:nth-child(7) { animation-delay: 180ms; }
.pages-grid > *:nth-child(n+8), .cl-grid > *:nth-child(n+8), .media-workspace-grid > *:nth-child(n+8), .article-template-grid > *:nth-child(n+8), .create-media-grid > *:nth-child(n+8) { animation-delay: 210ms; }

.publish-btn {
  position: relative;
}
.publish-btn .pending {
  position: absolute; top: -6px; right: -8px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--ember);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
  font-variant-numeric: tabular-nums;
}
.nav-badge { font-variant-numeric: tabular-nums; }

.toast-stack {
  position: fixed; bottom: var(--space-5); right: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-2);
  z-index: 2100; max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-4);
  animation: toastin 320ms var(--ease-out);
  min-width: 280px;
  overflow: hidden;
  position: relative;
}
@keyframes toastin {
  from { transform: translateX(28px) scale(0.98); opacity: 0; }
  60% { transform: translateX(-2px) scale(1); }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
/* Exit: collapse handled in JS (height+margin to 0) so the stack reflows. */
.toast.closing { opacity: 0; transform: translateX(28px); transition: opacity 180ms var(--ease-in-out), transform 180ms var(--ease-in-out); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast .toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-title { font-size: 13px; font-weight: 600; color: var(--text); }
.toast .toast-msg { font-size: 13px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.toast .toast-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.toast .toast-close { color: var(--dim); background: none; border: none; cursor: pointer; padding: 2px; flex-shrink: 0; }
.toast .toast-close:hover { color: var(--text); }
/* Success check draws itself in (stroke-dashoffset) — a tiny moment. */
.toast .toast-icon svg.checkdraw path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: toastcheck 420ms 90ms var(--ease-out) forwards; }
@keyframes toastcheck { to { stroke-dashoffset: 0; } }
/* Timed toasts carry a hairline progress ribbon (ttl countdown). */
.toast .toast-progress {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  transform-origin: left center;
  background: var(--muted); opacity: 0.4;
}
.toast.success .toast-progress { background: var(--success); }
.toast.error .toast-progress { background: var(--error); }
.toast.warning .toast-progress { background: var(--warning); }
.toast.info .toast-progress { background: var(--info); }
.toast .toast-progress.run { animation: toastdrain linear forwards; }
@keyframes toastdrain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Connect screen — the welcome moment. Ambient gradient orbs drift slowly
   behind a card whose contents arrive in a gentle stagger. */
.connect-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100%; padding: var(--space-7);
  overflow-y: auto;
  position: relative;
}
.connect-screen::before,
.connect-screen::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}
.connect-screen::before {
  width: 480px; height: 480px;
  top: -140px; right: -120px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.14), transparent 70%);
  animation: orbDriftA 46s var(--ease-in-out) infinite alternate;
}
.connect-screen::after {
  width: 420px; height: 420px;
  bottom: -160px; left: -100px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.10), transparent 70%);
  animation: orbDriftB 52s var(--ease-in-out) infinite alternate;
}
@keyframes orbDriftA { from { transform: translate(0, 0) scale(1); } to { transform: translate(-60px, 50px) scale(1.12); } }
@keyframes orbDriftB { from { transform: translate(0, 0) scale(1); } to { transform: translate(50px, -40px) scale(1.08); } }
.connect-card {
  width: 100%; max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  box-shadow: var(--shadow-2);
  position: relative; z-index: 1;
  animation: rise-in 420ms var(--ease-out) backwards;
}
.connect-card > * { animation: rise-in 360ms var(--ease-out) backwards; }
.connect-card > *:nth-child(1) { animation-delay: 60ms; }
.connect-card > *:nth-child(2) { animation-delay: 110ms; }
.connect-card > *:nth-child(3) { animation-delay: 160ms; }
.connect-card > *:nth-child(4) { animation-delay: 210ms; }
.connect-card > *:nth-child(5) { animation-delay: 260ms; }
.connect-card > *:nth-child(6) { animation-delay: 310ms; }
.connect-card > *:nth-child(n+7) { animation-delay: 360ms; }
.light-theme .connect-card { background: linear-gradient(145deg, #ffffff, #f9f7fe); }
.connect-logo { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-5); font-weight: 800; font-size: 20px; }
.connect-logo .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--gradient-brand); animation: logoPulse 2.6s var(--ease-in-out) infinite; }
@keyframes logoPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.0); } 50% { box-shadow: 0 0 0 7px rgba(236, 72, 153, 0.10); } }
.connect-logo .tld { color: var(--ember); }
.connect-tag { font-size: 13px; color: var(--muted); margin-bottom: var(--space-6); }
/* Connect success — check ring draws, then the app flows into the workspace. */
.connect-success {
  position: fixed; inset: 0; z-index: 1500;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.connect-success .cs-ring {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--success-bg);
  display: flex; align-items: center; justify-content: center;
  animation: csPop 460ms var(--spring) backwards;
}
.connect-success .cs-ring svg { width: 34px; height: 34px; color: var(--success); }
.connect-success .cs-ring svg path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: toastcheck 360ms 140ms var(--ease-out) forwards; }
.connect-success .cs-ring svg circle { stroke-dasharray: 63; stroke-dashoffset: 63; animation: csRing 520ms var(--ease-out) forwards; }
@keyframes csPop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes csRing { to { stroke-dashoffset: 0; } }
.connect-success.done { opacity: 0; transition: opacity 220ms var(--ease-in-out); }
.saved-site {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; margin-bottom: var(--space-2);
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.saved-site:hover { border-color: var(--ember); transform: translateY(-1px); }
.saved-site .site-info { flex: 1; min-width: 0; }
.saved-site .site-label { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-site .site-url { font-size: 12px; color: var(--muted); }
.saved-site .site-remove { color: var(--dim); background: none; border: none; cursor: pointer; padding: 4px; }
.saved-site .site-remove:hover { color: var(--error); }

.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.pages-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.pages-list-head, .pages-list-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--space-3); padding: 12px 16px; align-items: center; }
.pages-list-head { background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.pages-list-row { border-bottom: 1px solid var(--hair); cursor: pointer; transition: background 0.15s var(--ease); }
.pages-list-row:last-child { border-bottom: none; }
.pages-list-row:hover { background: var(--surface-2); }
.plr-title { font-size: 14px; font-weight: 600; color: var(--text); }
.plr-slug { font-size: 13px; color: var(--muted); }
.plr-status { display: flex; gap: 6px; justify-content: flex-end; }
.page-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  position: relative;
}
.light-theme .page-card { background: linear-gradient(145deg, #ffffff, #f9f7fe); }
.page-card:hover { transform: translateY(-2px); border-color: var(--ember); box-shadow: var(--shadow-2); }
.page-card .page-thumb {
  height: 140px; border-radius: var(--radius);
  background: var(--surface-2);
  margin-bottom: var(--space-4);
  overflow: hidden; position: relative;
  border: 1px solid var(--border);
}
.page-card .page-thumb img { transition: transform 420ms var(--ease-out); }
.page-card:hover .page-thumb img { transform: scale(1.035); }
.page-card .page-thumb .page-thumb-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; color: var(--dim);
  letter-spacing: -0.02em;
}
.page-card .page-thumb-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.page-card .page-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: var(--space-1); }
.page-card .page-url { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-card .page-pending {
  position: absolute; top: 150px; right: 14px; z-index: 2;
  background: var(--warning-bg); color: var(--warning);
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: var(--radius-xl);
}
.page-card .page-front {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  background: rgba(1,1,29,0.85); backdrop-filter: blur(4px);
  color: var(--info);
  font-size: 10px; font-weight: 600; padding: 3px 9px;
  border-radius: var(--radius-xl); letter-spacing: 0.04em; text-transform: uppercase;
}
.page-card .page-draft {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  background: var(--warning-bg); color: var(--warning);
  font-size: 10px; font-weight: 700; padding: 3px 9px;
  border-radius: var(--radius-xl); letter-spacing: 0.04em; text-transform: uppercase;
}
.page-card .page-front ~ .page-draft { left: auto; right: 10px; }

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 6px var(--panel-w);
  height: 100%;
  overflow: hidden;
}
.editor-layout.panel-hidden { grid-template-columns: 1fr 0 0; }

/* Drag handle between the preview and the properties panel */
.editor-resizer {
  cursor: col-resize;
  background: transparent;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10;
  touch-action: none; /* pointer events own this element — no gesture hijack */
}
.editor-resizer:hover,
.editor-resizer.dragging {
  background: var(--ember);
}
/* While resizing: the webview must never eat pointer events (drag hang),
   and the canvas must not animate width (drag = instant feedback). */
.editor-layout.resizing webview { pointer-events: none; transition: none !important; }
/* Device toggle (desktop/tablet/mobile): the webview glides to its new width. */
.editor-canvas webview { transition: width 280ms var(--ease); }
.editor-resizer .resizer-grip {
  width: 2px;
  height: 32px;
  border-radius: 1px;
  background: var(--border);
  transition: background 0.15s;
}
.editor-resizer:hover .resizer-grip,
.editor-resizer.dragging .resizer-grip {
  background: var(--ember);
}
.editor-canvas {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.editor-canvas webview {
  width: 100%; height: 100%;
  border: none;
  display: inline-flex;
}
.editor-toolbar {
  position: absolute; top: var(--space-3); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow-2);
  z-index: 5;
}
.editor-toolbar .device-group { display: flex; gap: 2px; }
.editor-page-select {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font); font-size: 13px; font-weight: 500;
  padding: 6px 28px 6px 10px; cursor: pointer; outline: none; max-width: 180px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A0A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.editor-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-3); background: var(--bg);
  z-index: 4;
}
.editor-loading .small { color: var(--muted); }
.properties-panel {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0; /* let the grid track clamp it; contents handle their own fit */
  container-type: inline-size;
}
.properties-head {
  padding: var(--space-4) var(--space-5) var(--space-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.pp-mode-tabs {
  display: flex; gap: 2px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
}
.pp-mode-tab {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 6px;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.pp-mode-tab svg { width: 14px; height: 14px; flex-shrink: 0; }
.pp-mode-tab span { overflow: hidden; text-overflow: ellipsis; }
/* Narrow panel: icon-only tabs — the labels gracefully bow out. */
@container (max-width: 320px) {
  .pp-mode-tab span { display: none; }
  .pp-mode-tab { flex: 0 0 auto; padding: 8px 12px; }
}
.pp-mode-tab:hover { color: var(--text); }
.pp-mode-tab.active { color: var(--ember); border-bottom-color: var(--ember); }
.pending-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); margin-bottom: var(--space-2); cursor: pointer; }
.pending-item:hover { border-color: var(--ember); }
.pending-item.pending-nav:hover { border-color: var(--ember); box-shadow: var(--shadow-2); }
.pending-item-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.pending-page-tag { font-size: 10px; }
.pending-field-name { color: var(--muted); font-size: 12px; }
.pending-item-input { font-size: 13px; }
.pending-group { margin-bottom: var(--space-4); }
.pending-group-head { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: var(--space-2); padding-bottom: var(--space-1); border-bottom: 1px solid var(--hair); display: flex; align-items: center; gap: var(--space-2); }
.reposition-frame {
  width: 100%; height: 130px;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
  position: relative; cursor: grab;
  user-select: none;
}
.reposition-frame:active { cursor: grabbing; }
.reposition-crosshair {
  position: absolute; width: 20px; height: 20px;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%);
  pointer-events: none; transition: opacity 0.1s;
  background: rgba(236,72,153,0.3);
}
.properties-head .pp-title { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: var(--space-2); }
.properties-head .pp-title svg { color: var(--ember); }
.properties-body { flex: 1; overflow-y: auto; padding: var(--space-4) var(--space-5); }
.properties-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; height: 100%; gap: var(--space-3); padding: var(--space-7) var(--space-5);
}
.properties-empty .pe-icon { color: var(--dim); }
.properties-empty .pe-title { font-size: 15px; font-weight: 600; color: var(--text); }
.properties-empty .pe-desc { font-size: 13px; color: var(--muted); max-width: 240px; line-height: 1.5; }
.properties-foot { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); flex-shrink: 0; }

.pp-section { margin-bottom: var(--space-5); }
.pp-section .pp-label { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--dim); margin-bottom: var(--space-2); }
.pp-meta-row { display: flex; justify-content: space-between; font-size: 12px; padding: 6px 0; }
.pp-meta-row .k { color: var(--muted); }
.pp-meta-row .v { color: var(--text); font-weight: 500; max-width: 60%; text-align: right; word-break: break-word; }

.ai-result {
  background: var(--info-bg);
  border-left: 3px solid var(--ember);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
}
.ai-result .ai-result-label { font-size: 11px; font-weight: 700; color: var(--ember); text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-2); }
.ai-result .ai-result-label svg { width: 13px; height: 13px; flex-shrink: 0; }
.ai-result .ai-result-text { font-size: 14px; color: var(--text); line-height: 1.55; white-space: pre-wrap; }
.ai-result .ai-result-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.ai-result.loading .ai-result-text { color: var(--muted); display: flex; align-items: center; gap: var(--space-2); }

.ai-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.ai-action {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 10px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.ai-action:hover { border-color: var(--ember); background: var(--info-bg); }
.ai-action svg { width: 14px; height: 14px; color: var(--ember); }
.ai-action:disabled { opacity: 0.5; cursor: not-allowed; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--space-2);
}
.media-item {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  overflow: hidden; cursor: pointer;
  border: 2px solid transparent;
  background: var(--surface-2);
  position: relative;
}
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item:hover { border-color: var(--ember); }
.media-item.selected { border-color: var(--ember); }

.context-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px;
  box-shadow: var(--shadow-4);
  z-index: 1500;
  min-width: 200px;
  animation: fadein 0.12s var(--ease);
}
.context-menu .cm-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); cursor: pointer;
}
.context-menu .cm-item:hover { background: var(--surface-2); }
.context-menu .cm-item svg { width: 14px; height: 14px; color: var(--ember); }
.context-menu .cm-sep { height: 1px; background: var(--border); margin: 4px 0; }
.context-menu .cm-item.danger { color: var(--error); }
.context-menu .cm-item.danger svg { color: var(--error); }

.sections-list { display: flex; flex-direction: column; gap: var(--space-2); }
.section-row {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: grab;
}
.section-row.dragging { opacity: 0.5; }
.section-row.drag-over { border-color: var(--ember); }
.section-row .grip { color: var(--dim); cursor: grab; display: flex; }
.section-row .sec-label { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-row .sec-toggle { color: var(--dim); background: none; border: none; cursor: pointer; padding: 4px; }
.section-row .sec-toggle:hover { color: var(--text); }
.section-row.hidden-sec .sec-label { color: var(--dim); text-decoration: line-through; }

.review-list { display: flex; flex-direction: column; gap: var(--space-3); max-height: 50vh; overflow-y: auto; padding-right: var(--space-2); }
.review-group { }
.review-group .rg-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-2); display: flex; align-items: center; gap: 6px; }
.review-group .rg-title svg { width: 15px; height: 15px; flex-shrink: 0; }
.review-item {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--space-3);
  animation: rise-in var(--dur) var(--ease-out) backwards;
}
.review-item .ri-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-1); }
.review-item .ri-label { font-size: 13px; font-weight: 600; color: var(--text); }
/* Before → after diff: live value (muted) above the new value (confirmed). */
.review-item .ri-diff { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.review-item .ri-before,
.review-item .ri-after {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 12.5px; line-height: 1.5;
  border-radius: 7px; padding: 5px 9px;
  min-width: 0;
}
.review-item .ri-before { background: var(--surface); color: var(--muted); }
.review-item .ri-after { background: var(--success-bg); color: var(--text); }
.review-item .ri-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  flex-shrink: 0; padding: 1px 6px; border-radius: 99px;
}
.review-item .ri-before .ri-tag { color: var(--dim); border: 1px solid var(--border); }
.review-item .ri-after .ri-tag { color: var(--success); border: 1px solid var(--success); }
.review-item .ri-text { word-break: break-word; min-width: 0; }

.ai-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--space-2); }
.ai-preset {
  padding: 10px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); cursor: pointer; text-align: center;
  transition: border-color 0.15s var(--ease);
}
.ai-preset:hover { border-color: var(--ember); }
.ai-preset.active { border-color: var(--ember); background: var(--info-bg); }

.settings-section { margin-bottom: var(--space-6); }
.settings-section .ss-title { font-size: 15px; font-weight: 700; margin-bottom: var(--space-1); }
.settings-section .ss-desc { font-size: 13px; color: var(--muted); margin-bottom: var(--space-4); }

.test-result {
  margin-top: var(--space-3); padding: var(--space-3);
  border-radius: var(--radius-sm); font-size: 13px;
  display: flex; align-items: flex-start; gap: var(--space-2);
}
.test-result.ok { background: var(--success-bg); color: var(--success); }
.test-result.fail { background: var(--error-bg); color: var(--error); }
.test-result.testing { background: var(--info-bg); color: var(--info); }
.test-result.warning { background: var(--warning-bg); color: var(--warning); }
.test-result svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.tier-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-5); position: relative;
}
.tier-card.current { border-color: var(--ember); }
.tier-card .tier-name { font-size: 16px; font-weight: 700; margin-bottom: var(--space-1); }
.tier-card .tier-price { font-size: 22px; font-weight: 800; color: var(--ember); margin-bottom: var(--space-3); }
.tier-card .tier-feats { font-size: 13px; color: var(--muted); line-height: 1.7; }
.tier-card .tier-current-badge { position: absolute; top: var(--space-4); right: var(--space-4); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); } .gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); }
.mb-2 { margin-bottom: var(--space-2); } .mb-3 { margin-bottom: var(--space-3); } .mb-4 { margin-bottom: var(--space-4); }
.text-muted { color: var(--muted); } .text-dim { color: var(--dim); } .text-ember { color: var(--ember); }
.flex-1 { flex: 1; } .min-w-0 { min-width: 0; }
.hidden { display: none !important; }
.center { text-align: center; }
.relative { position: relative; }

.brand-fields { display: flex; flex-direction: column; gap: var(--space-4); }
.brand-fields .field { margin: 0; }
.brand-color-input { -webkit-appearance: none; appearance: none; }
.brand-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.brand-color-input::-webkit-color-swatch { border: none; border-radius: 6px; }

.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.cl-card { padding: 0; overflow: hidden; position: relative; }
.cl-thumb { height: 130px; background: var(--surface-2); overflow: hidden; }
.cl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cl-title { padding: var(--space-3) var(--space-4) 0; font-size: 15px; font-weight: 600; color: var(--text); }
.cl-excerpt { padding: var(--space-1) var(--space-4) var(--space-2); font-size: 13px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cl-meta-row { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-4) var(--space-4); }
.cl-card-delete { position: absolute; top: var(--space-2); right: var(--space-2); z-index: 4; opacity: 0; transition: opacity var(--dur) var(--ease); }
.cl-card:hover .cl-card-delete, .page-card:hover .cl-card-delete { opacity: 1; }
.cl-card-delete svg { width: 14px; height: 14px; }
.cl-pending { position: absolute; top: var(--space-3); right: var(--space-3); }
.cl-edit-body { max-height: 55vh; overflow-y: auto; }

.media-workspace-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--space-4); }
.media-cell { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.light-theme .media-cell { background: linear-gradient(145deg, #ffffff, #f9f7fe); }
.media-cell-img { height: 140px; background: var(--surface-2); overflow: hidden; }
.media-cell-img img { width: 100%; height: 100%; object-fit: cover; }
.media-cell-name { padding: var(--space-2) var(--space-3); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-cell-actions { padding: var(--space-2) var(--space-3) var(--space-3); margin-top: auto; }
.media-cell-actions .btn { width: 100%; }

.io-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: var(--space-7) var(--space-5);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.io-dropzone.drag-over { border-color: var(--ember); background: var(--info-bg); }
.io-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-4); margin-top: var(--space-5); }
.io-card { padding: var(--space-4); }
.io-card-head { display: flex; gap: var(--space-3); margin-bottom: var(--space-3); }
.io-thumb { width: 80px; height: 80px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); }
.io-thumb img { width: 100%; height: 100%; object-fit: cover; }
.io-card-meta { flex: 1; min-width: 0; }
.io-card-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.io-card-body .field { margin-bottom: var(--space-2); }
.io-card-body .field-label { font-size: 11px; }
.io-card-body .input, .io-card-body .textarea { padding: 8px 10px; font-size: 13px; }

.cu-layout { display: grid; grid-template-columns: 260px minmax(0,1fr); gap: var(--space-5); height: 100%; padding: var(--space-6) var(--space-7); margin: 0 auto; }
@media (max-width: 860px) { .cu-layout { grid-template-columns: 1fr; height: auto; } }
.cu-sources { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); overflow-y: auto; max-height: 100%; }
.cu-sources-head .h3 { font-size: 16px; }
.cu-source-list { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-4); }
.cu-config { border-top: 1px solid var(--hair); margin-top: var(--space-3); padding-top: var(--space-3); flex-shrink: 0; }
.cu-source { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); }
.cu-source-label { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-word; }
.cu-main { display: flex; flex-direction: column; min-height: 0; }
.cu-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.cu-toolbar .h3 { font-size: 16px; }
.cu-filters { align-self: flex-start; margin-bottom: var(--space-3); }
.cu-progress { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); margin-bottom: var(--space-3); }
.cu-stage-bar { margin-bottom: var(--space-3); }
.cu-list { flex: 1; overflow-y: auto; padding-right: var(--space-2); display: flex; flex-direction: column; gap: var(--space-3); }
.cu-card { padding: var(--space-4); }
.cu-card-head { display: flex; gap: var(--space-3); }
.cu-card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.cu-diff { margin-top: var(--space-3); display: grid; grid-template-columns: 90px 1fr; gap: var(--space-2) var(--space-3); align-items: start; }
.cu-diff-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); padding-top: 2px; }
.cu-diff-current { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--space-2); border-left: 3px solid var(--dim); }
.cu-diff-proposed { font-size: 13px; color: var(--text); background: var(--success-bg); border-radius: var(--radius-sm); padding: var(--space-2); border-left: 3px solid var(--success); }
.cu-article-preview { margin-top: var(--space-3); }
.cu-article-iframe { width: 100%; height: 220px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.cu-refs { margin-top: var(--space-3); }
.cu-refs-body { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.cu-ref { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--space-2); border-left: 3px solid var(--violet); }
.cu-ref-excerpt { font-size: 12px; color: var(--text); font-style: italic; line-height: 1.5; }
.cu-ref-display { font-size: 11px; color: var(--violet); margin-top: var(--space-1); font-weight: 600; }
.cu-card-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }

/* ===== HOME DASHBOARD ===== */
.home-wrap { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-4); }
.home-welcome { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.home-welcome-actions { display: flex; align-items: center; gap: var(--space-2); }
.home-hero-avatar {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--gradient-brand);
  color: #fff; font-size: 23px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-2);
  margin-left: var(--space-2);
}
/* Hero live-preview of the homepage */
.home-preview {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  aspect-ratio: 16 / 9;
  max-height: 52vh;
  box-shadow: var(--shadow-2);
  animation: rise-in var(--dur-slow) var(--ease-out) backwards;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.home-preview:hover { box-shadow: var(--shadow-3); border-color: var(--violet); transform: translateY(-2px); }
.home-preview-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.home-preview-media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transform-origin: top center; user-select: none; }
.home-preview-hint {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(1, 1, 29, 0.45);
  backdrop-filter: blur(2px);
  color: #fff; font-size: 14px; font-weight: 600;
  opacity: 0; transition: opacity var(--dur) var(--ease);
  pointer-events: none;
}
.home-preview-hint svg { width: 16px; height: 16px; }
.home-preview:hover .home-preview-hint { opacity: 1; }
.home-preview-visit {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gradient-brand);
  color: #fff; font-size: 12.5px; font-weight: 700;
  padding: 8px 16px; border-radius: 99px; border: none; cursor: pointer;
  box-shadow: var(--shadow-3);
  transition: filter var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.home-preview-visit svg { width: 14px; height: 14px; }
.home-preview-visit:hover { filter: brightness(1.08); transform: translateY(-1px); }
.home-preview-visit:active { transform: translateY(0) scale(0.97); }
.home-preview-fallback { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
/* Duo row: content updates + website health, equal widths */
.home-duo { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: stretch; }
@media (max-width: 900px) { .home-duo { grid-template-columns: 1fr; } }
.home-duo .home-card { animation: rise-in var(--dur-slow) var(--ease-out) backwards; }
.home-duo .home-card:nth-child(2) { animation-delay: 60ms; }
.home-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.home-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.home-card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--text); }
.home-card-title svg { width: 16px; height: 16px; color: var(--ember); }
.home-setup { text-align: left; }
.home-setup-title { font-size: 16px; font-weight: 700; color: var(--text); }
.home-sug-list { display: flex; flex-direction: column; gap: 6px; }
.home-sug-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  animation: rise-in var(--dur) var(--ease-out) backwards;
}
.home-sug-row:nth-child(2) { animation-delay: 40ms; }
.home-sug-row:nth-child(3) { animation-delay: 80ms; }
.home-sug-row:hover { background: var(--surface-2); }
.hsr-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); color: var(--ember); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hsr-icon svg { width: 14px; height: 14px; }
.hsr-text { min-width: 0; }
.hsr-title { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-allclear { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: var(--space-2) 0; }
.home-allclear .empty-icon { color: var(--success); margin: 0; animation: emptyFloat 3.8s var(--ease-in-out) infinite; }
.home-allclear-title { font-size: 15px; font-weight: 700; color: var(--text); margin-top: 4px; }
/* Website health internals */
.home-health-body { display: flex; flex-direction: column; gap: var(--space-3); min-height: 120px; }
.home-health-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.hh-stat { display: flex; flex-direction: column; gap: 3px; }
.hh-sub { color: var(--dim); font-weight: 500; }
.hh-num { font-size: 21px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.home-health-spark { height: 110px; border-top: 1px solid var(--hair); padding-top: var(--space-2); }
.home-health-prompt { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; }
/* Activity */
.home-card.home-activity { animation: rise-in var(--dur-slow) var(--ease-out) backwards; animation-delay: 120ms; }
.home-act-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: 13px; }
.home-act-row svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }
.home-act-row svg { color: var(--muted); }
.home-act-row.warn svg { color: var(--warning); }
.home-act-row.ok svg { color: var(--success); }
.home-act-row b { font-weight: 600; color: var(--text); word-break: break-word; }
.har-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); flex-shrink: 0; margin-top: 6px; }
.home-stats { display: flex; gap: var(--space-5); margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--hair); }
.home-stat-num { font-size: 22px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

/* ===== UPDATE REPORT ===== */
.rep-list { display: flex; flex-direction: column; gap: var(--space-2); max-height: 46vh; overflow-y: auto; padding-right: var(--space-2); }
.rep-row {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  animation: rise-in var(--dur) var(--ease-out) backwards;
}
.rep-row:nth-child(n+2) { animation-delay: 30ms; }
.rep-row:nth-child(n+5) { animation-delay: 60ms; }
.rep-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--surface); color: var(--success); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rep-icon.ok { color: var(--violet); }
.rep-icon svg { width: 14px; height: 14px; }
.rep-text { flex: 1; min-width: 0; }
.rep-text b { font-size: 13.5px; font-weight: 600; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.brand-identity-grid { display: grid; grid-template-columns: auto 1fr 1.4fr; gap: var(--space-5); align-items: start; }
@media (max-width: 860px) { .brand-identity-grid { grid-template-columns: 1fr; } }
.brand-id-block { display: flex; flex-direction: column; align-items: flex-start; }
.brand-font-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--hair); }
.brand-font-row:last-of-type { border-bottom: none; }
.brand-font-name { font-size: 15px; font-weight: 600; color: var(--text); }
.brand-palette-row { display: flex; gap: 8px; flex-wrap: wrap; }
.brand-swatch { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); display: inline-block; box-shadow: var(--shadow-1); }
/* Editor: Brand styling section */
.bs-colors { display: flex; gap: 7px; flex-wrap: wrap; }
.bs-color { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); cursor: pointer; transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.bs-color:hover { transform: scale(1.14); }
.bs-color.active { border-color: var(--ember); box-shadow: 0 0 0 2px var(--info-bg); }
.cm-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); padding: 4px 12px; }

/* ===== PUBLISH CELEBRATION ===== */
/* A bold gradient band sweeps the canvas while "Published live" rises in
   the centre — the moment your work goes live. */
.publish-sweep {
  position: fixed; inset: 0; z-index: 2400;
  overflow: hidden;
  pointer-events: none;
}
.publish-sweep i {
  position: absolute; inset: -20% -60%;
  background: linear-gradient(105deg, transparent 40%, rgba(139, 92, 246, 0.20) 47%, rgba(236, 72, 153, 0.26) 52%, rgba(249, 115, 22, 0.16) 57%, transparent 64%);
  transform: translateX(-70%);
  animation: publishSweep 1500ms var(--ease-out) forwards;
}
@keyframes publishSweep {
  from { transform: translateX(-70%); }
  to { transform: translateX(70%); }
}
/* Hero text: rises with a spring settle, holds, breathes away. */
.publish-sweep .ps-hero {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  opacity: 0;
  animation: psHero 2100ms 250ms var(--ease-out) forwards;
}
@keyframes psHero {
  0% { opacity: 0; transform: scale(0.92) translateY(10px); }
  14% { opacity: 1; transform: scale(1.015) translateY(0); }
  22% { transform: scale(1) translateY(0); }
  72% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(1.03) translateY(-6px); }
}
.publish-sweep .ps-ring {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--success-bg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 10px rgba(34, 197, 94, 0.06), var(--shadow-3);
}
.publish-sweep .ps-ring svg { width: 34px; height: 34px; color: var(--success); }
.publish-sweep .ps-ring svg path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: toastcheck 380ms 480ms var(--ease-out) forwards; }
.publish-sweep .ps-ring svg circle { stroke-dasharray: 63; stroke-dashoffset: 63; animation: csRing 520ms 380ms var(--ease-out) forwards; }
.publish-sweep .ps-text {
  font-size: clamp(40px, 5.5vw, 64px);
  font-weight: 800; letter-spacing: -0.035em; line-height: 1;
  background: var(--gradient-brand);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  text-shadow: none;
}

/* ===== CONTENT UPDATES: article plan + source reader ===== */
/* Article plan — the pre-draft presentation (topic, key facts, sources). */
.ap { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; animation: rise-in var(--dur) var(--ease-out) backwards; }
.ap-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ap-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ember); }
.ap-eyebrow svg { width: 13px; height: 13px; }
.ap-head .badge { display: inline-flex; align-items: center; gap: 5px; }
.ap-head .badge svg { width: 11px; height: 11px; }
.ap-title { font-size: clamp(20px, 2.6vw, 27px); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; color: var(--text); margin: 2px 0 6px; }
.ap-deck { font-size: 14px; color: var(--muted); line-height: 1.55; margin-bottom: 14px; }
.ap-facts-label, .ap-sources-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 14px 0 8px; }
.ap-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.ap-fact { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; animation: rise-in var(--dur) var(--ease-out) backwards; }
.ap-fact:nth-child(2) { animation-delay: 40ms; }
.ap-fact:nth-child(3) { animation-delay: 80ms; }
.ap-fact:nth-child(4) { animation-delay: 120ms; }
.ap-fact:nth-child(5) { animation-delay: 160ms; }
.ap-fact:nth-child(6) { animation-delay: 200ms; }
.ap-fact-value { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; }
.ap-fact.is-number .ap-fact-value { font-size: clamp(19px, 2vw, 23px); font-weight: 800; letter-spacing: -.02em; color: var(--violet); font-variant-numeric: tabular-nums; }
.ap-fact-meta { display: flex; flex-direction: column; gap: 2px; }
.ap-fact-type { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ember); }
.ap-fact-type svg { width: 11px; height: 11px; }
.ap-fact-sub { font-size: 11.5px; color: var(--dim); line-height: 1.35; }
.ap-sources { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-source-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--hair); border-radius: 99px; padding: 4px 12px; font-size: 12px; font-weight: 500; color: var(--muted); max-width: 220px; }
.ap-source-chip svg { width: 12px; height: 12px; flex-shrink: 0; }
.ap-source-chip span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hair); font-size: 12.5px; color: var(--muted); }
.ap-foot svg { width: 13px; height: 13px; color: var(--violet); flex-shrink: 0; }
/* Source document reader modal */
.src-modal { max-width: 780px; }
.src-reader { position: relative; padding: 28px 36px; overflow-y: auto; max-height: calc(100% - 96px); font-size: 14.5px; line-height: 1.75; color: var(--text); }
.src-reader p { margin: 0 0 14px; }
.src-reader p.src-hl { background: var(--info-bg); border-left: 3px solid var(--violet); border-radius: 6px; padding: 10px 14px; margin-left: -14px; }
.src-reader p.src-hl.src-hl-pulse { animation: srcPulse 1.6s var(--ease-out); }
@keyframes srcPulse { 0% { background: rgba(139, 92, 246, 0.28); } 100% { background: var(--info-bg); } }
.src-status { padding: 8px 36px 14px; border-top: 1px solid var(--hair); font-size: 11.5px; color: var(--dim); }
.cu-ref { position: relative; }
.cu-ref-view { margin-top: 6px; }

/* ===== INSIGHTS (Google Analytics + Search Console) ===== */
.insights-wrap { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-4); }
.ins-demo-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; align-self: center; }
.ins-demo-badge svg { width: 13px; height: 13px; }
.ins-zero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding: var(--space-8) var(--space-6); animation: rise-in var(--dur-slow) var(--ease-out) backwards; }
.ins-zero-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); color: var(--ember); display: flex; align-items: center; justify-content: center; }
.ins-zero-icon svg { width: 26px; height: 26px; }
.ins-privacy-note { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: var(--surface-2); border: 1px solid var(--hair); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12.5px; color: var(--muted); max-width: 520px; }
.ins-privacy-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; color: var(--success); }
.ins-hero { display: grid; grid-template-columns: minmax(280px, 1fr) 1.6fr; gap: var(--space-5); align-items: center; animation: rise-in var(--dur-slow) var(--ease-out) backwards; }
@media (max-width: 900px) { .ins-hero { grid-template-columns: 1fr; } }
.ins-hero-num { font-size: clamp(34px, 4vw, 46px); font-weight: 800; letter-spacing: -0.03em; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ins-hero-num-sm { font-size: clamp(22px, 2.4vw, 28px); font-weight: 800; color: var(--text); letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.ins-hero-stat { display: flex; flex-direction: column; gap: 4px; }
.ins-hero-main { display: flex; flex-direction: column; gap: var(--space-4); }
.ins-hero-chart { height: 150px; }
.ins-delta { font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.ins-delta.up { color: var(--success); background: var(--success-bg); }
.ins-delta.down { color: var(--error); background: var(--error-bg); }
.ins-realtime { display: flex; align-items: center; gap: 6px; color: var(--ember); font-weight: 600; margin-top: 2px; }
.ins-realtime svg { width: 13px; height: 13px; }
.ins-summary { animation: rise-in var(--dur-slow) var(--ease-out) backwards; animation-delay: 40ms; }
.ins-summary-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.ins-summary-head svg { width: 15px; height: 15px; color: var(--ember); }
.ins-summary-text { font-size: 15px; line-height: 1.65; color: var(--text); min-height: 24px; }
.ins-alerts { animation: rise-in var(--dur-slow) var(--ease-out) backwards; animation-delay: 80ms; }
.ins-alert-list { display: flex; flex-direction: column; gap: var(--space-2); }
.ins-alert-row { display: flex; align-items: center; gap: var(--space-3); background: var(--warning-bg); border: 1px solid rgba(249, 115, 22, 0.25); border-radius: var(--radius-sm); padding: 12px 14px; }
.ins-alert-row.high { background: var(--error-bg); border-color: rgba(244, 63, 94, 0.3); }
.ins-alert-text { flex: 1; min-width: 0; }
.ins-alert-text b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ins-finding { background: var(--surface-2); border: 1px solid var(--violet); border-radius: var(--radius-sm); padding: 14px 16px; margin: var(--space-2) 0; animation: rise-in var(--dur) var(--ease-out) backwards; }
.ins-finding-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--violet); margin-bottom: 8px; }
.ins-finding-head svg { width: 14px; height: 14px; }
.ins-finding-head .btn-icon { margin-left: auto; }
.ins-finding-text { font-size: 14px; line-height: 1.65; color: var(--text); white-space: pre-wrap; }
.ins-opps { animation: rise-in var(--dur-slow) var(--ease-out) backwards; animation-delay: 100ms; }
.ins-opp-row { display: flex; align-items: center; gap: var(--space-3); padding: 10px 0; border-bottom: 1px solid var(--hair); }
.ins-opp-row:last-child { border-bottom: none; }
.ins-opp-text { flex: 1; min-width: 0; }
.ins-opp-text b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ins-card { animation: rise-in var(--dur-slow) var(--ease-out) backwards; animation-delay: 120ms; }
.ins-card-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: var(--space-3); }
.ins-card-head svg { width: 15px; height: 15px; color: var(--ember); }
.ins-two { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--space-4); align-items: center; }
@media (max-width: 760px) { .ins-two { grid-template-columns: 1fr; } }
.ins-donut-block { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.chart-donut { position: relative; }
.chart-donut-centre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.chart-donut-centre b { font-size: 18px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-donut-centre span { font-size: 11px; color: var(--muted); }
.chart-donut-empty { display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 13px; background: var(--surface-2); border-radius: 50%; }
.ins-legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 12px; color: var(--muted); }
.ins-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ins-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-bars { display: flex; flex-direction: column; gap: 9px; }
.chart-bar-row { display: grid; grid-template-columns: minmax(70px, 130px) 1fr 46px; gap: 10px; align-items: center; }
.chart-bar-label { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 4px; transition: width var(--dur-slow) var(--ease-out); }
.chart-bar-value { font-size: 12px; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.ins-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.ins-stat { display: flex; flex-direction: column; gap: 3px; }
.ins-stat-num { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ins-queries { display: flex; flex-direction: column; }
.ins-query-row { display: flex; align-items: center; gap: var(--space-3); padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
.ins-query-row:last-child { border-bottom: none; }
.ins-query-text { flex: 1; min-width: 0; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-page-row { display: flex; align-items: center; gap: var(--space-3); padding: 8px 0; border-bottom: 1px solid var(--hair); }
.ins-page-row:last-child { border-bottom: none; }
.ins-page-path { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-page-time { color: var(--dim); min-width: 60px; text-align: right; }
.ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }

/* Cards panel — repeatable content blocks in the section inspector */
.cards-panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: var(--space-4); }
.cards-list { display: flex; flex-direction: column; gap: 4px; }
.card-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--hair); animation: rise-in var(--dur) var(--ease-out) backwards; }
.card-row .article-block-handle { cursor: pointer; padding: 2px; }
.card-row .article-block-handle:hover { color: var(--text); background: var(--surface-2); }
.card-row-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-row .btn-icon { width: 28px; height: 28px; }
.card-row .btn-icon svg { width: 14px; height: 14px; }
.card-row-idx { font-size: 11px; font-weight: 700; color: var(--dim); min-width: 16px; text-align: center; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* Expandable card accordion (direct-build cards + section field groups) */
.card-acc { border: 1px solid var(--hair); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; animation: rise-in var(--dur) var(--ease-out) backwards; }
.card-acc-head { display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box; padding: 8px 10px; cursor: pointer; user-select: none; }
.card-acc-head:hover { background: var(--surface-2); }
.card-acc-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-sm); }
.card-acc-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-acc-count { font-size: 11px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.card-acc-chev { display: flex; align-items: center; color: var(--dim); flex-shrink: 0; transition: transform var(--dur) var(--ease-out); }
.card-acc-chev svg { width: 14px; height: 14px; }
.card-acc.open { border-color: var(--border); }
.card-acc.open .card-acc-chev { transform: rotate(180deg); }
.card-acc-body { padding: 10px 10px 12px; border-top: 1px solid var(--hair); display: flex; flex-direction: column; gap: 10px; }
.card-acc-head .btn-icon { width: 28px; height: 28px; flex-shrink: 0; }
.card-acc-head .btn-icon svg { width: 14px; height: 14px; }
.cards-list .card-acc .card-row-idx { min-width: 18px; }

/* ===== COMMAND PALETTE (Ctrl+K) ===== */
.palette-overlay {
  position: fixed; inset: 0; z-index: 2500;
  background: rgba(1, 1, 29, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14vh;
  animation: fadein 140ms var(--ease);
  transition: opacity 140ms var(--ease-in-out);
}
.light-theme .palette-overlay { background: rgba(26, 27, 46, 0.4); }
.palette-overlay.closing { opacity: 0; pointer-events: none; }
.palette {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-4);
  overflow: hidden;
  animation: palettein 240ms var(--ease-out);
  transition: transform 140ms var(--ease-in-out), opacity 140ms var(--ease-in-out);
}
.palette-overlay.closing .palette { transform: scale(0.97) translateY(-4px); opacity: 0; }
@keyframes palettein { from { transform: scale(0.98) translateY(-8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.palette-input-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 14px 18px;
  border-bottom: 1px solid var(--hair);
}
.palette-input-row svg { width: 17px; height: 17px; color: var(--dim); flex-shrink: 0; }
.palette-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font); font-size: 15px; color: var(--text);
}
.palette-input::placeholder { color: var(--dim); }
.palette-esc {
  font-size: 11px; color: var(--dim); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px; flex-shrink: 0;
  font-family: var(--font-mono);
}
.palette-list { max-height: 46vh; overflow-y: auto; padding: 8px; }
.palette-group {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); padding: 10px 10px 6px;
}
.palette-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 9px 10px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--muted);
}
.palette-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.palette-item .pi-label { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-hint { font-size: 12px; color: var(--dim); margin-left: auto; flex-shrink: 0; }
.palette-item.selected { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--violet); color: var(--violet); }
.palette-item.selected .pi-label { color: var(--text); }
.palette-empty { padding: 28px 16px; text-align: center; color: var(--dim); font-size: 13px; }
.palette-foot {
  display: flex; gap: var(--space-4); padding: 9px 16px;
  border-top: 1px solid var(--hair);
  font-size: 11px; color: var(--dim);
}
.palette-foot b { font-weight: 600; color: var(--muted); }
.palette-item { animation: rise-in 200ms var(--ease-out) backwards; }
.palette-item:nth-child(n+4) { animation-delay: 30ms; }
