*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --ring: #a1a1aa;
  --radius: 0.5rem;
  --sidebar-w: 220px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --red-50: #fef2f2;
  --red-300: #ffa3a3;
  --red-400: #ff6568;
  --red-500: #fb2c36;
  --red-600: #e40014;
  --red-700: #bf000f;
  --red-800: #9f0712;
  --red-900: #82181a;
  --red-950: #460809;
 
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-300: #ffb96d;
  --orange-400: #ff8b1a;
  --orange-500: #fe6e00;
  --orange-600: #f05100;
  --orange-700: #c53c00;
  --orange-800: #9f2d00;
  --orange-900: #7e2a0c;

  --amber-50: #fffbeb;
  --amber-200: #fee685;
  --amber-300: #ffd236;
  --amber-400: #fcbb00;
  --amber-500: #f99c00;
  --amber-600: #dd7400;
  --amber-700: #b75000;
  --amber-800: #953d00;
  --amber-900: #7b3306;
  --amber-950: #461901;

  --yellow-50: #fefce8;
  --yellow-300: #ffe02a;
  --yellow-400: #fac800;
  --yellow-500: #edb200;
  --yellow-600: #cd8900;
  --yellow-700: #a36100;
  --yellow-800: #874b00;
  --yellow-900: #733e0a;

  --lime-50: #f7fee7;
  --lime-400: #9de500;
  --lime-500: #80cd00;
  --lime-600: #62a400;
  --lime-900: #35530e;

  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-300: #7bf1a8;
  --green-400: #05df72;
  --green-500: #00c758;
  --green-600: #00a544;
  --green-700: #008138;
  --green-800: #016630;
  --green-900: #0d542b;
  --green-950: #032e15;

  --emerald-100: #d0fae5;
  --emerald-400: #00d294;
  --emerald-500: #00bb7f;
  --emerald-600: #009767;
  --emerald-900: #004e3b;

  --teal-50: #f0fdfa;
  --teal-300: #46ecd5;
  --teal-400: #00d3bd;
  --teal-500: #00baa7;
  --teal-600: #009588;
  --teal-700: #00776e;
  --teal-800: #005f5a;
  --teal-900: #0b4f4a;

  --cyan-900: #104e64;

  --sky-50: #f0f9ff;
  --sky-300: #77d4ff;
  --sky-500: #00a5ef;
  --sky-600: #0084cc;
  --sky-700: #0069a4;
  --sky-950: #052f4a;

  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-300: #90c5ff;
  --blue-400: #54a2ff;
  --blue-500: #3080ff;
  --blue-600: #155dfc;
  --blue-700: #1447e6;
  --blue-800: #193cb8;
  --blue-900: #1c398e;
  --blue-950: #162456;

  --violet-50: #f5f3ff;
  --violet-300: #c4b4ff;
  --violet-400: #a685ff;
  --violet-500: #8d54ff;
  --violet-600: #7f22fe;
  --violet-700: #7008e7;
  --violet-800: #5d0ec0;
  --violet-900: #4d179a;

  --purple-50: #faf5ff;
  --purple-300: #d9b3ff;
  --purple-400: #c07eff;
  --purple-500: #ac4bff;
  --purple-600: #9810fa;
  --purple-700: #8200da;
  --purple-800: #6e11b0;
  --purple-900: #59168b;
  --purple-950: #3c0366;

  --pink-400: #fb64b6;
  --pink-500: #f6339a;
  --pink-600: #e30076;

  --rose-50: #fff1f2;
  --rose-300: #ffa2ae;
  --rose-400: #ff667f;
  --rose-500: #ff2357;
  --rose-600: #e70044;
  --rose-700: #c20039;
  --rose-800: #a30037;
  --rose-900: #8b0836;

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #90a1b9;
  --slate-500: #62748e;
  --slate-800: #1d293d;
  --slate-900: #0f172b;
  --slate-950: #020618;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #99a1af;
  --gray-500: #6a7282;
  --gray-700: #364153;
  --gray-800: #1e2939;
  --gray-900: #101828;
  --gray-950: #030712;

  --zinc-50: #fafafa;
  --zinc-100: #f4f4f5;
  --zinc-200: #e4e4e7;
  --zinc-400: #9f9fa9;
  --zinc-500: #71717b;
  --zinc-800: #27272a;
  --zinc-900: #18181b;
  --zinc-950: #09090b;

  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a1a1a1;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  --neutral-950: #0a0a0a;

  --stone-50: #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a6a09b;
  --stone-500: #79716b;
  --stone-600: #57534d;
  --stone-700: #44403b;
  --stone-800: #292524;
  --stone-900: #1c1917;
  --stone-950: #0c0a09;

}

