/* ============================================================
   FINANZAS PERSONAL — Design System (main.css)
   Premium dark-mode with glassmorphism
   ============================================================ */

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

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-primary:    #0a0a1a;
  --bg-secondary:  #0f0f2a;
  --bg-tertiary:   #141432;
  --bg-card:       rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-input:      rgba(255, 255, 255, 0.04);
  --bg-input-focus:rgba(255, 255, 255, 0.07);

  /* Accent palette */
  --accent-violet: #7c3aed;
  --accent-violet-hover: #6d28d9;
  --accent-violet-glow: rgba(124, 58, 237, 0.35);
  --accent-cyan:   #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-green:  #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.25);
  --accent-red:    #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.25);
  --accent-amber:  #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.25);

  /* Gradients */
  --gradient-violet-cyan: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  --gradient-violet:      linear-gradient(135deg, #7c3aed, #a855f7);
  --gradient-green:       linear-gradient(135deg, #10b981, #34d399);
  --gradient-red:         linear-gradient(135deg, #ef4444, #f87171);
  --gradient-amber:       linear-gradient(135deg, #f59e0b, #fbbf24);
  --gradient-surface:     linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));

  /* Typography */
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary:  #64748b;
  --text-inverse:   #0a0a1a;

  /* Borders & Dividers */
  --border:          rgba(255, 255, 255, 0.08);
  --border-hover:    rgba(255, 255, 255, 0.15);
  --border-focus:    rgba(124, 58, 237, 0.5);

  /* Shadows */
  --shadow-sm:    0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:    0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg:    0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl:    0 12px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow:  0 0 30px var(--accent-violet-glow);

  /* Spacing scale */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radii */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Sidebar */
  --sidebar-width:     240px;
  --sidebar-collapsed:  72px;

  /* Navbar */
  --navbar-height: 72px;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-base:   0.3s ease;
  --transition-slow:   0.5s ease;
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Font families */
  --font-body:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Z-index scale */
  --z-sidebar:    100;
  --z-navbar:     200;
  --z-dropdown:   300;
  --z-modal:      400;
  --z-toast:      500;
  --z-voice:      600;
  --z-tooltip:    700;
}


/* ── Reset / Normalize ─────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

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

/* Subtle grain/noise overlay for depth */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(124, 58, 237, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

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

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

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

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--accent-violet);
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}


/* ── Base Typography ───────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: 2rem;    letter-spacing: -0.03em; }
h2 { font-size: 1.5rem;  letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 2rem; }

.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

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

.amount {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.amount-sm {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.875rem;
}


/* ── Layout: Sidebar ──────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(10, 10, 30, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-base), transform var(--transition-base);
  overflow: hidden;
}

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

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--gradient-violet-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-violet-glow);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand-text h2 {
  font-size: 1rem;
  font-weight: 700;
  background: var(--gradient-violet-cyan);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-brand-text span {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  overflow-y: auto;
}

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

.sidebar-nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  margin-bottom: 2px;
}

.nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-violet-cyan);
  opacity: 0;
  transition: opacity var(--transition-base);
  border-radius: var(--radius-md);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link:hover::before {
  opacity: 0.08;
}

.nav-link.active {
  color: var(--text-primary);
  font-weight: 600;
}

.nav-link.active::before {
  opacity: 0.12;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gradient-violet-cyan);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-link-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
}

.nav-link-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-link-text {
  position: relative;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
}

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

/* Sidebar collapsed */
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-link-text,
.sidebar.collapsed .sidebar-nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: var(--space-sm);
}

.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: var(--space-md);
}


/* ── Layout: Main Content ──────────────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-base);
}

.sidebar.collapsed ~ .main-wrapper {
  margin-left: var(--sidebar-collapsed);
}

/* Top Navbar */
.navbar {
  position: sticky;
  top: 0;
  height: var(--navbar-height);
  background: rgba(10, 10, 30, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-navbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  flex-shrink: 0;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.sidebar-toggle:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.navbar-title {
  font-size: 1.25rem;
  font-weight: 700;
}

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

.navbar-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.navbar-date svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.navbar-balance {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.navbar-balance-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.navbar-balance-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-green);
}


/* Main content */
.main-content {
  flex: 1;
  padding: var(--space-xl);
}

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

.page-header h1 {
  margin-bottom: var(--space-xs);
}

.page-header p {
  font-size: 0.9rem;
}


/* ── Cards (Glassmorphism) ─────────────────────────────────── */
.card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

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


/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition-fast);
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.1);
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Primary */
.btn-primary {
  background: var(--gradient-violet);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-violet-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px var(--accent-violet-glow);
  transform: translateY(-1px);
}

