/* ==========================================================================
   Atlas Design System
   AMOLED black, monochromatic, compact. Based on the "Enterprise" Zed theme.
   A generalized component library — drop this CSS in and compose.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ---------- Backgrounds ---------- */
  --bg-base: #000000;
  --bg-sidebar: #000000;
  --bg-surface: #000000;
  --bg-raised: #0f0f0f;
  --bg-overlay: #0f0f0f;
  --bg-input: #0a0a0a;
  --bg-tab-active: #171717;
  --bg-tab-inactive: transparent;
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-selected: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.08);
  --bg-elevated: #0f0f0f;

  /* ---------- Text ---------- */
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --text-tertiary: #777777;
  --text-ghost: #333333;
  --text-inverse: #000000;
  --text-accent: #ffff00;
  --text-muted: #585858;

  /* ---------- Borders ---------- */
  --border-default: #1e1e1e;
  --border-subtle: #141414;
  --border-strong: #3d3d3d;
  --border-focus: #0070f3;
  --border-variant: #141414;

  /* ---------- Accent (Vercel-style: near-white primary, subtle blue highlight) ---------- */
  --accent-primary: #ededed;        /* button / primary surface */
  --accent-primary-hover: #ffffff;  /* hover brighter */
  --accent-primary-muted: rgba(237, 237, 237, 0.06);
  --accent-secondary: #a1a1a1;
  --accent-highlight: #0070f3;      /* focus ring / links / selection — Vercel blue */
  --accent-highlight-hover: #3291ff;
  --accent-highlight-muted: rgba(0, 112, 243, 0.12);

  /* ---------- Semantic / Status ---------- */
  --status-success: #4d4d4d;
  --status-success-muted: rgba(77, 77, 77, 0.12);
  --status-warning: #CD9731;
  --status-warning-muted: rgba(205, 151, 49, 0.12);
  --status-error: #F44747;
  --status-error-muted: rgba(244, 71, 71, 0.12);
  --status-info: #6796E6;
  --status-info-muted: rgba(103, 150, 230, 0.12);

  /* ---------- shadcn aliases ---------- */
  --background: var(--bg-base);
  --foreground: var(--text-primary);
  --card: var(--bg-raised);
  --card-foreground: var(--text-primary);
  --popover: var(--bg-overlay);
  --popover-foreground: var(--text-primary);
  --primary: var(--accent-primary);
  --primary-foreground: var(--text-inverse);
  --secondary: var(--bg-raised);
  --secondary-foreground: var(--text-secondary);
  --muted: #171717;
  --muted-foreground: var(--text-muted);
  --accent: #171717;
  --accent-foreground: var(--text-primary);
  --destructive: var(--status-error);
  --destructive-foreground: #ffffff;
  --border: var(--border-default);
  --input: var(--border-default);
  --ring: #0070f3;

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

  --text-xxs: 10px;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 28px;
  --text-3xl: 44px;

  /* ---------- Spacing (4px grid) ---------- */
  --space-0: 0px;
  --space-px: 1px;
  --space-0h: 2px;
  --space-1: 4px;
  --space-1h: 6px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* ---------- Radius ---------- */
  --radius: 0.375rem;
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-full: 9999px;

  /* ---------- Shadows (overlays only) ---------- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.9);
  --shadow-overlay: 0 16px 48px rgba(0, 0, 0, 0.95);

  /* ---------- Z-index ---------- */
  --z-dropdown: 50;
  --z-sticky: 60;
  --z-overlay: 100;
  --z-modal: 200;
  --z-toast: 300;
  --z-tooltip: 400;
  --z-max: 9999;

  /* ---------- Component sizing ---------- */
  --h-titlebar: 36px;
  --h-tabbar: 34px;
  --h-panel-header: 32px;
  --h-statusbar: 28px;
  --h-icon-button: 28px;
  --h-row: 24px;
  --h-input-sm: 20px;
  --h-input: 24px;
  --h-button: 28px;
}

/* ==========================================================================
   Global base
   ========================================================================== */
* { box-sizing: border-box; }

html, body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
}

