/* ===== TOKENS ===== */
:root {
  --bg: #0a0b0f;
  --bg-2: #12141c;
  --bg-3: #1a1d28;
  --bg-4: #22263a;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);
  --text: #e8eaf0;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;

  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --accent-2: #22d3ee;
  --accent-3: #f59e0b;
  --success: #10b981;
  --danger: #f43f5e;
  --warn: #f59e0b;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;

  --sidebar-w: 220px;
  --topbar-h: 60px;

  --font: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html {
  scroll-behavior: smooth
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden
}

a {
  text-decoration: none;
  color: inherit
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none
}

input,
select,
textarea {
  font-family: inherit
}

canvas {
  max-width: 100%
}

/* ===== LAYOUT ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition), width var(--transition);
}

.sidebar.collapsed {
  width: 64px
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-footer .stat-label {
  display: none
}

.sidebar.collapsed .sidebar-footer {
  flex-direction: column;
  gap: 4px;
  align-items: center
}

.sidebar.collapsed .sidebar-stat {
  flex-direction: column;
  gap: 0
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 18px;
  height: 18px
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  white-space: nowrap
}

.logo-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text)
}

.logo-sub {
  font-size: 10px;
  color: var(--accent-2);
  letter-spacing: 0.1em;
  text-transform: uppercase
}

.sidebar-toggle {
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: color var(--transition), background var(--transition);
}

.sidebar-toggle:hover {
  color: var(--text);
  background: var(--bg-3)
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-3)
}

.nav-item.active {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12)
}

.sidebar-footer {
  padding: 12px 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

.sidebar-stat {
  display: flex;
  flex-direction: column;
  flex: 1
}

.sidebar-stat .stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em
}

.sidebar-stat .stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums
}

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left var(--transition);
  display: flex;
  flex-direction: column;
}

.main.sidebar-collapsed {
  margin-left: 64px
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px
}

.breadcrumb {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
}

.search-wrap svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted)
}

.search-wrap input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  padding: 8px 0;
  width: 200px;
}

.search-wrap input::placeholder {
  color: var(--text-muted)
}

/* ===== SECTIONS ===== */
.section {
  display: none;
  padding: 28px 28px 60px;
  animation: fadeUp 0.3s ease
}

.section.active {
  display: block
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text)
}

/* ===== FILTER CHIPS ===== */
.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap
}

.filter-chip {
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent)
}

.filter-chip.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  color: var(--accent)
}

/* ===== LOCATIONS GRID ===== */
.locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.location-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.location-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-color, var(--accent));
  opacity: 0.8;
}

.location-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card)
}

.location-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent)
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px
}

.card-cat {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em
}

.card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition)
}

.location-card:hover .card-actions {
  opacity: 1
}

.vector-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px
}

.vbar-row {
  display: flex;
  align-items: center;
  gap: 8px
}

.vbar-label {
  font-size: 10px;
  color: var(--text-muted);
  width: 70px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.vbar-track {
  flex: 1;
  height: 4px;
  background: var(--bg-4);
  border-radius: 2px;
  overflow: hidden
}

.vbar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease
}

.vbar-val {
  font-size: 10px;
  color: var(--text-muted);
  width: 28px;
  text-align: right;
  font-family: var(--font-mono)
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border)
}

.card-date {
  font-size: 11px;
  color: var(--text-muted)
}

/* ===== EMPTY STATE ===== */
.empty-state {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 12px;
}

.empty-icon svg {
  width: 48px;
  height: 48px;
  opacity: 0.3
}

/* ===== EDITOR ===== */
.editor-layout {
  display: flex;
  flex-direction: column;
  gap: 0
}

.editor-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 16px;
  color: var(--text-muted);
}

.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 24px
}

.editor-meta {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.editor-meta-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 300px;
}

.editor-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.editor-color-input {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  overflow: hidden;
}

.editor-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.editor-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.editor-name-input {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
}

.editor-name-input:focus {
  border-color: var(--accent);
  background: var(--bg-4)
}

.editor-category-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
}

.editor-category-input:focus {
  border-color: var(--accent);
  background: var(--bg-4);
  color: var(--text);
}

