/* ============================================================
   Design plugin — local browser UI
   Universal styling, no project tokens. Neutral zinc grayscale.
   ============================================================ */

:root {
  /* Surfaces — zinc */
  --u-bg-0:        #09090b;
  --u-bg-1:        #18181b;
  --u-bg-2:        #27272a;
  --u-bg-3:        #3f3f46;
  --u-bg-4:        #52525b;
  --u-bg-hover:    rgba(255,255,255,0.05);
  --u-bg-active:   rgba(255,255,255,0.08);
  --u-bg-selected: rgba(255,255,255,0.10);

  /* Text */
  --u-fg-0:  #fafafa;
  --u-fg-1:  #d4d4d8;
  --u-fg-2:  #a1a1aa;
  --u-fg-3:  #71717a;

  /* Borders */
  --u-border:        rgba(255,255,255,0.08);
  --u-border-strong: rgba(255,255,255,0.16);

  /* Accent — neutral gray-blue, intentionally not "branded" */
  --u-accent:        #38bdf8;   /* sky-400 — works on dark, not too strong */
  --u-accent-bg:     rgba(56,189,248,0.14);
  --u-accent-line:   rgba(56,189,248,0.50);
  --u-accent-strong: #0ea5e9;

  /* Status */
  --u-status-success: #22c55e;
  --u-status-warn:    #f59e0b;
  --u-status-error:   #ef4444;
  --u-status-live:    #ef4444;

  /* Radii */
  --u-r-xs: 2px;
  --u-r-sm: 4px;
  --u-r-md: 6px;
  --u-r-lg: 8px;
  --u-r-pill: 999px;

  /* Spacing */
  --u-s-1: 4px;
  --u-s-2: 8px;
  --u-s-3: 12px;
  --u-s-4: 16px;
  --u-s-5: 24px;

  /* Type */
  --u-font-sans:    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --u-font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', 'Menlo', monospace;
  --u-font-display: 'Inter', ui-sans-serif, system-ui, sans-serif;

  /* Layout */
  --u-sidebar-w:  320px;
  --u-rsidebar-w: 320px;
  --u-header-h:   44px;
  --u-status-h:   28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--u-bg-0);
  color: var(--u-fg-0);
  font-family: var(--u-font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font: inherit; }
::selection { background: var(--u-accent-bg); color: var(--u-fg-0); }

/* ----- App shell ----- */
.app {
  display: grid;
  grid-template-columns: var(--u-sidebar-w) 1fr;
  height: 100vh;
}
.app.with-rsidebar {
  grid-template-columns: var(--u-sidebar-w) 1fr var(--u-rsidebar-w);
}

/* ----- Sidebar ----- */
.sidebar {
  background: var(--u-bg-1);
  border-right: 1px solid var(--u-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.brand {
  padding: var(--u-s-3) var(--u-s-4);
  display: flex;
  align-items: center;
  gap: var(--u-s-2);
  border-bottom: 1px solid var(--u-border);
}
.brand-mark {
  width: 24px; height: 24px;
  border-radius: var(--u-r-sm);
  background: var(--u-accent);
  color: var(--u-bg-0);
  font-weight: 700;
  display: grid;
  place-items: center;
  font-family: var(--u-font-display);
  font-size: 12px;
}
.brand-title {
  font-family: var(--u-font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--u-fg-0);
  flex: 1;
}
.brand-status {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--u-fg-3);
  transition: background 200ms ease-out;
}
.brand-status.connected { background: var(--u-status-success); box-shadow: 0 0 6px var(--u-status-success); }

/* Search */
.search {
  margin: var(--u-s-3) var(--u-s-3) var(--u-s-2);
  height: 30px;
  display: flex;
  align-items: center;
  gap: var(--u-s-2);
  padding: 0 var(--u-s-3);
  background: var(--u-bg-2);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-md);
  transition: border-color 120ms ease-out;
}
.search:focus-within { border-color: var(--u-accent-line); }
.search svg { flex: none; color: var(--u-fg-3); }
.search input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--u-fg-0);
  font-size: 12px;
  outline: none;
  font-family: inherit;
  min-width: 0;
}
.search-clear {
  background: transparent;
  border: 0;
  color: var(--u-fg-3);
  cursor: pointer;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
}
.search-clear:hover { color: var(--u-fg-0); }
.search-kbd {
  font-family: var(--u-font-mono);
  font-size: 10px;
  padding: 1px 5px;
  color: var(--u-fg-3);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-sm);
}

