/* ===== CSS CUSTOM PROPERTIES — THEME LIGHT (default) ===== */
:root,
[data-theme="light"] {
  --body-bg:
    radial-gradient(circle at 15% 10%, rgba(31, 143, 95, .20), transparent 28%),
    radial-gradient(circle at 86% 16%, rgba(217, 155, 33, .22), transparent 24%),
    linear-gradient(135deg, #f7fbf8 0%, #f7f1e8 52%, #eef5fb 100%);
  --sidebar-bg: rgba(20, 31, 25, .95);
  --sidebar-text: #fff;
  --sidebar-muted: rgba(255, 255, 255, .62);
  --sidebar-nav-hover: rgba(255, 255, 255, .12);
  --paper: #fbfaf7;
  --panel: rgba(255, 255, 255, .88);
  --ink: #17211b;
  --muted: #66736c;
  --line: rgba(23, 33, 27, .12);
  --table-bg: rgba(255, 255, 255, .82);
  --table-head-bg: #eef7f1;
  --table-head-ink: #224134;
  --row-hover: rgba(31, 143, 95, .06);
  --input-bg: #fff;
  --pill-bg: rgba(255, 255, 255, .72);
  --shadow: 0 24px 70px rgba(24, 35, 29, .14);
  --shadow-sm: 0 8px 24px rgba(24, 35, 29, .10);
  --green: #1f8f5f;
  --blue: #2669d9;
  --gold: #d99b21;
  --red: #d94b3d;
  --theme-active-bg: rgba(255,255,255,.22);
  --theme-active-border: rgba(255,255,255,.5);
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
  --body-bg: linear-gradient(135deg, #0a0f0c 0%, #0f1a14 50%, #0d1420 100%);
  --sidebar-bg: rgba(4, 8, 6, .98);
  --sidebar-text: #d6ede0;
  --sidebar-muted: rgba(180, 220, 195, .55);
  --sidebar-nav-hover: rgba(255, 255, 255, .08);
  --paper: #0f1a14;
  --panel: rgba(18, 30, 23, .96);
  --ink: #d6ede0;
  --muted: #7aa08a;
  --line: rgba(255, 255, 255, .08);
  --table-bg: rgba(14, 24, 18, .98);
  --table-head-bg: #152219;
  --table-head-ink: #8dcfaa;
  --row-hover: rgba(31, 143, 95, .10);
  --input-bg: #152219;
  --pill-bg: rgba(255, 255, 255, .06);
  --shadow: 0 24px 70px rgba(0, 0, 0, .5);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .35);
  --green: #2dbd80;
  --blue: #4a90e8;
  --gold: #e0b84a;
  --red: #e8604e;
  --theme-active-bg: rgba(45,189,128,.15);
  --theme-active-border: rgba(45,189,128,.4);
}

/* ===== OCEAN THEME ===== */
[data-theme="ocean"] {
  --body-bg:
    radial-gradient(circle at 20% 20%, rgba(0, 100, 200, .18), transparent 35%),
    radial-gradient(circle at 80% 80%, rgba(0, 200, 180, .14), transparent 30%),
    linear-gradient(135deg, #e8f4fd 0%, #f0faff 50%, #e0f5f2 100%);
  --sidebar-bg: rgba(5, 20, 50, .97);
  --sidebar-text: #cce8ff;
  --sidebar-muted: rgba(180, 220, 255, .55);
  --sidebar-nav-hover: rgba(100, 180, 255, .12);
  --paper: #f0f8ff;
  --panel: rgba(230, 245, 255, .90);
  --ink: #0d2137;
  --muted: #3a6080;
  --line: rgba(13, 33, 55, .12);
  --table-bg: rgba(240, 250, 255, .90);
  --table-head-bg: #c8e8f8;
  --table-head-ink: #0d3a5c;
  --row-hover: rgba(0, 100, 200, .06);
  --input-bg: #f0f8ff;
  --pill-bg: rgba(255, 255, 255, .70);
  --shadow: 0 24px 70px rgba(0, 50, 120, .14);
  --shadow-sm: 0 8px 24px rgba(0, 50, 120, .10);
  --green: #00a878;
  --blue: #006fcf;
  --gold: #d9820a;
  --red: #d94040;
  --theme-active-bg: rgba(0,111,207,.12);
  --theme-active-border: rgba(0,111,207,.4);
}

/* ===== HIGH CONTRAST THEME ===== */
[data-theme="contrast"] {
  --body-bg: #ffffff;
  --sidebar-bg: #000000;
  --sidebar-text: #ffffff;
  --sidebar-muted: rgba(255, 255, 255, .75);
  --sidebar-nav-hover: rgba(255, 255, 255, .15);
  --paper: #ffffff;
  --panel: #ffffff;
  --ink: #000000;
  --muted: #333333;
  --line: #000000;
  --table-bg: #ffffff;
  --table-head-bg: #f0f0f0;
  --table-head-ink: #000000;
  --row-hover: #f5f5f5;
  --input-bg: #ffffff;
  --pill-bg: #f0f0f0;
  --shadow: 0 4px 12px rgba(0,0,0,.25);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.20);
  --green: #006400;
  --blue: #00008b;
  --gold: #8b6914;
  --red: #8b0000;
  --theme-active-bg: rgba(0,0,0,.08);
  --theme-active-border: rgba(0,0,0,.5);
}

/* ===== RESET & BASE ===== */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--body-bg);
  transition: background .35s ease, color .25s ease;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }

