/* ============================================================
   ClinicPro Panamá — Design System
   Medical SaaS UI · Version 1.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --blue-primary: #1a6bcc;
  --blue-dark: #0f4a9e;
  --blue-light: #e8f0fc;
  --blue-50: #f0f6ff;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  --green-primary: #16a34a;
  --green-light: #dcfce7;
  --green-50: #f0fdf4;
  --green-400: #4ade80;
  --green-500: #22c55e;

  --teal-500: #14b8a6;
  --teal-light: #ccfbf1;

  --purple-500: #8b5cf6;
  --purple-light: #ede9fe;

  --amber-500: #f59e0b;
  --amber-light: #fef3c7;

  --red-500: #ef4444;
  --red-light: #fee2e2;

  /* Neutral Palette */
  --white: #ffffff;
  --gray-25: #fcfcfd;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-150: #eceef2;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Sidebar */
  --sidebar-bg: #0d1b3e;
  --sidebar-w: 260px;
  --sidebar-hover: rgba(255,255,255,0.07);
  --sidebar-active: rgba(26,107,204,0.85);
  --sidebar-text: rgba(255,255,255,0.72);
  --sidebar-text-active: #ffffff;

  /* Layout */
  --navbar-h: 64px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
  --shadow: 0 4px 16px rgba(0,0,0,0.09);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.11);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.14);
  --shadow-blue: 0 4px 16px rgba(26,107,204,0.28);

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --t1: 150ms;
  --t2: 220ms;
  --t3: 350ms;

  /* App */
  --app-bg: #f4f6fa;
  --card-bg: var(--white);
  --border: var(--gray-200);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-500);
  --text-muted: var(--gray-400);
}

/* Dark Mode */
body.dark {
  --app-bg: #0f1623;
  --card-bg: #1a2236;
  --border: #2a3448;
  --text-primary: #e8edf5;
  --text-secondary: #8a97b0;
  --text-muted: #5a6a80;
  --sidebar-bg: #0a1020;
  --gray-50: #1a2236;
  --gray-100: #202d45;
  --gray-200: #2a3448;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--app-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 { font-family: 'Sora', sans-serif; font-weight: 600; line-height: 1.3; }

a { color: var(--blue-primary); text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }

/* ── Login Page ─────────────────────────────────────────────── */
#login-page {
  display: flex;
  min-height: 100vh;
  background: var(--gray-50);
}

.login-left {
  flex: 1;
  background: linear-gradient(145deg, #0d1b3e 0%, #1a3a7a 50%, #0f4a9e 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-left-blob1 {
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,107,204,0.35) 0%, transparent 70%);
  top: -100px; right: -100px;
}
.login-left-blob2 {
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22,163,74,0.2) 0%, transparent 70%);
  bottom: -80px; left: -60px;
}
.login-brand {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 48px;
  position: relative; z-index: 1;
}
.login-brand-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--blue-primary), var(--green-primary));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: white;
  box-shadow: 0 8px 24px rgba(26,107,204,0.4);
}
.login-brand h1 { font-size: 28px; color: white; }
.login-brand span { font-size: 13px; color: rgba(255,255,255,0.6); font-weight: 400; display: block; margin-top: 2px; }

.login-features { position: relative; z-index: 1; width: 100%; max-width: 380px; }
.login-feature-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.login-feature-item:last-child { border-bottom: none; }
.login-feature-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.login-feature-item h4 { font-size: 14px; color: white; margin-bottom: 3px; }
.login-feature-item p { font-size: 12px; color: rgba(255,255,255,0.55); line-height: 1.5; }

.login-right {
  width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  background: var(--white);
}
.login-form-wrap { width: 100%; }
.login-form-wrap h2 { font-size: 26px; color: var(--gray-900); margin-bottom: 6px; }
.login-form-wrap > p { color: var(--gray-500); margin-bottom: 32px; font-size: 14px; }

.role-tabs {
  display: flex; gap: 6px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 28px;
}
.role-tab {
  flex: 1;
  padding: 8px 6px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--t2) var(--ease);
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  border: none;
  background: none;
}
.role-tab.active {
  background: var(--white);
  color: var(--blue-primary);
  box-shadow: var(--shadow-sm);
}

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 7px; }