/* ---------- Semantic type ---------- */
h1, .h1 {
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
h2, .h2 {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
h3, .h3 {
  font-family: var(--font-ui);
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
h4, .h4 {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
p, .p {
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}
small, .small {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}
code, .code, pre, kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-primary);
}
.label-upper {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.caption {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
}
.mono { font-family: var(--font-mono); }

/* ==========================================================================
   Component primitives — .atlas-* prefix
   ========================================================================== */

/* ---------- Buttons ---------- */
.atlas-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1h);
  height: var(--h-button);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.atlas-btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
}
.atlas-btn-primary:hover { background: var(--accent-primary-hover); }
.atlas-btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.atlas-btn-secondary:hover { background: var(--bg-tab-active); }
.atlas-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.atlas-btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.atlas-btn-destructive {
  background: var(--status-error-muted);
  color: var(--status-error);
  border-color: rgba(244, 71, 71, 0.25);
}
.atlas-btn-destructive:hover { background: rgba(244, 71, 71, 0.18); }
.atlas-btn-sm { height: 22px; padding: 0 var(--space-2); font-size: var(--text-xs); }
.atlas-btn-lg { height: 36px; padding: 0 var(--space-4); font-size: var(--text-base); }
.atlas-btn-icon {
  width: var(--h-icon-button);
  height: var(--h-icon-button);
  padding: 0;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
}
.atlas-btn-icon:hover { background: var(--bg-hover); color: var(--text-secondary); }

/* ---------- Inputs ---------- */
.atlas-input {
  height: var(--h-input);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 var(--space-2);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-sm);
  outline: none;
  width: 100%;
}
.atlas-input::placeholder { color: var(--text-tertiary); }
.atlas-input:focus { border-color: var(--border-focus); }
.atlas-input-sm { height: var(--h-input-sm); font-size: var(--text-xs); }

/* ---------- Cards & Panels ---------- */
.atlas-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.atlas-card-header {
  height: var(--h-panel-header);
  padding: 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-1h);
  border-bottom: 1px solid var(--border-subtle);
}
.atlas-card-body { padding: var(--space-2) var(--space-3); }

.atlas-panel-header {
  height: var(--h-panel-header);
  padding: 0 var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.atlas-panel-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* ---------- Tabs ---------- */
.atlas-tabbar {
  height: var(--h-tabbar);
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-base);
  overflow-x: auto;
  flex-shrink: 0;
}
.atlas-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1h);
  padding: 0 var(--space-3);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-tertiary);
  font: 500 var(--text-sm) var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
}
.atlas-tab:hover { color: var(--text-secondary); background: var(--bg-hover); }
.atlas-tab.is-active {
  color: var(--text-primary);
  background: var(--bg-tab-active);
  border-bottom-color: var(--accent-primary);
}

/* ---------- List items ---------- */
.atlas-list { display: flex; flex-direction: column; }
.atlas-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-1h);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  cursor: pointer;
}
.atlas-list-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.atlas-list-item.is-selected {
  background: var(--bg-selected);
  color: var(--text-primary);
  border-left-color: var(--accent-primary);
}

/* ---------- Badges ---------- */
.atlas-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xxs);
  padding: 2px var(--space-1h);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  line-height: 1.4;
}
.atlas-badge-primary { color: var(--text-primary); background: var(--bg-active); border-color: var(--border-strong); }
.atlas-badge-warning { color: var(--status-warning); background: var(--status-warning-muted); border-color: rgba(205,151,49,0.25); }
.atlas-badge-error { color: var(--status-error); background: var(--status-error-muted); border-color: rgba(244,71,71,0.25); }
.atlas-badge-info { color: var(--status-info); background: var(--status-info-muted); border-color: rgba(103,150,230,0.25); }
.atlas-badge-success { color: var(--text-secondary); background: var(--status-success-muted); border-color: rgba(77,77,77,0.3); }

.atlas-pill {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xxs);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: nowrap;
}
.atlas-pill-active { color: var(--text-primary); background: var(--bg-active); border-color: var(--border-strong); }

.atlas-kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xxs);
  padding: 1px var(--space-1h);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

/* ---------- Status / Dirty indicator ---------- */
.atlas-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}
.atlas-dot-primary { background: var(--accent-primary); }
.atlas-dot-success { background: var(--status-success); }
.atlas-dot-warning { background: var(--status-warning); }
.atlas-dot-error { background: var(--status-error); }
.atlas-dot-info { background: var(--status-info); }

/* ---------- Title / Status bars ---------- */
.atlas-titlebar {
  height: var(--h-titlebar);
  padding: 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-default);
  user-select: none;
  flex-shrink: 0;
}
.atlas-statusbar {
  height: var(--h-statusbar);
  padding: 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-base);
  border-top: 1px solid var(--border-default);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ---------- Dropdown / Popover ---------- */