/* ===== LAYOUT ===== */
.shell { display: grid; grid-template-columns: clamp(230px, 18vw, 280px) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow: auto;
  box-shadow: 10px 0 40px rgba(0, 0, 0, .18);
  transition: background .35s ease;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ===== BRAND / LOGO ===== */
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; }
.brand strong { display: block; font-size: 24px; letter-spacing: .02em; color: var(--sidebar-text); }
.brand span { color: var(--sidebar-muted); }

.logoBox {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #50c878, #f4c15d);
  color: #102117;
  font-weight: 800;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
  flex-shrink: 0;
}
.logoBox img { width: 100%; height: 100%; object-fit: cover; }
.logoBox:hover, .logoBox:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .28);
  outline: 0;
}

/* ===== NAVIGATION ===== */
nav { display: grid; gap: 8px; margin: 0 0 20px; }
.navBtn {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  color: var(--sidebar-muted);
  text-align: left;
  background: transparent;
  transition: transform .2s ease, background .2s ease, color .2s ease;
  font-weight: 500;
}
.navBtn:hover, .navBtn.active {
  transform: translateX(4px);
  background: var(--sidebar-nav-hover);
  color: var(--sidebar-text);
}

/* ===== THEME SWITCHER ===== */
.themeSection {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.10);
}
.themeLabel {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sidebar-muted);
  margin-bottom: 10px;
}
.themeGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.themeBtn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.themeBtn:hover { background: var(--sidebar-nav-hover); color: var(--sidebar-text); }
.themeBtn.active {
  background: var(--theme-active-bg);
  border-color: var(--theme-active-border);
  color: var(--sidebar-text);
}
.themeSwatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.2);
}
.swatchLight { background: linear-gradient(135deg, #f7fbf8, #50c878); }
.swatchDark  { background: linear-gradient(135deg, #0f1a14, #2dbd80); }
.swatchOcean { background: linear-gradient(135deg, #e8f4fd, #006fcf); }
.swatchContrast { background: linear-gradient(135deg, #fff 50%, #000 50%); }

.logoForm { display: none; }

/* ===== BUTTONS ===== */
.primary {
  padding: 11px 15px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 10px 24px rgba(31, 143, 95, .22);
  font-weight: 600;
  transition: transform .15s ease, box-shadow .15s ease;
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(31, 143, 95, .28); }
.ghost, .danger {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(38, 105, 217, .1);
  color: #164e9d;
}
[data-theme="dark"] .ghost { background: rgba(74,144,232,.15); color: #7ab8f5; }
[data-theme="ocean"] .ghost { background: rgba(0,111,207,.1); color: #0047ab; }
[data-theme="contrast"] .ghost { background: #e8e8e8; color: #000; border: 1px solid #000; }
.danger { background: rgba(217, 75, 61, .1); color: #a8281e; }
[data-theme="dark"] .danger { background: rgba(232,96,78,.15); color: #f08070; }
[data-theme="contrast"] .danger { background: #ffe0e0; color: #8b0000; border: 1px solid #8b0000; }

.iconBtn {
  width: 38px; height: 38px; padding: 0;
  display: inline-grid; place-items: center; flex: 0 0 auto;
}
.iconBtn svg {
  width: 19px; height: 19px; fill: none;
  stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.iconBtn:disabled { opacity: .42; cursor: not-allowed; }

/* ===== CONTENT ===== */
.content {
  min-width: 0;
  padding: clamp(16px, 2vw, 32px);
  transition: background .35s ease;
}
.topbar {
  display: flex; justify-content: space-between;
  gap: 20px; align-items: center; margin-bottom: 24px;
}
.eyebrow {
  margin: 0 0 6px; color: var(--green);
  font-weight: 800; text-transform: uppercase; font-size: 12px;
}
h1 { margin: 0; font-size: clamp(30px, 4vw, 54px); line-height: 1; color: var(--ink); }
h2, h3 { margin: 0; color: var(--ink); }
.ratePill {
  padding: 12px 16px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--pill-bg);
  color: var(--ink); white-space: nowrap;
  transition: background .25s ease, border-color .25s ease;
}

/* ===== VIEWS ===== */
.view { display: none; animation: enter .42s ease both; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ===== KPI CARDS ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi {
  min-height: 154px; padding: 20px; border-radius: 24px;
  color: #fff; display: grid; align-content: space-between;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi:after {
  content: ""; position: absolute; right: -36px; bottom: -46px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255, 255, 255, .18);
}
.kpi span, .kpi small { color: rgba(255, 255, 255, .80); font-size: 13px; }
.kpi strong { font-size: clamp(22px, 2.3vw, 34px); }
.accentA { background: linear-gradient(135deg, #197a52, #23a971); }
.accentB { background: linear-gradient(135deg, #c17a12, #e0aa3e); }
.accentC { background: linear-gradient(135deg, #1d5fbf, #42a5f5); }
.accentD { background: linear-gradient(135deg, #263238, #53636d); }

/* ===== PANELS ===== */
.panel {
  min-width: 0; padding: clamp(14px, 1.4vw, 20px);
  border: 1px solid var(--line); border-radius: 24px;
  background: var(--panel); box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transition: background .25s ease, border-color .25s ease;
}
.panelHead {
  display: flex; justify-content: space-between;
  gap: 14px; align-items: center; margin-bottom: 16px;
}
.panelHead h2 { font-size: 17px; }

/* ===== CHARTS GRID ===== */
.chartsGrid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.chartsGrid2 {
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
}
.chartPanel { display: flex; flex-direction: column; }
.chartWrap {
  position: relative;
  flex: 1;
  min-height: 220px;
  max-height: 280px;
}
.chartWrap canvas { width: 100% !important; height: 100% !important; }
.chartDonut { max-height: 260px; display: flex; align-items: center; justify-content: center; }
.chartDonut canvas { max-width: 260px; max-height: 260px; }

/* ===== DASHBOARD GRID ===== */
.dashboardGrid {
  display: grid;
  grid-template-columns: minmax(300px, .88fr) minmax(440px, 1.12fr);
  gap: 18px;
  margin-bottom: 0;
}
.dashboardGrid > *, .reportGrid > *, .view > .panel { min-width: 0; }

/* ===== TABLES ===== */
.tableWrap {
  max-width: 100%; overflow: auto; border-radius: 16px;
  border: 1px solid var(--line); -webkit-overflow-scrolling: touch;
}
table {
  width: 100%; border-collapse: collapse; min-width: 900px;
  background: var(--table-bg);
  transition: background .25s ease;
}
th, td {
  padding: 12px 13px; text-align: left;
  border-bottom: 1px solid var(--line); font-size: 13px;
  vertical-align: top; overflow-wrap: anywhere; word-break: normal;
  color: var(--ink);
}
th {
  position: sticky; top: 0;
  background: var(--table-head-bg); color: var(--table-head-ink); z-index: 1;
  transition: background .25s ease;
}
tr:hover td { background: var(--row-hover); }

/* Hover only — no row background coloring */
#daily tbody tr:hover td { background: var(--row-hover); }

#daily .actions .iconBtn {
  border: 1px solid var(--line);
  background: var(--pill-bg);
  color: var(--muted);
  box-shadow: none;
  backdrop-filter: blur(5px);
}
#daily .actions .danger { color: var(--red); }
#daily .actions .iconBtn:hover { background: var(--panel); color: var(--ink); }

/* Table sizing */
#daily table { min-width: 1260px; }
#maintenance table { min-width: 1120px; }
#dashboard .dashboardGrid .panel:nth-child(2) table { min-width: 560px; }

/* ===== BADGES & LINKS ===== */
.linkCell { min-width: 120px; }
.docLink {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 8px 11px; border-radius: 999px;
  color: #fff; background: linear-gradient(135deg, var(--blue), var(--green));
  font-weight: 700; text-decoration: none; white-space: nowrap;
  box-shadow: 0 8px 18px rgba(38, 105, 217, .16);
}
.mutedBadge {
  display: inline-flex; align-items: center; min-height: 30px;
  padding: 6px 10px; border-radius: 999px;
  color: var(--muted); background: var(--line);
  font-weight: 700; white-space: nowrap;
}
.statusBadge {
  display: inline-flex; align-items: center; min-height: 32px;
  padding: 7px 11px; border-radius: 999px; font-weight: 800;
  max-width: 100%; white-space: normal; line-height: 1.25;
}
.statusBadge.ok { color: #176342; background: rgba(31, 143, 95, .14); }
.statusBadge.warning { color: #8a5b00; background: rgba(217, 155, 33, .20); }
.statusBadge.danger { color: #9e261c; background: rgba(217, 75, 61, .16); }
[data-theme="dark"] .statusBadge.ok { color: #5edd9f; background: rgba(45,189,128,.15); }
[data-theme="dark"] .statusBadge.warning { color: #e0b84a; background: rgba(224,184,74,.12); }
[data-theme="dark"] .statusBadge.danger { color: #f08070; background: rgba(232,96,78,.14); }

/* ===== VEHICLE CARDS ===== */
.vehicleCards { display: grid; gap: 12px; }
.vehicleCard, .listItem {
  padding: 14px; border: 1px solid var(--line);
  border-radius: 18px; background: var(--panel);
  transition: background .25s ease;
}
.vehicleCard strong, .listItem strong { display: block; color: var(--ink); }
.vehicleCard small, .listItem small { overflow-wrap: anywhere; color: var(--muted); }
.progress {
  height: 9px; margin: 12px 0; border-radius: 99px;
  background: var(--line); overflow: hidden;
}
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--gold)); }

/* ===== REPORT ===== */
.reportControls { display: flex; gap: 10px; flex-wrap: wrap; }
.reportControls select {
  min-width: 130px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--input-bg); color: var(--ink); font-weight: 700;
}
.reportKpis { margin-top: 8px; }
.reportGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.reportGrid h3 { margin: 0 0 12px; font-size: 17px; color: var(--ink); }
.reportGrid table { min-width: 620px; }

/* ===== DAILY SUMMARY BAR ===== */
.dailySummary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background .25s ease;
  min-height: 46px;
}
.dailySummary:empty { display: none; }
.summaryItem {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.summaryItem .sumVal {
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
}
.summaryItem .sumVal.pos { color: var(--green); }
.summaryItem .sumVal.neg { color: var(--red); }
.summaryItem .sumVal.neutral { color: var(--blue); }
.summarySep {
  width: 1px;
  height: 20px;
  background: var(--line);
  flex-shrink: 0;
}
.summaryCount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink);
  font-weight: 800;
  font-size: 12px;
}

/* ===== CATEGORY BADGE (in table) ===== */
.catBadge {
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
  border: 1px solid transparent;
  max-width: 100%;
}

/* Dans le tableau daily : police encore plus petite sur grands écrans */
#daily .catBadge {
  font-size: 10px;
  padding: 3px 6px;
  gap: 3px;
}
.catBadge-green  { background: rgba(31,143,95,.13);  color: #176342; border-color: rgba(31,143,95,.2); }
.catBadge-teal   { background: rgba(0,168,120,.12);  color: #005d44; border-color: rgba(0,168,120,.2); }
.catBadge-blue   { background: rgba(38,105,217,.11); color: #1a4b9e; border-color: rgba(38,105,217,.2); }
.catBadge-bordeaux { background: rgba(94,24,42,.12); color: #5e182a; border-color: rgba(94,24,42,.2); }
.catBadge-red    { background: rgba(217,75,61,.11);  color: #9e261c; border-color: rgba(217,75,61,.2); }
.catBadge-gold   { background: rgba(217,155,33,.14); color: #7a5500; border-color: rgba(217,155,33,.2); }
.catBadge-purple { background: rgba(155,89,182,.11); color: #6c3483; border-color: rgba(155,89,182,.2); }
.catBadge-slate  { background: rgba(100,116,139,.10); color: #475569; border-color: rgba(100,116,139,.2); }

[data-theme="dark"] .catBadge-green    { background: rgba(45,189,128,.18); color: #5edd9f; }
[data-theme="dark"] .catBadge-teal     { background: rgba(0,200,170,.14); color: #00e5c0; }
[data-theme="dark"] .catBadge-blue     { background: rgba(74,144,232,.16); color: #7ab8f5; }
[data-theme="dark"] .catBadge-bordeaux { background: rgba(200,60,100,.18); color: #f08090; }
[data-theme="dark"] .catBadge-red      { background: rgba(232,96,78,.16);  color: #f08070; }
[data-theme="dark"] .catBadge-gold     { background: rgba(224,184,74,.16); color: #e0b84a; }
[data-theme="dark"] .catBadge-purple   { background: rgba(200,130,240,.15); color: #c890f0; }
[data-theme="dark"] .catBadge-slate    { background: rgba(150,170,200,.12); color: #96aac8; }

/* ===== CATEGORY GRID (settings page) ===== */
.catGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.catCard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  transition: background .2s ease, transform .18s ease, box-shadow .18s ease;
  border-left: 4px solid transparent;
}
.catCard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.catCardTop {
  display: flex;
  align-items: center;
  gap: 10px;
}
.catEmoji {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 20px;
  flex-shrink: 0;
  background: var(--line);
}
.catCardInfo { flex: 1; min-width: 0; }
.catCardInfo strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.catCardMeta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.catTypeBadge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.catTypeBadge.revenu    { background: rgba(31,143,95,.13); color: #176342; }
.catTypeBadge.depense   { background: rgba(217,75,61,.11); color: #9e261c; }
.catTypeBadge.entretien { background: rgba(38,105,217,.11); color: #1a4b9e; }
.catTypeBadge.autre     { background: rgba(100,116,139,.10); color: #475569; }
[data-theme="dark"] .catTypeBadge.revenu    { background: rgba(45,189,128,.18); color: #5edd9f; }
[data-theme="dark"] .catTypeBadge.depense   { background: rgba(232,96,78,.16); color: #f08070; }
[data-theme="dark"] .catTypeBadge.entretien { background: rgba(74,144,232,.16); color: #7ab8f5; }
[data-theme="dark"] .catTypeBadge.autre     { background: rgba(150,170,200,.12); color: #96aac8; }

.catUsageCount {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
}
.catCardActions { display: flex; gap: 8px; }
.catCardActions .ghost, .catCardActions .danger {
  flex: 1;
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
}

/* ===== DRIVER CARDS ===== */
.driverGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.driverCard {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, background .25s ease;
}
.driverCard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.driverCardTop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 14px;
}
.driverAvatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.02em;
}
.driverCardInfo { flex: 1; min-width: 0; }
.driverCardInfo strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.driverCardInfo .driverPhone {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.driverStatusBadge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
}
.driverStatusBadge.actif   { background: rgba(31,143,95,.13); color: #176342; }
.driverStatusBadge.inactif { background: rgba(217,75,61,.11); color: #9e261c; }
[data-theme="dark"] .driverStatusBadge.actif   { background: rgba(45,189,128,.18); color: #5edd9f; }
[data-theme="dark"] .driverStatusBadge.inactif { background: rgba(232,96,78,.16); color: #f08070; }

.driverStats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.driverStat {
  padding: 10px 14px;
  text-align: center;
  border-right: 1px solid var(--line);
}
.driverStat:last-child { border-right: 0; }
.driverStat .statVal {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.driverStat .statLabel {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 2px;
}
.driverCardDocs {
  padding: 10px 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.driverDocPill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.driverDocPill.present {
  background: rgba(38,105,217,.11);
  color: var(--blue);
  border: 1px solid rgba(38,105,217,.2);
}
.driverDocPill.absent {
  background: var(--line);
  color: var(--muted);
  cursor: default;
}
[data-theme="dark"] .driverDocPill.present { background: rgba(74,144,232,.15); color: #7ab8f5; }
.driverCardActions {
  display: flex;
  gap: 0;
  border-top: 0;
}
.driverCardActions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  border-top: 1px solid var(--line);
  transition: background .18s ease, color .18s ease;
}
.driverCardActions button:first-child { border-right: 1px solid var(--line); border-radius: 0 0 0 20px; }
.driverCardActions button:last-child { border-radius: 0 0 20px 0; }
.driverCardActions button:hover { background: var(--row-hover); color: var(--ink); }
.driverCardActions button.dangerBtn:hover { background: rgba(217,75,61,.08); color: var(--red); }

/* ===== VEHICLE CARDS ===== */
.vehicleGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.vehicleSettingCard {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, background .25s ease;
}
.vehicleSettingCard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.vehicleCardHeader {
  padding: 18px 18px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.vehiclePlateTag {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(31,143,95,.22);
}
.vehicleCardMeta { flex: 1; min-width: 0; }
.vehicleCardMeta strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vehicleCardMeta .vehicleModel {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.vehicleStatusDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.vehicleStatusDot.actif   { background: var(--green); box-shadow: 0 0 0 3px rgba(31,143,95,.18); }
.vehicleStatusDot.inactif { background: var(--red);   box-shadow: 0 0 0 3px rgba(217,75,61,.16); }

.vehicleMetrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.vehicleMetric {
  padding: 12px 16px;
  border-right: 1px solid var(--line);
}
.vehicleMetric:last-child { border-right: 0; }
.vehicleMetric .metricLabel {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.vehicleMetric .metricVal {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.vehicleMetric .metricSub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.vehicleNotes {
  padding: 10px 18px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vehicleNotes:empty { display: none; }
.vehicleAmortProgress {
  padding: 10px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.vehicleAmortLabel {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.vehicleAmortLabel span:last-child { font-weight: 800; color: var(--ink); }
.vehicleCardActions {
  display: flex;
}
.vehicleCardActions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  border-top: 1px solid var(--line);
  transition: background .18s ease, color .18s ease;
}
.vehicleCardActions button:first-child { border-right: 1px solid var(--line); border-radius: 0 0 0 20px; }
.vehicleCardActions button:last-child { border-radius: 0 0 20px 0; }
.vehicleCardActions button:hover { background: var(--row-hover); color: var(--ink); }
.vehicleCardActions button.dangerBtn:hover { background: rgba(217,75,61,.08); color: var(--red); }

/* ===== SETTINGS LISTS ===== */
.list { display: grid; gap: 10px; }
.compact .listItem { padding: 10px 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== PAGE SIZE SELECTOR ===== */
.pageSizeSelect {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== FILTERS ===== */
.filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 12px; align-items: end; margin-bottom: 16px;
}
.filters .field { min-width: 0; }
.resetFilter { min-height: 45px; white-space: nowrap; }

/* ===== FORM FIELDS ===== */
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 13px;
  border: 1px solid var(--line); border-radius: 13px;
  background: var(--input-bg); color: var(--ink);
  transition: background .25s ease, border-color .25s ease;
}
.field textarea { min-height: 88px; resize: vertical; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex; justify-content: space-between;
  align-items: center; gap: 14px; margin-top: 14px;
  color: var(--muted); font-weight: 700;
}
.pagination > div { display: flex; align-items: center; gap: 10px; }
.pagination strong { color: var(--ink); }

/* ===== MODAL ===== */
dialog { border: 0; padding: 0; background: transparent; width: min(760px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(11, 18, 14, .46); backdrop-filter: blur(8px); }
.modalCard {
  position: relative; padding: 24px; border-radius: 24px;
  background: var(--paper); box-shadow: var(--shadow);
  transition: background .25s ease;
}
.close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; background: var(--line); color: var(--ink); }
.formGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
menu { padding: 0; margin: 0; display: flex; justify-content: flex-end; gap: 10px; }
menu button:not(.primary) { padding: 11px 15px; border-radius: 12px; background: var(--line); color: var(--ink); }

/* ===== TOAST ===== */
.toast {
  position: fixed; right: 22px; bottom: 22px;
  padding: 13px 16px; border-radius: 14px;
  color: #fff; background: var(--ink);
  opacity: 0; transform: translateY(12px);
  transition: .22s ease; z-index: 9999; font-weight: 600;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== GUIDE ===== */
.guide { max-width: 880px; line-height: 1.7; }
.guide h2 { margin-bottom: 14px; }
.guide h3 { margin-top: 22px; color: var(--green); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .dashboardGrid, .reportGrid, .chartsGrid, .chartsGrid2 { grid-template-columns: 1fr; }
  .themeSection { margin-top: 20px; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .resetFilter { width: 100%; }
}

@media (min-width: 1101px) {
  #daily .tableWrap, #monthly .tableWrap { overflow-x: visible; }
  #daily table, #monthly table { width: 100%; min-width: 0; table-layout: fixed; }
  #daily th, #daily td { padding: 7px 5px; font-size: 10.5px; line-height: 1.24; }
  #daily th { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
  #daily th:nth-child(1), #daily td:nth-child(1)  { width: 8%; }
  #daily th:nth-child(2), #daily td:nth-child(2)  { width: 11%; }
  #daily th:nth-child(3), #daily td:nth-child(3)  { width: 9%; }
  #daily th:nth-child(4), #daily td:nth-child(4)  { width: 13%; }
  #daily th:nth-child(5), #daily td:nth-child(5)  { width: 9%; }
  #daily th:nth-child(6), #daily td:nth-child(6)  { width: 10%; }
  #daily th:nth-child(7), #daily td:nth-child(7)  { width: 10%; }
  #daily th:nth-child(8), #daily td:nth-child(8)  { width: 13%; }
  #daily th:nth-child(9), #daily td:nth-child(9)  { width: 8%; }
  #daily th:nth-child(10), #daily td:nth-child(10) { width: 8%; }
  #daily th:nth-child(11), #daily td:nth-child(11) { width: 8%; }
  #daily .actions { gap: 4px; flex-wrap: nowrap; }
  #daily .iconBtn { width: 28px; height: 28px; }
  #daily .iconBtn svg { width: 15px; height: 15px; }
  #daily .docLink, #daily .mutedBadge {
    min-height: 0; padding: 5px 6px; font-size: 10px;
    line-height: 1.15; white-space: normal;
  }
  #monthly th, #monthly td { padding: 9px 10px; font-size: 12px; line-height: 1.25; }
}

@media (min-width: 1500px) {
  .dashboardGrid { grid-template-columns: minmax(360px, .82fr) minmax(520px, 1.18fr); }
  .panel { padding: 24px; }
  th, td { padding: 13px 15px; }
  #daily th, #daily td { padding: 8px 6px; font-size: 11.5px; }
  #monthly th, #monthly td { padding: 10px 12px; font-size: 12.5px; }
  .chartWrap { min-height: 260px; max-height: 320px; }
}

@media (min-width: 1101px) and (max-width: 1499px) {
  .sidebar { padding: 18px; }
  .brand strong { font-size: 20px; }
  .navBtn { padding: 11px 12px; font-size: 13px; }
  .content { padding: 16px; }
  h1 { font-size: 38px; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .kpi { min-height: 126px; padding: 16px; }
  .kpi strong { font-size: 24px; }
  .panel { padding: 15px; border-radius: 18px; }
  .panelHead h2 { font-size: 15px; }
  th, td { padding: 8px 9px; font-size: 11px; line-height: 1.3; overflow-wrap: anywhere; }
  table { min-width: 760px; }
  #daily th, #daily td { padding: 6px 4px; font-size: 9.2px; line-height: 1.22; }
  #maintenance table { min-width: 940px; }
  .docLink, .mutedBadge, .statusBadge { font-size: 11px; padding: 6px 8px; }
  #daily .docLink, #daily .mutedBadge { min-height: 0; padding: 4px 5px; font-size: 9px; }
  .docLink, .mutedBadge { white-space: normal; line-height: 1.2; }
  .iconBtn { width: 32px; height: 32px; }
  #daily .iconBtn { width: 24px; height: 24px; }
  #daily .iconBtn svg { width: 14px; height: 14px; }
  #daily .actions { gap: 3px; }
  #monthly th, #monthly td { padding: 7px 8px; font-size: 10.8px; }
  .filters { gap: 9px; }
  .field input, .field select, .field textarea { padding: 10px 11px; }
}

@media (max-width: 900px) {
  .brand { margin-bottom: 18px; }
  .sidebar { padding-bottom: 18px; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .navBtn { padding: 12px; border-radius: 12px; text-align: center; }
  .panelHead { align-items: flex-start; flex-direction: column; }
  .panelHead .primary { width: 100%; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { align-items: flex-start; }
  .ratePill { border-radius: 14px; }
  .themeGrid { grid-template-columns: repeat(4, 1fr); }
  .themeBtn { flex-direction: column; gap: 4px; font-size: 10px; padding: 8px 4px; }
}

@media (max-width: 700px) {
  .content, .sidebar { padding: 18px; }
  .topbar { display: grid; }
  nav { grid-template-columns: 1fr; }
  .formGrid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination > div { justify-content: space-between; }
  .panel { padding: 16px; border-radius: 18px; }
  .kpi { min-height: 132px; border-radius: 18px; }
  .brand strong { font-size: 20px; }
  h1 { font-size: 32px; }
  table { min-width: 680px; }
  #daily table { min-width: 1080px; }
  #maintenance table { min-width: 980px; }
  #dashboard .dashboardGrid .panel:nth-child(2) table { min-width: 540px; }
  .chartWrap { min-height: 180px; max-height: 220px; }
}

@media (max-width: 420px) {
  .content, .sidebar { padding: 14px; }
  .panel { padding: 14px; }
  .kpis { grid-template-columns: 1fr; }
  .primary, .ghost, .danger { width: 100%; }
  .actions .iconBtn, .pagination .iconBtn { width: 38px; }
  menu { flex-direction: column-reverse; }
  th, td { padding: 10px 9px; font-size: 12px; }
  #daily table { min-width: 980px; }
  #maintenance table { min-width: 900px; }
  #dashboard .dashboardGrid .panel:nth-child(2) table { min-width: 500px; }
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.loginBody {
  margin: 0; min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7fbf8;
}

.loginLayout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* ===== LEFT PANEL ===== */
.loginLeft {
  position: relative;
  background: linear-gradient(145deg, #12241a 0%, #1a3427 45%, #152d20 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  overflow: hidden;
  color: #fff;
}

.loginWavesSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.loginBrand {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}
.loginLogoBox {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #50c878, #f4c15d);
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: #102117;
  flex-shrink: 0;
}
.loginBrand strong { display: block; font-size: 22px; font-weight: 800; color: #fff; }
.loginBrand span   { color: rgba(255,255,255,.55); font-size: 13px; }

.loginHero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 60px 0 20px;
}

.loginSecureBadge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid rgba(80, 200, 120, .4);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  color: #50c878;
  background: rgba(80, 200, 120, .1);
  width: fit-content;
  margin-bottom: 24px;
}

.loginHeadline {
  font-size: clamp(28px, 3.5vw, 48px);
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  margin: 0 0 18px;
}

.loginSub {
  font-size: 15px;
  color: rgba(255,255,255,.6);
  line-height: 1.65;
  margin: 0;
  max-width: 400px;
}

.loginPills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.loginPill {
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.06);
}

/* ===== RIGHT PANEL ===== */
.loginRight {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 48px;
  background: #f7fbf8;
}

.loginCard {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 28px;
  padding: 40px 36px 32px;
  box-shadow: 0 32px 80px rgba(20, 40, 30, .13);
}

.loginEyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #23a971;
}

.loginTitle {
  margin: 0 0 28px;
  font-size: 26px;
  font-weight: 800;
  color: #17211b;
}

.loginErrorMsg {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(217, 75, 61, .1);
  border: 1px solid rgba(217, 75, 61, .22);
  color: #9e261c;
  font-size: 13px;
  font-weight: 600;
}

.loginForm { display: grid; gap: 16px; }

.loginField { display: grid; gap: 7px; }
.loginField label {
  font-size: 13px;
  font-weight: 700;
  color: #66736c;
}
.loginField input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid rgba(23, 33, 27, .15);
  border-radius: 14px;
  font-size: 14px;
  color: #17211b;
  background: #fff;
  font-family: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
  outline: none;
}
.loginField input:focus {
  border-color: #23a971;
  box-shadow: 0 0 0 3px rgba(35, 169, 113, .16);
}

.loginSubmitBtn {
  margin-top: 4px;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 0;
  background: linear-gradient(135deg, #1f8f5f, #23a971);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 10px 28px rgba(31, 143, 95, .28);
}
.loginSubmitBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(31, 143, 95, .36);
}

.loginDivider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: #a0ada6;
  font-size: 12px;
  font-weight: 600;
}
.loginDivider::before, .loginDivider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(23,33,27,.1);
}

.loginGoogleBtn {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(23,33,27,.15);
  background: #fff;
  color: #66736c;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: not-allowed;
  opacity: .55;
}

.loginGoogleNote {
  margin: 12px 0 0;
  font-size: 11px;
  color: #a0ada6;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 860px) {
  .loginLayout { grid-template-columns: 1fr; }
  .loginLeft   { min-height: 340px; padding: 32px 28px; }
  .loginHero   { padding: 30px 0 10px; }
  .loginHeadline { font-size: 28px; }
  .loginRight  { padding: 32px 20px; }
}

/* ================================================================
   SIDEBAR USER & LOGOUT
   ================================================================ */
.sidebarUser {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 0 0;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebarUserAvatar {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #50c878, #f4c15d);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #102117;
  flex-shrink: 0;
}
.sidebarUserInfo { flex: 1; min-width: 0; }
.sidebarUserInfo strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebarUserRole {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 2px;
}
.sidebarUserRole.admin       { background: rgba(244,193,93,.2); color: #f4c15d; }
.sidebarUserRole.superviseur { background: rgba(80,200,120,.15); color: #50c878; }

.logoutLink {
  display: block;
  margin-top: 12px;
  padding: 10px;
  border-radius: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.45);
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
  border: 1px solid rgba(255,255,255,.08);
}
.logoutLink:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ================================================================
   USERS GRID
   ================================================================ */
.userGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.userCard {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, background .25s ease;
}
.userCard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.userCardTop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 14px;
}
.userCardInfo { flex: 1; min-width: 0; }
.userCardInfo strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.userUsername {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 500;
}

.rolePill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  white-space: nowrap;
}
.rolePill.admin       { background: rgba(244,193,93,.18); color: #a07018; }
.rolePill.superviseur { background: rgba(38,105,217,.11); color: #1a4b9e; }
[data-theme="dark"] .rolePill.admin       { background: rgba(244,193,93,.18); color: #f4c15d; }
[data-theme="dark"] .rolePill.superviseur { background: rgba(74,144,232,.16); color: #7ab8f5; }

.userMeta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 18px 14px;
  border-top: 1px solid var(--line);
}
.userLastLogin {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.userCardActions {
  display: flex;
  border-top: 1px solid var(--line);
}
.userCardActions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-right: 1px solid var(--line);
  transition: background .18s ease, color .18s ease;
  font-family: inherit;
  cursor: pointer;
}
.userCardActions button:last-child { border-right: 0; border-radius: 0 0 20px 0; }
.userCardActions button:first-child { border-radius: 0 0 0 20px; }
.userCardActions button:only-child  { border-radius: 0 0 20px 20px; }
.userCardActions button:hover       { background: var(--row-hover); color: var(--ink); }
.userCardActions button.dangerBtn:hover { background: rgba(217,75,61,.08); color: var(--red); }
.userCardActions button:disabled    { opacity: .4; cursor: not-allowed; }

/* ================================================================
   CLICKABLE LINK CELLS (daily tracking)
   ================================================================ */
.linkCellActive {
  cursor: pointer;
  transition: background .15s ease;
}
.linkCellActive:hover { background: var(--row-hover) !important; }

/* ================================================================
   REPORT PANEL CONTROLS (print button)
   ================================================================ */
.reportPanelControls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.printBtn {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
}

/* ================================================================
   PRINT / PDF STYLES
   ================================================================ */
@media print {
  /* Hide everything except the monthly report */
  .sidebar,
  .topbar,
  .reportPanelControls,
  .panelHead button,
  .panelHead .printBtn,
  #daily, #dashboard, #maintenance,
  #drivers, #vehicles, #categories, #users, #guide { display: none !important; }

  body, .shell { display: block !important; background: #fff !important; }
  .content { padding: 0 !important; }
  .view  { display: none !important; }
  #monthly { display: block !important; }
  #monthly .panel { box-shadow: none !important; border: 1px solid #ddd !important; border-radius: 12px !important; }
  .kpi { print-color-adjust: exact; -webkit-print-color-adjust: exact; border-radius: 12px !important; }
  .tableWrap { overflow: visible !important; border: 1px solid #ddd !important; border-radius: 8px !important; }
  table { min-width: 0 !important; }
  .reportGrid { grid-template-columns: 1fr !important; }

  @page { margin: 1.5cm; size: A4; }
}
