/* StackFill — editor app styles.
 *
 * Imports the shared component CSS (which loads tokens + base) and layers
 * the editor-specific surfaces on top: dashboard, upload, three-column
 * editor, inspector, fills list. Re-uses tokens.css for color and type;
 * no hex literals here.
 *
 * Design intent: practical, print-savvy. Type-led with restrained accents.
 * Closer to Linear/Stripe than to a typical creative SaaS — no chrome
 * gradients, no playful color, generous whitespace.
 */

@import url('/css/components.css?v=1');

/* ---------- app shell ---------- */
.page-app .site-nav,
.page-app-editor .site-nav { border-bottom: 1px solid var(--c-border); }

.app-main { padding: var(--s-6) 0 var(--s-10); }

.app-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
  margin-bottom: var(--s-6);
}
.app-header h1 { margin: 0; font-size: var(--fs-30); }
.app-header__actions { display: flex; gap: var(--s-3); align-items: center; }

.app-subtle-link {
  color: var(--c-muted); text-decoration: none; font-size: var(--fs-14);
}
.app-subtle-link:hover { color: var(--c-ink); }

/* ---------- generic table ---------- */
.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-14);
  background: var(--c-page);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.app-table th,
.app-table td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table thead th {
  font-weight: 600; color: var(--c-muted);
  font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--c-surface);
}
.app-table td .row-actions {
  display: flex; gap: var(--s-3); align-items: center;
  font-size: var(--fs-14);
}
.app-table td .row-actions a { color: var(--c-navy); text-decoration: none; }
.app-table td .row-actions a:hover { text-decoration: underline; }
.app-table td .row-actions button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--c-navy);
  cursor: pointer;
}
.app-table td .row-actions button:hover { text-decoration: underline; }
/* In-row delete: visually quieter than a primary button, semantically
   destructive. Padding/border lifted from .btn--sm so it lines up with
   the inline-link siblings without a hard pill background. */
.app-table td .row-actions__danger {
  appearance: none; border: 0; background: transparent;
  padding: 0; font: inherit; color: #B23A48; cursor: pointer;
}
.app-table td .row-actions__danger:hover { text-decoration: underline; }
.app-table td .row-actions__danger[disabled] { opacity: 0.5; cursor: progress; }
.app-table .title-cell { font-weight: 600; color: var(--c-ink); }
.app-table .title-cell a { color: var(--c-ink); text-decoration: none; }
.app-table .title-cell a:hover { color: var(--c-navy); }

/* ---------- status badges ---------- */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--r-full);
  font-size: var(--fs-12); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  border: 1px solid var(--c-border-strong);
  color: var(--c-muted);
  background: var(--c-page);
}
/* Template status (from `templates.status` in the schema). */
.badge--draft     { color: var(--c-muted); }
.badge--live      { color: var(--c-navy);  border-color: var(--c-navy); }
.badge--paused    { color: var(--c-muted); border-color: var(--c-border-strong); }
.badge--archived  { color: var(--c-muted); }
.badge--past_due  { color: #8a6a00;        border-color: #d4a73a; }
.badge--canceled  { color: var(--c-danger); border-color: var(--c-danger); }
/* Fill status (from `fills.status` in the schema). */
.badge--open      { color: var(--c-muted); }
.badge--finalized { color: var(--c-navy);  border-color: var(--c-navy); }
.badge--expired   { color: var(--c-muted); border-color: var(--c-border-strong); }
/* Render preflight (from `renders.preflight_status`). */
.badge--pending   { color: var(--c-muted); }
.badge--pass      { color: #2e5e3a;        border-color: #2e5e3a; }
.badge--warn      { color: #8a6a00;        border-color: #d4a73a; }
.badge--fail      { color: var(--c-danger); border-color: var(--c-danger); }
/* Legacy editor-mock values, preserved so demos still style correctly. */
.badge--paid      { color: #2e5e3a; border-color: #2e5e3a; }
.badge--rendered  { color: var(--c-navy);  border-color: var(--c-navy); }

/* ---------- empty state ---------- */
.empty-state {
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-lg);
  padding: var(--s-10) var(--s-6);
  text-align: center;
  background: var(--c-page);
}
.empty-state h2 { font-size: var(--fs-24); margin-bottom: var(--s-3); }
.empty-state p { color: var(--c-muted); margin-bottom: var(--s-5); }

/* ---------- upload dropzone ---------- */
.upload-page {
  max-width: 640px;
}
.upload-page .eyebrow {
  margin-bottom: var(--s-3);
}
.upload-page h1 {
  font-size: var(--fs-30);
  line-height: 1.15;
  margin-bottom: var(--s-3);
}
.upload-page__lede {
  max-width: 54ch;
  margin-bottom: var(--s-5);
  font-size: var(--fs-15);
  line-height: 1.5;
}
.dropzone {
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--r-lg);
  padding: var(--s-10) var(--s-6);
  text-align: center;
  background: var(--c-page);
  transition: border-color var(--t-fast), background var(--t-fast);
  cursor: pointer;
}
.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--c-navy);
  background: var(--c-surface);
}
.dropzone__hint { color: var(--c-muted); font-size: var(--fs-14); margin-top: var(--s-2); }
.dropzone input[type="file"] { display: none; }
.upload-page > .upload-form[hidden],
.upload-page > .upload-fonts-step[hidden] {
  display: none !important;
}
.upload-page .dropzone {
  border-radius: var(--r-md);
  padding: var(--s-7) var(--s-5);
}
.upload-page .dropzone strong {
  font-size: var(--fs-14);
}
.upload-page .dropzone__hint {
  font-size: var(--fs-13);
}
.upload-page .field {
  margin-bottom: 0;
}
.upload-page .field input[type="text"] {
  padding: var(--s-3);
}
.upload-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}
.upload-page .btn {
  padding: 0.55rem 0.8rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-14);
}

