:root {
  --color-primary-50: #e8ecf4;
  --color-primary-100: #d1dae8;
  --color-primary-200: #a3b5d1;
  --color-primary-300: #627d98;
  --color-primary-400: #486581;
  --color-primary-500: #102a43;
  --color-primary-600: #0d2137;
  --color-primary-700: #0a1929;
  --color-primary-800: #07111c;
  --color-primary-900: #04090e;

  --color-success-50: #f0fdf4;
  --color-success-100: #dcfce7;
  --color-success-200: #bbf7d0;
  --color-success-500: #257750;
  --color-success-600: #1e6343;
  --color-success-700: #175236;

  --color-warning-50: #fffbeb;
  --color-warning-100: #fef3c7;
  --color-warning-200: #fde68a;
  --color-warning-500: #d97706;
  --color-warning-600: #b45309;
  --color-warning-700: #92400e;

  --color-danger-50: #fef2f2;
  --color-danger-100: #fee2e2;
  --color-danger-200: #fecaca;
  --color-danger-500: #c42b31;
  --color-danger-600: #a72328;
  --color-danger-700: #8b1d22;

  --color-info-50: #eff6ff;
  --color-info-100: #dbeafe;
  --color-info-200: #bfdbfe;
  --color-info-500: #2563eb;
  --color-info-600: #1d4ed8;
  --color-info-700: #1e40af;

  --color-neutral-50: #f8fafc;
  --color-neutral-100: #f1f5f9;
  --color-neutral-200: #e2e8f0;
  --color-neutral-300: #cbd5e1;
  --color-neutral-400: #94a3b8;
  --color-neutral-500: #6b7280;
  --color-neutral-600: #4b5563;
  --color-neutral-700: #374151;
  --color-neutral-800: #1f2937;
  --color-neutral-900: #111827;

  --color-gold-50: #fdf9e8;
  --color-gold-100: #faf0c8;
  --color-gold-200: #f5e08e;
  --color-gold-300: #ecc94b;
  --color-gold-400: #d4a928;
  --color-gold-500: #b8941e;
  --color-gold-600: #9a7b18;
  --color-gold-700: #7c6313;

  --atlas-primary: var(--color-primary-500);
  --atlas-primary-light: var(--color-primary-400);
  --atlas-primary-muted: var(--color-primary-300);
  --atlas-accent: var(--color-neutral-200);
  --atlas-accent-light: var(--color-neutral-50);
  --atlas-accent-medium: var(--color-neutral-100);
  --atlas-cream: #ffffff;

  --atlas-gold: var(--color-gold-400);
  --atlas-gold-light: var(--color-gold-100);
  --atlas-gold-muted: var(--color-gold-300);

  --atlas-bg: var(--color-neutral-50);
  --atlas-panel: var(--atlas-cream);
  --atlas-panel2: var(--color-neutral-100);
  --atlas-text: var(--color-neutral-800);
  --atlas-muted: var(--color-neutral-500);
  --atlas-body-strong: var(--color-neutral-700);
  --atlas-body-stronger: var(--color-neutral-800);
  --atlas-line: var(--color-neutral-100);

  --atlas-good: var(--color-success-500);
  --atlas-warn: var(--color-warning-500);
  --atlas-bad: var(--color-danger-500);
  --atlas-info: var(--color-info-500);
  --atlas-blue: var(--color-info-500);

  --atlas-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 24px rgba(15, 23, 42, 0.06);
  --atlas-shadow-lg: 0 4px 6px rgba(15, 23, 42, 0.05), 0 10px 40px rgba(15, 23, 42, 0.1);
  --atlas-radius: 12px;
  --atlas-radius-sm: 10px;
  --atlas-radius-xs: 8px;

  --atlas-sidebar: #0f172a;
  --atlas-sidebar-text: rgba(255, 255, 255, 0.9);
  --atlas-sidebar-muted: rgba(255, 255, 255, 0.6);
  --atlas-sidebar-active: rgba(255, 255, 255, 0.15);
  --atlas-sidebar-line: rgba(255, 255, 255, 0.1);

  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* Theme Body Background */
.atlas-dark-theme {
  background: var(--atlas-bg);
  color: var(--atlas-text);
}

.atlas-dark-theme * {
  transition-timing-function: ease;
}

/* Topbar - Fixed navigation with proper layout */
.atlas-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  border-bottom: 1px solid var(--atlas-accent-medium);
  background: #ffffff;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 40;
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

/* On desktop, offset topbar to start after the sidebar */
@media (min-width: 1024px) {
  .atlas-topbar.has-sidebar {
    left: 16rem;
  }
}

/* Topbar inner container */
.atlas-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1rem;
}

