/* ============================================================
   NexOps Shared Design System
   Premium dark SaaS dashboard CSS
   ============================================================ */

/* -----------------------------------------------------------
   1. Design Tokens (CSS Custom Properties)
   ----------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg-primary: #0a0a0f;
  --bg-secondary: #111119;
  --bg-card: #16161f;
  --bg-elevated: #1c1c28;
  --bg-hover: #1f1f2e;
  --bg-input: #0e0e16;
  --bg-overlay: rgba(0, 0, 0, 0.6);

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #8a8a9a;
  --text-muted: #55556a;
  --text-inverse: #0a0a0f;

  /* Accent */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --accent-warm: #f59e0b;
  --accent-purple: #8b5cf6;

  /* Gradients */
  --gradient-1: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --gradient-2: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(59, 130, 246, 0.5);

  /* Status */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 100px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --container-max: 1200px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Typography */
  --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}


/* -----------------------------------------------------------
   2. Reset + Base Styles
   ----------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

img, svg {
  display: block;
  max-width: 100%;
}

ul, ol {
  list-style: none;
}

::selection {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}


/* -----------------------------------------------------------
   3. Common Layout Classes
   ----------------------------------------------------------- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.page-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: var(--space-2xl);
}

.page-header {
  margin-bottom: var(--space-2xl);
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-xs);
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}


/* -----------------------------------------------------------
   4. Typography
   ----------------------------------------------------------- */
.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--space-md);
}

.section-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  line-height: 1.7;
}

.text-gradient {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.text-secondary {
  color: var(--text-secondary);
}

.text-success {
  color: var(--success);
}

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

.text-warning {
  color: var(--warning);
}

.text-sm {
  font-size: 0.85rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-mono {
  font-family: var(--font-mono);
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* -----------------------------------------------------------
   5. Form Elements
   ----------------------------------------------------------- */

/* Labels */
label,
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.01em;
}

.form-label-required::after {
  content: ' *';
  color: var(--danger);
}

/* Inputs & Textareas */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="date"],
textarea,
.form-input {
  width: 100%;
  padding: 0.65rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:focus,
textarea:focus,
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input:disabled,
textarea:disabled,
.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-secondary);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Select */
select,
.form-select {
  width: 100%;
  padding: 0.65rem 2.25rem 0.65rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8a9a' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

select:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Form Groups */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-row {
  display: flex;
  gap: var(--space-lg);
}

.form-row > * {
  flex: 1;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: var(--space-xs);
}

.form-error-input,
input.error,
textarea.error {
  border-color: var(--danger);
}

.form-error-input:focus,
input.error:focus,
textarea.error:focus {
  box-shadow: 0 0 0 3px var(--danger-bg);
}


/* -----------------------------------------------------------
   6. Buttons
   ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}

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

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.8rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* Primary - gradient */
.btn-primary {
  background: var(--gradient-1);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-sm), 0 0 16px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
  box-shadow: var(--shadow-md), 0 0 24px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
  color: #fff;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Secondary - outline */
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

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

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.25);
  transform: translateY(-1px);
  color: #fff;
}

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

/* Ghost - minimal */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.4rem 0.65rem;
}

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

/* Success */
.btn-success {
  background: var(--success);
  color: #fff;
  border: none;
}

.btn-success:hover {
  background: #16a34a;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.25);
  transform: translateY(-1px);
  color: #fff;
}

/* Icon button */
.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

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

/* Button group */
.btn-group {
  display: flex;
  gap: var(--space-sm);
}


/* -----------------------------------------------------------
   7. Cards
   ----------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.card-hover:hover {
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: var(--shadow-glow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  /* Flexible content area */
}

.card-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.card-compact {
  padding: var(--space-lg);
}

.card-flush {
  padding: 0;
}

.card-flush .card-header {
  padding: var(--space-lg) var(--space-xl);
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.card-flush .card-body {
  padding: var(--space-xl);
}

.card-flush .card-footer {
  padding: var(--space-lg) var(--space-xl);
  margin-top: 0;
}


/* -----------------------------------------------------------
   8. Auth Form Layout
   ----------------------------------------------------------- */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-xl);
  position: relative;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  position: relative;
  z-index: 1;
}

.auth-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: var(--space-xs);
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--space-xs);
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
}


