/* ═══════════════════════════════════════════════════════════════
   studio-admin — admin.css
   Token system matches ui-kit/core/tokens.css quality.
   Brand: Tokyo Night blue (#7aa2f7) — appropriate for a tool.
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --brand:         #7aa2f7;
  --brand-dim:     #5a85f0;
  --brand-muted:   #1e2d5a;
  --brand-soft:    rgba(122, 162, 247, 0.10);
  --brand-glow:    rgba(122, 162, 247, 0.22);
  --brand-border:  rgba(122, 162, 247, 0.28);

  --bg:            #0d0d11;
  --bg-raised:     #111116;
  --surface:       #17171e;
  --surface-2:     #1e1e28;
  --elevated:      #26262f;
  --overlay:       #2e2e3a;

  --text-1:        #c0caf5;
  --text-2:        #7070a0;
  --text-3:        #404060;
  --text-4:        #28283a;
  --text-on-brand: #0d0d11;

  --border:        rgba(192, 202, 245, 0.06);
  --border-hi:     rgba(192, 202, 245, 0.11);
  --border-str:    rgba(192, 202, 245, 0.20);

  --success:       #9ece6a;
  --success-soft:  rgba(158, 206, 106, 0.12);
  --error:         #f7768e;
  --error-soft:    rgba(247, 118, 142, 0.12);
  --warning:       #e0af68;

  --font-body:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  --text-2xs:   10px;
  --text-xs:    12px;
  --text-sm:    13px;
  --text-base:  14px;
  --text-md:    15px;
  --text-lg:    18px;
  --text-xl:    22px;
  --text-2xl:   28px;

  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semi:    600;
  --weight-bold:    700;

  --leading-tight:  1.2;
  --leading-normal: 1.5;
  --leading-loose:  1.7;

  --tracking-wide:   0.05em;
  --tracking-wider:  0.08em;
  --tracking-widest: 0.14em;

  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;

  --radius-base: 10px;
  --radius-xs:   calc(var(--radius-base) * 0.25);
  --radius-sm:   calc(var(--radius-base) * 0.5);
  --radius-md:   var(--radius-base);
  --radius-lg:   calc(var(--radius-base) * 1.4);
  --radius-xl:   calc(var(--radius-base) * 2);
  --radius-full: 9999px;

  --shadow-xs:    0 1px 2px rgba(0,0,0,0.55);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.50), 0 0 0 1px var(--border);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.55), 0 0 0 1px var(--border);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.60), 0 0 0 1px var(--border);
  --shadow-brand: 0 4px 20px var(--brand-glow), 0 0 0 1px var(--brand-border);

  --ease-out:    cubic-bezier(0.0, 0.0, 0.2, 1.0);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1.0);
  --dur-fast:    110ms;
  --dur-base:    190ms;
  --dur-slow:    330ms;

  --sidebar-w: 220px;
  --panel-w:   310px;
  --topbar-h:  50px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; background: none; border: none; outline: none; }

/* ── App shell ─────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--panel-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100dvh;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  background: rgba(13, 13, 17, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  color: var(--brand);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.topbar-logo-icon { font-size: 15px; }

.topbar-divider {
  width: 1px;
  height: 14px;
  background: var(--border-hi);
  flex-shrink: 0;
}

.topbar-site {
  font-size: var(--text-sm);
  color: var(--text-2);
  flex-shrink: 0;
}

/* ── Tab bar ─────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  margin-left: var(--space-2);
}
.tab {
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--text-3);
  letter-spacing: var(--tracking-wide);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.tab:hover { color: var(--text-2); }
.tab.active {
  background: var(--elevated);
  color: var(--text-1);
  box-shadow: var(--shadow-xs);
}

.topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.save-indicator {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-3);
  transition: color var(--dur-base);
  min-width: 120px;
  text-align: right;
}
.save-indicator.ok  { color: var(--success); }
.save-indicator.err { color: var(--error); }

.topbar-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border: 1px solid var(--border-hi);
  color: var(--text-2);
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.topbar-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-str);
  color: var(--text-1);
}
.topbar-btn-save {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
}
.topbar-btn-save:hover { background: rgba(122,162,247,0.16); }
.topbar-btn-save:disabled { opacity: 0.45; cursor: not-allowed; }

.topbar-btn-deploy {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-on-brand);
  font-weight: var(--weight-semi);
}
.topbar-btn-deploy:hover { filter: brightness(1.08); }
.topbar-btn-deploy:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  grid-row: 2;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hi) transparent;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.sidebar-group { padding: var(--space-3) var(--space-2); }
.sidebar-group + .sidebar-group { border-top: 1px solid var(--border); }

.sidebar-group-label {
  font-size: 10px;
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-3);
  padding: var(--space-1) var(--space-2) var(--space-2);
  font-family: var(--font-mono);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 7px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-2);
  text-align: left;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  min-height: 34px;
}
.sidebar-item:hover { background: var(--surface); color: var(--text-1); }
.sidebar-item.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.sidebar-item-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  opacity: 0.6;
}
.sidebar-item.active .sidebar-item-icon { opacity: 1; }

/* ── Editor panel ───────────────────────────────────────────── */
.editor-panel {
  grid-row: 2;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 46px;
}
.editor-panel-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  flex: 1;
  color: var(--text-1);
}
.editor-panel-subtitle {
  font-size: var(--text-xs);
  color: var(--text-3);
}

