:root {
  --sidebar-bg: #1e293b;
  --sidebar-width: 250px;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --header-h: 64px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ======== LOGIN PAGE ======== */
#login-page {
  display: none;
  min-height: 100vh;
}
#login-page.active {
  display: flex;
}

/* ---------- HERO LEFT ---------- */
.lp-hero {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-image: url('/images/carwash-bg.jpg');
  background-size: cover;
  background-position: center center;
  background-color: #07070e;
}

/* Dark overlay so text is readable over the photo */
.lp-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(0,0,0,.65) 0%, rgba(0,0,0,.4) 55%, rgba(0,0,0,.15) 100%),
    linear-gradient(180deg, rgba(0,0,0,.1) 0%, rgba(0,0,0,.35) 100%);
  z-index: 0;
}
.lp-hero::after { display: none; }

.lp-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 44px 52px;
}

/* Brand */
.lp-brand { display: flex; align-items: center; gap: 13px; }
.lp-brand-ic { flex-shrink: 0; }
.lp-brand-name {
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  letter-spacing: .2px;
  line-height: 1;
}
.lp-brand-name span { color: #f59e0b; }
.lp-brand-sub {
  font-size: 10px;
  color: #475569;
  letter-spacing: 2.5px;
  font-weight: 600;
  margin-top: 4px;
  text-transform: uppercase;
}

.lp-spacer { flex: 1; min-height: 60px; max-height: 130px; }

/* Headline */
.lp-headline { margin-bottom: 44px; }
.lp-headline h1 {
  font-size: 54px;
  font-weight: 900;
  color: #fff;
  line-height: 1.07;
  letter-spacing: -1.5px;
  margin-bottom: 18px;
}
.lp-headline h1 em { font-style: normal; color: #f59e0b; }
.lp-headline p {
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.7;
  max-width: 340px;
}

/* Features */
.lp-feats { display: flex; flex-direction: column; gap: 20px; margin-bottom: 44px; }
.lp-feat { display: flex; align-items: center; gap: 16px; }
.lp-feat-ic {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(245,158,11,.1);
  border: 1.5px solid rgba(245,158,11,.22);
  display: flex; align-items: center; justify-content: center;
  color: #f59e0b;
  font-size: 16px;
  flex-shrink: 0;
}
.lp-feat strong { display: block; color: #f1f5f9; font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.lp-feat span   { color: #94a3b8; font-size: 12.5px; line-height: 1.5; }

/* Help box */
.lp-help {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  color: #f59e0b;
  font-size: 20px;
  max-width: 260px;
}
.lp-help strong { display: block; color: #f1f5f9; font-size: 13px; font-weight: 700; line-height: 1; margin-bottom: 3px; }
.lp-help span   { color: #94a3b8; font-size: 12px; }

/* ---------- CARD RIGHT ---------- */
.lp-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 52px;
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}

.lp-card {
  width: 420px;
  background: #1c1c2e;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 24px;
  padding: 44px 40px 40px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.06),
    0 32px 80px rgba(0,0,0,.8),
    0 8px 32px rgba(0,0,0,.6);
}

/* Card header */
.lp-card-head { text-align: center; margin-bottom: 32px; }
.lp-card-ic   { display: flex; justify-content: center; margin-bottom: 16px; }
.lp-card-head h2 {
  font-size: 26px;
  font-weight: 800;
  color: #f1f5f9;
  margin-bottom: 8px;
  letter-spacing: -.3px;
}
.lp-card-head p { color: #475569; font-size: 13.5px; line-height: 1.55; }

/* Fields */
.lp-field { margin-bottom: 18px; }
.lp-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 8px;
}
.lp-inp-wrap { position: relative; }
.lp-inp-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 14px;
  pointer-events: none;
  transition: color .2s;
}
.lp-inp-wrap input {
  width: 100%;
  padding: 13px 16px 13px 44px;
  background: #13131e;
  border: 1.5px solid rgba(255,255,255,.18);
  border-radius: 12px;
  font-size: 14px;
  color: #e2e8f0;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}
.lp-inp-wrap input::placeholder { color: #6b7280; }
.lp-inp-wrap input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,.1);
}
.lp-inp-wrap:focus-within .lp-inp-icon { color: #f59e0b; }

/* Login button */
.lp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  background: #f59e0b;
  color: #000;
  font-size: 15px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: .2px;
  transition: background .2s, box-shadow .2s, transform .1s;
  box-shadow: 0 4px 20px rgba(245,158,11,.35), 0 1px 4px rgba(0,0,0,.4);
}
.lp-btn:hover  { background: #e08e00; box-shadow: 0 6px 28px rgba(245,158,11,.5); transform: translateY(-1px); }
.lp-btn:active { transform: translateY(0); }

/* Error */
.lp-err {
  color: #f87171;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 18px;
  font-weight: 500;
}

/* ---------- RESPONSIVE: LOGIN ---------- */
@media (max-width: 980px) {
  #login-page.active {
    display: block;
    background: #07070e;
    min-height: 100vh;
    overflow-y: auto;
  }

  /* Hero takes only as much space as content needs */
  .lp-hero {
    min-height: unset;
    height: auto;
  }

  .lp-hero-inner {
    min-height: unset;
    padding: 32px 24px 36px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  /* Show everything */
  .lp-spacer { display: none; }
  .lp-feats  { display: flex; margin-bottom: 28px; }
  .lp-help   { display: inline-flex; }

  .lp-headline {
    margin-top: 24px;
    margin-bottom: 28px;
  }
  .lp-headline h1 { font-size: 36px; }
  .lp-headline p  { display: block; }

  /* Login card section */
  .lp-right {
    padding: 28px 20px 40px;
    background: #07070e;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: unset;
  }

  .lp-card {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .lp-hero-inner { padding: 24px 18px 28px; }
  .lp-headline h1 { font-size: 28px; }
  .lp-card { padding: 30px 20px 24px; }
  .lp-right { padding: 20px 14px 36px; }
  .lp-feat-ic { width: 38px; height: 38px; font-size: 14px; }
  .lp-feat strong { font-size: 13px; }
  .lp-feat span   { font-size: 12px; }
}

/* ======== APP LAYOUT ======== */
#app { display: none; }
#app.active { 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: transform .3s;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand i { color: var(--primary); font-size: 22px; }
.sidebar-brand span { color: #fff; font-size: 16px; font-weight: 700; line-height: 1.2; }

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  transition: all .15s;
  border-radius: 6px;
  margin: 1px 8px;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: rgba(255,255,255,.45); font-size: 11px; text-transform: capitalize; }
.btn-logout {
  background: none; border: none; color: rgba(255,255,255,.5);
  cursor: pointer; padding: 4px; font-size: 14px; transition: color .2s;
}
.btn-logout:hover { color: var(--danger); }

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

.topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 12px;
}
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

#page-content { padding: 24px; flex: 1; }

/* ======== CARDS ======== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ======== STAT CARDS ======== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue   { background: #eff6ff; color: var(--primary); }
.stat-icon.green  { background: #f0fdf4; color: var(--success); }
.stat-icon.amber  { background: #fffbeb; color: var(--warning); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }
.stat-icon.cyan   { background: #ecfeff; color: var(--info); }
.stat-icon.purple { background: #faf5ff; color: #8b5cf6; }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ======== CHARTS ======== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.chart-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
}
.chart-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text-muted); }
.chart-wrap { position: relative; height: 220px; }

/* ======== TABLES ======== */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 11px 14px; vertical-align: middle; }
tbody td.actions { white-space: nowrap; }

/* ======== BADGES ======== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-danger   { background: #fee2e2; color: #dc2626; }
.badge-warning  { background: #fef9c3; color: #a16207; }
.badge-info     { background: #e0f2fe; color: #0369a1; }
.badge-gray     { background: #f1f5f9; color: #64748b; }
.badge-purple   { background: #f3e8ff; color: #7c3aed; }
.badge-orange   { background: #fff7ed; color: #c2410c; }

/* ======== BUTTONS ======== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1.5px solid transparent; transition: all .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning   { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; }
.btn-outline   { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 6px 8px; }

/* ======== FORMS ======== */
.form-row { display: grid; gap: 14px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12.5px; font-weight: 500; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.form-group textarea { resize: vertical; min-height: 70px; }

/* ======== PAGE HEADER ======== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title h2 { font-size: 22px; font-weight: 700; }
.page-title p  { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ======== FILTERS BAR ======== */
.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-bar input,
.filters-bar select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  min-width: 140px;
}
.filters-bar input:focus,
.filters-bar select:focus { outline: none; border-color: var(--primary); }
.filters-bar input.search-input { min-width: 220px; }

/* ======== MODAL ======== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}
.modal-box.modal-lg { max-width: 780px; }
.modal-box.modal-sm { max-width: 420px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--text-muted); padding: 2px 6px;
  border-radius: 6px; transition: all .15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ======== TOAST ======== */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #1e293b; color: #fff;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
  min-width: 250px; max-width: 380px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight .25s ease;
}
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { background: #15803d; }
.toast.error   { background: #dc2626; }
.toast.warning { background: #d97706; }
.toast-msg { flex: 1; }

/* ======== EMPTY STATE ======== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: .4; display: block; }
.empty-state h4 { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; }

/* ======== UTILS ======== */
.text-muted  { color: var(--text-muted); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ======== DETAIL VIEW ======== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item label { font-size: 11px; color: var(--text-muted); font-weight: 500; display: block; margin-bottom: 2px; }
.detail-item span  { font-size: 14px; font-weight: 500; }

/* ======== VEHICLE SUB-TABLE ======== */
.sub-section { margin-top: 20px; }
.sub-section h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }

/* ======== RESPONSIVE ======== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  #page-content { padding: 12px; }
  .modal-box { max-height: 95vh; }

  /* Topbar */
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar-title { font-size: 15px; }
  #topbar-date { display: none; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
  .page-title h2 { font-size: 18px; }

  /* Filters bar — stack vertically */
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filters-bar input,
  .filters-bar select { width: 100%; min-width: unset; }
  .filters-bar .btn { width: 100%; justify-content: center; }

  /* Tables — horizontal scroll with fade hint */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }

  /* Stat cards */
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }
  .stat-icon { width: 40px; height: 40px; font-size: 17px; }

  /* Card header */
  .card-header { flex-direction: column; align-items: flex-start; }

  /* Modals — full screen on mobile */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    max-height: 92vh;
  }
  .modal-box.modal-lg { max-width: 100%; }

  /* Action buttons in tables */
  td.actions { display: flex; gap: 4px; flex-wrap: wrap; }

  /* Toast — full width bottom */
  #toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: 100%; }

  /* Charts */
  .charts-grid { grid-template-columns: 1fr; }
  .chart-wrap { height: 180px; }

  /* Sub section table */
  .sub-section .table-wrap table { min-width: 400px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 11px; }

  /* Login page on small phones */
  .lp-hero-inner { padding: 20px 16px; }
  .lp-headline h1 { font-size: 24px; }
  .lp-card { padding: 28px 20px 24px; }
  .lp-right { padding: 20px 14px; }

  /* Smaller page content padding */
  #page-content { padding: 10px; }

  /* Make badge text smaller */
  .badge { font-size: 10px; padding: 2px 7px; }

  /* Buttons in page actions */
  .page-actions { flex-direction: column; }
  .page-actions .btn { width: 100%; }
}

