/* BRAIN — Ben's Resource for Assets, Ideas & Notes */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e5eb;
  --border-strong: #c8cdd8;
  --text: #1a1d26;
  --text-muted: #5c6370;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --danger: #dc2626;
  --on-primary: #fff;
  --row-hover: #fafbfc;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --overlay: rgba(26, 29, 38, 0.45);
  --thumb-overlay: rgba(26, 29, 38, 0.55);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --card-aspect: 2.5 / 3.5;
  --upload-width: 220px;
  /* Table density (comfortable default) */
  --table-font-size: 0.875rem;
  --table-head-font-size: 0.75rem;
  --table-cell-padding-y: 0.75rem;
  --table-cell-padding-x: 1rem;
  --table-meta-cell-padding-y: 0.65rem;
  --table-meta-cell-padding-x: 0.875rem;
  --table-thumb-width: 40px;
  --table-thumb-height: 56px;
  --table-thumb-col-width: 52px;
  --table-badge-font-size: 0.8125rem;
  --table-action-btn-size: 2rem;
  --table-action-icon-size: 1rem;
  --table-row-actions-gap: 0.35rem;
}

html.density-compact {
  --table-font-size: 0.8125rem;
  --table-head-font-size: 0.6875rem;
  --table-cell-padding-y: 0.4rem;
  --table-cell-padding-x: 0.65rem;
  --table-meta-cell-padding-y: 0.4rem;
  --table-meta-cell-padding-x: 0.65rem;
  --table-thumb-width: 32px;
  --table-thumb-height: 45px;
  --table-thumb-col-width: 44px;
  --table-badge-font-size: 0.75rem;
  --table-action-btn-size: 1.75rem;
  --table-action-icon-size: 0.875rem;
  --table-row-actions-gap: 0.25rem;
}

html.density-expanded {
  --table-font-size: 0.9375rem;
  --table-head-font-size: 0.8125rem;
  --table-cell-padding-y: 1rem;
  --table-cell-padding-x: 1.25rem;
  --table-meta-cell-padding-y: 0.875rem;
  --table-meta-cell-padding-x: 1.125rem;
  --table-thumb-width: 52px;
  --table-thumb-height: 73px;
  --table-thumb-col-width: 64px;
  --table-badge-font-size: 0.875rem;
  --table-action-btn-size: 2.25rem;
  --table-action-icon-size: 1.125rem;
  --table-row-actions-gap: 0.45rem;
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #12151c;
  --surface: #1a1f2b;
  --border: #2a3142;
  --border-strong: #3d465c;
  --text: #e8eaef;
  --text-muted: #9aa3b2;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.18);
  --danger: #f87171;
  --row-hover: #222836;
  --success: #4ade80;
  --success-bg: rgba(21, 128, 61, 0.22);
  --danger-bg: rgba(220, 38, 38, 0.18);
  --danger-border: rgba(248, 113, 113, 0.35);
  --overlay: rgba(0, 0, 0, 0.65);
  --thumb-overlay: rgba(0, 0, 0, 0.6);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.45);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* Mobile pull-to-refresh */
.ptr-viewport {
  --ptr-app-offset: 0px;
  --ptr-indicator-scale: 0;
  position: relative;
  min-height: 100vh;
  background: var(--bg);
}

.ptr-viewport.is-ptr-active {
  overflow: hidden;
  touch-action: none;
}

.ptr-viewport .app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  background: var(--bg);
  border-radius: 0 0 1rem 1rem;
  box-shadow: 0 4px 24px rgb(0 0 0 / 0.08);
  will-change: transform;
}

.ptr-viewport .app.is-ptr-shifted {
  transition: none;
}

.ptr-viewport:not(.is-ptr-active) .app.is-ptr-shifted {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.ptr-viewport .app.is-ptr-shifted,
.ptr-viewport.is-ptr-active .app {
  transform: translate3d(0, var(--ptr-app-offset), 0);
}

.pull-to-refresh {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 0;
  display: flex;
  justify-content: center;
  padding-top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
  pointer-events: none;
  opacity: calc(0.25 + var(--ptr-indicator-scale) * 0.75);
  transform: scale(calc(0.82 + var(--ptr-indicator-scale) * 0.18));
}

.pull-to-refresh.is-ready {
  opacity: 1;
}

.pull-to-refresh-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.pull-to-refresh-spinner {
  position: relative;
  width: 36px;
  height: 36px;
}

.pull-to-refresh-ring {
  display: block;
}

.pull-to-refresh-ring-track {
  stroke: var(--border);
  opacity: 0.9;
}

.pull-to-refresh-ring-progress {
  stroke: var(--primary);
  stroke-dasharray: 62.83;
  stroke-dashoffset: 62.83;
  transition: stroke 0.15s ease;
}

.pull-to-refresh.is-ready .pull-to-refresh-ring-progress {
  stroke: var(--primary-hover, var(--primary));
}

.pull-to-refresh-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transform-origin: center center;
}

.pull-to-refresh.is-refreshing .pull-to-refresh-spinner {
  animation: ptr-spin 0.7s linear infinite;
}

.pull-to-refresh-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}

.pull-to-refresh.is-ready .pull-to-refresh-label {
  color: var(--text);
}

@keyframes ptr-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (hover: hover) and (pointer: fine) {
  .ptr-viewport .app {
    border-radius: 0;
    box-shadow: none;
    transform: none !important;
  }

  .pull-to-refresh {
    display: none;
  }
}

/* Layout */

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
}

.app-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.app-footer-copy,
.app-footer-notice {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.app-footer-notice {
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

.app-header {
  position: relative;
  z-index: 100;
  padding: 1rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.app-header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 4rem;
}

.app-header-nav {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}

.app-header-nav .segmented-nav {
  pointer-events: auto;
}

.header-actions {
  position: relative;
  z-index: 101;
  flex-shrink: 0;
}

.settings-menu {
  position: relative;
}

.settings-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-icon {
  width: 1.35rem;
  height: 1.35rem;
}

.settings-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem 0;
  z-index: 200;
}

.settings-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.settings-dropdown-item:hover,
.settings-dropdown-item:focus-visible {
  background: var(--row-hover);
  outline: none;
}

.settings-dropdown-divider {
  height: 1px;
  margin: 0.35rem 0.5rem;
  background: var(--border);
}

.settings-dropdown-item--logout {
  color: var(--text-muted);
  font-weight: 500;
}

.settings-dropdown-item--logout:hover,
.settings-dropdown-item--logout:focus-visible {
  color: var(--danger);
  background: var(--danger-bg);
}

.brand {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  max-width: min(100%, 12rem);
  flex-shrink: 0;
}

.brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
  flex: 1;
}

.brand-subtitle {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.brand-subtitle-line {
  display: block;
  white-space: nowrap;
}

/* Toolbar */

.toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.toolbar-search-group {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: min(100%, 280px);
}

.filter-menu {
  position: relative;
  flex-shrink: 0;
}

.filter-btn-active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.filter-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 200;
  min-width: 400px;
  width: min(580px, calc(100vw - 1.5rem));
  max-width: min(580px, calc(100vw - 1.5rem));
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.filter-panel-header {
  padding: 1rem 1.125rem 0.875rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.filter-panel-title {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.filter-panel-subtitle {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.filter-panel-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: start;
  gap: 1rem 1.25rem;
  padding: 1rem 1.25rem;
  max-height: min(82vh, 680px);
  overflow-y: auto;
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.filter-section-heading {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.filter-section-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.filter-section-count {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.filter-section-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.filter-link-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
}

.filter-link-btn:hover {
  text-decoration: underline;
}

.filter-link-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.filter-link-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
  opacity: 0.55;
}

.filter-action-divider {
  color: var(--text-muted);
  font-size: 0.75rem;
  user-select: none;
}

.filter-check-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 220px;
  max-height: min(38vh, 360px);
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.filter-check-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0;
  padding: 0.5rem 0.55rem;
  font-size: 0.875rem;
  color: var(--text);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease;
}

.filter-check-row:hover {
  background: var(--primary-light);
}

.filter-check-row:has(input:checked) {
  background: color-mix(in srgb, var(--primary-light) 55%, transparent);
}

.filter-check-row input {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.filter-check-row .filter-product-label {
  flex: 1;
  min-width: 0;
}

.filter-check-row span:not(.filter-product-label) {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
  word-break: break-word;
}

.filter-check-list .filter-product-label .meta-code {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.filter-check-empty {
  margin: 0;
  padding: 0.5rem 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

.filter-section-flag {
  grid-column: 1 / -1;
  padding-top: 0.125rem;
}

.filter-edits-row {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin: 0;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.filter-edits-row:hover {
  border-color: var(--border-strong);
  background: var(--primary-light);
}

.filter-edits-row:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary-light) 50%, transparent);
}

.filter-edits-row input {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.filter-edits-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.filter-edits-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.filter-edits-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.filter-panel-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 1.125rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.filter-clear-all-btn {
  width: 100%;
}

.card-edits-toggle.settings-option {
  margin-top: 0.5rem;
  margin-bottom: 0;
  padding: 1.125rem 1.25rem;
  gap: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card-edits-toggle .settings-option-text {
  gap: 0.35rem;
  padding-right: 0.5rem;
}

.card-edits-toggle .theme-toggle {
  flex-shrink: 0;
}

.cards-table tbody tr.row-needs-edits {
  background: color-mix(in srgb, var(--danger-bg) 35%, transparent);
}

.cell-title-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.cell-title-text {
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.edits-needed-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 4px;
}

.btn-flag-edits.is-active {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.search-wrap {
  flex: 1;
  min-width: 160px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cards-per-page {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cards-per-page-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.cards-per-page-select {
  padding: 0.5rem 0.625rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-width: 4.25rem;
}

.cards-per-page-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

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

.btn-primary:disabled {
  opacity: 0.6;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-danger {
  background: var(--danger);
  color: var(--on-primary);
}

.btn-danger:hover {
  filter: brightness(0.92);
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0.25rem 0;
  font-family: inherit;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius);
}

.btn-icon:hover {
  color: var(--text);
  background: var(--bg);
}

/* Table */

.table-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

.cards-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.cards-pagination-end {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.cards-pagination-info {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.cards-pagination-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--table-font-size);
  transition: font-size 0.2s ease;
}

.app-table th,
.app-table td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  transition:
    padding 0.2s ease,
    font-size 0.2s ease;
}

.cards-table th,
.cards-table td {
  padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
  vertical-align: top;
}

.cards-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--table-head-font-size);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  border-radius: 4px;
}

.th-sort:hover {
  color: var(--text);
}

.th-sort:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.th-sort.sort-asc,
.th-sort.sort-desc {
  color: var(--primary);
}

.sort-indicator::after {
  display: inline-block;
  font-size: 0.625rem;
  opacity: 0.35;
  margin-left: 0.1rem;
}

.th-sort.sort-asc .sort-indicator::after {
  content: '▲';
  opacity: 1;
}

.th-sort.sort-desc .sort-indicator::after {
  content: '▼';
  opacity: 1;
}

.cards-table tbody tr:hover {
  background: var(--row-hover);
}

.cards-table tbody tr:last-child td {
  border-bottom: none;
}

.cards-table td {
  max-width: 280px;
}

.cards-table .col-thumb,
.cards-table .cell-thumb {
  width: var(--table-thumb-col-width);
  max-width: var(--table-thumb-col-width);
  padding-right: 0.5rem;
  transition: width 0.2s ease, max-width 0.2s ease;
}

.cards-table .col-actions,
.cards-table .cell-actions,
.meta-table .col-actions,
.meta-table .cell-actions {
  width: 1%;
  max-width: none;
  white-space: nowrap;
  vertical-align: middle;
}

.cell-thumb {
  vertical-align: middle;
}

.thumb-zoom {
  position: relative;
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 4px;
  line-height: 0;
}

.thumb-zoom:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.thumb-img {
  display: block;
  width: var(--table-thumb-width);
  height: var(--table-thumb-height);
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: width 0.2s ease, height 0.2s ease;
}

.thumb-zoom-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--thumb-overlay);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.thumb-zoom:hover .thumb-zoom-overlay,
.thumb-zoom:focus-visible .thumb-zoom-overlay {
  opacity: 1;
}

.thumb-zoom-icon {
  width: 22px;
  height: 22px;
  color: var(--on-primary);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

/* Cursor-following hover preview */

.thumb-hover-preview {
  position: fixed;
  z-index: 2;
  width: var(--hover-preview-width, 220px);
  max-width: min(var(--hover-preview-width, 220px), calc(100vw - 16px));
  aspect-ratio: var(--card-aspect);
  pointer-events: none;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity 0.15s ease,
    width 0.2s ease,
    transform 0.15s ease;
}

.thumb-hover-preview.preview-small {
  --hover-preview-width: 150px;
}

.thumb-hover-preview.preview-medium {
  --hover-preview-width: 220px;
}

.thumb-hover-preview.preview-large {
  --hover-preview-width: 320px;
}

.thumb-hover-preview.is-visible {
  opacity: 1;
  transform: scale(1);
}

.thumb-hover-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--table-thumb-width);
  height: var(--table-thumb-height);
  border-radius: 4px;
  transition: width 0.2s ease, height 0.2s ease;
  border: 1px dashed var(--border-strong);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.625rem;
  text-align: center;
  line-height: 1.2;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: var(--table-row-actions-gap);
  transition: gap 0.2s ease;
}

.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--table-action-btn-size);
  height: var(--table-action-btn-size);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition:
    width 0.2s ease,
    height 0.2s ease,
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.btn-icon-action .action-icon {
  width: var(--table-action-icon-size);
  height: var(--table-action-icon-size);
  transition: width 0.2s ease, height 0.2s ease;
}

.btn-edit {
  color: var(--text-muted);
}

.btn-edit:hover,
.btn-edit:focus-visible {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
  outline: none;
}

.btn-delete {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.btn-delete:hover,
.btn-delete:focus-visible {
  color: var(--on-primary);
  background: var(--danger);
  border-color: var(--danger);
  outline: none;
}

.cell-title {
  font-weight: 500;
  color: var(--text);
}

.cell-muted {
  color: var(--text-muted);
  white-space: nowrap;
}

.cell-expansion {
  white-space: nowrap;
}

.cell-expansion .meta-code {
  display: inline-block;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.cell-truncate {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin: 0;
}

/* Modal */

.modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(920px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  color: var(--text);
}

.modal::backdrop {
  background: var(--overlay);
}

.modal-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr var(--upload-width);
  grid-template-rows: auto;
  align-items: start;
  gap: 1.5rem;
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

@media (max-width: 640px) {
  .modal-body {
    grid-template-columns: 1fr;
  }

  .modal-upload {
    order: -1;
  }

  .upload-zone {
    max-width: 200px;
    margin: 0 auto;
  }
}

.modal-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.field-optional {
  font-weight: 400;
  opacity: 0.85;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.field textarea {
  resize: vertical;
  min-height: 4rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.modal-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: start;
  flex-shrink: 0;
}

.upload-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  align-self: flex-start;
}

.upload-zone {
  width: var(--upload-width);
  height: auto;
  aspect-ratio: var(--card-aspect);
  flex-shrink: 0;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
}

.upload-zone:hover,
.upload-zone:focus-visible,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  outline: none;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  pointer-events: none;
}

.upload-icon {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.upload-text {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
}

.upload-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.ocr-hint {
  margin-top: 0.5rem;
  max-width: 160px;
  line-height: 1.35;
}

.upload-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.clear-image {
  position: absolute;
  bottom: 0.35rem;
  right: 0.35rem;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  z-index: 1;
}

.ocr-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.ocr-status.loading {
  color: var(--primary);
}

.ocr-status.success {
  color: var(--success);
  background: var(--success-bg);
}

.ocr-status.error {
  color: var(--danger);
  background: var(--danger-bg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Confirm dialog */

.confirm-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(400px, calc(100vw - 2rem));
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  color: var(--text);
}

.confirm-dialog::backdrop {
  background: var(--overlay);
}

.confirm-dialog-inner {
  padding: 1.5rem;
}

.confirm-dialog-title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.confirm-dialog-message {
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  color: var(--text);
}

.confirm-dialog-hint {
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Image lightbox */

.image-viewer {
  border: none;
  padding: 0;
  max-width: min(96vw, 520px);
  width: max-content;
  background: transparent;
  overflow: visible;
}

.image-viewer::backdrop {
  background: var(--overlay);
}

.image-viewer-inner {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-lg);
}

.image-viewer-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
}

.image-viewer-img {
  display: block;
  max-width: min(88vw, 480px);
  max-height: min(80vh, 672px);
  width: auto;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  aspect-ratio: var(--card-aspect);
  object-fit: contain;
  background: var(--bg);
}

.image-viewer-caption {
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: center;
  color: var(--text);
}

/* Bulk Add */

.bulk-modal {
  width: min(920px, calc(100vw - 2rem));
}

.bulk-dialog-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
  color: var(--text);
}

.bulk-view {
  display: none;
  flex-direction: column;
  min-height: 0;
}

.bulk-view.bulk-view-active {
  display: flex;
  flex: 1;
  min-height: 0;
}

.bulk-view .modal-footer {
  flex-shrink: 0;
}

#bulk-view-summary.bulk-view-active {
  min-height: 0;
}

#bulk-view-summary .bulk-summary-body {
  flex: 1;
  min-height: 0;
}

.bulk-setup-body,
.bulk-processing-body,
.bulk-summary-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.bulk-intro {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.bulk-upload-zone {
  width: 100%;
  max-width: none;
  aspect-ratio: auto;
  min-height: 140px;
  margin-top: 1.25rem;
}

.bulk-file-count {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.bulk-file-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25rem 0.125rem;
}

.bulk-preview-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.bulk-preview-thumb {
  width: 100%;
  aspect-ratio: var(--card-aspect);
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  display: block;
}

.bulk-preview-name {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-processing-body {
  text-align: center;
  padding: 3rem 1.5rem;
}

.bulk-processing-text {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--text);
}

.bulk-save-progress {
  margin-top: 1.25rem;
  padding: 1.25rem 1rem;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bulk-save-progress-text {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
}

.bulk-save-progress-track {
  max-width: 100%;
}

.bulk-save-progress-detail {
  margin: 0.65rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-progress-track {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  max-width: 320px;
  margin: 0 auto;
}

.bulk-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.2s ease;
}

.bulk-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem 0;
}

.bulk-progress-label {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.bulk-status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bulk-status-badge.status-pending_review {
  background: var(--primary-light);
  color: var(--primary);
}

.bulk-status-badge.status-approved {
  background: var(--success-bg);
  color: var(--success);
}

.bulk-status-badge.status-skipped {
  background: var(--bg);
  color: var(--text-muted);
}

.bulk-status-badge.status-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.bulk-status-badge.status-edits-flagged {
  box-shadow: inset 0 0 0 1px var(--danger-border);
}

.bulk-review-edits-toggle {
  margin-top: 0.5rem;
  margin-bottom: 0;
  padding: 0.875rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bulk-stat-edits {
  color: var(--danger);
}

.bulk-review-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: auto;
  align-items: start;
  gap: 1.25rem;
  padding: 1rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

@media (max-width: 640px) {
  .bulk-review-body {
    grid-template-columns: 1fr;
  }
}

.bulk-review-image-wrap {
  display: flex;
  justify-content: center;
  align-self: start;
  width: 200px;
  flex-shrink: 0;
}

.bulk-review-image {
  display: block;
  width: 200px;
  height: auto;
  aspect-ratio: var(--card-aspect);
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.bulk-review-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.bulk-review-fields-actions {
  display: flex;
  justify-content: flex-end;
}

.bulk-batch-meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.bulk-meta-label {
  font-weight: 500;
}

.bulk-ocr-warning {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius);
}

.bulk-review-footer {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.bulk-finish-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  margin-left: auto;
}

.bulk-finish-remaining {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.bulk-finish-wrap .btn.is-inactive,
.bulk-finish-wrap .btn:disabled {
  opacity: 0.4;
}

.bulk-review-actions {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

.bulk-summary-title {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.bulk-summary-stats {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--text);
}

.bulk-stat-value {
  font-weight: 700;
  font-size: 1.25rem;
  margin-right: 0.35rem;
  color: var(--text);
}

.bulk-stat-errors {
  color: var(--danger);
}

.bulk-summary-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Settings / Preferences */

.settings-modal {
  width: min(1280px, calc(100vw - 2rem));
  padding: 0;
  color: var(--text);
}

.settings-shell {
  display: grid;
  grid-template-columns: 160px 1fr;
  min-height: 320px;
}

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

  .settings-nav {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
  }
}

.settings-nav {
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.settings-nav-heading {
  margin: 0 0 0.75rem;
  padding: 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.settings-tab {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: var(--radius);
  background: none;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text-muted);
  cursor: pointer;
}

.settings-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.settings-tab.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow);
}

.settings-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0;
}

.settings-content-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.settings-panel {
  padding: 1rem 1.25rem 1.5rem;
}

.settings-panel.hidden {
  display: none;
}

.settings-panel-title + .settings-option,
.settings-panel-title + .settings-subsection {
  border-top: 1px solid var(--border);
  padding-top: 0.875rem;
}

.settings-subsection {
  padding-top: 0;
}

.settings-subsection-title {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.backup-last-run {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.backup-last-run strong {
  color: var(--text);
  font-weight: 600;
}

.backup-hint {
  margin: 0 0 1rem;
  line-height: 1.45;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings-panel-title {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
}

.settings-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0;
}

.settings-option + .settings-option {
  border-top: 1px solid var(--border);
}

.settings-option-column {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

.density-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  width: 100%;
}

.density-option {
  display: block;
  cursor: pointer;
}

.density-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.density-option-label {
  display: block;
  padding: 0.5rem 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.density-option:hover .density-option-label {
  border-color: var(--border-strong);
  color: var(--text);
}

.density-option input:checked + .density-option-label {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary);
}

.density-option input:focus-visible + .density-option-label {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.settings-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.settings-option-label {
  font-size: 0.9375rem;
  font-weight: 500;
}

.settings-option-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.settings-users-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 0.9fr) minmax(0, 1.7fr);
  gap: 0.9rem;
}

.settings-users-list-pane {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.settings-users-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 24rem;
  overflow: auto;
  padding-right: 0.3rem;
}

.settings-user-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, var(--surface));
  color: var(--text);
  border-radius: calc(var(--radius) + 2px);
  padding: 0.62rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.15s ease, background 0.15s ease;
}

.settings-user-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 12%, transparent);
}

.settings-user-item.is-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary-light) 72%, var(--surface));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent),
    0 10px 24px color-mix(in srgb, var(--primary) 18%, transparent);
}

