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

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface2: #f1f3f6;
  --border: #e4e7ec;
  --border2: #d0d5dd;
  --text: #111827;
  --text2: #6b7280;
  --text3: #9ca3af;
  --blue: #1d5bbf;
  --blue-light: #dbeafe;
  --blue-dark: #1447a6;
  --green: #15803d;
  --green-light: #dcfce7;
  --amber: #b45309;
  --amber-light: #fef3c7;
  --red: #b91c1c;
  --red-light: #fee2e2;
  --purple: #6d28d9;
  --purple-light: #ede9fe;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.10);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  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;
}

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

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon i {
  color: #fff;
  font-size: 16px;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.brand-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}

.sidebar-section {
  padding: 16px 12px 8px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}

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

.nav-item.active {
  background: var(--blue-light);
  color: var(--blue);
}

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

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
}

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

/* ── MAIN ── */
.main {
  margin-left: 220px;
  width: calc(100% - 220px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── TOPBAR ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex: 0 0 38px;
}

.nav-toggle:hover {
  background: var(--surface2);
}

.topbar-left h1 {
  font-size: 17px;
  font-weight: 600;
}

.topbar-left p {
  font-size: 12px;
  color: var(--text3);
  margin-top: 1px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface2);
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.btn-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-danger:hover {
  background: #991b1b;
}

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

.btn-icon {
  padding: 8px;
  width: 34px;
  height: 34px;
  justify-content: center;
}

/* ── CONTENT ── */
.content {
  padding: 24px 28px;
  flex: 1;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 16px;
}

.stat-label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}

.stat-val {
  font-size: 26px;
  font-weight: 600;
  margin-top: 3px;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--text3);
  margin-top: 4px;
}

.stat-trend {
  font-size: 11.5px;
  margin-top: 4px;
  font-weight: 500;
}

.trend-up {
  color: var(--green);
}

.trend-down {
  color: var(--red);
}

/* ── TIMELINE ── */
.timeline {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 6px;
  flex: 0 0 12px;
}

.timeline-body {
  background: var(--surface2);
  padding: 10px 12px;
  border-radius: 8px;
  flex: 1;
}

.timeline-time {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 6px;
}

.timeline-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

/* ── CALENDAR ── */
.calendar {
  display: block;
  padding: 12px;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

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

.calendar-weekday {
  font-size: 12px;
  text-align: center;
  color: var(--text3);
  padding: 6px 4px;
  border-left: 1px solid var(--border);
}

.calendar-day {
  min-height: 72px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 1px solid var(--border);
}

.calendar-day.out {
  opacity: 0.45;
}

.calendar-day .day-num {
  font-weight: 600;
  font-size: 13px;
}

.day-badges {
  margin-top: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.day-badge {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text2);
}

.day-badge-block {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  color: #fff;
  margin-bottom: 4px;
  box-shadow: var(--shadow);
}

.day-badge-block {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  color: #fff;
  margin-bottom: 4px;
  box-shadow: var(--shadow);
}

.badge-img {
  width: 48px;
  height: 28px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 48px;
}

/* ── GANTT / PLANNING ── */
.gantt {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  box-shadow: var(--shadow);
}

.gantt-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text3);
}

.gantt-head-left {
  width: 164px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 8px;
}

.gantt-month-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
  line-height: 1.15;
}

.gantt-head-sub {
  font-size: 10px;
  color: var(--text3);
  line-height: 1.1;
}

.gantt-grid {
  display: flex;
  gap: 0;
  align-items: stretch;
  overflow: auto;
}

.gantt-left {
  width: 164px;
  min-width: 179px;
  background: transparent;
  border-right: 1px solid var(--border);
}

.gantt-left .car-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
}

.gantt-left .car-row .car-img-wrap {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 28px;
}

.gantt-left img {
  width: 40px;
  height: 28px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.gantt-left .car-img-wrap .month-badge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-size: 7px;
  font-weight: 700;
  color: #fff;
  padding: 1px 2px;
  border-radius: 6px 6px 0 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

.gantt-right {
  flex: 1;
  position: relative;
  min-width: 480px;
}

.gantt-days {
  display: flex;
  position: sticky;
  top: 0;
  background: transparent;
  z-index: 10;
}

.gantt-day {
  flex: 1;
  min-width: 10px;
  text-align: center;
  /*padding: 4px 3px;*/
  border-left: 1px solid var(--border);
  font-size: 11px;
  color: var(--text3);
}

.gantt-row {
  display: flex;
  position: relative;
  min-height: 42px;
  border-bottom: 1px dashed var(--border);
}

.gantt-track {
  position: relative;
  flex: 1;
}

.gantt-bar {
  position: absolute;
  top: 6px;
  height: 32px;
  border-radius: 6px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: hidden;
  font-size: 12px
}

.gantt-bar img {
  width: 32px;
  height: 22px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 32px;
}

/* ── GANTT TODAY LINE ── */
.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e53e3e;
  z-index: 20;
  pointer-events: none;
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(229, 62, 62, 0.5);
}