/* Tree */
.tree {
  flex: 1;
  padding: 0 var(--u-s-2) var(--u-s-3);
}
.tree-section {
  margin-bottom: var(--u-s-3);
}
.tree-h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--u-fg-2);
  margin: 0 var(--u-s-2) var(--u-s-2);
}
.tree-h2 .count {
  color: var(--u-fg-3);
  font-weight: 500;
  font-family: var(--u-font-mono);
}
.tree-empty {
  padding: 0 var(--u-s-2) 0;
  color: var(--u-fg-3);
  font-size: 11px;
  line-height: 1.5;
}
.tree-empty code {
  font-family: var(--u-font-mono);
  font-size: 10px;
  background: var(--u-bg-2);
  padding: 1px 4px;
  border-radius: var(--u-r-xs);
}

.tree details { margin-left: 4px; }
.tree details > summary {
  cursor: pointer;
  padding: 3px var(--u-s-2);
  border-radius: var(--u-r-sm);
  font-weight: 500;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--u-s-1);
  color: var(--u-fg-1);
}
.tree details > summary::-webkit-details-marker { display: none; }
.tree details > summary::before {
  content: "▸";
  color: var(--u-fg-3);
  font-size: 10px;
  width: 12px;
  display: inline-block;
  transition: transform 100ms;
}
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree details > summary:hover { background: var(--u-bg-hover); }

.tree-files { list-style: none; padding: 0 0 0 20px; margin: 0; }
.tree-file {
  display: block;
  padding: 4px var(--u-s-2);
  color: var(--u-fg-1);
  text-decoration: none;
  border-radius: var(--u-r-sm);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.tree-file:hover { background: var(--u-bg-hover); color: var(--u-fg-0); }
.tree-file.active {
  background: var(--u-accent-bg);
  color: var(--u-accent);
}
.tree-file .tf-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tree-file.active .tf-name::before {
  content: "● ";
  color: var(--u-accent);
}
.tree-file { display: flex; align-items: center; gap: var(--u-s-1); }
.tf-badge {
  font-family: var(--u-font-mono);
  font-size: 9px;
  background: #facc15;
  color: #1c1917;
  border-radius: var(--u-r-pill);
  padding: 1px 6px;
  font-weight: 600;
  flex: none;
}

/* System link button (above search) */
.system-link {
  display: flex;
  align-items: center;
  gap: var(--u-s-2);
  margin: var(--u-s-3) var(--u-s-3) 0;
  padding: 8px var(--u-s-3);
  background: var(--u-bg-2);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-md);
  color: var(--u-fg-1);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  transition: all 120ms ease-out;
}
.system-link:hover {
  background: var(--u-bg-3);
  color: var(--u-fg-0);
  border-color: var(--u-border-strong);
}
.system-link.active {
  background: var(--u-accent-bg);
  color: var(--u-accent);
  border-color: var(--u-accent-line);
}
.system-link .sl-glyph {
  font-size: 14px;
  line-height: 1;
}
.system-link .sl-label { flex: 1; }
.system-link .sl-arrow {
  color: var(--u-fg-3);
  font-size: 11px;
  font-family: var(--u-font-mono);
}
.system-link.active .sl-arrow { color: var(--u-accent); }

/* Cheatsheet */
.cheatsheet {
  margin-top: auto;
  padding: var(--u-s-3) var(--u-s-2) var(--u-s-3);
  border-top: 1px solid var(--u-border);
  background: var(--u-bg-1);
}
.cheatsheet > details {
  margin-bottom: 4px;
}
.cheatsheet > details > summary {
  padding: 4px var(--u-s-2);
  font-size: 11px;
  font-weight: 500;
  color: var(--u-fg-1);
  border-radius: var(--u-r-sm);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--u-s-1);
}
.cheatsheet > details > summary::-webkit-details-marker { display: none; }
.cheatsheet > details > summary::before {
  content: "▸";
  color: var(--u-fg-3);
  font-size: 10px;
  width: 12px;
  display: inline-block;
  transition: transform 100ms;
}
.cheatsheet > details[open] > summary::before { transform: rotate(90deg); }
.cheatsheet > details > summary:hover { background: var(--u-bg-hover); }

