:root { font-family: system-ui,sans-serif; color: #182526; background: #f0f5f5; }
* { box-sizing: border-box; }
main { max-width: 640px; margin: 32px auto; padding: 24px; background: white; border-radius: 16px; }
h1 { margin: 12px 0; } p { line-height: 1.5; }
.brand { color: #12656e; font-weight: 800; text-decoration: none; }
button, .action { display: inline-block; margin: 5px 5px 5px 0; border: 0; border-radius: 8px; padding: 10px 14px; background: #12656e; color: white; font: inherit; text-decoration: none; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
input, select { display: block; width: 100%; padding: 10px; margin: 5px 0 12px; font: inherit; }
#map { height: 300px; position: relative; overflow: hidden; border-radius: 12px; background: #e6eeee; }
#map img { width: 256px; height: 256px; position: absolute; }
#map-marker { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border: 2px solid white; background: #12656e; border-radius: 50%; padding: 8px; }
#map-credit { position: absolute; bottom: 0; right: 0; background: white; padding: 3px 5px; font-size: 12px; }
@media (max-width: 660px) { main { margin: 0; border-radius: 0; min-height: 100dvh; } }

[hidden] { display: none !important; }
.owner-access { border-top: 1px solid #cbdcdd; margin-top: 24px; padding-top: 10px; }
.owner-access a { display: inline-flex; align-items: center; min-height: 44px; color: #12656e; font-weight: 700; }

#driver-calendar { margin: 22px 0; padding-bottom: 16px; border-bottom: 1px solid #cbdcdd; }
#driver-calendar-events { padding-left: 20px; }
#driver-calendar-events li { padding: 7px 0; }

:is(#driver-traffic, #driver-search) { margin: 22px 0; padding-bottom: 16px; border-bottom: 1px solid #cbdcdd; }
:is(#driver-traffic, #driver-search) table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
:is(#driver-traffic, #driver-search) th, :is(#driver-traffic, #driver-search) td { padding: 8px; border-bottom: 1px solid #d8e5e5; text-align: right; }
:is(#driver-traffic, #driver-search) th:first-child { text-align: left; }
:is(#driver-traffic, #driver-search) td { font-variant-numeric: tabular-nums; }

.search-report-results { max-height: 24rem; overflow: auto; }
#driver-search caption { text-align: left; margin-bottom: 8px; }

#driver-quotes { margin: 22px 0; padding-bottom: 16px; border-bottom: 1px solid #cbdcdd; }
.driver-quote-list { padding-inline-start: 22px; }
.driver-quote-list li { margin-bottom: 16px; overflow-wrap: anywhere; }
.driver-quote-list p { margin: 4px 0; }

.quote-price-form { margin: 10px 0; }
.quote-price-form input { max-width: 16rem; }
.quote-price-form [role="status"]:empty { display: none; }

#driver-sent-quotes {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid #cbdcdd;
  border-radius: 8px;
}
#driver-sent-quotes summary { cursor: pointer; font-weight: 700; color: #12656e; }

#driver-invoices {
  margin: 22px 0;
  padding: 16px;
  border: 1px solid #cbdcdd;
  border-radius: 10px;
}
#driver-invoices h2 { margin-top: 0; }
#driver-invoices input[type="checkbox"] {
  display: inline-block;
  width: auto;
  margin: 0 4px 0 0;
}
#driver-invoices output {
  margin-left: 8px;
  color: #12656e;
  font-weight: 700;
}

#owner-ledger {
  margin: 22px 0;
  border: 1px solid #cbdcdd;
  border-radius: 10px;
  padding: 16px;
}
#owner-ledger h2 { margin-top: 0; }
#owner-ledger details { border-top: 1px solid #cbdcdd; padding: 10px 0; }
#owner-ledger summary { color: #12656e; font-weight: 700; cursor: pointer; }
#owner-ledger form { padding: 12px 0 0; }
#owner-ledger-totals { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
#owner-ledger-totals dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 700; }
#owner-ledger-rows { padding-inline-start: 20px; overflow-wrap: anywhere; }
#owner-ledger-rows li { margin-bottom: 8px; }

@media screen {
  #owner-ledger-print { display: none; }
}

@media print {
  body.printing-owner-ledger { margin: 0; background: white; color: #182526; }
  .printing-owner-ledger #tracking-driver { max-width: none; margin: 0; padding: 0; min-height: 0; }
  .printing-owner-ledger #tracking-driver > :not(#owner-ledger-print) { display: none; }
  #owner-ledger-print { font-size: 11pt; overflow-wrap: anywhere; }
  #owner-ledger-print h1 { font-size: 20pt; color: #12656e; }
  #owner-ledger-print dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; break-inside: avoid; }
  #owner-ledger-print dd { margin: 0; font-weight: 700; }
  #owner-ledger-print table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  #owner-ledger-print thead { display: table-header-group; }
  #owner-ledger-print tr { break-inside: avoid; }
  #owner-ledger-print th, #owner-ledger-print td { border-bottom: 1px solid #abbcbc; padding: 5px; text-align: left; vertical-align: top; }
  #owner-ledger-print th:nth-child(n+4), #owner-ledger-print td:nth-child(n+4) { text-align: right; white-space: nowrap; }
}

#purchase-invoice-items {
  border: 1px solid #cbdcdd;
  border-radius: 8px;
  margin: 12px 0;
}
.purchase-invoice-item {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(72px, 1fr) minmax(100px, 1fr);
  gap: 4px 10px;
  align-items: end;
  padding: 10px 0;
  border-bottom: 1px solid #d8e5e5;
}
.purchase-invoice-item button { justify-self: start; }
@media (max-width: 480px) {
  .purchase-invoice-item { grid-template-columns: 1fr 1fr; }
  .purchase-invoice-item label:first-child { grid-column: 1 / -1; }
}

#owner-ledger > .owner-ledger-toggle {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  color: #fff;
  background: #12656e;
  border-radius: 8px;
}
#owner-ledger > .owner-ledger-toggle::-webkit-details-marker { display: none; }
#owner-ledger > .owner-ledger-toggle::after { content: "+"; font-size: 1.25em; }
#owner-ledger[open] > .owner-ledger-toggle { margin-bottom: 12px; }
#owner-ledger[open] > .owner-ledger-toggle::after { content: "−"; }

#invoice-inspection {
  min-width: 0;
  margin: 0 0 16px;
  padding: 8px 12px 12px;
  border: 1px solid #cbdcdd;
  border-radius: 8px;
}
#invoice-inspection legend { font-weight: 650; }
#invoice-inspection label {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
#invoice-inspection select { margin: 4px 0; }
