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

:root {
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', monospace;

  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --border: #e2e0d8;
  --border-strong: #ccc9be;

  --text: #1a1916;
  --text-2: #6b6860;
  --text-3: #9e9b92;

  --blue: #1a56db;
  --blue-light: #e8f0fd;
  --blue-text: #1340a8;

  --green: #166534;
  --green-light: #dcfce7;
  --green-text: #14532d;

  --amber: #92400e;
  --amber-light: #fef3c7;
  --amber-text: #78350f;

  --red: #991b1b;
  --red-light: #fee2e2;
  --red-text: #7f1d1d;

  --purple: #5b21b6;
  --purple-light: #ede9fe;
  --purple-text: #4c1d95;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);

  --sidebar-w: 220px;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Auth ── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 380px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text);
}

/* ── Logo ── */
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--text);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── App layout ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
}

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

.nav-links {
  list-style: none;
  padding: 10px 8px;
  flex: 1;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: background 0.12s, color 0.12s;
  position: relative;
}

.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.nav-link svg { flex-shrink: 0; opacity: 0.7; }

.badge {
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 20px;
  margin-left: auto;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-3); text-transform: capitalize; }

/* ── Main content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
}

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

.page-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

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

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

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

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

.stat-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ── Phase row colors ── */
:root {
  --phase-service-bg:     #c8dff7;
  --phase-service-stripe: #1a56db;
  --phase-detail-bg:      #ddd5f9;
  --phase-detail-stripe:  #5b21b6;
  --phase-body-bg:        #fcddb8;
  --phase-body-stripe:    #c05621;
  --phase-final-bg:       #b8edcc;
  --phase-final-stripe:   #166534;
  --phase-hold-bg:        #f9c0c0;
  --phase-hold-stripe:    #991b1b;
  --phase-neutral-bg:     var(--surface);
  --phase-neutral-stripe: var(--border);
}

/* ── Table ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--surface-2);
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

thead th:hover { color: var(--text-2); }

tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.08s, filter 0.08s;
  position: relative;
}

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

/* Phase row backgrounds */
tbody tr.phase-service    { background: var(--phase-service-bg); }
tbody tr.phase-detail     { background: var(--phase-detail-bg); }
tbody tr.phase-body       { background: var(--phase-body-bg); }
tbody tr.phase-final      { background: var(--phase-final-bg); }
tbody tr.phase-hold       { background: var(--phase-hold-bg); }
tbody tr.phase-neutral    { background: var(--phase-neutral-bg); }

tbody tr:hover { filter: brightness(0.96); }

/* Left border stripe via first td */
tbody tr td:first-child {
  border-left: 4px solid transparent;
  padding-left: 12px;
}
tbody tr.phase-service  td:first-child { border-left-color: var(--phase-service-stripe); }
tbody tr.phase-detail   td:first-child { border-left-color: var(--phase-detail-stripe); }
tbody tr.phase-body     td:first-child { border-left-color: var(--phase-body-stripe); }
tbody tr.phase-final    td:first-child { border-left-color: var(--phase-final-stripe); }
tbody tr.phase-hold     td:first-child { border-left-color: var(--phase-hold-stripe); }
tbody tr.phase-neutral  td:first-child { border-left-color: var(--border-strong); }

tbody td {
  padding: 11px 14px;
  vertical-align: middle;
  font-size: 13px;
}

.td-stock {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--blue);
  font-weight: 500;
}

.td-vehicle { font-weight: 500; }
.td-muted { color: var(--text-2); }

/* ── Day number cells — big and readable ── */
.days-cell {
  text-align: center;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  min-width: 52px;
}

.days-cell .days-val {
  display: inline-block;
  min-width: 36px;
  padding: 3px 8px;
  border-radius: var(--radius);
  text-align: center;
}

/* Status days — tighter urgency scale */
.days-status-green { background: var(--green-light);  color: var(--green-text); }
.days-status-amber { background: var(--amber-light);  color: var(--amber-text); }
.days-status-red   { background: var(--red-light);    color: var(--red-text);   }

/* Total days — broader scale */
.days-total-green  { background: var(--green-light);  color: var(--green-text); }
.days-total-amber  { background: var(--amber-light);  color: var(--amber-text); }
.days-total-red    { background: var(--red-light);    color: var(--red-text);   }