/* ---------- font dropzone (modal + post-ingest) ---------- */
/* Composes the .dropzone base for the dashed-border + hover/drag styling,
   adds the empty-state title + the queued-file list. */
.font-dropzone {
  /* Tighter than the PDF upload dropzone — it lives inside a modal/section. */
  padding: var(--s-6) var(--s-5);
  cursor: pointer;
}
.font-dropzone__prompt { text-align: center; }
.font-dropzone__title { font-size: var(--fs-15); }
.font-dropzone__hint { color: var(--c-muted); font-size: var(--fs-13); margin: 6px 0 0; }
.font-dropzone__list {
  display: flex; flex-direction: column; gap: 6px;
  text-align: left;
}
.font-dropzone__item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  background: var(--c-page);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: var(--fs-13);
}
.font-dropzone__item-name {
  flex: 1 1 auto; min-width: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: var(--fs-12);
  color: var(--c-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.font-dropzone__remove {
  flex: 0 0 22px;
  width: 22px; height: 22px;
  border: 1px solid var(--c-border);
  border-radius: 50%;
  background: transparent;
  color: var(--c-muted);
  font-size: 14px; line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.font-dropzone__remove:hover {
  color: #B23A48;
  border-color: #B23A48;
  background: rgba(178, 58, 72, 0.06);
}

.upload-form {
  display: flex; flex-direction: column; gap: var(--s-4);
  max-width: 640px;
}
.upload-progress {
  display: none;
  padding: var(--s-5);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.upload-progress.is-active { display: block; }
.upload-progress__bar {
  height: 4px; background: var(--c-border); border-radius: 2px;
  overflow: hidden; margin-top: var(--s-3);
}
.upload-progress__bar::after {
  content: ""; display: block; height: 100%;
  background: var(--c-navy);
  animation: indeterminate 1.4s ease-in-out infinite;
  width: 40%;
}
@keyframes indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(280%); }
}

/* ---------- inline feedback ---------- */
.inline-error {
  background: rgba(179, 58, 58, 0.06);
  border: 1px solid rgba(179, 58, 58, 0.3);
  color: var(--c-danger);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-14);
}
.inline-success {
  background: rgba(164, 182, 154, 0.18);
  border: 1px solid var(--c-sage);
  color: #2e5e3a;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-14);
}
.inline-info {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-14);
}

/* ---------- editor shell ---------- */
.page-app-editor body,
body.page-app-editor { overflow-x: hidden; }

.editor-shell {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "topbar topbar topbar"
    "layers canvas inspector";
  height: calc(100vh - 64px);
  background: var(--c-surface);
}

.editor-topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  background: var(--c-page);
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.editor-topbar__title-group {
  display: flex; align-items: center; gap: var(--s-3); flex: 1; min-width: 0;
}
.editor-topbar__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--fs-18); color: var(--c-ink);
  background: transparent; border: 1px solid transparent;
  padding: 0.3rem 0.5rem; border-radius: var(--r-sm);
  min-width: 8ch;
  max-width: 36ch;
}
.editor-topbar__title:hover { border-color: var(--c-border); }
.editor-topbar__title:focus { border-color: var(--c-navy); outline: none; background: var(--c-page); }

.editor-topbar__group {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-14);
  color: var(--c-muted);
}
.editor-topbar__group label { color: var(--c-muted); }

/* ---------- font picker (Canva-style, each row in its own face) ---------- */
.font-picker { position: relative; display: inline-block; min-width: 180px; }
.font-picker__btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: space-between;
  gap: var(--s-2);
  width: 100%;
  padding: 0.4rem 0.6rem;
  font: inherit; font-size: var(--fs-14);
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-page); color: var(--c-ink);
  cursor: pointer;
  text-align: left;
}
.font-picker__btn:hover { border-color: var(--c-border-strong); }
.font-picker__btn:focus { outline: none; border-color: var(--c-navy); box-shadow: 0 0 0 3px rgba(26,61,95,.12); }
.font-picker__btn-label {
  flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  /* Inline style from JS sets the actual face per-selection. */
}
.font-picker__caret { color: var(--c-muted); font-size: 0.85em; line-height: 1; }
.font-picker__panel {
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: max(220px, 100%); max-width: 320px;
  max-height: 320px; overflow-y: auto;
  background: var(--c-page);
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
  padding: 4px;
}
.font-picker__opt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 15px;
  cursor: pointer;
  color: var(--c-ink);
}
.font-picker__opt:hover { background: var(--c-surface); }
.font-picker__opt.is-active { background: rgba(26, 61, 95, 0.08); }
.font-picker__tick {
  flex: 0 0 14px; width: 14px; color: var(--c-navy); font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.font-picker__opt-name {
  flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.25;
  /* Inline style from JS sets the actual face per-row. */
}
.font-picker__group {
  /* Section divider above each family group. Not selectable. */
  padding: 10px 10px 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-muted);
  user-select: none;
  border-top: 1px solid var(--c-border);
}
.font-picker__panel > .font-picker__group:first-child,
.font-picker__panel > .font-picker__opt + .font-picker__group:first-of-type { border-top: none; }
/* When inherit option sits above the first group, suppress its top border. */
.font-picker__opt + .font-picker__group { border-top: 1px solid var(--c-border); }
.font-picker__opt--variant {
  /* Indent variants so the family heading reads as the parent. */
  padding-left: 22px;
}

