/* Content Sorter 2000 — Dotcom-era homage
   Inspired by theglobe.com & the late-90s portal aesthetic.
   Sidebar drips on the right. Light mode default. Verdana all day. */

/* ================================================================
   LIGHT MODE (default)
   ================================================================ */

:root {
  /* Surface */
  --navy: #f5f1ea;
  --panel: #e8e2d8;
  --surface: #efe9e0;
  --input-bg: #ffffff;
  --border: rgba(0, 0, 0, 0.08);

  /* Accent */
  --accent: #3366cc;
  --accent-dim: rgba(51, 102, 204, 0.08);
  --accent-soft: rgba(51, 102, 204, 0.18);

  /* Secondary */
  --teal: #008866;
  --teal-dim: rgba(0, 136, 102, 0.08);
  --teal-glow: rgba(0, 136, 102, 0.15);
  --orange: #cc5500;
  --purple: #6644aa;
  --lime: #228844;
  --pink: #cc3355;
  --hot-pink: #3366cc;
  --sunset: #cc5500;
  --neon-blue: #3366cc;

  /* Text */
  --text: #2a2a2a;
  --text-dim: #8a8578;

  /* Chart / visualization tokens (read by JS) */
  --chart-bg: #ffffff;
  --chart-grid: rgba(0, 0, 0, 0.05);
  --chart-cross: rgba(0, 0, 0, 0.08);
  --chart-label: #999999;
  --chart-corner: #aaaaaa;
  --chart-dot: #3366cc;
  --chart-dot-hover: #cc5500;
  --chart-dot-stroke: #ffffff;
  --chart-text: #444444;
  --chart-empty: #bbbbbb;
  --chart-line: rgba(51, 102, 204, 0.20);
  --chart-line-hover: #cc5500;
  --chart-line-selected: #3366cc;
  --chart-rail: rgba(51, 102, 204, 0.20);
  --chart-rail-glow: rgba(51, 102, 204, 0.06);
  --chart-axis: rgba(0, 0, 0, 0.06);
  --chart-spoke: rgba(0, 0, 0, 0.08);
  --chart-cell-low-r: 240;
  --chart-cell-low-g: 237;
  --chart-cell-low-b: 230;
  --chart-cell-high-r: 51;
  --chart-cell-high-g: 102;
  --chart-cell-high-b: 204;
  --chart-hover-stroke: #cc5500;
  --chart-selected-stroke: #3366cc;
  --chart-cell-border: rgba(0, 0, 0, 0.06);
  --chart-rank: #aaaaaa;
  --chart-dot-fill-low: rgba(51, 102, 204, 0.25);

  /* Drip shadow */
  --drip-shadow: rgba(0, 0, 0, 0.06);
}

/* ================================================================
   DARK MODE
   ================================================================ */

[data-theme="dark"] {
  --navy: #0c1521;
  --panel: #111b2b;
  --surface: #172335;
  --input-bg: #0a1320;
  --border: rgba(100, 140, 200, 0.10);

  --accent: #4488ff;
  --accent-dim: rgba(68, 136, 255, 0.10);
  --accent-soft: rgba(68, 136, 255, 0.20);

  --teal: #00cc88;
  --teal-dim: rgba(0, 204, 136, 0.12);
  --teal-glow: rgba(0, 204, 136, 0.25);
  --orange: #ff7744;
  --purple: #7b68ee;
  --lime: #44dd88;
  --pink: #ff3366;
  --hot-pink: #4488ff;
  --sunset: #ff7744;
  --neon-blue: #4488ff;

  --text: #c5cdd8;
  --text-dim: #6a7b8f;

  --chart-bg: #0a1320;
  --chart-grid: rgba(100, 140, 200, 0.06);
  --chart-cross: rgba(100, 140, 200, 0.10);
  --chart-label: #6a7b8f;
  --chart-corner: #3d4f63;
  --chart-dot: #4488ff;
  --chart-dot-hover: #ff7744;
  --chart-dot-stroke: #0c1521;
  --chart-text: #c5cdd8;
  --chart-empty: #3d4f63;
  --chart-line: rgba(68, 136, 255, 0.20);
  --chart-line-hover: #ff7744;
  --chart-line-selected: #4488ff;
  --chart-rail: rgba(68, 136, 255, 0.25);
  --chart-rail-glow: rgba(68, 136, 255, 0.08);
  --chart-axis: rgba(100, 140, 200, 0.08);
  --chart-spoke: rgba(100, 140, 200, 0.10);
  --chart-cell-low-r: 10;
  --chart-cell-low-g: 19;
  --chart-cell-low-b: 32;
  --chart-cell-high-r: 68;
  --chart-cell-high-g: 136;
  --chart-cell-high-b: 204;
  --chart-hover-stroke: #ff7744;
  --chart-selected-stroke: #4488ff;
  --chart-cell-border: rgba(100, 140, 200, 0.06);
  --chart-rank: #3d4f63;
  --chart-dot-fill-low: rgba(68, 136, 255, 0.3);

  --drip-shadow: rgba(0, 0, 0, 0.25);
}

