/* ===========================
   CSS VARIABLES – LIGHT MODE
   =========================== */
:root {
  --sidebar-bg: #1e293b;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(59, 130, 246, 0.18);
  --sidebar-active-border: #3b82f6;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #cbd5e1;
  --sidebar-text-active: #ffffff;
  --sidebar-icon: #64748b;
  --sidebar-icon-active: #3b82f6;
  --sidebar-divider: rgba(255, 255, 255, 0.06);
  --sidebar-width: 260px;

  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f8fafc;
  --bg-table-head: #f8fafc;
  --bg-stripe: #fafbfc;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-label: #64748b;

  --border: #e2e8f0;
  --border-input: #cbd5e1;
  --border-focus: #3b82f6;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 24px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;
  --accent-text: #1d4ed8;

  --success: #10b981;
  --success-light: #ecfdf5;
  --success-text: #065f46;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-text: #92400e;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-text: #991b1b;
  --info: #06b6d4;
  --info-light: #ecfeff;
  --info-text: #155e75;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --purple-text: #5b21b6;

  --topbar-bg: #ffffff;
  --topbar-border: #e2e8f0;
  --topbar-height: 64px;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --tr: all 0.2s ease;
  --tr-slow: all 0.35s ease;
}

/* ===========================
   CSS VARIABLES – DARK MODE
   =========================== */
[data-theme="dark"] {
  --sidebar-bg: #0d1117;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-active-bg: rgba(59, 130, 246, 0.2);
  --sidebar-text: #6b7280;
  --sidebar-text-hover: #9ca3af;
  --sidebar-text-active: #f9fafb;
  --sidebar-icon: #4b5563;
  --sidebar-icon-active: #60a5fa;
  --sidebar-divider: rgba(255, 255, 255, 0.05);

  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #1e293b;
  --bg-hover: #263348;
  --bg-table-head: #162032;
  --bg-stripe: #1a2540;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-label: #94a3b8;

  --border: #334155;
  --border-input: #334155;
  --border-focus: #60a5fa;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.5);
  --shadow-lg: 0 10px 24px rgba(0,0,0,0.6);

  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-light: rgba(59, 130, 246, 0.12);
  --accent-text: #93c5fd;

  --success-light: rgba(16, 185, 129, 0.12);
  --success-text: #34d399;
  --warning-light: rgba(245, 158, 11, 0.12);
  --warning-text: #fbbf24;
  --danger-light: rgba(239, 68, 68, 0.12);
  --danger-text: #f87171;
  --info-light: rgba(6, 182, 212, 0.12);
  --info-text: #22d3ee;
  --purple-light: rgba(139, 92, 246, 0.12);
  --purple-text: #a78bfa;

  --topbar-bg: #1e293b;
  --topbar-border: #334155;
}

/* ===========================
   RESET & BASE
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Sarabun', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-main);
  transition: background var(--tr-slow), color var(--tr-slow);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

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

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: background var(--tr-slow);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sidebar-divider);
}

.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--sidebar-text);
  letter-spacing: 0.03em;
}

/* Nav scroll area */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-text);
  padding: 12px 20px 4px;
  opacity: 0.6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: var(--tr);
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-hover);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  border-left-color: var(--sidebar-active-border);
  color: var(--sidebar-text-active);
  font-weight: 500;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--sidebar-icon);
  flex-shrink: 0;
  transition: color var(--tr);
}

.nav-item:hover i { color: var(--sidebar-text-hover); }
.nav-item.active i { color: var(--sidebar-icon-active); }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--sidebar-divider);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--sidebar-text);
  line-height: 1.2;
}

/* Theme toggle button */
.theme-toggle {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--sidebar-hover);
  border: 1px solid var(--sidebar-divider);
  color: var(--sidebar-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: var(--tr);
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: #f1f5f9;
}

/* ===========================
   MAIN AREA
   =========================== */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin var(--tr-slow);
}

/* ===========================
   TOPBAR
   =========================== */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 50;
  transition: background var(--tr-slow), border-color var(--tr-slow);
}

.topbar-title {
  flex: 1;
}

