/* ═══════════════════════════════════════════════════════════════════
   Chempirical Standalone Design System
   ═══════════════════════════════════════════════════════════════════
   Shared design tokens and component classes for standalone
   browser-based tools (Covalent, Signum, and future tools).

   Dark theme with lime green accent. Inspired by the Tentacle
   component library (variant+size pattern, LCH text scale,
   z-index layers, consistent transitions).
   ═══════════════════════════════════════════════════════════════════ */


/* ── Design Tokens ──────────────────────────────────────────────── */

:root {
  /* Surfaces — 4 levels of depth */
  --st-surface-0: #09090b;   /* base / canvas background */
  --st-surface-1: #111113;   /* elevated (header, sidebar, docks) */
  --st-surface-2: #18181b;   /* interactive surfaces (inputs, cards) */
  --st-surface-3: #232326;   /* hover state */

  /* Borders — 3 levels */
  --st-border-subtle: #1f1f22;
  --st-border: #27272a;
  --st-border-hi: #3f3f46;

  /* Text — 4 levels (Tentacle-inspired perceptual hierarchy) */
  --st-text:       #fafafa;  /* primary — headings, values */
  --st-text-muted: #a1a1aa;  /* secondary — labels, descriptions */
  --st-text-subtle:#71717a;  /* tertiary — hints, placeholders */
  --st-text-faint: #52525b;  /* quaternary — disabled, decorative */

  /* Accent — lime green (10-shade scale) */
  --st-accent-50:  #f7fee7;
  --st-accent-100: #ecfccb;
  --st-accent-200: #d9f99d;
  --st-accent-300: #bef264;
  --st-accent-400: #a3e635;  /* ← primary accent */
  --st-accent-500: #84cc16;
  --st-accent-600: #65a30d;
  --st-accent-700: #4d7c0f;
  --st-accent-800: #3f6212;
  --st-accent-900: #365314;
  --st-accent-glow: rgba(163, 230, 53, 0.12);
  --st-accent-soft: rgba(163, 230, 53, 0.06);

  /* Semantic colors */
  --st-danger:  #f87171;
  --st-warning: #fbbf24;
  --st-info:    #60a5fa;
  --st-success: #a3e635;

  /* Typography */
  --st-font-sans: 'Inter', -apple-system, system-ui, sans-serif;
  --st-font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Radii */
  --st-radius-sm: 4px;
  --st-radius-md: 6px;
  --st-radius-lg: 10px;

  /* Transitions */
  --st-transition-fast: 100ms;
  --st-transition-base: 150ms;
  --st-transition-slow: 250ms;

  /* Z-index layers */
  --st-z-base:     1;
  --st-z-header:   10;
  --st-z-toolbar:  100;
  --st-z-backdrop: 199;
  --st-z-overlay:  200;
  --st-z-mobile:   210;
  --st-z-toast:    500;
  --st-z-modal:    600;


  /* ── Backward-compat aliases ──
     Both Covalent and Signum inline CSS reference these names.
     They map to the canonical --st-* tokens above so tools can
     link this file and gradually migrate. ───────────────────────── */

  /* — Covalent variable names — */
  --bg-base:        var(--st-surface-0);
  --bg-elevated:    var(--st-surface-1);
  --bg-surface:     var(--st-surface-2);
  --bg-hover:       var(--st-surface-3);
  --border:         var(--st-border);
  --border-subtle:  var(--st-border-subtle);
  --text-primary:   var(--st-text);
  --text-secondary: var(--st-text-muted);
  --text-tertiary:  var(--st-text-subtle);
  --accent:         var(--st-accent-400);
  --accent-dim:     var(--st-accent-600);
  --accent-glow:    var(--st-accent-glow);
  --danger:         var(--st-danger);
  --warning:        var(--st-warning);
  --info:           var(--st-info);
  --font-sans:      var(--st-font-sans);
  --font-mono:      var(--st-font-mono);
  --radius-sm:      var(--st-radius-sm);
  --radius-md:      var(--st-radius-md);
  --radius-lg:      var(--st-radius-lg);

  /* — Signum variable names — */
  --sans:           var(--st-font-sans);
  --mono:           var(--st-font-mono);
  --c-base:         var(--st-surface-0);
  --c-1:            var(--st-surface-1);
  --c-2:            var(--st-surface-2);
  --c-3:            var(--st-border);         /* Signum uses --c-3 = #27272a (same as border) */
  --c-border:       var(--st-border);
  --c-border-hi:    var(--st-border-hi);
  --c-text:         var(--st-text);
  --c-text-1:       #e4e4e7;                  /* between --st-text and --st-text-muted */
  --c-text-2:       var(--st-text-muted);
  --c-text-3:       var(--st-text-subtle);
  --c-accent:       var(--st-accent-400);
  --c-accent-soft:  rgba(163, 230, 53, 0.1);  /* Signum uses 0.1, tokens use 0.12 */
}