.gantt-today-label {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: #e53e3e;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px rgba(229, 62, 62, 0.4);
}

.gantt-today-label::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #e53e3e;
}

/* Highlight today column header */
.gantt-day.gantt-day-today {
  color: #e53e3e;
  font-weight: 700;
  background: rgba(229, 62, 62, 0.08);
  border-radius: 4px;
}

/* ── SECTION HEADER ── */
.section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-hdr h2 {
  font-size: 15px;
  font-weight: 600;
}

.section-hdr .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── SEARCH & FILTER ── */
.search-bar {
  position: relative;
}

.search-bar input {
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  width: 220px;
  max-width: 100%;
}

.search-bar input:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.search-bar i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 13px;
}

.search-bar i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 13px;
}

.filter-select {
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  cursor: pointer;
}

/* ── TABLE ── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

thead th {
  background: var(--surface2);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #fafbfc;
}

.table-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text3);
}

.table-empty i {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green {
  background: var(--green-light);
  color: var(--green);
}

.badge-amber {
  background: var(--amber-light);
  color: var(--amber);
}

.badge-red {
  background: var(--red-light);
  color: var(--red);
}

.badge-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.badge-purple {
  background: var(--purple-light);
  color: var(--purple);
}

.badge-gray {
  background: var(--surface2);
  color: var(--text2);
}

/* ── FLEET GRID ── */
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.car-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.car-card:hover {
  box-shadow: var(--shadow-md);
}

.car-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.car-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--blue);
}

.car-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.car-plate {
  font-size: 11px;
  color: var(--text3);
  font-family: monospace;
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

.car-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.spec-tag {
  font-size: 11px;
  background: var(--surface2);
  color: var(--text2);
  padding: 3px 8px;
  border-radius: 4px;
}

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

.car-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--blue);
}

.car-price span {
  font-size: 11px;
  font-weight: 400;
  color: var(--text3);
}

.car-actions {
  display: flex;
  gap: 6px;
}

/* ── CLIENT CARDS ── */
.client-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}

.client-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
}

.client-name {
  font-size: 14px;
  font-weight: 600;
}

.client-cin {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
  margin-bottom: 10px;
}

.client-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text2);
}

.client-info span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.client-info i {
  width: 14px;
  color: var(--text3);
}

.client-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.client-stat {
  text-align: center;
}

.client-stat .val {
  font-size: 15px;
  font-weight: 600;
}

.client-stat .lbl {
  font-size: 10px;
  color: var(--text3);
}

/* ── REVENUE ── */
.revenue-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.bar-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.bar-chart h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 140px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.bar-fill {
  width: 100%;
  background: var(--blue-light);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.4s ease;
  position: relative;
}

.bar-fill:hover {
  background: var(--blue);
}

.bar-label {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}

.bar-amt {
  font-size: 10px;
  color: var(--text2);
  font-weight: 500;
}

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* make inline modal content easier to control on smaller screens */
#modal-body > div {
  width: 100%;
}

#modal-body > div > div {
  min-width: 0;
}

#modal-body label {
  width: 100%;
}

#modal-body label input,
#modal-body label select,
#modal-body label textarea {
  width: 100%;
  min-height: 42px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 18px;
  padding: 4px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

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

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 91, 191, 0.1);
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.calc-box {
  background: var(--blue-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 4px;
}

.calc-box .calc-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 4px;
}

.calc-box .calc-total {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  border-top: 1px solid rgba(29, 91, 191, 0.2);
  padding-top: 8px;
  margin-top: 4px;
}

/* ── DASHBOARD QUICK ACTIONS ── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.quick-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.quick-card:hover {
  background: var(--blue-light);
  border-color: var(--blue);
}

.quick-card i {
  font-size: 22px;
  color: var(--blue);
  margin-bottom: 8px;
}

.quick-card p {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
}

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

.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease;
}

.toast.success {
  background: var(--green);
}

.toast.error {
  background: var(--red);
}

@keyframes slideIn {
  from {
    transform: translateX(100px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ── CONFIRM DIALOG ── */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  align-items: center;
  justify-content: center;
}

.confirm-overlay.open {
  display: flex;
}

.confirm-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 360px;
  box-shadow: var(--shadow-md);
}

.confirm-box h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-box p {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 20px;
}

.confirm-box .btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── DETAIL PANEL ── */
.detail-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 200;
  overflow-y: auto;
  padding: 24px;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}

