/* ===== المتغيرات الأساسية ===== */
:root {
  --primary: #1a6b4a;
  --primary-light: #22895f;
  --primary-dark: #134d36;
  --secondary: #0d7abf;
  --accent: #e8f5f0;
  --accent2: #e3f2fd;
  --danger: #dc3545;
  --warning: #fd7e14;
  --success: #28a745;
  --info: #17a2b8;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #6c757d;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Segoe UI', 'Tahoma', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; direction: rtl; }
* { scrollbar-width: thin; scrollbar-color: var(--primary) #eee; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ===== Layout ===== */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo .logo-icon { font-size: 2rem; }
.sidebar-logo h2 { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.sidebar-logo p { font-size: 0.75rem; opacity: 0.7; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.5;
  padding: 16px 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  cursor: pointer;
  transition: all 0.2s;
  border-right: 3px solid transparent;
  font-size: 0.9rem;
}
.nav-item:hover { background: rgba(255,255,255,0.1); }
.nav-item.active {
  background: rgba(255,255,255,0.18);
  border-right-color: #fff;
  font-weight: 600;
}
.nav-item .icon { font-size: 1.1rem; min-width: 22px; }
.nav-badge {
  margin-right: auto;
  background: var(--warning);
  color: #fff;
  border-radius: 20px;
  font-size: 0.7rem;
  padding: 1px 7px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.75rem;
  opacity: 0.6;
  text-align: center;
}

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

/* Top Bar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-title h1 { font-size: 1.2rem; font-weight: 700; color: var(--primary-dark); }
.topbar-title p { font-size: 0.8rem; color: var(--text-muted); }
.topbar-actions { margin-right: auto; display: flex; align-items: center; gap: 10px; }
.topbar-search {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 7px 14px;
  gap: 8px;
  min-width: 220px;
}
.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  width: 100%;
}
.topbar-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}
.topbar-btn:hover { background: var(--primary-light); }
.topbar-btn.outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.topbar-btn.outline:hover { background: var(--accent); }

/* Content Area */
.content-area { padding: 28px; flex: 1; }

/* ===== Pages ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== Stats Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 18px;
  border-right: 4px solid var(--primary);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card:nth-child(2) { border-right-color: var(--secondary); }
.stat-card:nth-child(3) { border-right-color: var(--warning); }
.stat-card:nth-child(4) { border-right-color: var(--danger); }
.stat-card:nth-child(5) { border-right-color: var(--success); }
.stat-icon {
  font-size: 2.2rem;
  background: var(--accent);
  border-radius: var(--radius-sm);
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
}
.stat-info h3 { font-size: 1.8rem; font-weight: 800; color: var(--primary-dark); }
.stat-info p { font-size: 0.82rem; color: var(--text-muted); }

/* ===== Cards & Tables ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 22px; }

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  background: var(--bg);
  padding: 11px 14px;
  text-align: right;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--accent); }
.data-table .actions { display: flex; gap: 6px; }

/* ===== Badges & Status ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: var(--accent); color: var(--primary-dark); }
.badge-secondary { background: #e2e3e5; color: #383d41; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #0a6aa8; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c82333; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; border-radius: 6px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ===== Grid Layouts ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ===== Doctor Card ===== */
.doctor-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 3px solid var(--primary);
  transition: all 0.2s;
}
.doctor-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.doctor-avatar {
  font-size: 2.8rem;
  background: linear-gradient(135deg, var(--accent), #c8e6c9);
  border-radius: 50%;
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
}
.doctor-info h3 { font-size: 0.95rem; font-weight: 700; }
.doctor-info .specialty { color: var(--primary); font-size: 0.82rem; font-weight: 600; }
.doctor-meta { display: flex; flex-direction: column; gap: 4px; }
.doctor-meta span { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.doctor-actions { display: flex; gap: 8px; margin-top: auto; }
.rating { color: #f59e0b; font-weight: 700; font-size: 0.85rem; }

/* ===== Clinic Card ===== */
.clinic-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  transition: all 0.2s;
  border-right: 4px solid var(--secondary);
}
.clinic-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.clinic-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.clinic-header h3 { font-size: 1rem; font-weight: 700; }
.clinic-details { display: flex; flex-direction: column; gap: 7px; }
.clinic-details span { font-size: 0.82rem; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.clinic-specialties { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.clinic-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ===== Patient Record ===== */
.patient-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.patient-avatar-lg {
  font-size: 3rem;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 80px; height: 80px;
  display: flex; align-items: center; justify-content: center;
}
.patient-info-main h2 { font-size: 1.3rem; font-weight: 800; }
.patient-info-main .meta { display: flex; gap: 16px; margin-top: 6px; font-size: 0.85rem; opacity: 0.85; }

/* ===== Pharmacy Card ===== */
.pharmacy-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-top: 3px solid var(--info);
  transition: all 0.2s;
}
.pharmacy-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pharmacy-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.pharmacy-header h3 { font-size: 0.95rem; font-weight: 700; }

/* ===== Medication Card ===== */
.med-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  border-right: 4px solid var(--warning);
}
.med-card.low-stock { border-right-color: var(--danger); background: #fff8f8; }
.text-danger { color: var(--danger); }
.med-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.med-header h3 { font-size: 0.95rem; font-weight: 700; }
.med-info span { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.med-info strong { color: var(--text); font-size: 0.82rem; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px);
  transition: transform 0.25s;
}
.modal-overlay.open .modal { 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: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none;
  font-size: 1.4rem; color: var(--text-muted);
  cursor: pointer; line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== Form ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-control {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  background: var(--surface);
  width: 100%;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ===== Filters ===== */
.filters-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.filter-select {
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 7px 14px;
  font-size: 0.85rem;
  outline: none;
  background: var(--surface);
  cursor: pointer;
}
.filter-select:focus { border-color: var(--primary); }
.search-input {
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 7px 14px;
  font-size: 0.85rem;
  outline: none;
  background: var(--surface);
  min-width: 200px;
}
.search-input:focus { border-color: var(--primary); }

/* ===== Appointment Timeline ===== */
.appointment-item {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.appointment-item:last-child { border-bottom: none; }
.appt-time {
  min-width: 80px;
  text-align: center;
  background: var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.appt-time .time { font-size: 1.1rem; font-weight: 800; color: var(--primary-dark); }
.appt-time .date { font-size: 0.72rem; color: var(--text-muted); }
.appt-details { flex: 1; }
.appt-details h4 { font-size: 0.9rem; font-weight: 700; }
.appt-details p { font-size: 0.82rem; color: var(--text-muted); margin-top: 3px; }
.appt-actions { display: flex; gap: 6px; }

/* ===== Dashboard Quick Actions ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.quick-action {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  border: 2px solid transparent;
}
.quick-action:hover { border-color: var(--primary); transform: translateY(-3px); }
.quick-action .qa-icon { font-size: 2rem; margin-bottom: 8px; }
.quick-action p { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }

/* ===== Record Timeline ===== */
.record-timeline { position: relative; padding-right: 24px; }
.record-timeline::before {
  content: '';
  position: absolute;
  right: 9px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.record-item { position: relative; padding-bottom: 24px; }
.record-item::before {
  content: '';
  position: absolute;
  right: -19px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--primary);
}
.record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.record-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.record-card-header h4 { font-size: 0.95rem; font-weight: 700; color: var(--primary-dark); }
.record-section { margin-bottom: 10px; }
.record-section label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.record-section p { font-size: 0.85rem; margin-top: 2px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-right: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hamburger { display: flex !important; }
}
.hamburger {
  display: none;
  background: none; border: none;
  font-size: 1.4rem; cursor: pointer;
  padding: 4px;
}

/* ===== Alerts ===== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 24px; left: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--primary-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-120%);
  transition: transform 0.3s;
  min-width: 260px;
}
.toast.show { transform: translateX(0); }
.toast.success { background: var(--success); }
.toast.danger { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 4rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; }
.empty-state p { font-size: 0.88rem; }

/* ===== Progress Bar ===== */
.progress { background: var(--border); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 20px; transition: width 0.5s; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover:not(.active) { color: var(--text); background: var(--bg); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== Avatar Initials ===== */
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Misc */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.fw-bold { font-weight: 700; }
.small { font-size: 0.8rem; }

/* ===== Sidebar Overlay (mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ===== Section Heading ===== */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.section-heading h2 { font-size: 1.15rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }

/* ===== Fee Summary ===== */
.fee-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.fee-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
  border-right: 4px solid var(--primary);
  min-width: 180px;
  flex: 1;
}
.fee-item span { font-size: 0.8rem; color: var(--text-muted); }
.fee-item strong { font-size: 1.2rem; font-weight: 800; color: var(--primary-dark); }
.fee-item.fee-paid { border-right-color: var(--success); }
.fee-item.fee-paid strong { color: var(--success); }
.fee-item.fee-unpaid { border-right-color: var(--danger); }
.fee-item.fee-unpaid strong { color: var(--danger); }

/* ===== Star Picker ===== */
.star-pick { transition: transform 0.1s; }
.star-pick:hover { transform: scale(1.2); }

/* ===== Medical Welcome Banner ===== */
.medical-banner {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--secondary) 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.medical-banner::before {
  content: '';
  position: absolute;
  top: -40px; left: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.medical-banner::after {
  content: '';
  position: absolute;
  bottom: -30px; right: 120px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.medical-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.medical-banner-text h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; }
.medical-banner-text p { font-size: 0.92rem; opacity: 0.9; margin-bottom: 14px; }
.medical-banner-features {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.medical-banner-features span {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.medical-banner-icon {
  font-size: 5rem;
  opacity: 0.2;
  line-height: 1;
  user-select: none;
}
@media (max-width: 600px) {
  .medical-banner-icon { display: none; }
  .medical-banner { padding: 18px; }
}

/* ===== Owner KPI Cards ===== */
.owner-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  border-radius: var(--radius);
  padding: 22px 18px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s;
}
.kpi-card:hover { transform: translateY(-3px); }
.kpi-green  { background: linear-gradient(135deg, #1a6b4a, #22895f); }
.kpi-blue   { background: linear-gradient(135deg, #0d5ea3, #1a72c0); }
.kpi-orange { background: linear-gradient(135deg, #e67e22, #f39c12); }
.kpi-red    { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.kpi-purple { background: linear-gradient(135deg, #5b2d8e, #6d38a8); }
.kpi-icon { font-size: 1.8rem; opacity: 0.9; }
.kpi-value { font-size: 2rem; font-weight: 900; line-height: 1; }
.kpi-label { font-size: 0.78rem; opacity: 0.85; }

/* ===== Bar Chart ===== */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  padding-bottom: 30px;
  position: relative;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
}
.bar {
  width: 100%;
  background: linear-gradient(180deg, var(--primary-light), var(--primary-dark));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.5s ease;
}
.bar-value { font-size: 0.72rem; font-weight: 700; color: var(--primary-dark); }
.bar-label { font-size: 0.65rem; color: var(--text-muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ===== Donut Chart ===== */
.donut-wrapper { display: flex; justify-content: center; margin-bottom: 16px; }
.donut {
  width: 140px; height: 140px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.donut-hole {
  width: 90px; height: 90px;
  background: #fff;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 0.75rem; color: var(--text-muted);
}
.donut-hole strong { font-size: 1.4rem; font-weight: 900; color: var(--primary-dark); }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* ===== Gender Bar ===== */
.gender-bar-wrapper { margin-bottom: 20px; }
.gender-bar {
  display: flex;
  height: 36px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.gender-male {
  background: linear-gradient(90deg, #0d5ea3, #1a72c0);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.78rem; font-weight: 600;
  transition: width 0.5s;
  min-width: 40px;
}
.gender-female {
  background: linear-gradient(90deg, #c0392b, #e74c3c);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.78rem; font-weight: 600;
  transition: width 0.5s;
  min-width: 40px;
}

/* ===== Theme Selector ===== */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.theme-option {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-option:hover { border-color: var(--primary); transform: translateY(-2px); }
.theme-option.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent); }

/* ===== Print Styles ===== */
@media print {
  .sidebar, .topbar, .no-print, .topbar-actions, .hamburger,
  .btn, .filters-bar, .modal-overlay, .toast-container { display: none !important; }
  .main-content { margin-right: 0 !important; }
  .content-area { padding: 10px !important; }
  .record-card { box-shadow: none !important; border: 1px solid #ccc !important; }
  body { background: white !important; }
}

/* ===== Install PWA Button ===== */
.pwa-install-btn {
  position: fixed;
  bottom: 80px; left: 24px;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
}

/* ===== Responsive additions ===== */
@media (max-width: 900px) {
  .owner-kpi-grid { grid-template-columns: 1fr 1fr; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .bar-chart { height: 120px; }
  #page-records > div { grid-template-columns: 1fr !important; }
  .donut { width: 110px; height: 110px; }
  .donut-hole { width: 70px; height: 70px; }
}
@media (max-width: 500px) {
  .owner-kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 1.6rem; }
  .bar-chart { gap: 4px; }
  .bar-label { font-size: 0.55rem; }
}
</style>

