/* ============================================================
   GasNote — "Cyber Indigo" Design System
   靛蓝科技色 · 侧边栏布局 · 现代专业风格
   ============================================================ */

:root {
  --bg: #F8FAFC;
  --bg-warm: #F1F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-glow: rgba(79, 70, 229, 0.18);
  --accent-light: #EEF2FF;
  --accent-active-bg: #E0E7FF;
  --success: #10B981;
  --success-light: #ECFDF5;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --info: #3B82F6;
  --info-light: #EFF6FF;
  --text: #1A1D28;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --border: #E8EAEF;
  --border-2: #D1D5DB;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(0, 0, 0, 0.04);
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 64px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

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

input, select, textarea, button { font-family: inherit; font-size: inherit; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ---- Sidebar (Admin) ---- */
.app-layout { display: flex; min-height: 100dvh; }

.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 0.3s ease, transform 0.3s ease;
  box-shadow: var(--shadow-sm);
}

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

.sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #4338CA);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; flex-shrink: 0;
}

.sidebar-brand h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.sidebar-brand span {
  font-size: 11px;
  color: var(--text-3);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #8B95A5;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 12px 8px;
  margin-top: 4px;
}

/* 侧边栏账户区段（独立于导航菜单） */
.sidebar-account {
  padding: 8px 12px 4px;
  border-top: 1px solid var(--border);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item.active {
  background: var(--accent-active-bg);
  color: var(--accent);
  font-weight: 600;
}

.nav-item i { width: 20px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-warm);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #4338CA);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0;
}

.user-badge .info { flex: 1; min-width: 0; }
.user-badge .name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.user-badge .role { font-size: 11px; color: var(--text-3); }

/* ---- Sidebar Overlay (Mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  z-index: 99;
}

/* ---- 侧边栏折叠状态（桌面端） ---- */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
  min-width: 0;
  overflow: visible;
}

.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 24px 8px;
}

.sidebar.collapsed .sidebar-brand .brand-icon,
.sidebar.collapsed .sidebar-brand > div { display: none; }

.sidebar.collapsed .sidebar-toggle-btn {
  margin-left: 0;
}

.sidebar.collapsed .nav-section-title {
  text-align: center;
  font-size: 0;
  padding: 8px 4px;
  margin-top: 4px;
}

.sidebar.collapsed .nav-section-title::after {
  content: '· · ·';
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-3);
}

.sidebar.collapsed .sidebar-nav {
  overflow: visible;
}

.sidebar.collapsed .sidebar-account .nav-section-title {
  text-align: center;
  font-size: 0;
  padding: 8px 4px;
  margin-top: 4px;
}

.sidebar.collapsed .sidebar-account .nav-section-title::after {
  content: '· · ·';
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-3);
}

.sidebar.collapsed .sidebar-account .nav-item {
  justify-content: center;
  padding: 11px 0;
  gap: 0;
  white-space: nowrap;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 11px 0;
  gap: 0;
  white-space: nowrap;
  position: relative;
}

.sidebar.collapsed .nav-item span { display: none; }

.sidebar.collapsed .nav-item:hover span {
  display: block;
  position: absolute;
  left: calc(var(--sidebar-collapsed-w) - 8px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 120;
  min-width: max-content;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--text);
  color: #fff;
  box-shadow: var(--shadow-md);
  font-size: 13px;
}

.sidebar.collapsed .sidebar-footer { padding: 12px 8px; }

.sidebar.collapsed .user-badge {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .user-badge .info { display: none; }

/* 折叠时主内容区跟随收缩 */
.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed-w);
}