.topbar-title h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.topbar-breadcrumb {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.topbar-breadcrumb span { color: var(--accent); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  width: 220px;
  transition: var(--tr);
}

.topbar-search i { color: var(--text-muted); font-size: 0.85rem; }

.topbar-search input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  font-size: 0.85rem;
  width: 100%;
}

.topbar-search input::placeholder { color: var(--text-muted); }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  position: relative;
  transition: var(--tr);
}

.icon-btn:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent); }

.badge-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--topbar-bg);
}

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: var(--tr);
}

.topbar-avatar:hover { border-color: var(--accent); }

/* ===========================
   PAGE CONTENT
   =========================== */
.content {
  flex: 1;
  padding: 28px;
}

.page { display: none; animation: fadeIn 0.25s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: var(--tr);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--bg-hover); border-color: var(--border-input); }

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger-light);
  background: var(--danger-light);
}
.btn-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: var(--tr);
}

.btn-icon:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* ===========================
   STAT CARDS
   =========================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow var(--tr), transform var(--tr);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: var(--accent-light); color: var(--accent); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.cyan   { background: var(--info-light); color: var(--info); }

.stat-body { flex: 1; min-width: 0; }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-change {
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
}

.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===========================
   CARDS
   =========================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: background var(--tr-slow), border-color var(--tr-slow);
}

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

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i { color: var(--accent); }

.card-body { padding: 20px 22px; }
.card-body-flush { padding: 0; }

/* ===========================
   TABLES
   =========================== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--bg-table-head);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-label);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

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

tbody td {
  padding: 13px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

td.td-bold { color: var(--text-primary); font-weight: 600; }
td.td-num  { font-family: 'Courier New', monospace; font-size: 0.85rem; }

/* ===========================
   BADGES / STATUS
   =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-success { background: var(--success-light); color: var(--success-text); }
.badge-warning { background: var(--warning-light); color: var(--warning-text); }
.badge-danger  { background: var(--danger-light);  color: var(--danger-text);  }
.badge-info    { background: var(--info-light);    color: var(--info-text);    }
.badge-accent  { background: var(--accent-light);  color: var(--accent-text);  }
.badge-purple  { background: var(--purple-light);  color: var(--purple-text);  }
.badge-muted   { background: var(--bg-hover);      color: var(--text-muted);   }

/* ===========================
   FORMS
   =========================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-label);
}

label .req { color: var(--danger); }

.input, select.input, textarea.input {
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: var(--tr);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.input:focus, select.input:focus, textarea.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.input::placeholder { color: var(--text-muted); }

select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.input { resize: vertical; min-height: 90px; }

.form-hint { font-size: 0.77rem; color: var(--text-muted); }

.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 36px; }
.input-icon-wrap .i-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

/* ===========================
   FILTER BAR
   =========================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.filter-tab {
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: var(--tr);
}

.filter-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.search-input-wrap {
  position: relative;
  margin-left: auto;
}

.search-input-wrap i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-input-wrap .input {
  padding-left: 36px;
  width: 220px;
}

/* ===========================
   CALENDAR
   =========================== */
.calendar-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 22px;
  align-items: start;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.cal-month-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cal-nav-btns { display: flex; gap: 6px; }

.cal-view-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.cal-view-tab {
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: var(--tr);
}

.cal-view-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day-hdr {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 8px 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-day-hdr.weekend { color: var(--danger); }

.cal-cell {
  min-height: 80px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px;
  cursor: pointer;
  background: var(--bg-card);
  transition: var(--tr);
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.cal-cell:hover { border-color: var(--accent); background: var(--accent-light); }
.cal-cell.other-month { background: var(--bg-main); opacity: 0.5; }
.cal-cell.weekend .cal-date-num { color: var(--danger); }

.cal-cell.today {
  border-color: var(--accent);
  background: var(--accent-light);
}

.cal-cell.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.cal-date-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
}

.cal-cell.today .cal-date-num {
  background: var(--accent);
  color: white;
}

.cal-event {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.cal-event.approved { background: var(--success-light); color: var(--success-text); }
.cal-event.pending  { background: var(--warning-light); color: var(--warning-text); }
.cal-event.using    { background: var(--accent-light);  color: var(--accent-text);  }
.cal-event.done     { background: var(--bg-hover);      color: var(--text-muted);   }

/* Calendar Side Panel */
.cal-side {
  position: sticky;
  top: calc(var(--topbar-height) + 28px);
}

.cal-side-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 500;
}

.cal-side-date span {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-top: 2px;
}

.cal-booking-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  transition: var(--tr);
  background: var(--bg-card);
}

