:root {
  --bg-0: #09090b;
  --bg-1: #111115;
  --bg-2: #18181d;
  --bg-glass: rgba(17, 17, 21, 0.78);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.2);
  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #8d8d99; /* 5.7:1 on the dark panels (was #71717a, 3.9:1) */
  --accent-primary: oklch(0.68 0.24 280);
  --accent-secondary: oklch(0.72 0.19 200);
  --accent-emerald: #10b981;
  --ui-bg0-rgb: 9 9 11;
  --ui-shade-k: 1; /* how strongly black overlays show (much less in the light UI) */
  --ui-ink: #ffffff; /* base of every white-alpha surface and border (black in the light UI) */
  --ui-panel-rgb: 12 12 16;
  --ui-glass-rgb: 22 22 30;
  --ui-bg-deep: #08080c;
  --ui-input-bg: rgba(0, 0, 0, 0.4);
  --ui-surface: #18181b;
  --ui-surface-2: #27272a;
  --ui-faint: #71717a;
  --ui-text-soft: #e4e4e7;
  --text-dim-aa: #a1a1ad;
  --ui-accent-text: #c084fc;
  --ui-accent-soft: #d8b4fe;
  --ui-accent-lilac: #c4b5fd;
  --ui-warn: #fcd34d;
  --ui-danger: #f87171;
  --ui-danger-soft: #fca5a5;
  --ui-info: #818cf8;
  --ui-ok: #34d399;
  --ui-teal: #5eead4;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}


/* Light interface: only the variables change, so every panel, border and text colour follows */
html[data-ui-theme="light"] {
  color-scheme: light;
  --bg-0: #f4f4f7;
  --bg-1: #ffffff;
  --bg-2: #ececf1;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --border-subtle: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.25);
  --text-main: #18181b;
  --text-muted: #52525b;
  --text-dim: #5f5f6b;
  --ui-bg0-rgb: 244 244 247;
  --ui-shade-k: 0.18;
  --ui-ink: #000000;
  --ui-panel-rgb: 255 255 255;
  --ui-glass-rgb: 250 250 253;
  --ui-bg-deep: #e9e9ef;
  --ui-input-bg: rgba(0, 0, 0, 0.05);
  --ui-surface: #ececf1;
  --ui-surface-2: #dcdce3;
  --ui-faint: #6b6b76;
  --ui-text-soft: #27272a;
  --text-dim-aa: #55555f;
  --ui-accent-text: #7e22ce;
  --ui-accent-soft: #6b21a8;
  --ui-accent-lilac: #6d28d9;
  --ui-warn: #b45309;
  --ui-danger: #b91c1c;
  --ui-danger-soft: #b91c1c;
  --ui-info: #4f46e5;
  --ui-ok: #047857;
  --ui-teal: #0f766e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-0);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

code, pre, kbd {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Ambient OKLCH Aurora */
.ambient-aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.22;
}

.blob-a {
  width: 560px;
  height: 560px;
  top: -180px;
  left: 12%;
  background: radial-gradient(circle, oklch(0.65 0.26 285), transparent 70%);
}

.blob-b {
  width: 520px;
  height: 520px;
  top: -140px;
  right: 10%;
  background: radial-gradient(circle, oklch(0.7 0.21 205), transparent 70%);
}

.aurora-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at top, #000 25%, transparent 75%);
}

/* Top Header */
.vault-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: rgb(var(--ui-bg0-rgb) / 0.84);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-cube {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #a855f7, #38bdf8);
  color: var(--bg-0);
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand-dot {
  color: #a855f7;
}

.brand-tag {
  font-size: 10px;
  font-family: monospace;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.mobile-sidebar-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
}

.mobile-sidebar-toggle:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
}

.mode-switcher {
  display: inline-flex;
  background: var(--bg-1);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.is-active {
  background: #fafafa;
  color: var(--bg-0);
}

.add-feature-btn {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #ffffff;
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.add-feature-btn:hover {
  opacity: 0.92;
}

/* Catalog View & Sidebar Layout */
.catalog-view {
  position: relative;
  z-index: 1;
  max-width: 1540px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.catalog-container {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

/* Left Sidebar: Searching and Options */
.catalog-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.catalog-sidebar::-webkit-scrollbar {
  width: 4px;
}

.catalog-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-section-title {
  font-size: 10px;
  font-family: monospace;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Sidebar Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 34px 8px 34px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  transition: all 0.2s ease;
}

#searchInput:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.search-kbd {
  position: absolute;
  right: 10px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
}

/* Sidebar Collection Tabs */
.sidebar-collection-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  padding: 0;
  border: none;
}

.sidebar-collection-tabs .col-tab,
.vault-header .col-tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.sidebar-collection-tabs .col-tab:hover,
.vault-header .col-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border-hover);
}

