/* Celestech Next-Gen UI/UX Design System — Playground /4/
   Principles: Luminous precision, instrument-grade typography, collapsible horizontal navigation runway,
   seamless entity connectedness, contextual in-place configuration. */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Surfaces & Canvas */
  --bg-app: #f6f8fa;
  --bg-surface: #ffffff;
  --bg-surface-raised: #ffffff;
  --bg-subtle: #f0f2f6;
  --bg-hover: #e6ebf2;
  --bg-active: #dce2ec;
  
  /* Hairline Borders */
  --border-subtle: rgba(18, 24, 38, 0.08);
  --border-medium: rgba(18, 24, 38, 0.14);
  --border-strong: rgba(18, 24, 38, 0.24);
  --border-focus: #b45309;

  /* Ink Hierarchy */
  --ink-primary: #11141a;
  --ink-secondary: #485060;
  --ink-tertiary: #758095;
  --ink-muted: #9aa5b8;
  --ink-on-accent: #ffffff;

  /* Solar Core Accent */
  --solar-50: #fffbeb;
  --solar-100: #fef3c7;
  --solar-200: #fde68a;
  --solar-400: #fbbf24;
  --solar-500: #f59e0b;
  --solar-600: #d97706;
  --solar-700: #b45309;
  --solar-800: #92400e;

  /* Domain Category Hues */
  --domain-commerce: #c25e1a;
  --domain-operations: #d97706;
  --domain-fulfillment: #0284c7;
  --domain-finance: #059669;
  --domain-company: #4f46e5;
  --domain-settings: #64748b;

  /* Status Tokens */
  --status-success: #16a34a;
  --status-success-bg: #f0fdf4;
  --status-success-border: #bbf7d0;
  --status-warning: #d97706;
  --status-warning-bg: #fffbeb;
  --status-warning-border: #fde68a;
  --status-danger: #dc2626;
  --status-danger-bg: #fef2f2;
  --status-danger-border: #fecaca;
  --status-info: #2563eb;
  --status-info-bg: #eff6ff;
  --status-info-border: #bfdbfe;
  --status-neutral: #64748b;
  --status-neutral-bg: #f1f5f9;
  --status-neutral-border: #e2e8f0;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Geometry & Shadows */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  --shadow-subtle: 0 1px 2px rgba(18, 24, 38, 0.04);
  --shadow-card: 0 1px 3px rgba(18, 24, 38, 0.05), 0 4px 12px rgba(18, 24, 38, 0.03);
  --shadow-popover: 0 8px 24px rgba(18, 24, 38, 0.12), 0 2px 6px rgba(18, 24, 38, 0.06);
  --shadow-drawer: -6px 0 28px rgba(18, 24, 38, 0.12);

  /* Density variables */
  --table-cell-py: 12px;
  --table-cell-px: 16px;
  --table-font-size: 13.5px;
}

[data-density="compact"] {
  --table-cell-py: 7px;
  --table-cell-px: 12px;
  --table-font-size: 12.5px;
}

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

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.tabular, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   APP HEADER & UTILITY BAR
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 48px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.utility-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 800;
  font-size: 13.5px;
  letter-spacing: 0.1em;
  color: var(--ink-primary);
  text-transform: uppercase;
}

.brand-sun {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fef08a, var(--solar-500) 65%, var(--solar-700) 100%);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.sandbox-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--solar-800);
  background: var(--solar-100);
  border: 1px solid var(--solar-200);
  padding: 1px 7px;
  border-radius: var(--radius-xs);
}

.utility-center {
  flex: 1;
  max-width: 440px;
  margin: 0 20px;
}

.quick-search-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--ink-tertiary);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-search-trigger:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  color: var(--ink-secondary);
}

.search-hint-kbd {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

.utility-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.density-control {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.density-toggle-btn {
  background: transparent;
  border: none;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.1s ease;
}

.density-toggle-btn.active {
  background: var(--bg-surface);
  color: var(--ink-primary);
  box-shadow: var(--shadow-subtle);
}

.role-switcher-container {
  position: relative;
}

.role-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px 12px 3px 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-primary);
  transition: all 0.15s ease;
}

.role-pill:hover {
  border-color: var(--border-medium);
  background: var(--bg-hover);
}

.role-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--solar-700);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
}

/* ==========================================================================
   THE HORIZONTAL RUNWAY
   ========================================================================== */
.runway-wrapper {
  background: var(--bg-surface);
  position: relative;
  transition: all 0.2s ease;
}

/* Wide Mode: Primary Macro Categories */
.runway-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 50px;
  border-bottom: 1px solid var(--border-subtle);
}

.category-nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.category-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.14s ease;
}