/* 移动端覆盖：768px 以下还原所有折叠样式 */
@media (max-width: 768px) {
  .sidebar.collapsed { width: 260px; }
  .sidebar.collapsed .sidebar-brand .brand-icon,
  .sidebar.collapsed .sidebar-brand > div { display: revert; }
  .sidebar.collapsed .sidebar-brand h2,
  .sidebar.collapsed .sidebar-brand span,
  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .user-badge .info { display: revert; }
  .sidebar.collapsed .sidebar-toggle-btn { margin-left: auto; }
  .sidebar.collapsed .nav-item { justify-content: revert; gap: 12px; padding: 11px 14px; }
  .sidebar.collapsed .user-badge { justify-content: revert; padding: 10px 12px; }
  .sidebar.collapsed .nav-section-title { text-align: revert; font-size: 13px; padding: 12px 12px 8px; }
  .sidebar.collapsed .nav-section-title::after { content: none; }
  .sidebar.collapsed .sidebar-account .nav-section-title { text-align: revert; font-size: 13px; padding: 12px 12px 8px; }
  .sidebar.collapsed .sidebar-account .nav-section-title::after { content: none; }
  .sidebar.collapsed .sidebar-account .nav-item { justify-content: revert; gap: 12px; padding: 11px 14px; }
  .sidebar.collapsed .nav-item:hover span {
    position: static;
    transform: none;
    min-width: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    box-shadow: none;
    font-size: inherit;
  }
  .sidebar.collapsed ~ .main-content { margin-left: 0 !important; }
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: 260px;
  transition: margin-left 0.3s ease;
  min-height: 100dvh;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main-content.no-sidebar { margin-left: 0; }

/* ---- Page Header ---- */
.page-header {
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.page-header .header-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ---- Page Body ---- */
.page-body { padding: 28px 32px; flex: 1; min-width: 0; }

/* ---- User Top Bar (Simple Layout) ---- */
.user-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.user-topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.user-topbar .brand .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.user-topbar .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover { border-color: var(--border-2); }

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

.card-header h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.card-body { padding: 22px; }

/* ---- Stat Cards ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

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

.stat-card .stat-label {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.06;
}

.stat-orange .stat-icon { background: var(--accent-light); color: var(--accent); }
.stat-orange::after { background: var(--accent); }
.stat-orange .stat-value { color: var(--accent); }

.stat-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-green::after { background: var(--success); }
.stat-green .stat-value { color: var(--success); }

.stat-blue .stat-icon { background: var(--info-light); color: var(--info); }
.stat-blue::after { background: var(--info); }
.stat-blue .stat-value { color: var(--info); }

.stat-purple .stat-icon { background: #F5F3FF; color: #8B5CF6; }
.stat-purple::after { background: #8B5CF6; }
.stat-purple .stat-value { color: #8B5CF6; }

/* ---- Dashboard ---- */
.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 24px 26px;
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(circle at top right, rgba(79, 70, 229, 0.16), transparent 34%),
    linear-gradient(135deg, #EEF2FF 0%, var(--surface) 58%, #f8fbff 100%);
  box-shadow: var(--shadow-sm);
}

.dashboard-eyebrow {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
}

.dashboard-hero h2 {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.7px;
  color: var(--text);
}

.dashboard-hero p {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 14px;
}

.dashboard-stat-grid .stat-card { min-height: 150px; }

.stat-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-3);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.dashboard-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-main-chart { grid-column: span 2; }

.dashboard-main-chart .card-body { padding-bottom: 18px; }

.card-subtitle {
  font-size: 12px;
  color: var(--text-3);
}

.chart-wrap-lg { height: 320px; }

.dashboard-list-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.dashboard-list-item strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}

.dashboard-list-item span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

.dashboard-list-item em {
  flex-shrink: 0;
  font-style: normal;
  font-size: 12px;
  color: var(--text-3);
}

.recent-records-scroll,
.dashboard-scroll-list {
  overflow-y: auto;
  max-height: 220px;
  scrollbar-gutter: stable;
}

.recent-record-row {
  display: grid;
  grid-template-columns: 1fr 0.8fr 0.5fr 0.8fr;
  gap: 6px;
  padding: 10px 12px;
}