.sidebar-collection-tabs .col-tab.is-active,
.vault-header .col-tab.is-active {
  background: var(--bg-2);
  color: var(--text-main);
  border-color: rgba(168, 85, 247, 0.45);
  font-weight: 600;
}

.vault-header .col-tab {
  width: auto;
  gap: 8px;
  min-height: 28px; /* touch target of at least 24px */
  white-space: nowrap;
  font-family: inherit;
}

.vault-header #collectionTabs {
  display: flex;
  gap: 6px;
}

.tab-count {
  font-size: 10px;
  font-family: monospace;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.col-tab.is-active .tab-count {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

/* Sidebar Options Lists (Categories & Sources) */
.sidebar-options-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.filter-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.filter-pill.is-active {
  background: var(--bg-2);
  color: var(--text-main);
  border-color: rgba(168, 85, 247, 0.45);
  font-weight: 600;
}

.pill-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-count {
  font-size: 10px;
  font-family: monospace;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  margin-left: 8px;
  flex-shrink: 0;
}

.filter-pill.is-active .pill-count {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  font-weight: 600;
}

/* Sidebar Options & Controls */
.sidebar-options-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-color: var(--border-hover);
}

.sidebar-btn.danger:hover {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
}

.option-state {
  font-family: monospace;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  font-weight: 700;
}

.option-state.is-off {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.btn-icon {
  font-size: 13px;
  opacity: 0.7;
}

/* Main Catalog Stage */
.catalog-main {
  flex: 1;
  min-width: 0;
}

.hero-banner {
  text-align: left;
  max-width: 100%;
  margin: 0 0 20px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}

.hero-headline {
  font-size: clamp(1.7rem, 2.9vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.hero-gradient {
  background: linear-gradient(135deg, #ffffff 10%, #c084fc 55%, #38bdf8 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 0;
  max-width: 960px;
}

.hero-subtitle code {
  color: #e4e4e7;
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 12px;
}

.results-summary {
  font-size: 12.5px;
  color: var(--text-muted);
}

.toolbar-active-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #d8b4fe;
}

.active-chip-clear {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.active-chip-clear:hover {
  color: #ffffff;
}

.clear-all-chip {
  font-size: 11px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 4px;
}

.clear-all-chip:hover {
  color: var(--text-main);
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.subtle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
}

.subtle-btn:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
}

/* Catalog Grid & Cards */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(390px, 1fr));
  gap: 20px;
}

@media (max-width: 520px) {
  .catalog-grid { grid-template-columns: 1fr; }
}

.vault-card {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.vault-card:hover {
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.vault-card.is-template {
  border-color: rgba(56, 189, 248, 0.3);
}

.card-preview-box {
  position: relative;
  width: 100%;
  height: 255px;
  background: var(--ui-bg-deep);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}

.card-preview-box iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.preview-Overlay-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 4;
}

.badge-group {
  display: flex;
  gap: 6px;
}

.source-badge, .cat-badge, .tsx-badge {
  pointer-events: auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-family: monospace;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.source-badge {
  background: rgb(var(--ui-bg0-rgb) / 0.78);
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.cat-badge {
  background: rgba(168, 85, 247, 0.22);
  color: #e9d5ff;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.tsx-badge {
  background: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.preview-quick-btns {
  pointer-events: auto;
  display: flex;
  gap: 5px;
}

.mini-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgb(var(--ui-bg0-rgb) / 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fafafa;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.mini-icon-btn:hover {
  background: #fafafa;
  color: var(--bg-0);
}

.card-info {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  gap: 14px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.card-title {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.card-slug {
  font-size: 11px;
  color: var(--text-dim);
}

.card-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

.card-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.action-btn {
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s ease;
}

.action-btn:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.1);
}

.action-btn.primary {
  background: #fafafa;
  color: var(--bg-0);
  border-color: #fafafa;
  font-weight: 600;
}

.action-btn.primary:hover {
  background: #e4e4e7;
}

.action-btn.accent {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}

/* IDE Split-Screen Workbench View */
.workbench-view {
  position: relative;
  z-index: 1;
  height: calc(100vh - 62px);
  display: grid;
  grid-template-columns: 270px 1fr 480px;
  overflow: hidden;
}

.is-hidden {
  display: none !important;
}

.wb-sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wb-pane-header {
  padding: 12px 16px;
  font-size: 10.5px;
  font-family: monospace;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
}

.wb-search-box {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

#wbSearchInput {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  outline: none;
  transition: border-color 0.2s ease;
}

#wbSearchInput:focus {
  border-color: #a855f7;
}

.wb-tree {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}

.tree-group-label {
  font-size: 10px;
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  padding: 10px 8px 4px;
}

.tree-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.tree-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.tree-item.is-active {
  background: rgba(168, 85, 247, 0.18);
  color: #fafafa;
  border-left: 2px solid #a855f7;
}

.wb-stage {
  display: flex;
  flex-direction: column;
  background: var(--ui-bg-deep);
  overflow: hidden;
}

.wb-stage-toolbar {
  padding: 10px 16px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.wb-active-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.wb-source-pill {
  font-size: 10px;
  font-family: monospace;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
}

.wb-slug-code {
  font-size: 11px;
  color: var(--text-dim);
}

.wb-stage-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewport-group {
  display: inline-flex;
  background: var(--bg-0);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.vp-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.vp-btn.is-active {
  background: var(--bg-2);
  color: var(--text-main);
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.wb-preview-canvas {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
}

.wb-iframe-wrap {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-0);
  transition: width 0.25s ease;
}

.wb-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.wb-stage-footer {
  padding: 10px 16px;
  background: var(--bg-1);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.wb-code-pane {
  background: var(--bg-1);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wb-code-header {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.code-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.code-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-family: monospace;
  cursor: pointer;
}

.code-tab.is-active {
  background: var(--bg-2);
  color: #fafafa;
  border-color: var(--border-subtle);
}

.wb-code-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: var(--bg-0);
  font-size: 12px;
  line-height: 1.55;
  color: #e4e4e7;
}

.wb-code-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
}

/* Inspector & Studio Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.inspector-drawer {
  width: min(1420px, 96vw);
  height: min(880px, 92vh);
  background: var(--bg-1);
  border: 1px solid var(--border-hover);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75);
}

.insp-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.insp-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.insp-title-group h2 {
  font-size: 16px;
  font-weight: 600;
}

.insp-folder-code {
  font-size: 11.5px;
  color: #a855f7;
  background: rgba(168, 85, 247, 0.12);
  padding: 3px 8px;
  border-radius: 5px;
}

.insp-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-modal-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-2);
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
}

.insp-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  overflow: hidden;
}

.insp-preview-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
  background: var(--ui-bg-deep);
  overflow: hidden;
}

.insp-preview-bar, .insp-code-bar {
  padding: 10px 16px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.insp-preview-links, .code-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.insp-stage-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
}

.insp-iframe-holder {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  transition: width 0.25s ease;
}

.insp-iframe-holder iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.insp-meta-strip {
  padding: 12px 16px;
  background: var(--bg-1);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.insp-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.tag-chip {
  font-size: 10px;
  font-family: monospace;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.insp-code-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.insp-code-scroll {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: var(--bg-0);
  font-size: 12px;
  line-height: 1.55;
  color: #e4e4e7;
}

/* Studio Add Feature Modal */
.studio-modal {
  width: min(980px, 95vw);
  max-height: 92vh;
  background: var(--bg-1);
  border: 1px solid var(--border-hover);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.studio-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.studio-kicker {
  font-size: 10px;
  font-family: monospace;
  letter-spacing: 0.16em;
  color: #a855f7;
  display: block;
}

.studio-form {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-grid-3, .form-code-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.form-field input, .form-field select, .form-field textarea {
  background: var(--bg-0);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-family: inherit;
}

.form-field textarea {
  font-family: monospace;
  line-height: 1.45;
}

.studio-agent-tip {
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  font-size: 12px;
  color: #e9d5ff;
}

.studio-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.studio-submit-group {
  display: flex;
  gap: 8px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #fafafa;
  color: var(--bg-0);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

/* Responsive Media Queries */
@media (max-width: 1080px) {
  .catalog-container {
    gap: 24px;
  }
  .catalog-sidebar {
    width: 250px;
  }
}

@media (max-width: 900px) {
  .catalog-container {
    flex-direction: column;
    gap: 18px;
  }

  .catalog-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    padding-right: 0;
    display: none;
  }

  .catalog-sidebar.is-open {
    display: block;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .mobile-sidebar-toggle {
    display: inline-flex;
  }

  .workbench-view {
    grid-template-columns: 240px 1fr;
  }
  .wb-code-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  .vault-header {
    padding: 0 16px;
  }
  .brand-text {
    display: none;
  }
  .catalog-view {
    padding: 18px 16px 60px;
  }
}

/* Header: keep labels on one line and let the search box give way when the window is narrow */
.vault-header .brand-tag,
.vault-header button,
.vault-header .mode-btn { white-space: nowrap; }
.vault-header .search-box { flex: 1 1 160px; min-width: 140px; max-width: 360px; }
@media (max-width: 1280px) {
  .vault-header .col-tab { padding: 4px 8px; font-size: 11px; }
  .vault-header { gap: 8px 10px; height: auto; min-height: 62px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .vault-header .header-left { flex-wrap: wrap; row-gap: 8px; }
}
