:root {
  color-scheme: dark;
  --bg: #0b1218;
  --card: #131e27;
  --text: #e7eef3;
  --muted: #a9bbc8;
  --line: #2b3b47;
  --accent: #86d5d9;
  --danger: #ffb5ae;
  --warning: #e9ca8b;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-header, main, footer {
  width: min(1120px, 100%);
  margin: auto;
  padding: 24px 28px;
}

.site-header { border-bottom: 1px solid var(--line); }

.brand {
  color: var(--accent);
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -1px;
  line-height: 1.15;
}

.brand span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

footer {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.page-heading, .card-heading, .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.page-heading, .card-heading { justify-content: space-between; }
.page-heading { margin: 8px 0 22px; }
.card-heading { align-items: flex-start; }

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -.4px;
}

h2 { margin: 0; font-size: 21px; line-height: 1.35; }
h3 { margin: 0; font-size: 17px; line-height: 1.4; }
p { margin: 12px 0; }
.muted { color: var(--muted); }
.optional:empty { margin: 0; }

.card {
  min-width: 0;
  margin: 18px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.card > :last-child { margin-bottom: 0; }
.narrow { max-width: 460px; margin: 42px auto; }

.actions { margin-top: 20px; }
.actions:not(:has(> :not([hidden]))) { margin-top: 0; }
.actions > :is(button, a) { flex: 0 1 auto; }

button, input { font: inherit; }

button, .actions > a {
  min-height: 46px;
  padding: 10px 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  line-height: 1.35;
  cursor: pointer;
}

.actions > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

button.primary, .actions > a.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #092329;
  font-weight: 650;
}

button.danger { border-color: #925d59; color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
button:not(:disabled):hover { background-color: #1a303b; }
button.primary:not(:disabled):hover, .actions > a.primary:hover {
  background: var(--accent);
  filter: brightness(1.14);
}

:is(button, input, a, summary):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

form { display: grid; gap: 16px; }
form > .actions { margin-top: 2px; }

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
}

.field input {
  display: block;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.field .code { font-variant-numeric: tabular-nums; letter-spacing: .18em; }

.check { display: flex; align-items: flex-start; gap: 12px; }
.check input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 3px 0;
  accent-color: var(--accent);
}

.card-fields { max-width: 680px; margin-top: 18px; }
.card-fields p { margin-top: 0; }
#totp-help { margin: 0; }
#partner { padding-top: 18px; border-top: 1px solid var(--line); }
summary { font-weight: 600; cursor: pointer; }

.facts {
  display: grid;
  grid-template-columns: minmax(110px, .65fr) minmax(0, 1fr);
  gap: 8px 18px;
  max-width: 460px;
  margin: 18px 0;
  font-size: 14px;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.vin { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }

.badge {
  display: inline-block;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.badge.positive { color: var(--accent); border-color: #3e6f70; background: #112d32; }
.badge.warning { color: var(--warning); border-color: #62553b; background: #2b261c; }
.badge.danger { color: var(--danger); border-color: #774e4c; background: #302222; }

.inline-message {
  display: block;
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #192a35;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.inline-message:empty { margin: 0; padding: 0; border: 0; }
main > .narrow:not([hidden]) ~ .inline-message { max-width: 460px; margin-inline: auto; }

.payment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px 24px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  overflow-wrap: anywhere;
}

.payment p:last-child { margin-bottom: 0; }
.payment .actions { grid-column: 1 / -1; margin: 0; }

.payment-qr, .totp-qr {
  display: block;
  max-width: min(100%, 240px);
  height: auto;
  border-radius: 8px;
  background: #fff;
  image-rendering: pixelated;
}

.totp-qr { margin-inline: auto; }

.account-actions, .auth-options, .owner-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-help { margin: 0; overflow-wrap: anywhere; }
.auth-options { justify-content: space-between; }

.text-button {
  padding: 8px 0;
  border-color: transparent;
  color: var(--accent);
}

.text-button:not(:disabled):hover {
  background: transparent;
  text-decoration: underline;
}

.control-form { margin-top: 16px; }
.owner-tabs { border-bottom: 1px solid var(--line); }
.owner-tabs button { border-color: transparent; border-radius: 9px 9px 0 0; }
.owner-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--accent);
  background: var(--card);
}

.vehicle-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px 28px;
  margin: 18px 0;
  padding: 16px 0;
  border-block: 1px solid var(--line);
}

.vehicle-details .facts { margin: 0; }
.installations ul { margin: 8px 0 0; padding: 0; list-style: none; }
.installations li + li { margin-top: 12px; }
.installations strong { display: block; margin-bottom: 4px; font-size: 14px; }
.connection { max-width: 720px; }
.connection ol { padding-left: 24px; }
.connection li + li { margin-top: 8px; }
.connection-email { color: var(--accent); overflow-wrap: anywhere; }
#vehicles-note { font-size: 14px; }

[hidden] { display: none; }

@media (max-width: 760px) {
  .site-header, main, footer, .card { padding: 20px; }
  .page-heading { gap: 8px; }
  h1 { font-size: 27px; }
  .narrow { margin: 24px auto; }
  .facts { grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; }
  .actions { gap: 10px; }
  .actions > :is(button, a) { flex: 1 1 160px; }
  .card-heading > .badge { margin-top: 3px; }
}

@media (max-width: 680px) {
  .payment { grid-template-columns: minmax(0, 1fr); }
  .payment-qr { justify-self: center; }
  .vehicle-details { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 400px) {
  .site-header, main, footer, .card { padding: 16px; }
  .brand { font-size: 28px; }
  h1 { font-size: 25px; }
  .narrow { margin-top: 16px; }
  .facts { grid-template-columns: minmax(78px, .75fr) minmax(0, 1fr); gap: 8px 10px; }
  .actions > :is(button, a) { flex-basis: 100%; }
  .account-actions button { padding-inline: 12px; }
  .owner-tabs button { flex: 1; padding-inline: 8px; }
  .card-heading { gap: 8px; }
  #vehicles .vin { font-size: 17px; }
  #vehicles .card > p, .payment p { font-size: 14px; }
  .payment p { margin-block: 8px; }
  #vehicles .actions > :is(button, a) {
    flex-basis: 135px;
    padding-inline: 10px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .12s, border-color .12s; }
}