.editor-topbar__zoom {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-page);
}
.editor-topbar__zoom .zoom-btn,
.editor-topbar__zoom .zoom-readout {
  appearance: none;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--c-border);
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-size: var(--fs-14);
  color: var(--c-ink);
  cursor: pointer;
  line-height: 1;
}
.editor-topbar__zoom .zoom-btn:first-child { border-left: 0; }
.editor-topbar__zoom .zoom-btn:hover,
.editor-topbar__zoom .zoom-readout:hover { background: var(--c-surface); }
.editor-topbar__zoom .zoom-readout {
  min-width: 4.5ch; text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--c-muted);
}

.editor-topbar__saved {
  color: var(--c-muted); font-size: var(--fs-12);
}
.editor-topbar__actions {
  display: flex; gap: var(--s-2);
  margin-left: auto;
}

/* compact btn for editor chrome */
.btn--sm {
  padding: 0.45rem 0.85rem;
  font-size: var(--fs-14);
  font-weight: 600;
}
.btn--sm.btn--primary[disabled] {
  opacity: 0.5; cursor: not-allowed;
}

/* ---------- left rail: layers ---------- */
.editor-layers {
  grid-area: layers;
  background: var(--c-page);
  border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  min-height: 0;
}
.editor-layers__head {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.editor-layers__head h2 {
  font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-muted); margin: 0; font-weight: 600;
}
.editor-layers__filter {
  display: flex; gap: 2px;
  font-size: var(--fs-12);
}
.editor-layers__filter button {
  background: transparent; border: 1px solid var(--c-border);
  color: var(--c-muted); padding: 0.15rem 0.5rem; border-radius: var(--r-sm);
  cursor: pointer;
}
.editor-layers__filter button.is-active {
  background: var(--c-ink); color: var(--c-page); border-color: var(--c-ink);
}
.editor-layers__list {
  flex: 1; overflow-y: auto; padding: var(--s-2) 0;
  font-size: var(--fs-14);
}
.layer-row {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: var(--s-2);
  padding: 0.4rem var(--s-4);
  cursor: pointer;
  border-left: 2px solid transparent;
  user-select: none;
}
.layer-row:hover { background: var(--c-surface); }
.layer-row.is-selected {
  background: rgba(26, 61, 95, 0.06);
  border-left-color: var(--c-navy);
}
.layer-row--group {
  font-weight: 600;
}
.layer-row--child {
  padding-left: calc(var(--s-4) + 18px);
  font-size: var(--fs-13);
}
.layer-row__twirl {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--c-muted);
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}
.layer-row__twirl:hover { color: var(--c-ink); }
.layer-row__icon {
  width: 14px; height: 14px;
  color: var(--c-muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.layer-row__label {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.layer-row__hint {
  font-size: var(--fs-12); color: var(--c-muted);
}
.layer-row__flag {
  width: 8px; height: 8px; border-radius: 2px;
  background: var(--c-sage);
  display: inline-block;
}
.layer-row__flag.layer-row__flag--hidden { visibility: hidden; }

/* ---------- canvas center ---------- */
.editor-canvas-wrap {
  grid-area: canvas;
  display: flex;
  flex-direction: column;       /* stack pagebar above canvas */
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-6);
  overflow: auto;
  min-width: 0;
}
.editor-canvas {
  background: var(--c-page);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--c-border);
  position: relative;
}

/* ---------- multi-page tab strip (above the canvas) ---------- */
.editor-pagebar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--c-page);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
  max-width: 100%;
  overflow-x: auto;
}
.editor-pagebar__tab {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  font-size: var(--fs-13);
  color: var(--c-ink);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.editor-pagebar__tab:hover { background: var(--c-surface); }
.editor-pagebar__tab.is-active {
  background: var(--c-navy);
  color: var(--c-page);
}
.editor-pagebar__tab-label { font-weight: 500; }
.editor-pagebar__tab-meta {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  opacity: 0.65;
}
.editor-pagebar__tab.is-active .editor-pagebar__tab-meta { opacity: 0.8; }
.editor-canvas svg { display: block; }
.editor-canvas .obj { cursor: pointer; }
.editor-canvas .obj-outline {
  fill: none; stroke: var(--c-navy); stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.editor-canvas .obj-handle {
  fill: var(--c-page); stroke: var(--c-navy); stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.editor-canvas .selection-marquee {
  fill: rgba(26, 61, 95, 0.08);
  stroke: var(--c-navy);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* ---------- right rail: inspector ---------- */
.editor-inspector {
  grid-area: inspector;
  background: var(--c-page);
  border-left: 1px solid var(--c-border);
  overflow-y: auto;
  padding: var(--s-4) var(--s-5);
}
.editor-inspector h2 {
  font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--c-muted); margin: 0 0 var(--s-3); font-weight: 600;
}
.editor-inspector__empty {
  padding: var(--s-6) 0; color: var(--c-muted); font-size: var(--fs-14);
}
.editor-inspector__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding-bottom: var(--s-4);
  margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-border);
}
.editor-inspector__full-btn {
  width: 100%;
  justify-content: center;
}
.editor-inspector__type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-1);
}
.editor-inspector__type-btn {
  min-height: 34px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  background: var(--c-page);
  color: var(--c-ink);
  font-size: var(--fs-12);
  font-weight: 600;
  cursor: pointer;
}
.editor-inspector__type-btn.is-active {
  background: var(--c-navy);
  border-color: var(--c-navy);
  color: var(--c-page);
}
.editor-inspector__type-btn:focus-visible {
  outline: 2px solid var(--c-focus-ring);
  outline-offset: 2px;
}
.editor-inspector__asset-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  max-height: 148px;
  overflow: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-page);
  padding: var(--s-2);
}
.field .editor-inspector__asset-option {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 28px;
  padding: 0 var(--s-1);
  border-radius: var(--r-sm);
  font-size: var(--fs-14);
  text-transform: none;
  letter-spacing: 0;
}
.field .editor-inspector__asset-option:hover {
  background: var(--c-surface);
}
.editor-inspector__asset-empty {
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-muted);
  font-size: var(--fs-12);
  padding: var(--s-3);
}
.field {
  display: flex; flex-direction: column;
  gap: var(--s-1);
  margin-bottom: var(--s-4);
  font-size: var(--fs-14);
}
.field label,
.field > .field-label,
.field > span {
  font-weight: 500; color: var(--c-ink);
  font-size: var(--fs-12);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field input[type="color"],
.field input[type="file"],
.field textarea,
.field select {
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  padding: 0.5rem 0.6rem;
  font-size: var(--fs-14);
  background: var(--c-page);
  width: 100%;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--c-focus-ring); outline-offset: 0;
  border-color: var(--c-navy);
}
.field textarea { min-height: 60px; resize: vertical; font-family: inherit; }
.field__hint { color: var(--c-muted); font-size: var(--fs-12); }
.field__source-hint { color: var(--c-muted); font-size: var(--fs-12); font-style: italic; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--c-border);
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-row__label { font-weight: 500; font-size: var(--fs-14); }
.toggle-row__hint { color: var(--c-muted); font-size: var(--fs-12); margin-top: 2px; }