/* -----------------------------------------------------------
   9. Dashboard Layout: Sidebar + Main
   ----------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.sidebar-logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.sidebar-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 var(--space-md);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 400;
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 500;
  border-color: rgba(59, 130, 246, 0.15);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  opacity: 0.7;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  color: var(--accent);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: var(--bg-hover);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* -----------------------------------------------------------
   10. Metric Cards
   ----------------------------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: border-color var(--transition-base);
}

.metric-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.metric-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.metric-card-label .metric-icon {
  font-size: 0.9rem;
  opacity: 0.6;
}

.metric-card-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
}

.metric-card-value.gradient {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-card-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.metric-card-trend.up {
  color: var(--success);
  background: var(--success-bg);
}

.metric-card-trend.down {
  color: var(--danger);
  background: var(--danger-bg);
}

.metric-card-trend.neutral {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

.metric-card-trend .trend-arrow {
  font-size: 0.7rem;
}

.metric-card-footer {
  margin-top: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
}


/* -----------------------------------------------------------
   11. Health Score Circle (SVG-Based Ring)
   ----------------------------------------------------------- */
.health-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.health-score-ring {
  position: relative;
  width: 140px;
  height: 140px;
}

.health-score-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.health-score-ring .ring-bg {
  fill: none;
  stroke: var(--border-light);
  stroke-width: 8;
}

.health-score-ring .ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.health-score-ring .ring-fill.excellent {
  stroke: var(--success);
  filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.4));
}

.health-score-ring .ring-fill.good {
  stroke: var(--accent);
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.4));
}

.health-score-ring .ring-fill.warning {
  stroke: var(--warning);
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.4));
}

.health-score-ring .ring-fill.critical {
  stroke: var(--danger);
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.4));
}

.health-score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.health-score-number {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.health-score-suffix {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.health-score-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
}

.health-score-sublabel {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}


/* -----------------------------------------------------------
   12. Recommendation Cards with Priority Badges
   ----------------------------------------------------------- */
.recommendation-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.recommendation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  gap: var(--space-lg);
  transition: border-color var(--transition-base);
}

.recommendation-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.recommendation-priority {
  flex-shrink: 0;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.priority-badge.critical {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.priority-badge.high {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.priority-badge.medium {
  background: var(--info-bg);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.priority-badge.low {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.recommendation-content {
  flex: 1;
  min-width: 0;
}

.recommendation-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.recommendation-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

.recommendation-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.recommendation-impact {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.recommendation-actions {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
}


/* -----------------------------------------------------------
   13. Chart Area Placeholder
   ----------------------------------------------------------- */
.chart-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  min-height: 300px;
  position: relative;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.chart-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chart-body {
  position: relative;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: var(--space-2xl);
}

.chart-placeholder-icon {
  font-size: 2rem;
  opacity: 0.3;
}

.chart-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 3px;
}

.chart-tab {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  font-family: var(--font-body);
}

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

.chart-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}


/* -----------------------------------------------------------
   14. Loading Spinner
   ----------------------------------------------------------- */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(4px);
  border-radius: inherit;
  z-index: 10;
}

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-line {
  height: 14px;
  margin-bottom: var(--space-sm);
}

.skeleton-line:last-child {
  width: 60%;
}

.skeleton-circle {
  border-radius: 50%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Dot pulse loader */
.dot-loader {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dot-loader span {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: dot-pulse 1.4s infinite ease-in-out both;
}

.dot-loader span:nth-child(1) { animation-delay: -0.32s; }
.dot-loader span:nth-child(2) { animation-delay: -0.16s; }
.dot-loader span:nth-child(3) { animation-delay: 0s; }

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}


/* -----------------------------------------------------------
   15. Toast Notifications
   ----------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  max-width: 420px;
  pointer-events: all;
  animation: toast-in 0.3s ease forwards;
  backdrop-filter: blur(12px);
}

.toast.toast-out {
  animation: toast-out 0.2s ease forwards;
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 1rem;
  line-height: 1;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

/* Toast variants */
.toast.success {
  border-left: 3px solid var(--success);
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast.info {
  border-left: 3px solid var(--accent);
}

.toast.info .toast-icon {
  color: var(--accent);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}


/* -----------------------------------------------------------
   16. Empty States
   ----------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-4xl) var(--space-xl);
  min-height: 300px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--gradient-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: var(--space-lg);
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

.empty-state .btn {
  margin-top: var(--space-sm);
}


/* -----------------------------------------------------------
   17. Tables
   ----------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: var(--bg-secondary);
}

th {
  padding: 0.75rem var(--space-lg);
  text-align: left;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 0.75rem var(--space-lg);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-hover);
}


/* -----------------------------------------------------------
   18. Badges & Tags
   ----------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
}

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

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

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-info {
  background: var(--info-bg);
  color: var(--accent);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

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

.badge-dot.success { background: var(--success); }
.badge-dot.danger { background: var(--danger); }
.badge-dot.warning { background: var(--warning); }
.badge-dot.info { background: var(--accent); }
.badge-dot.neutral { background: var(--text-muted); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}


/* -----------------------------------------------------------
   19. Modal / Dialog
   ----------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: fade-in 0.2s ease;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modal-in 0.25s ease;
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-body {
  padding: var(--space-xl);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}


/* -----------------------------------------------------------
   20. Dropdown Menu
   ----------------------------------------------------------- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 100;
  animation: dropdown-in 0.15s ease;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger:hover {
  background: var(--danger-bg);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

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


/* -----------------------------------------------------------
   21. Tooltips
   ----------------------------------------------------------- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.35rem 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 200;
}

.tooltip:hover::after {
  opacity: 1;
}


/* -----------------------------------------------------------
   22. Progress Bars
   ----------------------------------------------------------- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-1);
  transition: width 0.5s ease;
}

.progress-bar-fill.success {
  background: var(--success);
}

.progress-bar-fill.warning {
  background: var(--warning);
}

.progress-bar-fill.danger {
  background: var(--danger);
}


/* -----------------------------------------------------------
   23. Tabs
   ----------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-xl);
}

.tab {
  padding: 0.75rem var(--space-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  position: relative;
  transition: color var(--transition-fast);
}

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

.tab.active {
  color: var(--text-primary);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-1);
  border-radius: 2px 2px 0 0;
}

/* Pill tabs variant */
.tabs-pill {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 3px;
  border-bottom: none;
  margin-bottom: var(--space-xl);
  width: fit-content;
}

.tab-pill {
  padding: 0.4rem 1rem;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  font-family: var(--font-body);
}

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

.tab-pill.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}


/* -----------------------------------------------------------
   24. Avatars
   ----------------------------------------------------------- */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}

.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-primary);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}


/* -----------------------------------------------------------
   25. Dividers
   ----------------------------------------------------------- */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-xl) 0;
}