body {
  font-family: var(--font);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.9rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Layout ───────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--muted);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.25rem;
  height: 3.25rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

.sidebar-brand-icon {
  width: 1.75rem;
  height: 1.75rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-nav a, .nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted-foreground);
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover, .nav-link:hover {
  background: var(--border);
  color: var(--foreground);
  text-decoration: none;
}

.sidebar-nav a.active, .nav-link.active {
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 500;
}

.sidebar-section-label {
  padding: 0.75rem 0.75rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

/* ── Main content ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  height: 100vh;
}

.topbar {
  height: 3.25rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  background: var(--background);
  font-size: 0.825rem;
  color: var(--muted-foreground);
  position: relative;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  max-width: 1400px;
}

.page-header {
  margin-bottom: 0.75rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.card-body {
  padding: 0.85rem 1rem;
}

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="url"],
select,
textarea {
  display: block;
  width: 100%;
  height: 2rem;
  padding: 0 0.6rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.825rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  height: auto;
  padding: 0.5rem 0.75rem;
  resize: vertical;
}

.input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(161, 161, 170, 0.2);
}

.input:disabled,
input:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
}

.form-row {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

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

label, .label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--foreground);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn-primary:hover { background: #27272a; }

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

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--muted); }

.btn-ghost {
  background: transparent;
  color: var(--foreground);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--muted); }

.btn-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}
.btn-destructive:hover { background: #dc2626; }

.btn-sm {
  height: 1.875rem;
  padding: 0 0.625rem;
  font-size: 0.8rem;
}

.table-wrapper {
  overflow-x: auto;
}

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

thead tr {
  background: var(--muted);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--muted); }

tbody td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--foreground);
  font-size: 1.25rem;
  padding: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;
}

.topbar-brand {
  display: none;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--foreground);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

@media (max-width: 768px) {
  .menu-btn { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    height: 100dvh;
  }

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

  .app-shell.sidebar-open .sidebar-overlay {
    display: block;
  }

  .topbar-brand { display: block; }

  .topbar {
    justify-content: space-between;
    padding: 0 1rem;
  }

  .page-content {
    padding: 0.75rem 1rem;
  }

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

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

  .page-title { font-size: 1.15rem; }

  thead th { padding: 0.5rem 0.75rem; }
  tbody td { padding: 0.6rem 0.75rem; font-size: 0.825rem; }
}

@media (max-width: 480px) {
  .page-content { padding: 0.5rem 0.75rem; }
  .card-body { padding: 0.75rem; }
  .card-header { padding: 0.75rem 1rem; }
  .btn { height: 2.5rem; }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.nav-card {
  padding: 1.25rem;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.nav-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nav-card-icon {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.card-overdue  { border-color: var(--destructive); }
.card-due-soon { border-color: #e67e22; }
.text-muted { color: var(--muted-foreground); }
.text-sm { font-size: 0.825rem; }
.text-xs { font-size: 0.75rem; }
.font-semibold { font-weight: 600; }
.gap-2 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.ms-2 { margin-left: 0.5rem; }
.d-none { display: none; }
.w-full { width: 100%; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}
.badge-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge-warning  { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.badge-error    { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.badge-info     { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