.detail-panel.open {
  display: block;
}

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

.detail-section {
  margin-bottom: 20px;
}

.detail-section h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.detail-row .key {
  color: var(--text2);
}

.detail-row .val {
  font-weight: 500;
}

/* ── PRINT RECEIPT ── */
@media print {

  .sidebar,
  .topbar,
  .modal-overlay,
  .confirm-overlay,
  .toast-container,
  .btn {
    display: none !important;
  }

  .main {
    margin-left: 0;
  }

  .content {
    padding: 0;
  }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 99px;
}

.avatar-colors {
  --colors: #1d5bbf, #15803d, #b45309, #6d28d9, #b91c1c, #0e7490;
}

/* -------- Improvements: responsiveness, inputs, micro-interactions -------- */
input,
select,
textarea {
  outline-offset: 3px;
}

.btn {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  box-shadow: 0 6px 18px rgba(29, 91, 191, 0.12);
}

.btn-primary:focus {
  box-shadow: 0 8px 22px rgba(29, 91, 191, 0.18);
}

.quick-card {
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.quick-card:hover {
  transform: translateY(-4px);
}

/* make grids responsive */
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.fleet-grid,
.client-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.revenue-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* modal / form improvements */
.modal {
  padding: 20px;
}

.modal .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.modal input[type="text"],
.modal input[type="number"],
.modal input[type="date"],
.modal select,
.modal textarea {
  width: 100%;
}

/* responsive layout tweaks */
@media (max-width: 900px) {
  .sidebar {
    width: 68px;
  }

  .sidebar .brand-name,
  .sidebar .brand-sub,
  .sidebar-label,
  .nav-item span,
  .sidebar-footer {
    display: none;
  }

  .main {
    margin-left: 68px;
    width: calc(100% - 68px);
  }

  .topbar {
    padding: 10px 14px;
  }

  .content {
    padding: 16px;
  }

  .modal {
    width: 92vw;
    padding: 16px;
  }

  .modal-header h3 {
    font-size: 15px;
  }

  /* show session info on mobile as a compact bottom dock */
  .sidebar-footer {
    display: block;
    position: fixed;
    left: 68px;
    right: 0;
    bottom: 0;
    z-index: 130;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.06);
  }

  .sidebar-footer > div:first-child {
    font-size: 10px !important;
    text-align: left !important;
    line-height: 1.35 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #auth-area {
    margin-top: 6px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap;
  }

  #auth-area > div:first-child {
    flex: 1 1 140px;
    min-width: 0;
    text-align: left !important;
  }

  #auth-area > div:first-child strong,
  #auth-area > div:first-child span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #auth-area .badge {
    margin-top: 4px !important;
  }

  #auth-area .quota-block {
    flex: 1 1 160px;
    min-width: 0;
    margin-top: 0;
  }

  #auth-area .quota-label {
    font-size: 9px;
  }

  #auth-area .quota-label span:last-child {
    white-space: nowrap;
  }

  #auth-area .btn {
    width: auto !important;
    flex: 0 0 auto;
    padding: 6px 10px !important;
    font-size: 11px !important;
  }
}

@media (max-width: 520px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .topbar-right {
    justify-content: space-between;
    width: 100%;
  }

  .search-bar {
    flex: 1;
    margin-right: 8px;
  }

  .search-bar input {
    width: 100%;
  }

  #cta-label {
    display: none;
  }

  .fleet-grid,
  .client-grid {
    grid-template-columns: 1fr;
  }

  .topbar-left h1 {
    font-size: 15px;
  }

  .search-bar {
    width: 100%;
  }

  .search-bar input {
    width: 100%;
  }

  .topbar-right {
    flex-wrap: wrap;
  }

  .topbar-right .btn {
    width: 100%;
    justify-content: center;
  }

  .modal-overlay {
    align-items: flex-end;
  }

  .modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  .modal-header {
    margin-bottom: 14px;
  }

  .modal-header h3 {
    font-size: 15px;
  }

  #modal-body > div {
    padding: 0 !important;
    max-width: 100% !important;
    gap: 12px !important;
  }

  #modal-body > div > div[style*="display:flex"] {
    flex-direction: column !important;
    gap: 12px !important;
  }

  #modal-body > div > div[style*="display:grid"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  #modal-body > div > div[style*="justify-content:flex-end"] {
    flex-direction: column;
    align-items: stretch;
  }

  #modal-body > div > div[style*="justify-content:flex-end"] .btn {
    width: 100%;
    justify-content: center;
  }

  .confirm-box,
  .login-box {
    width: calc(100vw - 24px);
    max-width: none;
    padding: 20px 16px;
  }
}

/* small table responsiveness */
.table-card {
  overflow: auto;
}