.cheatsheet ul, .cheatsheet ol {
  padding: 4px var(--u-s-2) var(--u-s-2) var(--u-s-4);
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
}
.cheatsheet li {
  display: flex;
  align-items: baseline;
  gap: var(--u-s-2);
  padding: 2px 0;
}
.cheatsheet li > span {
  color: var(--u-fg-3);
  font-size: 10px;
  margin-left: auto;
  text-align: right;
}
.cheatsheet kbd {
  font-family: var(--u-font-mono);
  font-size: 10px;
  background: var(--u-bg-2);
  border: 1px solid var(--u-border);
  padding: 1px 5px;
  border-radius: var(--u-r-xs);
  color: var(--u-fg-0);
}
.cheatsheet code {
  font-family: var(--u-font-mono);
  font-size: 10px;
  color: var(--u-accent);
  background: var(--u-accent-bg);
  padding: 1px 4px;
  border-radius: var(--u-r-xs);
}
.cheatsheet code i { font-style: normal; color: var(--u-fg-2); }

.cheatsheet ul.cmds li, .cheatsheet ul.files li {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.cheatsheet ul.cmds li > span, .cheatsheet ul.files li > span {
  margin-left: 0;
  text-align: left;
}

/* ----- Main ----- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header {
  display: flex;
  align-items: center;
  gap: var(--u-s-2);
  padding: var(--u-s-2) var(--u-s-3);
  background: var(--u-bg-1);
  border-bottom: 1px solid var(--u-border);
  min-height: var(--u-header-h);
}

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
.tabs::-webkit-scrollbar { height: 0; }

.tab {
  display: flex;
  align-items: center;
  gap: var(--u-s-2);
  padding: 6px var(--u-s-3);
  background: var(--u-bg-2);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-md);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 240px;
  color: var(--u-fg-1);
  font-family: inherit;
}
.tab:hover { background: var(--u-bg-3); }
.tab.active {
  background: var(--u-bg-3);
  border-color: var(--u-border-strong);
  color: var(--u-fg-0);
}
.tab .name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.tab .close {
  color: var(--u-fg-3);
  cursor: pointer;
  padding: 0 4px;
  border-radius: var(--u-r-xs);
  line-height: 1;
  font-size: 14px;
  background: transparent;
  border: 0;
  font-family: inherit;
}
.tab .close:hover {
  background: rgba(255,255,255,0.10);
  color: var(--u-fg-0);
}

.actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.actions button, .actions a {
  background: var(--u-bg-2);
  color: var(--u-fg-1);
  border: 1px solid var(--u-border);
  padding: 5px var(--u-s-3);
  font-size: 11px;
  border-radius: var(--u-r-md);
  cursor: pointer;
  font-family: var(--u-font-mono);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.actions button:hover, .actions a:hover {
  background: var(--u-bg-3);
  color: var(--u-fg-0);
}
.actions a.icon-only {
  background: transparent;
  border: 0;
  padding: 5px var(--u-s-2);
  color: var(--u-fg-2);
}
.actions a.icon-only:hover { color: var(--u-accent); }

/* Viewport */
.viewport {
  flex: 1;
  position: relative;
  background: var(--u-bg-0);
}
/* Direct-child only — avoids matching preview iframes nested inside .system-view */
.viewport > iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
  background: var(--u-bg-0);
}
.viewport > iframe.active { display: block; }

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--u-fg-3);
  flex-direction: column;
  gap: var(--u-s-4);
  padding: 48px;
  text-align: center;
}
.empty-state .big {
  font-family: var(--u-font-display);
  font-size: 18px;
  color: var(--u-fg-1);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.empty-state .small {
  font-size: 12px;
  max-width: 480px;
  line-height: 1.6;
}
.empty-state .small kbd {
  font-family: var(--u-font-mono);
  background: var(--u-bg-2);
  border: 1px solid var(--u-border);
  padding: 1px 6px;
  border-radius: var(--u-r-xs);
  font-size: 11px;
  color: var(--u-fg-1);
}
.empty-state .small code {
  font-family: var(--u-font-mono);
  font-size: 11px;
  background: var(--u-bg-2);
  padding: 1px 4px;
  border-radius: var(--u-r-xs);
  color: var(--u-accent);
}

/* Status bar */
.statusbar {
  font-family: var(--u-font-mono);
  font-size: 10px;
  color: var(--u-fg-3);
  padding: var(--u-s-1) var(--u-s-3);
  background: var(--u-bg-1);
  border-top: 1px solid var(--u-border);
  display: flex;
  align-items: center;
  gap: var(--u-s-3);
  height: var(--u-status-h);
}
.statusbar .file {
  color: var(--u-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}
.statusbar .selected-info {
  display: flex;
  align-items: center;
  gap: var(--u-s-1);
  flex: 1;
  min-width: 0;
}
.statusbar .sel-text {
  color: var(--u-fg-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 600px;
}
.statusbar .clear-sel {
  background: transparent;
  color: var(--u-fg-3);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-xs);
  padding: 1px 6px;
  font-family: inherit;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}
.statusbar .clear-sel:hover { color: var(--u-fg-0); background: var(--u-bg-2); }
.statusbar .ws { margin-left: auto; }
.statusbar .ws.connected { color: var(--u-status-success); }

.filter-no-match {
  display: none !important;
}

/* ----- System tab ----- */
.tab-system {
  background: var(--u-accent-bg);
  border-color: var(--u-accent-line);
  color: var(--u-accent);
}
.tab-system:hover { background: var(--u-accent-bg); }
.tab-system.active { color: var(--u-accent); border-color: var(--u-accent); }

/* ----- System view ----- */
.system-view {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  background: var(--u-bg-0);
}
.system-view.active { display: block; }
.system-view::-webkit-scrollbar { width: 8px; }
.system-view::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sv {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--u-s-5) var(--u-s-5) 80px;
}
.sv-empty {
  display: grid;
  place-items: center;
  height: 50vh;
  color: var(--u-fg-3);
}

.sv-header {
  padding-bottom: var(--u-s-4);
  border-bottom: 1px solid var(--u-border);
  margin-bottom: var(--u-s-5);
}
.sv-header h1 {
  font-family: var(--u-font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--u-fg-0);
  margin: 0 0 var(--u-s-2);
}
.sv-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--u-s-2);
  align-items: center;
  font-size: 12px;
  color: var(--u-fg-3);
  margin: 0;
}
.sv-meta code {
  font-family: var(--u-font-mono);
  font-size: 11px;
  background: var(--u-bg-2);
  padding: 1px 6px;
  border-radius: var(--u-r-xs);
  color: var(--u-fg-1);
}