/* Bare switch */
.switch {
  position: relative;
  width: 36px; height: 20px;
  background: var(--c-border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--c-page);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform var(--t-fast);
}
.switch.is-on { background: var(--c-navy); }
.switch.is-on::after { transform: translateX(16px); }
.switch.is-mixed { background: var(--c-sage); }
.switch[role="switch"]:focus-visible { outline: 2px solid var(--c-focus-ring); outline-offset: 2px; }

/* ---------- editor narrow-mode (mobile) ---------- */
.editor-mobile-tabs { display: none; }

@media (max-width: 900px) {
  .editor-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "topbar"
      "tabs"
      "panel";
    height: auto;
    min-height: calc(100vh - 64px);
  }
  .editor-mobile-tabs {
    grid-area: tabs;
    display: flex;
    border-bottom: 1px solid var(--c-border);
    background: var(--c-page);
  }
  .editor-mobile-tabs button {
    flex: 1; background: transparent; border: 0; padding: var(--s-3);
    font-size: var(--fs-14); color: var(--c-muted); cursor: pointer;
    border-bottom: 2px solid transparent;
  }
  .editor-mobile-tabs button.is-active {
    color: var(--c-ink); border-bottom-color: var(--c-navy);
  }
  .editor-layers,
  .editor-canvas-wrap,
  .editor-inspector {
    grid-area: panel;
    display: none;
    border-right: 0; border-left: 0;
  }
  .editor-shell[data-tab="layers"] .editor-layers,
  .editor-shell[data-tab="canvas"] .editor-canvas-wrap,
  .editor-shell[data-tab="inspector"] .editor-inspector {
    display: flex;
  }
  .editor-shell[data-tab="canvas"] .editor-canvas-wrap { display: flex; }
  .editor-shell[data-tab="inspector"] .editor-inspector { display: block; }
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(14, 26, 43, 0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
  padding: var(--s-4);
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: var(--c-page);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
  max-width: 480px; width: 100%;
  box-shadow: var(--shadow-md);
}
.modal--wide { max-width: 640px; }
.modal h2 { font-size: var(--fs-20); margin-bottom: var(--s-2); }
.modal p { color: var(--c-muted); font-size: var(--fs-14); margin-bottom: var(--s-4); }
.modal__actions {
  display: flex; gap: var(--s-3); justify-content: flex-end; margin-top: var(--s-5);
}
.modal__actions--split { align-items: center; }
.modal__actions--split .btn:first-child { margin-right: auto; }