.category-tab:hover {
  color: var(--ink-primary);
  background: var(--bg-subtle);
}

.category-tab.active {
  color: var(--ink-primary);
  background: var(--bg-subtle);
}

.category-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.indicator-commerce { background: var(--domain-commerce); }
.indicator-operations { background: var(--domain-operations); }
.indicator-fulfillment { background: var(--domain-fulfillment); }
.indicator-finance { background: var(--domain-finance); }
.indicator-company { background: var(--domain-company); }
.indicator-settings { background: var(--domain-settings); }

.category-badge-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-active);
  color: var(--ink-secondary);
}

.category-tab.active .category-badge-count {
  background: var(--solar-100);
  color: var(--solar-800);
}

/* Wide Mode: Secondary Pages / Sub-modules */
.runway-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 42px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.page-tab-list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.page-tab {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.12s ease;
}

.page-tab:hover {
  color: var(--ink-primary);
  background: var(--bg-hover);
}

.page-tab.active {
  color: var(--solar-800);
  font-weight: 600;
  background: var(--solar-50);
}

/* Runway Actions */
.runway-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-btn-contextual {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.config-btn-contextual:hover {
  background: var(--bg-subtle);
  border-color: var(--border-medium);
  color: var(--ink-primary);
}

/* ==========================================================================
   COLLAPSED RUNWAY (When deep into an order / document)
   ========================================================================== */
.runway-collapsed {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 48px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.runway-wrapper.is-collapsed .runway-primary,
.runway-wrapper.is-collapsed .runway-secondary {
  display: none;
}

.runway-wrapper.is-collapsed .runway-collapsed {
  display: flex;
}

.collapsed-spine {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.uncollapse-btn {
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--ink-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
  transition: all 0.15s ease;
}

.uncollapse-btn:hover {
  background: var(--bg-hover);
  color: var(--ink-primary);
}

.spine-crumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.12s ease;
}

.spine-crumb:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.spine-crumb.active-entity {
  font-weight: 700;
  color: var(--ink-primary);
  background: var(--bg-subtle);
}

.spine-chevron {
  color: var(--ink-muted);
  font-size: 11px;
}

.entity-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--status-warning-bg);
  color: var(--solar-800);
  border: 1px solid var(--status-warning-border);
}

/* Lateral Switcher Flyout on Crumb Hover */
.lateral-flyout {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 120;
  min-width: 240px;
  margin-top: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  padding: 6px;
}

.spine-crumb:hover .lateral-flyout {
  display: block;
}

.flyout-header {
  padding: 6px 10px 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-tertiary);
  letter-spacing: 0.05em;
}

.flyout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.1s ease;
}

.flyout-item:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.flyout-item.active {
  background: var(--solar-50);
  color: var(--solar-800);
  font-weight: 600;
}

/* ==========================================================================
   PAGE STAGE / CONTENT CANVAS
   ========================================================================== */
.main-stage {
  flex: 1;
  padding: 24px 32px 48px;
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
}

/* Philosophy Banner */
.philosophy-banner {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  border: 1px solid var(--solar-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-subtle);
}

.philosophy-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.philosophy-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--solar-800);
  display: flex;
  align-items: center;
  gap: 6px;
}

.philosophy-desc {
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.banner-action-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: var(--solar-700);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.banner-action-btn:hover {
  background: var(--solar-800);
}

/* Stage Header */
.stage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.stage-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stage-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stage-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
}

.stage-subtitle {
  font-size: 13px;
  color: var(--ink-tertiary);
}

.stage-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Action Tabs within Active Document */
.doc-tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border-medium);
  margin-bottom: 20px;
}

.doc-tab {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-tertiary);
  border-bottom: 2px solid transparent;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
  transition: all 0.12s ease;
  margin-bottom: -1px;
}

.doc-tab:hover {
  color: var(--ink-primary);
}

.doc-tab.active {
  color: var(--solar-800);
  border-bottom-color: var(--solar-600);
}

/* ==========================================================================
   THE LIVING ENTITY FABRIC (THE VISUAL CONNECTION SPINE)
   ========================================================================== */
.entity-fabric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-subtle);
}

.fabric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.fabric-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fabric-track {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}

.fabric-node {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.fabric-node:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.fabric-node.current {
  background: var(--solar-50);
  border-color: var(--solar-400);
  box-shadow: 0 0 0 1px var(--solar-400);
}

.node-icon-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: var(--bg-surface);
  color: var(--ink-secondary);
  border: 1px solid var(--border-subtle);
}

.fabric-node.current .node-icon-bubble {
  background: var(--solar-600);
  color: #fff;
  border-color: var(--solar-600);
}

