/**
 * public/css/dashboard-system.css
 * CyberHeroesHQ — Shared Dashboard Design System
 * Design tokens + component classes used by ALL dashboard shells:
 *   Teacher, Admin, District, Principal, Parent, School.
 *
 * Each role imports this system, then its own role-specific skin
 * (e.g. --ds-primary, --ds-surface) via a role-specific CSS block.
 * All shared class names use .ds-* prefix.
 *
 * Usage: include dashboard-system.css BEFORE the role skin.
 */

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

/* ═══════════════════════════════════════════════════════════════════
   DESIGN TOKENS
   Each role sets these via a role-skin block (see below).
   Default values are neutral/light-theme fallbacks.
═══════════════════════════════════════════════════════════════════ */
:root {
  /* Role-specific skin tokens — override these in role CSS */
  --ds-primary:       #2563eb;
  --ds-primary-hover:#1d4ed8;
  --ds-primary-light: #eff6ff;
  --ds-accent:       #7c3aed;
  --ds-surface:      #ffffff;
  --ds-surface-2:    #f8fafc;
  --ds-border:       #e2e8f0;
  --ds-border-light: #f1f5f9;
  --ds-text:         #0f172a;
  --ds-text-muted:   #64748b;
  --ds-text-dim:     #94a3b8;
  --ds-bg:           #f8fafc;
  --ds-success:      #22c55e;
  --ds-success-light:#dcfce7;
  --ds-warning:      #f59e0b;
  --ds-warning-light:#fef3c7;
  --ds-danger:       #ef4444;
  --ds-danger-light: #fee2e2;
  --ds-info:         #0ea5e9;
  --ds-info-light:   #e0f2fe;
  --ds-radius-sm:   6px;
  --ds-radius-md:    10px;
  --ds-radius-lg:    14px;
  --ds-radius-xl:    20px;
  --ds-shadow-sm:    0 1px 2px rgba(0,0,0,0.06);
  --ds-shadow-md:    0 4px 12px rgba(0,0,0,0.08);
  --ds-shadow-lg:    0 8px 24px rgba(0,0,0,0.10);
  --ds-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ds-nav-h:        60px;
  --ds-sidebar-w:    0px;   /* 0 = no sidebar (top-nav layout) */
}

/* ── Reset (applied globally — safe for all roles) ─────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--ds-font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ds-text);
  background: var(--ds-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--ds-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════
   LAYOUT SHELL
   Supports two modes: sidebar layout (Admin) and top-nav layout (others).
═══════════════════════════════════════════════════════════════════ */

/* Sidebar layout */
.ds-shell {
  display: flex;
  min-height: 100vh;
}

.ds-shell--sidebar {
  flex-direction: row;
}

.ds-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ds-shell--sidebar .ds-main {
  margin-left: var(--ds-sidebar-w);
  transition: margin-left 0.2s ease;
}

/* Top-nav layout */
.ds-topnav-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR NAV (used by Admin, optionally by others)
═══════════════════════════════════════════════════════════════════ */
.ds-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--ds-sidebar-w);
  background: var(--ds-surface);
  border-right: 1px solid var(--ds-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width 0.2s ease;
  overflow: hidden;
}

.ds-sidebar.collapsed { width: 60px; }

.ds-sidebar-logo {
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--ds-border);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  flex-shrink: 0;
}

.ds-sidebar-logo-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }

.ds-sidebar-logo-text {
  font-weight: 700;
  font-size: 15px;
  color: var(--ds-text);
  white-space: nowrap;
}

.ds-sidebar-logo-sub {
  font-size: 11px;
  color: var(--ds-text-muted);
  white-space: nowrap;
}

.ds-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.ds-nav-section-label {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ds-text-dim);
  white-space: nowrap;
}

.ds-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-text-muted);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.ds-nav-item:hover {
  background: var(--ds-surface-2);
  color: var(--ds-text);
  text-decoration: none;
}

.ds-nav-item.active {
  background: var(--ds-primary-light);
  color: var(--ds-primary);
}

.ds-nav-item.active .ds-nav-icon { filter: none; }

.ds-nav-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.ds-nav-label { flex: 1; }

.ds-nav-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--ds-danger);
  color: #fff;
  padding: 1px 5px;
  border-radius: 10px;
  flex-shrink: 0;
}

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