.recent-record-row .recent-plate {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.recent-record-row .recent-user {
  font-size: 12px;
  color: var(--text-2);
}

.recent-record-row .recent-fuel {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.recent-record-row .recent-date {
  font-size: 12px;
  color: var(--text-3);
  text-align: right;
}

.attention-card .dashboard-list-item {
  border-color: rgba(245, 158, 11, 0.22);
  background: var(--warning-light);
}

.mini-empty {
  padding: 32px 12px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.top-fuel-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.top-fuel-item {
  display: grid;
  grid-template-columns: 28px 120px minmax(120px, 1fr) 80px;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}

.top-fuel-item > span {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #FEE2E2;
  color: #DC2626;
  font-size: 12px;
  font-weight: 700;
}

.top-fuel-item strong { color: var(--text); }

.top-fuel-item div {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #FEF2F2;
}

.top-fuel-item i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #EF4444, #B91C1C);
}

.top-fuel-item em {
  text-align: right;
  font-style: normal;
  color: #B91C1C;
  font-weight: 600;
}

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--accent-light); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-wrap { overflow-x: auto; }

/* ---- Vehicle Image ---- */
.vehicle-img {
  width: 80px; height: 56px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}

.img-placeholder {
  width: 80px; height: 56px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input, .form-select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: var(--text-3); }
.form-input.error { border-color: var(--danger); }

select.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%239CA3AF'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

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

.form-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

.form-hint.warning { color: var(--warning); }

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

.form-input.error ~ .form-error { display: block; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  outline: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4338CA);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.3);
  filter: brightness(1.08);
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-warm);
  color: var(--text);
  border-color: var(--border-2);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.12); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--bg-warm);
  color: var(--text);
}

