/* ==========================================================================
   APP LAYER — Waffle-specific layout built only from houseofkatha-co tokens
   and components. No raw colors/sizes: everything resolves to a --token.
   ========================================================================== */

body { min-height: 100vh; }

/* ---- Brand lockup ---- */
.brand {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary); text-decoration: none;
}
.brand__logo { display: block; height: 1.5rem; width: auto; max-width: none; }

/* ---- Centered auth layout ---- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: var(--space-4);
}
.auth__card { max-width: 26rem; gap: var(--space-6); padding: var(--space-8); box-shadow: var(--shadow-lg); }
.auth__footer { text-align: center; font-size: var(--font-size-xs); color: var(--color-text-tertiary); }
.auth .tabs__list { margin-bottom: var(--space-2); }
.auth .tabs__tab { flex: 1; }
.form-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.form-stack .field__error:empty { display: none; }
.label-note { font-weight: var(--font-weight-regular); color: var(--color-text-tertiary); font-size: var(--font-size-xs); }

/* ---- App shell ---- */
.topbar { position: sticky; top: 0; z-index: 50; padding-inline: var(--page-gutter); box-shadow: var(--shadow-xs); }
.topbar__end { display: flex; align-items: center; gap: var(--space-3); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-8); }
.page-head h1 { font-size: var(--font-size-fluid-h2); line-height: 1.25; }
.page-head p { color: var(--color-text-tertiary); margin-top: var(--space-2); }
.toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.toolbar .input-group { width: auto; flex: 1 1 14rem; max-width: 22rem; }
.muted { color: var(--color-text-tertiary); }
.mono { font-family: var(--font-family-mono); }
.dot { width: .5rem; height: .5rem; border-radius: var(--radius-full); background: var(--color-neutral-400); display: inline-block; }
.dot--ok { background: var(--color-success-500); }
.dot--err { background: var(--color-error-500); }
.dot--warn { background: var(--color-warning-500); }

/* ---- Gallery ---- */
.project-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-6); }
.project-bar .select { width: auto; min-width: 14rem; }
.sketch-grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); align-items: start; }
.sketch-grid .skeleton { height: 12rem; }
.sketch-grid > .empty-state { grid-column: 1 / -1; }
.sketch-card__name { font-family: var(--font-family-mono); font-size: var(--font-size-xs); color: var(--color-text-tertiary); }
.sketch-card__desc { color: var(--color-text-secondary); }
.tag-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sketch-card__params { font-size: var(--font-size-xs); color: var(--color-text-tertiary); }
.sketch-card__params span { color: var(--color-text-secondary); font-family: var(--font-family-mono); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.presets-panel { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); background: var(--color-bg-subtle); border-radius: var(--radius); }
.presets-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-weight: var(--font-weight-semibold); font-size: var(--font-size-sm); }
.preset-list { display: flex; flex-direction: column; gap: var(--space-1); }
.preset-item, .member-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); background: var(--color-bg-surface); border-radius: var(--radius); font-size: var(--font-size-sm); }
.preset-actions { display: flex; gap: var(--space-1); }
.no-presets { font-size: var(--font-size-xs); color: var(--color-text-tertiary); }
.code-block { display: block; padding: var(--space-2) var(--space-3); background: var(--color-bg-subtle); border-radius: var(--radius); font-family: var(--font-family-mono); font-size: var(--font-size-xs); word-break: break-all; flex: 1; }
.inline-row { display: flex; gap: var(--space-2); align-items: center; }
.inline-row--end { align-items: flex-end; }
.file-pick { flex: 1; }
.file-pick .btn { width: 100%; }
.info-box { padding: var(--space-3); background: var(--color-bg-subtle); border-radius: var(--radius); font-size: var(--font-size-xs); color: var(--color-text-secondary); line-height: var(--line-height-md); }
.modal { max-width: 34rem; }
.modal__footer .btn--danger { margin-right: auto; }
.modal-form { display: flex; flex-direction: column; gap: var(--space-4); }
code { font-family: var(--font-family-mono); font-size: 0.9em; background: var(--color-bg-subtle); padding: 0 var(--space-1); border-radius: var(--radius); }