.editor-desc-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-dim);
  outline: none;
  resize: vertical;
  min-height: 40px;
  width: 100%;
  transition: all var(--transition);
}

.editor-desc-input:focus {
  border-color: var(--accent);
  background: var(--bg-4)
}

.editor-meta-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.vector-display {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.radar-wrap {
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  overflow: hidden;
}

.radar-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

@media(max-width:768px) {
  .vector-display {
    grid-template-columns: 1fr
  }

  .radar-wrap {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
  }
}

.vector-raw {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.vr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
}

.vr-label {
  font-size: 12px;
  color: var(--text-dim)
}

.vr-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent)
}

/* ===== SLIDERS ===== */
.sliders-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.slider-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color var(--transition);
}

.slider-card:hover {
  border-color: var(--border-hover)
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px
}

.slider-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px
}

.slider-label svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted)
}

.slider-values {
  display: flex;
  align-items: center;
  gap: 8px
}

.slider-vec {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent)
}

.raw-edit-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  transition: all var(--transition);
}

.raw-edit-wrap:focus-within {
  border-color: var(--accent);
  background: var(--bg-4);
}

.raw-edit-input {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  width: 50px;
  text-align: right;
  outline: none;
}

/* Hide spin buttons */
.raw-edit-input::-webkit-inner-spin-button,
.raw-edit-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.raw-unit {
  font-size: 10px;
  color: var(--text-muted);
}

.slider-raw {
  font-size: 11px;
  color: var(--text-muted);
}

.slider-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px
}

.slider-notes {
  margin-top: 12px;
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-dim);
  resize: vertical;
  min-height: 32px;
  outline: none;
  transition: all var(--transition);
}

.slider-notes:focus {
  border-color: var(--accent);
  background: var(--bg-4);
  color: var(--text);
}

.slider-wrap {
  position: relative;
  padding: 4px 0
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-4);
  border-radius: 2px;
  outline: none;
  transition: background var(--transition);
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-2);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 14px var(--accent-glow)
}

input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-2);
  cursor: pointer;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 4px
}

.slider-ticks span {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono)
}

/* ===== DASHBOARD ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media(max-width:900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr)
  }
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition);
}

.stat-card:hover {
  border-color: var(--border-hover)
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0
}

.stat-card-icon svg {
  width: 20px;
  height: 20px
}

.stat-card-val {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted)
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.dash-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.span-6 {
  grid-column: span 6
}

.span-12 {
  grid-column: span 12
}

@media(max-width:900px) {
  .span-6 {
    grid-column: span 12
  }
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.dash-card-header span:first-child {
  display: flex;
  align-items: center;
  gap: 8px
}

.dash-card-header svg {
  width: 15px;
  height: 15px
}

.badge {
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

/* Clusters */
.clusters-list {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.cluster-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color var(--transition);
}

.cluster-item:hover {
  border-color: var(--border-hover)
}

.cluster-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px
}

.cluster-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0
}

.cluster-label {
  font-size: 12px;
  font-weight: 600
}

.cluster-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto
}

.cluster-members {
  display: flex;
  flex-wrap: wrap;
  gap: 5px
}

.cluster-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--text-dim);
}

/* Gap List */
.gap-list {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.gap-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border)
}

.gap-item:last-child {
  border-bottom: none
}

.gap-name {
  font-size: 12px;
  font-weight: 500;
  width: 110px;
  flex-shrink: 0
}

.gap-bar-wrap {
  flex: 1;
  position: relative
}

.gap-bar-track {
  height: 6px;
  background: var(--bg-4);
  border-radius: 3px;
  overflow: hidden
}

.gap-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease
}

.gap-meta {
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  width: 60px;
  flex-shrink: 0;
  font-family: var(--font-mono)
}

.gap-warning {
  color: var(--warn)
}

.icon-sm {
  width: 14px;
  height: 14px
}

/* ===== PARAMS TABLE ===== */
.params-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border)
}

.params-table {
  width: 100%;
  border-collapse: collapse
}

.params-table th {
  background: var(--bg-2);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.params-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.params-table tr:last-child td {
  border-bottom: none
}

.params-table tr:hover td {
  background: var(--bg-3)
}

.font-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-2)
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-4);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  transition: all var(--transition);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch:hover .toggle-slider {
  border-color: var(--border-hover);
  background: var(--bg-3);
}