.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius); }
.btn-block { width: 100%; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: var(--success-light); color: #059669; }
.badge-danger { background: var(--danger-light); color: #DC2626; }
.badge-info { background: var(--info-light); color: #2563EB; }
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-warning { background: var(--warning-light); color: #B45309; }

/* ---- Alerts / Flash ---- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert {
  padding: 14px 20px;
  border-radius: 0;
  background: #fff;
  border: 1px solid currentColor;
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.35s ease;
  min-width: 280px;
  max-width: 420px;
}

.alert.out { animation: toastOut 0.3s ease forwards; }

.alert-success { color: #059669; }
.alert-danger,
.alert-error { color: #DC2626; }
.alert-info { color: #2563EB; }
.alert-warning { color: #B45309; }
.alert i { color: currentColor; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}

.modal-header {
  padding: 22px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-warm);
  color: var(--text-3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}

.modal-close:hover { background: var(--border-2); color: var(--text); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 0 24px 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-input,
.filter-bar .form-select { padding: 10px 12px; font-size: 13px; }

/* ---- Info Banner ---- */
.info-banner {
  background: var(--accent-light);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-banner i { color: var(--accent); }

/* ---- Fuel Report ---- */
.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.report-filter-card {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  overflow: visible;
}

.report-filter-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
}

.report-filter-field {
  min-width: 140px;
}

.report-filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.report-vehicle-filter {
  min-width: 200px;
}

.report-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.report-table-wrap {
  max-height: calc(100dvh - 340px);
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-gutter: stable;
  cursor: grab;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.report-table-wrap.drag-scroll {
  overflow-x: hidden;
}

.report-table-wrap.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.report-table-wrap.is-dragging * { cursor: grabbing; }

.fuel-report-table {
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
}

.fuel-report-table th,
.fuel-report-table td {
  min-width: 92px;
  text-align: center;
  white-space: nowrap;
  border-right: 1px solid var(--border);
}

.fuel-report-table th:last-child,
.fuel-report-table td:last-child { border-right: none; }

.fuel-report-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.fuel-report-table thead tr:nth-child(2) th { top: 43px; }

.summary-head {
  background: #FEF3C7 !important;
  color: #B45309 !important;
  font-weight: 700 !important;
}

.summary-sub {
  background: #FFFBEB !important;
  color: #B45309 !important;
  font-weight: 600 !important;
}

.summary-cell {
  background: #FFFBEB;
}

.fuel-report-table .month-head {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  border-right-color: rgba(79, 70, 229, 0.28);
}

.fuel-report-table .sub-head {
  background: #EEF2FF;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

.report-sticky-col {
  position: sticky !important;
  z-index: 4 !important;
  background: var(--surface) !important;
  box-shadow: 1px 0 0 var(--border), 6px 0 12px rgba(15, 23, 42, 0.04);
}

.sticky-plate-col {
  left: 0;
  min-width: 110px !important;
  max-width: 110px;
}

.sticky-model-col {
  left: 110px;
  min-width: 120px !important;
  max-width: 120px;
}

.sticky-district-col {
  left: 230px;
  min-width: 100px !important;
  max-width: 100px;
}

.fuel-report-table thead .report-sticky-col { background: var(--surface-2) !important; }

.vehicle-cell {
  text-align: left !important;
}

.vehicle-meta-cell {
  color: var(--text-2);
  text-align: left !important;
}

.vehicle-cell strong,
.vehicle-cell span {
  display: block;
}

.vehicle-cell span {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 12px;
}

.consumption-cell {
  color: var(--accent);
  font-weight: 700;
}

/* ---- Month Picker ---- */
.month-picker {
  position: relative;
}

.mp-trigger {
  width: 100%;
  min-height: 39px;
  padding: 10px 36px 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.mp-trigger:hover { border-color: var(--border-2); }

.mp-trigger .fa-caret-down {
  color: var(--text-3);
  font-size: 12px;
  transition: transform 0.2s;
}

.mp-popup {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  width: 280px;
  max-height: 360px;
  overflow-y: auto;
}

.mp-year-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mp-year-nav button {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  cursor: pointer;
  padding: 4px 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  transition: var(--transition);
}

.mp-year-nav button:hover { background: var(--surface-2); border-color: var(--accent); }

.mp-year-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  user-select: none;
}

.mp-year-label:hover { background: var(--surface-2); }

.mp-month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mp-month-grid button {
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.mp-month-grid button:hover { background: var(--surface-2); border-color: var(--accent); }

.mp-month-grid button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.mp-year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.mp-year-grid button {
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.mp-year-grid button:hover { background: var(--surface-2); border-color: var(--accent); }

.mp-year-grid button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.mp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
}

/* ---- Multi Select ---- */
.multi-select {
  position: relative;
}

.ms-trigger {
  width: 100%;
  min-height: 39px;
  padding: 10px 36px 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.ms-trigger:hover { border-color: var(--border-2); }

.ms-trigger .fa-caret-down {
  color: var(--text-3);
  font-size: 12px;
  transition: transform 0.2s;
}

.ms-popup {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  width: 220px;
  max-height: 280px;
  overflow-y: auto;
}

.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}

.ms-option:hover { background: var(--surface-2); }

.ms-option input[type="checkbox"] { accent-color: var(--accent); }

/* ---- Record Cards ---- */
.record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.record-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.record-card .rc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.record-card .rc-plate {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.record-card .rc-date {
  font-size: 12px;
  color: var(--text-3);
}

.record-card .rc-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.record-card .rc-stat {
  font-size: 13px;
  color: var(--text-2);
}

.record-card .rc-stat strong {
  color: var(--text);
  font-weight: 600;
}

.record-card .rc-consumption {
  color: var(--accent);
  font-weight: 700;
}

/* ---- User Hero Entry ---- */
.hero-entry {
  text-align: center;
  padding: 48px 20px;
}

.hero-entry .welcome {
  font-size: 16px;
  color: var(--text-2);
  margin-bottom: 8px;
}

.hero-entry .user-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--text);
}

.record-btn {
  width: 160px; height: 160px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #4338CA);
  border: none;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-display);
  box-shadow: 0 8px 40px var(--accent-glow), 0 0 0 8px rgba(79, 70, 229, 0.06);
  transition: var(--transition);
  position: relative;
}

.record-btn::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px dashed rgba(79, 70, 229, 0.2);
  animation: spin 20s linear infinite;
}

.record-btn i { font-size: 36px; }

.record-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 50px rgba(79, 70, 229, 0.3), 0 0 0 12px rgba(79, 70, 229, 0.08);
}

.record-btn:active { transform: scale(0.97); }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 8px 40px var(--accent-glow), 0 0 0 8px rgba(79, 70, 229, 0.06); }
  50% { box-shadow: 0 8px 40px var(--accent-glow), 0 0 0 20px rgba(79, 70, 229, 0); }
  100% { box-shadow: 0 8px 40px var(--accent-glow), 0 0 0 8px rgba(79, 70, 229, 0.06); }
}

/* ---- Quick Stats (User Home) ---- */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 480px;
  margin: 36px auto 0;
}

.quick-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: left;
  transition: var(--transition);
}

.quick-stat:hover { border-color: var(--border-2); }