/* ================================================================
   RESET & BASE
   ================================================================ */

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

body {
  font-family: Verdana, Tahoma, Geneva, sans-serif;
  background: var(--navy);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s, color 0.3s;
}

/* ── Utility ─────────────────────────────────────────────────────── */

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

/* ── Empty state (0 docs) ────────────────────────────────────────── */

.cs-empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: state-fade 0.5s ease-out;
}

@keyframes state-fade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cs-empty-inner {
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.cs-empty-logo {
  height: 64px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(51, 102, 204, 0.18));
  margin-bottom: 4px;
}

[data-theme="dark"] .cs-empty-logo {
  filter: drop-shadow(0 2px 12px rgba(68, 136, 255, 0.25));
}

.cs-empty-tagline {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  font-weight: bold;
  color: var(--text);
  text-align: center;
  margin: 0;
}

.cs-empty-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  text-align: center;
  margin: 0;
}

.cs-empty-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.cs-empty-textarea:focus {
  border-color: var(--accent);
}

.cs-empty-btn {
  width: 100%;
  padding: 12px 20px;
  font-family: Verdana, Tahoma, sans-serif;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(180deg, #4477dd 0%, #2255bb 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom-color: rgba(0, 0, 0, 0.2);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(51, 102, 204, 0.3);
}

.cs-empty-btn:hover {
  background: linear-gradient(180deg, #5588ee 0%, #3366cc 100%);
  box-shadow: 0 4px 16px rgba(51, 102, 204, 0.4);
  transform: translateY(-1px);
}

.cs-empty-btn:active {
  transform: translateY(1px);
}

.cs-empty-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.cs-empty-samples-link {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: underline;
  cursor: pointer;
}

.cs-empty-samples-link:hover {
  color: var(--accent);
}

.cs-empty-links {
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-dim);
}

.cs-empty-links a {
  color: var(--text-dim);
  text-decoration: none;
}

.cs-empty-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.cs-empty-links-sep {
  margin: 0 6px;
  opacity: 0.5;
}

/* ── Solo state (1 doc) ──────────────────────────────────────────── */

.cs-solo-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: state-fade 0.5s ease-out;
}

.cs-solo-inner {
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.cs-solo-emoji {
  font-size: 48px;
  margin: 0;
  line-height: 1;
}

.cs-solo-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  font-weight: bold;
  color: var(--text);
  margin: 0;
}

.cs-solo-body {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0;
}

/* ================================================================
   APP SHELL
   ================================================================ */

.cs-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ================================================================
   SIDEBAR — on the RIGHT, with dripping left edge
   ================================================================ */

.cs-sidebar {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  border-top: 1px solid var(--border);
  transition: background 0.3s;
}

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

.cs-logo {
  height: 54px;
  width: auto;
  transition: filter 0.3s;
}

/* ── Theme toggle ────────────────────────────────────────────────── */

.cs-theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px 4px 8px;
  cursor: pointer;
  font-family: Verdana, Tahoma, sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  transition: all 0.2s;
  flex-shrink: 0;
}

.cs-theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cs-theme-icon {
  font-size: 14px;
  line-height: 1;
}

/* ── Input section ───────────────────────────────────────────────── */

.cs-input-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cs-textarea {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.3s;
  min-height: 80px;
  max-height: 140px;
}

.cs-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.cs-textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

/* ── Char counter ────────────────────────────────────────────────── */

.cs-textarea-wrap {
  position: relative;
}