/* ---------- post-ingest required-fonts checklist ---------- */
.upload-fonts-step { display: flex; flex-direction: column; gap: var(--s-3); }
.upload-fonts-step__head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  align-items: flex-start;
}
.upload-fonts-step__head h2 {
  font-size: var(--fs-24);
  line-height: 1.2;
  margin-bottom: var(--s-2);
}
.upload-fonts-step__head p { max-width: 58ch; margin-bottom: 0; }
.upload-fonts-step__head-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.upload-fonts-step__add {
  border-top: 1px solid var(--c-border);
  padding-top: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.upload-fonts-step__add h3 { font-size: var(--fs-16); margin: 0 0 var(--s-1); }
.upload-fonts-step__actions {
  display: flex; gap: var(--s-3); flex-wrap: wrap;
}
.upload-fonts-step__open {
  border-top: 1px solid var(--c-border);
  padding-top: var(--s-4);
  margin-top: var(--s-2);
}
.required-fonts {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-page);
  overflow-x: auto;
}
.required-fonts__loading {
  padding: var(--s-3);
  font-size: var(--fs-13);
  font-style: italic;
}
.required-fonts__empty {
  padding: var(--s-4);
  color: var(--c-muted);
  font-size: var(--fs-14);
}
.required-fonts__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-14);
}
.required-fonts__table th,
.required-fonts__table td {
  text-align: left;
  padding: 10px var(--s-3);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.required-fonts__table tbody tr:last-child td { border-bottom: 0; }
.required-fonts__table th {
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: var(--fs-12);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.required-fonts__row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: 10px var(--s-3);
  background: var(--c-page);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font-size: var(--fs-14);
}
.required-fonts__row--ok       { border-color: rgba(85, 112, 73, 0.35); background: rgba(164, 182, 154, 0.08); }
.required-fonts__row--missing  { border-color: rgba(178, 58, 72, 0.35); background: rgba(178, 58, 72, 0.04); }
.required-fonts__row--standard { opacity: 0.75; }
.required-fonts__badge {
  min-width: 68px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.required-fonts__badge--ok       { background: var(--c-sage, #557049); color: #fff; }
.required-fonts__badge--missing  { background: #B23A48; color: #fff; }
.required-fonts__badge--standard { background: var(--c-border); color: var(--c-muted); }
.required-fonts__main {
  display: flex; flex-direction: column; min-width: 0;
}
.required-fonts__name {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: var(--fs-13);
  color: var(--c-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.required-fonts__meta {
  font-size: var(--fs-12);
  color: var(--c-muted);
}
.required-fonts__note {
  font-size: var(--fs-12);
  color: var(--c-muted);
  text-align: right;
  white-space: nowrap;
}
.required-fonts__table td:last-child { text-align: right; }
.required-fonts__row--ok .required-fonts__note { color: var(--c-sage, #557049); }
.required-fonts__row--missing .required-fonts__note { color: #B23A48; }

@media (max-width: 720px) {
  .upload-fonts-step__head {
    flex-direction: column;
  }
  .upload-fonts-step__head-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .required-fonts__table {
    min-width: 620px;
  }
}

/* ---------- multi-file font uploader status rows ---------- */
.fontup-status {
  display: flex; flex-direction: column; gap: var(--s-2);
  margin-top: var(--s-3);
  max-height: 220px; overflow: auto;
}
.fontup-status__row {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-3);
  padding: 6px 8px;
  border: 1px solid var(--c-border, #E5E9EE);
  border-radius: 6px;
  font-size: var(--fs-13);
}
.fontup-status__name {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: var(--fs-12);
  color: var(--c-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.fontup-status__state {
  font-size: var(--fs-12);
  white-space: nowrap;
}
.fontup-status__ok { color: var(--c-sage, #557049); font-weight: 500; }
.fontup-status__err { color: #B23A48; font-weight: 500; }

/* ---------- share link ---------- */
.share-link {
  display: flex; gap: var(--s-2); align-items: stretch;
  margin-top: var(--s-2);
}
.share-link input {
  flex: 1;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  padding: 0.5rem 0.6rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: var(--fs-12);
  background: var(--c-surface);
  color: var(--c-ink);
}

/* ---------- dashboard upload CTA ---------- */
.upload-cta {
  display: inline-flex; align-items: center; gap: var(--s-2);
}

/* ---------- admin dashboard ---------- */
.page-admin {
  background: var(--c-surface);
}

.page-admin .site-nav {
  position: sticky;
}

.admin-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
  background: var(--c-surface);
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: var(--s-5) var(--s-4);
  background: var(--c-page);
  border-right: 1px solid var(--c-border);
}

.admin-sidebar__account {
  padding: 0 var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--c-border);
}

.admin-sidebar__eyebrow,
.admin-topbar__crumb {
  font-size: var(--fs-12);
  line-height: 1.2;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.admin-sidebar__name {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: var(--fs-18);
  font-weight: 650;
  color: var(--c-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-sidebar__meta {
  min-height: 1.2em;
  margin-top: 3px;
  color: var(--c-muted);
  font-size: var(--fs-12);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 0 var(--s-3);
  border-radius: var(--r-sm);
  color: var(--c-muted);
  text-decoration: none;
  font-size: var(--fs-14);
  font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast);
}

.admin-nav a:hover {
  background: var(--c-surface);
  color: var(--c-ink);
}

.admin-nav a.is-active {
  background: var(--c-ink);
  color: var(--c-page);
}

.admin-sidebar__quota {
  margin-top: auto;
  padding: var(--s-4) var(--s-2) 0;
  border-top: 1px solid var(--c-border);
}

.admin-sidebar__quota-label {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  color: var(--c-ink);
  font-size: var(--fs-12);
  font-weight: 700;
}

.admin-sidebar__quota-track {
  height: 5px;
  margin-top: var(--s-2);
  border-radius: var(--r-full);
  background: var(--c-border);
  overflow: hidden;
}

.admin-sidebar__quota-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--c-sage);
}

.admin-sidebar__quota-plan {
  margin-top: var(--s-2);
  color: var(--c-muted);
  font-size: var(--fs-12);
}

.admin-workspace {
  min-width: 0;
  padding: var(--s-5);
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.admin-topbar__title h1 {
  margin: 4px 0 0;
  font-size: var(--fs-24);
  line-height: var(--lh-tight);
}

.admin-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: min(680px, 54vw);
}

.admin-actions-bar {
  position: relative;
  flex: 0 0 auto;
}

.admin-new-toggle {
  min-height: 36px;
  white-space: nowrap;
}

.admin-new-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  width: min(280px, calc(100vw - 32px));
  padding: 6px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-page);
  box-shadow: var(--shadow-md);
}

.admin-new-menu[hidden] {
  display: none;
}

.admin-new-menu button {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-ink);
  text-align: left;
  cursor: pointer;
}

.admin-new-menu button:hover,
.admin-new-menu button:focus-visible {
  background: var(--c-surface);
  outline: none;
}

.admin-new-menu strong {
  font-size: var(--fs-14);
  line-height: 1.2;
}

.admin-new-menu span {
  color: var(--c-muted);
  font-size: var(--fs-12);
  line-height: 1.3;
}

.admin-search {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.admin-search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.admin-search input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-page);
  padding: 0.45rem 0.65rem;
  color: var(--c-ink);
  font: inherit;
  font-size: var(--fs-14);
}

.admin-search input:focus {
  outline: 2px solid var(--c-focus-ring);
  border-color: var(--c-navy);
}

.admin-status {
  margin-bottom: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  font-size: var(--fs-14);
  background: var(--c-page);
}

.admin-status--success {
  border-color: var(--c-sage);
  color: #2e5e3a;
}

.admin-status--error {
  border-color: rgba(179, 58, 58, 0.35);
  color: var(--c-danger);
}

.admin-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
}

.admin-stack > * {
  min-width: 0;
}

.admin-flow {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  gap: var(--s-4);
  align-items: stretch;
  padding: var(--s-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-page);
  min-width: 0;
}

.admin-flow__intro h2 {
  margin: var(--s-1) 0 var(--s-2);
  font-size: var(--fs-20);
}

.admin-flow__intro p:last-child {
  color: var(--c-muted);
  font-size: var(--fs-14);
  line-height: var(--lh-snug);
}

.admin-flow__actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
}

.admin-flow-card {
  display: flex;
  min-height: 108px;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.admin-flow-card:hover {
  border-color: var(--c-border-strong);
  background: var(--c-page);
}

.admin-flow-card:focus-visible {
  outline: 2px solid var(--c-focus-ring);
  outline-offset: 2px;
}

.admin-flow-card--primary {
  border-color: rgba(26, 61, 95, 0.28);
  background: rgba(26, 61, 95, 0.06);
}

.admin-flow-card strong {
  font-size: var(--fs-14);
  line-height: 1.2;
}

.admin-flow-card span {
  color: var(--c-muted);
  font-size: var(--fs-12);
  line-height: 1.35;
}

.admin-grid {
  display: grid;
  gap: var(--s-4);
  min-width: 0;
}

.admin-grid--dashboard {
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
}

.admin-grid--settings {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-grid--clients {
  grid-template-columns: minmax(0, 1fr);
}

.admin-grid--assets {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.admin-grid--integrations {
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  align-items: start;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
}

.admin-metric,
.admin-panel,
.admin-detail,
.admin-setting-card {
  background: var(--c-page);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}

.admin-metric {
  position: relative;
  overflow: hidden;
  padding: var(--s-4);
}

.admin-metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--c-navy);
}

.admin-metric--sage::before { background: var(--c-sage); }
.admin-metric--gold::before { background: #d4a73a; }
.admin-metric--red::before { background: #B23A48; }

.admin-metric__label {
  color: var(--c-muted);
  font-size: var(--fs-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-metric__value {
  margin-top: var(--s-2);
  font-family: var(--font-display);
  font-size: var(--fs-30);
  line-height: 1;
  font-weight: 650;
  color: var(--c-ink);
}

.admin-metric__detail {
  margin-top: var(--s-2);
  color: var(--c-muted);
  font-size: var(--fs-13);
}

.admin-panel {
  min-width: 0;
  padding: var(--s-4);
}

.admin-panel--quiet {
  background: #FAFBFC;
}

.admin-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.admin-panel__header h2,
.admin-detail h2,
.admin-setting-card h2 {
  margin: 0;
  font-size: var(--fs-18);
  line-height: var(--lh-snug);
}

.admin-panel__header p,
.admin-setting-card p {
  margin: 4px 0 0;
  color: var(--c-muted);
  font-size: var(--fs-13);
  line-height: var(--lh-snug);
}

.admin-table {
  border-radius: var(--r-sm);
  font-size: var(--fs-13);
}

.admin-table th,
.admin-table td {
  padding: 0.65rem 0.75rem;
}

.admin-table thead th {
  letter-spacing: 0.04em;
}

.admin-table--compact th,
.admin-table--compact td {
  padding: 0.55rem 0.65rem;
}

.admin-table-wrap {
  min-width: 0;
  max-width: 100%;
  max-height: min(640px, 64vh);
  overflow: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
}

.admin-table-wrap .admin-table {
  border: 0;
  border-radius: 0;
}

.admin-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.admin-table tbody tr.is-selected td {
  background: rgba(26, 61, 95, 0.04);
}

.admin-sort {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.admin-sort:hover span:first-child,
.admin-sort.is-active span:first-child {
  color: var(--c-ink);
}

.admin-sort__mark {
  color: var(--c-muted);
  font-size: 0.85em;
  line-height: 1;
}

.admin-row-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--c-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.admin-row-link:hover {
  color: var(--c-navy);
  text-decoration: underline;
}

.admin-row-meta {
  margin-top: 2px;
  color: var(--c-muted);
  font-size: var(--fs-12);
  font-weight: 400;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 0.5rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: var(--fs-12);
  font-weight: 700;
  white-space: nowrap;
}

.admin-chip--global,
.admin-chip--price-paid {
  border-color: rgba(46, 94, 58, 0.35);
  color: #2e5e3a;
  background: rgba(164, 182, 154, 0.16);
}

.admin-chip--project,
.admin-chip--company,
.admin-chip--template,
.admin-chip--user {
  border-color: rgba(26, 61, 95, 0.30);
  color: var(--c-navy);
  background: rgba(26, 61, 95, 0.06);
}

.admin-chip--price-free {
  border-color: rgba(212, 167, 58, 0.55);
  color: #745b00;
  background: rgba(212, 167, 58, 0.12);
}

.admin-chip--agency,
.admin-chip--pro,
.admin-chip--starter,
.admin-chip--final,
.admin-chip--preview,
.admin-chip--subscription,
.admin-chip--fill-payment {
  border-color: rgba(26, 61, 95, 0.30);
  color: var(--c-navy);
  background: rgba(26, 61, 95, 0.06);
}

.admin-chip--price-inherit {
  background: var(--c-page);
}

.admin-empty {
  padding: var(--s-6) var(--s-4);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-sm);
  text-align: center;
  background: var(--c-page);
}

.admin-empty h2 {
  margin: 0;
  font-size: var(--fs-18);
}

.admin-empty p {
  max-width: 52ch;
  margin: var(--s-2) auto 0;
  color: var(--c-muted);
  font-size: var(--fs-14);
}

.admin-empty--loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
}

.admin-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-navy);
  border-radius: 50%;
  animation: admin-spin 800ms linear infinite;
}

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

.admin-attention {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.admin-attention__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--s-3);
  border: 1px solid var(--c-border);
  border-left-width: 4px;
  border-radius: var(--r-sm);
  background: var(--c-page);
}

.admin-attention__item strong {
  color: var(--c-ink);
  font-size: var(--fs-14);
}

.admin-attention__item span {
  color: var(--c-muted);
  font-size: var(--fs-13);
}

.admin-attention__item--warn { border-left-color: #d4a73a; }
.admin-attention__item--neutral { border-left-color: var(--c-navy); }

.admin-detail {
  padding: var(--s-4);
}

.admin-detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}

.admin-detail__chips {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-detail__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
}

.admin-detail__col {
  min-width: 0;
  padding-top: var(--s-3);
  border-top: 1px solid var(--c-border);
}

.admin-detail__col h3 {
  margin: 0 0 var(--s-2);
  font-size: var(--fs-12);
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-mini-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.admin-mini-list__row {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-mini-list__row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-ink);
  font-size: var(--fs-13);
  font-weight: 600;
}

.admin-mini-list__link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-ink);
  font-size: var(--fs-13);
  font-weight: 700;
  text-decoration: none;
}

.admin-mini-list__link:hover {
  color: var(--c-navy);
  text-decoration: underline;
}

.admin-mini-list__row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-muted);
  font-size: var(--fs-12);
}

.admin-select {
  min-width: 112px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-page);
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: var(--fs-13);
  color: var(--c-ink);
}

.admin-select:focus {
  outline: 2px solid var(--c-focus-ring);
  border-color: var(--c-navy);
}

.admin-setting-card {
  padding: var(--s-4);
}

.admin-setting-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.admin-file-action {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.admin-search-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--s-2);
}

.admin-search-summary__chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
}

.admin-search-summary__chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-muted);
  font-size: var(--fs-12);
  font-weight: 700;
}