.quick-stat-lbl {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.quick-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-stat-icon {
  font-size: 20px;
  color: var(--text-3);
}

.quick-stat-val {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
}

/* ---- Charts ---- */
.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ---- Detail Grid ---- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.detail-item {
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.detail-item .detail-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.detail-item .detail-label {
  font-size: 0.7rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ---- Pagination ---- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.pagination-info {
  color: var(--text-3);
  font-size: 13px;
}

.pagination-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-link,
.page-ellipsis {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
}

.page-link {
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface);
}

.page-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.page-link.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.page-link.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.page-ellipsis { color: var(--text-3); }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }

.empty-state .empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}

.empty-state .empty-desc {
  font-size: 13px;
}

/* ---- Login Page ---- */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 100% 80% at 50% 0%, rgba(79, 70, 229, 0.08) 0%, transparent 50%),
    var(--bg-warm);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo .icon-ring {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #4338CA);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.login-logo p {
  color: var(--text-3);
  font-size: 14px;
  margin-top: 6px;
}

/* ---- Mobile Bottom Nav ---- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--transition);
  font-size: 11px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  background: none;
  text-decoration: none;
}

.mobile-nav-item i { font-size: 20px; }

.mobile-nav-item.active { color: var(--accent); }

.mobile-nav-item:hover { color: var(--text-2); }

/* ---- Mobile Menu Button ---- */
.mobile-menu-btn {
  display: none !important;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 20px;
  cursor: pointer;
}

.sidebar-toggle-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: var(--transition);
  flex-shrink: 0;
  margin-left: auto;
}
.sidebar-toggle-btn:hover { background: var(--bg-warm); color: var(--text); }

/* ---- Utilities ---- */
.hidden { display: none !important; }
.text-muted { color: var(--text-3); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.action-group { display: flex; gap: 6px; }

.page-enter { animation: pageIn 0.3s ease; }

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

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.2);
  }

  .main-content {
    margin-left: 0 !important;
  }

  .mobile-nav { display: block; }
  .mobile-menu-btn { display: inline-flex !important; }

  .page-header { padding: 20px 16px 16px; }
  .page-header h1 { font-size: 20px; }
  .page-body { padding: 16px; padding-bottom: 80px; }

  .dashboard-hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  .dashboard-hero h2 { font-size: 22px; }
  .dashboard-grid,
  .dashboard-grid-three { grid-template-columns: 1fr; }
  .chart-wrap-lg { height: 280px; }
  .top-fuel-item { grid-template-columns: 28px 1fr 72px; }
  .top-fuel-item div { grid-column: 2 / 4; }
  .pagination-bar { flex-direction: column; align-items: flex-start; }
  .report-filter-row { align-items: stretch; flex-direction: column; }
  .report-filter-field { width: 100%; min-width: 0; }
  .report-filter-actions { flex-direction: row; width: 100%; }
  .report-filter-actions .btn { flex: 1; }
  .report-filter-actions .btn-ghost { flex: 0 0 auto; }
  .report-table-wrap { max-height: calc(100dvh - 460px); }
  .report-filter-card { padding: 12px; }
  .fuel-report-table { min-width: max-content !important; }
  .fuel-report-table th,
  .fuel-report-table td {
    min-width: 52px;
    padding: 8px 3px;
    font-size: 10px;
  }
  .fuel-report-table thead th,
  .fuel-report-table .month-head,
  .fuel-report-table .sub-head {
    font-size: 10px;
  }
  .sticky-plate-col {
    min-width: 62px !important;
    max-width: 62px;
  }
  .sticky-model-col {
    left: 62px;
    min-width: 48px !important;
    max-width: 48px;
  }
  .sticky-district-col {
    left: 110px;
    min-width: 36px !important;
    max-width: 36px;
  }
  .sticky-plate-col,
  .sticky-model-col,
  .sticky-district-col {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mp-popup { width: 260px; left: 50% !important; transform: translateX(-50%); }
  .ms-popup { width: 200px; left: 50% !important; transform: translateX(-50%); }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 10px 12px; }

  .filter-bar { flex-direction: column; }
  .filter-bar .form-group { width: 100%; }

  .hero-entry { padding: 32px 16px; }
  .record-btn { width: 130px; height: 130px; font-size: 14px; }
  .record-btn i { font-size: 28px; }

  .chart-dual { grid-template-columns: 1fr !important; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }

  .login-card { padding: 36px 24px; }

  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
  .mobile-menu-btn { display: none !important; }
}