/* ── Reset ───────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--st-font-sans);
  font-size: 13px;
  line-height: 1.5;
  background: var(--st-surface-0);
  color: var(--st-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--st-accent-600);
  color: white;
}

button:not(:disabled),
[role="button"]:not(:disabled) {
  cursor: pointer;
}


/* ── Icon ────────────────────────────────────────────────────────── */

.st-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.st-icon.sm { width: 14px; height: 14px; }
.st-icon.lg { width: 22px; height: 22px; }


/* ═══════════════════════════════════════════════════════════════════
   BUTTONS — variant + size pattern
   ═══════════════════════════════════════════════════════════════════ */

.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: all var(--st-transition-fast);
  border: 1px solid transparent;
}

.st-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--st-accent-400);
}

.st-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Button Sizes ── */
.st-btn          { padding: 5px 10px; font-size: 12px; border-radius: var(--st-radius-sm); }
.st-btn.xs       { padding: 3px  6px; font-size: 11px; gap: 4px; border-radius: var(--st-radius-sm); }
.st-btn.sm       { padding: 5px 10px; font-size: 12px; border-radius: var(--st-radius-sm); }
.st-btn.md       { padding: 7px 14px; font-size: 13px; border-radius: var(--st-radius-md); }
.st-btn.lg       { padding: 9px 18px; font-size: 14px; border-radius: var(--st-radius-md); }

/* ── Button Variants ── */

/* Default (secondary) */
.st-btn {
  background: var(--st-surface-2);
  border-color: var(--st-border);
  color: var(--st-text-muted);
}
.st-btn:hover {
  background: var(--st-surface-3);
  color: var(--st-text);
}
.st-btn.active {
  background: var(--st-accent-glow);
  color: var(--st-accent-400);
  border-color: var(--st-accent-600);
}

/* Primary */
.st-btn.primary {
  background: var(--st-accent-600);
  border-color: transparent;
  color: white;
}
.st-btn.primary:hover { background: var(--st-accent-500); }

/* Danger */
.st-btn.danger {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--st-danger);
}
.st-btn.danger:hover { background: rgba(248, 113, 113, 0.25); }

/* Ghost */
.st-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--st-text-subtle);
}
.st-btn.ghost:hover {
  background: var(--st-surface-2);
  color: var(--st-text-muted);
}

/* Accent */
.st-btn.accent {
  background: var(--st-accent-glow);
  border-color: var(--st-accent-700);
  color: var(--st-accent-400);
}
.st-btn.accent:hover {
  background: var(--st-accent-400);
  color: var(--st-surface-0);
}

/* ── Button Group ── */
.st-btn-group {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--st-surface-2);
  border-radius: var(--st-radius-md);
  border: 1px solid var(--st-border);
}
.st-btn-group .st-btn {
  border: none;
  background: transparent;
}
.st-btn-group .st-btn:hover { background: var(--st-surface-3); }
.st-btn-group .st-btn.active {
  background: var(--st-accent-glow);
  color: var(--st-accent-400);
}


/* ═══════════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════════════ */

/* ── Input ── */
.st-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--st-text);
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm);
  outline: none;
  transition: border-color var(--st-transition-fast);
}
.st-input::placeholder { color: var(--st-text-faint); }
.st-input:focus { border-color: var(--st-accent-400); }
.st-input.error { border-color: var(--st-danger); }
.st-input.mono { font-family: var(--st-font-mono); }