.cs-char-counter {
  display: block;
  text-align: right;
  font-size: 11px;
  margin-top: 4px;
  color: var(--text-dim);
  opacity: 0.7;
  transition: color 0.2s, opacity 0.2s;
  font-variant-numeric: tabular-nums;
}

.cs-char-counter.cs-char-short {
  color: var(--text-dim);
  opacity: 0.7;
}

.cs-char-counter.cs-char-ok {
  color: var(--accent);
  opacity: 0.5;
}

/* ── Garbage warning ─────────────────────────────────────────────── */

.cs-garbage-warn {
  display: block;
  font-size: 11px;
  line-height: 1.4;
  margin-top: 4px;
  padding: 6px 8px;
  color: #b8860b;
  background: rgba(184, 134, 11, 0.08);
  border-left: 2px solid rgba(184, 134, 11, 0.4);
  border-radius: 3px;
}

[data-theme="dark"] .cs-garbage-warn {
  color: #e0c068;
  background: rgba(224, 192, 104, 0.08);
  border-left-color: rgba(224, 192, 104, 0.3);
}

/* ── Bucket list ─────────────────────────────────────────────────── */

.cs-bucket-list-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cs-bucket-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cs-bucket-list:empty::before {
  content: 'no documents loaded \2014  paste text above';
  color: var(--text-dim);
  font-size: 11px;
  font-style: italic;
  padding: 12px 0;
  text-align: center;
}

.cs-bucket-item {
  --shine: 0%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 0;
}

.cs-bucket-item:hover {
  background: var(--surface);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .cs-bucket-item:hover {
  border-color: rgba(100, 140, 200, 0.18);
}

.cs-bucket-item.cs-bucket-active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.cs-bucket-item-label {
  flex: 1;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-bucket-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  font-family: 'Lucida Console', 'Menlo', monospace;
  flex-shrink: 0;
  line-height: 1;
}

.cs-bucket-item-score {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  color: var(--teal);
  flex-shrink: 0;
}

/* ── Drag-and-drop (manual sort) ─────────────────────────────────── */

.cs-bucket-draggable {
  cursor: grab;
}

.cs-bucket-draggable:active {
  cursor: grabbing;
}

.cs-bucket-grip {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.cs-bucket-item:hover .cs-bucket-grip {
  opacity: 1;
}

.cs-bucket-dragging {
  opacity: 0.35;
  border-color: var(--accent) !important;
}

.cs-drop-above {
  box-shadow: 0 -2px 0 0 var(--accent);
}

.cs-drop-below {
  box-shadow: 0 2px 0 0 var(--accent);
}

/* ── Sort section ────────────────────────────────────────────────── */

.cs-sort-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cs-sort-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cs-sort-btn {
  font-family: Verdana, Tahoma, sans-serif;
  font-size: 11px;
  padding: 4px 10px;
  background: var(--input-bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  text-transform: lowercase;
  letter-spacing: 0.3px;
  transition: all 0.15s;
}

.cs-sort-btn:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
}

.cs-sort-btn.cs-sort-active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

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

.cs-samples-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: var(--teal-dim);
  border: 1px solid rgba(0, 136, 102, 0.18);
}

.cs-samples-banner-text {
  flex: 1;
  font-size: 11px;
  color: var(--teal);
  letter-spacing: 0.3px;
}

.cs-samples-banner-btn {
  font-family: Verdana, Tahoma, sans-serif;
  font-size: 10px;
  padding: 4px 10px;
  border: 1px solid rgba(0, 136, 102, 0.35);
  border-radius: 4px;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
  white-space: nowrap;
  transition: all 0.15s;
}

.cs-samples-banner-btn:hover {
  background: rgba(0, 136, 102, 0.08);
}

.cs-samples-banner-btn:disabled {
  color: var(--text-dim);
  border-color: var(--text-dim);
  cursor: not-allowed;
}

.cs-samples-banner-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}

.cs-samples-banner-close:hover {
  color: var(--teal);
}

.cs-status {
  font-size: 11px;
  color: var(--text-dim);
  min-height: 16px;
}

.cs-status.error { color: var(--orange); }
.cs-status.success { color: var(--teal); }

/* ── Buttons ─────────────────────────────────────────────────────── */

.cs-btn {
  font-family: Verdana, Tahoma, sans-serif;
  font-size: 12px;
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.4;
  transition: all 0.2s;
}