.editor-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  scrollbar-width: thin;
  scrollbar-color: var(--border-hi) transparent;
}

.editor-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-3);
  color: var(--text-3);
  padding: var(--space-8);
  text-align: center;
}
.editor-empty-icon { font-size: 28px; opacity: 0.35; }
.editor-empty-text { font-size: var(--text-sm); line-height: var(--leading-loose); max-width: 200px; }

/* Panel sections */
.panel-group {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.panel-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.panel-group-title {
  font-size: 10px;
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-bottom: var(--space-3);
}

/* ── Form fields ─────────────────────────────────────────────── */
.field { margin-bottom: var(--space-4); }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 10px;
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-1);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.field-input::placeholder { color: var(--text-4); }
.field-input:focus {
  border-color: var(--brand-border);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field-textarea {
  height: auto;
  min-height: 68px;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
  line-height: var(--leading-loose);
}

/* Color row: swatch + hex text */
.color-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.color-row .field-input { flex: 1; font-family: var(--font-mono); font-size: var(--text-xs); }
.color-swatch {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  cursor: pointer;
  padding: 3px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

/* Atmosphere pills */
.pill-group {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-top: var(--space-1);
}
.atmo-pill {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border: 1px solid var(--border-hi);
  color: var(--text-2);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.atmo-pill:hover { border-color: var(--border-str); color: var(--text-1); }
.atmo-pill.active {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
}

/* Slider */
.slider-row { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-1); }
.slider-row input[type="range"] {
  flex: 1;
  appearance: none;
  height: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  cursor: pointer;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--brand-border);
  cursor: pointer;
}
.slider-val {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-2);
  min-width: 28px;
  text-align: right;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.toggle-row-label { font-size: var(--text-sm); color: var(--text-2); }
.toggle-switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast);
}
.toggle-switch input:checked + .toggle-track {
  background: var(--brand-soft);
  border-color: var(--brand-border);
}
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(14px);
  background: var(--brand);
}

/* Font preset cards */
.font-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-top: var(--space-1);
}
.font-preset-card {
  padding: var(--space-3) var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  text-align: left;
}
.font-preset-card:hover { border-color: var(--border-str); background: var(--surface-2); }
.font-preset-card.active { border-color: var(--brand-border); background: var(--brand-soft); }
.font-preset-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  color: var(--text-2);
  margin-bottom: 4px;
}
.font-preset-card.active .font-preset-name { color: var(--brand); }
.font-preset-preview {
  font-size: 15px;
  color: var(--text-1);
  line-height: 1.2;
}

/* Hue track */
.hue-track {
  position: relative;
  height: 18px;
  border-radius: var(--radius-full);
  background: linear-gradient(to right,
    hsl(0,75%,58%),hsl(30,75%,58%),hsl(60,75%,58%),hsl(90,75%,58%),
    hsl(120,75%,58%),hsl(150,75%,58%),hsl(180,75%,58%),hsl(210,75%,58%),
    hsl(240,75%,58%),hsl(270,75%,58%),hsl(300,75%,58%),hsl(330,75%,58%),
    hsl(360,75%,58%));
  cursor: pointer;
  margin: 4px 0 8px;
}
.hue-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.6);
  pointer-events: none;
  background: currentColor;
}