/* ---- Dashboard ---- */
.dash { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: var(--space-6); align-items: start; }
@media (max-width: 52rem) { .dash { grid-template-columns: 1fr; } }
.dash__side { position: sticky; top: calc(var(--control-height-lg) + var(--space-8)); padding: var(--space-3); gap: var(--space-2); }
.dash__side-title { padding: var(--space-2) var(--space-3); font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); color: var(--color-text-tertiary); text-transform: uppercase; }
.sidebar-empty { padding: var(--space-4) var(--space-3); color: var(--color-text-tertiary); font-size: var(--font-size-sm); }
.sketch-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3); min-height: var(--control-height-sm); border-radius: var(--radius); cursor: pointer; font-size: var(--font-size-sm); }
.sketch-item:hover { background: var(--color-bg-subtle); }
.sketch-item.active { background: var(--color-primary-50); color: var(--color-primary-700); font-weight: var(--font-weight-semibold); }
.client-count.active { background: var(--color-success-50); color: var(--color-success-700); }
.dash__main { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.stat-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.stat { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4); background: var(--color-bg-surface); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.stat__label { font-size: var(--font-size-xs); color: var(--color-text-tertiary); text-transform: uppercase; }
.stat__value { font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); }
.stat__value--ok { color: var(--color-success-600); }
.stat__value--sm { font-size: var(--font-size-sm); font-family: var(--font-family-mono); font-weight: var(--font-weight-regular); color: var(--color-text-secondary); }
.stat__sub { font-size: var(--font-size-xs); color: var(--color-text-tertiary); }
.panel-title { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); }
.params-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.param-item { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); background: var(--color-bg-subtle); border-radius: var(--radius); }
.param-name { font-weight: var(--font-weight-medium); font-size: var(--font-size-sm); }
.param-item .slider { gap: var(--space-4); }
.param-item .switch { min-height: var(--control-height-sm); }
.param-value { font-size: var(--font-size-xs); color: var(--color-primary-700); font-variant-numeric: tabular-nums; }
.pulse { animation: pulse-flash 700ms var(--ease-standard); }
@keyframes pulse-flash { 0% { color: var(--color-primary-600); } 100% { color: inherit; } }
.collapse { padding: 0; gap: 0; }
.section-toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); width: 100%; padding: var(--space-4) var(--space-6); background: transparent; border: 0; font-weight: var(--font-weight-semibold); font-size: var(--font-size-md); cursor: pointer; text-align: left; color: var(--color-text-primary); border-radius: var(--radius); }
.section-toggle:hover { background: var(--color-bg-subtle); }
.section-toggle .chevron { transition: transform var(--duration-base) var(--ease-standard); color: var(--color-text-tertiary); }
.section-toggle.open .chevron { transform: rotate(90deg); }
.section-body { display: none; padding: 0 var(--space-6) var(--space-6); }
.section-body.open { display: flex; flex-direction: column; gap: var(--space-4); }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.chip-row .btn--sm { flex-shrink: 0; }
.table-wrap .table { min-width: 0; }
.right { text-align: right; }