/* ── Label ── */
.st-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--st-text-subtle);
  margin-bottom: 4px;
}

/* ── Section Label ── */
.st-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--st-text-faint);
}

/* ── Checkbox / Radio ── */
.st-checkbox {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--st-text-faint);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  transition: all var(--st-transition-fast);
  flex-shrink: 0;
}
.st-checkbox:checked {
  background: var(--st-accent-600);
  border-color: var(--st-accent-400);
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
  background-size: 100%;
}
.st-checkbox:hover:not(:checked) { border-color: var(--st-text-subtle); }

/* ── Toggle ── */
.st-toggle {
  position: relative;
  width: 32px;
  height: 18px;
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: 9px;
  cursor: pointer;
  transition: all var(--st-transition-fast);
}
.st-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--st-text-faint);
  border-radius: 50%;
  transition: all var(--st-transition-fast);
}
.st-toggle.on {
  background: var(--st-accent-600);
  border-color: var(--st-accent-400);
}
.st-toggle.on::after {
  transform: translateX(14px);
  background: white;
}


/* ═══════════════════════════════════════════════════════════════════
   PANELS & LAYOUT
   ═══════════════════════════════════════════════════════════════════ */

/* ── Header ── */
.st-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--st-surface-1);
  border-bottom: 1px solid var(--st-border);
  flex-shrink: 0;
  position: relative;
  z-index: var(--st-z-header);
}

/* ── Logo ── */
.st-logo {
  font-weight: 700;
  font-size: 12px;
  color: var(--st-accent-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex-shrink: 1;
  min-width: 0;
}
.st-logo a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.st-logo .st-icon { stroke: var(--st-accent-400); }

/* ── Branding ── */
.st-branding {
  font-size: 10px;
  color: var(--st-text-faint);
  font-weight: 400;
  margin-left: 4px;
}
.st-branding a {
  color: var(--st-accent-400);
  text-decoration: none;
}
.st-branding a:hover { text-decoration: underline; }

/* ── Spacer ── */
.st-spacer { flex: 1; }

/* ── Panel ── */
.st-panel {
  background: var(--st-surface-1);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.st-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--st-text-faint);
  border-bottom: 1px solid var(--st-border);
  cursor: pointer;
  user-select: none;
  transition: color var(--st-transition-fast);
}
.st-panel-header:hover { color: var(--st-text-muted); }
.st-panel-header .st-icon { width: 14px; height: 14px; }

.st-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}


/* ═══════════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════════ */

.st-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--st-border);
  flex-shrink: 0;
}

.st-tab {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--st-text-subtle);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--st-transition-fast);
  user-select: none;
}
.st-tab:hover { color: var(--st-text-muted); }
.st-tab.active {
  color: var(--st-accent-400);
  border-bottom-color: var(--st-accent-400);
}


/* ═══════════════════════════════════════════════════════════════════
   BADGE
   ═══════════════════════════════════════════════════════════════════ */

.st-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--st-surface-2);
  color: var(--st-text-muted);
  border: 1px solid var(--st-border);
}
.st-badge.accent  { background: var(--st-accent-glow); color: var(--st-accent-400); border-color: var(--st-accent-700); }
.st-badge.danger  { background: rgba(248,113,113,0.12); color: var(--st-danger); border-color: rgba(248,113,113,0.25); }
.st-badge.warning { background: rgba(251,191,36,0.12); color: var(--st-warning); border-color: rgba(251,191,36,0.25); }
.st-badge.info    { background: rgba(96,165,250,0.12); color: var(--st-info); border-color: rgba(96,165,250,0.25); }


/* ═══════════════════════════════════════════════════════════════════
   STATUS BAR
   ═══════════════════════════════════════════════════════════════════ */

.st-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 12px;
  background: var(--st-surface-1);
  border-top: 1px solid var(--st-border);
  font-size: 11px;
  color: var(--st-text-faint);
  flex-shrink: 0;
  gap: 16px;
}

.st-status-bar .st-icon { width: 12px; height: 12px; }


/* ═══════════════════════════════════════════════════════════════════
   RESIZE HANDLE
   ═══════════════════════════════════════════════════════════════════ */