.admin-search-summary__chip strong {
  color: var(--c-ink);
  font-size: var(--fs-16);
}

.admin-brand-preview {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
}

.admin-brand-preview__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-page);
  overflow: hidden;
  color: var(--c-navy);
  font-family: var(--font-display);
  font-weight: 700;
}

.admin-brand-preview__logo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.admin-brand-preview__body {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.admin-brand-preview__body strong {
  color: var(--c-ink);
  font-size: var(--fs-14);
}

.admin-brand-preview__body span {
  color: var(--c-muted);
  font-size: var(--fs-12);
}

.admin-brand-preview__swatches {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-2);
}

.admin-brand-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--c-muted);
  font-size: var(--fs-12);
}

.admin-brand-swatch span {
  width: 18px;
  height: 18px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
}

.admin-integration-hero {
  background: #FAFBFC;
}

.admin-onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
}

.admin-onboarding-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--s-2);
  align-items: start;
  min-height: 86px;
  padding: var(--s-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-page);
}

.admin-onboarding-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: var(--fs-12);
  font-weight: 800;
}

.admin-onboarding-step strong {
  color: var(--c-ink);
  font-size: var(--fs-14);
  line-height: 1.25;
}

.admin-onboarding-step small {
  grid-column: 2;
  color: var(--c-muted);
  font-size: var(--fs-12);
  line-height: 1.35;
}