.divider-vertical {
  width: 1px;
  height: 100%;
  background: var(--border);
  margin: 0 var(--space-md);
}


/* -----------------------------------------------------------
   26. Utility Classes
   ----------------------------------------------------------- */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.w-full { width: 100%; }
.h-full { height: 100%; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.text-center { text-align: center; }
.text-right { text-align: right; }

.relative { position: relative; }
.overflow-hidden { overflow: hidden; }


/* -----------------------------------------------------------
   27. Animations & Transitions
   ----------------------------------------------------------- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-up {
  animation: fade-up 0.4s ease forwards;
}

.animate-scale-in {
  animation: scale-in 0.3s ease forwards;
}

.animate-slide-right {
  animation: slide-in-right 0.3s ease forwards;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  animation: fade-up 0.4s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }


/* -----------------------------------------------------------
   28. Mobile Responsive
   ----------------------------------------------------------- */

/* Mobile top bar (replaces sidebar) */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-lg);
  align-items: center;
  justify-content: space-between;
  z-index: 60;
  backdrop-filter: blur(12px);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
}

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

/* Hamburger icon lines */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 20px;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all var(--transition-base);
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* Sidebar mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 49;
}

/* Tablet: 1024px */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .main-content {
    padding: var(--space-xl);
  }
}

/* Mobile: 768px */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }

  /* Show mobile top bar */
  .mobile-topbar {
    display: flex;
  }

  .mobile-menu-btn {
    display: flex;
  }

  /* Collapse sidebar */
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    z-index: 55;
    width: var(--sidebar-width);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.visible {
    display: block;
  }

  /* Main content takes full width */
  .main-content {
    margin-left: 0;
    padding: var(--space-lg);
    padding-top: calc(var(--topbar-height) + var(--space-lg));
  }

  /* Layout adjustments */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    flex-direction: column;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  /* Card spacing */
  .card {
    padding: var(--space-lg);
  }

  /* Chart area */
  .chart-area {
    padding: var(--space-lg);
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  /* Recommendation cards stack */
  .recommendation-card {
    flex-direction: column;
    gap: var(--space-md);
  }

  /* Auth card */
  .auth-card {
    padding: var(--space-xl);
  }

  /* Toast position */
  .toast-container {
    top: calc(var(--topbar-height) + var(--space-md));
    right: var(--space-md);
    left: var(--space-md);
  }

  .toast {
    min-width: auto;
    max-width: none;
  }

  /* Table horizontal scroll */
  .table-wrapper {
    border-radius: var(--radius-md);
  }

  /* Tabs scroll */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  /* Modal full-width on mobile */
  .modal {
    max-width: none;
    max-height: 92vh;
    margin: auto var(--space-md);
    border-radius: var(--radius-lg);
  }
}

/* Small mobile: 480px */
@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .metric-card-value {
    font-size: 1.5rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    width: 100%;
  }

  .flex-between {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
}


/* -----------------------------------------------------------
   29. Print Styles
   ----------------------------------------------------------- */
@media print {
  .sidebar,
  .mobile-topbar,
  .toast-container,
  .btn,
  .modal-backdrop {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    border: 1px solid #ddd;
    box-shadow: none;
  }
}