/* Design presets */
.panel-hint {
  font-size: 10px;
  color: var(--text-3);
  margin-top: var(--space-2);
  line-height: 1.5;
}

.design-presets {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-1);
}
.design-preset-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  text-align: left;
  width: 100%;
}
.design-preset-btn:hover { border-color: var(--border-str); background: var(--surface-2); }
.design-preset-swatches { display: flex; gap: 3px; flex-shrink: 0; }
.design-preset-swatch {
  width: 12px; height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,.1);
}
.design-preset-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  color: var(--text-1);
}
.design-preset-desc { font-size: 10px; color: var(--text-3); margin-top: 1px; }

/* Layout drag list */
.drag-list { display: flex; flex-direction: column; gap: 3px; }
.drag-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-2);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.drag-item:hover { background: var(--surface-2); border-color: var(--border-hi); color: var(--text-1); }
.drag-handle {
  color: var(--text-3);
  cursor: grab;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drag-handle span {
  display: block;
  width: 10px;
  height: 1px;
  background: currentColor;
  border-radius: 1px;
}
.drag-item-label { flex: 1; }

/* ── Array editor ─────────────────────────────────────────────── */
.array-list { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-1); }

.array-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.array-item-hd {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-2);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  min-height: 32px;
}
.array-item-n {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-3);
  min-width: 14px;
  flex-shrink: 0;
}
.array-item-lbl {
  flex: 1;
  font-size: var(--text-xs);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.array-item-rm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.array-item-rm:hover { background: var(--error-soft); color: var(--error); }

.array-item-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.array-item-body .field { margin-bottom: 0; }

.array-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  width: 100%;
  padding: 8px;
  margin-top: var(--space-1);
  border: 1px dashed var(--border-hi);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-3);
  cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
.array-add-btn:hover {
  border-color: var(--brand-border);
  color: var(--brand);
  background: var(--brand-soft);
}

/* ── Image field ─────────────────────────────────────────────── */
.img-field-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.img-field-row .field-input { flex: 1; }
.img-upload-btn {
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.img-upload-btn:hover { background: var(--surface-2); border-color: var(--border-str); color: var(--text-1); }
.img-preview-thumb {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: var(--space-2);
  display: none;
}
.img-preview-thumb.shown { display: block; }

/* ── History list ─────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: var(--space-2); }
.history-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.history-time {
  flex: 1;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-2);
}
.history-restore {
  font-size: var(--text-xs);
  color: var(--brand);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  background: var(--brand-soft);
  cursor: pointer;
  transition: background var(--dur-fast);
}
.history-restore:hover { background: rgba(122,162,247,0.18); }
.history-empty {
  font-size: var(--text-sm);
  color: var(--text-3);
  text-align: center;
  padding: var(--space-8);
  font-family: var(--font-mono);
}

/* ── Preview pane ─────────────────────────────────────────────── */
.preview-pane {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.preview-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  height: 36px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.preview-url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-2);
  height: 24px;
  min-width: 0;
}
.preview-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 4px var(--success);
  flex-shrink: 0;
}
.preview-url-text {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-ctrl {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-3);
  flex-shrink: 0;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.preview-ctrl:hover { background: var(--surface-2); color: var(--text-1); }

.preview-mode-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 1px;
}
.mode-pill {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--weight-medium);
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.mode-pill.active {
  background: var(--surface-2);
  color: var(--text-1);
}

.preview-iframe {
  flex: 1;
  border: none;
  background: #fff;
}

/* ── Toast ─────────────────────────────────────────────────── */
@keyframes toast-in  { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); }    to { opacity: 0; transform: translateY(6px); } }

.toaster {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 999;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 220px;
  max-width: 300px;
  padding: var(--space-3) var(--space-4);
  background: var(--elevated);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  pointer-events: all;
  animation: toast-in var(--dur-base) var(--ease-out) forwards;
}
.toast.out { animation: toast-out var(--dur-base) var(--ease-out) forwards; }
.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.toast-dot-ok  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.toast-dot-err { background: var(--error);   box-shadow: 0 0 6px var(--error); }

