/* ════════════════════════════════════════════════════════════════════
   Gestnova Design System v1
   Inspiración macOS Sonoma · Dark-only v1 · Vanilla CSS sin Tailwind

   7 valores filtran cada decisión: Ayuda · Amor · Unidad · Abundancia
   · Soberanía · Salud · Ciencia real
   ════════════════════════════════════════════════════════════════════ */

:root {
  /* ━━━━━━━━━━━━ COLOR ━━━━━━━━━━━━ */
  --bg-base:        #0a0a0c;
  --bg-panel:       #15161a;
  --bg-elevated:    #1c1d22;
  --bg-input:       #232429;
  --bg-hover:       #2a2b31;
  --bg-glass:       rgba(28, 29, 34, 0.72);

  --border-subtle:  rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.18);

  --text-primary:   #f5f6f8;
  --text-secondary: #a8aab5;
  --text-tertiary:  #8b8d9a; /* bumped from #6b6d78 — WCAG AA contrast ≥4.5:1 on dark bg */
  --text-disabled:  #45464f;

  --accent-50:      #eef2ff;
  --accent-400:     #818cf8;
  --accent-500:     #5b5eda; /* darkened from #6366f1 — white text contrast ≥4.5:1 (WCAG AA) */
  --accent-600:     #4f52d4;
  --accent-soft:    rgba(99,102,241,0.14);
  --accent-ring:    rgba(99,102,241,0.4);

  --success-500:    #10b981;
  --success-soft:   rgba(16,185,129,0.14);
  --warning-500:    #f59e0b;
  --warning-soft:   rgba(245,158,11,0.14);
  --danger-500:     #ef4444;
  --danger-soft:    rgba(239,68,68,0.14);

  --ring-accent:  0 0 0 3px var(--accent-ring);
  --ring-success: 0 0 0 3px rgba(16,185,129,0.4);
  --ring-danger:  0 0 0 3px rgba(239,68,68,0.4);

  /* ━━━━━━━━━━━━ TIPOGRAFÍA ━━━━━━━━━━━━ */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', Consolas, monospace;
  --fs-xs:   11px;
  --fs-sm:   13px;
  --fs-base: 14px;
  --fs-md:   15px;
  --fs-lg:   17px;
  --fs-xl:   20px;
  --fs-2xl:  24px;
  --fs-3xl:  32px;
  --lh-tight: 1.3;
  --lh-base:  1.5;
  --lh-loose: 1.65;

  /* ━━━━━━━━━━━━ ESPACIADO ━━━━━━━━━━━━ */
  --space-1:  4px;   --space-2:  8px;   --space-3:  12px;
  --space-4:  16px;  --space-5:  20px;  --space-6:  24px;
  --space-8:  32px;  --space-10: 40px;  --space-12: 48px;  --space-16: 64px;
  --pad-card:        var(--space-6);
  --pad-card-dense:  var(--space-4);
  --gap-stack:       var(--space-4);
  --gap-section:     var(--space-8);

  /* ━━━━━━━━━━━━ RADIOS & SOMBRAS ━━━━━━━━━━━━ */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   18px;
  --radius-pill: 999px;
  --shadow-sm:         0 1px 2px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(255,255,255,0.04) inset;
  --shadow-md:         0 4px 12px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(255,255,255,0.04) inset;
  --shadow-lg:         0 16px 32px rgba(0,0,0,0.5), 0 0 0 0.5px rgba(255,255,255,0.05) inset;
  --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 0.5px rgba(255,255,255,0.06) inset;
  --shadow-glow:       0 0 0 4px var(--accent-ring);
  --blur-sm: blur(12px) saturate(140%);
  --blur-md: blur(20px) saturate(160%);
  --blur-lg: blur(40px) saturate(180%);

  /* ━━━━━━━━━━━━ MOTION ━━━━━━━━━━━━ */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 150ms;  --dur-base: 220ms;  --dur-slow: 400ms;

  /* ━━━━━━━━━━━━ Z-INDEX ━━━━━━━━━━━━ */
  --z-dropdown: 10;     --z-sticky: 20;     --z-fixed: 30;
  --z-modal-bg: 100;    --z-modal: 110;
  --z-popover: 200;     --z-toast: 300;     --z-tooltip: 400;

  /* ━━━━━━━━━━━━ LAYOUT ━━━━━━━━━━━━ */
  --topbar-h: 56px;
  --sidebar-w: 240px;
  --container-max: 1280px;
  --reading-max: 720px;

  /* ━━━━━━━━━━━━ PRINT ━━━━━━━━━━━━ */
  --print-bg: #ffffff;
  --print-ink: #1a1a1a;

  /* ━━━━━━━━━━━━ LIGHT MODE (latente, v2) ━━━━━━━━━━━━ */
  --bg-base-light: #fafafa;
  --bg-panel-light: #ffffff;
  --bg-elevated-light: #ffffff;
  --text-primary-light: #1a1a1a;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
  }
}