.cs-btn:active {
  transform: scale(0.97);
}

.cs-btn-primary {
  background: linear-gradient(180deg, #4477dd 0%, #2255bb 100%);
  color: #fff;
  font-weight: bold;
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(0, 0, 0, 0.15);
  box-shadow:
    0 2px 6px rgba(51, 102, 204, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.cs-btn-primary:hover {
  background: linear-gradient(180deg, #5588ee 0%, #3366cc 100%);
  box-shadow:
    0 3px 10px rgba(51, 102, 204, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.cs-btn-primary:disabled {
  background: var(--text-dim);
  box-shadow: none;
  border-color: transparent;
  cursor: not-allowed;
}

.cs-btn-danger {
  background: transparent;
  color: var(--orange);
  border: 1px solid rgba(204, 85, 0, 0.25);
  font-weight: bold;
}

[data-theme="dark"] .cs-btn-danger {
  border-color: rgba(255, 119, 68, 0.25);
}

.cs-btn-danger:hover {
  background: rgba(204, 85, 0, 0.06);
}

.cs-btn-sm {
  padding: 4px 12px;
  font-size: 11px;
}

.cs-btn-icon {
  background: transparent;
  color: var(--text-dim);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
}

.cs-btn-icon:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Footer (inside sidebar) ─────────────────────────────────────── */

.cs-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  margin-top: auto;
  width: 100%;
  box-sizing: border-box;
}

.cs-copyright {
  color: var(--text-dim);
}

/* ================================================================
   MAIN AREA
   ================================================================ */

.cs-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  min-height: 0;
  position: relative;
}

/* ── View tabs ───────────────────────────────────────────────────── */

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

.cs-view-tab {
  font-family: Verdana, Tahoma, sans-serif;
  font-size: 10px;
  padding: 5px 10px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s;
  border-bottom: 1px solid transparent;
}

.cs-view-tab:hover {
  color: var(--accent);
}

.cs-view-tab.cs-view-tab-active {
  background: var(--input-bg);
  color: var(--accent);
  border-color: var(--border);
  border-bottom-color: var(--input-bg);
}

.cs-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.cs-axis-controls {
  display: flex;
  gap: 16px;
  align-items: center;
}

.cs-select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: Verdana, sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.cs-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

/* ── Quadrant ────────────────────────────────────────────────────── */

.cs-quadrant-container {
  background: var(--chart-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  align-self: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: background 0.3s, box-shadow 0.3s;
}

[data-theme="dark"] .cs-quadrant-container {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#quadrant-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Rollercoaster container ─────────────────────────────────────── */

.cs-coaster-container {
  background: var(--chart-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: background 0.3s;
}

[data-theme="dark"] .cs-coaster-container {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

#coaster-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Generic viz containers ──────────────────────────────────────── */

.cs-viz-container {
  background: var(--chart-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: background 0.3s;
}

[data-theme="dark"] .cs-viz-container {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.cs-viz-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cs-viz-square {
  aspect-ratio: 1;
  align-self: center;
}

.cs-viz-wide {
  aspect-ratio: auto;
}

.cs-viz-scroll {
  overflow-y: auto;
  flex: 1;
}

/* ── Detail panel ────────────────────────────────────────────────── */

.cs-detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .cs-detail-panel {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

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

.cs-detail-label {
  font-weight: bold;
  color: var(--accent);
  font-size: 13px;
}

.cs-detail-hints {
  font-size: 12px;
  color: var(--teal);
}

.cs-detail-hints span {
  display: block;
  margin-bottom: 2px;
}

.cs-detail-toggle summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cs-detail-text {
  background: var(--input-bg);
  padding: 12px;
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 8px;
  color: var(--text);
}

/* ================================================================
   MOBILE (default — column, quadrant on top)
   ================================================================ */

@media (max-width: 899px) {
  .cs-app {
    flex-direction: column;
  }

  .cs-main {
    order: -1;
  }

  .cs-sidebar {
    order: 1;
  }

  .cs-quadrant-container {
    max-height: 60vh;
    width: 100%;
    flex: 0 0 auto;
  }

  .cs-logo {
    height: 44px;
  }

  .cs-textarea {
    min-height: 70px;
  }

  .cs-bucket-list-section {
    max-height: 200px;
  }
}

/* ================================================================
   DESKTOP — main left, sidebar right with dripping edge
   ================================================================ */

@media (min-width: 900px) {
  .cs-app {
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
  }

  .cs-main {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 24px;
    justify-content: flex-start;
    order: 0;
  }

  .cs-sidebar {
    width: 340px;
    min-width: 340px;
    height: 100vh;
    overflow-y: auto;
    border-top: none;
    border-left: none;
    order: 1;
    position: relative;
    z-index: 2;
  }

  /* ── The dripping left edge ──────────────────────────────────── */

  .cs-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 100%;
    width: 40px;
    height: 100%;
    background: var(--panel);
    pointer-events: none;
    filter: drop-shadow(-2px 0 4px var(--drip-shadow));
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 900' fill='white'%3E%3Crect x='39' y='0' width='1' height='900'/%3E%3Cpath d='M40 30 Q36 34 35 42 L35 170 Q35 182 30 188 Q26 192 29 199 Q33 204 36 196 L36 42 Q37 35 40 32 Z'/%3E%3Cpath d='M40 260 Q37 264 36 272 L36 355 Q36 366 32 371 Q29 375 32 381 Q36 384 38 374 L38 272 Q39 265 40 262 Z'/%3E%3Cpath d='M40 430 Q38 433 37 440 L37 490 Q37 500 34 504 Q32 507 35 512 Q38 514 39 505 L39 440 Q40 434 40 432 Z'/%3E%3Cpath d='M40 570 Q35 574 34 584 L34 715 Q34 728 29 734 Q25 739 29 746 Q34 750 37 738 L37 584 Q38 576 40 572 Z'/%3E%3Cpath d='M40 810 Q39 812 38 818 L38 840 Q38 847 36 850 Q35 852 37 856 Q39 857 40 850 L40 818 Z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 900' fill='white'%3E%3Crect x='39' y='0' width='1' height='900'/%3E%3Cpath d='M40 30 Q36 34 35 42 L35 170 Q35 182 30 188 Q26 192 29 199 Q33 204 36 196 L36 42 Q37 35 40 32 Z'/%3E%3Cpath d='M40 260 Q37 264 36 272 L36 355 Q36 366 32 371 Q29 375 32 381 Q36 384 38 374 L38 272 Q39 265 40 262 Z'/%3E%3Cpath d='M40 430 Q38 433 37 440 L37 490 Q37 500 34 504 Q32 507 35 512 Q38 514 39 505 L39 440 Q40 434 40 432 Z'/%3E%3Cpath d='M40 570 Q35 574 34 584 L34 715 Q34 728 29 734 Q25 739 29 746 Q34 750 37 738 L37 584 Q38 576 40 572 Z'/%3E%3Cpath d='M40 810 Q39 812 38 818 L38 840 Q38 847 36 850 Q35 852 37 856 Q39 857 40 850 L40 818 Z'/%3E%3C/svg%3E");
    -webkit-mask-size: 40px 900px;
    mask-size: 40px 900px;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: right top;
    mask-position: right top;
  }

  .cs-quadrant-container {
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 140px);
    width: auto;
    max-width: 100%;
    aspect-ratio: 1;
  }

  .cs-logo {
    height: 60px;
  }

  .cs-textarea {
    min-height: 80px;
  }
}

/* ── Large desktops ──────────────────────────────────────────────── */

@media (min-width: 1400px) {
  .cs-sidebar {
    width: 380px;
    min-width: 380px;
    padding: 28px;
  }

  .cs-main {
    padding: 32px;
  }

  .cs-quadrant-container {
    max-height: calc(100vh - 120px);
  }
}

/* ================================================================
   SCROLLBAR
   ================================================================ */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--navy);
}

::-webkit-scrollbar-thumb {
  background: var(--text-dim);
  border-radius: 3px;
  opacity: 0.5;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ================================================================
   WAITLIST TRIGGER
   ================================================================ */

.cs-waitlist-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: var(--input-bg);
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  font-family: Verdana, Tahoma, sans-serif;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.cs-waitlist-trigger:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(51, 102, 204, 0.12);
}

[data-theme="dark"] .cs-waitlist-trigger:hover {
  box-shadow: 0 0 16px rgba(68, 136, 255, 0.12);
}

.cs-waitlist-pulse {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: wl-pulse 2s ease-in-out infinite;
}

@keyframes wl-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-soft); }
  50%      { opacity: 0.6; box-shadow: 0 0 0 6px transparent; }
}

/* ================================================================
   MODAL OVERLAY & CARD
   ================================================================ */

.cs-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

[data-theme="dark"] .cs-modal-overlay {
  background: rgba(12, 21, 33, 0.85);
}

.cs-modal {
  position: relative;
  width: 90%;
  max-width: 420px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px 28px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  animation: modal-in 0.2s ease-out;
}

[data-theme="dark"] .cs-modal {
  background: var(--panel);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cs-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 20px;
}

.cs-modal-title {
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: bold;
  letter-spacing: 0.3px;
}

.cs-modal-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 20px;
}

.cs-modal-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-modal-input {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: Verdana, Tahoma, sans-serif;
  font-size: 13px;
  transition: border-color 0.2s;
}

[data-theme="dark"] .cs-modal-input {
  background: var(--surface);
}

.cs-modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.cs-modal-input::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

.cs-modal-textarea {
  resize: vertical;
  min-height: 60px;
  max-height: 120px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 13px;
  line-height: 1.5;
}

.cs-modal-submit {
  margin-top: 8px;
}

.cs-modal-status {
  font-size: 12px;
  min-height: 18px;
  text-align: center;
}

.cs-modal-status.success { color: var(--teal); }
.cs-modal-status.error   { color: var(--orange); }

/* ── Footer link ──────────────────────────────────────────────────── */

.cs-footer-link {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.cs-footer-link:hover {
  color: var(--accent);
}

/* ── Terms modal ─────────────────────────────────────────────────── */

.cs-modal-terms {
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.cs-terms-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-dim);
}

.cs-terms-body h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-top: 6px;
}

.cs-terms-body p {
  margin: 0;
}

.cs-terms-body ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cs-terms-body li {
  font-size: 12px;
  line-height: 1.7;
}

.cs-terms-body strong {
  color: var(--text);
}

/* ── FAQ toggle button ───────────────────────────────────────────── */

.cs-faq-toggle {
  margin-left: auto;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--input-bg);
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.cs-faq-toggle:hover,
.cs-faq-toggle.cs-faq-active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
}

/* ── FAQ panel ───────────────────────────────────────────────────── */

.cs-faq-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 33.33%;
  height: 100%;
  background: var(--input-bg);
  border-left: 1px solid var(--border);
  z-index: 500;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
  animation: faq-slide 0.2s ease-out;
}