/* ── Login ─────────────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--bg);
  overflow: auto;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  color: var(--brand);
  margin-bottom: var(--space-6);
}
.login-logo-icon { font-size: 16px; }
.login-heading {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-1);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}
.login-sub {
  font-size: var(--text-sm);
  color: var(--text-2);
  margin-bottom: var(--space-6);
}
.login-input {
  width: 100%;
  height: 40px;
  background: var(--bg-raised);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-1);
  margin-bottom: var(--space-3);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.login-input::placeholder { color: var(--text-4); }
.login-input:focus {
  border-color: var(--brand-border);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.login-err {
  font-size: var(--text-xs);
  color: var(--error);
  font-family: var(--font-mono);
  min-height: 18px;
  margin-bottom: var(--space-2);
}
.login-btn {
  width: 100%;
  height: 40px;
  background: var(--brand);
  color: var(--text-on-brand);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  transition: filter var(--dur-fast);
}
.login-btn:hover  { filter: brightness(1.08); }
.login-btn:active { filter: brightness(0.95); }

/* ── Dashboard ──────────────────────────────────────────────── */
.dashboard-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: auto;
}
.dashboard-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-6);
  height: var(--topbar-h);
  background: rgba(13,13,17,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.dashboard-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  color: var(--brand);
}
.dashboard-logout {
  margin-left: auto;
  height: 28px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  border: 1px solid var(--border-hi);
  color: var(--text-2);
  transition: all var(--dur-fast);
}
.dashboard-logout:hover {
  background: var(--surface-2);
  border-color: var(--border-str);
  color: var(--text-1);
}
.dashboard-body {
  flex: 1;
  padding: var(--space-10) var(--space-8);
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}
.dashboard-eyebrow {
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: var(--space-2);
}
.dashboard-heading {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--text-1);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-1);
}
.dashboard-sub {
  font-size: var(--text-sm);
  color: var(--text-2);
  margin-bottom: var(--space-8);
}
.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}
.site-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-base) var(--ease-spring),
              box-shadow var(--dur-base) var(--ease-out);
}
.site-card:hover {
  background: var(--surface-2);
  border-color: var(--border-hi);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.site-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.site-card-name {
  font-weight: var(--weight-semi);
  font-size: var(--text-md);
  color: var(--text-1);
}
.site-card-url {
  font-size: var(--text-xs);
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.site-card-status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-3);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 4px var(--success);
}

/* ── Inspector ──────────────────────────────────────────────── */
.inspector-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.inspector-back {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
  color: var(--text-2);
  border: 1px solid var(--border-hi);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--dur-fast);
}
.inspector-back:hover { border-color: var(--border-str); color: var(--text-1); background: var(--surface-2); }
.inspector-chip {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inspector-el-chip {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--warning);
  background: rgba(224,175,104,0.12);
  border: 1px solid rgba(224,175,104,0.28);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inspector-clear-btn {
  width: 100%;
  padding: 7px var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--error);
  border: 1px solid rgba(247,118,142,0.22);
  background: var(--error-soft);
  cursor: pointer;
  transition: all var(--dur-fast);
  margin-top: var(--space-2);
}
.inspector-clear-btn:hover { background: rgba(247,118,142,0.18); border-color: var(--error); }

.custom-preset-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.custom-preset-apply {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.custom-preset-apply:hover { background: var(--brand-soft); border-color: var(--brand-border); }
.custom-preset-del {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 10px;
  width: 22px; height: 22px;
  border-radius: 3px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color var(--dur-fast), border-color var(--dur-fast);
  flex-shrink: 0;
}
.custom-preset-del:hover { color: var(--error); border-color: var(--error); }

/* ── Bloom layer rows (section inspector) ─────────────────────── */
.bloom-row {
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  padding: 8px 8px 2px;
  margin-bottom: 6px;
}
.bloom-row-color {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.bloom-row-hex {
  flex: 1;
  font-size: 11px !important;
}
.bloom-del-btn {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  color: var(--text-3);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.bloom-del-btn:hover { color: var(--error); border-color: var(--error); }
.add-bloom-btn {
  width: 100%;
  padding: 6px;
  background: none;
  border: 1px dashed var(--border-hi);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-top: 2px;
}
.add-bloom-btn:hover { color: var(--brand); border-color: var(--brand-border); }
