:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #171a20;
  --muted: #68707b;
  --line: #d9dee4;
  --line-soft: #e9edf1;
  --accent: #c41515;
  --accent-dark: #961111;
  --good: #146c43;
  --warn: #9b4d00;
  --danger: #b42318;
  --shadow: 0 16px 42px rgba(23, 26, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
}

.overline {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.05;
  font-weight: 760;
}

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

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(20, 108, 67, 0.12);
}

.status-dot.refreshing::before {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(155, 77, 0, 0.14);
}

.status-dot.error::before {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.12);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.status-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.status-band > div {
  min-width: 0;
  padding: 17px 18px;
  background: var(--surface);
}

.label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-band strong {
  display: block;
  overflow: hidden;
  font-size: 20px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.toolbar {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) minmax(140px, 0.7fr) minmax(260px, 1.8fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.toolbar label {
  min-width: 0;
}

.toolbar label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.toolbar select,
.toolbar input[type="search"] {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.toolbar select:focus,
.toolbar input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 21, 21, 0.12);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  white-space: nowrap;
}

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

.check-field span {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-transform: none;
}

.error-panel {
  padding: 12px 14px;
  border: 1px solid rgba(180, 35, 24, 0.28);
  border-radius: 8px;
  background: #fff3f1;
  color: var(--danger);
  font-weight: 650;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 1390px;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #f9fafb;
  color: #4d5560;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

thead th.sort-active {
  color: var(--accent);
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

tbody tr:hover {
  background: #fbfcfd;
}

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

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.vehicle-cell {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 310px;
}

.vehicle-cell img {
  width: 84px;
  height: 52px;
  border-radius: 6px;
  background: #f2f3f5;
  object-fit: cover;
}

.vehicle-image-placeholder {
  width: 84px;
  height: 52px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(196, 21, 21, 0.08), rgba(23, 26, 32, 0.04)),
    #f2f3f5;
}

.vehicle-name {
  display: block;
  margin-bottom: 3px;
  font-weight: 760;
}

.vehicle-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.country-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 760;
}

.discount {
  color: var(--accent);
  font-weight: 780;
}

.saving-positive {
  color: var(--good);
  font-weight: 760;
}

.saving-negative {
  color: var(--danger);
  font-weight: 760;
}

.muted {
  color: var(--muted);
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.link-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.empty-cell {
  height: 180px;
  color: var(--muted);
  text-align: center;
}

.source-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 0 2px 10px;
  color: var(--muted);
  font-size: 12px;
}

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

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

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

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

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

  .source-footer {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .status-band {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .primary-button {
    min-width: 126px;
  }
}
