/* =========================================================
   res/css/style.css  –  MedicalPRO Dashboard Unified
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens ──────────────────────────────────────── */
:root {
  --accent:       #2979ff;
  --accent-light: #e8f0fe;
  --accent-dark:  #1a56cc;
  --bg:           #f0f4f8;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --text:         #1a202c;
  --text-muted:   #64748b;
  --green:        #16a34a;
  --red:          #dc2626;
  --orange:       #ea580c;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.10);
  --shadow-hover: 0 8px 24px rgba(41,121,255,0.15);
  --radius:       12px;
  --radius-sm:    8px;
  --radius-xs:    6px;
  --transition:   0.2s cubic-bezier(0.4,0,0.2,1);
  --sidebar-width: 250px;
  --header-h:     58px;
}

/* ── Dark Theme Overrides ───────────────────────────────── */
body.dark {
  --bg:           #0f172a;
  --surface:      #1e293b;
  --border:       #334155;
  --text:         #f1f5f9;
  --text-muted:   #94a3b8;
  --accent-light: #1e3a5f;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.5);
}

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}
a:hover { opacity: 0.8; }

/* ── Header bar ─────────────────────────────────────────── */
.header {
  background: linear-gradient(135deg, #1a1f36 0%, #2d3561 100%);
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.header .logo img {
  height: 36px;
  width: auto;
  display: block;
}

.header .controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header select {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23fff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.header select option { background: #1a1f36; color: #fff; }

/* ── Header buttons ─────────────────────────────────────── */
.header-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: inherit;
}
.header-btn:hover { background: rgba(255,255,255,0.22); }

.header-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  white-space: nowrap;
}
.header-sync-badge.success { background: rgba(22,163,74,0.22); border-color: rgba(22,163,74,0.35); }
.header-sync-badge.warning { background: rgba(234,88,12,0.22); border-color: rgba(234,88,12,0.35); }
.header-sync-badge.danger { background: rgba(220,38,38,0.22); border-color: rgba(220,38,38,0.35); }
.header-sync-badge.info { background: rgba(41,121,255,0.18); border-color: rgba(41,121,255,0.35); }

/* Sync-now in header */
#sync-now {
  background: var(--accent);
  border: none;
  font-weight: 600;
}
#sync-now:hover { background: var(--accent-dark); }
#sync-now.syncing::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 10px;
  border: 2px solid var(--accent);
  animation: pulse 1s infinite;
}
#sync-now { position: relative; overflow: visible; }

@keyframes pulse {
  0%   { transform: scale(1);   opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* User dropdown in header */
.header .user-dropdown { position: relative; display: inline-block; }
.header .user-dropdown .dropdown-toggle {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  white-space: nowrap;
}
.header .user-dropdown .dropdown-toggle:hover { background: rgba(255,255,255,0.22); }
.header .user-dropdown .dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1001;
  display: none;
  min-width: 180px;
  padding: 6px 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
}
.header .user-dropdown.open .dropdown-menu { display: block; }
.header .user-dropdown .dropdown-menu li a {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  font-size: 13px;
  transition: var(--transition);
}
.header .user-dropdown .dropdown-menu li a:hover { background: var(--accent-light); color: var(--accent); }
.header .user-dropdown .dropdown-menu .divider {
  height: 1px;
  margin: 6px 0;
  background: var(--border);
}

/* ── Toggle switch (dark mode) ──────────────────────────── */
.toggle-switch {
  position: relative;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 22px;
  transition: var(--transition);
}
.toggle-switch .slider:before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .slider { background: var(--accent); }
.toggle-switch input:checked + .slider:before { transform: translateX(20px); }

/* ── Layout: sidebar + main-content ─────────────────────── */
.layout { display: flex; min-height: calc(100vh - var(--header-h)); }

.sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  overflow-y: auto;
  position: relative;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 24px;
}
.main-content.full { max-width: none; }

