:root {
  color-scheme: light;
  --navy: #103b73;
  --blue: #1565c0;
  --sky: #38bdf8;
  --white: #fff;
  --canvas: #f2f5f9;
  --ink: #122743;
  --quiet: #52657c;
  --line: #dbe4ee;
  --wash: #eaf3fd;
  --danger: #a12632;
  --headline: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --data: ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius: 16px;
  --shadow: 0 2px 4px #102c5008, 0 12px 30px #102c5005;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1, h2, h3 { font-family: var(--headline); font-weight: 750; line-height: 1.12; letter-spacing: -.035em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); overflow-wrap: anywhere; }
h2 { font-size: clamp(1.35rem, 2.5vw, 1.85rem); }
h3 { font-size: 1.25rem; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
svg { flex: none; display: block; }
code { font: .88em var(--data); color: var(--navy); }
:focus-visible { outline: 3px solid #1781dc; outline-offset: 3px; }
::selection { background: #afe5fd; color: var(--ink); }

.wrap { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.page { flex: 1; padding-block: 30px 66px; }
.page--form { max-width: 820px; }
.page--auth { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; justify-items: center; padding-block: clamp(44px, 10vh, 105px) 80px; }
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  position: absolute;
  z-index: 10;
  inset: 8px auto auto 8px;
  border-radius: 8px;
  padding: 12px 18px;
  color: var(--navy);
  background: var(--white);
}

.site-header { border-bottom: 1px solid var(--line); background: var(--white); }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--navy); text-decoration: none; min-height: 44px; }
.brand-mark {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 10px;
  background: var(--navy);
  color: var(--white);
}
.brand-word { font: 800 1.03rem/1 var(--headline); letter-spacing: .09em; }
.top-nav { display: flex; align-items: center; gap: 5px; }
.top-link, .private-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding-inline: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--quiet);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 650;
  font-size: .88rem;
}
.top-link:hover, .top-link[aria-current="page"] { color: var(--navy); background: var(--wash); }
.top-link--logout { color: var(--navy); }
.logout-form { display: flex; }
.site-footer { border-top: 1px solid var(--line); color: var(--quiet); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 59px; padding-block: 12px; font-size: .76rem; }
.footer-inner span:first-child { color: var(--navy); font: 750 .72rem/1.5 var(--headline); letter-spacing: .09em; }

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.17fr) minmax(0, 1fr);
  align-items: center;
  min-height: 322px;
  overflow: hidden;
  background: var(--navy);
  background-image: linear-gradient(114deg, #0c3264 18%, #103b73 55%, #164c8a);
  border: 1px solid #194c82;
  border-radius: 23px;
  box-shadow: 0 14px 32px #102c5020;
  color: var(--white);
}
.hero::before {
  content: "";
  z-index: -1;
  position: absolute;
  inset: 0 0 0 37%;
  opacity: .29;
  background-image: linear-gradient(#77b9ff38 1px, transparent 1px), linear-gradient(90deg, #77b9ff38 1px, transparent 1px);
  background-size: 23px 23px;
  mask-image: linear-gradient(90deg, transparent, #000 54%);
}
.hero-copy { padding: 43px 0 44px clamp(26px, 5vw, 55px); position: relative; z-index: 1; }
.hero-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  color: #c0e8ff;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.hero-kicker span { width: 18px; height: 2px; background: var(--sky); }
.hero h1 { font-size: clamp(2.45rem, 5.6vw, 4.45rem); letter-spacing: -.065em; }
.hero h1 + p { margin-top: 9px; color: #deefff; font-size: clamp(.96rem, 1.55vw, 1.125rem); }
.hero-art { padding-inline: 0 20px; transform: translateX(2px); align-self: center; }
.hero-art img { width: 100%; height: auto; }
.search-form { display: flex; gap: 8px; width: min(100%, 468px); margin-top: 26px; }
.search-input {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  gap: 10px;
  padding-left: 14px;
  border-radius: 9px;
  background: var(--white);
  color: var(--blue);
}
.search-input:focus-within { outline: 3px solid var(--sky); outline-offset: 3px; }
.search-input input { width: 100%; min-width: 0; min-height: 53px; padding: 9px 10px 9px 0; border: 0; border-radius: 9px; color: var(--ink); background: transparent; }
.search-input input::-webkit-search-decoration { -webkit-appearance: none; }
.search-input input:focus-visible { outline: none; }
.search-input input::placeholder, .field input::placeholder, .field textarea::placeholder { color: #667891; opacity: 1; }

.button-group { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.button--primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.button--primary:hover { background: var(--navy); border-color: var(--navy); }
.button--outline { background: var(--white); border-color: #c6d5e6; color: var(--navy); }
.button--outline:hover { border-color: #84afdb; background: var(--wash); }
.button--subtle { background: transparent; color: var(--navy); }
.button--subtle:hover { background: var(--wash); }
.button--search { background: var(--sky); border-color: var(--sky); color: #092e57; padding-inline: 22px; }
.button--search:hover { background: #83d7fb; border-color: #83d7fb; }
.button--search:focus-visible { outline-color: #d5f2ff; }
.button--compact { min-height: 44px; font-size: .85rem; }
.text-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  color: var(--blue);
  font-size: .92rem;
  font-weight: 700;
  text-decoration: none;
  text-underline-offset: .21em;
}
.text-link:hover { text-decoration: underline; }

.archive-bar { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 13px 20px; margin-block: 34px 16px; }
.archive-bar p, .page-heading p:not(.eyebrow) { margin-top: 5px; color: var(--quiet); }
.archive-bar p { overflow-wrap: anywhere; }
.archive-grid, .detail-grid, .vehicle-grid, .settings-grid { display: grid; align-items: start; gap: 18px; }
.archive-grid, .vehicle-grid { grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); }
.detail-grid { grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); }
.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-wide { grid-column: 1 / -1; }
.panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .panel-heading h3 { flex: 1; min-width: 0; color: var(--ink); font-size: 1.2rem; }
.section-icon, .empty-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border-radius: 9px;
  color: var(--blue);
  background: var(--wash);
}
.count {
  display: grid;
  min-width: 29px;
  height: 29px;
  place-items: center;
  padding-inline: 7px;
  border-radius: 6px;
  color: var(--navy);
  background: var(--wash);
  font: 700 .8rem/1 var(--data);
}
.record-list { list-style: none; padding: 0; }
.record-list li + li { border-top: 1px solid var(--line); }
.record-list li:last-child .record { border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
.record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 10px 17px;
  text-decoration: none;
}
.record--vehicle { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.record:hover { background: #f5f9fe; }
.record:focus-visible { outline-offset: -3px; }
.record-copy { min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.record-copy strong { font-size: .97rem; font-weight: 750; line-height: 1.24; }
.record-copy > span { margin-top: 3px; color: var(--quiet); font-size: .83rem; }
.record-data { color: var(--quiet); text-align: right; font: 650 .79rem/1.3 var(--data); white-space: nowrap; }
.record-arrow { color: var(--blue); }
.plate {
  display: inline-grid;
  grid-template-columns: 7px 1fr 7px;
  align-items: stretch;
  justify-self: start;
  min-width: 88px;
  min-height: 30px;
  overflow: hidden;
  border: 1px solid #b8c7d9;
  border-radius: 5px;
  background: var(--white);
  color: #18304b;
  font: 800 .78rem/28px var(--data);
  font-variant-numeric: tabular-nums;
  letter-spacing: .045em;
  text-align: center;
  white-space: nowrap;
}
.plate::before, .plate::after { content: ""; background: var(--blue); }
.plate::before { margin-right: 3px; }
.plate::after { margin-left: 3px; }
.empty-state { display: grid; justify-items: center; min-height: 197px; align-content: center; gap: 5px; padding: 21px 16px; text-align: center; }
.empty-icon { width: 45px; height: 45px; margin-bottom: 3px; }
.empty-state p { max-width: 33ch; color: var(--quiet); font-size: .9rem; }
.empty-state p strong { color: var(--ink); font-size: .97rem; }
.empty-state .text-link { min-height: 44px; }
.empty-action { margin-top: 14px; }

.back-link { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--blue); text-decoration: none; font-size: .9rem; font-weight: 700; }
.back-link:hover { text-decoration: underline; text-underline-offset: .21em; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px 24px; margin-block: 12px 24px; }
.page-heading > div { min-width: 0; }
.page-heading .button-group { flex: none; }
.eyebrow { color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .115em; text-transform: uppercase; }
.page-heading .eyebrow { margin-bottom: 6px; }
.page-heading h1 + p { max-width: 62ch; }
.vehicle-subtitle { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; margin-top: 11px; color: var(--quiet); }
.vehicle-subtitle .text-link { margin-block: -4px; }
.vehicle-heading .plate { grid-template-columns: 9px 1fr 9px; min-width: 113px; min-height: 38px; font-size: 1rem; line-height: 36px; }
.facts { display: grid; padding-inline: 18px; }
.facts > div { padding: 12px 0; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--quiet); font-size: .81rem; font-weight: 650; }
.facts dd { margin-top: 3px; font-size: .97rem; font-weight: 600; overflow-wrap: anywhere; }
.facts .text-link { min-height: 44px; margin-block: -9px -5px; }
.settings-copy { padding: 14px 18px 18px; color: var(--quiet); font-size: .93rem; }
.settings-copy p + p { margin-top: 9px; }
.url-text { font-family: var(--data); overflow-wrap: anywhere; word-break: break-word; }
.origin-list { display: grid; gap: 6px; list-style: none; padding: 0; }
.origin-list li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 7px; }
.origin-tag { padding: 2px 6px; border-radius: 5px; background: var(--wash); color: var(--navy); font: 650 .73rem/1.4 var(--body); }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }

.vehicle-aside { display: grid; gap: 18px; }
.mileage-panel { padding: 20px 18px; background: #eaf4ff; border-color: #cfe2f6; }
.odometer { margin-top: 6px; color: var(--navy); font: 750 clamp(1.85rem, 5vw, 2.65rem)/1.18 var(--data); overflow-wrap: anywhere; letter-spacing: -.06em; }
.odometer span { color: #3a608a; font-size: .57em; font-weight: 700; letter-spacing: 0; }
.odometer-note { margin-top: 7px; color: var(--quiet); font-size: .84rem; }
.odometer-note strong { color: var(--navy); font-family: var(--data); }
.qr-panel-body { display: grid; grid-template-columns: minmax(75px, 116px) minmax(0, 1fr); align-items: center; gap: 13px; padding: 16px 18px; }
.qr-panel-body--empty { grid-template-columns: minmax(0, 1fr); }
.qr-panel-body p { margin-bottom: 9px; color: var(--quiet); font-size: .86rem; overflow-wrap: anywhere; }
.qr-preview { width: 100%; height: auto; background: var(--white); outline: 1px solid var(--line); border-radius: 7px; }
.history-list { display: grid; gap: 18px; list-style: none; padding: 18px 18px 18px 38px; }
.history-item { position: relative; min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f9fbfd; }
.history-item::before { content: ""; position: absolute; top: 18px; left: -22px; width: 10px; height: 10px; z-index: 1; border: 2px solid var(--blue); border-radius: 50%; background: var(--white); }
.history-item:not(:last-child)::after { content: ""; position: absolute; top: 25px; bottom: -41px; left: -18px; border-left: 2px solid #cbdef3; }
.history-meta { display: flex; justify-content: space-between; gap: 5px 14px; flex-wrap: wrap; color: var(--navy); font-size: .89rem; }
.history-meta > div { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.history-meta time { font-weight: 760; }
.history-meta span { color: var(--quiet); font: 600 .82rem/1.35 var(--data); }
.history-meta strong { font-family: var(--data); white-space: nowrap; }
.history-item p { margin-top: 8px; font-size: .94rem; }

.entry-form { padding: clamp(18px, 4vw, 32px); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.field--wide { grid-column: 1 / -1; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .9rem; font-weight: 720; }
.field label span { margin-left: 3px; color: var(--quiet); font-size: .77rem; font-weight: 500; }
.field input, .field textarea, .field select {
  min-width: 0;
  width: 100%;
  min-height: 47px;
  padding: 10px 11px;
  border: 1px solid #afc2d8;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.45;
}
.field input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.field textarea { resize: vertical; }
.field select { padding-right: 7px; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field .plate-input { font-family: var(--data); text-transform: uppercase; }
.field-hint { color: var(--quiet); font-size: .82rem; }
.field-error { display: flex; align-items: flex-start; gap: 5px; color: var(--danger); font-size: .83rem; font-weight: 650; }
.field-error svg { margin-top: 2px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.notice { display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; border: 1px solid #c5dbf6; border-radius: 9px; color: var(--navy); background: var(--wash); font-size: .9rem; }
.notice svg { margin-top: 1px; }
.notice span { min-width: 0; overflow-wrap: anywhere; }
.notice--error { background: #fff0f0; border-color: #efc9cb; color: #8c202a; }
.notice--success { background: #e9f8ef; border-color: #bfe6ce; color: #195d3a; }
.flash-stack { display: grid; gap: 7px; margin-bottom: 17px; }
.entry-form > .notice { margin-bottom: 17px; }

.auth-card { width: min(100%, 455px); padding: clamp(22px, 5vw, 34px); border-top: 4px solid var(--blue); }
.auth-top h1 { margin-top: 6px; font-size: clamp(1.9rem, 5.5vw, 2.55rem); }
.auth-top h1 + p { margin-top: 8px; color: var(--quiet); }
.auth-mark {
  display: grid;
  width: 51px;
  height: 51px;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--wash);
  color: var(--blue);
}
.auth-form { display: grid; gap: 15px; margin-top: 22px; }
.auth-form > .button { width: 100%; margin-top: 3px; }
.error-card .button { margin-top: 20px; }

@media (max-width: 940px) {
  .vehicle-heading { flex-wrap: wrap; }
  .archive-grid { grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
  .hero h1 { font-size: clamp(2.25rem, 6.2vw, 3.7rem); }
  .hero-copy { padding-left: 30px; }
}

@media (max-width: 760px) {
  .wrap { width: calc(100% - 36px); }
  .page { padding-block: 19px 44px; }
  .page--auth { padding-top: 40px; }
  .topbar { min-height: 62px; }
  .hero { min-height: 0; grid-template-columns: minmax(0, 1fr); border-radius: 17px; }
  .hero::before { inset: 23% 0 0; mask-image: linear-gradient(180deg, transparent, #000 70%); }
  .hero-copy { padding: 29px 24px 0; }
  .hero h1 { font-size: clamp(2.3rem, 8vw, 3.45rem); }
  .hero-art { padding: 0 14px; transform: none; }
  .hero-art img { width: min(100%, 370px); margin: -3px auto -6px; }
  .search-form { margin-top: 19px; }
  .archive-bar { margin-top: 27px; }
  .archive-grid, .detail-grid, .vehicle-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .vehicle-aside { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .qr-panel-body { grid-template-columns: minmax(75px, 115px) minmax(0, 1fr); }
  .qr-panel-body--empty { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 535px) {
  .top-nav { gap: 2px; }
  .top-link--archive { display: none; }
  .top-link--network, .top-link--logout { width: 44px; min-width: 44px; padding-inline: 0; }
  .top-link--network span, .top-link--logout span { display: none; }
  .private-mark { padding-inline: 0; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .archive-bar { align-items: flex-start; flex-direction: column; }
  .archive-bar .button-group, .vehicle-heading .button-group { align-items: stretch; width: 100%; }
  .archive-bar .button-group > *, .vehicle-heading .button-group > * { flex: 1 1 130px; }
  .fields { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

@media (max-width: 390px) {
  .wrap { width: calc(100% - 28px); }
  .brand { gap: 7px; }
  .brand-mark { width: 33px; height: 33px; }
  .brand-word { font-size: .87rem; letter-spacing: .06em; }
  .private-mark span { display: none; }
  .hero-copy { padding: 25px 16px 0; }
  .hero h1 { font-size: clamp(2rem, 9.8vw, 2.23rem); }
  .hero-kicker { font-size: .64rem; margin-bottom: 10px; }
  .search-input { gap: 6px; padding-left: 9px; }
  .search-input > svg { width: 18px; height: 18px; }
  .search-input input { min-height: 48px; padding-right: 4px; }
  .button--search { padding-inline: 11px; }
  .button-group .button { padding-inline: 9px; font-size: .82rem; }
  .archive-bar .button-group > :first-child { flex-basis: 110px; }
  .archive-bar .button-group > :last-child { flex-basis: 145px; }
  .panel-heading { padding-inline: 12px; gap: 7px; }
  .panel-heading--actions .button { padding-inline: 8px; font-size: .8rem; }
  .section-icon { width: 32px; height: 32px; }
  .panel-heading h2, .panel-heading h3 { font-size: 1.08rem; }
  .record { padding-inline: 11px; gap: 7px; }
  .record--vehicle { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 8px; row-gap: 3px; }
  .record--vehicle .plate { grid-column: 1; grid-row: 1 / 3; }
  .record--vehicle .record-copy { grid-column: 2; grid-row: 1; }
  .record--vehicle .record-data { grid-column: 2; grid-row: 2; text-align: left; }
  .record--vehicle .record-arrow { grid-column: 3; grid-row: 1 / 3; }
  .history-list { padding-left: 33px; padding-right: 12px; }
  .history-item { padding-inline: 10px; }
  .footer-inner { flex-wrap: wrap; gap: 4px 9px; }
}