.cal-booking-item:hover { border-color: var(--accent); }

.cal-booking-car {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cal-booking-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-booking-meta i { color: var(--accent); width: 14px; }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.cal-legend-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
}

/* ===========================
   CAR GRID
   =========================== */
.cars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.car-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--tr), box-shadow var(--tr);
}

.car-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.car-img {
  height: 130px;
  background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .car-img { background: linear-gradient(135deg, #263348, #1e293b); }

.car-status-badge {
  position: absolute;
  top: 10px; right: 10px;
}

.car-body { padding: 14px 16px; }

.car-plate {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--bg-main);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: inline-block;
  margin-bottom: 6px;
}

.car-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.car-type {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.car-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  gap: 6px;
}

/* ===========================
   DASHBOARD CHARTS
   =========================== */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 0 4px;
}

.bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  background: var(--accent-light);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: height 0.5s ease;
  border-top: 2px solid var(--accent);
  max-width: 32px;
}

[data-theme="dark"] .bar { background: var(--accent-light); }

.bar-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 0;
}

.donut-chart {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: conic-gradient(
    var(--success) 0deg 126deg,
    var(--accent)  126deg 198deg,
    var(--warning) 198deg 252deg,
    var(--danger)  252deg 360deg
  );
  position: relative;
  flex-shrink: 0;
}

.donut-chart::after {
  content: '';
  width: 60px; height: 60px;
  background: var(--bg-card);
  border-radius: 50%;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-val { margin-left: auto; font-weight: 700; color: var(--text-primary); }

/* ===========================
   ACTIVITY FEED
   =========================== */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.activity-body { flex: 1; min-width: 0; }

.activity-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.activity-text strong { font-weight: 600; }

.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===========================
   REPORTS PAGE
   =========================== */
.report-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.report-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
}

.report-stat-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.report-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.bar-chart-full {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 160px;
  padding: 0 4px;
}

.bar-full-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar-full {
  width: 100%;
  background: linear-gradient(180deg, var(--accent) 0%, rgba(59,130,246,0.5) 100%);
  border-radius: 5px 5px 0 0;
  max-width: 44px;
  position: relative;
}

.bar-full-val {
  position: absolute;
  top: -20px;
  width: 100%;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
}

.bar-full-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===========================
   SETTINGS PAGE
   =========================== */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 22px;
  align-items: start;
}

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

.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: var(--tr);
  border-bottom: 1px solid var(--border);
}

.settings-menu-item:last-child { border-bottom: none; }
.settings-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-menu-item.active { background: var(--accent-light); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.settings-menu-item i { width: 16px; text-align: center; }

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

.settings-section-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.settings-section-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-section-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-body { padding: 22px; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.toggle-row:last-child { border-bottom: none; }

.toggle-info { flex: 1; }
.toggle-label { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.toggle-desc  { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.toggle-switch {
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background var(--tr);
  flex-shrink: 0;
  border: none;
}

.toggle-switch.on { background: var(--accent); }

.toggle-switch::after {
  content: '';
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
  transition: transform var(--tr);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.on::after { transform: translateX(20px); }

/* ===========================
   USERS TABLE
   =========================== */
.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.td-user { display: flex; align-items: center; gap: 10px; }
.td-user-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.td-user-email { font-size: 0.77rem; color: var(--text-muted); }

/* ===========================
   EMPTY STATE
   =========================== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 0.85rem; }

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tr);
  backdrop-filter: blur(2px);
}

.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--tr);
}

.modal-overlay.show .modal { transform: scale(1) translateY(0); }

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

.modal-header h3 { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: var(--tr);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ===========================
   UTILITIES
   =========================== */
.flex      { display: flex; }
.flex-col  { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 24px; }
.text-sm  { font-size: 0.85rem; }
.text-xs  { font-size: 0.78rem; }
.text-muted { color: var(--text-muted); }
.text-bold  { font-weight: 700; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