.sv-section {
  margin-bottom: var(--u-s-5);
}
.sv-section h2 {
  font-family: var(--u-font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--u-fg-0);
  letter-spacing: -0.01em;
  margin: 0 0 var(--u-s-3);
  display: flex;
  align-items: baseline;
  gap: var(--u-s-2);
}
.sv-section h3 {
  font-family: var(--u-font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--u-fg-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: var(--u-s-3) 0 var(--u-s-2);
  display: flex;
  align-items: baseline;
  gap: var(--u-s-2);
}
.sv-count {
  font-family: var(--u-font-mono);
  font-size: 11px;
  color: var(--u-fg-3);
  font-weight: 500;
}

.sv-readme {
  font-family: var(--u-font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--u-fg-1);
  background: var(--u-bg-1);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-md);
  padding: var(--u-s-4);
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
}

/* Tokens */
.sv-tokens-group { margin-bottom: var(--u-s-3); }
.sv-tokens {
  display: grid;
  gap: var(--u-s-2);
}
.sv-tokens-color { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.sv-tokens-font, .sv-tokens-fontsize { grid-template-columns: 1fr; }
.sv-tokens-radius, .sv-tokens-shadow { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.sv-tokens-space { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sv-tokens-other, .sv-tokens-weight, .sv-tokens-leading, .sv-tokens-motion {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.tok {
  background: var(--u-bg-1);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-md);
  padding: var(--u-s-2);
  display: flex;
  flex-direction: column;
  gap: var(--u-s-2);
  min-width: 0;
}
.tok-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  min-width: 0;
}
.tok-meta code {
  font-family: var(--u-font-mono);
  color: var(--u-fg-0);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tok-meta span {
  font-family: var(--u-font-mono);
  color: var(--u-fg-3);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tok-color { flex-direction: row; align-items: center; }
.tok-swatch {
  width: 48px;
  height: 48px;
  border-radius: var(--u-r-sm);
  border: 1px solid var(--u-border-strong);
  flex: none;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.05) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.05) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.05) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.tok-color .tok-swatch { background: inherit; }

.tok-text .tok-sample {
  color: var(--u-fg-0);
  font-size: 18px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tok-radius { flex-direction: row; align-items: center; }
.tok-radius .tok-shape {
  width: 48px; height: 48px;
  background: var(--u-bg-3);
  border: 1px solid var(--u-border-strong);
  flex: none;
}
.tok-shadow { flex-direction: row; align-items: center; padding: var(--u-s-3); }
.tok-shadow .tok-shape {
  width: 48px; height: 48px;
  background: var(--u-bg-2);
  border-radius: var(--u-r-md);
  flex: none;
}
.tok-space { flex-direction: column; }
.tok-space .tok-bar {
  height: 8px;
  background: var(--u-accent);
  border-radius: var(--u-r-pill);
  max-width: 100%;
}

/* Galleries (preview / ui_kits) */
.sv-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--u-s-3);
}
.sv-previews-ui_kits {
  grid-template-columns: repeat(auto-fill, minmax(560px, 1fr));
}
.sv-previews-ui_kits .sv-preview-frame {
  aspect-ratio: 16 / 10;
}
.sv-preview-card {
  background: var(--u-bg-1);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 120ms;
}
.sv-preview-card:hover {
  border-color: var(--u-accent-line);
  transform: translateY(-1px);
}
.sv-preview-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--u-bg-0);
  border-bottom: 1px solid var(--u-border);
  overflow: hidden;
}
.sv-preview-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  border: 0;
  transform: scale(0.5);
  transform-origin: top left;
  /* `pointer-events: none` blocks click-through; .sv-preview-card has its own
     onClick that handles opening the file. Keep iframe interactive-blocked so
     hovers/clicks don't get swallowed by the inner specimen. */
  pointer-events: none;
  background: var(--u-bg-0);
}
.sv-preview-foot {
  padding: var(--u-s-2) var(--u-s-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sv-preview-foot strong {
  font-size: 12px;
  color: var(--u-fg-0);
  font-weight: 600;
}
.sv-preview-foot code {
  font-family: var(--u-font-mono);
  font-size: 10px;
  color: var(--u-fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Components / list */
.sv-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--u-s-1);
}
.sv-list li {
  background: var(--u-bg-1);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-sm);
  padding: var(--u-s-2) var(--u-s-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sv-list code {
  font-family: var(--u-font-mono);
  font-size: 12px;
  color: var(--u-fg-0);
  font-weight: 500;
}
.sv-list-path {
  font-family: var(--u-font-mono);
  font-size: 10px;
  color: var(--u-fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Assets */
.sv-assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--u-s-2);
}
.sv-asset {
  background: var(--u-bg-1);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-sm);
  padding: var(--u-s-3);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--u-s-2);
}
.sv-asset img {
  max-width: 100%;
  max-height: 80px;
  height: auto;
  width: auto;
  object-fit: contain;
}
.sv-asset figcaption {
  font-family: var(--u-font-mono);
  font-size: 10px;
  color: var(--u-fg-3);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ----- Comment bar ----- */
.comment-bar {
  background: var(--u-bg-1);
  border-top: 1px solid var(--u-border);
  padding: 6px var(--u-s-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.cb-row {
  display: flex;
  align-items: center;
  gap: var(--u-s-2);
  flex-wrap: wrap;
}
/* Phase 6 — the shell-side composer / focused-row / pin-strip surfaces are
 * gone; pins + composer + thread popover live inside the canvas iframe
 * (apps/studio/comments-overlay.{tsx,css}). The remaining
 * `.comment-bar` and `.cb-row.strip` rules below render the residual
 * open-count summary the shell still surfaces in the BottomBar. */

.cb-label {
  color: var(--u-fg-3);
  font-size: 11px;
  flex: none;
  align-self: center;
}

.cb-row.strip {
  font-size: 11px;
  color: var(--u-fg-3);
}

/* ----- Right sidebar — Comments panel ----- */
.rsidebar {
  background: var(--u-bg-1);
  border-left: 1px solid var(--u-border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rsidebar-header {
  padding: var(--u-s-3) var(--u-s-4);
  border-bottom: 1px solid var(--u-border);
}
.rsidebar-header h2 {
  font-family: var(--u-font-display);
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 var(--u-s-2);
  color: var(--u-fg-0);
  display: flex;
  align-items: center;
  gap: var(--u-s-2);
}
.rsidebar-header h2 .total {
  font-family: var(--u-font-mono);
  font-size: 11px;
  color: var(--u-fg-3);
  font-weight: 500;
  margin-left: auto;
}
.rsidebar-filters {
  display: flex;
  gap: 4px;
  background: var(--u-bg-2);
  border-radius: var(--u-r-md);
  padding: 3px;
  border: 1px solid var(--u-border);
}
.rsidebar-filter {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--u-fg-2);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 6px;
  border-radius: var(--u-r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 100ms;
}
.rsidebar-filter:hover { color: var(--u-fg-0); }
.rsidebar-filter.active {
  background: var(--u-bg-3);
  color: var(--u-fg-0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.rsidebar-filter .fc {
  font-family: var(--u-font-mono);
  font-size: 10px;
  color: var(--u-fg-3);
}
.rsidebar-filter.active .fc { color: var(--u-fg-1); }

.rsidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--u-s-2);
}
.rsidebar-body::-webkit-scrollbar { width: 6px; }
.rsidebar-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.rsidebar-empty {
  padding: var(--u-s-5) var(--u-s-3);
  text-align: center;
  color: var(--u-fg-3);
  font-size: 12px;
  line-height: 1.5;
}
.rsidebar-empty kbd {
  font-family: var(--u-font-mono);
  background: var(--u-bg-2);
  border: 1px solid var(--u-border);
  padding: 1px 5px;
  border-radius: var(--u-r-xs);
  font-size: 11px;
  color: var(--u-fg-1);
}

.rs-group {
  margin-bottom: var(--u-s-2);
}
.rs-group-h {
  display: flex;
  align-items: center;
  gap: var(--u-s-1);
  padding: var(--u-s-2) var(--u-s-2) 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--u-fg-2);
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.rs-group-h:hover { color: var(--u-fg-0); }
.rs-group-h .rs-group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.rs-group-h .rs-group-count {
  font-family: var(--u-font-mono);
  font-size: 10px;
  color: var(--u-fg-3);
  font-weight: 500;
}

.rs-comment {
  background: var(--u-bg-2);
  border: 1px solid var(--u-border);
  border-radius: var(--u-r-md);
  padding: var(--u-s-2) var(--u-s-3);
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 100ms;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rs-comment:hover {
  border-color: var(--u-border-strong);
  background: var(--u-bg-3);
}
.rs-comment.active-pin {
  border-color: var(--u-accent-line);
  background: var(--u-accent-bg);
}
.rs-comment.resolved {
  opacity: 0.65;
}
.rs-comment-head {
  display: flex;
  align-items: center;
  gap: var(--u-s-2);
}
.rs-num {
  font-family: var(--u-font-mono);
  font-size: 10px;
  background: #facc15;
  color: #1c1917;
  border-radius: var(--u-r-pill);
  padding: 1px 6px;
  font-weight: 700;
  flex: none;
}
.rs-comment.resolved .rs-num {
  background: var(--u-status-success);
  color: #052e16;
}
.rs-time {
  font-family: var(--u-font-mono);
  font-size: 10px;
  color: var(--u-fg-3);
  margin-left: auto;
  flex: none;
}
.rs-comment-text {
  font-size: 12px;
  color: var(--u-fg-0);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.rs-comment.resolved .rs-comment-text {
  color: var(--u-fg-2);
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.25);
}
.rs-comment-foot {
  display: flex;
  align-items: center;
  gap: var(--u-s-1);
  font-size: 10px;
}
.rs-comment-foot code {
  font-family: var(--u-font-mono);
  font-size: 10px;
  background: var(--u-bg-3);
  color: var(--u-fg-2);
  padding: 1px 5px;
  border-radius: var(--u-r-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.rs-comment-actions {
  display: flex;
  gap: 4px;
  flex: none;
}
.rs-act {
  background: transparent;
  border: 1px solid var(--u-border);
  color: var(--u-fg-2);
  border-radius: var(--u-r-xs);
  padding: 1px 6px;
  font-family: var(--u-font-mono);
  font-size: 10px;
  cursor: pointer;
  line-height: 1.4;
}
.rs-act:hover {
  background: var(--u-bg-3);
  color: var(--u-fg-0);
}
.rs-act.danger:hover {
  background: var(--u-status-error);
  color: #fff;
  border-color: var(--u-status-error);
}

/* Header — comments toggle button */
.actions .rs-toggle {
  position: relative;
}
.actions .rs-toggle.active {
  background: var(--u-accent-bg);
  color: var(--u-accent);
  border-color: var(--u-accent-line);
}
.actions .rs-toggle .rs-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #facc15;
  color: #1c1917;
  border-radius: var(--u-r-pill);
  padding: 0 5px;
  font-family: var(--u-font-mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.4;
}

/* Status bar — add comment button */
.add-comment {
  background: transparent;
  color: var(--u-accent);
  border: 1px solid var(--u-accent-line);
  border-radius: var(--u-r-xs);
  padding: 1px 8px;
  font-family: var(--u-font-mono);
  font-size: 10px;
  line-height: 1.4;
  cursor: pointer;
}
.add-comment:hover {
  background: var(--u-accent-bg);
  color: var(--u-accent);
}