/* ━━━━━━━━━━━━ RESET MÍNIMO ━━━━━━━━━━━━ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ━━━━━━━━━━━━ PRINT ━━━━━━━━━━━━ */
@media print {
  body { background: var(--print-bg); color: var(--print-ink); }
  .topbar, .sidebar, .btn, .print-hide { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ════════════════════════════════════════════════════════════════════
   COMPONENT LIBRARY
   ════════════════════════════════════════════════════════════════════ */

/* ━━━━━━━━━━━━ LAYOUT PRIMITIVES ━━━━━━━━━━━━ */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-glass);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.layout-sidebar {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-6) var(--space-3);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--dur-fast) var(--ease-out);
}
.sidebar-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-link.active {
  background: var(--accent-soft);
  color: var(--accent-400);
}

.content {
  padding: var(--space-8);
  max-width: var(--container-max);
  width: 100%;
}

.page-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin: 0 0 var(--space-6);
}
.page-subtitle {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin: 0 0 var(--space-6);
}

/* ━━━━━━━━━━━━ CARDS ━━━━━━━━━━━━ */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--pad-card);
  box-shadow: var(--shadow-sm);
}
.card-elevated  { box-shadow: var(--shadow-md); }
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--border-default);
}
.card-dense   { padding: var(--pad-card-dense); }
.card-hover   { transition: box-shadow var(--dur-base), transform var(--dur-base); }
.card-hover:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-1px); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.card-title    { font-size: var(--fs-lg); font-weight: 600; color: var(--text-primary); margin: 0; }
.card-subtitle { font-size: var(--fs-sm); color: var(--text-tertiary); margin-top: var(--space-1); }

/* ━━━━━━━━━━━━ BUTTONS ━━━━━━━━━━━━ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  font-family: inherit;
  min-height: 36px;
  text-decoration: none;
  user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring-accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Accessibility — universal focus ring for elements not covered by component rules */
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--ring-accent);
}

.btn-primary {
  background: var(--accent-500);
  color: white;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-600); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); }

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

.btn-outline {
  background: transparent;
  color: var(--accent-400);
  border-color: var(--accent-500);
}
.btn-outline:hover:not(:disabled) { background: var(--accent-soft); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger-500);
  border-color: rgba(239,68,68,0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.22); }

.btn-sm   { min-height: 28px; padding: var(--space-1) var(--space-3); font-size: var(--fs-sm); }
.btn-lg   { min-height: 44px; padding: var(--space-3) var(--space-5); font-size: var(--fs-md); }
.btn-icon { padding: var(--space-2); min-width: 36px; }

/* ━━━━━━━━━━━━ FORMS ━━━━━━━━━━━━ */
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
  font-size: var(--fs-md);
  font-family: inherit;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  min-height: 36px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent-500);
  box-shadow: var(--ring-accent);
}
.input::placeholder { color: var(--text-tertiary); }
.textarea { min-height: 80px; resize: vertical; line-height: var(--lh-base); }

.label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.field-help  { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: var(--space-1); }
.field-error { font-size: var(--fs-xs); color: var(--danger-500); margin-top: var(--space-1); }
.form-row { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }

/* ━━━━━━━━━━━━ BADGES ━━━━━━━━━━━━ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.badge-success { background: var(--success-soft); color: var(--success-500); border-color: rgba(16,185,129,0.3); }
.badge-warning { background: var(--warning-soft); color: var(--warning-500); border-color: rgba(245,158,11,0.3); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger-500);  border-color: rgba(239,68,68,0.3); }
.badge-accent  { background: var(--accent-soft);  color: var(--accent-400);  border-color: var(--accent-ring); }
.badge-ok  { background: var(--success-soft); color: var(--success-500); border-color: rgba(16,185,129,0.3); }
.badge-err { background: var(--danger-soft);  color: var(--danger-500);  border-color: rgba(239,68,68,0.3); }

/* ━━━━━━━━━━━━ TABLES ━━━━━━━━━━━━ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.data-table th {
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}
.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.data-table tr:hover td { background: var(--bg-hover); }
.data-table tr:last-child td { border-bottom: none; }

/* ━━━━━━━━━━━━ MODAL ━━━━━━━━━━━━ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
  z-index: var(--z-modal-bg);
  animation: fadeIn var(--dur-base) var(--ease-out);
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
  animation: slideUp var(--dur-base) var(--ease-out);
}

/* ━━━━━━━━━━━━ TABS ━━━━━━━━━━━━ */
.tab-list {
  display: inline-flex;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  gap: var(--space-1);
}
.tab-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast);
  font-family: inherit;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ━━━━━━━━━━━━ TOGGLE / SWITCH ━━━━━━━━━━━━ */