/* ---- Editor ---- */
body.editor { --header-h: var(--control-height-lg); --sidebar-w: 14rem; --status-h: 1.75rem; height: 100vh; overflow: hidden; }
.editor-bar { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding-inline: var(--space-4); background: var(--color-bg-surface); box-shadow: var(--shadow-xs); flex-shrink: 0; position: relative; z-index: 10; }
.editor-bar .header-left { display: flex; align-items: center; gap: var(--space-3); min-width: 0; flex: 1; }
.editor-bar .header-right { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.breadcrumb { font-size: var(--font-size-sm); color: var(--color-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb .crumb-sep { margin-inline: var(--space-2); color: var(--color-border-strong); }
.breadcrumb .crumb-sketch { color: var(--color-text-primary); font-weight: var(--font-weight-medium); }
.crumb-editable { cursor: text; }
.crumb-editable:hover { color: var(--color-text-primary); }
.inline-edit { background: var(--color-bg-surface); border-radius: var(--radius); color: var(--color-text-primary); font: inherit; outline: none; padding: 0 var(--space-2); box-shadow: var(--shadow-focus-ring); border: 0; }
.save-status { font-size: var(--font-size-xs); color: var(--color-text-tertiary); white-space: nowrap; }
.save-status.dirty { color: var(--color-warning-700); }
.save-status.saved { color: var(--color-success-700); }
.autosave-toggle { user-select: none; white-space: nowrap; font-size: var(--font-size-xs); }
.autosave-toggle.on .switch__track { background: var(--color-primary-600); }
.autosave-toggle.on .switch__track::before { transform: translateX(1rem); }
.btn-group { display: flex; gap: var(--space-1); }
#preview-btn.active { box-shadow: var(--btn-focus-ring); }
.err-btn-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; padding: 0 var(--space-1); border-radius: var(--radius-full); background: var(--color-error-600); color: var(--color-text-inverse); font-size: var(--font-size-xs); line-height: 1.25rem; }

#body-wrap { display: flex; flex-direction: column; height: calc(100vh - var(--header-h)); }
#layout { flex: 1; min-height: 0; display: flex; overflow: hidden; }
#file-sidebar { width: var(--sidebar-w); flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--color-bg-surface); transition: width var(--duration-slow) var(--ease-standard); }
#file-sidebar.collapsed { width: 0; min-width: 0; }
#sidebar-strip { flex-shrink: 0; width: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; padding-top: var(--space-3); gap: var(--space-2); cursor: pointer; background: var(--color-bg-surface); transition: width var(--duration-slow) var(--ease-standard); }
#sidebar-strip.visible { width: 1.75rem; }
#sidebar-strip:hover { background: var(--color-bg-subtle); }
.strip-arrow, .strip-label { font-size: var(--font-size-xs); color: var(--color-text-tertiary); user-select: none; }
.strip-label { writing-mode: vertical-lr; text-transform: uppercase; }
.sidebar-hd { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); flex-shrink: 0; font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); color: var(--color-text-tertiary); text-transform: uppercase; }
.sidebar-hd-title { flex: 1; }
#add-dropdown { position: fixed; z-index: 500; display: none; min-width: 11rem; }
#add-dropdown.open { display: block; }
#add-dropdown .dropdown__item { width: 100%; background: none; border: 0; text-align: left; }
#file-list { flex: 1; overflow-y: auto; padding: var(--space-1) var(--space-2); }
.file-item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); min-height: var(--control-height-sm); border-radius: var(--radius); font-size: var(--font-size-sm); cursor: pointer; color: var(--color-text-secondary); user-select: none; }
.file-item:hover { background: var(--color-bg-subtle); color: var(--color-text-primary); }
.file-item.active { background: var(--color-primary-50); color: var(--color-primary-700); font-weight: var(--font-weight-medium); }
.file-item.dirty .fi-name::after { content: " •"; color: var(--color-warning-600); }
.fi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; cursor: text; }
.fi-name.inline-edit { overflow: visible; white-space: normal; min-width: 4rem; width: 100%; }
.fi-del { flex-shrink: 0; width: 1.5rem; height: 1.5rem; display: inline-flex; align-items: center; justify-content: center; color: transparent; cursor: pointer; border: none; background: none; border-radius: var(--radius); }
.file-item:hover .fi-del { color: var(--color-text-tertiary); }
.fi-del:hover { color: var(--color-error-600) !important; background: var(--color-error-50); }

