:root {
  color-scheme: light;
  --bg: #f7f8f7;
  --panel: #ffffff;
  --text: #171a1f;
  --muted: #626976;
  --line: #dce1e6;
  --accent: #c62032;
  --accent-dark: #941725;
  --soft: #eef3f1;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.summary {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
}

.search-field,
.check-field {
  display: flex;
  gap: 8px;
}

.search-field {
  flex-direction: column;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
}

.search-field input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-color: var(--accent);
}

.check-field {
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.brand-list {
  display: grid;
  gap: 8px;
}

.brand-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: clip;
}

.brand-toggle {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  padding: 11px 14px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.brand-toggle strong {
  font-size: 16px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-logo {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  object-fit: contain;
}

.brand-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.chevron {
  width: 11px;
  height: 11px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.brand-section[open] .chevron {
  transform: rotate(225deg);
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

th,
td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: #3b424d;
  background: var(--soft);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.vehicle-photo {
  width: 74px;
  height: 46px;
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #f1f3f5;
  cursor: zoom-in;
}

.vehicle-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.product-code {
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.empty-state {
  margin: 24px 0 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

.image-dialog {
  width: min(920px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #111317;
  color: #ffffff;
  overflow: hidden;
}

.image-dialog::backdrop {
  background: rgb(0 0 0 / 70%);
}

.image-dialog img {
  width: 100%;
  max-height: 76vh;
  display: block;
  object-fit: contain;
  background: #090a0c;
}

.image-dialog p {
  margin: 0;
  padding: 10px 14px 13px;
  color: #e7e9ec;
  font-size: 14px;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgb(0 0 0 / 68%);
  color: #ffffff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px 10px 24px;
  }

  .page-header {
    display: block;
  }

  h1 {
    font-size: 24px;
  }

  .summary {
    margin-top: 8px;
    text-align: left;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .check-field {
    justify-content: flex-start;
    white-space: normal;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr {
    display: grid;
    grid-template-columns: 88px 1fr 92px;
    gap: 4px 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }

  tr:last-child {
    border-bottom: 0;
  }

  td {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px;
    padding: 3px 0;
    border-bottom: 0;
    font-size: 13px;
  }

  td[data-field="photo"] {
    grid-row: 1 / span 4;
    grid-column: 1;
    display: block;
    padding: 0;
  }

  td[data-field="photo"]::before {
    content: "";
  }

  td[data-field="brand"],
  td[data-field="fuel"] {
    display: none;
  }

  td[data-field="model"],
  td[data-field="motorization"],
  td[data-field="yearStart"],
  td[data-field="yearEnd"],
  td[data-field="harness"] {
    grid-column: 2 / 4;
  }

  td[data-field="productCode"] {
    grid-column: 3;
    grid-row: 1;
    display: block;
    justify-self: end;
    padding: 4px 7px;
    border-radius: 6px;
    background: #fff1f2;
    text-align: right;
  }

  td[data-field="productCode"]::before {
    content: "";
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .vehicle-photo {
    width: 78px;
    height: 56px;
  }
}