@media (min-width: 1024px) {
  .atlas-topbar-inner {
    padding: 0 1.5rem;
  }
}

/* Hide topbar logo on desktop when sidebar has its own logo */
@media (min-width: 1024px) {
  .atlas-topbar.has-sidebar .atlas-topbar-logo {
    display: none;
  }
}

/* Topbar sections */
.atlas-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.atlas-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .atlas-topbar-right {
    gap: 1rem;
  }
}

/* Action buttons group */
.atlas-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-right: 0.75rem;
  border-right: 1px solid var(--atlas-line);
}

@media (max-width: 767px) {
  .atlas-topbar-actions {
    padding-right: 0.5rem;
    border-right: none;
  }
}

/* Mobile Search Overlay */
.atlas-topbar-search {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 35;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border-bottom: 1px solid var(--atlas-line);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}

.atlas-topbar-search.visible {
  transform: translateY(0);
  opacity: 1;
}

.atlas-topbar-search-inner {
  position: relative;
}

.atlas-topbar-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--atlas-muted);
  pointer-events: none;
}

.atlas-topbar-search-input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border-radius: var(--atlas-radius-xs);
  border: 1px solid var(--atlas-line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--atlas-text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

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

.atlas-topbar-search-input:focus {
  border-color: var(--atlas-primary);
  box-shadow: 0 0 0 3px rgba(16, 42, 67, 0.1);
}

/* Icon Button (for AI Assistant, Notifications, Search) */
.atlas-topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--atlas-radius-xs);
  color: var(--atlas-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition-base), background-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
}

.atlas-topbar-icon-btn:hover {
  color: var(--atlas-text);
  background: rgba(16, 42, 67, 0.06);
}

.atlas-topbar-icon-btn:active {
  transform: scale(0.96);
}

@media (min-width: 768px) {
  .atlas-topbar-icon-btn {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* User Dropdown Button */
.atlas-topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.375rem 0.5rem 0.375rem 0.375rem;
  border-radius: var(--atlas-radius-xs);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition-base), background-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
  min-height: 44px;
}

.atlas-topbar-user-btn:hover {
  background: rgba(16, 42, 67, 0.06);
}

.atlas-topbar-user-btn:active {
  transform: scale(0.98);
}

.atlas-topbar-chevron {
  color: var(--atlas-muted);
  transition: transform var(--transition-base);
}

.atlas-topbar-user-btn[aria-expanded="true"] .atlas-topbar-chevron {
  transform: rotate(180deg);
}

/* Logo & Brand */
.atlas-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.atlas-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--atlas-accent);
  color: var(--atlas-primary);
  font-weight: 700;
  font-size: 20px;
}

.atlas-brand-name {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 16px;
  color: var(--atlas-text);
}

.atlas-brand-sub {
  font-size: 12px;
  color: var(--atlas-muted);
  margin-top: 2px;
}

/* Pill Badge */
.atlas-pill {
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(16, 42, 67, 0.2);
  background: rgba(16, 42, 67, 0.08);
  border-radius: 999px;
  color: var(--atlas-primary);
}