/* ═══════════════════════════════════════════════════════════════════
   TOP NAVBAR (used by Teacher, District, Parent, School)
═══════════════════════════════════════════════════════════════════ */
.ds-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--ds-nav-h);
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-border);
}

.ds-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ds-nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ds-text);
  text-decoration: none;
  flex-shrink: 0;
}
.ds-nav-brand:hover { text-decoration: none; color: var(--ds-text); }

.ds-nav-brand-icon { font-size: 18px; }

.ds-nav-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--ds-primary);
  background: var(--ds-primary-light);
  padding: 2px 8px;
  border-radius: 20px;
}

.ds-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ds-nav-user {
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-text);
}

.ds-nav-school {
  font-size: 12px;
  color: var(--ds-text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   TOPBAR (sidebar mode — shown next to collapsed sidebar)
═══════════════════════════════════════════════════════════════════ */
.ds-topbar {
  height: var(--ds-nav-h);
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.ds-topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }

.ds-topbar-collapse-btn {
  background: none;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  padding: 6px 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--ds-text-muted);
  transition: background 0.12s;
}
.ds-topbar-collapse-btn:hover { background: var(--ds-surface-2); }

.ds-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ds-text-muted);
}
.ds-breadcrumb a { color: var(--ds-text-muted); }
.ds-breadcrumb a:hover { color: var(--ds-primary); text-decoration: none; }
.ds-breadcrumb-sep { color: var(--ds-border); }
.ds-breadcrumb-current { color: var(--ds-text); font-weight: 600; }

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

.ds-topbar-time {
  font-size: 12px;
  color: var(--ds-text-dim);
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════
   PAGE STRUCTURE
═══════════════════════════════════════════════════════════════════ */
.ds-main-content {
  flex: 1;
  padding: 32px 0 64px;
}

.ds-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.ds-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.ds-page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ds-text);
  margin-bottom: 4px;
}

.ds-page-sub {
  font-size: 0.875rem;
  color: var(--ds-text-muted);
}

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

.ds-breadcrumb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ds-text-muted);
  margin-bottom: 20px;
}
.ds-breadcrumb-row a { color: var(--ds-primary); }
.ds-breadcrumb-row a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════════════ */
.ds-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-sm);
  transition: box-shadow 0.15s;
}

.ds-card:hover { box-shadow: var(--ds-shadow-md); }

.ds-card-padded { padding: 24px; }

.ds-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.ds-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ds-text);
}

.ds-card-body {}

.ds-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.ds-metric-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 20px 24px;
  box-shadow: var(--ds-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ds-metric-icon { font-size: 22px; line-height: 1; }

.ds-metric-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ds-text);
  line-height: 1;
}

.ds-metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ds-text-muted);
  margin-top: 2px;
}

.ds-metric-delta {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 4px;
}
.ds-metric-delta--up { color: var(--ds-success); }
.ds-metric-delta--down { color: var(--ds-danger); }

.ds-metrics-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}
.ds-metrics-grid--2 { grid-template-columns: repeat(2, 1fr); }
.ds-metrics-grid--3 { grid-template-columns: repeat(3, 1fr); }
.ds-metrics-grid--4 { grid-template-columns: repeat(4, 1fr); }
.ds-metrics-grid--5 { grid-template-columns: repeat(5, 1fr); }

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════ */
.ds-btn {
  font-family: var(--ds-font);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--ds-radius-sm);
  padding: 9px 18px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.ds-btn:hover { text-decoration: none; }