/* Login page — full bleed, no padding/background */
.main-content:has(.login-page) { padding: 0; background: none; }
.layout:has(.login-page) { min-height: 100vh; background: none; }
body:has(.login-page) { background: #0f172a; }

/* ── Sidebar menu ───────────────────────────────────────── */
.menu-item {
  display: block;
  padding: 12px 15px;
  margin-bottom: 4px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-xs);
  border-left: 4px solid transparent;
  transition: all 0.2s;
  font-size: 14px;
}
.menu-item:hover {
  background: var(--accent-light);
  border-left-color: var(--accent);
  text-decoration: none;
  opacity: 1;
}
.menu-item.active {
  background: var(--accent);
  color: #fff;
  border-left-color: var(--accent-dark);
}
.menu-item i {
  width: 20px;
  text-align: center;
  margin-right: 8px;
}
body.dark .menu-item:hover { background: rgba(41,121,255,0.15); }

/* ── Content wrapper ────────────────────────────────────── */
.page-content {
  max-width: 1400px;
}

/* ── Section headers ────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}
.section-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.section-header h3 i { color: var(--accent); margin-right: 6px; }

/* ── Stat Cards Row ─────────────────────────────────────── */
.stat-cards {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}
.stat-cards.cols-5 { grid-template-columns: repeat(5, 1fr); }
.stat-cards.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stat-cards.cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1100px) { .stat-cards.cols-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .stat-cards.cols-5,
                             .stat-cards.cols-4,
                             .stat-cards.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .stat-cards.cols-5,
                             .stat-cards.cols-4,
                             .stat-cards.cols-3 { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 20px 16px;
  border-top: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: var(--accent-light);
  border-radius: 50%;
  transform: translate(30px, -30px);
  opacity: 0.6;
}
.stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.stat-card.profit  { border-top-color: var(--green); }
.stat-card.profit::before  { background: #dcfce7; }
.stat-card.green   { border-top-color: var(--green); }
.stat-card.blue    { border-top-color: var(--accent); }
.stat-card.orange  { border-top-color: var(--orange); }
.stat-card.orange::before { background: #ffedd5; }
.stat-card.cyan    { border-top-color: #06b6d4; }
.stat-card.purple  { border-top-color: #8b5cf6; }
.stat-card.red     { border-top-color: var(--red); }

body.dark .stat-card.profit::before  { background: rgba(22,163,74,0.15); }
body.dark .stat-card.orange::before  { background: rgba(234,88,12,0.15); }
body.dark .stat-card.cyan::before    { background: rgba(6,182,212,0.15); }
body.dark .stat-card.purple::before  { background: rgba(139,92,246,0.15); }
body.dark .stat-card.red::before     { background: rgba(220,38,38,0.15); }

.stat-label {
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.stat-value i { font-size: 20px; opacity: 0.5; }

.stat-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.dashboard-summary-note {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

.table-row-highlight {
  background: rgba(41,121,255,0.08);
}

/* ── Filter Section (reports) ───────────────────────────── */
.filter-section {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.filter-row {
  display: flex;
  gap: 15px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-group { flex: 1; min-width: 150px; position: relative; }

.filter-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 13px;
  display: block;
}

.report-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: var(--text);
}

/* ── Chart / widget card ────────────────────────────────── */
.chart-container {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow var(--transition);
  margin-bottom: 20px;
}
.chart-container:hover { box-shadow: var(--shadow-md); }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-weight: 600;
}
.chart-header a,
.chart-header .btn-default {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.2);
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.35);
  transition: var(--transition);
}
.chart-header a:hover,
.chart-header .btn-default:hover { background: rgba(255,255,255,0.35); opacity: 1; }

.chart-body { padding: 20px; flex: 1; }

/* Stats inside chart body */
.chart-body .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.chart-body .stat-row:last-child { border-bottom: none; }
.chart-body .stat-num { font-weight: 600; color: var(--accent); }

/* ── Chart grid ─────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* Legacy dash grid (for admin/index pages) */
.dashboard-grid.auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff !important;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { background: var(--accent-dark); opacity: 1; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-primary { background: var(--accent); }
.btn-default {
  background: var(--surface);
  color: var(--text) !important;
  border: 1px solid var(--border);
}
.btn-default:hover { background: var(--bg); }
.btn-block { display: flex; width: 100%; justify-content: center; }

.btn-ghost {
  background: rgba(255,255,255,0.15);
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: var(--radius-xs);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-ghost:hover { background: rgba(255,255,255,0.28); opacity: 1; }

.btn-info { background: #06b6d4; }
.btn-info:hover { background: #0891b2; }
.btn-success { background: var(--green); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }

/* ── Form controls ──────────────────────────────────────── */
.form-control {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41,121,255,0.15);
}
select.form-control {
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
body.dark select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
}

.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text); font-size: 13px; }

/* ── Tables ─────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
}
.table-striped tbody tr:nth-child(odd) { background: rgba(0,0,0,0.02); }
body.dark .table-striped tbody tr:nth-child(odd) { background: rgba(255,255,255,0.02); }
.table tbody tr:hover { background: var(--accent-light); }
.table-bordered { border: 1px solid var(--border); }
.table-bordered th, .table-bordered td { border: 1px solid var(--border); }

/* ── Panel / Card (Bootstrap compat) ────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-heading {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-weight: 600;
}
.panel-body { padding: 16px; }
.panel-footer {
  padding: 10px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

/* Panel border colour accents */
.panel.borders-blue    { border-left: 4px solid var(--accent); }
.panel.borders-green   { border-left: 4px solid var(--green); }
.panel.borders-orange  { border-left: 4px solid var(--orange); }
.panel.borders-warning { border-left: 4px solid var(--orange); }
.panel.borders-danger  { border-left: 4px solid var(--red); }
.panel.borders-success { border-left: 4px solid var(--green); }
.panel.borders-info    { border-left: 4px solid #06b6d4; }
.panel.borders-purple  { border-left: 4px solid #8b5cf6; }
.panel.borders-maroon  { border-left: 4px solid #800000; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
}
.alert-info    { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.alert-success { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.alert-warning { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.alert-danger  { background: #fce4ec; color: #b91c1c; border-color: #f8b4b4; }
body.dark .alert-info    { background: rgba(41,121,255,0.15); }
body.dark .alert-success { background: rgba(22,163,74,0.15); }
body.dark .alert-warning { background: rgba(234,88,12,0.15); }
body.dark .alert-danger  { background: rgba(220,38,38,0.15); }

/* ── Labels / Badges ────────────────────────────────────── */
.label {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.label-success { background: #dcfce7; color: #15803d; }
.label-danger  { background: #fce4ec; color: #b91c1c; }
.label-info    { background: var(--accent-light); color: var(--accent); }
.label-warning { background: #ffedd5; color: #9a3412; }
.label-default { background: var(--border); color: var(--text-muted); }
body.dark .label-success { background: rgba(22,163,74,0.2); }
body.dark .label-danger  { background: rgba(220,38,38,0.2); }
body.dark .label-info    { background: rgba(41,121,255,0.2); }
body.dark .label-warning { background: rgba(234,88,12,0.2); }
body.dark .label-default { background: var(--border); }

/* ── Utility classes ────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }
.text-muted  { color: var(--text-muted); }
.text-green,
.text-success { color: var(--green) !important; }
.text-red,
.text-danger  { color: var(--red) !important; }
.text-blue,
.text-primary { color: var(--accent) !important; }
.text-orange,
.text-warning { color: var(--orange) !important; }
.text-info    { color: #06b6d4 !important; }
.text-white   { color: #fff !important; }
.text-size-20 { font-size: 20px !important; }

.bg-white    { background: #fff; }
.bg-transparent { background: transparent; }
.bg-success  { background: var(--green)  !important; }
.bg-primary  { background: var(--accent) !important; }
.bg-warning  { background: var(--orange) !important; }
.bg-danger   { background: var(--red)    !important; }
.bg-info     { background: #06b6d4       !important; }
.bg-blue     { background: var(--accent) !important; }

.pad-0    { padding: 0 !important; }
.pad-10   { padding: 10px !important; }
.pad-v-10 { padding-top: 10px !important; padding-bottom: 10px !important; }
.pad-h-10 { padding-left: 10px !important; padding-right: 10px !important; }
.padding-10 { padding: 10px; }
.padding-15 { padding: 15px; }

.margin-0    { margin: 0 !important; }
.margin-t-10 { margin-top: 10px; }
.margin-t-20 { margin-top: 20px; }
.margin-b-5  { margin-bottom: 5px; }
.margin-v-10 { margin-top: 10px; margin-bottom: 10px; }
.margin-v-5  { margin-top: 5px; margin-bottom: 5px; }

.bold   { font-weight: 700; }
.font-lg { font-size: 24px; }

.border-0 { border: none !important; }

/* ── Login page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.7)),
    url("../img/bg-login.jpg") center/cover no-repeat;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding-bottom: 350px;
}
.login-card .login-brand {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 32px;
}
.login-card .login-brand .fa { color: var(--accent); margin-right: 10px; }
.login-card .login-body { padding: 0; }
.login-card .login-body label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
}
.login-card .login-body .form-control {
  display: block;
  width: 100%;
  padding: 18px 18px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.login-card .login-body .form-control:focus {
  border-color: var(--accent);
}
.login-card .login-body .form-group { margin-bottom: 18px; }
.login-card .login-body .btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: #132a50;
  cursor: pointer;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}
.login-card .login-body .btn:hover { background: var(--accent-dark); }
.login-card .login-body .alert {
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 8px;
  font-size: 13px;
  background: rgba(220,38,38,0.15);
  border: 1px solid rgba(220,38,38,0.3);
  color: #fca5a5;
}

/* ── DataTables overrides ───────────────────────────────── */
.dt-buttons { margin: 10px 0; display: flex; gap: 4px; flex-wrap: wrap; }
.dt-buttons .dt-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.dt-buttons .dt-button:hover { background: var(--accent-light); border-color: var(--accent); }
body.dark .dt-buttons .dt-button { background: var(--surface); color: var(--text); border-color: var(--border); }
body.dark .dt-buttons .dt-button:hover { background: rgba(41,121,255,0.15); }

/* DataTables dark mode */
body.dark table.dataTable { color: var(--text); }
body.dark table.dataTable thead th { background: var(--surface); color: var(--text-muted); border-color: var(--border); }
body.dark table.dataTable tbody td { border-color: var(--border); }
body.dark table.dataTable tbody tr:hover { background: rgba(41,121,255,0.1); }
body.dark table.dataTable.no-footer { border-color: var(--border); }
body.dark .dataTables_wrapper .dataTables_filter input { background: var(--surface); color: var(--text); border-color: var(--border); }
body.dark .dataTables_wrapper .dataTables_length select { background: var(--surface); color: var(--text); border-color: var(--border); }
body.dark .dataTables_wrapper .dataTables_info,
body.dark .dataTables_wrapper .dataTables_paginate { color: var(--text-muted); }
body.dark .dataTables_wrapper .dataTables_paginate .paginate_button { color: var(--text-muted) !important; border-color: var(--border); }
body.dark .dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--accent); color: #fff !important; border-color: var(--accent); }
body.dark .dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--accent-light); }

/* ── Datetime picker dark ───────────────────────────────── */
body.dark .bootstrap-datetimepicker-widget { background: var(--surface); color: var(--text); border-color: var(--border); }
body.dark .bootstrap-datetimepicker-widget table th,
body.dark .bootstrap-datetimepicker-widget table td { color: var(--text); }
body.dark .bootstrap-datetimepicker-widget table td.day:hover,
body.dark .bootstrap-datetimepicker-widget table td.hour:hover,
body.dark .bootstrap-datetimepicker-widget table td.minute:hover { background: var(--accent-light); }
body.dark .bootstrap-datetimepicker-widget table td.active,
body.dark .bootstrap-datetimepicker-widget table td.active:hover { background: var(--accent); color: #fff; }
body.dark .bootstrap-datetimepicker-widget table td.old,
body.dark .bootstrap-datetimepicker-widget table td.new { color: var(--text-muted); }

/* ── Chart body overrides (Bootstrap panels inside chart-body) ── */
.chart-body .panel {
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--surface);
}
.chart-body .panel-body { padding: 10px 14px; font-size: 13px; }
.chart-body .panel-body.bg-success { background: var(--green) !important; color: #fff; }
.chart-body .panel-body.bg-primary { background: var(--accent) !important; color: #fff; }
.chart-body .panel-body.bg-info    { background: #06b6d4 !important; color: #fff; }
.chart-body .panel-body.bg-warning { background: var(--orange) !important; color: #fff; }
.chart-body .panel-body.bg-danger  { background: var(--red) !important; color: #fff; }
.chart-body .panel-body.bg-orange  { background: var(--orange) !important; color: #fff; }
.chart-body .panel-body.text-size-20 { font-size: 18px; font-weight: 700; }

.chart-body .panel-body.text-success { color: var(--green) !important; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding-top: 6px; padding-bottom: 6px; }
.chart-body .panel-body.text-primary { color: var(--accent) !important; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding-top: 6px; padding-bottom: 6px; }
.chart-body .panel-body.text-info    { color: #06b6d4 !important; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding-top: 6px; padding-bottom: 6px; }
.chart-body .panel-body.text-warning { color: var(--orange) !important; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding-top: 6px; padding-bottom: 6px; }
.chart-body .panel-body.text-danger  { color: var(--red) !important; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding-top: 6px; padding-bottom: 6px; }
.chart-body .panel-body.pad-v-10 { padding-top: 10px !important; padding-bottom: 10px !important; }

.chart-body .row::after,
.chart-body .row::before { display: table; content: ''; }
.chart-body .row::after { clear: both; }

/* ── 5-col Bootstrap legacy ─────────────────────────────── */
.col-lg-2-4 { width: 20%; float: left; }
@media (max-width: 991px) { .col-lg-2-4 { width: 50%; } }
@media (max-width: 767px) { .col-lg-2-4 { width: 100%; } }

/* ── Responsive sidebar ──────────────────────────────────── */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    flex: 0 0 auto;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .main-content { padding: 16px; }
  .header { padding: 0 12px; }
  .header .logo img { height: 28px; }
}

/* ── Dropdown (Bootstrap compat) ────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-toggle { cursor: pointer; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1001;
  display: none;
  min-width: 180px;
  padding: 6px 0;
  margin: 4px 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu li a {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  font-size: 13px;
  transition: var(--transition);
}
.dropdown-menu li a:hover { background: var(--accent-light); color: var(--accent); }
.dropdown-menu .divider { height: 1px; margin: 6px 0; background: var(--border); }
.dropdown-menu-right { right: 0; left: auto; }

/* ── Misc ────────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
small { font-size: 12px; color: var(--text-muted); }

/* ── Grid item (report pages) ────────────────────────────── */
.grid-item { display: flex; flex-direction: column; }
.grid-item-content { flex: 1; display: flex; flex-direction: column; height: 100%; }
.grid-item .panel { display: flex; flex-direction: column; height: 100%; margin-bottom: 0; }
.grid-item .panel-body { flex: 1; }

/* ── Missing border/text/bg utility classes ──────────────── */
.border-blue   { border-color: var(--accent) !important; }
.border-green  { border-color: var(--green) !important; }
.borders-yellow { border-left: 4px solid #eab308 !important; }
.borders-red   { border-left: 4px solid var(--red) !important; }
.bg-maroon { background: #800000 !important; }
.bg-purple { background: #8b5cf6 !important; }
.bg-red    { background: var(--red) !important; }
.text-maroon { color: #800000 !important; }
.text-purple { color: #8b5cf6 !important; }
.text-yellow { color: #eab308 !important; }