#editor-area { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
#cm-wrapper { flex: 1; overflow: hidden; background: var(--color-bg-surface); }
.CodeMirror { height: 100%; font-family: var(--font-family-mono); font-size: var(--font-size-sm); line-height: 1.65; background: var(--color-bg-surface); color: var(--color-text-primary); }
.CodeMirror-gutters { background: var(--color-bg-subtle); border-right: 0; }
.CodeMirror-linenumber { color: var(--color-text-tertiary); }
.CodeMirror-cursor { border-left-color: var(--color-primary-600); }
.CodeMirror-activeline-background { background: var(--color-primary-50); }
.CodeMirror-selected { background: var(--color-primary-100) !important; }
.cm-error-line { background: var(--color-error-50) !important; }

#asset-preview { flex: 1; display: none; flex-direction: column; overflow: hidden; background: var(--color-bg-surface); }
.ap-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-4); font-size: var(--font-size-sm); color: var(--color-text-secondary); flex-shrink: 0; }
.ap-filename { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: var(--space-6); }
.ap-body.ap-img { background: repeating-conic-gradient(var(--color-neutral-100) 0% 25%, var(--color-neutral-50) 0% 50%) 0 0 / 1rem 1rem; }
.ap-body img, .ap-body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.ap-body audio { width: min(26rem, 90%); }
.ap-unknown { color: var(--color-text-tertiary); font-size: var(--font-size-sm); }

#resize-handle { width: 0.25rem; flex-shrink: 0; cursor: col-resize; display: none; background: var(--color-neutral-200); position: relative; transition: background var(--duration-base); }
#resize-handle::after { content: ''; position: absolute; inset: 0 -0.25rem; }
#resize-handle:hover, #resize-handle.active { background: var(--color-primary-400); }
#preview-pane { flex-shrink: 0; width: 40%; display: flex; flex-direction: column; overflow: hidden; background: var(--color-bg-surface); }
.preview-hd { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4); font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); text-transform: uppercase; color: var(--color-text-tertiary); flex-shrink: 0; }
#preview-frame { flex: 1; width: 100%; border: none; background: #000; }

#statusbar { height: var(--status-h); flex-shrink: 0; display: flex; align-items: center; padding-inline: var(--space-4); gap: var(--space-4); font-size: var(--font-size-xs); color: var(--color-text-tertiary); background: var(--color-bg-surface); box-shadow: 0 -1px 2px rgba(16, 24, 40, 0.05); overflow: hidden; }
#sb-file { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sb-pos, #sb-info { flex-shrink: 0; }

