:root {
  color-scheme: light;
  --ink: #172b43;
  --muted: #50647d;
  --line: #dce5ef;
  --paper: #fff;
  --canvas: #f3f6fa;
  --navy: #112740;
  --blue: #175aba;
  --bright: #246bd3;
  --radius: 15px;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 3vw, 2.55rem); letter-spacing: -.045em; line-height: 1.08; }
h2 { font-size: 1rem; letter-spacing: -.015em; }
strong { font-weight: 680; }
p { line-height: 1.55; }
:focus-visible { outline: 3px solid #0d76db; outline-offset: 3px; }
.skip { position: fixed; z-index: 9; top: 12px; left: 12px; background: white; padding: 12px; translate: 0 -180%; }
.skip:focus { translate: 0; }

#sidebar {
  position: fixed; inset: 0 auto 0 0; width: 224px; padding: 28px 16px 20px;
  display: flex; flex-direction: column; background: var(--navy); color: #d9e6f6; overflow-y: auto;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; font-size: 1.25rem; font-weight: 800; letter-spacing: .055em; }
#sidebar .brand { margin: 0 10px 38px; }
.brand small { display: block; color: #b5c7dc; font-size: .68rem; font-weight: 600; letter-spacing: .025em; }
.brand-icon { display: inline-flex; align-items: center; justify-content: center; gap: 3px; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 9px; background: #337ce9; }
.brand-icon i { width: 3px; height: 16px; transform: skew(-22deg); background: white; border-radius: 2px; }
.brand-icon i:first-child { height: 10px; opacity: .65; }
.brand-icon i:last-child { height: 20px; }
.side-nav { display: grid; gap: 5px; }
.side-nav a { display: flex; min-height: 47px; gap: 10px; align-items: center; padding: 0 12px; border-radius: 9px; font-size: .9rem; font-weight: 600; }
.side-nav a:hover, .side-settings:hover { background: #1d3958; }
.side-nav a[aria-current] { color: white; background: #245188; box-shadow: inset 3px 0 #6babff; }
.nav-icon { display: inline-grid; place-items: center; width: 23px; font-size: 1.13rem; line-height: 1; }
.side-footer { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid #2a405b; }
.demo-label { display: inline-flex; align-items: center; gap: 7px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.demo-label i { width: 7px; height: 7px; border-radius: 50%; background: #28a580; }
.side-settings { display: block; padding: 10px 0; color: #c6d5e7; font-size: .81rem; border-radius: 6px; }
.workspace { margin-left: 224px; }
#topbar { min-height: 64px; display: flex; align-items: center; gap: 18px; padding: 0 30px; background: var(--paper); border-bottom: 1px solid var(--line); }
.breadcrumb, .today { color: var(--muted); font-size: .79rem; }
.breadcrumb span { padding: 0 6px; color: #667b95; }
.breadcrumb strong { color: var(--ink); }
.today { margin-left: auto; text-transform: capitalize; }
#topbar .demo-label { border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; }
.top-links { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.top-links a, .portfolio-link { display: inline-flex; align-items: center; min-height: 44px; gap: 4px; color: var(--blue); font-size: .82rem; font-weight: 700; }
.top-links a:hover, .top-links a[aria-current], .portfolio-link:hover { text-decoration: underline; }
.help-body { display: grid; gap: 14px; padding: 16px; }
.help-body ol { margin: 0; padding-inline-start: 24px; line-height: 1.55; }
.help-body li + li { margin-top: 8px; }
@media (max-width: 850px) {
  #topbar { flex-wrap: wrap; }
  #topbar .top-links { margin-left: auto; }
}
@media (max-width: 480px) {
  #topbar .top-links { flex-basis: 100%; justify-content: flex-end; }
}
.mobile-brand, #mobile { display: none; }
main, #notice { width: min(100%, 1560px); margin: 0 auto; }
main { padding: 27px 30px 40px; }
#notice:empty { display: none; }
#notice { padding: 10px 30px; color: #12644d; background: #e4f8f0; border-bottom: 1px solid #c4ebdd; }
#notice.error { color: #8f2638; background: #fff0f2; border-color: #f5cad0; }

.hero, .page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.hero { padding: 29px 23px; color: white; border-radius: var(--radius); background: linear-gradient(112deg,#142b48 8%,#1a426f 70%,#255795); }
.hero p, .page-heading p { font-size: .91rem; margin-top: 8px; }
.hero p { color: #d4e3f6; }
.page-heading { min-height: 74px; }
.page-heading p { color: var(--muted); }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 9px 14px; border: 1px solid transparent; border-radius: 8px; font-weight: 700; font-size: .81rem; line-height: 1.22; text-align: center; }
.button.primary { background: var(--blue); color: white; }
.hero .button.primary { background: #1660c5; border-color: #6eabff; }
.button.primary:hover { background: #124c9b; }
.button.secondary { background: #fff; border-color: #d4e1ef; color: #1a549e; }
.button.secondary:hover { background: #eef5ff; }
.button.danger { background: #a42940; color: white; }
.button.danger:hover { background: #852337; }
.button.small { min-height: 38px; padding: 7px 9px; font-size: .73rem; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 4px #172b4306; min-width: 0; }
.metric { display: grid; align-content: start; gap: 7px; padding: 14px; }
.metric strong { font-size: clamp(1.25rem, 2.2vw, 1.8rem); line-height: 1.1; letter-spacing: -.035em; overflow-wrap: anywhere; }
.metric > span:last-child { color: var(--muted); font-size: .75rem; font-weight: 600; }
.row-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; font-size: 1.03rem; font-weight: 750; }
.blue { color: #1757a7; background: #eaf2ff; }
.green { color: #096147; background: #e2f6ed; }
.amber { color: #804700; background: #fff1d9; }
.red { color: #a02238; background: #fde9ed; }
.neutral { color: #3f5672; background: #eef2f8; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 15px; align-items: start; }
main > .panel + .panel { margin-top: 15px; }
.panel-head { padding: 15px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #e8eef5; }
.panel-head h2 { line-height: 1.25; }
.text-link, .back-link { color: #1859aa; font-weight: 700; font-size: .77rem; }
.text-link { flex: 0 0 auto; }
.text-link:hover, .back-link:hover, .entity-link:hover { text-decoration: underline; }
.back-link { display: inline-flex; align-items: center; min-height: 38px; }
.caption { font-size: .71rem; color: var(--muted); }
.rows { padding: 0 15px; }
.list-row { min-height: 64px; display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.list-row + .list-row { border-top: 1px solid #ecf0f5; }
.row-main { flex: 1 1 auto; min-width: 0; font-size: .84rem; overflow-wrap: anywhere; }
.row-main small, .subline { display: block; margin-top: 4px; font-size: .74rem; color: var(--muted); }
.pill { display: inline-flex; align-items: center; min-height: 24px; border-radius: 20px; padding: 3px 8px; flex: 0 0 auto; font-size: .68rem; font-weight: 700; text-align: center; }
.empty { padding: 18px 16px; font-size: .87rem; color: var(--muted); }
.chart { display: flex; gap: 10px; height: 162px; padding: 15px 16px; }
.chart-axis { display: flex; align-items: end; flex-direction: column; justify-content: space-between; padding-bottom: 21px; color: var(--muted); font-size: .64rem; }
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; flex: 1; margin: 0; padding: 0; list-style: none; }
.bars li { min-width: 0; display: flex; align-items: center; flex-direction: column; gap: 6px; font-size: .69rem; color: var(--muted); }
.bar-slot { height: 100%; width: 100%; display: flex; align-items: end; justify-content: center; border-bottom: 1px solid var(--line); }
.bar { width: min(30px, 72%); height: var(--bar); border-radius: 5px 5px 0 0; background: #9cbeec; }
.bar.current { background: #246bd3; }

.table-wrap { overflow-x: auto; border-radius: inherit; }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
th, td { padding: 12px 15px; text-align: left; vertical-align: middle; }
th { background: #f7f9fc; color: var(--muted); font-weight: 700; font-size: .75rem; }
tr + tr td, thead + tbody tr:first-child td { border-top: 1px solid #edf1f5; }
.filters { padding: 15px; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.form-panel, .active-summary, .vehicle-summary { padding: 20px; }
.form-panel, .active-summary { max-width: 680px; }
.form-panel { display: grid; gap: 13px; }
.form-panel p, .field-hint { color: var(--muted); font-size: .84rem; }
.form-panel .field-hint { margin-top: -5px; }
label { display: block; font-weight: 680; font-size: .84rem; }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px; border: 1px solid #bfccdb; border-radius: 8px; color: var(--ink); background: white; }
label > :is(input,select,textarea) { display: block; margin-top: 6px; }
textarea { resize: vertical; }
.optional { font-weight: 400; color: var(--muted); }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.vehicle-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.vehicle-summary div { display: grid; justify-items: start; gap: 5px; }
.vehicle-summary div > span:first-child, dt { color: var(--muted); font-size: .76rem; }
.active-summary dl { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 14px 0; }
dd { margin: 3px 0 0; font-weight: 680; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 7px; align-items: center; }
.inline-form select { width: auto; min-height: 38px; font-size: .8rem; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; width: min(440px, calc(100% - 24px)); color: var(--ink); }
dialog::backdrop { background: #1228419e; }
dialog p { margin: 10px 0 16px; color: var(--muted); }
.role-switch, .card-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.role-switch { padding: 3px; border-radius: 9px; background: #eef3fa; }
.role-switch a, .card-tabs a { display: inline-flex; min-height: 44px; align-items: center; padding: 7px 10px; border-radius: 7px; font-size: .78rem; font-weight: 700; }
.role-switch a[aria-current], .card-tabs a[aria-current] { color: white; background: var(--blue); }
.card-tabs { margin-bottom: 12px; }
.card-tabs a:not([aria-current]) { background: white; border: 1px solid var(--line); }
.approval { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.approval input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--blue); }
body:has(.role-switch a[href="#/driver"][aria-current]) #mobile { grid-template-columns: repeat(4,minmax(0,1fr)); }
.driver-profile { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 16px; }
.driver-profile div { display: grid; gap: 5px; }
.driver-profile span, .driver-profile small { color: var(--muted); font-size: .78rem; }
.driver-profile strong { font-size: 1.2rem; }
.card-filter { max-width: 320px; margin-bottom: 14px; }
.card-fields { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; min-width: 0; }
.card-fields legend { padding: 0 5px; font-size: .84rem; font-weight: 700; }
.card-field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.demo-profile { margin-bottom: 16px; }
.report-filters { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 16px; }
.report-filters button { justify-self: start; }
.filter-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2,max-content); }
.chart-selection { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; background: #eaf2ff; border-radius: 8px; }
.chart-choice { padding: 4px 6px; margin: 3px 4px 0 0; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); text-align: left; }
.chart-choice[aria-pressed="true"] { border-color: var(--blue); background: #eaf2ff; }
.report-chart canvas[data-chart="bar"], .report-chart canvas[data-chart="pie"] { cursor: pointer; }
.email-dialog { width: min(660px, calc(100% - 24px)); }
#print-dialog { width: min(850px, calc(100% - 24px)); }
.print-toolbar { margin: 12px 0; }
#print-pages { display: grid; gap: 14px; }
#print-pages img { display: block; width: 100%; border: 1px solid var(--line); }
@media print {
  @page { size: A4; margin: 0; }
  body:has(#print-dialog[open]) > :not(#print-dialog) { display: none !important; }
  #print-dialog[open] { position: static; width: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: visible; }
  #print-dialog[open]::backdrop { display: none; }
  #print-dialog > :not(#print-pages) { display: none; }
  #print-pages { display: block; }
  #print-pages img { width: 100%; height: 297mm; object-fit: contain; border: 0; break-inside: avoid; }
  #print-pages img + img { break-before: page; }
}
.email-form { display: grid; gap: 12px; }
.email-form p:empty { display: none; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
.report-output { display: grid; gap: 14px; margin-top: 16px; }
.report-output .metrics { margin: 0; }
.report-preview { border-top: 3px solid var(--blue); padding-top: 14px; }
.report-note { color: var(--muted); font-size: .79rem; }
.report-presets, .chart-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.report-chart-views { display: flex; flex-wrap: wrap; gap: 8px; }
.report-chart-views [aria-pressed="true"] { background: var(--blue); color: white; }
.report-chart-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.report-chart-grid .chart-key { overflow-wrap: anywhere; }
@media (max-width: 1150px) {
  .report-chart-grid { grid-template-columns: 1fr; }
}
.report-presets { margin-bottom: 12px; }
.chart-controls label { min-width: 108px; }
.report-empty { margin-top: 12px; padding: 10px 14px; background: #fff1d9; border-radius: 8px; color: #804700; }
.report-chart { padding: 12px 16px; }
.report-chart canvas { display: block; width: 100%; height: 240px; }
.report-comparisons { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.chart-legend { display: inline-flex; gap: 5px; align-items: center; margin-right: 12px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; }
@media (max-width: 680px) {
  #topbar .today { display: none; }
  .role-switch { margin-left: auto; }
  .card-row { flex-wrap: wrap; }
  .card-row .row-main { flex-basis: 100%; }
  .card-field-grid { grid-template-columns: 1fr; }
  .report-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .report-comparisons { grid-template-columns: 1fr; }
  .demo-profile { flex-wrap: wrap; }
}
@media print {
  .report-presets, .chart-controls, .report-chart-views { display: none; }
  .report-chart-grid { grid-template-columns: 1fr; }
  body:has(.report-output) :is(#sidebar, #topbar, #mobile, #notice, .skip, .demo-profile, .report-filters, .report-actions, #chart-type) { display: none !important; }
  body:has(.report-output) .workspace { margin: 0; }
  body:has(.report-output) main { padding: 0; }
  main:has(.report-output) > .panel { display: none; }
  .report-output .table-wrap { overflow: visible; }
  .report-output :is(th,td) { font-size: 9pt; padding: 4px; overflow-wrap: anywhere; }
  .report-output tr { break-inside: avoid; }
  .report-chart { break-inside: avoid; }
}

@media (max-width: 1150px) {
  #sidebar { width: 184px; }
  .workspace { margin-left: 184px; }
  #topbar, main { padding-left: 20px; padding-right: 20px; }
  .metric { padding: 11px; }
}
@media (max-width: 920px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  #sidebar, .breadcrumb { display: none; }
  .workspace { margin-left: 0; }
  #topbar { min-height: 58px; padding: 0 13px; gap: 8px; }
  .mobile-brand { display: inline-flex; color: var(--navy); font-size: 1.05rem; }
  .today { font-size: .67rem; }
  #mobile { position: fixed; z-index: 3; inset: auto 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); background: white; border-top: 1px solid var(--line); box-shadow: 0 -4px 15px #12284112; }
  #mobile a { display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 49px; border-radius: 7px; font-size: .67rem; font-weight: 700; color: var(--muted); }
  #mobile a[aria-current] { color: #1458ad; background: #eaf2ff; }
  main { padding: 15px 12px 80px; }
  #notice { padding: 9px 12px; font-size: .85rem; }
  .hero, .page-heading { align-items: flex-start; flex-direction: column; }
  .hero { padding: 17px 15px; margin-bottom: 13px; }
  .hero .button { width: 100%; }
  .page-heading { min-height: 0; margin-bottom: 14px; }
  .metrics, .dashboard-grid { gap: 8px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 10px; }
  .metric:last-child { grid-column: 1 / -1; grid-template-columns: auto auto 1fr; align-items: center; }
  .form-panel, .vehicle-summary, .active-summary { padding: 14px; }
  .button.small, .back-link, .inline-form select { min-height: 44px; }
  .form-panel :is(input,select,textarea) { font-size: 1rem; }
  .form-panel .actions > .primary { flex: 1 1 auto; }
  .issue-row { flex-wrap: wrap; }
  .issue-row .inline-form { flex: 0 0 100%; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label:first-child { grid-column: 1 / -1; }
  th, td { padding: 10px; }
}
