/* ---------- Self-hosted type ---------- */

@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/Oswald-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/Oswald-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/Oswald-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/Oswald-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/IBMPlexSans-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/IBMPlexSans-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/IBMPlexSans-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/IBMPlexSans-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/IBMPlexSans-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/IBMPlexSans-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/IBMPlexMono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/IBMPlexMono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/IBMPlexMono-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/IBMPlexMono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens — dark instrument panel by default ---------- */

:root {
  color-scheme: dark;
  --panel: #12161d;
  --panel-raised: #1a2029;
  --panel-sunken: #0d1015;
  --ink: #eef1f5;
  --ink-dim: #8b94a3;
  --line: #262d38;
  --line-strong: #333c4a;
  --accent: #4c86ff;
  --accent-ink: #ffffff;

  --tell-green: #35d07f;
  --tell-amber: #ffb020;
  --tell-red: #ff5757;
  --tell-off: #4b5563;

  --plate-blue: #1d4ed8;

  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --panel: #eceff4;
    --panel-raised: #ffffff;
    --panel-sunken: #e2e6ed;
    --ink: #1a2130;
    --ink-dim: #5c6675;
    --line: #d7dce3;
    --line-strong: #c2c9d3;
    --accent: #1d4ed8;
    --accent-ink: #ffffff;

    --tell-green: #1f9d58;
    --tell-amber: #b5720a;
    --tell-red: #d13b3b;
    --tell-off: #9aa3af;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); }

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
}

/* ---------- Topbar / brand ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel-raised);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.country-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 20px;
  border-radius: 50%;
  background: var(--plate-blue);
  color: #ffffff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ---------- Layout ---------- */

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header--detail {
  align-items: flex-start;
}

.hero-identity {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vehicle-name {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.95rem;
}

.empty {
  color: var(--ink-dim);
  padding: 32px 0;
  text-align: center;
}

.actions { display: flex; gap: 10px; align-items: center; }

/* ---------- Plate chip — a fixed-color object, independent of theme ---------- */

.plate-chip {
  display: inline-flex;
  align-items: stretch;
  border: 2px solid #16181c;
  border-radius: 5px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.plate-chip-band {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  background: var(--plate-blue);
  color: #ffffff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.plate-chip-number {
  padding: 5px 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  color: #16181c;
}

.plate-chip--large .plate-chip-number {
  font-size: 1.6rem;
  padding: 8px 16px;
}

.plate-chip--large .plate-chip-band {
  font-size: 12px;
  padding: 0 9px;
}

/* ---------- Dashboard fleet list ---------- */

.fleet {
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.vehicle-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.12s ease;
}

.vehicle-row:last-child { border-bottom: none; }

.vehicle-row:hover,
.vehicle-row:focus-visible {
  background: var(--panel-sunken);
}

.vehicle-row-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.vehicle-row-label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  color: var(--ink);
}

.doc-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
}

.doc-line {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.85rem;
}

.doc-line-name {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink-dim);
  width: 3.2em;
}

.doc-line-phrase { color: var(--ink-dim); }
.doc-line-phrase--expired { color: var(--tell-red); font-weight: 600; }
.doc-line-phrase--expiring_soon { color: var(--tell-amber); font-weight: 600; }

/* ---------- Telltale dot ---------- */

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
}

.dot-valid { background: var(--tell-green); box-shadow: 0 0 6px 0 color-mix(in srgb, var(--tell-green) 70%, transparent); }
.dot-expiring_soon { background: var(--tell-amber); box-shadow: 0 0 6px 0 color-mix(in srgb, var(--tell-amber) 70%, transparent); }
.dot-expired { background: var(--tell-red); box-shadow: 0 0 6px 0 color-mix(in srgb, var(--tell-red) 70%, transparent); }
.dot-missing { background: var(--tell-off); }

/* ---------- Vehicle detail: document panel ---------- */

.identifiers {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 20px 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.identifiers dt {
  color: var(--ink-dim);
  font-size: 0.8rem;
  margin: 0;
}

.identifiers dd {
  margin: 0;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  font-size: 0.95rem;
}

.doc-panel {
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.doc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.doc-panel > div:last-child { border-bottom: none; }

.doc-row-status {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 130px;
  flex-shrink: 0;
}

.doc-row-name {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.doc-row-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 180px;
  min-width: 0;
}

.doc-row-phrase { font-weight: 600; }
.doc-row-phrase--expired { color: var(--tell-red); }
.doc-row-phrase--expiring_soon { color: var(--tell-amber); }
.doc-row-phrase--valid { color: var(--tell-green); }
.doc-row-phrase--missing { color: var(--ink-dim); font-weight: 400; }

.doc-row-on {
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.doc-row-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

/* ---------- Renew panel ---------- */

.renew-panel {
  padding: 18px 20px;
  background: var(--panel-sunken);
  border-bottom: 1px solid var(--line);
}

.renew-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.renew-form .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.renew-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
  margin: 0;
}

.renew-form .date-card { margin-top: 0; }

.renew-form input[type="number"] {
  width: 100px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: var(--ink);
  font-size: 14px;
  font-family: var(--font-body);
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  border: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.button-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.button-danger { background: var(--tell-red); color: #ffffff; }

.link-button {
  background: none;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  text-decoration: underline;
  padding: 0;
}

/* ---------- Forms ---------- */

.form-page {
  max-width: 420px;
  margin: 24px auto 0;
}

.form-page h1 {
  text-align: center;
  margin: 0 0 16px;
}

form.login-form, form.vehicle-form {
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
  margin-top: 10px;
}

form input[type="text"],
form input[type="password"] {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-sunken);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
  padding: 4px 14px 14px;
}

legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
  padding: 0 4px;
}

.login-form button[type="submit"] {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Date card ---------- */

.date-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-sunken);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.date-card:hover { border-color: var(--accent); }

.date-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.date-card-icon {
  width: 18px;
  height: 18px;
  color: var(--ink-dim);
  flex-shrink: 0;
}

.date-display {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.date-card.is-empty .date-display {
  font-weight: 400;
  color: var(--ink-dim);
}

.date-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  opacity: 0;
  cursor: pointer;
}

/* ---------- Flashes ---------- */

.flashes {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
}

.flash-error { background: color-mix(in srgb, var(--tell-red) 16%, var(--panel-raised)); color: var(--tell-red); }
.flash-info { background: color-mix(in srgb, var(--tell-green) 16%, var(--panel-raised)); color: var(--tell-green); }

/* ---------- Focus visibility ---------- */

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

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .vehicle-row { grid-template-columns: 1fr; }
  .doc-row { flex-direction: column; align-items: flex-start; }
  .doc-row-actions { margin-left: 0; }
  .page-header--detail { flex-direction: column; gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .vehicle-row, .date-card { transition: none; }
}