.input-wrap { position: relative; }
.input-wrap i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 15px; }
.input-wrap input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-900);
  transition: border-color var(--t1) var(--ease), box-shadow var(--t1) var(--ease);
  background: var(--white);
}
.input-wrap input:focus {
  outline: none;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(26,107,204,0.1);
}
.input-wrap .eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); cursor: pointer; font-size: 14px;
}

.btn-primary {
  width: 100%;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--blue-primary), var(--blue-700));
  color: white;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all var(--t2) var(--ease);
  box-shadow: var(--shadow-blue);
  font-family: 'Sora', sans-serif;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(26,107,204,0.38);
}
.btn-primary:active { transform: translateY(0); }

.demo-creds {
  margin-top: 24px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.demo-creds p { font-size: 12px; color: var(--gray-500); line-height: 1.7; }
.demo-creds strong { color: var(--blue-primary); }

.login-footer { margin-top: 32px; text-align: center; font-size: 12px; color: var(--gray-400); }

/* ── App Shell ──────────────────────────────────────────────── */
#app { display: none; }
#app.visible { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--t3) var(--ease);
  overflow: hidden;
}
.sidebar-logo {
  height: var(--navbar-h);
  display: flex; align-items: center; gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue-primary), #16a34a);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: white;
}
.sidebar-logo h2 { font-size: 16px; color: white; white-space: nowrap; }
.sidebar-logo span { font-size: 10px; color: rgba(255,255,255,0.45); display: block; margin-top: 1px; font-weight: 400; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }

.nav-section-title {
  padding: 16px 18px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 18px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--sidebar-text);
  transition: all var(--t1) var(--ease);
  position: relative;
  white-space: nowrap;
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  box-shadow: 0 2px 10px rgba(26,107,204,0.4);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--green-primary);
  border-radius: 99px;
}
.nav-item i { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item span { font-size: 13.5px; font-weight: 450; }
.nav-badge {
  margin-left: auto;
  background: var(--red-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t1) var(--ease);
}
.user-card:hover { background: var(--sidebar-hover); }
.user-avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
}
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-size: 13px; color: white; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-role { font-size: 11px; color: rgba(255,255,255,0.45); }
.user-card i { color: rgba(255,255,255,0.3); font-size: 13px; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  height: var(--navbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-xs);
}
.navbar-breadcrumb {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
}
.navbar-breadcrumb .page-title { font-size: 18px; font-weight: 600; color: var(--text-primary); font-family: 'Sora', sans-serif; }
.navbar-breadcrumb .page-sub { font-size: 13px; color: var(--text-secondary); }
.navbar-sep { color: var(--gray-300); }

.search-bar {
  display: flex; align-items: center;
  background: var(--gray-50);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 7px 14px;
  gap: 8px;
  width: 260px;
  transition: all var(--t1) var(--ease);
}
.search-bar:focus-within {
  border-color: var(--blue-primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(26,107,204,0.08);
  width: 300px;
}
.search-bar i { color: var(--gray-400); font-size: 14px; }
.search-bar input {
  background: none; border: none; outline: none;
  font-size: 13.5px; color: var(--text-primary); width: 100%;
}
.search-bar input::placeholder { color: var(--gray-400); }

.navbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  transition: all var(--t1) var(--ease);
  position: relative;
}
.icon-btn:hover { background: var(--gray-100); color: var(--blue-primary); }
.icon-btn .notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--red-500);
  border-radius: 50%;
  border: 2px solid var(--white);
}
.navbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Page Body ──────────────────────────────────────────────── */
.page-body { padding: 24px; flex: 1; }

.page { display: none; }
.page.active { display: block; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap; gap: 12px;
}
.section-header h2 { font-size: 20px; font-weight: 600; }
.section-header p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ── Buttons ─────────────────────────────────────────────────  */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--t2) var(--ease);
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

.btn-blue {
  background: linear-gradient(135deg, var(--blue-primary), var(--blue-700));
  color: white;
  box-shadow: var(--shadow-blue);
}
.btn-blue:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(26,107,204,0.35); }