.ds-btn-primary {
  background: var(--ds-primary);
  color: #fff;
}
.ds-btn-primary:hover { background: var(--ds-primary-hover); color: #fff; }

.ds-btn-secondary {
  color: var(--ds-primary);
  background: var(--ds-primary-light);
  border: 1.5px solid rgba(37,99,235,0.2);
}
.ds-btn-secondary:hover { background: #dbeafe; }

.ds-btn-ghost {
  color: var(--ds-text-muted);
  background: none;
  border: 1.5px solid var(--ds-border);
}
.ds-btn-ghost:hover { background: var(--ds-surface-2); color: var(--ds-text); }

.ds-btn-danger {
  color: var(--ds-danger);
  background: var(--ds-danger-light);
  border: 1.5px solid rgba(239,68,68,0.2);
}
.ds-btn-danger:hover { background: #fee2e2; }

.ds-btn-success {
  color: var(--ds-success);
  background: var(--ds-success-light);
  border: 1.5px solid rgba(34,197,94,0.2);
}
.ds-btn-success:hover { background: #dcfce7; }

.ds-btn-warning {
  color: var(--ds-warning);
  background: var(--ds-warning-light);
  border: 1.5px solid rgba(245,158,11,0.2);
}
.ds-btn-warning:hover { background: #fef3c7; }

.ds-btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.ds-btn-xs { padding: 3px 8px; font-size: 0.75rem; }
.ds-btn-lg { padding: 12px 28px; font-size: 1rem; }

.ds-btn-logout {
  font-family: var(--ds-font);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ds-text-muted);
  background: none;
  border: 1.5px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.ds-btn-logout:hover { background: var(--ds-surface-2); }

/* ═══════════════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════════════ */
.ds-table-wrap {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  overflow: hidden;
  box-shadow: var(--ds-shadow-sm);
}

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

.ds-table thead tr {
  background: var(--ds-surface-2);
  border-bottom: 1px solid var(--ds-border);
}

.ds-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ds-text-muted);
  white-space: nowrap;
}

.ds-table th.num,
.ds-table td.num { text-align: center; }

.ds-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--ds-border-light);
  vertical-align: middle;
  color: var(--ds-text);
}

.ds-table tbody tr:last-child td { border-bottom: none; }

.ds-table tbody tr {
  transition: background 0.1s;
}

.ds-table tbody tr:hover td { background: var(--ds-surface-2); }

.ds-table tbody tr.row-link { cursor: pointer; }

/* ═══════════════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════════════ */
.ds-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  vertical-align: middle;
}

.ds-badge-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
}

.ds-badge-primary { background: var(--ds-primary-light); color: var(--ds-primary); }
.ds-badge-success { background: var(--ds-success-light); color: #15803d; }
.ds-badge-warning { background: var(--ds-warning-light); color: #92400e; }
.ds-badge-danger  { background: var(--ds-danger-light);  color: #b91c1c; }
.ds-badge-info    { background: var(--ds-info-light);    color: #075985; }
.ds-badge-neutral { background: var(--ds-surface-2); color: var(--ds-text-muted); }

.ds-badge-level {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--ds-surface-2);
  color: var(--ds-text-muted);
  display: inline-block;
}

.ds-code-badge {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ds-primary);
  background: var(--ds-primary-light);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 6px;
  padding: 3px 10px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════════════════ */
.ds-alert {
  padding: 12px 16px;
  border-radius: var(--ds-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid transparent;
}

.ds-alert-success { background: var(--ds-success-light); color: #15803d; border-color: #bbf7d0; }
.ds-alert-warning { background: var(--ds-warning-light); color: #92400e; border-color: #fde68a; }
.ds-alert-danger  { background: var(--ds-danger-light);  color: #b91c1c; border-color: #fca5a5; }
.ds-alert-info    { background: var(--ds-info-light);    color: #075985; border-color: #93c5fd; }

/* ═══════════════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════════════ */
.ds-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ds-field label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ds-text-muted);
}

.ds-optional { font-weight: 400; color: var(--ds-text-dim); }

.ds-field input,
.ds-field select,
.ds-field textarea {
  font-family: var(--ds-font);
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1.5px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--ds-text);
  background: var(--ds-surface);
}

.ds-field input:focus,
.ds-field select:focus,
.ds-field textarea:focus {
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.ds-form { display: flex; flex-direction: column; gap: 16px; }

/* ═══════════════════════════════════════════════════════════════════
   EMPTY STATES
═══════════════════════════════════════════════════════════════════ */
.ds-empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
}

.ds-empty-icon { font-size: 3rem; margin-bottom: 16px; }

.ds-empty-state h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ds-text);
  margin-bottom: 8px;
}

.ds-empty-state p {
  color: var(--ds-text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════
   CALLOUT BANNER
═══════════════════════════════════════════════════════════════════ */
.ds-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  margin-bottom: 20px;
  font-size: 0.875rem;
}

.ds-callout-icon { font-size: 24px; line-height: 1; flex-shrink: 0; }
.ds-callout-body { flex: 1; color: var(--ds-text); line-height: 1.6; }
.ds-callout-body strong { color: var(--ds-text); }

/* ═══════════════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════════════ */
.ds-modal {
  border: none;
  border-radius: var(--ds-radius-lg);
  padding: 0;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--ds-shadow-lg);
}

.ds-modal::backdrop {
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
}

.ds-modal-inner { padding: 32px; }

.ds-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ds-text);
  margin-bottom: 6px;
}

.ds-modal-sub {
  font-size: 0.875rem;
  color: var(--ds-text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.ds-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════
   PROGRESS BARS
═══════════════════════════════════════════════════════════════════ */
.ds-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ds-progress-track {
  flex: 1;
  height: 10px;
  background: var(--ds-border);
  border-radius: 5px;
  overflow: hidden;
}

.ds-progress-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--ds-primary);
  transition: width 0.4s ease;
}

.ds-progress-pct {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ds-text-muted);
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   ACTIVITY FEED
═══════════════════════════════════════════════════════════════════ */
.ds-activity-feed {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  overflow: hidden;
  background: var(--ds-surface);
}

.ds-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ds-border-light);
}
.ds-activity-item:last-child { border-bottom: none; }