/* Secondary / Ghost */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

/* Danger */
.btn-danger {
  background: var(--gradient-red);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-red-glow);
}

.btn-danger:hover {
  box-shadow: 0 6px 24px var(--accent-red-glow);
  transform: translateY(-1px);
}

/* Success */
.btn-success {
  background: var(--gradient-green);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-green-glow);
}

/* Icon-only button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Small */
.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}


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

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all var(--transition-base);
}

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

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* Toggle switch */
.toggle-group {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.toggle-option {
  flex: 1;
  padding: 10px 16px;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.toggle-option.active {
  color: #fff;
}

.toggle-option.active.gasto {
  background: var(--gradient-red);
}

.toggle-option.active.ingreso {
  background: var(--gradient-green);
}

.toggle-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}


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

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead th {
  padding: var(--space-md) var(--space-lg);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.table tbody tr {
  transition: background var(--transition-fast);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.table td {
  padding: var(--space-md) var(--space-lg);
  font-size: 0.875rem;
  vertical-align: middle;
  white-space: nowrap;
}

.table td:last-child {
  text-align: right;
}


/* ── Progress Bars ─────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar-fill.green {
  background: var(--gradient-green);
  box-shadow: 0 0 12px var(--accent-green-glow);
}

.progress-bar-fill.amber {
  background: var(--gradient-amber);
  box-shadow: 0 0 12px var(--accent-amber-glow);
}

.progress-bar-fill.red {
  background: var(--gradient-red);
  box-shadow: 0 0 12px var(--accent-red-glow);
}

.progress-bar-fill.violet {
  background: var(--gradient-violet);
  box-shadow: 0 0 12px var(--accent-violet-glow);
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}


/* ── Badges / Tags ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-violet {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.25);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-gray {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.2);
}


/* ── Alerts / Banners ──────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid;
  animation: alertSlideIn 0.4s ease;
}

@keyframes alertSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-message {
  color: inherit;
  opacity: 0.85;
  font-size: 0.8rem;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.alert-info {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.2);
  color: #22d3ee;
}

.alert-success {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}


/* ── Utility Classes ───────────────────────────────────────── */
.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.items-end       { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-xs          { gap: var(--space-xs); }
.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            { display: grid; }
.grid-2          { grid-template-columns: repeat(2, 1fr); }
.grid-3          { grid-template-columns: repeat(3, 1fr); }
.grid-4          { grid-template-columns: repeat(4, 1fr); }

.m-0   { margin: 0; }
.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); }
.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); }

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

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

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

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-violet    { color: var(--accent-violet); }
.text-cyan      { color: var(--accent-cyan); }
.text-green     { color: var(--accent-green); }
.text-red       { color: var(--accent-red); }
.text-amber     { color: var(--accent-amber); }

.bg-card { background: var(--bg-card); }

.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden { display: none !important; }
.invisible { visibility: hidden; }

/* Fade-in animation */
.fade-in {
  animation: fadeIn 0.5s ease;
}

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

.slide-up {
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ── Responsive ────────────────────────────────────────────── */

/* Mobile: sidebar hidden by default */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

  .sidebar.active,
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .navbar {
    padding: 0 var(--space-md);
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .navbar-date {
    display: none;
  }

  /* Overlay when sidebar is open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: calc(var(--z-sidebar) - 1);
    backdrop-filter: blur(4px);
  }

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

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }

  .sidebar .sidebar-brand-text,
  .sidebar .nav-link-text,
  .sidebar .sidebar-nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .sidebar .nav-link {
    justify-content: center;
    padding: var(--space-sm);
  }

  .sidebar .sidebar-brand {
    justify-content: center;
    padding: var(--space-md);
  }

  .main-wrapper {
    margin-left: var(--sidebar-collapsed);
  }

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

/* Large screens */
@media (min-width: 1400px) {
  .main-content {
    max-width: 1400px;
  }
}