[data-theme="dark"] .cs-faq-panel {
  background: var(--panel);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
}

@keyframes faq-slide {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.cs-faq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.cs-faq-title {
  font-size: 14px;
  font-weight: bold;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* ── FAQ tabs ──────────────────────────────────────────────────── */

.cs-faq-tabs {
  display: flex;
  gap: 2px;
}

.cs-faq-tab {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: all 0.15s;
}

.cs-faq-tab:hover {
  color: var(--accent);
}

.cs-faq-tab-active {
  color: var(--accent);
  border-color: var(--border);
  border-bottom-color: var(--input-bg);
  background: var(--input-bg);
}

[data-theme="dark"] .cs-faq-tab-active {
  border-bottom-color: var(--panel);
  background: var(--panel);
}

.cs-faq-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cs-faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 0.15s;
}

[data-theme="dark"] .cs-faq-item {
  background: var(--input-bg);
}

.cs-faq-item[open] {
  border-color: var(--accent-soft);
}

.cs-faq-item summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs-faq-item summary::before {
  content: '\25B8';
  color: var(--accent);
  font-size: 11px;
  transition: transform 0.15s;
}

.cs-faq-item[open] summary::before {
  transform: rotate(90deg);
}

.cs-faq-item summary::-webkit-details-marker { display: none; }

.cs-faq-item p {
  padding: 0 16px 14px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-dim);
}

.cs-faq-item p strong {
  color: var(--accent);
}

.cs-faq-item p em {
  color: var(--teal);
}

/* FAQ — mobile: full screen overlay */
@media (max-width: 899px) {
  .cs-faq-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* ── Focus-within accent ─────────────────────────────────────────── */

.cs-input-section:focus-within .cs-label {
  color: var(--accent);
}

.cs-footer-danger {
  color: var(--text-dim);
}

.cs-footer-danger:hover {
  color: var(--orange);
}


