:root {
  color-scheme: dark;
  --bg: #050608;
  --surface: #101216;
  --surface-2: #171a20;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f5f7fa;
  --muted: #9ca3af;
  --soft: #c9ced6;
  --accent: #f5f7fa;
  --accent-ink: #08090b;
  --danger: #ff6b6b;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --line: rgba(0, 0, 0, 0.1);
  --text: #111318;
  --muted: #68707d;
  --soft: #303642;
  --accent: #111318;
  --accent-ink: #ffffff;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), transparent 320px),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 0 clamp(16px, 5vw, 48px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.wordmark,
.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wordmark {
  font-weight: 700;
}

.brand-logo {
  width: 170px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: #000000;
}

.brand-mark {
  display: block;
  width: min(310px, 92%);
  aspect-ratio: 16 / 9;
  object-fit: contain;
  margin: 0 auto 18px;
}

.topnav a,
.topnav button,
.ghost-action,
.panel-head a {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

.topnav form {
  margin: 0;
}

.auth-page main {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.login-panel h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  line-height: 0.95;
}

.login-panel p {
  margin: 14px 0 30px;
  text-align: center;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--soft);
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 14px 14px;
  outline: none;
}

.login-form input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.login-form button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

.messages {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 12px 14px;
}

.message--success {
  border-color: rgba(67, 214, 134, 0.3);
  background: rgba(67, 214, 134, 0.08);
}

.alert {
  margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--danger) 42%, var(--line));
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.page-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 32px 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

.page-hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 7vw, 5.4rem);
  line-height: 0.95;
}

.metric-strip,
.vehicle-grid,
.split-layout,
.detail-grid {
  display: grid;
  gap: 16px;
}

.metric-strip {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 18px;
}

.metric-strip article,
.vehicle-card,
.panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.metric-strip article {
  padding: 18px;
}

.metric-strip span,
.vehicle-card span,
.timeline-row span,
.timeline-row em,
.muted {
  color: var(--muted);
}

.metric-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 1.4rem;
}

.vehicle-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vehicle-card {
  display: grid;
  gap: 20px;
  padding: 22px;
  transition: transform 160ms ease, border-color 160ms ease;
}

.vehicle-card__image,
.vehicle-hero-image img,
.vehicle-detail-hero__media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.vehicle-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}

.vehicle-card__header,
.panel-head,
.timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.vehicle-card__header p,
.vehicle-card__header h2 {
  margin: 0;
}

.vehicle-card__header p {
  color: var(--muted);
}

.vehicle-card__header h2 {
  margin-top: 5px;
  font-size: 1.7rem;
}

.vehicle-card__metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.vehicle-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vehicle-card__meta span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: var(--surface-2);
}

.vehicle-card__metrics div {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.vehicle-card__metrics strong {
  display: block;
  margin-top: 5px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
}

.split-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vehicle-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  gap: 24px;
  align-items: end;
  padding: 28px 0 18px;
}

.vehicle-detail-hero__content h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 5rem);
  line-height: 0.95;
}

.hero-actions,
.section-nav,
.row-actions,
.linked-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-actions {
  margin-top: 22px;
}

.vehicle-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  color: var(--muted);
  font-size: clamp(4rem, 14vw, 9rem);
  font-weight: 800;
}

.section-nav {
  position: sticky;
  top: 73px;
  z-index: 8;
  margin: 4px 0 18px;
  padding: 10px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.section-nav a,
.row-actions a,
.linked-docs a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.92rem;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.vehicle-hero-image {
  margin-bottom: 18px;
}

.vehicle-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.document-preview {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.notes-block {
  margin: 12px 0 0;
  color: var(--soft);
  white-space: pre-wrap;
}

.data-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.data-list div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.data-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.data-list dt {
  color: var(--muted);
}

.data-list dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.form-shell {
  width: min(760px, 100%);
}

.app-form {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  padding: 22px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--soft);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 118px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.field--checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.field--checkbox span {
  grid-column: 2;
  grid-row: 1;
}

.field--checkbox input {
  grid-column: 1;
  grid-row: 1;
  width: 20px;
  height: 20px;
  padding: 0;
}

.field small,
.field-error {
  color: var(--muted);
  font-size: 0.9rem;
}

.field-error {
  color: var(--danger);
  font-weight: 600;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 6px;
}

.form-actions button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
}

.form-actions .danger-button {
  background: var(--danger);
  color: #ffffff;
}

.panel {
  padding: 20px;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-row strong small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 500;
}

.timeline-row:last-child {
  border-bottom: 0;
}

.timeline-row em {
  font-style: normal;
}

.compact-timeline .timeline-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--surface-2);
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill--faellig {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger);
}

.block-panel {
  margin-bottom: 18px;
}

.table-list {
  display: grid;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row span,
.table-row small,
.document-card span,
.document-card small {
  color: var(--muted);
}

.table-row strong,
.document-card strong {
  display: block;
  margin: 5px 0;
}

.row-actions {
  align-items: center;
  justify-content: flex-end;
}

.row-actions em {
  color: var(--soft);
  font-style: normal;
  white-space: nowrap;
}

.danger-link {
  color: var(--danger) !important;
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.document-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
}

.delete-copy {
  margin: 0;
  color: var(--soft);
}

@media (max-width: 760px) {
  main {
    width: min(100vw - 24px, 1180px);
    padding-top: 20px;
  }

  .topbar,
  .page-hero,
  .vehicle-card__header {
    align-items: stretch;
    flex-direction: column;
  }

  .topnav {
    flex-wrap: wrap;
  }

  .metric-strip,
  .vehicle-grid,
  .split-layout,
  .vehicle-info,
  .detail-grid,
  .document-grid,
  .vehicle-detail-hero,
  .table-row {
    grid-template-columns: 1fr;
  }

  .section-nav {
    top: 129px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .section-nav a,
  .row-actions a {
    white-space: nowrap;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions a,
  .form-actions button {
    width: 100%;
    text-align: center;
  }

  .vehicle-card__metrics {
    grid-template-columns: 1fr;
  }

  .login-panel {
    padding: 28px 20px;
  }
}