.atlas-popover {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1) 0;
  min-width: 180px;
}
.atlas-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  height: 30px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  cursor: pointer;
}
.atlas-menu-item:hover { background: var(--bg-tab-active); color: var(--text-primary); }
.atlas-menu-separator { height: 1px; background: var(--border-default); margin: var(--space-1) 0; }

/* ---------- Checkbox / Radio ---------- */
.atlas-check { accent-color: var(--accent-primary); }

/* ---------- Progress ---------- */
.atlas-progress {
  height: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.atlas-progress-bar {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
}

/* ---------- Toggle switch ---------- */
.atlas-switch {
  width: 28px;
  height: 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.atlas-switch::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--text-tertiary);
  transition: transform 120ms ease-out, background 120ms ease-out;
}
.atlas-switch.is-on { background: var(--accent-primary); border-color: var(--accent-primary); }
.atlas-switch.is-on::after { transform: translateX(12px); background: var(--text-inverse); }

/* ---------- Avatar ---------- */
.atlas-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-xxs);
  font-weight: 600;
  color: var(--text-secondary);
}

/* ---------- Divider ---------- */
.atlas-divider { height: 1px; background: var(--border-default); border: 0; margin: 0; }
.atlas-divider-v { width: 1px; background: var(--border-default); align-self: stretch; }

/* ==========================================================================
   Scrollbar, focus, transitions
   ========================================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.14); }
.hide-scrollbar { scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

button, a, select { transition: background-color 120ms ease-out; }

*:focus-visible {
  outline: 1px solid var(--border-focus);
  outline-offset: 1px;
}

/* ==========================================================================
   Light mode — [data-theme="light"] on <html> or <body>
   Also honors .light class so shadcn toggles work interchangeably.
   Dark is the default; these overrides invert surfaces and text while keeping
   the compact, border-defined aesthetic and the blue highlight.
   ========================================================================== */
[data-theme="light"],
.light {
  /* Backgrounds — paper white → subtle gray stack */
  --bg-base: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-raised: #fafafa;
  --bg-overlay: #ffffff;
  --bg-input: #ffffff;
  --bg-tab-active: #f4f4f5;
  --bg-tab-inactive: transparent;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-selected: rgba(0, 112, 243, 0.06);
  --bg-active: rgba(0, 0, 0, 0.06);
  --bg-elevated: #fafafa;

  /* Text — inverted ramp */
  --text-primary: #0a0a0a;
  --text-secondary: #52525b;
  --text-tertiary: #71717a;
  --text-ghost: #d4d4d8;
  --text-inverse: #ffffff;
  --text-accent: #b45309;   /* amber in place of unreadable yellow */
  --text-muted: #a1a1aa;

  /* Borders */
  --border-default: #e4e4e7;
  --border-subtle: #f4f4f5;
  --border-strong: #d4d4d8;
  --border-focus: #0070f3;
  --border-variant: #f4f4f5;

  /* Accent — primary is near-black so it reads on white; blue highlight stays */
  --accent-primary: #0a0a0a;
  --accent-primary-hover: #27272a;
  --accent-primary-muted: rgba(10, 10, 10, 0.06);
  --accent-secondary: #71717a;
  --accent-highlight: #0070f3;
  --accent-highlight-hover: #0761d1;
  --accent-highlight-muted: rgba(0, 112, 243, 0.10);

  /* Status — unchanged palette but adjusted tints on white */
  --status-success: #166534;
  --status-success-muted: rgba(22, 101, 52, 0.08);
  --status-warning: #b45309;
  --status-warning-muted: rgba(180, 83, 9, 0.10);
  --status-error: #dc2626;
  --status-error-muted: rgba(220, 38, 38, 0.08);
  --status-info: #0070f3;
  --status-info-muted: rgba(0, 112, 243, 0.08);

  /* shadcn aliases remap for light */
  --background: var(--bg-base);
  --foreground: var(--text-primary);
  --card: var(--bg-base);
  --card-foreground: var(--text-primary);
  --popover: var(--bg-overlay);
  --popover-foreground: var(--text-primary);
  --primary: var(--accent-primary);
  --primary-foreground: var(--text-inverse);
  --secondary: var(--bg-raised);
  --secondary-foreground: var(--text-primary);
  --muted: #f4f4f5;
  --muted-foreground: var(--text-tertiary);
  --accent: #f4f4f5;
  --accent-foreground: var(--text-primary);
  --destructive: var(--status-error);
  --destructive-foreground: #ffffff;
  --border: var(--border-default);
  --input: var(--border-default);
  --ring: #0070f3;
}