/* Card Styles */
.atlas-card {
  background: var(--atlas-cream);
  border: 1px solid var(--atlas-accent-medium);
  border-radius: var(--atlas-radius);
  box-shadow: var(--atlas-shadow);
  padding: 16px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.atlas-card:hover {
  border-color: rgba(16, 42, 67, 0.2);
  box-shadow: var(--atlas-shadow-lg);
}

.atlas-card-body {
  padding: 16px;
}

.atlas-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.atlas-card-title {
  font-weight: 700;
  letter-spacing: -0.2px;
  font-size: 18px;
  color: var(--atlas-text);
}

.atlas-card-sub {
  font-size: 13px;
  color: var(--atlas-muted);
  margin-top: 6px;
  margin-bottom: 10px;
}

/* Labels & Scores */
.atlas-label {
  color: var(--atlas-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.atlas-score-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-top: 6px;
}

.atlas-score-value {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--atlas-primary);
}

.atlas-score-label {
  font-size: 13px;
  color: var(--atlas-muted);
}

/* Meta Information Grid */
.atlas-meta {
  display: flex;
  gap: 14px;
}

.atlas-meta-item {
  text-align: right;
}

.atlas-meta-k {
  font-size: 11px;
  color: var(--atlas-muted);
}

.atlas-meta-v {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
  color: var(--atlas-text);
}

/* Gauge/Score Visualization */
.atlas-gauge-wrap {
  margin-top: 10px;
}

.atlas-gauge {
  width: 100%;
  height: 140px;
  display: block;
}

.atlas-gauge-bg {
  fill: none;
  stroke: rgba(16, 42, 67, 0.15);
  stroke-width: 14;
  stroke-linecap: round;
}

.atlas-gauge-fg {
  fill: none;
  stroke: var(--atlas-primary);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 999;
  stroke-dashoffset: 999;
  filter: drop-shadow(0 6px 14px rgba(16, 42, 67, 0.2));
  transition: stroke-dashoffset 1s ease-in-out;
}

.atlas-gauge-dot {
  fill: var(--atlas-text);
  opacity: 0.8;
}

.atlas-needle {
  stroke: var(--atlas-text);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.7;
}

.atlas-gauge-legend {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--atlas-muted);
  margin: -8px 8px 0;
}

/* Mini Metric Cards */
.atlas-grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.atlas-mini {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--atlas-accent-medium);
  background: var(--atlas-accent-light);
}

.atlas-mini-k {
  font-size: 11px;
  color: var(--atlas-muted);
}

.atlas-mini-v {
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--atlas-text);
}

/* Signal/Alert Items */
.atlas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.atlas-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--atlas-radius-sm);
  border: 1px solid var(--atlas-accent-medium);
  background: var(--atlas-cream);
  transition: border-color var(--transition-base), background-color var(--transition-base), box-shadow var(--transition-base);
}

.atlas-item:hover {
  border-color: rgba(16, 42, 67, 0.3);
  background: var(--atlas-accent-light);
  box-shadow: var(--atlas-shadow);
}

.atlas-badge {
  font-weight: 700;
}

.atlas-badge.good {
  color: var(--atlas-good);
}

.atlas-badge.warn {
  color: var(--atlas-warn);
}

.atlas-badge.bad {
  color: var(--atlas-bad);
}

.atlas-badge-pill {
  flex: 0 0 auto;
  padding: 2px 10px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: white;
}

.atlas-badge-pill.good {
  background: var(--color-success-500);
}

.atlas-badge-pill.warn {
  background: var(--color-warning-500);
}

.atlas-badge-pill.bad {
  background: var(--color-danger-500);
}

/* ─── Data Table ─── */
.atlas-table-row {
  background: var(--atlas-bg);
  transition: background 0.15s ease;
}
.atlas-table-row:hover {
  background: rgba(255,255,255,0.03);
}
.atlas-table-cell {
  padding: 1rem 1.5rem;
  white-space: nowrap;
  font-size: 0.875rem;
  color: var(--atlas-text);
}
.atlas-table-cell.muted {
  color: var(--atlas-muted);
}
.atlas-table-cell.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.atlas-table-cell.actions {
  text-align: right;
  font-weight: 500;
}
.atlas-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.atlas-item h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--atlas-text);
}