.node-meta {
  display: flex;
  flex-direction: column;
}

.node-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-tertiary);
}

.node-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-primary);
}

.node-connector {
  color: var(--ink-muted);
  font-size: 14px;
  padding: 0 4px;
}

/* ==========================================================================
   PRECISION DATA GRID
   ========================================================================== */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-input {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px 6px 30px;
  font-size: 13px;
  width: 280px;
  outline: none;
  transition: all 0.15s ease;
}

.filter-input:focus {
  background: #fff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--solar-100);
}

.filter-icon {
  position: absolute;
  left: 10px;
  color: var(--ink-muted);
  font-size: 12px;
  pointer-events: none;
}

.quick-filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip:hover {
  background: var(--bg-hover);
  color: var(--ink-primary);
}

.chip.active {
  background: var(--solar-100);
  border-color: var(--solar-200);
  color: var(--solar-800);
  font-weight: 600;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.data-table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--table-font-size);
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px var(--table-cell-px);
  border-bottom: 1px solid var(--border-medium);
  white-space: nowrap;
  user-select: none;
}

.data-table thead th.sortable {
  cursor: pointer;
}

.data-table thead th.sortable:hover {
  color: var(--ink-primary);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.12s ease;
  cursor: pointer;
}

.data-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.data-table tbody tr.is-selected {
  background-color: var(--solar-50);
}

.data-table td {
  padding: var(--table-cell-py) var(--table-cell-px);
  color: var(--ink-primary);
  vertical-align: middle;
}

.table-cell-mono {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-primary);
}

.table-cell-amount {
  font-family: var(--font-mono);
  text-align: right;
  font-weight: 600;
}

.data-table thead th.align-right {
  text-align: right;
}

/* Status Pill in Table */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-warning {
  background: var(--status-warning-bg);
  color: var(--solar-800);
  border: 1px solid var(--status-warning-border);
}
.badge-warning .badge-dot { background: var(--solar-600); }

.badge-success {
  background: var(--status-success-bg);
  color: #15803d;
  border: 1px solid var(--status-success-border);
}
.badge-success .badge-dot { background: var(--status-success); }

.badge-info {
  background: var(--status-info-bg);
  color: #1d4ed8;
  border: 1px solid var(--status-info-border);
}
.badge-info .badge-dot { background: var(--status-info); }

.badge-neutral {
  background: var(--status-neutral-bg);
  color: #475569;
  border: 1px solid var(--status-neutral-border);
}
.badge-neutral .badge-dot { background: var(--status-neutral); }

/* Entity chip in table */
.entity-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--ink-secondary);
  transition: all 0.12s ease;
}

.entity-chip:hover {
  background: var(--bg-surface);
  border-color: var(--border-medium);
  color: var(--ink-primary);
}

/* ==========================================================================
   CONTEXTUAL IN-PLACE CONFIG DRAWER
   ========================================================================== */
.config-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 31, 0.4);
  backdrop-filter: blur(3px);
  z-index: 200;
  justify-content: flex-end;
}

.config-drawer-overlay.open {
  display: flex;
}

.config-drawer {
  width: 500px;
  max-width: 92vw;
  height: 100vh;
  background: var(--bg-surface);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-primary);
}

.drawer-subtitle {
  font-size: 12.5px;
  color: var(--ink-tertiary);
}

.drawer-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--ink-tertiary);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.drawer-close:hover {
  color: var(--ink-primary);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-tertiary);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 72%;
}

.setting-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-primary);
}

.setting-desc {
  font-size: 12px;
  color: var(--ink-tertiary);
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-medium);
  transition: .2s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
  box-shadow: var(--shadow-subtle);
}

input:checked + .slider {
  background-color: var(--solar-600);
  border-color: var(--solar-600);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   COMMAND PALETTE (CTRL+K)
   ========================================================================== */
.palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 31, 0.45);
  backdrop-filter: blur(4px);
  z-index: 300;
  justify-content: center;
  padding-top: 12vh;
}

.palette-overlay.open {
  display: flex;
}

.palette-box {
  width: 620px;
  max-width: 92vw;
  max-height: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-popover);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.palette-search-icon {
  font-size: 16px;
  color: var(--ink-tertiary);
}

.palette-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  color: var(--ink-primary);
}

.palette-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.palette-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-tertiary);
  padding: 8px 10px 4px;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s ease;
}

.palette-item:hover, .palette-item.selected {
  background: var(--solar-50);
}

.palette-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.palette-item-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-primary);
}

.palette-item-desc {
  font-size: 12px;
  color: var(--ink-tertiary);
}

.palette-shortcut {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-tertiary);
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}