#mobile-block { display: none; position: fixed; inset: 0; z-index: 9999; background: var(--color-bg-page); }
@media (max-width: 768px) { #mobile-block { display: flex; } }

.form-error { color: var(--color-error-600); font-size: var(--font-size-xs); }

#error-console { flex-shrink: 0; max-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--color-bg-surface); transition: max-height var(--duration-base) var(--ease-standard); }
#error-console.has-errors { max-height: 11rem; box-shadow: 0 -1px 2px rgba(16, 24, 40, 0.08); }
.errc-hd { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-4); flex-shrink: 0; font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); text-transform: uppercase; }
.errc-hd-left { display: flex; align-items: center; gap: var(--space-2); color: var(--color-error-700); }
#err-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; padding: 0 var(--space-1); border-radius: var(--radius-full); background: var(--color-error-600); color: var(--color-text-inverse); line-height: 1.25rem; }
.errc-clear-btn { font: inherit; text-transform: uppercase; background: none; border: none; color: var(--color-text-tertiary); cursor: pointer; padding: 0; }
.errc-clear-btn:hover { color: var(--color-text-primary); }
#error-list { flex: 1; overflow-y: auto; }
.err-item { padding: var(--space-2) var(--space-4); font-size: var(--font-size-sm); }
.err-item:nth-child(even) { background: var(--color-bg-subtle); }
.err-item-row { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
.err-item-type { color: var(--color-error-700); font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); text-transform: uppercase; flex-shrink: 0; }
.err-item-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.err-item-loc { flex-shrink: 0; font-family: var(--font-family-mono); font-size: var(--font-size-xs); color: var(--color-text-link); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.err-item-hint { font-size: var(--font-size-xs); color: var(--color-warning-700); padding-top: var(--space-1); }

/* ---- Landing ----
   Everything scales from --u (one pixel of the 1512x982 design), so the
   composition keeps its proportions and always fits the viewport. */
html:has(body.landing) { overflow: hidden; width: 100%; height: 100%; }
body.landing { position: fixed; inset: 0; margin: 0; width: auto; height: auto; --u: min(0.066138vw, 0.101833vh, 0.101833dvh, 0.101833svh); background: #737f52; overflow: hidden; display: flex; justify-content: center; padding: calc(55 * var(--u)) 0 0; }
.landing-card { position: relative; flex: 0 1 auto; margin-inline: auto; min-width: 0; width: min(calc(915 * var(--u)), 100%); height: 100%; background: var(--color-bg-page); border-radius: calc(72 * var(--u)) calc(72 * var(--u)) 0 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; padding: 0 calc(24 * var(--u)) calc(60 * var(--u)); }
/* Spare height is split above/below the content (≈ the design's 211/162 ratio) so it never pools in one place. */
.landing-card::before, .landing-card::after { content: ""; display: block; flex: 1 1 0; min-height: 0; }
.landing-card::before { flex-grow: 1.85; }
.landing-brand { position: absolute; top: calc(56 * var(--u)); left: 50%; transform: translateX(-50%); width: calc(150 * var(--u)); min-width: 5.5rem; height: auto; }
.landing-logos { display: flex; align-items: center; justify-content: center; gap: calc(28 * var(--u)); width: 100%; }
.landing-logos .logo { width: calc(131 * var(--u)); height: calc(131 * var(--u)); flex-shrink: 0; display: block; }
.landing-logos .arrow { width: calc(295 * var(--u)); height: auto; flex-shrink: 0; display: block; }
.landing-title { font-family: "Libre Baskerville", Georgia, serif; font-style: italic; font-weight: 400; font-size: calc(52 * var(--u)); line-height: 1.15; margin-top: calc(85 * var(--u)); color: var(--color-neutral-900); }
.landing-lead { white-space: nowrap; max-width: 100%; margin-top: calc(48 * var(--u)); font-size: calc(18 * var(--u)); line-height: 1.22; color: var(--color-text-tertiary); }
.landing-card .btn { margin-top: calc(62 * var(--u)); height: calc(42 * var(--u)); min-height: 2.25rem; padding-inline: calc(20 * var(--u)); font-size: max(0.75rem, calc(14 * var(--u))); }
.landing-foot { position: absolute; left: 0; right: 0; bottom: calc(28 * var(--u)); font-family: var(--font-family-mono); font-size: max(0.625rem, calc(12 * var(--u))); text-transform: uppercase; color: var(--color-text-tertiary); }
.landing-foot a { color: inherit; text-decoration: underline; }
@media (max-width: 40rem) {
  body.landing { --u: min(0.2vw, 0.1018vh, 0.1018dvh, 0.1018svh); padding: max(0.75rem, calc(24 * var(--u))) max(0.75rem, calc(24 * var(--u))) 0; }
  .landing-card { width: 100%; padding-top: calc(24 * var(--u)); border-radius: calc(40 * var(--u)) calc(40 * var(--u)) 0 0; }
  .landing-card::before { flex-grow: 1; }
  .landing-brand { top: calc(40 * var(--u)); width: calc(120 * var(--u)); }
  .landing-logos { gap: calc(14 * var(--u));; }
  .landing-foot { bottom: calc(20 * var(--u)); }
  .landing-logos .logo { width: calc(92 * var(--u)); height: calc(92 * var(--u)); }
  .landing-logos .arrow { width: calc(150 * var(--u)); }
  .landing-title { font-size: calc(36 * var(--u)); margin-top: calc(100 * var(--u)); }
  .landing-lead { font-size: min(calc(14 * var(--u)), 3.5vw); margin-top: calc(32 * var(--u)); }
  .landing-card .btn { margin-top: calc(40 * var(--u)); }
}
.reveal { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
.modal .tabs__list { margin-bottom: var(--space-2); } .modal .tabs__tab { flex: 1; }
.modal-switch { text-align: center; font-size: var(--font-size-sm); color: var(--color-text-tertiary); }
.modal-switch button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--color-text-link); font: inherit; }
.section-toggle .muted { margin-right: auto; margin-left: calc(var(--space-2) * -1); font-weight: var(--font-weight-regular); }

/* Borders are off system-wide, so fields on white surfaces need a tint to read as inputs. */
.card .input, .card .select, .card .textarea,
.modal .input, .modal .select, .modal .textarea,
.topbar .select, .project-bar .select { background-color: var(--color-bg-subtle); }
.param-item .input { background-color: var(--color-bg-surface); }

/* ---- Admin ---- (composed only from existing tokens/components) */
.admin-side { gap: var(--space-1); }
.admin-side .dash__side-title:not(:first-child) { margin-top: var(--space-2); }
.admin-side a.sketch-item { color: var(--color-text-secondary); text-decoration: none; justify-content: flex-start; gap: var(--space-3); }
.admin-side a.sketch-item.active { color: var(--color-primary-700); }
.admin-side .icon { width: var(--icon-size-sm); height: var(--icon-size-sm); flex-shrink: 0; }
.admin-cols { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); align-items: start; }
.admin-table .table { min-width: 40rem; }
.admin-table td, .admin-table th { white-space: nowrap; }
.admin-table td.wrap { white-space: normal; min-width: 12rem; }
.admin-table tr[data-href] { cursor: pointer; }
.th-sort { appearance: none; background: none; border: 0; padding: 0; font: inherit; font-weight: var(--font-weight-semibold); color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-1); }
.th-sort:hover { color: var(--color-text-primary); }
.th-sort[data-dir]::after { content: "↑"; color: var(--color-primary-600); }
.th-sort[data-dir="desc"]::after { content: "↓"; }
.admin-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.admin-link { color: var(--color-text-primary); font-weight: var(--font-weight-medium); text-decoration: none; }
.admin-link:hover { color: var(--color-primary-600); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-6); font-size: var(--font-size-sm); }
.kv dt { color: var(--color-text-tertiary); } .kv dd { margin: 0; word-break: break-word; min-width: 0; }
.bars { display: flex; align-items: flex-end; gap: var(--space-1); height: 9rem; }
.bars__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; height: 100%; min-width: 0; }
.bars__stack { width: 100%; display: flex; flex-direction: column; justify-content: flex-end; flex: 1; gap: 2px; }
.bars__seg { width: 100%; border-radius: var(--radius); min-height: 0; }
.bars__seg--a { background: var(--color-primary-600); } .bars__seg--b { background: var(--color-neutral-400); }
.bars__label { font-size: var(--font-size-xs); color: var(--color-text-tertiary); }
.legend { display: flex; gap: var(--space-4); font-size: var(--font-size-xs); color: var(--color-text-secondary); flex-wrap: wrap; }
.legend i { display: inline-block; width: .625rem; height: .625rem; border-radius: var(--radius); margin-right: var(--space-1); }
.meter { display: flex; height: .75rem; border-radius: var(--radius-full); overflow: hidden; background: var(--color-bg-subtle); }
.meter span { display: block; height: 100%; }
.admin-skel { height: 6rem; }
@media (max-width: 52rem) {
  .admin-side { position: static; flex-direction: row; overflow-x: auto; padding: var(--space-2); }
  .admin-side .dash__side-title { display: none; }
  .admin-side a.sketch-item { white-space: nowrap; }
  .admin-hide-sm { display: none; }
}
.admin-table .btn-row { flex-wrap: nowrap; }