/* Light-mode tweaks for pieces that hardcode hex values or white-on-dark */
[data-theme="light"] ::-webkit-scrollbar-thumb,
.light ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover,
.light ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.22); }
[data-theme="light"] ::selection,
.light ::selection { background: var(--accent-highlight-muted); color: var(--text-primary); }

/* Skeleton shimmer — light ramp */
[data-theme="light"] .atlas-skeleton,
.light .atlas-skeleton {
  background: linear-gradient(90deg, #f4f4f5 0%, #e4e4e7 50%, #f4f4f5 100%);
  background-size: 200% 100%;
}

/* Tooltip light variant — invert to dark on light */
[data-theme="light"] .atlas-tooltip,
.light .atlas-tooltip { background: #0a0a0a; color: #fff; }
[data-theme="light"] .atlas-tooltip-dark,
.light .atlas-tooltip-dark { background: #fff; color: #0a0a0a; border-color: var(--border-default); }

/* Slider thumb — in light mode the white-on-white disappears, use accent */
[data-theme="light"] .atlas-slider-thumb,
.light .atlas-slider-thumb { background: #fff; border-color: var(--border-strong); }

/* Avatar group ring — on light bg, overlap ring should be white */
[data-theme="light"] .atlas-avatar-group .atlas-avatar + .atlas-avatar,
.light .atlas-avatar-group .atlas-avatar + .atlas-avatar { box-shadow: 0 0 0 2px #fff; }

/* Titlebar/statusbar keep the base bg, which inverts automatically — no extra rule needed */

/* Status dots in light mode — use saturated status hues for success/warning */
[data-theme="light"] .atlas-dot-success,
.light .atlas-dot-success { background: #22c55e; }

/* Segmented active chip — on light, use white with border */
[data-theme="light"] .atlas-segmented-item.is-active,
.light .atlas-segmented-item.is-active { background: #fff; color: var(--text-primary); box-shadow: 0 0 0 1px var(--border-default); }

/* Dialog footer — raised bg is now near-white, keep subtle contrast */
[data-theme="light"] .atlas-dialog-footer,
.light .atlas-dialog-footer { background: var(--bg-raised); }

/* Command item hover — tab-active is now #f4f4f5 which is correct */

/* Switch on-state thumb */
[data-theme="light"] .atlas-switch.is-on::after,
.light .atlas-switch.is-on::after { background: #fff; }

/* ---------- Link ---------- */
.atlas-link { color: var(--accent-highlight); text-decoration: none; text-underline-offset: 2px; cursor: pointer; }
.atlas-link:hover { color: var(--accent-highlight-hover); text-decoration: underline; }

/* ---------- Selection ---------- */
::selection { background: var(--accent-highlight-muted); color: var(--text-primary); }

/* ---------- Alert ---------- */
.atlas-alert {
  display: flex; gap: var(--space-2); align-items: flex-start;
  padding: var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.atlas-alert-title { color: var(--text-primary); font-weight: 600; font-size: var(--text-sm); margin-bottom: 2px; }
.atlas-alert-desc { color: var(--text-tertiary); font-size: var(--text-xs); line-height: 1.5; }
.atlas-alert-icon { flex-shrink: 0; margin-top: 1px; color: var(--text-tertiary); }
.atlas-alert-info { border-color: rgba(0, 112, 243, 0.25); background: var(--accent-highlight-muted); }
.atlas-alert-info .atlas-alert-title, .atlas-alert-info .atlas-alert-icon { color: var(--accent-highlight); }
.atlas-alert-warning { border-color: rgba(205,151,49,0.25); background: var(--status-warning-muted); }
.atlas-alert-warning .atlas-alert-title, .atlas-alert-warning .atlas-alert-icon { color: var(--status-warning); }
.atlas-alert-error { border-color: rgba(244,71,71,0.25); background: var(--status-error-muted); }
.atlas-alert-error .atlas-alert-title, .atlas-alert-error .atlas-alert-icon { color: var(--status-error); }

/* ---------- Toast ---------- */
.atlas-toast {
  display: flex; gap: var(--space-2); align-items: center;
  min-width: 280px; max-width: 380px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.atlas-toast-desc { color: var(--text-tertiary); font-size: var(--text-xs); }
.atlas-toast-close { margin-left: auto; color: var(--text-tertiary); cursor: pointer; }

/* ---------- Tooltip ---------- */
.atlas-tooltip {
  display: inline-block;
  padding: 4px var(--space-2);
  background: #ededed;
  color: #000;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}
.atlas-tooltip-dark {
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

/* ---------- Dialog / Sheet ---------- */
.atlas-dialog-backdrop { background: rgba(0,0,0,0.7); position: fixed; inset: 0; }
.atlas-dialog {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  width: 100%; max-width: 480px;
  overflow: hidden;
}
.atlas-dialog-header { padding: var(--space-4) var(--space-4) var(--space-2); }
.atlas-dialog-title { font-size: var(--text-md); font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.atlas-dialog-desc { font-size: var(--text-sm); color: var(--text-tertiary); line-height: 1.5; }
.atlas-dialog-body { padding: var(--space-2) var(--space-4); }
.atlas-dialog-footer {
  display: flex; gap: var(--space-2); justify-content: flex-end;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-raised);
}

/* ---------- Command palette ---------- */
.atlas-command {
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  width: 100%; max-width: 560px;
  overflow: hidden;
}
.atlas-command-input-wrap {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-3); height: 40px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
}
.atlas-command-input {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: var(--text-primary); font-size: var(--text-base); font-family: inherit;
}
.atlas-command-input::placeholder { color: var(--text-tertiary); }
.atlas-command-group-label {
  padding: var(--space-2) var(--space-3) 4px;
  font-size: var(--text-xxs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}
.atlas-command-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-3); height: 32px;
  font-size: var(--text-sm); color: var(--text-secondary);
  cursor: pointer;
}
.atlas-command-item:hover, .atlas-command-item.is-active {
  background: var(--bg-tab-active); color: var(--text-primary);
}
.atlas-command-item-shortcut { margin-left: auto; }

/* ---------- Accordion ---------- */
.atlas-accordion { border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-raised); }
.atlas-accordion-item + .atlas-accordion-item { border-top: 1px solid var(--border-subtle); }
.atlas-accordion-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3); background: transparent; border: 0;
  color: var(--text-primary); font: 500 var(--text-sm) var(--font-ui); cursor: pointer;
  text-align: left;
}
.atlas-accordion-trigger:hover { background: var(--bg-hover); }
.atlas-accordion-chev { color: var(--text-tertiary); transition: transform 150ms ease-out; }
.atlas-accordion-item.is-open .atlas-accordion-chev { transform: rotate(90deg); }
.atlas-accordion-content { padding: 0 var(--space-3) var(--space-3); color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.55; }

/* ---------- Breadcrumb ---------- */
.atlas-breadcrumb { display: flex; align-items: center; gap: var(--space-1h); font-size: var(--text-sm); color: var(--text-tertiary); }
.atlas-breadcrumb a { color: var(--text-tertiary); text-decoration: none; }
.atlas-breadcrumb a:hover { color: var(--text-primary); }
.atlas-breadcrumb-sep { color: var(--text-ghost); }
.atlas-breadcrumb-current { color: var(--text-primary); }

/* ---------- Pagination ---------- */
.atlas-pagination { display: flex; align-items: center; gap: 2px; }
.atlas-pagination-item {
  min-width: 28px; height: 28px; padding: 0 var(--space-2);
  display: inline-flex; align-items: center; justify-content: center;
  font: 500 var(--text-sm) var(--font-ui);
  color: var(--text-secondary);
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-md); cursor: pointer;
}
.atlas-pagination-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.atlas-pagination-item.is-active {
  background: var(--bg-raised); border-color: var(--border-default); color: var(--text-primary);
}
.atlas-pagination-ellipsis { color: var(--text-muted); padding: 0 4px; }

/* ---------- Skeleton ---------- */
.atlas-skeleton {
  background: linear-gradient(90deg, #0a0a0a 0%, #171717 50%, #0a0a0a 100%);
  background-size: 200% 100%;
  animation: atlas-shimmer 1.6s linear infinite;
  border-radius: var(--radius-md);
}
@keyframes atlas-shimmer { to { background-position: -200% 0; } }

/* ---------- Slider ---------- */
.atlas-slider {
  position: relative; height: 16px; width: 100%;
  display: flex; align-items: center;
}
.atlas-slider-track {
  width: 100%; height: 4px;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full); overflow: hidden;
}
.atlas-slider-range {
  height: 100%; background: var(--accent-primary); border-radius: var(--radius-full);
}
.atlas-slider-thumb {
  position: absolute; top: 50%;
  width: 14px; height: 14px; border-radius: var(--radius-full);
  background: #fff; border: 1px solid var(--border-strong);
  transform: translate(-50%, -50%);
  box-shadow: var(--shadow-sm); cursor: grab;
}

/* ---------- Segmented control / Toggle group ---------- */
.atlas-segmented {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.atlas-segmented-item {
  height: 22px; padding: 0 var(--space-2);
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: 0;
  font: 500 var(--text-xs) var(--font-ui); color: var(--text-tertiary);
  border-radius: var(--radius-sm); cursor: pointer;
}
.atlas-segmented-item:hover { color: var(--text-secondary); }
.atlas-segmented-item.is-active { background: #171717; color: var(--text-primary); box-shadow: 0 0 0 1px var(--border-default); }

.atlas-toggle {
  height: 28px; padding: 0 var(--space-2);
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: 1px solid transparent;
  font: 500 var(--text-sm) var(--font-ui); color: var(--text-tertiary);
  border-radius: var(--radius-md); cursor: pointer;
}
.atlas-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.atlas-toggle.is-on { background: var(--bg-raised); border-color: var(--border-default); color: var(--text-primary); }

/* ---------- Table ---------- */
.atlas-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.atlas-table thead th {
  padding: var(--space-2) var(--space-3);
  text-align: left; font-weight: 600;
  font-size: var(--text-xxs); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-default);
  position: sticky; top: 0;
}
.atlas-table tbody td {
  padding: var(--space-2) var(--space-3);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.atlas-table tbody tr:hover td { background: var(--bg-hover); color: var(--text-primary); }
.atlas-table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Empty state ---------- */
.atlas-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-8) var(--space-4);
  text-align: center; color: var(--text-tertiary);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}
.atlas-empty-icon { color: var(--text-muted); margin-bottom: var(--space-3); }
.atlas-empty-title { color: var(--text-primary); font-weight: 600; font-size: var(--text-base); margin-bottom: 4px; }
.atlas-empty-desc { font-size: var(--text-sm); color: var(--text-tertiary); max-width: 320px; line-height: 1.5; }

/* ---------- Stepper ---------- */
.atlas-stepper { display: flex; align-items: center; gap: var(--space-2); }
.atlas-stepper-step { display: flex; align-items: center; gap: var(--space-2); }
.atlas-stepper-dot {
  width: 20px; height: 20px; border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 var(--text-xxs) var(--font-mono);
  background: var(--bg-raised); border: 1px solid var(--border-default);
  color: var(--text-tertiary);
}
.atlas-stepper-step.is-active .atlas-stepper-dot { background: var(--accent-highlight); border-color: var(--accent-highlight); color: #fff; }
.atlas-stepper-step.is-done .atlas-stepper-dot { background: var(--bg-raised); border-color: var(--accent-highlight); color: var(--accent-highlight); }
.atlas-stepper-label { font-size: var(--text-sm); color: var(--text-tertiary); }
.atlas-stepper-step.is-active .atlas-stepper-label,
.atlas-stepper-step.is-done .atlas-stepper-label { color: var(--text-primary); }
.atlas-stepper-sep { flex: 1; height: 1px; background: var(--border-default); min-width: 20px; }

/* ---------- Hover card / stat ---------- */
.atlas-stat {
  padding: var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
}
.atlas-stat-label { font-size: var(--text-xxs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.atlas-stat-value { font-size: var(--text-2xl); font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.atlas-stat-delta { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 2px; font-family: var(--font-mono); }
.atlas-stat-delta.is-up { color: #50e3c2; }
.atlas-stat-delta.is-down { color: var(--status-error); }

/* ---------- Checkbox / Radio custom ---------- */
.atlas-checkbox {
  width: 14px; height: 14px; flex-shrink: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
  cursor: pointer;
}
.atlas-checkbox.is-checked {
  background: var(--accent-highlight); border-color: var(--accent-highlight); color: #fff;
}
.atlas-radio {
  width: 14px; height: 14px; flex-shrink: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.atlas-radio.is-checked { border-color: var(--accent-highlight); }
.atlas-radio.is-checked::after {
  content: ''; width: 6px; height: 6px; border-radius: var(--radius-full);
  background: var(--accent-highlight);
}

/* ---------- Avatar group ---------- */
.atlas-avatar-group { display: inline-flex; }
.atlas-avatar-group .atlas-avatar + .atlas-avatar { margin-left: -6px; box-shadow: 0 0 0 2px #000; }