/* ── Age pill (kept for vehicle detail page) ── */
.age-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.age-green { background: var(--green-light); color: var(--green-text); }
.age-amber { background: var(--amber-light); color: var(--amber-text); }
.age-red   { background: var(--red-light);   color: var(--red-text); }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.cpo-pill {
  background: var(--blue-light);
  color: var(--blue-text);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
}

/* ── Phase legend ── */
.phase-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.legend-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
  flex-shrink: 0;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius);
  border-left: 4px solid transparent;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s, transform 0.1s;
  user-select: none;
}
.legend-item:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.legend-item.li-service    { background: var(--phase-service-bg);  border-left-color: var(--phase-service-stripe);  color: #0f3580; }
.legend-item.li-detail     { background: var(--phase-detail-bg);   border-left-color: var(--phase-detail-stripe);   color: #3b1478; }
.legend-item.li-body       { background: var(--phase-body-bg);     border-left-color: var(--phase-body-stripe);     color: #7a3310; }
.legend-item.li-final      { background: var(--phase-final-bg);    border-left-color: var(--phase-final-stripe);    color: #0d4020; }
.legend-item.li-hold       { background: var(--phase-hold-bg);     border-left-color: var(--phase-hold-stripe);     color: #6b0f0f; }

/* Active filter state — selected item gets a ring, others dim */
.legend-item.filter-active {
  box-shadow: 0 0 0 2px currentColor;
}
.legend-item.filter-dimmed {
  opacity: 0.35;
}

/* Clear filter button — appears inline when a filter is active */
.legend-clear {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  background: none;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.legend-clear:hover { color: var(--text); border-color: var(--text-2); }

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

/* Dimmed rows when a filter is active */
tbody tr.phase-dimmed {
  opacity: 0.25;
  filter: grayscale(0.4);
  pointer-events: none;
}

/* ── Row tooltip ── */
.row-tooltip {
  position: fixed;
  z-index: 500;
  background: var(--text);
  color: white;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.row-tooltip.visible { opacity: 1; }
.row-tooltip .tt-phase {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 1px;
}

/* ── Pipeline mini (table row) ── */
.pipeline-mini {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pipe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  flex-shrink: 0;
}

.pipe-dot.complete { background: var(--green); border-color: var(--green); }
.pipe-dot.active   { background: var(--blue); border-color: var(--blue); }
.pipe-dot.pending-approval { background: var(--amber); border-color: var(--amber); }
.pipe-dot.on-hold  { background: var(--red); border-color: var(--red); }
.pipe-dot.not-started { background: var(--surface-2); border-color: var(--border); }

.pipe-line {
  height: 1.5px;
  width: 12px;
  background: var(--border);
  flex-shrink: 0;
}

.pipe-line.complete { background: var(--green); }

/* ── Vehicle Detail ── */
.vehicle-detail {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.vehicle-detail-main {}

.vehicle-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.vehicle-title {
  font-size: 22px;
  font-weight: 600;
}

.vehicle-meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--text-2);
}

.meta-item { display: flex; gap: 4px; }
.meta-label { color: var(--text-3); }

/* ── Milestone cards ── */
.milestones-section { margin-bottom: 28px; }
.milestones-section h2 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }

.milestone-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 10px;
}

.milestone-card.complete { border-left: 3px solid var(--green); }
.milestone-card.active   { border-left: 3px solid var(--blue); }
.milestone-card.pending-approval { border-left: 3px solid var(--amber); }
.milestone-card.on-hold  { border-left: 3px solid var(--red); }
.milestone-card.not-started { border-left: 3px solid var(--border); }

.milestone-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.milestone-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.milestone-title-block { flex: 1; min-width: 0; }
.milestone-name { font-size: 14px; font-weight: 600; }
.milestone-status-text { font-size: 12px; color: var(--text-2); margin-top: 1px; }

.milestone-timer {
  text-align: right;
}

.timer-value {
  font-size: 20px;
  font-weight: 600;
  font-family: var(--mono);
  line-height: 1;
}

.timer-label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.milestone-body {
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}

.milestone-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 12px 0;
  font-size: 12px;
}

.detail-item .detail-label { color: var(--text-3); margin-bottom: 2px; }
.detail-item .detail-val { font-weight: 500; }

.milestone-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Quote box (inside milestone) ── */
.quote-box {
  background: var(--amber-light);
  border: 1px solid #f6d860;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 13px;
}

.quote-box.approved {
  background: var(--green-light);
  border-color: #86efac;
}

.quote-box.rejected {
  background: var(--red-light);
  border-color: #fca5a5;
}

.quote-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.quote-total {
  font-size: 16px;
  font-weight: 600;
}

.quote-meta { font-size: 11px; color: var(--text-2); }

/* ── Vehicle sidebar panel ── */
.vehicle-sidebar { position: sticky; top: 0; }

.sidebar-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

.panel-header {
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

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

.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-2); }
.info-val { font-weight: 500; }

/* ── Comments ── */
.comment-list { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.comment-item {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
}

.comment-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.comment-author { font-weight: 500; color: var(--text-2); }
.comment-body { color: var(--text); line-height: 1.5; }

/* ── Approvals list ── */
.approvals-list { display: flex; flex-direction: column; gap: 10px; }

.approval-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  border-left: 3px solid var(--amber);
}

.approval-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.approval-vehicle { font-size: 15px; font-weight: 600; }
.approval-stock { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.approval-waiting { font-size: 13px; color: var(--amber-text); font-weight: 500; }

.approval-amounts {
  display: flex;
  gap: 20px;
  font-size: 13px;
  margin-bottom: 12px;
}

.approval-amount-item .amt-label { color: var(--text-3); font-size: 11px; }
.approval-amount-item .amt-val { font-size: 16px; font-weight: 600; }

.approval-actions { display: flex; gap: 8px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, opacity 0.1s;
  white-space: nowrap;
  line-height: 1.4;
  background: var(--surface);
  color: var(--text);
}

.btn:hover { background: var(--surface-2); }
.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--text); color: white; border-color: var(--text); }
.btn-primary:hover { background: #2d2d2a; }

.btn-success { background: #166534; color: white; border-color: #166534; }
.btn-success:hover { background: #14532d; }

.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: #7f1d1d; }

.btn-warning { background: #92400e; color: white; border-color: #92400e; }
.btn-warning:hover { background: #78350f; }

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

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-3);
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}

.btn-icon:hover { background: var(--surface-2); color: var(--text-2); }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.btn-back:hover { color: var(--text); }

/* ── Inputs ── */
input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.1s, box-shadow 0.1s;
  outline: none;
  line-height: 1.4;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

textarea { resize: vertical; }

.search-input { width: 220px; }
.select-sm { width: auto; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
}

.field.required label::after {
  content: ' *';
  color: var(--red);
}

.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding-top: 20px;
}

.field-checkbox input[type=checkbox] { width: auto; }
.label-hint { font-size: 11px; font-weight: 400; color: var(--text-3); }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.quote-total-row {
  text-align: right;
  font-size: 13px;
  color: var(--text-2);
  margin: -8px 0 14px;
}

.quote-total-row strong { font-size: 16px; color: var(--text); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}

.modal-sm { max-width: 400px; }

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

.modal-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-3);
  padding: 4px;
  border-radius: var(--radius);
}

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

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-context {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

/* ── Alerts ── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error { background: var(--red-light); color: var(--red-text); border: 1px solid #fca5a5; }
.alert-success { background: var(--green-light); color: var(--green-text); border: 1px solid #86efac; }

/* ── Loading state ── */
.loading-state {
  padding: 40px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.empty-state {
  padding: 60px 40px;
  text-align: center;
  color: var(--text-3);
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-2);
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease;
  pointer-events: auto;
  max-width: 320px;
}

.toast.success { background: #166534; }
.toast.error { background: var(--red); }
.toast.warning { background: var(--amber); }

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

/* ── Misc ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.hold-banner {
  background: var(--red-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--red-text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
}

/* ── Reports ── */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

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

.report-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { width: 80px; text-align: right; color: var(--text-2); flex-shrink: 0; }
.bar-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; transition: width 0.5s ease; }
.bar-val { width: 40px; color: var(--text-2); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .vehicle-detail { grid-template-columns: 1fr; }
  .vehicle-sidebar { position: static; }
}

@media (max-width: 640px) {
  .page { padding: 16px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .logo-text, .nav-link span, .user-info { display: none; }
}