@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-title { font-size: 13px; }
  .btn { padding: 7px 12px; font-size: 12px; }
}

/* ======== PRINT INVOICE ======== */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

.print-invoice {
  max-width: 700px; margin: 40px auto; padding: 40px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.print-invoice .inv-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; }
.print-invoice .inv-title { font-size: 32px; font-weight: 800; color: var(--primary); }
.print-invoice .inv-details { font-size: 13px; line-height: 1.8; }
.print-invoice .inv-table { width: 100%; border-collapse: collapse; margin: 24px 0; }
.print-invoice .inv-table th { background: #f1f5f9; padding: 10px 14px; text-align: left; font-size: 12px; text-transform: uppercase; }
.print-invoice .inv-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.print-invoice .inv-total { text-align: right; margin-top: 16px; }
.print-invoice .inv-total .total-row { display: flex; justify-content: flex-end; gap: 40px; padding: 6px 0; font-size: 14px; }
.print-invoice .inv-total .total-row.final { font-weight: 700; font-size: 18px; border-top: 2px solid var(--text); padding-top: 10px; }
.print-invoice .signature-area { display: flex; justify-content: space-between; margin-top: 60px; }
.print-invoice .sig-box { border-top: 1px solid #333; width: 180px; text-align: center; padding-top: 8px; font-size: 12px; color: var(--text-muted); }

/* ======== MONTH SELECTOR ======== */
.month-selector { display: flex; align-items: center; gap: 8px; }
.month-selector label { font-weight: 500; font-size: 13px; }
.month-selector input[type=month] { padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; }

/* ======== LOADING ======== */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; color: var(--text-muted); gap: 10px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ======== STATUS HIGHLIGHTS ======== */
.row-expired { background: #fff5f5 !important; }
.row-warning { background: #fffbeb !important; }

/* ======== HAMBURGER ======== */
.hamburger {
  display: none;
  background: none; border: none; padding: 6px;
  cursor: pointer; color: var(--text); font-size: 20px;
}
@media (max-width: 768px) { .hamburger { display: flex; } }
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 99;
}
.sidebar-overlay.active { display: block; }
