:root {
  --primary: #1a6fa8;
  --primary-dark: #0d4f7a;
  --primary-light: #3d9fd4;
  --accent: #f4a825;
  --bg: #f0f4f8;
  --sidebar-bg: #0a3352;
  --card: #ffffff;
  --text: #1a2332;
  --text-muted: #6b7a8d;
  --border: #dde4ed;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --shadow: 0 2px 12px rgba(10,51,82,0.08);
  --shadow-lg: 0 8px 32px rgba(10,51,82,0.15);
  --radius: 14px;
  --sidebar-w: 265px;
}

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

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ── APP LAYOUT ── */
#app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; right: 0; bottom: 0;
  z-index: 200;
  box-shadow: -4px 0 24px rgba(0,0,0,0.2);
  overflow: hidden;
}

.sidebar-header {
  padding: 22px 18px 18px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.sidebar-brand { color: #fff; font-size: 17px; font-weight: 800; }
.sidebar-sub   { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 2px; }

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 10px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

.nav-section-title {
  padding: 14px 18px 5px;
  font-size: 9px; font-weight: 800; letter-spacing: 2px;
  color: rgba(255,255,255,0.3); text-transform: uppercase;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 18px; margin: 1px 10px;
  border-radius: 10px;
  color: rgba(255,255,255,0.65);
  font-size: 13.5px; font-weight: 500;
  transition: all 0.18s;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 3px 12px rgba(26,111,168,0.45); }
.nav-icon { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-right: auto; background: var(--accent); color: #fff;
  border-radius: 20px; padding: 1px 7px; font-size: 10px; font-weight: 800;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.user-block {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: rgba(255,255,255,0.06);
  border-radius: 12px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.user-name { color: #fff; font-size: 13px; font-weight: 700; }
.user-role { color: var(--accent); font-size: 10px; }
.logout-btn { margin-right: auto; color: rgba(255,255,255,0.4); font-size: 18px; transition: color 0.2s; }
.logout-btn:hover { color: var(--danger); }

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

/* ── TOPBAR ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(240,244,248,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 26px;
  height: 62px;
  display: flex; align-items: center; gap: 14px;
}
.menu-toggle {
  display: none; background: none; border: none;
  font-size: 22px; cursor: pointer; color: var(--text);
}
.page-title { font-size: 17px; font-weight: 800; color: var(--text); }
.page-sub   { font-size: 11px; color: var(--text-muted); }
.topbar-right { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(39,174,96,0.25);
}

/* ── CONTENT ── */
.content-area { padding: 26px; flex: 1; }

/* ── CARDS ── */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* ── STATS ── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 15px; margin-bottom: 24px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  display: flex; align-items: flex-start; gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s; cursor: pointer;
  text-decoration: none; color: inherit;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.si-blue   { background: #e8f4fd; }
.si-orange { background: #fff4e0; }
.si-green  { background: #e8f8f0; }
.si-purple { background: #f0eeff; }
.stat-num  { font-size: 28px; font-weight: 900; line-height: 1; }
.stat-lbl  { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 600; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 11px 15px; text-align: right;
  background: #f7fafc; color: var(--text-muted);
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.5px;
  text-transform: uppercase; border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 13px 15px; border-bottom: 1px solid #f0f3f7;
  vertical-align: middle;
}
tbody tr:hover { background: #f8fbff; }
tbody tr:last-child td { border-bottom: none; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.badge::before { content: '●'; font-size: 7px; }
.badge-pending  { background: #fff4e0; color: #c07800; }
.badge-approved { background: #e8f8f0; color: #1e8449; }
.badge-rejected { background: #fef0ef; color: #c0392b; }
.badge-active   { background: #e8f4fd; color: #1a6fa8; }
.badge-inactive { background: #f5f5f5; color: #888; }
.badge-completed{ background: #e8f8f0; color: #1e8449; }
.badge-cancelled{ background: #fef0ef; color: #c0392b; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border: none; border-radius: 10px;
  font-family: 'Cairo', sans-serif; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all 0.18s; text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; box-shadow: 0 3px 12px rgba(26,111,168,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(26,111,168,0.4); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline {
  background: transparent; border: 2px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 4px 9px; font-size: 11px; border-radius: 7px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12.5px; font-weight: 700;
  color: var(--text); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  border: 2px solid var(--border); border-radius: 10px;
  font-family: 'Cairo', sans-serif; font-size: 13px; color: var(--text);
  background: #f8fafc; outline: none; transition: all 0.2s;
}
.form-control:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(26,111,168,0.1); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-full { grid-column: 1 / -1; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center;
}
.search-wrap { flex: 1; min-width: 180px; position: relative; }
.search-wrap input {
  width: 100%; padding: 9px 15px 9px 36px;
  border: 2px solid var(--border); border-radius: 10px;
  font-family: 'Cairo', sans-serif; font-size: 13px; background: #fff; outline: none;
  transition: border-color 0.2s;
}
.search-wrap input:focus { border-color: var(--primary); }
.search-wrap::before {
  content: '🔍'; position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); font-size: 13px; pointer-events: none;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,51,82,0.5);
  backdrop-filter: blur(4px); z-index: 400;
  display: none;
}
.modal-wrap {
  position: fixed; z-index: 500;
  top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.95);
  width: 90%; max-width: 520px;
  background: #fff; border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  display: none; flex-direction: column;
  max-height: 90vh; overflow: hidden;
}
.modal-overlay.open, .modal-wrap.open {
  display: flex;
}
.modal-wrap.open { transform: translate(-50%, -50%) scale(1); transition: transform 0.25s cubic-bezier(0.16,1,0.3,1); }
.modal-header {
  padding: 18px 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 800; }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,0.25); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0;
}

/* ── LOADING / EMPTY ── */
.loading {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 50px; flex-direction: column;
  color: var(--text-muted); font-size: 13px;
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty {
  text-align: center; padding: 55px 20px; color: var(--text-muted);
}
.empty-icon { font-size: 44px; opacity: 0.35; margin-bottom: 10px; }
.empty h3 { font-size: 14px; font-weight: 700; color: var(--text); }
.empty p  { font-size: 12px; margin-top: 4px; }

/* ── TOAST ── */
#toastContainer {
  position: fixed; bottom: 22px; left: 22px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 700; color: #fff;
  box-shadow: 0 6px 22px rgba(0,0,0,0.2);
  min-width: 230px; animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--primary); }

/* ── UTILS ── */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-gap    { display: flex; align-items: center; gap: 8px; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 18px; }
.mb-2 { margin-bottom: 10px; }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 12px; }
.fw-bold    { font-weight: 800; }
.divider    { height: 1px; background: var(--border); margin: 14px 0; }
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.img-thumb {
  width: 52px; height: 52px; border-radius: 10px;
  object-fit: cover; border: 2px solid var(--border);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ── PROVIDER CARD ── */
.provider-card {
  background: #fff; border-radius: 14px; padding: 18px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.provider-card:hover { box-shadow: var(--shadow-lg); }

/* ── CHART BARS ── */
.chart-wrap { height: 180px; display: flex; align-items: flex-end; gap: 7px; padding: 10px 0 0; }
.chart-bar {
  flex: 1; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--primary-light), var(--primary-dark));
  min-height: 10px; cursor: pointer; position: relative; transition: opacity 0.2s;
}
.chart-bar:hover { opacity: 0.75; }
.chart-bar.accent { background: linear-gradient(180deg, #ffc85a, var(--accent)); }
.chart-label {
  font-size: 9px; color: var(--text-muted); text-align: center; margin-top: 4px;
}

/* ── LOGIN ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0a3352 0%, #1a6fa8 55%, #0d4f7a 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 24px; padding: 44px 40px;
  width: 100%; max-width: 400px;
  box-shadow: 0 28px 70px rgba(0,0,0,0.28);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h2 { font-size: 12px; font-weight: 800; letter-spacing: 3px; color: var(--text-muted); margin-top: 10px; text-transform: uppercase; }
.login-title { font-size: 20px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.login-sub   { font-size: 12.5px; color: var(--text-muted); text-align: center; margin-bottom: 26px; }
.login-btn {
  width: 100%; padding: 14px; border: none; border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-family: 'Cairo', sans-serif; font-size: 15px; font-weight: 800;
  cursor: pointer; transition: all 0.25s;
  box-shadow: 0 5px 18px rgba(26,111,168,0.38);
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 9px 26px rgba(26,111,168,0.48); }
.alert { padding: 11px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-top: 14px; }
.alert-error   { background: #fff0f0; color: var(--danger);  border: 1px solid #ffcccc; }
.alert-success { background: #f0fff4; color: var(--success); border: 1px solid #c3f0d6; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(100%);
    transition: transform 0.28s ease;
    width: 265px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-right: 0; }
  .menu-toggle { display: block; }
  .grid-2, .grid-3, .stats-grid { grid-template-columns: 1fr; }
}
