:root {
  --sidebar-w: 240px;
  --navy: #10265c;
  --navy-dark: #0b1c47;
  --accent: #2f6fed;
}

/* ---------- Sidebar group headers (new grouped menu) ---------- */
.sidebar .nav-group-title {
  padding: 16px 18px 6px;
  font-size: .68rem;
  letter-spacing: .06em;
  color: #7a86b8;
  font-weight: 700;
  text-transform: uppercase;
}
.sidebar .brand img.logo-img {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}
.sidebar .brand .brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar .brand .brand-text small { font-size: .55rem; letter-spacing: .04em; color: #8fa0d6; font-weight: 500; }
.sidebar .nav-link.sub { padding-left: 40px; font-size: .87rem; }

/* ---------- New topbar (matches reference UI) ---------- */
.topbar .datetime-box {
  display: flex; align-items: center; gap: 8px;
  font-size: .8rem; color: #566;
  background: #f5f6fa; border-radius: 8px; padding: 6px 12px;
}
.topbar .bell-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #f5f6fa;
  display: flex; align-items: center; justify-content: center;
  color: #566; border: none;
}
.topbar .bell-btn .badge-dot {
  position: absolute; top: -2px; right: -2px;
  background: #ef4444; color: #fff;
  font-size: .62rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.topbar .user-box { display: flex; align-items: center; gap: 10px; }
.topbar .user-box img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.topbar .user-box .name { font-weight: 600; font-size: .85rem; color: #1c2340; }
.topbar .user-box .role { font-size: .72rem; color: #8a92ab; }

/* ---------- Filter panel ---------- */
.filter-panel { background: #fff; border-radius: 14px; padding: 20px 22px; box-shadow: 0 1px 3px rgba(20,25,50,.06); }
.filter-panel label.small-label { font-size: .78rem; color: #566; font-weight: 500; margin-bottom: 4px; display: block; }
.form-check-label { font-size: .85rem; color: #333; }

/* ---------- Stat cards (top of history page) ---------- */
.mini-stat { background: #fff; border-radius: 14px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; box-shadow: 0 1px 3px rgba(20,25,50,.06); height: 100%; }
.mini-stat .mini-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: #fff; flex-shrink: 0; }
.mini-stat .mini-value { font-size: 1.3rem; font-weight: 700; color: #1c2340; }
.mini-stat .mini-label { font-size: .78rem; color: #8a92ab; }

/* ---------- History table ---------- */
.history-table-wrap { background: #fff; border-radius: 14px; padding: 4px 0 12px; box-shadow: 0 1px 3px rgba(20,25,50,.06); overflow: hidden; }
.history-table-wrap table { margin-bottom: 0; }
.history-table-wrap thead th { background: #fbfbfd; border-bottom: 1px solid #eef0f6; padding: 12px 14px; }
.history-table-wrap tbody td { padding: 12px 14px; border-bottom: 1px solid #f3f4f8; }
.history-table-wrap tbody tr:hover { background: #f7f9fe; }
.history-table-wrap tbody tr.selected-row { background: #eef4ff; }

.ticket-pill { font-size: .74rem; font-weight: 600; padding: 4px 12px; border-radius: 20px; display: inline-block; }
.ticket-pill.luot { background: #e4f8ec; color: #1aa25a; }
.ticket-pill.thuebao { background: #e5f0ff; color: #2f6fed; }

.vehicle-icon { width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: #eef1fa; color: #2f6fed; margin-right: 6px; font-size: .85rem; }

.pager-controls .btn { min-width: 38px; }

/* ---------- Camera side panel ---------- */
.camera-panel { display: flex; flex-direction: column; gap: 14px; }
.camera-card { border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(20,25,50,.08); background: #fff; }
.camera-card .cam-header {
  padding: 8px 12px; font-size: .8rem; font-weight: 600; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.camera-card.cam-in .cam-header { background: #2f6fed; }
.camera-card.cam-out .cam-header { background: #e0435a; }
.camera-card .cam-img-wrap { position: relative; }
.camera-card img { width: 100%; height: 150px; object-fit: cover; display: block; }
.camera-card .cam-time {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
  color: #fff; font-size: .72rem; padding: 16px 10px 6px;
}
.cam-placeholder {
  height: 150px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1c2b52 0%, #2f4380 100%);
  color: #fff; font-size: 1.4rem; font-weight: 700; letter-spacing: .05em;
  font-family: 'Courier New', monospace;
}
.cam-placeholder.wide {
  font-size: 2.4rem; color: rgba(255,255,255,.5);
  background: linear-gradient(135deg, #232f4d 0%, #3a4a75 100%);
}

body {
  background: #f3f5f9;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  color: #cdd6ee;
  overflow-y: auto;
  z-index: 1030;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand .logo-dot {
  width: 34px; height: 34px;
  background: #22c07b;
  border-radius: 8px;
  display:flex; align-items:center; justify-content:center;
  font-size: 1rem;
}
.sidebar .nav-link {
  color: #b9c4e6;
  padding: 10px 18px;
  font-size: .92rem;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .nav-link i { width: 18px; text-align:center; }
.sidebar .nav-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.sidebar .nav-link.active {
  background: rgba(47,111,237,.18);
  color: #fff;
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar .support-box {
  margin: 14px;
  padding: 14px;
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  font-size: .8rem;
}

/* ---------- Layout ---------- */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid #e7e9f0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.topbar h5 { margin: 0; font-weight: 700; color: #1c2340; }
.page-body { padding: 22px 24px 40px; }

/* ---------- Cards ---------- */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(20,25,50,.06);
  display: flex;
  gap: 14px;
  align-items: center;
  height: 100%;
}
.stat-card .icon-box {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: #1c2340; }
.stat-card .stat-label { color: #7a8199; font-size: .85rem; }

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(20,25,50,.06);
}
.panel h6 { font-weight: 700; color: #1c2340; }

.table thead th {
  background: #f7f8fc;
  font-size: .8rem;
  color: #7a8199;
  font-weight: 600;
  border-bottom: none;
  white-space: nowrap;
}
.table td { vertical-align: middle; font-size: .88rem; }

.badge-status-in { background: #e7f7ee; color: #1aa25a; }
.badge-status-out { background: #eef1fa; color: #5568c9; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1c3a8a 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
}