.switch {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 20px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--dur-fast);
  border: 1px solid var(--border-default);
}
.switch.on { background: var(--accent-500); border-color: var(--accent-500); }
.switch::after {
  content: '';
  position: absolute;
  top: 1px; left: 1px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform var(--dur-base) var(--ease-out);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.switch.on::after { transform: translateX(16px); }

/* ━━━━━━━━━━━━ CHECKBOX ━━━━━━━━━━━━ */
.checkbox {
  width: 18px; height: 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-input);
  cursor: pointer;
  display: inline-flex;
  align-items: center; justify-content: center;
  transition: all var(--dur-fast);
}
.checkbox.checked {
  background: var(--accent-500);
  border-color: var(--accent-500);
}
.checkbox.checked::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* ━━━━━━━━━━━━ TOOLTIP ━━━━━━━━━━━━ */
.tooltip-trigger { position: relative; }
.tooltip {
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--dur-fast);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-default);
  z-index: var(--z-tooltip);
}
.tooltip-trigger:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* ━━━━━━━━━━━━ AVATAR ━━━━━━━━━━━━ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-400);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid var(--border-subtle);
}
.avatar-sm { width: 24px; height: 24px; font-size: var(--fs-xs); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--fs-md); }

/* ━━━━━━━━━━━━ SKELETON ━━━━━━━━━━━━ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 0%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 100%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-line   { height: 16px; }
.skeleton-text   { height: 14px; width: 60%; }
.skeleton-title  { height: 24px; width: 40%; }
.skeleton-block  { height: 200px; }
.skeleton-avatar { width: 32px; height: 32px; border-radius: 50%; }
.skeleton-card   { height: 140px; }

/* ━━━━━━━━━━━━ SPINNER ━━━━━━━━━━━━ */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ━━━━━━━━━━━━ EMPTY STATE ━━━━━━━━━━━━ */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-tertiary);
}
.empty-state-icon  { font-size: 48px; opacity: 0.4; margin-bottom: var(--space-4); }
.empty-state-title { font-size: var(--fs-lg); color: var(--text-secondary); margin-bottom: var(--space-2); }

/* ━━━━━━━━━━━━ DROPDOWN ━━━━━━━━━━━━ */
.dropdown-menu {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: var(--z-dropdown);
}
.dropdown-item {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--dur-fast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.danger { color: var(--danger-500); }
.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-1) 0;
}

/* ━━━━━━━━━━━━ TOAST ━━━━━━━━━━━━ */
.toast-stack {
  position: fixed; bottom: var(--space-6); right: var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-2);
  z-index: var(--z-toast);
}
.toast {
  background: var(--bg-glass);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-sm);
  max-width: 360px;
  animation: slideInRight var(--dur-base) var(--ease-out);
}

/* ━━━━━━━━━━━━ CODE ━━━━━━━━━━━━ */
.code-block {
  background: #0d1117;
  color: #c9d1d9;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow: auto;
  line-height: var(--lh-base);
  border: 1px solid var(--border-subtle);
}
code.inline, code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  border: 1px solid var(--border-subtle);
}

/* ━━━━━━━━━━━━ ANIMACIONES ━━━━━━━━━━━━ */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px) scale(0.98) } to { opacity: 1; transform: translateY(0) scale(1) } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px) } to { opacity: 1; transform: translateX(0) } }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.5 } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ━━━━━━━━━━━━ UTILS ━━━━━━━━━━━━ */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.text-xs   { font-size: var(--fs-xs); }
.text-sm   { font-size: var(--fs-sm); }
.text-lg   { font-size: var(--fs-lg); }
.text-dim     { color: var(--text-secondary); }
.text-dimmer  { color: var(--text-tertiary); }
.text-primary { color: var(--text-primary); }
.font-mono    { font-family: var(--font-mono); }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ━━━━━━━━━━━━ ICON ━━━━━━━━━━━━ */
.icon    { width: 16px; height: 16px; display: inline-block; vertical-align: middle; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* ━━━━━━━━━━━━ AUTH PAGES ━━━━━━━━━━━━ */
/* OAuth / SSO button */
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-md);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.oauth-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