.settings-user-card-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.settings-user-mini-avatar {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
}

.settings-user-card-name {
  font-weight: 600;
}

.settings-user-card-username {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.settings-user-role-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.12rem 0.42rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  width: fit-content;
  background: color-mix(in srgb, var(--bg) 80%, var(--surface));
}

.settings-users-new-btn {
  width: 100%;
}

.settings-user-profile-wrap {
  background: color-mix(in srgb, var(--surface) 86%, var(--bg));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 3px);
  padding: 0.8rem;
}

.settings-user-profile-wrap.is-switching {
  animation: settings-user-panel-swap 240ms ease;
}

@keyframes settings-user-panel-swap {
  0% {
    opacity: 0.55;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-user-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.settings-user-profile-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.settings-user-avatar {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.settings-user-profile-name {
  margin: 0;
  font-size: 0.95rem;
}

.settings-user-profile-username {
  margin: 0.1rem 0 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.settings-user-section {
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.settings-user-section-title {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.settings-user-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.settings-user-status-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.settings-user-status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.35rem;
  vertical-align: middle;
  background: #2fbf71;
}

.settings-user-form .input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 0.6rem;
}

.settings-users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.settings-user-delete-btn {
  border-color: color-mix(in srgb, var(--danger, #dc3545) 50%, var(--border));
  color: color-mix(in srgb, var(--danger, #dc3545) 70%, var(--text));
}

.settings-user-delete-btn:hover {
  border-color: var(--danger, #dc3545);
}

@media (max-width: 860px) {
  .settings-users-layout {
    grid-template-columns: 1fr;
  }

  .settings-user-status-grid {
    grid-template-columns: 1fr;
  }
}

.theme-toggle {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.theme-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-toggle-track {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  width: 44px;
  height: 24px;
  padding: 0 2px;
  background: var(--border-strong);
  border-radius: 12px;
  transition: background 0.2s;
}

.theme-toggle-thumb {
  display: block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.theme-toggle input:checked + .theme-toggle-track {
  background: var(--primary);
}

.theme-toggle input:checked + .theme-toggle-track .theme-toggle-thumb {
  transform: translateX(20px);
}

.theme-toggle input:focus-visible + .theme-toggle-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Project Manager */

.meta-manager-modal {
  width: min(900px, calc(100vw - 2rem));
  padding: 0;
  color: var(--text);
}

.meta-manager-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
}

.meta-manager-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.meta-tab {
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
}

.meta-tab:hover {
  color: var(--text);
}

.meta-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.meta-manager-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.meta-panel {
  display: none;
  padding: 1rem 1.5rem 1.5rem;
}

.meta-panel.meta-panel-active {
  display: block;
}

.meta-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.meta-toolbar-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.meta-toolbar-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.meta-toolbar-filter-label {
  font-weight: 600;
  white-space: nowrap;
}

.meta-toolbar-select {
  min-width: 11rem;
  max-width: min(18rem, 100%);
  padding: 0.4rem 0.55rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.meta-toolbar-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.deck-form-product-context {
  margin-top: 0.25rem;
}

.deck-form-product-context .field-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.deck-form-product-name {
  margin: 0;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.meta-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.meta-table th,
.meta-table td {
  padding: var(--table-meta-cell-padding-y) var(--table-meta-cell-padding-x);
  vertical-align: middle;
}

.meta-table th {
  background: var(--bg);
  font-size: var(--table-head-font-size);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-table tbody tr:hover {
  background: var(--row-hover);
}

.meta-table tbody tr.is-selected {
  background: var(--primary-light);
}

.meta-table tbody tr:last-child td {
  border-bottom: none;
}

.meta-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}

.meta-code {
  font-size: var(--table-badge-font-size);
  padding: 0.15rem 0.4rem;
  transition: font-size 0.2s ease;
  background: var(--bg);
  border-radius: 4px;
  color: var(--text);
}

.meta-code-colored {
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.meta-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.meta-status-draft {
  background: var(--bg);
  color: var(--text-muted);
}

.meta-status-testing {
  background: var(--primary-light);
  color: var(--primary);
}

.meta-status-released {
  background: var(--success-bg);
  color: var(--success);
}

.meta-status-active {
  background: var(--success-bg);
  color: var(--success);
}

.meta-status-on-hold {
  background: var(--warning-bg, rgba(234, 179, 8, 0.15));
  color: var(--warning, #ca8a04);
}

.meta-status-archived {
  background: var(--bg);
  color: var(--text-muted);
}

.meta-color-swatch {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  vertical-align: middle;
}

.btn-delete-text {
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-delete-text:hover {
  background: var(--danger-bg);
}

.expansion-decks-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.expansion-decks-title {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.expansion-decks-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

#deck-form-dialog {
  width: min(440px, calc(100vw - 2rem));
}

.meta-icon-field-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.meta-icon-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--primary);
  font-size: 1.125rem;
}

.meta-icon-preview-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.meta-icon-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.meta-icon-input {
  width: 100%;
}

.meta-product-color-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.meta-product-color-preview {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.meta-product-color-input-wrap {
  flex: 1;
  min-width: 0;
}

.meta-product-color-input {
  width: 100%;
  height: 2.5rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.meta-icon-hint {
  font-size: 0.6875rem;
  color: var(--primary);
  line-height: 1.35;
  text-decoration: none;
}

.meta-icon-hint:hover {
  text-decoration: underline;
}

.meta-icon-inline {
  display: inline-block;
  width: calc(var(--table-badge-font-size) + 0.3rem);
  font-size: var(--table-badge-font-size);
  text-align: center;
  color: var(--text-muted);
  vertical-align: middle;
  transition: font-size 0.2s ease, width 0.2s ease;
}

.meta-icon-legacy {
  display: inline-block;
  vertical-align: middle;
}

.meta-form-inner {
  text-align: left;
}

.meta-form-inner .field {
  margin-bottom: 0.75rem;
}

.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.deck-type-selector {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.deck-type-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.deck-type-option:hover {
  border-color: var(--border-strong);
  background: var(--row-hover);
}

.deck-type-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.deck-type-option input[type='radio'] {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0.15rem 0 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.deck-type-option-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.deck-type-option-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.deck-type-option-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Card Similarity Scanner */

.similarity-scanner-modal {
  width: min(920px, calc(100vw - 2rem));
  padding: 0;
  color: var(--text);
}

.similarity-scanner-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
}

.similarity-scanner-header {
  align-items: flex-start;
  gap: 1rem;
}

.similarity-scanner-heading {
  min-width: 0;
  padding-right: 0.5rem;
}

.similarity-scanner-heading h2 {
  margin: 0 0 0.35rem;
}

.similarity-scanner-tagline {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 36rem;
}

.similarity-options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.similarity-options-cards {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-width: min(100%, 320px);
}

.similarity-option-card {
  flex: 1;
  min-width: 200px;
  max-width: 280px;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.similarity-option-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.similarity-option-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.similarity-option-card-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.similarity-threshold-input {
  width: 100%;
  margin: 0.15rem 0;
  accent-color: var(--primary);
}

.similarity-threshold-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.similarity-filter-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.similarity-filter-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.similarity-filter-item input {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.similarity-options-action {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  flex-shrink: 0;
}

.similarity-ignored-btn,
.similarity-run-btn {
  min-width: 7.5rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  white-space: nowrap;
}

.similarity-ignored-panel {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 0 1.5rem 1rem;
  max-height: 12rem;
  overflow-y: auto;
}

.similarity-ignored-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem 1rem;
  padding-top: 0.875rem;
  padding-bottom: 0.5rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

.similarity-ignored-panel-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.similarity-ignored-panel-hint {
  margin: 0;
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.similarity-ignored-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.similarity-ignored-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.similarity-ignored-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.similarity-ignored-pair {
  font-size: 0.875rem;
  color: var(--text);
  word-break: break-word;
}

.similarity-ignored-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.similarity-ignored-date {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.similarity-ignored-empty {
  margin: 0;
  padding: 0.5rem 0 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

.ignore-pair-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  text-align: left;
}

.ignore-pair-fields label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.ignore-pair-fields select,
.ignore-pair-fields input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.similarity-row-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-ignore-pair {
  color: var(--text-muted);
}

.btn-ignore-pair:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.similarity-scanner-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.similarity-scan-progress {
  flex-shrink: 0;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.similarity-progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.similarity-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.15s ease;
}

.similarity-progress-text {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.similarity-states {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  padding: 1.5rem;
}

.similarity-state-panel {
  margin: 0;
  max-width: 28rem;
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
}

.similarity-state-title {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.similarity-results-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.similarity-results-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.similarity-results-count {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.similarity-results-search {
  flex: 1;
  min-width: min(100%, 220px);
  max-width: 320px;
}

.similarity-results-search .search-input {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.875rem;
}

.similarity-table-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.similarity-results-table th,
.similarity-results-table td {
  padding: var(--table-cell-padding-y) var(--table-cell-padding-x);
  vertical-align: top;
}

.similarity-scanner-main:has(.similarity-results-wrap:not(.hidden)) .similarity-states,
.similarity-scanner-main:has(.similarity-scan-progress:not(.hidden)) .similarity-states {
  display: none;
}

.similarity-score-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 4px;
  white-space: nowrap;
}

.similarity-card-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.similarity-card-row + .similarity-card-row {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.similarity-card-thumb {
  flex-shrink: 0;
}

.similarity-card-thumb .thumb-zoom,
.similarity-card-thumb .thumb-placeholder {
  width: var(--table-thumb-width);
  height: var(--table-thumb-height);
}

.similarity-card-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
}

.similarity-card-title {
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}

.similarity-meta-line {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  line-height: 1.4;
}

.similarity-meta-line + .similarity-meta-line {
  margin-top: 0.35rem;
}

.similarity-card-label {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.similarity-results-table .cell-reason {
  font-size: 0.875rem;
  color: var(--text);
  max-width: 280px;
}

.similarity-results-table .cell-card-pair {
  min-width: 12rem;
}

.similarity-results-table .cell-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- App navigation --- */

.segmented-nav {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  padding: 0.2rem;
  gap: 0.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.segmented-nav-slider {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow:
    0 0 12px rgba(59, 130, 246, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
  transition:
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 0;
}

[data-theme='dark'] .segmented-nav-slider {
  box-shadow:
    0 0 18px rgba(59, 130, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.segmented-nav-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.5rem 1.35rem;
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    text-shadow 0.28s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.22s ease;
}

.segmented-nav-btn:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.segmented-nav-btn.is-active {
  color: var(--primary);
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.45);
}

.segmented-nav-btn.is-active:hover {
  transform: none;
}

.segmented-nav-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --- View transitions --- */

.view-stack {
  position: relative;
  min-height: 200px;
}

.view-panel {
  outline: none;
}

.view-panel[hidden] {
  display: none !important;
}

.view-panel.view-enter {
  animation: view-enter 0.48s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.view-panel.view-exit {
  animation: view-exit 0.38s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  position: absolute;
  inset: 0;
  width: 100%;
  pointer-events: none;
}

.view-panel.view-forward.view-enter {
  --view-enter-y: 12px;
}

.view-panel.view-back.view-enter {
  --view-enter-y: -12px;
}

.view-panel.view-forward.view-exit {
  --view-exit-y: -10px;
}

.view-panel.view-back.view-exit {
  --view-exit-y: 10px;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(var(--view-enter-y, 10px));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes view-exit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(var(--view-exit-y, -8px));
  }
}

/* --- Ideas view --- */

.ideas-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: min(88vh, 920px);
}

.ideas-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.ideas-toolbar-lead {
  display: flex;
  align-items: center;
  justify-self: start;
}

.ideas-toolbar-center {
  display: flex;
  justify-content: center;
  justify-self: center;
}

.ideas-toolbar-trail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
}

.ideas-viz-nav {
  padding: 0.2rem;
  flex-shrink: 0;
  align-items: center;
}

.ideas-viz-nav .segmented-nav-btn {
  padding: 0.45rem 0.95rem;
  font-size: 0.8125rem;
}

.ideas-viz-nav-divider {
  width: 1px;
  align-self: stretch;
  margin: 0.35rem 0.25rem;
  background: var(--border);
  flex-shrink: 0;
}

.ideas-viz-cluster-btn.is-active {
  color: var(--primary);
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.45);
}

.ideas-viz-cluster-btn.is-disabled,
.ideas-viz-cluster-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.ideas-canvas-wrap.is-viz-wordcloud .ideas-zoom-controls,
.ideas-canvas-wrap.is-viz-wordcloud .ideas-conn-style-control,
.ideas-canvas-wrap.is-viz-wordcloud .ideas-map-clear-selection,
.ideas-canvas-wrap.is-viz-stickynotes .ideas-zoom-controls,
.ideas-canvas-wrap.is-viz-stickynotes .ideas-conn-style-control,
.ideas-canvas-wrap.is-viz-stickynotes .ideas-map-clear-selection,
.ideas-canvas-wrap.is-viz-cardview .ideas-zoom-controls,
.ideas-canvas-wrap.is-viz-cardview .ideas-conn-style-control,
.ideas-canvas-wrap.is-viz-cardview .ideas-map-clear-selection,
.ideas-canvas-wrap.is-viz-whiteboard .ideas-zoom-controls,
.ideas-canvas-wrap.is-viz-whiteboard .ideas-conn-style-control,
.ideas-canvas-wrap.is-viz-whiteboard .ideas-map-clear-selection {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition:
    opacity 0.35s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.ideas-viz-stack {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.ideas-viz-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.97);
  transition:
    opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.52s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.52s;
}

.ideas-viz-layer.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}

.ideas-viz-layer--neural .ideas-map-stage {
  position: absolute;
  inset: 0;
}

/* —— Sticky Notes (idea post-it piles) —— */
.ideas-viz-layer--stickynotes {
  --sticky-note-scale: 1;
  background:
    radial-gradient(ellipse 85% 50% at 50% 100%, rgba(28, 24, 18, 0.45), transparent 58%),
    radial-gradient(circle at 88% 12%, rgba(52, 44, 36, 0.3), transparent 40%),
    linear-gradient(165deg, #1c1814 0%, #2a231c 48%, #12100d 100%);
  overflow: hidden;
}

[data-theme='light'] .ideas-viz-layer--stickynotes {
  background:
    radial-gradient(ellipse 75% 45% at 50% 100%, rgba(100, 82, 58, 0.12), transparent 52%),
    linear-gradient(165deg, #d4c4a8 0%, #c4b294 45%, #b5a386 100%);
}

.ideas-viz-layer--stickynotes .idea-card-view-toolbar {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  pointer-events: auto;
}

.idea-sticky-scale-control {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.45rem 0.65rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  pointer-events: auto;
  cursor: default;
  user-select: none;
}

.idea-sticky-scale-label {
  white-space: nowrap;
  line-height: 1;
}

.idea-sticky-scale-input {
  flex: none;
  width: 5.5rem;
  height: 0.35rem;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.idea-sticky-scale-input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.idea-sticky-scale-value {
  min-width: 2.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  line-height: 1;
}

/* —— Card View (asset card piles) —— */
.ideas-viz-layer--cardview {
  background:
    radial-gradient(ellipse 90% 55% at 50% 100%, rgba(22, 18, 14, 0.5), transparent 60%),
    radial-gradient(circle at 12% 18%, rgba(48, 40, 32, 0.35), transparent 42%),
    linear-gradient(168deg, #1a1612 0%, #252018 45%, #14110e 100%);
  overflow: hidden;
}

[data-theme='light'] .ideas-viz-layer--cardview {
  background:
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(90, 72, 52, 0.15), transparent 55%),
    linear-gradient(168deg, #c9b89a 0%, #b8a484 42%, #a69378 100%);
}

.ideas-card-pile-empty {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  pointer-events: none;
}

.assets-pile-toolbar {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: auto;
}

.assets-pile-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.ideas-cardview-filter-menu {
  position: relative;
}

.ideas-cardview-filter-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(70vh, 28rem);
  z-index: 20;
}

.ideas-viz-layer--cardview.is-shift-grab {
  cursor: grab;
}

.ideas-viz-layer--cardview.is-shift-grabbing {
  cursor: grabbing;
}

.ideas-viz-layer--cardview.is-shift-grab .assets-pile-card,
.ideas-viz-layer--cardview.is-shift-grabbing .assets-pile-card {
  cursor: inherit;
}

/* —— Whiteboard (handwritten ideas + thoughts) —— */
.ideas-viz-layer--whiteboard {
  --wb-ink: #1a1a22;
  --wb-ink-muted: #2e2e3a;
  --wb-ink-hover: #0d0d14;
  --wb-highlight: rgba(255, 214, 74, 0.55);
  --wb-board: #f6f1e6;
  --wb-board-surface: #f8f3e8;
  --wb-board-edge: #c8bfb0;
  --wb-title-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  --wb-strike-glow: 0 1px 0 rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 80% at 12% 8%, rgba(40, 36, 28, 0.04), transparent 55%),
    radial-gradient(ellipse 90% 60% at 88% 92%, rgba(30, 26, 20, 0.05), transparent 50%),
    linear-gradient(175deg, #faf6ee 0%, var(--wb-board) 42%, #efe8da 100%);
}

[data-theme='light'] .ideas-viz-layer--whiteboard {
  --wb-ink: #14141c;
  --wb-ink-muted: #2a2a36;
  --wb-ink-hover: #0a0a10;
}

[data-theme='dark'] .ideas-viz-layer--whiteboard {
  --wb-ink: #f0f0f0;
  --wb-ink-muted: #a8a8a8;
  --wb-ink-hover: #ffffff;
  --wb-highlight: rgba(255, 232, 120, 0.36);
  --wb-board: #141414;
  --wb-board-surface: #1a1a1a;
  --wb-board-edge: #3a3a3a;
  --wb-title-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  --wb-strike-glow: 0 1px 2px rgba(0, 0, 0, 0.5);
  background:
    radial-gradient(ellipse 120% 80% at 12% 8%, rgba(255, 255, 255, 0.035), transparent 55%),
    radial-gradient(ellipse 90% 60% at 88% 92%, rgba(0, 0, 0, 0.4), transparent 50%),
    linear-gradient(175deg, #222222 0%, var(--wb-board) 45%, #0a0a0a 100%);
}

[data-theme='dark'] .ideas-viz-layer--whiteboard .ideas-whiteboard-toolbar {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}

[data-theme='dark'] .ideas-viz-layer--whiteboard .ideas-whiteboard-control {
  color: var(--wb-ink-muted);
}

[data-theme='dark'] .ideas-viz-layer--whiteboard .ideas-whiteboard-select {
  color: var(--wb-ink);
  border-color: color-mix(in srgb, var(--wb-board-edge) 85%, var(--border));
  background: color-mix(in srgb, var(--wb-board-surface) 90%, #050505);
}

[data-theme='dark'] .ideas-viz-layer--whiteboard .ideas-whiteboard-hint {
  color: var(--text-muted);
  opacity: 0.72;
}

[data-theme='dark'] .ideas-viz-layer--whiteboard .ideas-whiteboard-surface {
  border-color: color-mix(in srgb, var(--wb-board-edge) 75%, #505050);
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(255, 255, 255, 0.035) 27px,
      rgba(255, 255, 255, 0.035) 28px
    ),
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.025), transparent 42%),
    radial-gradient(circle at 76% 64%, rgba(0, 0, 0, 0.28), transparent 38%),
    linear-gradient(168deg, #242424 0%, var(--wb-board-surface) 55%, #101010 100%);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.05) inset,
    0 18px 42px rgba(0, 0, 0, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .ideas-viz-layer--whiteboard .ideas-whiteboard-surface::before {
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M8 40 Q20 36 28 44' fill='none' stroke='%23909090' stroke-width='0.6' opacity='0.2'/%3E%3Cpath d='M70 90 Q82 86 94 92' fill='none' stroke='%23909090' stroke-width='0.5' opacity='0.16'/%3E%3C/svg%3E");
}

.ideas-whiteboard-toolbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1.25rem;
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  background: color-mix(in srgb, var(--wb-board) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--wb-board-edge) 55%, transparent);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(20, 16, 10, 0.06);
}

.ideas-whiteboard-content {
  max-width: 52rem;
  margin: 0 auto;
}

.ideas-whiteboard-hint {
  margin: 0 0 0.5rem;
  padding: 0 0.5rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  color: var(--text-muted);
  opacity: 0.78;
  letter-spacing: 0.01em;
  user-select: none;
  pointer-events: none;
}

/* Fullscreen: clear centered viz nav + corner filter/actions */
.ideas-canvas-wrap.is-fullscreen,
.ideas-canvas-wrap.is-immersive-fullscreen {
  --ideas-fs-chrome: 3.75rem;
}

.ideas-canvas-wrap.is-fullscreen.is-viz-whiteboard,
.ideas-canvas-wrap.is-immersive-fullscreen.is-viz-whiteboard {
  --wb-content-max: min(96vw, 90rem);
}

.ideas-canvas-wrap.is-fullscreen.is-viz-whiteboard .ideas-whiteboard-scroll,
.ideas-canvas-wrap.is-immersive-fullscreen.is-viz-whiteboard .ideas-whiteboard-scroll {
  padding-left: clamp(1rem, 2.5vw, 2.5rem);
  padding-right: clamp(1rem, 2.5vw, 2.5rem);
}

.ideas-canvas-wrap.is-fullscreen.is-viz-whiteboard .ideas-whiteboard-content,
.ideas-canvas-wrap.is-immersive-fullscreen.is-viz-whiteboard .ideas-whiteboard-content {
  max-width: var(--wb-content-max);
  margin-top: var(--ideas-fs-chrome);
}

.ideas-canvas-wrap.is-fullscreen.is-viz-whiteboard .ideas-whiteboard-surface,
.ideas-canvas-wrap.is-immersive-fullscreen.is-viz-whiteboard .ideas-whiteboard-surface {
  padding: 1.5rem clamp(1.25rem, 2.5vw, 2.75rem) 2.75rem;
}

.ideas-canvas-wrap.is-fullscreen.is-viz-whiteboard .wb-section-ideas,
.ideas-canvas-wrap.is-immersive-fullscreen.is-viz-whiteboard .wb-section-ideas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 2.5rem;
  align-items: start;
}

@media (max-width: 820px) {
  .ideas-canvas-wrap.is-fullscreen.is-viz-whiteboard .wb-section-ideas,
  .ideas-canvas-wrap.is-immersive-fullscreen.is-viz-whiteboard .wb-section-ideas {
    grid-template-columns: 1fr;
  }
}

.ideas-canvas-wrap.is-fullscreen.is-viz-whiteboard .ideas-whiteboard-toolbar,
.ideas-canvas-wrap.is-immersive-fullscreen.is-viz-whiteboard .ideas-whiteboard-toolbar {
  top: calc(var(--ideas-fs-chrome) - 0.1rem);
}

/* Sticky Notes + Card View — drop controls below fullscreen chrome */
.ideas-canvas-wrap.is-fullscreen.is-viz-stickynotes .ideas-viz-layer--stickynotes .idea-card-view-toolbar,
.ideas-canvas-wrap.is-immersive-fullscreen.is-viz-stickynotes .ideas-viz-layer--stickynotes .idea-card-view-toolbar,
.ideas-canvas-wrap.is-fullscreen.is-viz-cardview .assets-pile-toolbar,
.ideas-canvas-wrap.is-immersive-fullscreen.is-viz-cardview .assets-pile-toolbar {
  top: var(--ideas-fs-chrome);
}

.ideas-whiteboard-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: default;
}

.ideas-whiteboard-control-label {
  white-space: nowrap;
}

.ideas-whiteboard-select {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--wb-board-edge) 80%, var(--border));
  background: color-mix(in srgb, #fff 72%, var(--wb-board));
  color: var(--text);
  cursor: pointer;
}

.ideas-whiteboard-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1rem 1.25rem 2rem;
}

.ideas-whiteboard-surface {
  position: relative;
  margin: 0;
  padding: 1.35rem 1.5rem 2.5rem;
  border: 2px solid color-mix(in srgb, var(--wb-board-edge) 70%, #9a9080);
  border-radius: 4px;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(120, 108, 88, 0.045) 27px,
      rgba(120, 108, 88, 0.045) 28px
    ),
    radial-gradient(circle at 18% 22%, rgba(80, 70, 55, 0.04), transparent 42%),
    radial-gradient(circle at 76% 64%, rgba(60, 52, 40, 0.035), transparent 38%),
    linear-gradient(168deg, #fcf9f2 0%, var(--wb-board-surface) 55%, #f3ece0 100%);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.65) inset,
    0 18px 42px rgba(28, 22, 14, 0.12),
    0 4px 12px rgba(28, 22, 14, 0.08);
}

.ideas-whiteboard-surface::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M8 40 Q20 36 28 44' fill='none' stroke='%238a7f6c' stroke-width='0.6' opacity='0.25'/%3E%3Cpath d='M70 90 Q82 86 94 92' fill='none' stroke='%238a7f6c' stroke-width='0.5' opacity='0.2'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

.ideas-whiteboard-empty {
  margin: 2rem 0;
  text-align: center;
  font-family: 'Caveat', 'Segoe Print', cursive;
  font-size: 1.35rem;
  color: var(--wb-ink-muted);
  opacity: 0.75;
}

.wb-section + .wb-section {
  margin-top: 2rem;
  padding-top: 0.35rem;
  border-top: 1px dashed color-mix(in srgb, var(--wb-board-edge) 55%, transparent);
}

.wb-section-title {
  margin: 0 0 1rem;
  font-family: 'Permanent Marker', 'Caveat', cursive;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--wb-ink);
  transform: rotate(var(--wb-rot, 0deg));
  text-shadow: var(--wb-title-shadow);
  letter-spacing: 0.02em;
}

.wb-section-ideas {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.wb-idea {
  transform: rotate(var(--wb-rot, 0deg));
  break-inside: avoid;
  min-width: 0;
}

.wb-idea-heading {
  position: relative;
  display: inline-block;
  margin: 0;
  padding: 0.1rem 0.15rem;
  border: none;
  background: transparent;
  font-family: 'Permanent Marker', 'Caveat', cursive;
  font-size: clamp(1.15rem, 2.1vw, 1.45rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--wb-ink);
  text-align: left;
  cursor: pointer;
  letter-spacing: 0.015em;
  text-shadow:
    0.4px 0.4px 0 color-mix(in srgb, var(--wb-ink) 92%, transparent),
    -0.25px 0.25px 0 color-mix(in srgb, var(--wb-ink) 40%, transparent);
  transition:
    color 0.15s ease,
    text-shadow 0.15s ease,
    background-size 0.2s ease;
  background-image: linear-gradient(var(--wb-highlight), var(--wb-highlight));
  background-repeat: no-repeat;
  background-position: 0 88%;
  background-size: 0 38%;
}

.wb-idea-heading:hover,
.wb-idea-heading:focus-visible {
  color: var(--wb-ink-hover);
  background-size: 100% 38%;
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent);
  border-radius: 2px;
}

.wb-thoughts {
  margin: 0.35rem 0 0;
  padding: 0 0 0 1.35rem;
  list-style: none;
}

.wb-thought-item {
  margin: 0.2rem 0;
  transform: rotate(var(--wb-rot, 0deg));
}

.wb-thought-line {
  position: relative;
  display: inline-block;
  margin: 0;
  padding: 0.05rem 0.1rem;
  border: none;
  background: transparent;
  font-family: 'Caveat', 'Segoe Print', cursive;
  font-size: clamp(1rem, 1.65vw, 1.2rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--wb-ink-muted);
  text-align: left;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-size 0.2s ease;
  background-image: linear-gradient(var(--wb-highlight), var(--wb-highlight));
  background-repeat: no-repeat;
  background-position: 0 92%;
  background-size: 0 32%;
}

.wb-thought-line::before {
  content: '– ';
  opacity: 0.85;
}

.wb-thought-line:hover,
.wb-thought-line:focus-visible {
  color: var(--wb-ink);
  background-size: 100% 32%;
  outline: none;
}

.wb-thought-line:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 2px;
}

/* Marker strike-through (click to toggle; Shift+click edits) */
.wb-idea-heading.is-wb-struck,
.wb-thought-line.is-wb-struck {
  opacity: 0.58;
}

.wb-idea-heading.is-wb-struck::after,
.wb-thought-line.is-wb-struck::after {
  content: '';
  position: absolute;
  left: -0.05em;
  right: -0.05em;
  top: 50%;
  height: 0.14em;
  min-height: 2px;
  max-height: 4px;
  margin-top: -0.07em;
  background: var(--wb-ink);
  opacity: 0.78;
  transform: rotate(-2.5deg);
  border-radius: 2px;
  pointer-events: none;
  box-shadow: var(--wb-strike-glow);
}

.wb-idea-heading.is-wb-struck:hover,
.wb-idea-heading.is-wb-struck:focus-visible,
.wb-thought-line.is-wb-struck:hover,
.wb-thought-line.is-wb-struck:focus-visible {
  opacity: 0.72;
}

.assets-pile-card.is-shift-dragging {
  cursor: grabbing;
}

.assets-pile-restack-btn {
  box-shadow: var(--shadow);
}

.assets-pile-toolbar-hint {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.assets-pile-toolbar-hint--mobile,
.ideas-whiteboard-hint--mobile {
  display: none;
}

.assets-pile-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.assets-pile-cluster-label {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-align: center;
  user-select: none;
}

.assets-pile-cluster-name {
  font-family: var(--font);
  font-size: clamp(1.1rem, 2.4vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 12%, transparent);
}

.assets-pile-cluster-count {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text-muted) 70%, transparent);
}

.assets-pile-table {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.assets-pile-card {
  position: absolute;
  left: 0;
  top: 0;
  width: 68px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: grab;
  transform-origin: center center;
  will-change: transform;
  transition:
    box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.28s ease;
  touch-action: none;
  user-select: none;
}

.assets-pile-card-frame {
  --assets-pile-crop: 5px;
  display: block;
  width: 100%;
  aspect-ratio: var(--card-aspect);
  border-radius: 5px;
  overflow: hidden;
  background: #1a1d26;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 8px 18px rgba(0, 0, 0, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.35);
}

.assets-pile-card-art {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.assets-pile-card-img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(100% + 2 * var(--assets-pile-crop, 5px));
  height: calc(100% + 2 * var(--assets-pile-crop, 5px));
  max-width: none;
  max-height: none;
  transform: translate(-50%, -50%);
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.assets-pile-card-img.is-loaded {
  opacity: 1;
}

.assets-pile-card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  text-align: center;
  font-family: var(--font);
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.88);
  background: linear-gradient(145deg, #2a3142 0%, #1a2030 100%);
}

.assets-pile-card-placeholder.is-hidden {
  display: none;
}

.assets-pile-card-caption {
  display: block;
  margin-top: 0.15rem;
  max-width: 100%;
  font-family: var(--font);
  font-size: 0.4375rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assets-pile-card:hover:not(.is-inspecting) .assets-pile-card-frame {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 14px 28px rgba(0, 0, 0, 0.52),
    0 0 18px rgba(96, 165, 250, 0.28);
  filter: brightness(1.08) saturate(1.06);
}

.assets-pile-card.is-inspecting {
  cursor: grabbing;
}

.assets-pile-card.is-inspecting .assets-pile-card-frame {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 24px 48px rgba(0, 0, 0, 0.58),
    0 0 32px rgba(96, 165, 250, 0.4);
  filter: brightness(1.1) saturate(1.1);
}

.assets-pile-card.is-culled {
  visibility: hidden;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .assets-pile-card {
    transition: none;
  }
  .assets-pile-card-img {
    transition: none;
  }
}

/* Legacy sticky-note styles (unused) */
.idea-card-view-toolbar {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  pointer-events: auto;
}

.idea-card-view-cluster-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.idea-card-view-cluster-caption {
  white-space: nowrap;
}

.idea-card-view-cluster-select {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-elevated, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2rem 0.45rem;
  cursor: pointer;
}

.idea-card-view-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.idea-card-view-cluster-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font);
  font-size: clamp(1.5rem, 3.2vw, 2.75rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 8%, transparent);
  white-space: nowrap;
  user-select: none;
}

.idea-card-view-table {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.idea-table-card {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(118px * var(--sticky-note-scale, 1));
  min-height: calc(118px * var(--sticky-note-scale, 1));
  margin: 0;
  padding: calc(0.7rem * var(--sticky-note-scale, 1)) calc(0.55rem * var(--sticky-note-scale, 1))
    calc(0.85rem * var(--sticky-note-scale, 1));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(0.22rem * var(--sticky-note-scale, 1));
  text-align: left;
  font-family: "Segoe Print", "Bradley Hand", "Apple Chancery", cursive, var(--font);
  font-weight: 700;
  color: hsl(var(--idea-hue, 48), 32%, 14%);
  background: linear-gradient(
    165deg,
    hsl(var(--idea-hue, 48), 94%, 84%) 0%,
    hsl(var(--idea-hue, 48), 90%, 76%) 55%,
    hsl(var(--idea-hue, 48), 86%, 71%) 100%
  );
  border: none;
  border-radius: 2px 3px 6px 2px;
  box-shadow:
    1px 2px 0 rgba(0, 0, 0, 0.06),
    3px 5px 0 rgba(0, 0, 0, 0.04),
    5px 12px 18px rgba(0, 0, 0, 0.32);
  cursor: grab;
  transform-origin: center center;
  will-change: transform;
  transition:
    box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.28s ease;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}

.idea-table-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.38) 0%,
    transparent 38%,
    transparent 72%,
    rgba(0, 0, 0, 0.04) 100%
  );
  pointer-events: none;
}

.idea-sticky-tape {
  position: absolute;
  top: calc(-6px * var(--sticky-note-scale, 1));
  left: 50%;
  z-index: 2;
  width: calc(40px * var(--sticky-note-scale, 1));
  height: calc(13px * var(--sticky-note-scale, 1));
  transform: translateX(-50%) rotate(-2deg);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.72) 0%,
    rgba(255, 255, 255, 0.38) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
  opacity: 0.92;
  pointer-events: none;
}

.idea-sticky-fold {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 calc(20px * var(--sticky-note-scale, 1)) calc(20px * var(--sticky-note-scale, 1));
  border-color: transparent transparent hsl(var(--idea-hue, 48), 55%, 58%) transparent;
  filter: drop-shadow(-1px 1px 1px rgba(0, 0, 0, 0.12));
  pointer-events: none;
}

.idea-table-card-title {
  position: relative;
  z-index: 1;
  font-size: calc(0.8125rem * var(--sticky-note-scale, 1));
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: hsl(var(--idea-hue, 48), 30%, 12%);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idea-table-card-meta {
  position: relative;
  z-index: 1;
  font-size: calc(0.65rem * var(--sticky-note-scale, 1));
  font-weight: 700;
  color: hsla(var(--idea-hue, 48), 28%, 14%, 0.82);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idea-table-card-snippet {
  position: relative;
  z-index: 1;
  font-size: calc(0.6rem * var(--sticky-note-scale, 1));
  font-weight: 700;
  line-height: 1.35;
  color: hsla(var(--idea-hue, 48), 22%, 12%, 0.78);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idea-table-card-tags {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin-top: auto;
  max-width: 100%;
}

.idea-table-card-tag {
  font-family: var(--font);
  font-size: calc(0.5rem * var(--sticky-note-scale, 1));
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.3rem;
  border-radius: 2px;
  background: hsla(var(--idea-hue, 48), 40%, 28%, 0.12);
  color: hsl(var(--idea-hue, 48), 35%, 22%);
  border: 1px solid hsla(var(--idea-hue, 48), 35%, 28%, 0.15);
}

.idea-table-card:hover:not(.is-held) {
  box-shadow:
    1px 2px 0 rgba(0, 0, 0, 0.06),
    4px 8px 0 rgba(0, 0, 0, 0.05),
    8px 20px 28px rgba(0, 0, 0, 0.38),
    0 0 20px hsla(var(--idea-hue, 48), 80%, 62%, 0.28);
  filter: brightness(1.03) saturate(1.05);
  z-index: 8000 !important;
}

.idea-table-card.is-held {
  cursor: grabbing;
  box-shadow:
    2px 4px 0 rgba(0, 0, 0, 0.08),
    10px 24px 36px rgba(0, 0, 0, 0.42),
    0 0 28px hsla(var(--idea-hue, 48), 85%, 65%, 0.38);
  filter: brightness(1.05) saturate(1.08);
}

.idea-table-card.is-culled {
  visibility: hidden;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .idea-table-card {
    transition: none;
  }
}

.ideas-word-cloud-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.ideas-word-cloud-words {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
}

.ideas-word-cloud-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 2rem;
  text-align: center;
  font-size: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.idea-cloud-word {
  position: absolute;
  left: var(--cloud-x, 0);
  top: var(--cloud-y, 0);
  margin: 0;
  padding: 0.1rem 0.2rem;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: var(--cloud-size, 16px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: hsla(217, 72%, 38%, calc(0.62 + var(--cloud-weight, 0.5) * 0.35));
  text-shadow:
    0 1px 2px rgba(255, 255, 255, 0.85),
    0 0 calc(4px + var(--cloud-glow, 0.3) * 10px) rgba(37, 99, 235, calc(0.1 + var(--cloud-glow, 0.3) * 0.22));
  cursor: pointer;
  white-space: nowrap;
  transform-origin: center center;
  animation: idea-cloud-float var(--cloud-drift, 7s) ease-in-out infinite;
  transition:
    color 0.35s ease,
    text-shadow 0.35s ease,
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.38s ease,
    filter 0.35s ease;
  will-change: transform, left, top;
}

.idea-cloud-word--tag {
  color: hsla(199, 78%, 34%, calc(0.65 + var(--cloud-weight, 0.5) * 0.32));
}

.idea-cloud-word--project {
  color: hsla(258, 58%, 42%, calc(0.62 + var(--cloud-weight, 0.5) * 0.35));
}

.idea-cloud-word--title {
  color: hsla(217, 68%, 36%, calc(0.6 + var(--cloud-weight, 0.5) * 0.38));
}

.idea-cloud-word:hover,
.idea-cloud-word.is-hovered {
  transform: scale(1.12);
  z-index: 8;
  color: hsla(217, 85%, 28%, 0.98);
  text-shadow:
    0 1px 3px rgba(255, 255, 255, 0.9),
    0 0 14px rgba(37, 99, 235, 0.35);
}

.idea-cloud-word.is-related {
  color: hsla(217, 78%, 32%, 0.95);
  text-shadow:
    0 1px 2px rgba(255, 255, 255, 0.85),
    0 0 12px rgba(37, 99, 235, 0.28);
}

.idea-cloud-word.is-active {
  transform: scale(1.16);
  z-index: 10;
  color: hsl(217, 88%, 24%);
  text-shadow:
    0 1px 3px rgba(255, 255, 255, 0.95),
    0 0 18px rgba(37, 99, 235, 0.42);
}

[data-theme='dark'] .idea-cloud-word {
  color: hsla(214, 88%, 72%, calc(0.42 + var(--cloud-weight, 0.5) * 0.55));
  text-shadow:
    0 0 calc(6px + var(--cloud-glow, 0.3) * 18px) rgba(96, 165, 250, calc(0.25 + var(--cloud-glow, 0.3) * 0.55)),
    0 0 calc(20px + var(--cloud-glow, 0.3) * 32px) rgba(59, 130, 246, calc(0.08 + var(--cloud-glow, 0.3) * 0.2));
}

[data-theme='dark'] .idea-cloud-word--tag {
  color: hsla(199, 92%, 74%, calc(0.5 + var(--cloud-weight, 0.5) * 0.5));
}

[data-theme='dark'] .idea-cloud-word--project {
  color: hsla(258, 78%, 78%, calc(0.48 + var(--cloud-weight, 0.5) * 0.52));
}

[data-theme='dark'] .idea-cloud-word--title {
  color: hsla(214, 85%, 70%, calc(0.45 + var(--cloud-weight, 0.5) * 0.55));
}

[data-theme='dark'] .idea-cloud-word:hover,
[data-theme='dark'] .idea-cloud-word.is-hovered {
  color: hsla(204, 100%, 88%, 0.98);
  text-shadow:
    0 0 16px rgba(147, 197, 253, 0.75),
    0 0 36px rgba(59, 130, 246, 0.45);
}

[data-theme='dark'] .idea-cloud-word.is-related {
  color: hsla(204, 90%, 80%, 0.92);
  text-shadow:
    0 0 14px rgba(129, 180, 255, 0.55),
    0 0 28px rgba(59, 130, 246, 0.28);
}

[data-theme='dark'] .idea-cloud-word.is-active {
  color: #fff;
  text-shadow:
    0 0 20px rgba(191, 219, 254, 0.9),
    0 0 44px rgba(59, 130, 246, 0.55);
}

.idea-cloud-word.is-dimmed {
  opacity: 0.22;
  filter: saturate(0.45);
}

.idea-cloud-word--enter {
  animation:
    idea-cloud-float var(--cloud-drift, 7s) ease-in-out infinite,
    idea-cloud-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.idea-cloud-word--exit {
  animation: idea-cloud-exit 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.idea-cloud-word--deleting {
  animation: idea-cloud-delete calc(0.34s + var(--delete-power, 1) * 0.12s)
    cubic-bezier(0.34, 1.15, 0.48, 1) forwards;
  pointer-events: none;
  z-index: 12;
}

.idea-cloud-word--delete-nudge {
  animation: idea-cloud-delete-nudge 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes idea-cloud-delete-nudge {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  40% {
    transform: scale(1.06);
    filter: brightness(1.2);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes idea-cloud-float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -1px;
  }
}

@keyframes idea-cloud-enter {
  from {
    opacity: 0;
    transform: scale(0.72);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes idea-cloud-exit {
  to {
    opacity: 0;
    transform: scale(0.85);
    filter: blur(3px);
  }
}

@keyframes idea-cloud-delete {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0) brightness(1);
  }
  18% {
    transform: scale(calc(1.06 + var(--delete-power, 1) * 0.08));
    filter: blur(0) brightness(calc(1.3 + var(--delete-power, 1) * 0.35));
    text-shadow:
      0 0 calc(18px + var(--delete-power, 1) * 24px) rgba(191, 219, 254, 0.85),
      0 0 calc(40px + var(--delete-power, 1) * 36px) rgba(59, 130, 246, 0.5);
  }
  38% {
    transform: scale(calc(1.12 + var(--delete-power, 1) * 0.1));
    filter: blur(0.5px) brightness(1.5);
  }
  55% {
    opacity: 0.7;
    transform: scale(0.6);
    filter: blur(2px);
  }
  100% {
    opacity: 0;
    transform: scale(0.15);
    filter: blur(calc(6px + var(--delete-power, 1) * 2px));
  }
}

.ideas-word-cloud-panel {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 6;
  width: min(300px, calc(100% - 2rem));
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

[data-theme='dark'] .ideas-word-cloud-panel {
  border-color: rgba(96, 165, 250, 0.22);
  background: rgba(15, 18, 24, 0.82);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    0 0 24px rgba(59, 130, 246, 0.12);
}

.ideas-word-cloud-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.ideas-word-cloud-panel-label {
  margin: 0 0 0.15rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ideas-word-cloud-panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.ideas-word-cloud-panel-count {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ideas-word-cloud-panel-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(28vh, 200px);
  overflow-y: auto;
  margin-bottom: 0.65rem;
}

.ideas-word-cloud-idea-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border: none;
  border-radius: var(--radius);
  background: var(--primary-light);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.ideas-word-cloud-idea-link:hover {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--primary);
}

[data-theme='dark'] .ideas-word-cloud-idea-link {
  background: rgba(96, 165, 250, 0.08);
}

[data-theme='dark'] .ideas-word-cloud-idea-link:hover {
  background: rgba(96, 165, 250, 0.18);
}

.ideas-word-cloud-panel-foot {
  display: flex;
  justify-content: flex-end;
}

.idea-node--cloud-match {
  z-index: 11;
  filter: saturate(1.15);
  box-shadow:
    0 0 28px hsla(var(--idea-hue, 220), 78%, 58%, 0.65),
    0 0 52px hsla(var(--idea-hue, 220), 70%, 50%, 0.28);
}

.idea-node--cloud-dim {
  opacity: 0.28 !important;
  filter: saturate(0.35);
}

.ideas-canvas-wrap.is-cluster-mode .ideas-particles-canvas {
  opacity: 0.7;
}

.idea-cluster-halo {
  fill: rgba(96, 165, 250, 0.04);
  stroke: rgba(96, 165, 250, 0.14);
  stroke-width: 1;
  stroke-dasharray: 6 8;
  animation: cluster-halo-pulse 4s ease-in-out infinite;
}

[data-theme='dark'] .idea-cluster-halo {
  fill: rgba(96, 165, 250, 0.06);
  stroke: rgba(147, 197, 253, 0.2);
}

.idea-cluster-label {
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--text);
  stroke: color-mix(in srgb, var(--surface) 88%, transparent);
  stroke-width: 4px;
  stroke-linejoin: round;
  paint-order: stroke fill;
  pointer-events: none;
}

[data-theme='dark'] .idea-cluster-label {
  fill: #eef2f8;
  stroke: color-mix(in srgb, #060a12 82%, transparent);
}

@keyframes cluster-halo-pulse {
  0%,
  100% {
    stroke-opacity: 0.7;
  }
  50% {
    stroke-opacity: 1;
  }
}

.ideas-filter-panel {
  min-width: 280px;
  width: min(360px, calc(100vw - 1.5rem));
}

.ideas-filter-mount--fullscreen .ideas-filter-panel {
  z-index: 210;
  width: min(380px, calc(100vw - 2.5rem));
}

.ideas-filter-panel-body {
  grid-template-columns: 1fr;
}

.ideas-filter-tag-list {
  min-height: 100px;
  max-height: min(36vh, 280px);
}

.ideas-filter-density-list {
  min-height: 0;
}

.ideas-filter-tag-label {
  font-weight: 500;
}

.ideas-filter-density-row {
  align-items: flex-start;
}

.ideas-filter-density-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.ideas-filter-density-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.2rem;
  box-shadow: 0 0 8px currentColor;
}

.ideas-filter-density-row .ideas-filter-density-label-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.45rem;
  row-gap: 0.05rem;
}

.ideas-filter-density-swatch {
  grid-row: 1 / span 2;
  align-self: center;
  margin-top: 0;
}

.ideas-filter-density-label {
  font-weight: 600;
  color: var(--text);
}

.ideas-filter-density-hint {
  grid-column: 2;
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.ideas-filter-density-swatch--spark {
  color: hsla(214, 75%, 62%, 0.55);
  background: hsla(214, 70%, 58%, 0.35);
}

.ideas-filter-density-swatch--growing {
  color: hsla(214, 82%, 65%, 0.75);
  background: hsla(214, 78%, 58%, 0.5);
}

.ideas-filter-density-swatch--rich {
  color: hsla(204, 90%, 68%, 0.95);
  background: hsla(214, 85%, 58%, 0.65);
}

.idea-node--filtered-out {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden;
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.45s;
}

.ideas-filter-empty {
  z-index: 4;
}

.ideas-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: min(82vh, 820px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(59, 130, 246, 0.06), transparent 70%),
    var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
  --ideas-parallax-x: 0px;
  --ideas-parallax-y: 0px;
}

.ideas-canvas-wrap:fullscreen,
.ideas-canvas-wrap.is-immersive-fullscreen {
  width: 100%;
  max-width: none;
  min-height: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(59, 130, 246, 0.08), transparent 70%),
    var(--surface);
}

.ideas-canvas-wrap.is-immersive-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.ideas-fullscreen-controls {
  position: absolute;
  top: 1rem;
  left: 50%;
  z-index: 7;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: max-content;
  max-width: min(calc(100% - 2rem), min(920px, calc(100vw - 2rem)));
  transform: translateX(-50%);
}

.ideas-filter-mount--fullscreen {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 7;
}

.ideas-filter-mount--fullscreen[hidden] {
  display: none !important;
}

.ideas-filter-mount--fullscreen .filter-btn {
  box-shadow: var(--shadow);
}

.ideas-fullscreen-controls[hidden] {
  display: none !important;
}

.ideas-fullscreen-viz-nav {
  flex: 0 1 auto;
  min-width: 0;
  padding: 0.18rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

.ideas-fullscreen-viz-nav .segmented-nav-btn {
  padding: 0.4rem 0.72rem;
  font-size: 0.75rem;
}

.ideas-canvas-top-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  max-width: calc(100% - 2rem);
}

.ideas-fullscreen-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.ideas-fullscreen-quick-actions[hidden] {
  display: none !important;
}

.ideas-fullscreen-quick-btn {
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.ideas-fullscreen-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.ideas-fullscreen-btn.hidden {
  display: none;
}

.ideas-fullscreen-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.ideas-fullscreen-btn.is-active {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.ideas-fullscreen-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ideas-fullscreen-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.ideas-fullscreen-icon--exit {
  display: none;
}

.ideas-fullscreen-btn.is-active .ideas-fullscreen-icon--enter {
  display: none;
}

.ideas-fullscreen-btn.is-active .ideas-fullscreen-icon--exit {
  display: block;
}

.ideas-map-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.ideas-map-clear-selection {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  z-index: 7;
  transform: translateX(-50%);
  padding: 0.45rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.3s;
}

.ideas-map-clear-selection.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px);
}

.ideas-map-clear-selection:not(.hidden):hover {
  transform: translateX(-50%) translateY(-1px);
}

.ideas-map-bottom-controls {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  width: min(100% - 2rem, 220px);
  max-width: min(100% - 2rem, 220px);
}

.ideas-cluster-settings-control {
  width: 100%;
}

.ideas-cluster-settings-control.hidden {
  display: none;
}

.ideas-cluster-settings-pill {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-sizing: border-box;
  width: 100%;
  padding: 0.55rem 0.75rem 0.65rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.ideas-cluster-settings-heading {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
}

.ideas-cluster-spacing {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: auto;
  margin: 0;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: default;
  user-select: none;
}

.ideas-cluster-spacing-label {
  line-height: 1;
  white-space: nowrap;
}

.ideas-cluster-spacing-input {
  flex: none;
  width: 4.25rem;
  height: 0.35rem;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.ideas-cluster-spacing-input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ideas-cluster-spacing-value {
  min-width: 2.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  line-height: 1;
}

.ideas-conn-style-control {
  position: static;
  width: 100%;
}

.ideas-conn-style-control.hidden {
  display: none;
}

.ideas-conn-settings-pill {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-sizing: border-box;
  width: 100%;
  padding: 0.55rem 0.75rem 0.65rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.ideas-conn-settings-heading {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
}

.ideas-conn-settings-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}

.ideas-conn-opacity {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: auto;
  margin: 0;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: default;
  user-select: none;
}

.ideas-conn-opacity-label {
  line-height: 1;
  white-space: nowrap;
}

.ideas-conn-opacity-input {
  flex: none;
  width: 4.25rem;
  height: 0.35rem;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.ideas-conn-opacity-input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ideas-conn-opacity-value {
  min-width: 2.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  line-height: 1;
}

.ideas-conn-dotted-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.ideas-conn-dotted-toggle:hover {
  color: var(--text);
  background: var(--row-hover);
}

.ideas-conn-dotted-toggle.is-active {
  color: var(--primary);
  background: var(--primary-light);
}

.ideas-conn-dotted-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ideas-conn-dotted-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.ideas-conn-dotted-icon line {
  stroke-dasharray: 4 4;
  transition: stroke-dasharray 0.2s ease;
}

.ideas-conn-dotted-toggle.is-active .ideas-conn-dotted-icon line {
  stroke-dasharray: none;
}

.ideas-conn-dotted-label {
  line-height: 1;
  user-select: none;
}

.ideas-zoom-controls {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ideas-zoom-btn {
  min-width: 2.1rem;
  padding: 0.35rem 0.55rem;
  font-size: 1.05rem;
  line-height: 1;
  font-weight: 600;
}

.ideas-zoom-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ideas-zoom-label {
  min-width: 2.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  user-select: none;
}

.ideas-canvas-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(96, 165, 250, 0.04), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(129, 140, 248, 0.05), transparent 40%);
  transform: translate(calc(var(--ideas-parallax-x) * -0.25), calc(var(--ideas-parallax-y) * -0.25));
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme='dark'] .ideas-canvas-wrap {
  background:
    radial-gradient(ellipse 70% 55% at 50% 35%, rgba(59, 130, 246, 0.14), transparent 65%),
    linear-gradient(180deg, #141824 0%, #0f1218 100%);
}

[data-theme='dark'] .ideas-canvas-wrap::before {
  background:
    radial-gradient(circle at 25% 25%, rgba(96, 165, 250, 0.08), transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(167, 139, 250, 0.06), transparent 45%);
}

.ideas-particles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  transform: translate(var(--ideas-parallax-x), var(--ideas-parallax-y));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ideas-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.idea-connection-line {
  stroke: hsla(214, 88%, 62%, var(--conn-opacity, 0.5));
  stroke-linecap: round;
  stroke-dasharray: none;
  stroke-dashoffset: 0;
  filter: drop-shadow(
    0 0 calc(3px + var(--conn-opacity, 0.5) * 4px)
    hsla(214, 90%, 65%, calc(var(--conn-opacity, 0.5) * 0.45))
  );
  animation: connection-pulse 3.5s ease-in-out infinite;
  transition:
    stroke 0.35s ease,
    filter 0.35s ease;
}

[data-theme='light'] .idea-connection-line {
  stroke: hsla(214, 72%, 42%, var(--conn-opacity, 0.45));
  filter: drop-shadow(
    0 0 calc(2px + var(--conn-opacity, 0.45) * 3px)
    hsla(214, 70%, 40%, calc(var(--conn-opacity, 0.45) * 0.35))
  );
}

.idea-connection-line.is-strong {
  stroke: hsla(204, 95%, 72%, var(--conn-opacity, 0.65));
  filter: drop-shadow(
    0 0 calc(5px + var(--conn-opacity, 0.65) * 6px)
    hsla(204, 95%, 70%, calc(var(--conn-opacity, 0.65) * 0.55))
  );
}

[data-theme='light'] .idea-connection-line.is-strong {
  stroke: hsla(214, 78%, 38%, var(--conn-opacity, 0.62));
}

.idea-connection-line--dying {
  stroke: hsla(214, 88%, 68%, var(--conn-opacity, 0.55));
  stroke-dasharray: none;
  animation: none;
  transition: none;
  filter: drop-shadow(0 0 5px hsla(214, 85%, 65%, calc(var(--conn-opacity, 0.5) * 0.5)));
}

.idea-connection-line.is-hot {
  stroke: hsla(200, 100%, 78%, calc(var(--conn-opacity, 0.5) * 1.15));
  animation-duration: 2s;
  filter: drop-shadow(
    0 0 calc(6px + var(--conn-opacity, 0.5) * 8px)
    hsla(200, 100%, 75%, calc(var(--conn-opacity, 0.5) * 0.65))
  );
}

@keyframes connection-pulse {
  0%,
  100% {
    stroke-opacity: calc(var(--conn-opacity, 0.5) * 0.92);
  }
  50% {
    stroke-opacity: calc(var(--conn-opacity, 0.5) * 1.08);
  }
}

/* Optional dotted links (toolbar: Dotted) — same weight/glow as solid */
.ideas-canvas-wrap.is-conn-dotted .idea-connection-line {
  stroke-dasharray: 7 11;
  stroke-dashoffset: var(--conn-dash, 0);
}

.ideas-canvas-wrap.is-conn-dotted .idea-connection-line.is-strong {
  stroke-dasharray: 9 8;
}

.ideas-canvas-wrap.is-conn-dotted .idea-connection-line.is-hot,
.ideas-canvas-wrap.is-conn-dotted .idea-connection-line--dying {
  stroke-dasharray: none;
}

.ideas-canvas {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.ideas-canvas.is-empty {
  pointer-events: none;
}

.ideas-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 2rem;
  text-align: center;
  font-size: 1.05rem;
  color: var(--text-muted);
  z-index: 5;
  pointer-events: none;
}

.idea-node {
  position: absolute;
  width: var(--idea-node-size, 72px);
  height: var(--idea-node-size, 72px);
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(
    circle at 35% 30%,
    hsla(var(--idea-hue, 220), 72%, 62%, calc(0.28 + var(--idea-glow, 0.25) * 0.35)),
    hsla(var(--idea-hue, 220), 55%, 42%, 0.1) 55%,
    transparent 72%
  );
  border: 1px solid hsla(var(--idea-hue, 220), 58%, 55%, calc(0.28 + var(--idea-glow, 0.2) * 0.4));
  box-shadow:
    0 0 calc(12px + var(--idea-glow, 0.3) * 28px) hsla(var(--idea-hue, 220), 72%, 52%, calc(var(--idea-glow, 0.25) * 0.55)),
    inset 0 0 calc(16px + var(--idea-glow, 0.2) * 20px) hsla(var(--idea-hue, 220), 80%, 60%, 0.08);
  transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1));
  animation: idea-node-pulse var(--idea-pulse-duration, 3.5s) ease-in-out infinite;
  transition:
    box-shadow 0.35s ease,
    border-color 0.35s ease,
    opacity 0.4s ease,
    filter 0.35s ease;
  touch-action: none;
}

.idea-node--sparse {
  opacity: 0.88;
}

.idea-node--dormant {
  opacity: 0.62;
  filter: saturate(0.7);
}

.idea-node--recent {
  animation-duration: calc(var(--idea-pulse-duration, 3.5s) * 0.85);
}

.idea-node--dense {
  border-width: 1.5px;
}

.idea-node:hover,
.idea-node:focus-visible,
.idea-node.is-dragging {
  z-index: 12;
  cursor: grabbing;
  box-shadow:
    0 0 calc(24px + var(--idea-glow, 0.3) * 36px) hsla(var(--idea-hue, 220), 78%, 58%, 0.55),
    0 0 48px hsla(var(--idea-hue, 220), 70%, 50%, 0.18),
    inset 0 0 28px hsla(var(--idea-hue, 220), 80%, 60%, 0.14);
  border-color: hsla(var(--idea-hue, 220), 72%, 62%, 0.6);
  outline: none;
}

.idea-node:hover:not(.is-dragging),
.idea-node:focus-visible {
  animation: none;
  transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1)) scale(1.1);
}

.idea-node.is-dragging {
  animation: none;
  transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1)) scale(1.08);
}

.idea-node.is-link-glow {
  box-shadow:
    0 0 calc(20px + var(--idea-glow, 0.3) * 32px) hsla(var(--idea-hue, 220), 75%, 58%, 0.5),
    0 0 40px rgba(96, 165, 250, 0.15),
    inset 0 0 24px hsla(var(--idea-hue, 220), 80%, 60%, 0.1);
}

.idea-node:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.idea-node--entering {
  animation: idea-node-grow 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.idea-node--deleting {
  animation: idea-node-delete calc(0.38s + var(--delete-power, 1) * 0.14s)
    cubic-bezier(0.34, 1.2, 0.48, 1) forwards;
  pointer-events: none;
  z-index: 18;
}

.idea-node--neighbor-falloff {
  animation: idea-node-neighbor-falloff 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes idea-node-pulse {
  0%,
  100% {
    transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1)) scale(1);
  }
  50% {
    transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1))
      scale(calc(1 + var(--idea-pulse-scale, 0.03)));
  }
}

@keyframes idea-node-grow {
  0% {
    opacity: 0;
    transform: scale(0.15);
    filter: blur(4px);
  }
  60% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes idea-node-delete {
  0% {
    opacity: 1;
    transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1)) scale(0.96);
    filter: brightness(1) blur(0);
  }
  12% {
    transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1))
      scale(calc(0.9 - var(--delete-power, 1) * 0.04));
    filter: brightness(calc(1.35 + var(--delete-power, 1) * 0.45)) blur(0);
    box-shadow:
      0 0 calc(28px + var(--delete-power, 1) * 40px) hsla(var(--idea-hue, 220), 85%, 62%, 0.75),
      0 0 calc(56px + var(--delete-power, 1) * 48px) hsla(var(--idea-hue, 220), 70%, 55%, 0.35);
  }
  32% {
    transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1))
      scale(calc(1.08 + var(--delete-power, 1) * 0.12));
    filter: brightness(calc(1.6 + var(--delete-power, 1) * 0.35)) blur(0.5px);
  }
  48% {
    transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1))
      scale(calc(1.18 + var(--delete-power, 1) * 0.16));
    opacity: 0.95;
  }
  62% {
    transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1)) scale(0.35);
    opacity: 0.55;
    filter: brightness(1.2) blur(2px);
  }
  100% {
    opacity: 0;
    transform: scaleX(var(--idea-stretch-x, 1)) scaleY(var(--idea-stretch-y, 1)) scale(0);
    filter: blur(calc(5px + var(--delete-power, 1) * 3px));
  }
}

@keyframes idea-node-neighbor-falloff {
  0% {
    filter: brightness(1);
    box-shadow:
      0 0 calc(16px + var(--idea-glow, 0.3) * 28px) hsla(var(--idea-hue, 220), 75%, 58%, 0.45),
      0 0 32px hsla(var(--idea-hue, 220), 70%, 50%, 0.12);
  }
  35% {
    filter: brightness(1.25);
    box-shadow:
      0 0 calc(24px + var(--idea-glow, 0.3) * 36px) hsla(var(--idea-hue, 220), 80%, 60%, 0.55),
      0 0 44px rgba(96, 165, 250, 0.2);
  }
  100% {
    filter: brightness(1);
    box-shadow: none;
  }
}

.idea-node-density-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px dashed hsla(var(--idea-hue, 220), 60%, 60%, 0.25);
  animation: density-ring-spin 12s linear infinite;
  pointer-events: none;
}

@keyframes density-ring-spin {
  to {
    transform: rotate(360deg);
  }
}

.idea-node-label {
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
  padding: 0 0.35rem;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.idea-node--sparse .idea-node-label {
  -webkit-line-clamp: 3;
  line-clamp: 3;
  font-size: 0.6rem;
}

.idea-node--dense .idea-node-label {
  -webkit-line-clamp: 5;
  line-clamp: 5;
}

.idea-node-tag-dot {
  position: absolute;
  top: 10%;
  right: 12%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--idea-color, hsl(var(--idea-hue, 220) 70% 58%));
  box-shadow: 0 0 8px color-mix(in srgb, var(--idea-color, #60a5fa) 65%, transparent);
}

.idea-node-tag-dot--many {
  width: 9px;
  height: 9px;
  box-shadow:
    0 0 8px hsl(var(--idea-hue, 220) 80% 55% / 0.6),
    -6px 2px 0 -2px hsl(var(--idea-hue, 220) 65% 50% / 0.5);
}

.idea-hover-preview {
  position: absolute;
  z-index: 20;
  max-width: 248px;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  animation: preview-fade-in 0.22s ease forwards;
}

@keyframes preview-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.idea-preview-title {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.idea-preview-density {
  margin: 0 0 0.4rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--primary);
  opacity: 0.9;
}

.idea-preview-note {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.idea-preview-muted {
  font-style: italic;
}

.idea-preview-meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.idea-preview-meta span {
  font-weight: 600;
  color: var(--text);
  margin-right: 0.25rem;
}

.idea-spark-ripple {
  position: absolute;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  margin-top: -60px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 15;
  border: 2px solid rgba(96, 165, 250, 0.5);
  background: radial-gradient(circle, rgba(96, 165, 250, 0.25) 0%, transparent 70%);
}

.idea-spark-ripple.is-animating {
  animation: spark-ripple 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes spark-ripple {
  0% {
    opacity: 0.95;
    transform: scale(0.15);
  }
  40% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: scale(calc(1.8 * var(--ripple-scale, 1)));
  }
}

.idea-color-row {
  margin-top: 0.15rem;
}

.idea-color-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.idea-color-reset {
  font-size: 0.75rem;
  padding: 0;
}

.idea-color-reset.hidden {
  display: none;
}

.idea-color-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.idea-form-modal {
  width: min(720px, calc(100vw - 2rem));
}

.idea-form-modal .idea-modal-body {
  display: grid;
  grid-template-columns: 1fr minmax(148px, 172px);
  gap: 1.25rem 1.5rem;
  align-items: start;
}

.idea-modal-fields {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.idea-recent-tags {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.idea-recent-tags-title {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.idea-recent-tags-hint {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.idea-recent-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.idea-recent-tag-chip {
  margin: 0;
  padding: 0.3rem 0.55rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease,
    opacity 0.15s ease;
}

.idea-recent-tag-chip:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.idea-recent-tag-chip:active:not(:disabled) {
  transform: translateY(0);
}

.idea-recent-tag-chip.is-applied,
.idea-recent-tag-chip:disabled {
  opacity: 0.45;
  cursor: default;
  color: var(--text-muted);
  background: var(--surface);
  border-color: var(--border);
}

.idea-recent-tag-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.idea-recent-tags-empty {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@media (max-width: 560px) {
  .idea-form-modal .idea-modal-body {
    grid-template-columns: 1fr;
  }

  .idea-recent-tags {
    order: 1;
  }
}

/* Tag pills input */

.idea-tags-field-wrap .idea-tags-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.idea-tags-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: text;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.idea-tags-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.idea-tags-pills {
  display: contents;
}

.idea-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  max-width: 100%;
  padding: 0.2rem 0.25rem 0.2rem 0.55rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 999px;
}

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

.idea-tag-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    color 0.12s ease,
    background 0.12s ease;
}

.idea-tag-pill-remove:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.idea-tag-pill-remove:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.idea-tags-input {
  flex: 1 1 6rem;
  min-width: 5rem;
  border: none;
  background: transparent;
  padding: 0.25rem 0.35rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
}

.idea-tags-input:focus {
  outline: none;
  box-shadow: none;
}

.idea-tags-input::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.idea-form-delete {
  margin-left: auto;
}

.idea-modal-form .modal-footer {
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- Notes workspace --- */

.notes-app {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 0;
  min-height: min(72vh, 720px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.notes-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.notes-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.notes-sidebar-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.notes-search-wrap {
  padding: 0.65rem 0.75rem;
}

.notes-search {
  width: 100%;
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0.5rem 0.75rem;
}

.notes-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  margin: 0 0 0.35rem;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.notes-list-item:hover,
.notes-list-item.is-active {
  background: rgba(96, 165, 250, 0.12);
}

.notes-list-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.notes-list-item-snippet {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.notes-list-item-date {
  font-size: 0.6875rem;
  color: var(--text-muted);
  opacity: 0.85;
}

.notes-list-empty,
.notes-list-muted {
  margin: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.notes-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.notes-editor-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 2rem;
  text-align: center;
}

.notes-editor-empty-text {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.notes-editor-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 28rem;
}

.notes-editor-hint kbd {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.75rem;
}

.notes-editor-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.notes-editor-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.notes-title-input {
  flex: 1;
  margin: 0;
  padding: 0.35rem 0;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  outline: none;
}

.notes-editor-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.notes-save-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.notes-body-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.notes-format-toolbar {
  position: sticky;
  top: 0;
  z-index: 8;
  flex-shrink: 0;
  padding: 0.55rem 0.75rem 0.45rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(12px);
}

.notes-format-toolbar-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow:
    var(--shadow),
    0 0 20px color-mix(in srgb, var(--primary) 8%, transparent);
}

[data-theme='dark'] .notes-format-toolbar-inner {
  border-color: rgba(96, 165, 250, 0.22);
  box-shadow:
    var(--shadow),
    0 0 24px rgba(59, 130, 246, 0.1);
}

.notes-format-toolbar-title {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 0.15rem;
  user-select: none;
}

.notes-format-group {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.notes-format-divider {
  width: 1px;
  height: 1.35rem;
  background: var(--border);
  flex-shrink: 0;
}

.notes-format-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 1.85rem;
  height: 1.85rem;
  padding: 0 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.notes-format-btn:hover {
  color: var(--text);
  background: var(--row-hover);
  border-color: var(--border);
}

.notes-format-btn:active {
  transform: scale(0.94);
}

.notes-format-btn.is-active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  box-shadow: 0 0 14px color-mix(in srgb, var(--primary) 22%, transparent);
}

.notes-format-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.notes-format-btn--italic .notes-format-btn-label {
  font-style: italic;
}

.notes-format-btn--underline .notes-format-btn-label {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.notes-format-btn-text {
  font-size: 0.6875rem;
  font-weight: 600;
}

.notes-format-btn--checklist {
  min-width: auto;
  padding: 0 0.55rem;
}

.notes-body-editor {
  flex: 1;
  min-height: 0;
  padding: 1rem 1.15rem 2rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
  outline: none;
  overflow-y: auto;
  transition: box-shadow 0.25s ease;
}

.notes-body-editor:focus {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}

[data-theme='dark'] .notes-body-editor:focus {
  box-shadow: inset 0 0 24px rgba(59, 130, 246, 0.06);
}

.notes-body-editor [data-note-align='center'] {
  text-align: center;
}

.notes-body-editor [data-note-align='right'] {
  text-align: right;
}

.note-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.35rem 0;
  padding: 0.15rem 0;
}

.note-checklist-box {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0.12rem 0 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  font-size: 0.9rem;
  line-height: 1.35rem;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.note-checklist-box:hover {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--primary) 20%, transparent);
}

.note-checklist-box:active {
  transform: scale(0.9);
}

.note-checklist-content {
  flex: 1;
  min-width: 0;
  outline: none;
}

.note-checklist-item.is-checked .note-checklist-content {
  opacity: 0.55;
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--text-muted) 70%, transparent);
  transition: opacity 0.25s ease;
}

.note-checklist-item.is-checked .note-checklist-box {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}

.notes-body-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.notes-body-editor:focus:empty::before {
  opacity: 0.72;
}

.notes-suggest {
  position: fixed;
  z-index: 340;
  min-width: 220px;
  max-width: 360px;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

[data-theme='dark'] .notes-suggest {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(15, 18, 24, 0.92);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.notes-suggest-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.notes-suggest-item--with-thumb {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem 0.4rem 0.4rem;
}

.notes-suggest-thumb {
  flex-shrink: 0;
  width: 44px;
  aspect-ratio: 3.5 / 2.5;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  border: 1px solid rgba(96, 165, 250, 0.2);
  background: rgba(0, 0, 0, 0.2);
}

.notes-suggest-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.notes-suggest-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.12);
}

.notes-suggest-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
  min-width: 0;
}

.notes-suggest-item:hover,
.notes-suggest-item.is-active {
  background: var(--primary-light);
}

[data-theme='dark'] .notes-suggest-item:hover,
[data-theme='dark'] .notes-suggest-item.is-active {
  background: rgba(96, 165, 250, 0.15);
}

.notes-suggest-kind {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}

.notes-suggest-label {
  font-size: 0.8125rem;
  font-weight: 600;
}

.notes-suggest-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.notes-suggest-empty {
  margin: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Link pills in notes */
.note-link-pill {
  display: inline-block;
  pointer-events: auto;
  margin: 0 0.1rem;
  padding: 0.1rem 0.45rem;
  border: none;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  vertical-align: baseline;
  user-select: none;
  -webkit-user-modify: read-only;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.note-link-pill--project { background: rgba(124, 58, 237, 0.14); color: #5b21b6; }
.note-link-pill--product { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.note-link-pill--deck { background: rgba(13, 148, 136, 0.14); color: #0f766e; }
.note-link-pill--card { background: rgba(217, 119, 6, 0.14); color: #b45309; }
.note-link-pill--idea { background: rgba(37, 99, 235, 0.12); color: #1e40af; }
.note-link-pill--note { background: rgba(71, 85, 105, 0.12); color: #334155; }

[data-theme='dark'] .note-link-pill--project { background: rgba(167, 139, 250, 0.2); color: #c4b5fd; }
[data-theme='dark'] .note-link-pill--product { background: rgba(96, 165, 250, 0.2); color: #93c5fd; }
[data-theme='dark'] .note-link-pill--deck { background: rgba(45, 212, 191, 0.18); color: #5eead4; }
[data-theme='dark'] .note-link-pill--card { background: rgba(251, 191, 36, 0.18); color: #fcd34d; }
[data-theme='dark'] .note-link-pill--idea { background: rgba(59, 130, 246, 0.22); color: #93c5fd; }
[data-theme='dark'] .note-link-pill--note { background: rgba(148, 163, 184, 0.22); color: #cbd5e1; }

.note-link-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.18);
}

[data-theme='dark'] .note-link-pill:hover {
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.25);
}

.note-tag-chip {
  color: #1d4ed8;
  font-weight: 600;
  background: rgba(37, 99, 235, 0.1);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

[data-theme='dark'] .note-tag-chip {
  color: #93c5fd;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

/* Linked notes panels */
.linked-notes-field label {
  display: block;
  margin-bottom: 0.35rem;
}

.linked-notes-panel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 160px;
  overflow-y: auto;
}

.linked-notes-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: var(--radius);
  background: rgba(96, 165, 250, 0.08);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.linked-notes-item:hover {
  background: rgba(96, 165, 250, 0.16);
}

.linked-notes-item-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.linked-notes-item-snippet {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.linked-notes-item-date {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.linked-notes-empty,
.linked-notes-muted {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.linked-notes-empty code {
  font-size: 0.6875rem;
}

/* Entity hover preview (glass) */
.entity-hover-preview {
  position: fixed;
  z-index: 350;
  max-width: 260px;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  pointer-events: none;
  animation: preview-fade-in 0.22s ease forwards;
  transform-origin: top center;
}

[data-theme='dark'] .entity-hover-preview {
  border-color: rgba(96, 165, 250, 0.25);
  background: rgba(12, 15, 20, 0.88);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(59, 130, 246, 0.12);
}

.entity-preview-kind {
  margin: 0 0 0.2rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}

.entity-preview-title {
  margin: 0 0 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.entity-preview-snippet,
.entity-preview-line {
  margin: 0 0 0.45rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.entity-preview-meta {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.entity-preview-meta span {
  font-weight: 600;
  color: var(--text);
  margin-right: 0.25rem;
}

.entity-preview-muted {
  font-style: italic;
}

.entity-hover-preview--card {
  width: min(var(--entity-card-preview-width, 220px), calc(100vw - 16px));
  max-width: min(var(--entity-card-preview-width, 220px), calc(100vw - 16px));
  padding: 0.6rem;
}

.entity-preview-card-image {
  margin: 0 0 0.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  width: 100%;
  aspect-ratio: var(--card-aspect);
  background: var(--bg);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme='dark'] .entity-preview-card-image {
  border-color: rgba(96, 165, 250, 0.22);
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.entity-preview-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.entity-hover-preview--card .entity-preview-title {
  margin-top: 0;
}

.entity-preview-card-body .entity-preview-snippet {
  margin-bottom: 0.35rem;
}

.entity-preview-flag {
  margin: 0 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fbbf24;
}

/* Neural map note nodes */
.note-node {
  position: absolute;
  width: var(--note-node-size, 76px);
  height: var(--note-node-size, 76px);
  margin: 0;
  padding: 0.35rem 0.25rem 0.2rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  text-align: center;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--surface) 88%, var(--text-muted)) 0%,
    color-mix(in srgb, var(--surface) 72%, transparent) 55%,
    transparent 100%
  );
  box-shadow:
    0 0 14px color-mix(in srgb, var(--text-muted) 18%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--surface) 70%, white);
  transition:
    box-shadow 0.35s ease,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease;
  touch-action: none;
}

.note-node:hover,
.note-node:focus-visible {
  z-index: 12;
  transform: scale(1.06);
  box-shadow:
    0 0 22px color-mix(in srgb, var(--text-muted) 28%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--surface) 80%, white);
}

[data-theme='dark'] .note-node {
  border-color: rgba(148, 163, 184, 0.35);
  background: linear-gradient(
    145deg,
    rgba(226, 232, 240, 0.14) 0%,
    rgba(100, 116, 139, 0.08) 55%,
    transparent 100%
  );
  box-shadow:
    0 0 18px rgba(148, 163, 184, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

[data-theme='dark'] .note-node:hover,
[data-theme='dark'] .note-node:focus-visible {
  box-shadow:
    0 0 28px rgba(203, 213, 225, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.note-node-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-muted);
  opacity: 0.95;
}

[data-theme='dark'] .note-node-icon {
  color: rgba(226, 232, 240, 0.85);
}

.note-node-icon svg {
  width: 100%;
  height: 100%;
}

.note-node-label {
  font-size: 0.5625rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.note-node--filtered-out {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden;
}

@media (max-width: 720px) {
  .app {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .app-header {
    padding-top: 0.65rem;
    margin-bottom: 1rem;
  }

  .app-header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    min-height: 0;
    position: relative;
    padding-top: 0.1rem;
  }

  .brand {
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: none;
    gap: 0.45rem;
    z-index: 1;
  }

  .brand-logo {
    width: 76px;
    height: 76px;
  }

  .brand-text {
    flex: none;
    width: 100%;
  }

  .brand-subtitle {
    align-items: center;
    text-align: center;
    font-size: 0.6875rem;
    line-height: 1.35;
  }

  .brand-subtitle-line {
    white-space: normal;
  }

  .header-actions {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 102;
  }

  .app-header-nav {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    pointer-events: auto;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 1;
  }

  .app-header-nav .segmented-nav {
    width: min(100%, 20.5rem);
    justify-content: center;
  }

  .app-header-nav .segmented-nav-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    font-size: 0.8125rem;
  }

  /* Ideas tab — stack toolbar; wrap view selector */
  .ideas-toolbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.65rem 0.5rem;
  }

  .ideas-toolbar-lead {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .ideas-toolbar-trail {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    gap: 0.4rem;
  }

  .ideas-toolbar-trail .btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.8125rem;
  }

  .ideas-toolbar-center {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    justify-self: stretch;
  }

  .ideas-viz-nav {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 14px;
    gap: 0.2rem;
    padding: 0.28rem;
  }

  .ideas-viz-nav .segmented-nav-btn {
    flex: 0 1 auto;
    padding: 0.38rem 0.62rem;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .ideas-viz-nav-divider {
    display: none;
  }

  .ideas-fullscreen-viz-nav {
    max-width: min(100%, calc(100vw - 2rem));
    justify-content: center;
  }

  .ideas-fullscreen-viz-nav .segmented-nav-btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.68rem;
  }

  .assets-pile-toolbar-hint--desktop,
  .ideas-whiteboard-hint--desktop {
    display: none;
  }

  .assets-pile-toolbar-hint--mobile,
  .ideas-whiteboard-hint--mobile {
    display: block;
  }

  .assets-pile-toolbar-hint--mobile {
    white-space: normal;
    line-height: 1.35;
  }

  .assets-pile-card {
    touch-action: manipulation;
  }

  .idea-thought-space-stream-btn,
  .idea-thought-space-back {
    padding: 0.42rem 0.62rem;
    font-size: 0.8125rem;
  }

  .thought-kanban-column-title {
    font-size: 0.82rem;
  }

  .thought-kanban-column-body {
    touch-action: pan-y;
  }

  .thought-kanban-card-item {
    padding: 0.5rem 0.45rem;
  }

  .idea-thought-space--touch .thought-kanban-card {
    min-height: 44px;
    padding: 0.5rem 0.72rem;
    touch-action: manipulation;
  }

  .idea-thought-space--touch .thought-field-label {
    padding: 0.35rem 0.55rem;
    min-height: 2.1rem;
    display: inline-flex;
    align-items: center;
    touch-action: manipulation;
    max-width: min(320px, 72vw);
  }

}

@media (orientation: landscape) and (max-height: 520px) {
  .idea-thought-space:not(.is-kanban-mode) .idea-thought-space-field-controls {
    left: max(0.65rem, env(safe-area-inset-left, 0));
    right: auto;
    bottom: max(0.5rem, env(safe-area-inset-bottom, 0));
    top: auto;
    transform: none;
    width: min(12rem, calc(100% - 1.25rem));
    max-width: min(12rem, calc(100% - 1.25rem));
  }

  .ideas-canvas-wrap.is-thought-space-mode:has(.idea-thought-space:not(.is-kanban-mode)) .ideas-zoom-controls {
    bottom: auto;
    top: calc(4.25rem + env(safe-area-inset-top, 0));
    right: max(0.5rem, env(safe-area-inset-right, 0));
  }
}

@media (max-width: 768px) {
  .notes-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .notes-sidebar {
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .segmented-nav-slider,
  .segmented-nav-btn,
  .view-panel.view-enter,
  .view-panel.view-exit,
  .idea-node,
  .ideas-map-stage,
  .idea-node-density-ring,
  .idea-cluster-halo,
  .idea-cloud-word,
  .ideas-viz-layer,
  .idea-connection-line,
  .idea-hover-preview,
  .idea-spark-ripple.is-animating {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 768px) {
  .segmented-nav-btn {
    padding: 0.45rem 1rem;
    font-size: 0.8125rem;
  }

  .ideas-canvas-wrap {
    min-height: min(62vh, 560px);
  }
}

/* —— Thought clusters & thought space —— */
.ideas-thought-clusters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

.thought-cluster-stardust {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    circle at 40% 38%,
    color-mix(in srgb, var(--idea-color, #60a5fa) 34%, white 66%) 0%,
    color-mix(in srgb, var(--idea-color, #60a5fa) 16%, transparent) 42%,
    transparent 72%
  );
  filter: blur(1.35px);
  mix-blend-mode: screen;
  animation: thought-stardust-aura 2.1s cubic-bezier(0.36, 0.68, 0.42, 1) forwards;
  transform: rotate(var(--stardust-angle, 0deg)) translateX(var(--stardust-r0, 14px))
    rotate(calc(-1 * var(--stardust-angle, 0deg)));
  will-change: transform, opacity;
}

.thought-cluster-stardust--fine {
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  filter: blur(1.1px);
}

.thought-cluster {
  position: absolute;
  z-index: 2;
  width: var(--thought-cluster-size, 28px);
  height: var(--thought-cluster-size, 28px);
  padding: 0;
  border: none;
  border-radius: 50%;
  overflow: visible;
  pointer-events: auto;
  cursor: pointer;
  background: transparent;
  transform: translateZ(0);
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.28s ease;
  filter: drop-shadow(0 0 calc(6px + var(--thought-cluster-pulse, 0.05) * 40px) hsl(var(--idea-hue, 210) 72% 62% / 0.55));
}

.thought-cluster-core {
  position: absolute;
  inset: 18%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    hsl(var(--idea-hue, 210) 90% 78% / 0.95),
    hsl(var(--idea-hue, 210) 65% 48% / 0.5) 55%,
    transparent 72%
  );
  animation: thought-cluster-pulse calc(2.4s - var(--thought-cluster-pulse, 0.05) * 8s) ease-in-out infinite;
}

.thought-cluster-particles {
  position: absolute;
  inset: -20%;
  z-index: 1;
  pointer-events: none;
}

.thought-cluster-count {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 0.85),
    0 1px 5px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.thought-cluster-particle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: hsl(var(--idea-hue, 210) 80% 70% / 0.85);
  transform: rotate(var(--particle-angle, 0deg)) translateX(var(--particle-dist, 40%));
  animation: thought-particle-orbit calc(3.5s + var(--particle-delay, 0s)) linear infinite;
  animation-delay: var(--particle-delay, 0s);
  opacity: 0.75;
}

.thought-cluster:hover,
.thought-cluster:focus-visible {
  transform: scale(1.14);
  filter: drop-shadow(0 0 14px hsl(var(--idea-hue, 210) 80% 65% / 0.85));
  z-index: 2;
}

.thought-cluster.is-entering .thought-cluster-core {
  animation: thought-cluster-enter 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.thought-cluster.is-pulse .thought-cluster-core {
  animation: thought-cluster-pop 0.45s ease-out;
}

.thought-bridge-line {
  stroke: hsl(210 70% 62% / 0.22);
  stroke-width: 1.1;
  stroke-linecap: round;
  pointer-events: none;
}

[data-theme='dark'] .thought-bridge-line {
  stroke: hsl(210 75% 72% / 0.28);
}

.thought-cluster-preview-title {
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.thought-cluster-preview-count {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  opacity: 0.85;
}

.thought-cluster-preview-list {
  margin: 0 0 0.35rem;
  padding-left: 1rem;
  font-size: 0.8125rem;
  opacity: 0.9;
}

.thought-cluster-preview-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  opacity: 0.65;
}

.idea-thought-space {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  --thought-space-idea-hue: 210;
  background:
    radial-gradient(
      ellipse 120% 90% at 50% 100%,
      hsl(var(--thought-space-idea-hue) 48% 18% / 0.55),
      transparent 58%
    ),
    radial-gradient(circle at 12% 8%, hsl(var(--thought-space-idea-hue) 42% 22% / 0.2), transparent 38%),
    radial-gradient(circle at 88% 22%, hsl(var(--thought-space-idea-hue) 38% 16% / 0.14), transparent 32%),
    linear-gradient(180deg, hsl(228 38% 4% / 0.97), hsl(234 32% 3% / 0.99));
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: scale(1.02);
  transition:
    opacity 0.38s ease,
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.idea-thought-space.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

[data-theme='light'] .idea-thought-space {
  background:
    radial-gradient(
      ellipse 120% 88% at 50% 100%,
      hsl(var(--thought-space-idea-hue) 55% 92% / 0.75),
      transparent 60%
    ),
    radial-gradient(circle at 10% 10%, hsl(var(--thought-space-idea-hue) 48% 88% / 0.28), transparent 40%),
    linear-gradient(180deg, hsl(228 28% 94% / 0.98), hsl(234 24% 91% / 0.99));
}

/* backdrop-filter blurs the whole layer on iOS; use a solid field on touch / narrow screens. */
@media (max-width: 980px) {
  .idea-thought-space {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background:
      radial-gradient(
        ellipse 120% 90% at 50% 100%,
        hsl(var(--thought-space-idea-hue) 48% 18% / 0.62),
        transparent 58%
      ),
      radial-gradient(circle at 12% 8%, hsl(var(--thought-space-idea-hue) 42% 22% / 0.18), transparent 38%),
      linear-gradient(180deg, hsl(228 38% 5% / 1), hsl(234 32% 4% / 1));
  }

  [data-theme='light'] .idea-thought-space {
    background:
      radial-gradient(
        ellipse 120% 88% at 50% 100%,
        hsl(var(--thought-space-idea-hue) 55% 92% / 0.82),
        transparent 60%
      ),
      linear-gradient(180deg, hsl(228 28% 95% / 1), hsl(234 24% 92% / 1));
  }

  .ideas-canvas-wrap.is-thought-space-mode .idea-node--thought-dim {
    opacity: 0;
    filter: none;
  }

  .idea-thought-space-map-stage {
    will-change: auto;
  }
}

.idea-thought-space--touch:not(.is-kanban-mode) .thought-field-item,
.idea-thought-space--touch:not(.is-kanban-mode) .thought-field-item.gravity-rel {
  filter: none;
}

.idea-thought-space--touch:not(.is-kanban-mode) .thought-field-anchor {
  transform: scale(var(--thought-scale, 1));
}

.idea-thought-space--touch:not(.is-kanban-mode) .thought-field-label {
  transform: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.idea-thought-space-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(210 30% 40% / 0.2);
  flex-shrink: 0;
}

.idea-thought-space-back {
  flex-shrink: 0;
}

.idea-thought-space-header-center {
  min-width: 0;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.idea-thought-space-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.25;
}

.idea-thought-space-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--thought-space-idea-hue, 210) 45% 58% / 0.35);
  background: hsl(222 30% 8% / 0.6);
  box-shadow: inset 0 1px 0 hsl(var(--thought-space-idea-hue, 210) 70% 70% / 0.08);
  margin: 0;
}

.idea-thought-space-mode-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: hsl(212 22% 78% / 0.92);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.35rem 0.66rem;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.idea-thought-space-mode-btn:hover,
.idea-thought-space-mode-btn:focus-visible {
  color: hsl(0 0% 100% / 0.98);
  background: hsl(var(--thought-space-idea-hue, 210) 75% 56% / 0.2);
}

.idea-thought-space-mode-btn.is-active {
  color: hsl(0 0% 100% / 0.98);
  background: linear-gradient(
    135deg,
    hsl(var(--thought-space-idea-hue, 210) 78% 58% / 0.35),
    hsl(var(--thought-space-idea-hue, 210) 70% 48% / 0.22)
  );
  box-shadow:
    0 0 14px hsl(var(--thought-space-idea-hue, 210) 75% 58% / 0.25),
    inset 0 1px 0 hsl(var(--thought-space-idea-hue, 210) 80% 78% / 0.35);
}

.idea-thought-space-back-label--mobile,
.idea-thought-space-mode-label--mobile,
.idea-thought-space-stream-label--mobile {
  display: none;
}

/* Touch devices: short labels in portrait and landscape (width can exceed 720px rotated). */
.idea-thought-space--touch .idea-thought-space-back-label--desktop,
.idea-thought-space--touch .idea-thought-space-mode-label--desktop,
.idea-thought-space--touch .idea-thought-space-stream-label--desktop {
  display: none;
}

.idea-thought-space--touch .idea-thought-space-back-label--mobile,
.idea-thought-space--touch .idea-thought-space-mode-label--mobile,
.idea-thought-space--touch .idea-thought-space-stream-label--mobile {
  display: inline;
}

.idea-thought-space--touch .idea-thought-space-hint--desktop {
  display: none;
}

.idea-thought-space--touch .idea-thought-space-hint--mobile:not(.hidden) {
  display: block;
}

@media (max-width: 720px) {
  .idea-thought-space-hint--desktop {
    display: none;
  }

  .idea-thought-space-hint--mobile:not(.hidden) {
    display: block;
  }

  .idea-thought-space-back-label--desktop,
  .idea-thought-space-mode-label--desktop,
  .idea-thought-space-stream-label--desktop {
    display: none;
  }

  .idea-thought-space-back-label--mobile,
  .idea-thought-space-mode-label--mobile,
  .idea-thought-space-stream-label--mobile {
    display: inline;
  }
}

.idea-thought-space-hint {
  flex-shrink: 0;
  margin: 0;
  padding: 0.32rem 0.75rem;
  font-size: 0.68rem;
  line-height: 1.35;
  text-align: center;
  color: hsl(210 22% 82% / 0.88);
  background: hsl(228 32% 8% / 0.55);
  border-bottom: 1px solid hsl(var(--thought-space-idea-hue, 210) 40% 50% / 0.15);
  pointer-events: none;
}

.idea-thought-space-hint--mobile {
  display: none;
}

@media (max-width: 980px) {
  .ideas-view.is-thought-space-open {
    gap: 0;
    min-height: 0;
  }

  .ideas-view.is-thought-space-open > .ideas-toolbar,
  .ideas-view:has(.idea-thought-space.is-active) > .ideas-toolbar {
    display: none;
  }

  .ideas-view.is-thought-space-open .ideas-canvas-wrap {
    flex: 1;
    min-height: 0;
    border-radius: var(--radius);
  }

  .ideas-canvas-wrap.is-thought-space-mode .ideas-map-bottom-controls,
  .ideas-canvas-wrap.is-thought-space-mode .ideas-canvas-top-actions,
  .ideas-canvas-wrap.is-thought-space-mode .ideas-conn-style-control {
    opacity: 0;
    pointer-events: none;
  }

  .idea-thought-space.is-active {
    position: fixed;
    inset: 0;
    z-index: 220;
    border-radius: 0;
    max-height: 100dvh;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .idea-thought-space-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0.45rem 0.5rem;
    padding: 0.55rem 0.65rem;
  }

  .idea-thought-space-back {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .idea-thought-space-stream-btn {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .idea-thought-space-header-center {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .idea-thought-space-title {
    font-size: 0.92rem;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .idea-thought-space-mode-toggle {
    width: 100%;
    justify-content: stretch;
  }

  .idea-thought-space-mode-btn {
    flex: 1 1 auto;
    min-width: 3.5rem;
    text-align: center;
    white-space: nowrap;
  }

  .idea-thought-space.is-kanban-mode .idea-thought-space-map-stage {
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
  }

  .idea-thought-space.is-kanban-mode .idea-thought-space-viewport {
    overflow: hidden;
  }
}

.idea-thought-space-field-controls {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  pointer-events: auto;
  touch-action: manipulation;
  transform: none;
  box-sizing: border-box;
}

/* Portrait / narrow: center above bottom safe area (must follow base rule — base used to leave translateX(-50%) active). */
@media (max-width: 980px) {
  .idea-thought-space-field-controls {
    left: 50%;
    right: auto;
    bottom: calc(0.55rem + env(safe-area-inset-bottom, 0));
    transform: translateX(-50%);
    width: min(calc(100% - 1.25rem), 21rem);
    max-width: calc(100% - 1.25rem);
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.45rem 0.6rem;
    z-index: 235;
  }

  .idea-thought-space-spacing,
  .idea-thought-space-text-size {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: 0 0 auto;
  }

  .idea-thought-space-spacing-label,
  .idea-thought-space-text-size-label {
    flex: 0 0 auto;
    min-width: 3.25rem;
  }

  .idea-thought-space-spacing-input,
  .idea-thought-space-text-size-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
    min-height: 1.35rem;
    height: 1.35rem;
  }

  .idea-thought-space-spacing-value,
  .idea-thought-space-text-size-value {
    flex: 0 0 auto;
  }

  .ideas-canvas-wrap.is-thought-space-mode .ideas-zoom-controls {
    bottom: calc(6.25rem + env(safe-area-inset-bottom, 0));
    z-index: 230;
  }
}

.idea-thought-space-spacing,
.idea-thought-space-text-size {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: default;
  user-select: none;
}

.idea-thought-space-spacing-label,
.idea-thought-space-text-size-label {
  line-height: 1;
  white-space: nowrap;
  min-width: 3.25rem;
}

.idea-thought-space-spacing-input,
.idea-thought-space-text-size-input {
  flex: 1;
  min-width: 4.5rem;
  min-height: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: hsl(var(--thought-space-idea-hue, 210) 72% 62%);
  cursor: pointer;
  touch-action: manipulation;
}

.idea-thought-space--touch .idea-thought-space-spacing-input,
.idea-thought-space--touch .idea-thought-space-text-size-input {
  min-height: 1.35rem;
  height: 1.35rem;
}

.idea-thought-space-spacing-input:focus-visible,
.idea-thought-space-text-size-input:focus-visible {
  outline: 2px solid hsl(var(--thought-space-idea-hue, 210) 70% 62%);
  outline-offset: 2px;
}

.idea-thought-space-spacing-value,
.idea-thought-space-text-size-value {
  min-width: 2.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  line-height: 1;
}

.idea-thought-space-stream-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.idea-thought-space-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.idea-thought-space.is-kanban-mode .idea-thought-space-viewport {
  cursor: default;
  overflow: hidden;
}

.idea-thought-space-viewport.is-panning {
  cursor: grabbing;
}

.idea-thought-space-viewport.is-panning .thought-field-item {
  pointer-events: none;
}

.idea-thought-space-map-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.idea-thought-space-kanban-columns {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0.65rem;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  width: 100%;
  box-sizing: border-box;
  pointer-events: auto;
  z-index: 4;
  min-height: 0;
}

.thought-kanban-column {
  flex: 0 0 clamp(220px, 86vw, 300px);
  width: clamp(220px, 86vw, 300px);
  min-width: clamp(220px, 86vw, 300px);
  max-width: clamp(220px, 86vw, 300px);
  flex-shrink: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  box-sizing: border-box;
}

@media (orientation: landscape) and (max-height: 560px) {
  .thought-kanban-column {
    flex-basis: clamp(220px, 38vw, 280px);
    width: clamp(220px, 38vw, 280px);
    min-width: clamp(220px, 38vw, 280px);
    max-width: clamp(220px, 38vw, 280px);
  }
}

/* Desktop: three columns side-by-side (non-touch wide screens only). */
@media (min-width: 981px) {
  .idea-thought-space:not(.idea-thought-space--touch) .idea-thought-space-kanban-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem 1.1rem 0.85rem;
    overflow-x: hidden;
    overflow-y: hidden;
    scroll-snap-type: none;
    touch-action: auto;
  }

  .idea-thought-space:not(.idea-thought-space--touch) .thought-kanban-column {
    flex: unset;
    width: auto;
    min-width: 0;
    max-width: none;
    scroll-snap-align: none;
  }
}

.idea-thought-space--touch.is-kanban-mode .idea-thought-space-map-stage {
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
}

.idea-thought-space.is-kanban-mode .idea-thought-space-canvas {
  pointer-events: none;
  z-index: 2;
}

.thought-kanban-column {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid hsl(var(--thought-space-idea-hue, 210) 40% 56% / 0.2);
  background:
    radial-gradient(circle at 50% 0%, hsl(var(--thought-space-idea-hue, 210) 72% 58% / 0.12), transparent 45%),
    repeating-linear-gradient(
      180deg,
      hsl(var(--thought-space-idea-hue, 210) 70% 70% / 0.02) 0,
      hsl(var(--thought-space-idea-hue, 210) 70% 70% / 0.02) 64px,
      transparent 64px,
      transparent 68px
    ),
    linear-gradient(180deg, hsl(224 35% 11% / 0.5), hsl(230 32% 7% / 0.24));
  box-shadow: inset 0 0 30px hsl(var(--thought-space-idea-hue, 210) 80% 52% / 0.07);
  transition:
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    background 0.28s ease;
}

.thought-kanban-column[data-kanban-col='todo'] {
  border-color: hsl(228 52% 62% / 0.28);
  background:
    radial-gradient(circle at 50% 0%, hsl(228 72% 58% / 0.16), transparent 48%),
    repeating-linear-gradient(
      180deg,
      hsl(228 70% 70% / 0.025) 0,
      hsl(228 70% 70% / 0.025) 64px,
      transparent 64px,
      transparent 68px
    ),
    linear-gradient(180deg, hsl(232 38% 12% / 0.55), hsl(236 34% 8% / 0.28));
  box-shadow: inset 0 0 36px hsl(228 80% 54% / 0.1);
}

.thought-kanban-column[data-kanban-col='inprogress'] {
  border-color: hsl(188 70% 62% / 0.42);
  background:
    radial-gradient(circle at 50% 0%, hsl(188 84% 58% / 0.22), transparent 48%),
    repeating-linear-gradient(
      180deg,
      hsl(188 70% 70% / 0.03) 0,
      hsl(188 70% 70% / 0.03) 64px,
      transparent 64px,
      transparent 68px
    ),
    linear-gradient(180deg, hsl(200 36% 12% / 0.55), hsl(204 32% 8% / 0.28));
  box-shadow:
    inset 0 0 42px hsl(188 88% 56% / 0.16),
    0 0 24px hsl(188 80% 50% / 0.08);
}

.thought-kanban-column[data-kanban-col='complete'] {
  border-color: hsl(158 48% 58% / 0.32);
  background:
    radial-gradient(circle at 50% 0%, hsl(158 62% 52% / 0.14), transparent 48%),
    repeating-linear-gradient(
      180deg,
      hsl(158 55% 65% / 0.02) 0,
      hsl(158 55% 65% / 0.02) 64px,
      transparent 64px,
      transparent 68px
    ),
    linear-gradient(180deg, hsl(210 30% 11% / 0.5), hsl(214 28% 8% / 0.26));
  box-shadow: inset 0 0 34px hsl(158 70% 48% / 0.12);
}

.thought-kanban-column.is-drop-target {
  border-color: hsl(var(--thought-space-idea-hue, 210) 80% 68% / 0.55);
  box-shadow:
    inset 0 0 48px hsl(var(--thought-space-idea-hue, 210) 85% 58% / 0.2),
    0 0 28px hsl(var(--thought-space-idea-hue, 210) 80% 55% / 0.18);
}

.thought-kanban-column-header {
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  padding-bottom: 0.15rem;
  background: linear-gradient(
    180deg,
    hsl(228 35% 11% / 0.72),
    hsl(228 35% 11% / 0.55) 70%,
    transparent
  );
}

.thought-kanban-column-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.35rem 0.55rem 0.75rem;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--thought-space-idea-hue, 210) 65% 58% / 0.35) transparent;
}

.thought-kanban-column-body::-webkit-scrollbar {
  width: 5px;
}

.thought-kanban-column-body::-webkit-scrollbar-track {
  background: transparent;
}

.thought-kanban-column-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: hsl(var(--thought-space-idea-hue, 210) 68% 58% / 0.28);
  box-shadow: 0 0 6px hsl(var(--thought-space-idea-hue, 210) 70% 55% / 0.25);
  transition: background 0.2s ease;
}

.thought-kanban-column-body:hover::-webkit-scrollbar-thumb,
.thought-kanban-column-body:focus-within::-webkit-scrollbar-thumb {
  background: hsl(var(--thought-space-idea-hue, 210) 72% 62% / 0.55);
}

.thought-kanban-column-body:not(:hover):not(:focus-within)::-webkit-scrollbar-thumb {
  background: hsl(var(--thought-space-idea-hue, 210) 68% 58% / 0.12);
}

.thought-kanban-column-body::before,
.thought-kanban-column-body::after {
  content: '';
  position: sticky;
  left: 0;
  right: 0;
  display: block;
  height: 14px;
  margin: 0 -0.55rem;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.thought-kanban-column-body::before {
  top: 0;
  margin-bottom: -14px;
  background: linear-gradient(180deg, hsl(228 32% 9% / 0.88), transparent);
}

.thought-kanban-column-body::after {
  bottom: 0;
  margin-top: -14px;
  background: linear-gradient(0deg, hsl(228 32% 9% / 0.88), transparent);
}

.thought-kanban-column-body.can-scroll-up::before {
  opacity: 1;
}

.thought-kanban-column-body.can-scroll-down::after {
  opacity: 1;
}

.thought-kanban-column-cards {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  align-items: stretch;
  min-height: min-content;
  padding: 0.5rem 0.6rem 0.6rem;
}

.thought-kanban-column-cards.is-reordering .thought-kanban-card-item:not(.is-dragging):not(.thought-kanban-card-placeholder) {
  transition: transform 0.32s cubic-bezier(0.34, 1.2, 0.48, 1);
}

.thought-kanban-card-item.is-kanban-shifting {
  transition: transform 0.32s cubic-bezier(0.34, 1.2, 0.48, 1);
  will-change: transform;
}

.idea-thought-space-kanban-columns.is-kanban-dragging .thought-kanban-column.is-drop-target {
  box-shadow:
    inset 0 0 0 1px hsl(var(--thought-space-idea-hue, 210) 70% 62% / 0.35),
    0 0 28px hsl(var(--thought-space-idea-hue, 210) 72% 55% / 0.18);
}

.thought-kanban-card-placeholder {
  flex-shrink: 0;
  position: relative;
  margin: 0;
  border-radius: 10px;
  border: 1px dashed hsl(var(--thought-space-idea-hue, 210) 62% 58% / 0.42);
  background:
    linear-gradient(
      180deg,
      hsl(var(--thought-space-idea-hue, 210) 58% 52% / 0.1),
      hsl(var(--thought-space-idea-hue, 210) 52% 44% / 0.04)
    );
  box-shadow:
    inset 0 0 0 1px hsl(var(--thought-space-idea-hue, 210) 70% 68% / 0.12),
    0 8px 22px hsl(var(--thought-space-idea-hue, 210) 60% 40% / 0.14);
  pointer-events: none;
  animation: kanban-placeholder-breathe 1.35s ease-in-out infinite;
}

.thought-kanban-card-placeholder::before {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    hsl(var(--thought-space-idea-hue, 210) 78% 72% / 0.15),
    hsl(var(--thought-space-idea-hue, 210) 82% 68% / 0.95),
    hsl(var(--thought-space-idea-hue, 210) 78% 72% / 0.15),
    transparent
  );
  box-shadow:
    0 0 10px hsl(var(--thought-space-idea-hue, 210) 80% 65% / 0.55),
    0 0 22px hsl(var(--thought-space-idea-hue, 210) 75% 58% / 0.28);
}

@keyframes kanban-placeholder-breathe {
  0%,
  100% {
    opacity: 0.88;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.008);
  }
}

.thought-kanban-column::after {
  display: none;
}

.thought-kanban-column-title {
  margin: 0.72rem 0.8rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: hsl(0 0% 100% / 0.9);
  text-transform: uppercase;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.thought-kanban-column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  border-radius: 999px;
  padding: 0.08rem 0.36rem;
  font-size: 0.68rem;
  color: hsl(0 0% 100% / 0.85);
  background: hsl(var(--thought-space-idea-hue, 210) 80% 62% / 0.2);
}

.thought-kanban-column-pct {
  margin-left: 0.15rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: hsl(0 0% 100% / 0.45);
}

.thought-kanban-column-pct:empty {
  display: none;
}

.idea-thought-space-kanban-tooltip {
  position: absolute;
  z-index: 24;
  max-width: min(280px, 88vw);
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid hsl(var(--thought-space-idea-hue, 210) 55% 58% / 0.35);
  background: hsl(228 32% 10% / 0.94);
  box-shadow:
    0 8px 28px hsl(228 50% 4% / 0.55),
    0 0 20px hsl(var(--thought-space-idea-hue, 210) 70% 50% / 0.15);
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.idea-thought-space-kanban-tooltip.hidden {
  display: none;
}

.kanban-preview-title {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.3;
  color: hsl(210 25% 96% / 0.96);
}

.kanban-preview-body {
  margin: 0 0 0.4rem;
  font-size: 0.74rem;
  line-height: 1.4;
  color: hsl(210 18% 88% / 0.82);
}

.kanban-preview-meta {
  margin: 0.12rem 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: hsl(210 15% 78% / 0.75);
}

.kanban-preview-meta span {
  color: hsl(210 20% 62% / 0.85);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}

.kanban-preview-hint {
  margin: 0.45rem 0 0;
  font-size: 0.62rem;
  color: hsl(var(--thought-space-idea-hue, 210) 70% 68% / 0.75);
}

.idea-thought-space.is-kanban-mode .idea-thought-space-particles {
  opacity: 0.42;
}

.idea-thought-space.is-kanban-mode .idea-thought-space-connections {
  display: none;
}

.idea-thought-space-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}

.idea-thought-space-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.thought-field-link {
  stroke: hsl(var(--thought-space-idea-hue, 210) 65% 58%);
  stroke-opacity: var(--link-opacity, 0.24);
  stroke-dasharray: 3 7;
  stroke-dashoffset: var(--link-dash, 0);
  stroke-linecap: round;
  fill: none;
  transition: stroke-opacity 0.25s ease;
}

.thought-field-link.is-hot {
  stroke: hsl(var(--thought-space-idea-hue, 210) 75% 68%);
  filter: drop-shadow(0 0 4px hsl(var(--thought-space-idea-hue, 210) 70% 60% / 0.45));
}

.thought-field-link.is-strong {
  stroke: hsl(var(--thought-space-idea-hue, 210) 72% 64%);
}

.thought-field-link.is-rel:not(.is-hot) {
  filter: drop-shadow(0 0 3px hsl(var(--thought-space-idea-hue, 210) 65% 55% / 0.38));
}

.thought-field-link.is-rel.is-hot {
  filter: drop-shadow(0 0 6px hsl(var(--thought-space-idea-hue, 210) 72% 58% / 0.62));
}

.thought-field-link.is-strong.is-rel {
  stroke-dasharray: 4 8;
}

.idea-thought-space-canvas {
  position: absolute;
  inset: 0;
  overflow: visible;
  z-index: 3;
}

.ideas-canvas-wrap.is-thought-space-mode .ideas-zoom-controls {
  z-index: 14;
}

/* Inside Idea — neural thought field */
.thought-field-item {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  opacity: var(--thought-opacity, 0.75);
  filter: blur(calc((1 - var(--thought-depth, 0.7)) * 0.28px));
  transition:
    opacity 0.28s ease,
    filter 0.28s ease;
}

.thought-field-item.is-draggable {
  pointer-events: auto;
}

.thought-field-item.is-dragging {
  z-index: 60 !important;
  filter: none;
}

.idea-thought-space.is-kanban-mode .thought-kanban-card-item:not(.is-dragging) .thought-kanban-card {
  transition:
    box-shadow 0.24s ease,
    border-color 0.24s ease,
    filter 0.24s ease,
    transform 0.24s cubic-bezier(0.34, 1.2, 0.48, 1);
}

.thought-kanban-card-item {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  filter: none;
  pointer-events: auto;
  padding: 0.48rem 0.68rem;
  box-sizing: border-box;
}

.thought-kanban-card-item.is-dragging {
  z-index: 1000 !important;
  filter: none;
  pointer-events: none;
}

.thought-kanban-card-item.is-dragging .thought-kanban-card {
  cursor: grabbing;
  transform: rotate(0deg) scale(1.03) translateY(-3px);
  box-shadow:
    0 14px 34px hsl(228 50% 4% / 0.55),
    0 0 28px hsl(var(--idea-hue, 210) 72% 55% / 0.42),
    inset 0 1px 0 hsl(0 0% 100% / 0.12);
  transition:
    box-shadow 0.22s ease,
    transform 0.22s cubic-bezier(0.34, 1.2, 0.48, 1);
}

.thought-kanban-card {
  position: relative;
  left: auto;
  top: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  width: 100%;
  min-height: 34px;
  height: auto;
  padding: 0.42rem 0.72rem;
  margin: 0;
  border: none;
  border-radius: 10px;
  cursor: grab;
  pointer-events: auto;
  overflow: hidden;
  transform-origin: center center;
  transform: rotate(var(--card-rotation, 0deg));
  border: 1px solid hsl(var(--idea-hue, 210) 68% 68% / 0.42);
  background:
    linear-gradient(
      145deg,
      hsl(var(--idea-hue, 210) 55% 52% / 0.22),
      hsl(var(--idea-hue, 210) 45% 38% / 0.1) 48%,
      hsl(228 35% 10% / 0.35)
    );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 2px 8px hsl(228 45% 4% / 0.38),
    0 0 10px hsl(var(--idea-hue, 210) 72% 55% / 0.2),
    inset 0 1px 0 hsl(0 0% 100% / 0.08);
  animation: none;
}

.thought-kanban-card-item[data-kanban-status='todo'] .thought-kanban-card {
  border-color: hsl(228 58% 68% / 0.38);
  box-shadow:
    0 2px 10px hsl(232 45% 4% / 0.42),
    0 0 12px hsl(228 68% 52% / 0.22),
    inset 0 1px 0 hsl(0 0% 100% / 0.07);
}

.thought-kanban-card-item[data-kanban-status='inprogress'] .thought-kanban-card {
  border-color: hsl(188 72% 68% / 0.55);
  box-shadow:
    0 2px 12px hsl(200 45% 4% / 0.42),
    0 0 18px hsl(188 80% 56% / 0.38),
    inset 0 1px 0 hsl(0 0% 100% / 0.1);
}

.thought-kanban-card-item[data-kanban-status='complete'] .thought-kanban-card {
  border-color: hsl(158 50% 62% / 0.42);
  box-shadow:
    0 2px 10px hsl(210 40% 4% / 0.38),
    0 0 14px hsl(158 58% 50% / 0.28),
    inset 0 1px 0 hsl(0 0% 100% / 0.08);
}

.thought-kanban-card-item[data-importance-tier='2'] .thought-kanban-card {
  border-width: 1.5px;
  box-shadow:
    0 3px 12px hsl(228 45% 4% / 0.48),
    0 0 18px hsl(var(--idea-hue, 210) 74% 54% / 0.32),
    inset 0 1px 0 hsl(0 0% 100% / 0.1);
}

.thought-kanban-card-item[data-importance-tier='3'] .thought-kanban-card {
  border-width: 1.5px;
  box-shadow:
    0 4px 14px hsl(228 45% 4% / 0.52),
    0 0 22px hsl(var(--idea-hue, 210) 78% 56% / 0.38),
    inset 0 1px 0 hsl(0 0% 100% / 0.12);
}

.thought-kanban-card-title {
  position: relative;
  left: auto;
  top: auto;
  display: block;
  width: 100%;
  padding: 0;
  font-size: calc(0.74rem * var(--thought-label-scale, 1));
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.015em;
  text-align: left;
  color: hsl(210 28% 96% / 0.94);
  text-shadow: 0 1px 2px hsl(228 45% 6% / 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
  transition:
    color 0.2s ease,
    text-shadow 0.2s ease;
}

.thought-kanban-card-item.is-hovered .thought-kanban-card {
  border-color: hsl(var(--idea-hue, 210) 82% 74% / 0.72);
  filter: brightness(1.08);
  transform: rotate(0deg) translateY(-2px) scale(1.02);
  box-shadow:
    0 6px 18px hsl(228 45% 4% / 0.55),
    0 0 22px hsl(var(--idea-hue, 210) 78% 58% / 0.45),
    inset 0 1px 0 hsl(0 0% 100% / 0.12);
}

.thought-kanban-card-item.is-hovered .thought-kanban-card-title {
  color: hsl(0 0% 100% / 1);
  text-shadow:
    0 0 8px hsl(var(--idea-hue, 210) 70% 55% / 0.35),
    0 1px 2px hsl(228 45% 6% / 0.85);
}

.thought-kanban-card-item.is-dragging .thought-kanban-card {
  cursor: grabbing;
  filter: brightness(1.1);
  transform: rotate(0deg) scale(1.04);
  box-shadow:
    0 10px 28px hsl(228 45% 4% / 0.62),
    0 0 32px hsl(var(--idea-hue, 210) 82% 58% / 0.55),
    inset 0 1px 0 hsl(0 0% 100% / 0.14);
}

.thought-kanban-card-item.is-kanban-settling .thought-kanban-card {
  animation: kanban-card-settle 0.48s cubic-bezier(0.34, 1.25, 0.48, 1);
}

.thought-kanban-card-item.is-kanban-complete-pulse .thought-kanban-card {
  animation: kanban-complete-pulse 0.72s ease-out;
}

.thought-kanban-card-item.is-entering .thought-kanban-card {
  animation: kanban-card-enter 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes kanban-card-enter {
  0% {
    opacity: 0;
    transform: scale(0.88) rotate(calc(var(--card-rotation, 0deg) - 4deg));
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(var(--card-rotation, 0deg));
  }
}

@keyframes kanban-card-settle {
  0% {
    transform: translateY(-6px) scale(1.04) rotate(0deg);
  }
  55% {
    transform: translateY(2px) scale(0.98) rotate(var(--card-rotation, 0deg));
  }
  100% {
    transform: translateY(0) scale(1) rotate(var(--card-rotation, 0deg));
  }
}

@keyframes kanban-complete-pulse {
  0% {
    box-shadow:
      0 2px 10px hsl(210 40% 4% / 0.38),
      0 0 14px hsl(158 58% 50% / 0.28);
  }
  40% {
    box-shadow:
      0 6px 22px hsl(158 70% 48% / 0.55),
      0 0 36px hsl(158 82% 56% / 0.65);
    filter: brightness(1.18);
  }
  100% {
    box-shadow:
      0 2px 10px hsl(210 40% 4% / 0.38),
      0 0 14px hsl(158 58% 50% / 0.28);
    filter: brightness(1);
  }
}

.thought-field-item.is-hovered {
  filter: none;
  opacity: 1;
}

.thought-field-item.is-entering .thought-field-anchor {
  animation: thought-field-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.thought-field-item.is-exiting {
  animation: thought-field-exit 0.32s ease forwards;
}

.thought-field-item.is-deleting {
  z-index: 40;
  pointer-events: none;
  filter: none;
  opacity: 1;
}

.thought-field-item.is-deleting .thought-field-anchor {
  animation: thought-field-anchor-delete calc(0.38s + var(--delete-power, 1) * 0.14s)
    cubic-bezier(0.34, 1.2, 0.48, 1) forwards;
}

.thought-field-item.is-deleting .thought-field-label {
  animation: thought-field-label-delete calc(0.38s + var(--delete-power, 1) * 0.14s)
    cubic-bezier(0.34, 1.2, 0.48, 1) forwards;
}

.thought-field-anchor {
  position: absolute;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  border: 1px solid hsl(var(--idea-hue, 210) 70% 68% / 0.55);
  background: radial-gradient(
    circle at 35% 30%,
    hsl(var(--idea-hue, 210) 90% 78% / 0.95),
    hsl(var(--idea-hue, 210) 55% 48% / 0.35) 55%,
    transparent 72%
  );
  box-shadow:
    0 0 10px hsl(var(--idea-hue, 210) 75% 58% / 0.55),
    0 0 22px hsl(var(--idea-hue, 210) 70% 50% / 0.22);
  transform: scale(var(--thought-scale, 1));
  transition:
    box-shadow 0.25s ease,
    transform 0.25s ease,
    border-color 0.25s ease;
}

.thought-field-item[data-kanban-status='todo'] .thought-field-anchor {
  border-color: hsl(206 65% 68% / 0.42);
  box-shadow:
    0 0 8px hsl(206 72% 54% / 0.35),
    0 0 20px hsl(206 72% 44% / 0.16);
}

.thought-field-item[data-kanban-status='inprogress'] .thought-field-anchor {
  border-color: hsl(188 80% 72% / 0.72);
  box-shadow:
    0 0 15px hsl(188 84% 62% / 0.7),
    0 0 30px hsl(188 78% 48% / 0.38);
}

.thought-field-item[data-kanban-status='complete'] .thought-field-anchor {
  border-color: hsl(155 60% 68% / 0.5);
  box-shadow:
    0 0 10px hsl(155 60% 56% / 0.48),
    0 0 24px hsl(155 58% 46% / 0.2);
}

.thought-field-item.gravity-rel {
  filter: blur(calc((1 - var(--thought-depth, 0.7)) * 0.16px));
  opacity: clamp(0.55, calc(var(--thought-opacity, 0.75) + 0.08), 0.98);
  transition:
    opacity 0.3s ease,
    filter 0.3s ease;
}

.thought-field-item.gravity-rel .thought-field-anchor {
  box-shadow:
    0 0 12px hsl(var(--idea-hue, 210) 76% 60% / 0.72),
    0 0 26px hsl(var(--idea-hue, 210) 70% 50% / 0.38);
}

[data-theme='light'] .thought-field-item.gravity-rel {
  opacity: clamp(0.65, calc(var(--thought-opacity, 0.75) + 0.06), 1);
}

.thought-field-item.is-hovered .thought-field-anchor {
  border-color: hsl(var(--idea-hue, 210) 85% 75% / 0.85);
  box-shadow:
    0 0 14px hsl(var(--idea-hue, 210) 80% 65% / 0.75),
    0 0 32px hsl(var(--idea-hue, 210) 75% 55% / 0.35);
}

.thought-field-label {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  padding: 0.15rem 0.4rem;
  font-size: calc(0.8125rem * var(--thought-label-scale, 1));
  line-height: 1.25;
  font-weight: 450;
  letter-spacing: 0.01em;
  color: hsl(210 25% 92% / 0.92);
  text-shadow:
    0 0 12px hsl(var(--idea-hue, 210) 60% 40% / 0.55),
    0 1px 2px hsl(228 40% 4% / 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 2.5ch;
  max-width: min(320px, 42vw);
  text-align: start;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transform-origin: center center;
  transition:
    color 0.25s ease,
    transform 0.25s ease,
    text-shadow 0.25s ease,
    filter 0.25s ease;
}

[data-theme='light'] .thought-field-label {
  color: hsl(228 35% 18% / 0.92);
  text-shadow:
    0 0 10px hsl(var(--idea-hue, 210) 55% 85% / 0.45),
    0 1px 0 hsl(0 0% 100% / 0.6);
}

.thought-field-label:hover {
  color: hsl(210 30% 98% / 0.98);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: hsl(var(--idea-hue, 210) 70% 68% / 0.55);
}

[data-theme='light'] .thought-field-label:hover {
  color: hsl(228 40% 12% / 0.98);
  text-decoration-color: hsl(var(--idea-hue, 210) 55% 42% / 0.45);
}

.thought-field-item.is-hovered .thought-field-label {
  color: hsl(0 0% 100% / 0.98);
  text-shadow:
    0 0 20px hsl(var(--idea-hue, 210) 78% 58% / 0.72),
    0 0 8px hsl(var(--idea-hue, 210) 70% 50% / 0.35),
    0 1px 3px hsl(228 50% 4% / 0.92);
  filter: drop-shadow(0 0 6px hsl(var(--idea-hue, 210) 70% 45% / 0.25));
}

[data-theme='light'] .thought-field-item.is-hovered .thought-field-label {
  color: hsl(228 40% 12% / 0.98);
}

@keyframes thought-field-enter {
  from {
    opacity: 0;
    transform: scale(0.2);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes thought-field-exit {
  to {
    opacity: 0;
    transform: scale(0.15);
  }
}

@keyframes thought-field-anchor-delete {
  0% {
    opacity: 1;
    transform: scale(var(--thought-scale, 1));
    filter: brightness(1) blur(0);
  }
  14% {
    transform: scale(calc(var(--thought-scale, 1) * (1.12 + var(--delete-power, 1) * 0.14)));
    filter: brightness(calc(1.4 + var(--delete-power, 1) * 0.4)) blur(0);
    box-shadow:
      0 0 calc(22px + var(--delete-power, 1) * 32px) hsl(var(--idea-hue, 210) 85% 62% / 0.8),
      0 0 calc(44px + var(--delete-power, 1) * 40px) hsl(var(--idea-hue, 210) 70% 50% / 0.35);
  }
  48% {
    transform: scale(calc(var(--thought-scale, 1) * (1.2 + var(--delete-power, 1) * 0.1)));
    opacity: 0.92;
  }
  100% {
    opacity: 0;
    transform: scale(0);
    filter: blur(calc(4px + var(--delete-power, 1) * 2px));
  }
}

@keyframes thought-field-label-delete {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
  18% {
    transform: scale(calc(1.06 + var(--delete-power, 1) * 0.08));
    filter: brightness(calc(1.35 + var(--delete-power, 1) * 0.35));
    text-shadow:
      0 0 calc(16px + var(--delete-power, 1) * 20px) hsl(var(--idea-hue, 210) 75% 58% / 0.85),
      0 1px 2px hsl(228 40% 4% / 0.85);
  }
  55% {
    transform: scale(0.4);
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: scale(0);
    filter: blur(3px);
  }
}

.ideas-canvas-wrap.is-thought-space-mode .idea-node--thought-dim {
  opacity: 0.22;
  filter: saturate(0.5) blur(0.5px);
  pointer-events: none;
}

.ideas-canvas-wrap.is-thought-space-mode .idea-node--thought-focus {
  opacity: 1;
  filter: none;
  pointer-events: auto;
  z-index: 3;
}

/* Add Thought — two-column compose + stream */
.thought-quick-add-dialog {
  width: min(56rem, calc(100vw - 2rem));
  overscroll-behavior: contain;
  overflow: hidden;
}

.thought-quick-add-form {
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  min-height: 0;
}

.thought-quick-add-header {
  align-items: flex-start;
  gap: 1rem;
}

.thought-quick-add-header .thought-quick-modal-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-top: 0.1rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
}

.thought-quick-add-header .thought-quick-modal-close:hover,
.thought-quick-add-header .thought-quick-modal-close:focus-visible {
  color: var(--text);
  border-color: hsl(210 55% 55% / 0.55);
  background: hsl(210 45% 50% / 0.14);
  outline: none;
}

.thought-quick-add-header-text h2 {
  margin: 0;
}

.thought-quick-add-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* Edit Thought — match Add Thought field + close styling */
.thought-edit-dialog {
  width: min(34rem, calc(100vw - 2rem));
  overscroll-behavior: contain;
  overflow: hidden;
}

.thought-edit-form {
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  min-height: 0;
}

.thought-edit-header {
  align-items: flex-start;
  gap: 1rem;
}

.thought-edit-header-text h2 {
  margin: 0;
}

.thought-edit-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
}

.thought-edit-modal-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-top: 0.1rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
}

.thought-edit-modal-close:hover,
.thought-edit-modal-close:focus-visible {
  color: var(--text);
  border-color: hsl(210 55% 55% / 0.55);
  background: hsl(210 45% 50% / 0.14);
  outline: none;
}

.thought-edit-dialog .thought-edit-body {
  display: block;
  grid-template-columns: none;
  padding: 1.35rem 1.5rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
}

.thought-edit-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.thought-edit-hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.thought-edit-short-input {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  padding: 0.55rem 0.65rem;
  line-height: 1.35;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.thought-edit-short-input:focus {
  outline: none;
  border-color: hsl(210 70% 55% / 0.65);
  box-shadow: 0 0 0 3px hsl(210 70% 55% / 0.18);
}

.thought-edit-single {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
}

.thought-edit-single .thought-quick-textarea {
  min-height: 10rem;
  resize: vertical;
}

.thought-edit-footer {
  border-top: 1px solid var(--border);
}

.thought-edit-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.15rem;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
}

.thought-edit-toggle input[type='checkbox'] {
  accent-color: hsl(var(--thought-space-idea-hue, 210) 72% 62%);
}

.thought-quick-add-dialog .thought-quick-add-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  flex: 1;
  align-items: stretch;
  justify-items: stretch;
  min-height: 0;
  /* Fixed height zone so intrinsic list height cannot grow the modal; stream scrolls inside */
  height: clamp(260px, 58vh, 520px);
  max-height: min(72vh, 540px);
}

.thought-quick-compose,
.thought-quick-sidebar {
  min-height: 0;
}

.thought-quick-compose {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.thought-quick-add-hint {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.thought-quick-add-hint kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.75rem;
  font-family: inherit;
  line-height: 1.2;
}

.thought-quick-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.thought-quick-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.thought-quick-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.thought-quick-select,
.thought-quick-textarea {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.thought-quick-select {
  padding: 0.55rem 0.65rem;
  cursor: pointer;
}

.thought-quick-textarea {
  flex: 1;
  min-height: 7.5rem;
  padding: 0.65rem 0.75rem;
  line-height: 1.45;
  resize: vertical;
}

.thought-quick-select:focus,
.thought-quick-textarea:focus {
  outline: none;
  border-color: hsl(210 70% 55% / 0.65);
  box-shadow: 0 0 0 3px hsl(210 70% 55% / 0.18);
}

.thought-quick-parent-lock-hint {
  margin: 0.35rem 0 0;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid hsl(210 45% 50% / 0.35);
  background: hsl(210 40% 45% / 0.14);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.thought-quick-parent-lock-hint.hidden {
  display: none;
}

.thought-quick-parent-locked .thought-quick-select:disabled {
  cursor: not-allowed;
  opacity: 0.92;
}

[data-theme='light'] .thought-quick-parent-lock-hint {
  background: hsl(210 45% 95% / 0.95);
}

.thought-quick-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  height: 100%;
  background: linear-gradient(
    180deg,
    hsl(220 28% 10% / 0.35) 0%,
    hsl(230 24% 8% / 0.2) 100%
  );
}

[data-theme='light'] .thought-quick-sidebar {
  background: linear-gradient(
    180deg,
    hsl(220 35% 96% / 0.9) 0%,
    hsl(220 30% 98% / 0.5) 100%
  );
}

.thought-quick-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.thought-quick-sidebar-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.thought-quick-sidebar-sub {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.thought-quick-count {
  flex-shrink: 0;
  min-width: 1.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  color: hsl(210 90% 92%);
  background: linear-gradient(135deg, hsl(210 70% 48%), hsl(230 65% 42%));
  box-shadow: 0 0 12px hsl(210 70% 50% / 0.35);
}

.thought-quick-count.is-zero {
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: none;
}

.thought-quick-list-panel {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding: 0.75rem 1rem 1rem;
}

.thought-quick-list-panel::-webkit-scrollbar {
  width: 7px;
}

.thought-quick-list-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: hsl(210 30% 45% / 0.35);
}

.thought-quick-list-panel::-webkit-scrollbar-track {
  background: transparent;
}

.thought-quick-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  min-height: 12rem;
  padding: 1.5rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  background: hsl(220 22% 12% / 0.25);
}

[data-theme='light'] .thought-quick-list-empty {
  background: hsl(220 30% 99% / 0.8);
}

.thought-quick-list-empty.hidden {
  display: none;
}

.thought-quick-empty-icon {
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0.55;
  margin-bottom: 0.25rem;
}

.thought-quick-empty-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.thought-quick-empty-text {
  margin: 0;
  max-width: 16rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.thought-quick-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.thought-quick-list.hidden {
  display: none;
}

.thought-quick-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid hsl(210 40% 40% / 0.22);
  background: hsl(220 24% 14% / 0.55);
  box-shadow: 0 1px 0 hsl(210 60% 70% / 0.06) inset;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

[data-theme='light'] .thought-quick-card {
  background: hsl(0 0% 100% / 0.92);
  border-color: var(--border);
}

.thought-quick-card:hover {
  border-color: hsl(210 60% 55% / 0.45);
  transform: translateY(-1px);
  box-shadow:
    0 4px 14px hsl(220 40% 8% / 0.2),
    0 1px 0 hsl(210 60% 70% / 0.08) inset;
}

.thought-quick-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-width: 0;
}

.thought-quick-card-index {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: hsl(210 85% 88%);
  background: hsl(210 55% 42% / 0.35);
  border: 1px solid hsl(210 50% 55% / 0.25);
}

.thought-quick-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.thought-quick-card-short {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thought-quick-card-detail {
  margin: 0;
  font-size: 0.78125rem;
  line-height: 1.42;
  color: var(--text-muted);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thought-quick-card-text {
  margin: 0;
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.45;
  word-break: break-word;
}

.thought-quick-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-left: 1.95rem;
}

.thought-quick-card-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.thought-quick-card-actions {
  flex-shrink: 0;
}

.thought-quick-add-footer {
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .thought-quick-add-dialog .thought-quick-add-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: min(76vh, 560px);
    max-height: min(78vh, 580px);
  }

  .thought-quick-compose {
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: auto;
    max-height: min(42vh, 320px);
  }

  .thought-quick-list-panel {
    max-height: none;
  }
}

@keyframes thought-cluster-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes thought-cluster-enter {
  from {
    transform: scale(0.2);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes thought-cluster-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.35);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes thought-particle-orbit {
  from {
    transform: rotate(var(--particle-angle, 0deg)) translateX(var(--particle-dist, 40%))
      rotate(calc(-1 * var(--particle-angle, 0deg)));
  }
  to {
    transform: rotate(calc(var(--particle-angle, 0deg) + 360deg))
      translateX(var(--particle-dist, 40%))
      rotate(calc(-1 * var(--particle-angle, 0deg) - 360deg));
  }
}

@keyframes thought-stardust-aura {
  0% {
    opacity: 0;
    transform: rotate(var(--stardust-angle, 0deg)) translateX(var(--stardust-r0, 14px))
      rotate(calc(-1 * var(--stardust-angle, 0deg))) scale(0.55);
  }
  22% {
    opacity: var(--stardust-peak, 0.2);
    transform: rotate(var(--stardust-angle, 0deg)) translateX(var(--stardust-r0, 14px))
      rotate(calc(-1 * var(--stardust-angle, 0deg))) scale(1);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--stardust-angle, 0deg)) translateX(var(--stardust-r1, 28px))
      rotate(calc(-1 * var(--stardust-angle, 0deg))) scale(0.75);
  }
}

@media (prefers-reduced-motion: reduce) {
  .thought-cluster,
  .thought-cluster-core,
  .thought-cluster-particle,
  .thought-cluster-stardust,
  .thought-field-item,
  .idea-thought-space {
    animation: none !important;
    transition: none !important;
  }

  .thought-cluster-stardust {
    display: none;
  }

  .idea-thought-space-particles {
    visibility: hidden;
  }
}

@media (max-width: 640px) {
  .similarity-options-bar {
    flex-direction: column;
  }

  .similarity-options-cards {
    flex-direction: column;
  }

  .similarity-option-card {
    max-width: none;
  }

  .similarity-options-action {
    width: 100%;
  }

  .similarity-ignored-btn,
  .similarity-run-btn {
    width: 100%;
  }

  .similarity-results-search {
    max-width: none;
  }
}
