:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  --ink: #162033;
  --muted: #59647a;
  --line: #e0e5ef;
  --blue: #234abb;
  --radius: 12px;
  color: var(--ink);
  background: #f4f5f8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .65; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.1; letter-spacing: -.045em; }
h2 { font-size: 1.125rem; letter-spacing: -.015em; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner, .page { max-width: 1440px; margin-inline: auto; padding-inline: clamp(18px, 4vw, 60px); }
.topbar-inner, .intro, .report-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar-inner { min-height: 68px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: -.01em; }
.mark { width: 36px; height: 36px; display: grid; place-items: center; background: #203963; color: #fff; border-radius: 9px; flex: none; }
.mark svg { width: 24px; height: 24px; }
.page { padding-block: clamp(28px, 5vw, 58px); }
.intro { flex-wrap: wrap; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.period, .report-actions { display: flex; align-items: center; gap: 10px; }
.period select { cursor: pointer; }
.toolbar, .source-heading { display: flex; gap: 8px; align-items: center; }
.source-heading { justify-content: space-between; }
.source-heading h3 { margin: 0; font-size: 1rem; }
.source-heading span, .subtle { color: var(--muted); font-size: .875rem; }
.subtle { margin-top: 12px; }
.source-settings { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; display: grid; gap: 12px; }
.source-actions { display: flex; justify-content: end; gap: 8px; flex-wrap: wrap; }
.threshold-control { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.threshold-control + .subtle { margin-top: 0; }
.fields label.confirmation { align-items: center; flex-direction: row; gap: 9px; }
.fields label.confirmation input { width: 16px; height: 16px; min-height: 16px; accent-color: var(--blue); }
.sync-note { display: block; margin-top: 5px; color: #9f2f25; min-width: 140px; white-space: normal; font-size: .78rem; }
.fleet-dialog { max-width: min(880px, calc(100% - 28px)); }
.fleet-controls, .fleet-card-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 14px; }
.fleet-controls .field, .fleet-card-form .field { flex: 1 1 12rem; }
.fleet-list { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.fleet-list table { min-width: 570px; }
.fleet-list td .button { min-height: 34px; padding: 5px 9px; font-size: .8rem; }
.fleet-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fleet-model { margin-top: 3px; font-weight: 400; }
.button, .period select, .fields input, .fields select, .field input, textarea {
  min-height: 42px;
  border: 1px solid #cbd4e2;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}
.button { padding: 8px 14px; font-size: .9rem; font-weight: 650; }
.button:hover { background: #eff3fa; }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover { background: #1a3691; }
.button.danger { color: #9f2f25; border-color: #ebc8c0; }
.button.sign-out { border-color: transparent; color: var(--muted); }
.period select, .fields input, .fields select, .field input, textarea { padding: 8px 11px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
.import { margin-top: 14px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.metrics article { display: grid; align-content: start; gap: 8px; padding: clamp(14px, 2vw, 23px); }
.metrics article + article { border-left: 1px solid var(--line); }
.metrics span { color: var(--muted); font-size: .875rem; font-weight: 600; }
.metrics strong { font-size: clamp(1.2rem, 3vw, 2rem); letter-spacing: -.04em; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.checks strong { color: #a13228; }
.metrics small { color: var(--muted); font-size: .78rem; }
.metrics small:empty { display: none; }
.report { margin-top: 24px; border: 1px solid var(--line); background: white; border-radius: var(--radius); overflow: hidden; }
.report-head { padding: 18px 20px; flex-wrap: wrap; }
.report-note { margin: -6px 20px 14px; }
.report-actions { flex-wrap: wrap; column-gap: 16px; }
.card-list { min-width: 100px; max-width: 190px; color: var(--muted); }
.record-count { display: inline-block; margin-left: 4px; padding: 2px 7px; background: #edf1f7; color: #4d5b74; border-radius: 6px; font-size: .78rem; vertical-align: 1px; }
.filter { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .875rem; font-weight: 600; cursor: pointer; }
.filter input { width: 16px; height: 16px; accent-color: var(--blue); }
.table-scroll { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { text-align: left; padding: 11px 10px; border-top: 1px solid var(--line); font-size: .875rem; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th { color: var(--muted); background: #f7f8fb; font-weight: 650; white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
.driver { font-weight: 700; overflow-wrap: anywhere; }
.plate { display: table; margin-top: 5px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; color: #485775; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.numeric { white-space: nowrap; }
.rate { font-weight: 700; }
.rate.alert { color: #a13228; }
.status { display: inline-block; white-space: nowrap; padding: 4px 7px; border-radius: 5px; font-size: .8rem; font-weight: 650; background: #edf0f5; color: #4e5d76; }
.status.ok { background: #e8f4ee; color: #225c42; }
.status.alert { background: #faecea; color: #922f26; }
.status.stale, .status.no-threshold, .status.partial-fuel, .status.missing-mileage { background: #faf0de; color: #82510b; }
.edit { border: 0; background: transparent; font-size: .875rem; color: var(--blue); padding: 5px 0; text-decoration: underline; text-underline-offset: 3px; }
.empty { border-top: 1px solid var(--line); padding: 28px 20px; color: var(--muted); font-size: .9rem; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: linear-gradient(155deg, #e9eef9 0, #f4f5f8 65%); }
.login-card { width: min(100%, 410px); padding: clamp(22px, 6vw, 34px); background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px #20396312; }
.login-card .brand { color: #34425c; }
.login-card h1 { margin: 25px 0 19px; font-size: 2rem; }
.login-card form { display: grid; gap: 14px; }
.login-card input { letter-spacing: .2em; }
.field, .fields label { display: flex; flex-direction: column; gap: 6px; font-size: .875rem; color: var(--ink); font-weight: 650; }
dialog { max-width: min(600px, calc(100% - 28px)); width: 100%; max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); padding: 24px; }
dialog::backdrop { background: #16203380; }
.dialog-heading, .dialog-actions, .delete-confirm { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.dialog-actions { justify-content: end; margin-top: 18px; }
#editor-period { color: var(--muted); text-transform: capitalize; margin-bottom: 16px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }
.error { color: #a13228; font-weight: 600; font-size: .875rem; margin-top: 10px; }
.login-card .error { margin: 0; }
.delete-confirm { padding: 12px 0 0; font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 720px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics article:nth-child(3) { border-left: 0; }
  .metrics article:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (max-width: 460px) {
  .fields { grid-template-columns: 1fr; }
  .brand { font-size: .9rem; gap: 8px; }
  .topbar-inner { min-height: 58px; }
  .controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; }
  .controls .period { grid-column: 1 / -1; }
  .period label:first-child { flex: 1; }
  .toolbar { gap: 1px; }
  .toolbar .button { padding-inline: 6px; font-size: .78rem; }
  .topbar-inner .mark { display: none; }
}