.btn-green {
  background: linear-gradient(135deg, var(--green-primary), #15803d);
  color: white;
  box-shadow: 0 4px 14px rgba(22,163,74,0.28);
}
.btn-green:hover { transform: translateY(-1px); }

.btn-outline {
  background: var(--white);
  border: 1.5px solid var(--border);
  color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--blue-primary); color: var(--blue-primary); background: var(--blue-50); }

.btn-ghost { color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }

.btn-danger {
  background: linear-gradient(135deg, var(--red-500), #dc2626);
  color: white;
}

/* ── KPI Cards ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: transform var(--t2) var(--ease), box-shadow var(--t2) var(--ease);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-color, var(--blue-primary));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kpi-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text-primary); font-family: 'Sora', sans-serif; line-height: 1; }
.kpi-footer { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.kpi-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.kpi-badge.up { background: var(--green-light); color: var(--green-primary); }
.kpi-badge.down { background: var(--red-light); color: var(--red-500); }
.kpi-footer-text { color: var(--text-muted); }

/* ── Charts Grid ─────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.chart-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.chart-card-header h3 { font-size: 15px; font-weight: 600; }
.chart-card-header p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── Data Tables ────────────────────────────────────────────── */
.table-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.table-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.table-card-header h3 { font-size: 15px; font-weight: 600; }

.table-filters {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.filter-input {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--gray-50);
  outline: none;
  transition: border-color var(--t1) var(--ease);
  font-family: inherit;
}
.filter-input:focus { border-color: var(--blue-primary); background: var(--white); }

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

table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--gray-50); border-bottom: 1px solid var(--border); }
th {
  padding: 11px 16px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tbody tr { transition: background var(--t1) var(--ease); }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

.table-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-secondary);
}

/* ── Status Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.badge-blue { background: var(--blue-light); color: var(--blue-primary); }
.badge-green { background: var(--green-light); color: var(--green-primary); }
.badge-amber { background: var(--amber-light); color: #b45309; }
.badge-red { background: var(--red-light); color: var(--red-500); }
.badge-purple { background: var(--purple-light); color: var(--purple-500); }
.badge-teal { background: var(--teal-light); color: var(--teal-500); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ── Patient Avatar ─────────────────────────────────────────── */
.pat-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.pat-info { display: flex; align-items: center; gap: 10px; }
.pat-info-text .name { font-weight: 500; font-size: 13.5px; }
.pat-info-text .sub { font-size: 12px; color: var(--text-secondary); }

/* ── Action Buttons ─────────────────────────────────────────── */
.action-btns { display: flex; align-items: center; gap: 4px; }
.action-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: all var(--t1) var(--ease);
  cursor: pointer;
}
.action-btn.view { color: var(--blue-primary); background: var(--blue-light); }
.action-btn.edit { color: #d97706; background: var(--amber-light); }
.action-btn.del { color: var(--red-500); background: var(--red-light); }
.action-btn:hover { filter: brightness(0.9); transform: scale(1.05); }

/* ── Calendar ───────────────────────────────────────────────── */
.calendar-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.cal-header {
  background: linear-gradient(135deg, var(--blue-primary), var(--blue-dark));
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  color: white;
}
.cal-header h3 { font-size: 15px; }
.cal-nav-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; font-size: 13px;
  transition: background var(--t1) var(--ease);
}
.cal-nav-btn:hover { background: rgba(255,255,255,0.25); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  padding: 12px;
  gap: 2px;
}
.cal-day-name {
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--text-secondary); padding: 6px 0;
  text-transform: uppercase;
}
.cal-day {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t1) var(--ease);
  position: relative; gap: 2px;
}
.cal-day:hover { background: var(--blue-light); color: var(--blue-primary); }
.cal-day.today {
  background: var(--blue-primary); color: white;
  font-weight: 700;
  box-shadow: var(--shadow-blue);
}
.cal-day.has-event::after {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green-primary);
  position: absolute; bottom: 4px;
}
.cal-day.other-month { color: var(--text-muted); }

/* ── Vitals & Progress ──────────────────────────────────────── */
.vital-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.vital-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.vital-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.vital-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.vital-value { font-size: 24px; font-weight: 700; font-family: 'Sora', sans-serif; color: var(--text-primary); }
.vital-unit { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.vital-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-top: 8px; }