.atlas-item p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--atlas-muted);
  line-height: 1.35;
}

/* Buttons */
.atlas-btn {
  appearance: none;
  border: 1px solid var(--atlas-accent-medium);
  background: var(--atlas-cream);
  color: var(--atlas-text);
  padding: 10px 12px;
  border-radius: var(--atlas-radius-xs);
  cursor: pointer;
  font-weight: 650;
  font-size: 14px;
  transition: border-color var(--transition-base), background-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
}

.atlas-btn:hover {
  border-color: rgba(16, 42, 67, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.atlas-btn:active {
  transform: translateY(0);
}

.atlas-btn.primary {
  background: var(--atlas-primary);
  border-color: var(--atlas-primary);
  color: white;
}

.atlas-btn.primary:hover {
  background: var(--color-primary-600);
  border-color: var(--color-primary-600);
  box-shadow: 0 4px 12px rgba(16, 42, 67, 0.25);
}

/* Input Fields */
.atlas-input {
  flex: 1 1 auto;
  padding: 10px 12px;
  border-radius: var(--atlas-radius-xs);
  border: 1px solid var(--atlas-accent-medium);
  background: white;
  color: var(--atlas-text);
  outline: none;
  font-size: 14px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

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

.atlas-input:focus {
  border-color: var(--atlas-primary);
  box-shadow: 0 0 0 4px rgba(16, 42, 67, 0.1);
}

.atlas-input:disabled {
  background: var(--atlas-accent-light);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Two Column Layout */
.atlas-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .atlas-cols {
    grid-template-columns: 1fr;
  }

  .atlas-grid3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .atlas-topbar {
    padding: 12px 16px;
  }

  .atlas-grid3 {
    grid-template-columns: 1fr;
  }

  .atlas-score-value {
    font-size: 32px;
  }

  .atlas-card {
    padding: 12px;
  }
}

/* Utility Classes */
.atlas-muted {
  color: var(--atlas-muted);
}

.atlas-text-good {
  color: var(--atlas-good);
}

.atlas-text-warn {
  color: var(--atlas-warn);
}

.atlas-text-bad {
  color: var(--atlas-bad);
}

.atlas-text-blue {
  color: var(--atlas-blue);
}

/* Animation Classes */
@keyframes atlas-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.atlas-animate-in {
  animation: atlas-fade-in 0.3s ease-out;
}

/* Chart/Graph Container */
.atlas-chart-container {
  position: relative;
  height: 300px;
  margin-top: 12px;
}

/* Progress Bar */
.atlas-progress {
  width: 100%;
  height: 8px;
  background: var(--atlas-accent-medium);
  border-radius: 999px;
  overflow: hidden;
}

.atlas-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--atlas-primary), var(--color-primary-300));
  border-radius: 999px;
  transition: width 0.5s ease-in-out;
}

/* Domain Breakdown Specific Styles */
.atlas-domain-item {
  padding: 16px;
  border-radius: var(--atlas-radius-sm);
  border: 1px solid var(--atlas-accent-medium);
  background: var(--atlas-cream);
  margin-bottom: 12px;
  transition: border-color var(--transition-base), background-color var(--transition-base), box-shadow var(--transition-base);
}

.atlas-domain-item:hover {
  border-color: rgba(16, 42, 67, 0.3);
  background: var(--atlas-accent-light);
  box-shadow: var(--atlas-shadow);
}

.atlas-domain-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.atlas-domain-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.atlas-domain-score {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.atlas-domain-progress {
  height: 6px;
  background: var(--atlas-accent-medium);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.atlas-domain-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s ease-in-out;
}

/* Dropdown Link Hover */
.atlas-dropdown-link {
  background: transparent;
  transition: background var(--transition-base);
}

.atlas-dropdown-link:hover {
  background: rgba(27, 77, 62, 0.08);
}

.atlas-dropdown-link--danger {
  background: transparent;
  transition: background var(--transition-base);
}

.atlas-dropdown-link--danger:hover {
  background: rgba(220, 38, 38, 0.08);
}