input:checked+.toggle-slider {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--success);
}

input:checked+.toggle-slider::before {
  transform: translateX(20px);
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--transition);
  min-width: 65px;
}

.status-text.active {
  color: var(--success);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px
}

.btn-primary {
  background: var(--accent);
  color: #fff
}

.btn-primary:hover {
  background: #4f52c9;
  box-shadow: 0 0 20px var(--accent-glow)
}

.btn-ghost {
  color: var(--text-muted);
  border: 1px solid var(--border)
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--bg-3)
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3)
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.25)
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--danger);
  border: 1px solid rgba(244, 63, 94, 0.3)
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25)
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: all var(--transition);
}

.btn-icon:hover {
  color: var(--text);
  background: var(--bg-3)
}

.btn-icon svg {
  width: 16px;
  height: 16px
}

.btn-icon.danger:hover {
  color: var(--danger)
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  place-items: center;
  z-index: 200;
}

.modal-overlay.open {
  display: grid
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(520px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-sm {
  width: min(400px, 95vw)
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px
}

.modal-header h3 svg {
  width: 16px;
  height: 16px
}

.modal-body {
  padding: 20px
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 14px
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px
}

.form-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow)
}

.form-input::placeholder {
  color: var(--text-muted)
}

textarea.form-input {
  resize: vertical
}

select.form-input option {
  background: var(--bg-2)
}

.color-input {
  padding: 4px 8px;
  height: 40px
}

.required {
  color: var(--danger)
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 500;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  animation: toastIn 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0
}

.toast.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399
}

.toast.error {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185
}

.toast.info {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

/* ===== UTILS ===== */
.text-muted {
  color: var(--text-muted)
}

.small {
  font-size: 12px
}

.tooltip-wrap {
  cursor: help;
  color: var(--text-muted)
}

.font-mono {
  font-family: var(--font-mono) !important;
}

.modal-info {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.5;
}

.import-actions-row {
  margin-top: -4px;
  margin-bottom: 12px;
  display: flex;
  justify-content: flex-start;
}

/* ===== MOBILE ===== */
@media(max-width:768px) {
  .sidebar {
    transform: translateX(-100%)
  }

  .sidebar.mobile-open {
    transform: translateX(0)
  }

  .main {
    margin-left: 0 !important
  }

  .section {
    padding: 16px 16px 40px
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr
  }

  .sliders-container {
    grid-template-columns: 1fr
  }

  .form-row {
    grid-template-columns: 1fr
  }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-track {
  background: var(--bg-2)
}

::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover)
}

/* ===== LOGIN OVERLAY ===== */
body.locked {
  overflow: hidden;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(7, 8, 12, 0.92);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.4s ease;
}

.login-overlay.hiding {
  animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 44px 40px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(99, 102, 241, 0.08);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.login-logo-icon svg {
  width: 24px;
  height: 24px;
}

.login-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.login-logo-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.login-logo-sub {
  font-size: 11px;
  color: var(--accent-2);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.login-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -4px;
}

.login-field-wrap {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}

.login-field-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
  transition: color var(--transition);
}

.login-input {
  width: 100%;
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 42px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  letter-spacing: 0.08em;
}

.login-input:focus {
  border-color: var(--accent);
  background: var(--bg-4);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-field-wrap:focus-within .login-field-icon {
  color: var(--accent);
}

.login-error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  min-height: 18px;
}

.login-error.visible {
  opacity: 1;
  transform: translateY(0);
}

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  font-family: var(--font);
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
  background: linear-gradient(135deg, #7577f3, #a5b4fc);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn svg {
  width: 16px;
  height: 16px;
}

.login-btn.shaking {
  animation: shake 0.4s cubic-bezier(0.36, .07, .19, .97);
}

@keyframes shake {

  10%,
  90% {
    transform: translateX(-2px);
  }

  20%,
  80% {
    transform: translateX(4px);
  }

  30%,
  50%,
  70% {
    transform: translateX(-6px);
  }

  40%,
  60% {
    transform: translateX(6px);
  }

  100% {
    transform: translateX(0);
  }
}