.ds-activity-avatar { font-size: 1.4rem; line-height: 1; flex-shrink: 0; margin-top: 2px; }

.ds-activity-body { flex: 1; font-size: 0.84rem; color: var(--ds-text-muted); line-height: 1.4; }

.ds-activity-name { font-weight: 600; color: var(--ds-text); }

.ds-activity-mission { font-weight: 500; color: var(--ds-primary); }

.ds-activity-class { color: var(--ds-text-dim); font-size: 0.8rem; }

.ds-activity-score { font-size: 0.8rem; color: var(--ds-success); margin-top: 2px; }

.ds-activity-time {
  font-size: 0.75rem;
  color: var(--ds-text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════════════ */
.ds-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.ds-page-info { color: var(--ds-text-muted); font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════════
   LOADING / SKELETON
═══════════════════════════════════════════════════════════════════ */
.ds-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--ds-border);
  border-top-color: var(--ds-primary);
  border-radius: 50%;
  animation: ds-spin 0.7s linear infinite;
}

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

.ds-loading-text {
  font-size: 13px;
  color: var(--ds-text-dim);
  padding: 16px 0;
}

.ds-skeleton {
  background: linear-gradient(90deg, var(--ds-surface-2) 25%, var(--ds-border-light) 50%, var(--ds-surface-2) 75%);
  background-size: 200% 100%;
  animation: ds-shimmer 1.4s ease infinite;
  border-radius: var(--ds-radius-sm);
}

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

.ds-skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}

.ds-skeleton-block {
  height: 80px;
  margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .ds-metrics-grid--5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .ds-metrics-grid--5,
  .ds-metrics-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .ds-metrics-grid--3 { grid-template-columns: 1fr; }

  .ds-nav-inner { padding: 0 16px; }
  .ds-container { padding: 0 16px; }
  .ds-main-content { padding: 20px 0 48px; }
  .ds-page-header { flex-direction: column; align-items: flex-start; }
  .ds-card-padded { padding: 18px; }

  .ds-table-wrap { overflow-x: auto; }
  .ds-table { min-width: 480px; }

  .ds-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .ds-sidebar.open {
    transform: translateX(0);
  }
}

@media (max-width: 480px) {
  .ds-metrics-grid--5,
  .ds-metrics-grid--4,
  .ds-metrics-grid--3,
  .ds-metrics-grid--2 { grid-template-columns: 1fr; }

  .ds-page-title { font-size: 1.3rem; }
  .ds-table { font-size: 0.8rem; }
  .ds-table th, .ds-table td { padding: 8px 10px; }

  /* Prevent iOS auto-zoom on inputs */
  input, select, textarea { font-size: 16px !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════════════════════ */
@media print {
  .ds-nav,
  .ds-sidebar,
  .ds-header-actions,
  .ds-btn-ghost,
  .ds-btn-secondary { display: none !important; }
  .ds-main-content { padding: 0; }
  .ds-card { box-shadow: none; border: 1px solid #ddd; }
}