:root {
  --ink: #18202c;
  --muted: #647084;
  --line: #d9e0ea;
  --paper: #ffffff;
  --soft: #f4f7fb;
  --blue: #143ee6;
  --blue-dark: #0d2ca9;
  --gold: #f3b64f;
  --red: #d92323;
  --shadow: 0 18px 45px rgba(24, 32, 44, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: #101724;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: grid;
  gap: 14px;
}

.brand img {
  width: 100%;
  max-width: 210px;
  background: #fff;
  border-radius: 6px;
  padding: 8px;
}

.brand strong {
  font-size: 19px;
}

.brand span {
  color: #b8c4d8;
  font-size: 14px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button,
.nav a {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  color: #fff;
  background: rgba(255,255,255,.06);
  text-align: left;
  padding: 10px 12px;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.nav button:hover,
.nav button.active,
.nav a:hover,
.nav a.active {
  background: var(--blue);
  border-color: var(--blue);
}

.content {
  min-width: 0;
  padding: 28px;
}

.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(120deg, rgba(16,23,36,.94), rgba(20,62,230,.72)),
    url("moto-alf-logo.jpg") center / min(900px, 90vw) no-repeat;
}

.hero-panel {
  width: min(720px, 100%);
  color: #fff;
  text-align: center;
}

.hero-logo {
  width: min(500px, 90%);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 24px 0 8px;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1;
}

.hero p {
  margin: 0 auto 26px;
  color: #dfe7f4;
  font-size: 18px;
  max-width: 560px;
}

.login-panel {
  max-width: 520px;
}

.login-form {
  display: grid;
  gap: 12px;
  max-width: 360px;
  margin: 0 auto;
  text-align: left;
}

.login-form label {
  color: #fff;
}

.form-error {
  color: #ffd0d0;
  text-align: center;
  font-weight: 700;
}

.toast {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 20;
  background: #101724;
  color: #fff;
  border-left: 5px solid var(--gold);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  font-weight: 700;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0;
  font-size: 30px;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat,
.panel,
.vehicle-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(24, 32, 44, .06);
}

.stat {
  padding: 18px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0;
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.wide {
  grid-column: 1 / -1;
}

.grid {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 130px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(20,62,230,.12);
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.actions form {
  margin: 0;
}

.service-item form {
  margin: 0;
}

.btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn.primary {
  background: var(--blue);
  color: #fff;
}

.btn.primary:hover {
  background: var(--blue-dark);
}

.btn.secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.btn.danger {
  color: #fff;
  background: var(--red);
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.vehicle-list {
  display: grid;
  gap: 12px;
}

.vehicle-card {
  padding: 15px;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.thumb {
  width: 78px;
  aspect-ratio: 1;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #eef2f7;
  object-fit: cover;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.vehicle-card h3 {
  margin: 0 0 5px;
  font-size: 18px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  width: 38%;
  color: var(--muted);
  font-size: 13px;
}

.vehicle-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #eef2f7;
}

.qr-box {
  display: grid;
  justify-items: center;
  gap: 9px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.qr-box img {
  width: 180px;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.service-list {
  display: grid;
  gap: 12px;
}

.service-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.service-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.service-item p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.65);
}

.print-sheet {
  width: min(900px, 100%);
  margin: 0 auto;
  background: #fff;
  color: #111;
  padding: 28px;
}

.print-top {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 130px;
  gap: 16px;
  align-items: center;
  border-bottom: 2px solid #111;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.print-top img {
  max-width: 220px;
}

.print-top h1 {
  margin: 0;
  font-size: 24px;
}

.print-qr {
  width: 118px;
  height: 118px;
}

.print-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.print-section h2 {
  font-size: 16px;
  margin: 0 0 8px;
  border-bottom: 1px solid #999;
  padding-bottom: 4px;
}

.print-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.print-section th,
.print-section td {
  border-bottom: 1px solid #ddd;
  padding: 6px 0;
  text-align: left;
  vertical-align: top;
}

.print-section th {
  width: 40%;
}

.print-services {
  margin-top: 18px;
}

.print-photo-section {
  margin-top: 18px;
}

.print-photo {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 6px;
}

@media (max-width: 880px) {
  .app-shell,
  .detail-layout,
  .form-grid,
  .grid.two,
  .stats,
  .print-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .vehicle-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .vehicle-card .actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .page-head {
    align-items: start;
    flex-direction: column;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    background: #fff;
  }

  .sidebar,
  .page-head,
  .actions,
  .no-print {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .content {
    padding: 0;
  }

  .print-sheet {
    width: 100%;
    padding: 0;
  }

  .service-item,
  .panel {
    break-inside: avoid;
    box-shadow: none;
  }
}