.admin-onboarding-step.is-done {
  border-color: rgba(46, 94, 58, 0.35);
  background: rgba(164, 182, 154, 0.12);
}

.admin-onboarding-step.is-done .admin-onboarding-step__num {
  background: rgba(46, 94, 58, 0.12);
  color: #2e5e3a;
}

.admin-code-block {
  margin: 0;
  padding: var(--s-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: #101820;
  color: #EEF4F2;
  overflow-x: auto;
  font-size: var(--fs-12);
  line-height: 1.55;
}

.admin-code-block code,
.admin-secret code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.admin-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.admin-asset-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.admin-asset-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: 56px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-page);
  color: var(--c-ink);
  font: inherit;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}

.admin-asset-tab:hover {
  border-color: var(--c-border-strong);
  background: #FAFBFC;
}

.admin-asset-tab.is-active {
  border-color: var(--c-navy);
  background: rgba(26, 61, 95, 0.06);
}

.admin-asset-tab span {
  color: var(--c-muted);
  font-size: var(--fs-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-asset-tab strong {
  font-family: var(--font-display);
  font-size: var(--fs-24);
  line-height: 1;
}

.admin-modal-backdrop {
  align-items: flex-start;
  overflow-y: auto;
}

.admin-modal {
  margin: 8vh auto var(--s-6);
  max-width: 560px;
  border-radius: var(--r-md);
}

.admin-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.admin-modal__head h2 {
  margin: 0;
  font-size: var(--fs-20);
}

.admin-modal__close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-page);
  color: var(--c-muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.admin-modal__close:hover {
  color: var(--c-ink);
  border-color: var(--c-border-strong);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.admin-form .field {
  margin-bottom: 0;
}

.admin-form .admin-select {
  width: 100%;
}

.admin-form input[type="color"] {
  min-height: 38px;
  padding: 3px;
}

.admin-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  padding-top: var(--s-2);
}

.admin-detail-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}

.admin-detail-list__row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--fs-13);
}