.st-resize {
  flex-shrink: 0;
  background: transparent;
  transition: background var(--st-transition-base);
}
.st-resize:hover { background: var(--st-accent-soft); }
.st-resize.vertical   { width: 4px; cursor: col-resize; }
.st-resize.horizontal { height: 4px; cursor: row-resize; }


/* ═══════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════ */

.st-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 8px 16px;
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-md);
  font-size: 12px;
  color: var(--st-text);
  z-index: var(--st-z-toast);
  transition: transform var(--st-transition-slow) ease;
  pointer-events: none;
  max-width: 400px;
}
.st-toast.visible { transform: translateX(-50%) translateY(0); }
.st-toast.err     { border-color: var(--st-danger); color: var(--st-danger); }
.st-toast.warn    { border-color: var(--st-warning); color: var(--st-warning); }
.st-toast.ok      { border-color: var(--st-accent-400); color: var(--st-accent-400); }


/* ═══════════════════════════════════════════════════════════════════
   MODAL / BACKDROP
   ═══════════════════════════════════════════════════════════════════ */

.st-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--st-z-backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--st-transition-slow);
}
.st-backdrop.visible { opacity: 1; pointer-events: auto; }

.st-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  background: var(--st-surface-1);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  z-index: var(--st-z-modal);
  opacity: 0;
  pointer-events: none;
  transition: all var(--st-transition-slow) ease;
  max-width: 90vw;
  max-height: 85vh;
  overflow: auto;
}
.st-modal.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}


/* ═══════════════════════════════════════════════════════════════════
   DRAWER / SLIDE-OVER
   ═══════════════════════════════════════════════════════════════════ */

.st-drawer {
  position: fixed;
  top: 0; bottom: 0;
  width: 320px;
  background: var(--st-surface-1);
  border-left: 1px solid var(--st-border);
  z-index: var(--st-z-overlay);
  transform: translateX(100%);
  transition: transform var(--st-transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  right: 0;
}
.st-drawer.left  { right: auto; left: 0; border-left: none; border-right: 1px solid var(--st-border); transform: translateX(-100%); }
.st-drawer.visible { transform: translateX(0); }


/* ═══════════════════════════════════════════════════════════════════
   LIST ITEMS
   ═══════════════════════════════════════════════════════════════════ */

.st-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--st-text-muted);
  border-radius: var(--st-radius-sm);
  transition: all var(--st-transition-fast);
  cursor: pointer;
}
.st-list-item:hover {
  background: var(--st-surface-3);
  color: var(--st-text);
}
.st-list-item.active {
  background: var(--st-accent-glow);
  color: var(--st-accent-400);
}


/* ═══════════════════════════════════════════════════════════════════
   DROPZONE
   ═══════════════════════════════════════════════════════════════════ */

.st-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border: 2px dashed var(--st-border);
  border-radius: var(--st-radius-md);
  color: var(--st-text-faint);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--st-transition-base);
}
.st-dropzone:hover,
.st-dropzone.dragover {
  border-color: var(--st-accent-600);
  color: var(--st-accent-400);
  background: var(--st-accent-soft);
}


/* ═══════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════ */

.st-mono      { font-family: var(--st-font-mono); }
.st-truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-divider   { height: 1px; background: var(--st-border); margin: 4px 0; }
.st-divider-v { width: 1px; height: 20px; background: var(--st-border); margin: 0 4px; flex-shrink: 0; }


/* ═══════════════════════════════════════════════════════════════════
   SETTINGS DRAWER (shared: Signum, Covalent)
   ═══════════════════════════════════════════════════════════════════ */

.st-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--st-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--st-text);
}
.st-drawer-header .close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--st-text-muted);
  border-radius: var(--st-radius-sm);
  cursor: pointer;
  transition: all var(--st-transition-fast);
}
.st-drawer-header .close-btn:hover { background: var(--st-surface-3); color: var(--st-text); }

.st-drawer-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.st-setting-group {
  margin-bottom: 20px;
}
.st-setting-group-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--st-text-faint);
  margin-bottom: 10px;
}
.st-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--st-text-muted);
}


/* ═══════════════════════════════════════════════════════════════════
   CUSTOM SELECT DROPDOWN (shared: settings font picker, etc.)
   ═══════════════════════════════════════════════════════════════════ */

