/*  Car Running Cost Tracker - interface styling
    Same dark palette as the other apps in this folder, so the fleet looks
    like one set of tools rather than six unrelated pages.  */

/*  Dubai Property Snagging palette, on white.
    Deep Teal #0E5D74 / Teal #0EA5D6 / Navy #083D4D / Aqua #E6F6F4 /
    Text Gray #333F48 / Light Gray #F5F7F9 / Orange #F39C12 / Green #28B463  */

:root {
  --bg: #f5f7f9;
  --bg-raised: #ffffff;
  --bg-raised-2: #eef3f6;
  --line: #dbe3e9;
  --line-soft: #eaf0f4;
  --text: #333f48;
  --text-dim: #5c6b75;
  --text-faint: #8a97a1;

  --accent: #0e5d74;          /* deep teal - primary action */
  --accent-dim: #0e5d74;
  --accent-strong: #083d4d;   /* navy - hover */
  --accent-soft: #e6f6f4;     /* aqua - tinted backgrounds */
  --brand-teal: #0ea5d6;

  --blue: #0ea5d6;
  --amber: #f39c12;
  --red: #d64545;
  --green: #28b463;
  --violet: #7b5ea7;

  --radius: 10px;
  --shadow: 0 10px 30px rgba(8, 61, 77, .10);
  --shadow-soft: 0 1px 2px rgba(8, 61, 77, .06), 0 1px 3px rgba(8, 61, 77, .04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }

/* Panels below set an explicit `display`, which would otherwise beat the
   browser's own rule for [hidden] and leave hidden things on screen. */
[hidden] { display: none !important; }
code { background: var(--bg-raised-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* ---------------- top bar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: linear-gradient(180deg, #ffffff, #f7fafb);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 13px; }

.brand-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(14, 165, 214, .18);
  flex: none;
}

.topbar h1 { font-size: 16px; font-weight: 620; letter-spacing: .2px; }
.brand-sub { margin: 1px 0 0; font-size: 12px; color: var(--text-faint); }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }

.tab {
  background: none; border: 0; cursor: pointer;
  padding: 6px 14px; border-radius: 6px;
  color: var(--text-dim); font-weight: 560; font-size: 13px;
}
.tab:hover { color: var(--text); background: var(--bg-raised-2); }
.tab.is-active { background: var(--bg-raised-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------------- buttons ---------------- */

.btn {
  background: var(--bg-raised-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 560;
  font-size: 13px;
  white-space: nowrap;
}
.btn:hover { border-color: #b9c8d2; background: #e4ecf1; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn-danger-ghost { background: transparent; border-color: #f0c9c9; color: var(--red); }
.btn-danger-ghost:hover { background: #fdeeee; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.icon-btn {
  background: none; border: 0; color: var(--text-dim);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 8px; border-radius: 6px;
}
.icon-btn:hover { color: var(--text); background: var(--bg-raised-2); }

/* ---------------- layout ---------------- */

main { padding: 20px 22px 60px; max-width: 1440px; margin: 0 auto; }
.view { display: none; }
.view.is-active { display: block; }
.view-title { font-size: 15px; font-weight: 620; }

.toolbar {
  display: flex; align-items: flex-end; gap: 12px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.quick-range { display: flex; gap: 6px; margin-left: auto; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 11.5px; color: var(--text-faint); font-weight: 560; letter-spacing: .3px; text-transform: uppercase; }
.field > span em { font-style: normal; color: var(--text-dim); }
.field.grow { flex: 1 1 200px; }
.field input, .field select {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 120px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent-dim); box-shadow: 0 0 0 3px rgba(14, 93, 116, .12); }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field.checkbox input { min-width: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.field.checkbox span { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text-dim); }

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}
.panel.narrow { max-width: 620px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 14px; font-weight: 620; }
.panel-note { font-size: 12px; color: var(--text-faint); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.hint { color: var(--text-faint); font-size: 12.5px; margin: 10px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.form-grid .field.grow { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.save-note { font-size: 12.5px; color: var(--accent); }

/* ---------------- KPI cards ---------------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }

.kpi {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px 14px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--bar, var(--accent));
}
.kpi-label { font-size: 11.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .4px; font-weight: 560; }
.kpi-value { font-size: 23px; font-weight: 660; margin-top: 4px; letter-spacing: -.4px; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--text-dim); margin-left: 3px; }
.kpi-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.kpi-sub .up { color: var(--red); }
.kpi-sub .down { color: var(--accent); }

/* ---------------- reminders ---------------- */

.reminders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }

.reminder {
  display: flex; align-items: center; gap: 11px;
  background: var(--bg-raised-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--text-faint);
  border-radius: 8px;
  padding: 10px 12px;
}
.reminder.overdue { border-left-color: var(--red); background: #fdf2f2; }
.reminder.soon { border-left-color: var(--amber); background: #fdf6e9; }
.reminder.ok { border-left-color: var(--accent); }
.reminder.unknown { border-left-color: var(--text-faint); }
.reminder-icon { font-size: 18px; flex: none; }
.reminder-body { min-width: 0; }
.reminder-car { font-weight: 600; font-size: 13.5px; }
.reminder-text { font-size: 12px; color: var(--text-dim); }
.reminder.overdue .reminder-text { color: #b03030; }
.reminder.soon .reminder-text { color: #8a6412; }

/* ---------------- charts ---------------- */

.chart-wrap { width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-wrap > div:first-child { flex: none; width: 190px; }

.legend { display: flex; flex-direction: column; gap: 6px; flex: 1 1 160px; min-width: 150px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-label { color: var(--text-dim); flex: 1; }
.legend-value { font-variant-numeric: tabular-nums; font-weight: 560; }

.bar-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.bar-row:last-child { border-bottom: 0; }
.bar-name { width: 160px; flex: none; font-size: 13px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 20px; background: var(--bg-raised-2); border-radius: 5px; overflow: hidden; display: flex; min-width: 60px; }
.bar-seg { height: 100%; }
.bar-total { width: 110px; flex: none; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-meta { width: 130px; flex: none; text-align: right; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .bar-name { width: 110px; }
  .bar-meta { display: none; }
}

/* ---------------- cars ---------------- */

.car-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }

.car-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.car-card.retired { opacity: .6; }
.car-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.car-name { font-size: 15px; font-weight: 640; }
.car-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.car-plate {
  display: inline-block; margin-top: 6px;
  background: var(--bg-raised-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 8px;
  font-size: 12px; letter-spacing: .5px; font-weight: 600; color: var(--text-dim);
}

.car-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.car-stat { background: var(--bg-raised-2); border-radius: 7px; padding: 8px 10px; }
.car-stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-faint); }
.car-stat-value { font-size: 15px; font-weight: 620; margin-top: 2px; font-variant-numeric: tabular-nums; }
.car-stat-value small { font-size: 11px; color: var(--text-dim); font-weight: 500; }

.car-split { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--bg-raised-2); }
.car-split span { height: 100%; }

.car-oil {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; padding: 8px 10px; border-radius: 7px;
  background: var(--bg-raised-2); border-left: 3px solid var(--text-faint);
}
.car-oil.overdue { border-left-color: var(--red); color: #b03030; }
.car-oil.soon { border-left-color: var(--amber); color: #8a6412; }
.car-oil.ok { border-left-color: var(--accent); color: var(--text-dim); }
.car-oil.unknown { color: var(--text-faint); }

.car-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 2px; }

/* ---------------- tables ---------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-faint); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-raised-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.dim { color: var(--text-faint); }
.nowrap { white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 560;
  border: 1px solid transparent; white-space: nowrap;
}

.empty { padding: 34px 10px; text-align: center; color: var(--text-faint); }
.empty strong { display: block; color: var(--text-dim); margin-bottom: 4px; font-size: 14px; }

.records-summary {
  display: flex; gap: 22px; flex-wrap: wrap;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 14px;
}
.records-summary div { font-size: 12.5px; color: var(--text-faint); }
.records-summary strong { display: block; font-size: 17px; color: var(--text); font-weight: 640; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------------- modal ---------------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 61, 77, .38);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: 100%; max-width: 720px;
  padding: 18px 20px 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { font-size: 16px; font-weight: 640; }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.modal-actions .spacer { flex: 1; }

.type-picker { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.type-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-raised-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 6px 13px; cursor: pointer;
  font-size: 12.5px; font-weight: 560; color: var(--text-dim);
}
.type-chip:hover { color: var(--text); }
.type-chip.is-active { color: #ffffff; font-weight: 640; border-color: transparent; }

.fuel-only.is-hidden { display: none; }

/* ---------------- toast ---------------- */

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--bg-raised); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow);
  padding: 11px 18px; border-radius: 9px; z-index: 120; font-size: 13px;
}
.toast[hidden] { display: none; }
.toast.bad { border-left-color: var(--red); }

/* ---------------- sign-in screen ---------------- */

.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background: radial-gradient(1100px 600px at 50% -10%, #e6f6f4, var(--bg));
}

.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
}
.login-head { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.login-head h1 { font-size: 16px; font-weight: 620; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; margin-top: 4px; }
.login-error {
  margin: 0; padding: 9px 12px; border-radius: 8px; font-size: 13px;
  background: #fdeeee; border: 1px solid #f0c9c9; color: #b03030;
}
.login-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

/* ---------------- who is signed in ---------------- */

.whoami { display: flex; align-items: center; gap: 9px; padding-left: 10px; border-left: 1px solid var(--line); }
.whoami-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.whoami-role { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .4px; }

.role-hidden { display: none !important; }

.default-pass-warning {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fdf6e9; border: 1px solid #f2d9a8;
  border-radius: var(--radius); padding: 11px 16px; margin-bottom: 16px;
  font-size: 13px; color: #8a6412;
}

/* ---------------- the driver's float ---------------- */

.float-banner {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-raised));
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px;
}
.float-banner.low { border-left-color: var(--amber); }
.float-banner.over { border-left-color: var(--red); }
.float-main { display: flex; flex-direction: column; }
.float-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-faint); font-weight: 560; }
.float-value { font-size: 27px; font-weight: 680; letter-spacing: -.5px; line-height: 1.15; }
.float-banner.low .float-value { color: var(--amber); }
.float-banner.over .float-value { color: var(--red); }
.float-parts { display: flex; gap: 22px; flex-wrap: wrap; }
.float-part { font-size: 12px; color: var(--text-faint); }
.float-part strong { display: block; font-size: 15px; color: var(--text); font-weight: 620; margin-top: 2px; font-variant-numeric: tabular-nums; }
.float-note { margin-left: auto; font-size: 12px; color: var(--text-faint); max-width: 280px; }

/* ---------------- drivers ---------------- */

.driver-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }

.driver-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.driver-card.inactive { opacity: .55; }
.driver-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.driver-name { font-size: 15px; font-weight: 640; }
.driver-user { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
  background: var(--bg-raised-2); border: 1px solid var(--line); color: var(--text-dim);
}
.badge.admin { background: #f1ecf9; border-color: #d9cdee; color: var(--violet); }
.badge.auto { background: var(--accent-soft); border-color: #b6dfd9; color: var(--accent); }

.driver-float { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.driver-float > div { background: var(--bg-raised-2); border-radius: 7px; padding: 8px 10px; }
.driver-float .car-stat-value.neg { color: var(--red); }
.driver-float .car-stat-value.low { color: var(--amber); }

.driver-cars { font-size: 12px; color: var(--text-faint); }
.driver-cars strong { color: var(--text-dim); font-weight: 560; }
.driver-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.car-check-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 7px; grid-column: 1 / -1;
  background: var(--bg-raised-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 12px;
}
.car-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.car-check input { width: 15px; height: 15px; accent-color: var(--accent); }

/* ---------------- telegram panel ---------------- */

.tg-status {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--text-dim);
  background: var(--bg-raised-2); border-radius: 8px; padding: 9px 12px; margin-top: 14px;
}
.tg-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.tg-status.good .dot { background: var(--accent); box-shadow: 0 0 8px rgba(53, 208, 165, .7); }
.tg-status.bad .dot { background: var(--red); }

.tg-log { margin-top: 12px; font-size: 12px; }
.tg-log-row { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); color: var(--text-faint); }
.tg-log-row:last-child { border-bottom: 0; }
.tg-log-row .ok { color: var(--accent); }
.tg-log-row .fail { color: var(--red); }

/* ---------------- telegram recipients ---------------- */

.recipients { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.recipients-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 11px;
}
.recipients-head > span {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-faint); font-weight: 600;
}

.recipient {
  display: flex; align-items: center; gap: 11px;
  background: var(--bg-raised-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 12px; margin-bottom: 7px;
}
.recipient.off { opacity: .5; }
.recipient input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.recipient-name { font-weight: 600; font-size: 13.5px; }
.recipient-id { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.recipient-body { flex: 1; min-width: 0; }

.recipient-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.recipient-add input {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; outline: none; flex: 1 1 150px; min-width: 120px;
}
.recipient-add input:focus { border-color: var(--accent-dim); }

/* ---------------- small screens ----------------
   Drivers get the dedicated phone app, but an admin checking the dashboard
   from a phone should still be able to read and use it. */

@media (max-width: 780px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar h1 { font-size: 15px; }
  /* Only the header subtitle - the login card still wants its one. */
  .topbar .brand-sub { display: none; }

  /* The tab strip scrolls sideways rather than wrapping into a tall block
     that pushes the whole dashboard off the screen. */
  .tabs {
    order: 3; width: 100%;
    overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }

  .topbar-right { gap: 8px; width: 100%; justify-content: space-between; }
  .whoami { padding-left: 0; border-left: 0; margin-left: auto; }

  main { padding: 14px 14px 48px; }

  .kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; }
  .kpi { padding: 11px 12px 12px; }
  .kpi-value { font-size: 20px; }

  .toolbar { gap: 9px; }
  .field input, .field select { min-width: 0; width: 100%; }
  .field { flex: 1 1 130px; }
  .quick-range { margin-left: 0; width: 100%; }
  .quick-range .btn { flex: 1; }

  .panel { padding: 13px 14px 15px; }
  .grid-2 { gap: 14px; }
  .donut-wrap { justify-content: center; }

  .car-grid, .driver-grid { grid-template-columns: 1fr; }
  .reminders { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }

  .bar-name { width: 92px; font-size: 12px; }
  .bar-total { width: 78px; font-size: 13px; }

  .modal-backdrop { padding: 12px; align-items: flex-start; }
  .modal { padding: 15px 16px 17px; border-radius: 12px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }

  .records-summary { gap: 14px; padding: 11px 14px; }
  /* Tables stay readable by scrolling sideways instead of squashing. */
  .table-wrap table { min-width: 620px; }
}

/* ---------------- the bell ---------------- */

.bell-btn { position: relative; padding: 6px 10px; font-size: 15px; }
.bell-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red); color: #fff; border: 2px solid var(--bg-raised);
  border-radius: 9px; font-size: 10.5px; font-weight: 700; line-height: 14px;
}

.bell-panel {
  position: fixed; top: 64px; right: 18px; z-index: 80;
  width: min(380px, calc(100vw - 36px));
  max-height: 70vh; overflow-y: auto;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.bell-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: var(--bg-raised); border-radius: 12px 12px 0 0;
}
.bell-list { padding: 6px; }
.bell-item {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 10px; border-radius: 9px; font-size: 13.5px;
}
.bell-item + .bell-item { border-top: 1px solid var(--line-soft); }
.bell-item.unread { background: #f2fafc; }
.bell-icon { font-size: 17px; flex: none; }

/* ---------------- share link row ---------------- */

.share-link { display: flex; gap: 8px; flex-wrap: wrap; }
.share-link input {
  flex: 1 1 220px; min-width: 0;
  background: var(--bg-raised-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 11px; font-size: 13px; color: var(--text-dim);
}

/* ---------------- brand logo ---------------- */

.brand-logo {
  width: 34px; height: 34px; flex: none;
  border-radius: 8px; display: block;
}
.login-head .brand-logo { width: 44px; height: 44px; border-radius: 10px; }

/* ---------------- tomorrow's inspections ---------------- */

.sched-summary {
  background: var(--accent-soft); border: 1px solid #c9e6e2;
  border-radius: 9px; padding: 11px 14px; margin-bottom: 14px;
}
.sched-summary strong { color: var(--accent-strong); font-size: 14px; }

.sched-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }

.sched-card {
  background: var(--bg-raised-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
}
.sched-head {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 9px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.sched-head .dim { font-size: 12px; }

.sched-job { display: flex; gap: 10px; padding: 6px 0; font-size: 13px; align-items: flex-start; }
.sched-job + .sched-job { border-top: 1px solid var(--line-soft); }
.sched-time {
  flex: none; width: 92px; font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--accent);
}