.admin-detail-list__row span {
  color: var(--c-muted);
  font-weight: 700;
}

.admin-detail-list__row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--c-ink);
  font-weight: 600;
}

.admin-copy-note {
  margin: 0;
  color: var(--c-muted);
  font-size: var(--fs-13);
}

.admin-secret {
  display: block;
  padding: var(--s-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-ink);
  overflow-wrap: anywhere;
  font-size: var(--fs-13);
}

.badge--active {
  color: var(--c-navy);
  border-color: var(--c-navy);
}

@media (max-width: 1180px) {
  .admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-grid--dashboard,
  .admin-grid--clients,
  .admin-grid--assets,
  .admin-grid--integrations,
  .admin-grid--settings,
  .admin-detail__grid {
    grid-template-columns: 1fr;
  }
  .admin-flow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .admin-shell {
    grid-template-columns: 1fr;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .admin-sidebar {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--c-border);
    padding: var(--s-4);
  }
  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .admin-nav a {
    flex: 0 0 auto;
  }
  .admin-sidebar__quota {
    display: none;
  }
  .admin-workspace {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: var(--s-4);
  }
  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-topbar__actions {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }
  .admin-search {
    flex-basis: 100%;
    min-width: 0;
  }
  .admin-actions-bar {
    align-self: stretch;
  }
  .admin-new-toggle {
    width: 100%;
  }
  .admin-new-menu {
    left: 0;
    right: auto;
    width: 100%;
  }
  .admin-flow__actions {
    grid-template-columns: 1fr;
  }
  .admin-metrics {
    grid-template-columns: 1fr;
  }
  .admin-brand-preview {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-brand-preview__swatches {
    justify-content: flex-start;
  }
  .admin-asset-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-search-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-onboarding-steps {
    grid-template-columns: 1fr;
  }
  .admin-asset-summary {
    grid-template-columns: 1fr;
  }
  .admin-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .admin-table-wrap .admin-table {
    display: table;
    min-width: 720px;
    white-space: normal;
  }
}

/* Mock badge — only visible in mock mode */
.mock-banner {
  background: rgba(164, 182, 154, 0.25);
  border-bottom: 1px solid var(--c-sage);
  color: #2e5e3a;
  font-size: var(--fs-12);
  padding: 0.4rem var(--container-pad);
  text-align: center;
  font-weight: 600;
}