.st-select {
  position: relative;
}
.st-select-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm);
  color: var(--st-text);
  font-size: 12px;
  cursor: pointer;
  transition: border-color var(--st-transition-fast);
}
.st-select-btn:hover { border-color: var(--st-border-hi, var(--st-accent-600)); }
.st-select-btn .icon { width: 12px; height: 12px; transition: transform var(--st-transition-fast); }
.st-select.open .st-select-btn .icon { transform: rotate(180deg); }

.st-select-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 100%;
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm);
  padding: 4px;
  z-index: 10;
}
.st-select.open .st-select-menu { display: block; }

.st-select-item {
  padding: 5px 8px;
  font-size: 12px;
  color: var(--st-text-muted);
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--st-transition-fast);
  white-space: nowrap;
}
.st-select-item:hover { background: var(--st-surface-3); color: var(--st-text); }
.st-select-item.active { color: var(--st-accent-400); }
.st-select-item.active::before { content: "\2713  "; }


/* ═══════════════════════════════════════════════════════════════════
   SETTINGS DRAWER — legacy class names (Signum, Covalent)
   Both tools use these class names in HTML/JS. The .st-* versions
   above are for new tools.
   ═══════════════════════════════════════════════════════════════════ */

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.settings-overlay.open { opacity: 1; pointer-events: auto; }

.settings-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 280px;
  background: var(--st-surface-1);
  border-left: 1px solid var(--st-border);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}
.settings-drawer.open { transform: translateX(0); }

.settings-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 48px;
  border-bottom: 1px solid var(--st-border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--st-text);
  flex-shrink: 0;
}
.settings-drawer-header .close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: var(--st-radius-sm);
  color: var(--st-text-muted);
  cursor: pointer;
  transition: all 0.1s;
}
.settings-drawer-header .close-btn:hover { background: var(--st-surface-3); color: var(--st-text); }

.settings-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.setting-group { margin-bottom: 20px; }
.setting-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--st-text-subtle);
  margin-bottom: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  color: var(--st-text-muted);
}
.setting-row label {
  font-size: 11px;
  color: var(--st-text-muted);
}

.setting-select {
  position: relative;
}
.setting-select .select-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm);
  color: var(--st-text);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.1s;
}
.setting-select .select-btn:hover { border-color: var(--st-border-hi); }
.setting-select .select-btn .icon {
  width: 12px;
  height: 12px;
  transition: transform 0.15s;
}
.setting-select.open .select-btn .icon { transform: rotate(180deg); }

.setting-select .select-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 140px;
  background: var(--st-surface-3);
  border: 1px solid var(--st-border-hi);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 4px;
  z-index: 200;
}
.setting-select.open .select-menu { display: block; }

.setting-select .select-item {
  padding: 5px 8px;
  font-size: 11px;
  color: var(--st-text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.1s;
}
.setting-select .select-item:hover { background: var(--st-surface-2); color: var(--st-text); }
.setting-select .select-item.active { color: var(--st-accent-400); }
.setting-select .select-item.active::before { content: '\2713  '; color: var(--st-accent-400); }


/* ── Reusable Scrollbar ─────────────────────────────────────────── */
.st-scrollbar,
.st-panel-body {
  scrollbar-width: thin;
  scrollbar-color: var(--st-border-hi) transparent;
}
.st-scrollbar::-webkit-scrollbar,
.st-panel-body::-webkit-scrollbar { width: 6px; height: 6px; }
.st-scrollbar::-webkit-scrollbar-track,
.st-panel-body::-webkit-scrollbar-track { background: transparent; }
.st-scrollbar::-webkit-scrollbar-thumb,
.st-panel-body::-webkit-scrollbar-thumb { background: var(--st-border-hi); border-radius: 3px; }
.st-scrollbar::-webkit-scrollbar-thumb:hover,
.st-panel-body::-webkit-scrollbar-thumb:hover { background: var(--st-text-faint); }

/* ── Reusable Panel ─────────────────────────────────────────────── */
.st-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.st-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--st-text-subtle);
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}
.st-panel-header:hover { background: var(--st-surface-2); }
.st-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
}