/* improve form labels used in inline modal markup */
label {
  display: block;
  font-size: 13px;
  color: var(--text2);
}

label input,
label select,
label textarea {
  margin-top: 6px;
}

/* reduce excessive shadows for a cleaner look */
.car-card,
.client-card,
.stat-card {
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.04);
}

/* ── LOGIN SCREEN ── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
}

.login-header p {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}

#login-error-msg {
  background: var(--red-light);
  color: var(--red);
  font-size: 12.5px;
  font-weight: 500;
  padding: 10px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid rgba(185, 28, 28, 0.15);
  display: none;
  text-align: center;
}

/* ── SIDEBAR QUOTA BAR ── */
.quota-block {
  margin-top: 8px;
  width: 100%;
}

.quota-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 4px;
}

.quota-track {
  background: var(--surface2);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.quota-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ── UPGRADE PAGE ── */
.upgrade-current-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 8px;
}

.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.15s;
}

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

.plan-card-current {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(29, 91, 191, 0.12), var(--shadow);
}

@media (max-width: 1100px) {
  .plans-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .plans-grid {
    grid-template-columns: 1fr;
  }
}

/* ALERTES J-1 EN HAUT DE PAGE */
#returns-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 9998;
  width: min(1040px, calc(100vw - 24px));
  pointer-events: none;
}

.returns-banner-compact {
  display: none;
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: #fff;
  box-shadow: 0 12px 26px rgba(153, 27, 27, 0.28);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
}

.returns-banner-compact span {
  display: none;
}

.returns-banner-collapsed {
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
}

.returns-banner-collapsed .returns-banner-inner {
  display: none;
}

.returns-banner-collapsed .returns-banner-compact {
  display: inline-flex;
}

.returns-banner-collapsed .returns-banner-compact span {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.18);
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: -2px;
}

.returns-banner-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(29, 91, 191, 0.98));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
}

.returns-banner-visible {
  animation: bannerDrop 0.22s ease-out forwards;
}

.returns-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
}

.returns-banner-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.returns-banner-text strong {
  font-size: 13px;
  letter-spacing: 0.01em;
}

.returns-banner-body {
  font-size: 12px;
}

.returns-banner-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 10px;
  margin-top: 2px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}

.returns-banner-detail {
  opacity: 0.86;
  font-size: 11px;
}

.returns-banner-btn,
.returns-banner-close {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.returns-banner-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 8px 12px;
  font-weight: 600;
  white-space: nowrap;
}

.returns-banner-close {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  flex: 0 0 34px;
}

.returns-banner-btn:hover,
.returns-banner-close:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.24);
}

@keyframes bannerDrop {
  from {
    transform: translateX(-50%) translateY(-12px);
    opacity: 0;
  }

  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1200px) {
  .stats-grid,
  .quick-grid,
  .fleet-grid,
  .client-grid,
  .revenue-grid,
  .plans-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    display: block;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .sidebar {
    width: min(84vw, 300px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.16);
    z-index: 2000;
    overflow-y: auto;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    width: 100%;
  }

  .topbar {
    padding: 12px 16px;
  }

  .content {
    padding: 16px;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1500;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-footer {
    position: static;
    display: block;
    margin-top: auto;
  }

  .sidebar .brand-name,
  .sidebar .brand-sub,
  .sidebar-label,
  .nav-item span {
    display: inline;
  }

  .sidebar-section {
    padding: 16px 12px 8px;
  }

  .detail-panel {
    width: min(100vw, 420px);
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-right {
    width: 100%;
  }

  .search-bar,
  .search-bar input,
  .topbar-right .btn {
    width: 100%;
  }

  .topbar-right .btn {
    justify-content: center;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid,
  .fleet-grid,
  .client-grid,
  .revenue-grid,
  .plans-grid {
    grid-template-columns: 1fr;
  }

  .section-hdr {
    flex-direction: column;
    align-items: stretch;
  }

  .section-hdr .actions {
    justify-content: flex-start;
  }

  .modal-overlay {
    align-items: flex-end;
  }

  .modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  }

  .confirm-box,
  .login-box {
    width: calc(100vw - 24px);
    max-width: none;
  }

  .detail-panel {
    width: 100vw;
    max-width: 100vw;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .table-card table {
    min-width: 680px;
  }

  #returns-banner {
    width: calc(100vw - 16px);
    top: 8px;
  }

  .returns-banner-inner {
    flex-wrap: wrap;
  }

  .returns-banner-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .topbar-left h1 {
    font-size: 15px;
  }

  .topbar-right .btn {
    padding-left: 12px;
    padding-right: 12px;
  }

  .confirm-box .btns,
  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .confirm-box .btns .btn,
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
}