/* Horizontal divider with centered label */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  color: var(--text-tertiary);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* Auth form: stacked fields */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
}
.auth-form input,
.auth-form select,
.auth-form textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
  font-size: var(--fs-md);
  font-family: inherit;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  min-height: 36px;
}
.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
  outline: none;
  border-color: var(--accent-500);
  box-shadow: var(--ring-accent);
}
.auth-form button[type="submit"],
.auth-form button:not([type]) {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--accent-500);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast);
  margin-top: var(--space-1);
}
.auth-form button[type="submit"]:hover:not(:disabled),
.auth-form button:not([type]):hover:not(:disabled) {
  background: var(--accent-600);
  transform: translateY(-1px);
}
.auth-form button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Footer links row below the form */
.auth-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  text-align: center;
}
.auth-footer a {
  color: var(--accent-400);
  text-decoration: underline; /* WCAG: links in text must be distinguishable beyond color */
  text-underline-offset: 2px;
}
.auth-footer a:hover { opacity: 0.8; }

/* Inline feedback banners */
.error-box {
  padding: var(--space-3) var(--space-4);
  background: var(--danger-soft);
  color: var(--danger-500);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
}
.success-box {
  padding: var(--space-3) var(--space-4);
  background: var(--success-soft);
  color: var(--success-500);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════════ */

/* MOBILE (<640px) */
@media (max-width: 639px) {
  .layout-sidebar {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: 80%;
    max-width: 320px;
    height: calc(100vh - var(--topbar-h));
    z-index: var(--z-fixed);
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-out);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: rgba(0,0,0,0.5);
    z-index: calc(var(--z-fixed) - 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-base);
  }
  .sidebar.open ~ .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .topbar { padding: 0 var(--space-3); }
  .topbar-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-md);
    font-size: 18px;
  }
  .topbar-burger:hover { background: var(--bg-hover); }
  .content { padding: var(--space-4); }

  .mobile-hide  { display: none !important; }
  .mobile-only  { display: block; }
}

@media (min-width: 640px) {
  .mobile-only     { display: none !important; }
  .topbar-burger   { display: none; }
  .sidebar-backdrop { display: none; }
}

/* TABLET (640-1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
  .content { padding: var(--space-6); }
}

/* ════════════════════════════════════════════════════════════════════
   v1.0.3 — Missing utility classes detected from real user feedback
   ════════════════════════════════════════════════════════════════════ */

/* toggle-row — used in skills, connectors, mcps, team for list items with toggle on right */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .info { flex: 1; min-width: 0; }
.toggle-row .info-title { font-weight: 600; color: var(--text-primary); margin: 0; }
.toggle-row .info-desc  { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: var(--space-1); }

/* usage-row — used in usage page for per-provider/per-user breakdowns */
.usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-sm);
}
.usage-row:last-child { border-bottom: none; }

/* btn-link — text-style action looking like a link, used for "Export CSV" etc. */
.btn-link {
  background: transparent;
  border: none;
  color: var(--accent-400);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  text-decoration: underline;
  transition: background var(--dur-fast);
  font-family: inherit;
}
.btn-link:hover { background: var(--accent-soft); }

/* stats-grid + stat — dashboard stat cards layout */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat {
  padding: var(--space-4);
}
.stat h4 {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat p {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

/* detail-card — alias for card-elevated with rich content */
.detail-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

/* sandbox-note — info box for runtime/security context */
.sandbox-note {
  background: var(--warning-soft);
  color: var(--warning-500);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  margin: var(--space-4) 0;
}

/* skill-name / skill-desc / skill-date — for dynamic-skills + skills tables */
.skill-name { font-weight: 600; color: var(--text-primary); }
.skill-desc { font-size: var(--fs-sm); color: var(--text-secondary); }
.skill-date { font-size: var(--fs-xs); color: var(--text-tertiary); }

/* error-msg / success-msg — inline form feedback */
.error-msg {
  color: var(--danger-500);
  background: var(--danger-soft);
  border: 1px solid rgba(239,68,68,0.3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  margin-top: var(--space-2);
}
.success-msg {
  color: var(--success-500);
  background: var(--success-soft);
  border: 1px solid rgba(16,185,129,0.3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  margin-top: var(--space-2);
}