.progress-bar-wrap { margin-top: 8px; }
.progress-bar-bg { height: 5px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 99px; transition: width 1s var(--ease); }

/* ── Finance Cards ──────────────────────────────────────────── */
.finance-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.finance-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.finance-card.income { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border-color: #bbf7d0; }
.finance-card.expense { background: linear-gradient(135deg, #fff1f2, #fee2e2); border-color: #fecaca; }
.finance-card.balance { background: linear-gradient(135deg, var(--blue-50), var(--blue-light)); border-color: var(--blue-100); }
.finance-card .fc-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
.finance-card .fc-value { font-size: 26px; font-weight: 700; font-family: 'Sora', sans-serif; margin-top: 6px; }
.finance-card.income .fc-value { color: var(--green-primary); }
.finance-card.expense .fc-value { color: var(--red-500); }
.finance-card.balance .fc-value { color: var(--blue-primary); }
.finance-card .fc-icon {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 36px; opacity: 0.12;
}

/* ── Inventory Stock ─────────────────────────────────────────── */
.stock-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 99px;
  overflow: hidden;
}
.stock-fill { height: 100%; border-radius: 99px; }
.stock-fill.ok { background: var(--green-primary); }
.stock-fill.warn { background: var(--amber-500); }
.stock-fill.low { background: var(--red-500); }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn var(--t2) var(--ease);
}
.modal-overlay.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: slideUp var(--t3) var(--ease);
}
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  cursor: pointer; border: none; background: none;
  transition: all var(--t1) var(--ease);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-900); }

.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

/* ── Forms (inside modals) ──────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 500; color: var(--gray-700); }
.form-field input, .form-field select, .form-field textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--gray-50);
  outline: none;
  transition: border-color var(--t1) var(--ease), box-shadow var(--t1) var(--ease);
  font-family: inherit;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--blue-primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(26,107,204,0.09);
}
.form-field textarea { min-height: 80px; resize: vertical; }

/* ── Notification Panel ─────────────────────────────────────── */
.notif-list { display: flex; flex-direction: column; gap: 4px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--t1) var(--ease);
  border-left: 3px solid transparent;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { border-left-color: var(--blue-primary); background: var(--blue-50); }
.notif-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.notif-item .notif-text .title { font-size: 13.5px; font-weight: 500; color: var(--text-primary); }
.notif-item .notif-text .desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.notif-item .notif-text .time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Settings ───────────────────────────────────────────────── */
.settings-grid {
  display: grid; grid-template-columns: 220px 1fr;
  gap: 20px;
}
.settings-sidebar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 8px 0;
  height: fit-content;
}
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all var(--t1) var(--ease);
  font-size: 13.5px; color: var(--gray-600);
  border-left: 2px solid transparent;
}
.settings-nav-item:hover { background: var(--gray-50); color: var(--blue-primary); }
.settings-nav-item.active { color: var(--blue-primary); border-left-color: var(--blue-primary); background: var(--blue-50); font-weight: 500; }
.settings-nav-item i { width: 18px; text-align: center; font-size: 14px; }
.settings-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.settings-section-title { font-size: 16px; font-weight: 600; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.toggle-wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-wrap:last-child { border-bottom: none; }
.toggle-info .tg-title { font-size: 13.5px; font-weight: 500; }
.toggle-info .tg-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.toggle {
  position: relative; width: 42px; height: 22px; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--gray-300);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--t2) var(--ease);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  top: 3px; left: 3px;
  transition: transform var(--t2) var(--ease);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--blue-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Reports ────────────────────────────────────────────────── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 14px; margin-bottom: 24px; }
.report-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--t2) var(--ease);
}
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--blue-primary); }
.report-card i { font-size: 28px; margin-bottom: 12px; }
.report-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.report-card p { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.report-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: countUp 0.5s var(--ease) both; }

.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--gray-900);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  pointer-events: all;
  animation: toastIn 0.3s var(--ease) both;
  max-width: 340px;
}
.toast.success i { color: var(--green-400); }
.toast.error i { color: #f87171; }
.toast.info i { color: #60a5fa; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.95); } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 260px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .charts-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .login-left { display: none; }
  .login-right { width: 100%; padding: 32px 24px; }
}
