:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #eef3f5;
  --line: #d8e1e5;
  --text: #172026;
  --muted: #64717a;
  --accent: #1f7a6d;
  --accent-strong: #14584f;
  --warning: #b86b18;
  --shadow: 0 16px 40px rgba(22, 35, 43, 0.12);
  --radius: 8px;
}

* {
  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;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 20px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.brand-title {
  font-weight: 800;
  font-size: 18px;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 22px;
}

.nav-tab,
.segment,
.pager button,
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  min-height: 38px;
  transition: 120ms ease;
}

.nav-tab.active,
.segment.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.filter-group {
  margin: 16px 0;
}

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

.search-box input,
.filter-group input,
.filter-group select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 12px;
  color: var(--text);
}

.search-box input:focus,
.filter-group input:focus,
.filter-group select:focus {
  outline: 2px solid rgba(31, 122, 109, 0.18);
  border-color: var(--accent);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.segment {
  min-width: 0;
  padding: 0 6px;
  font-size: 13px;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  text-transform: none !important;
  font-size: 14px !important;
  color: var(--text) !important;
  font-weight: 600 !important;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.stats-panel {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.stat-value {
  font-weight: 800;
  font-size: 19px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.main-panel {
  min-width: 0;
  padding: 26px 28px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
}

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

.icon-button {
  width: 42px;
  font-size: 20px;
}

.content-status {
  min-height: 38px;
  color: var(--muted);
  display: flex;
  align-items: center;
}

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.model-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(15, 35, 45, 0.04);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.model-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.model-media {
  height: 142px;
  background: #dce6ea;
  position: relative;
  overflow: hidden;
}

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

.vehicle-placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(31, 122, 109, 0.16), rgba(184, 107, 24, 0.12)),
    #edf3f5;
  color: #38515a;
}

.vehicle-shape {
  width: 138px;
  height: 58px;
  position: relative;
  border-bottom: 18px solid #38515a;
  border-radius: 8px 28px 7px 7px;
}

.vehicle-shape::before {
  content: "";
  position: absolute;
  left: 34px;
  top: 2px;
  width: 60px;
  height: 30px;
  border-radius: 28px 28px 0 0;
  background: #38515a;
}

.vehicle-shape::after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: -27px;
  width: 94px;
  height: 18px;
  background:
    radial-gradient(circle at 10px 9px, #ffffff 0 5px, #172026 6px 9px, transparent 10px),
    radial-gradient(circle at 82px 9px, #ffffff 0 5px, #172026 6px 9px, transparent 10px);
}

.model-body {
  padding: 13px 14px 14px;
}

.model-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: #375059;
  font-size: 12px;
  font-weight: 700;
}

.model-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.model-manufacturer {
  color: var(--muted);
  margin-top: 3px;
}

.model-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.fact {
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 8px;
  min-width: 0;
}

.fact strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.fact span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.parts-list {
  display: grid;
  gap: 10px;
}

.part-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) minmax(120px, 0.6fr) minmax(180px, 1.2fr) 96px;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.part-name {
  font-weight: 800;
}

.part-ru {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.code-pill {
  background: #ecf1f3;
  border: 1px solid #d6e0e4;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 22px 0 0;
}

.pager button {
  padding: 0 16px;
}

.pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 31, 38, 0.32);
  z-index: 20;
}

.detail-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(760px, 100vw);
  background: #ffffff;
  z-index: 30;
  overflow-y: auto;
  box-shadow: -18px 0 42px rgba(23, 32, 38, 0.18);
  padding: 22px;
}

.close-button {
  position: sticky;
  top: 0;
  float: right;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-size: 25px;
  z-index: 2;
}

.detail-hero {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 20px;
}

.detail-hero .model-media {
  height: 180px;
  border-radius: 8px;
}

.detail-title {
  margin: 2px 0 5px;
  font-size: 28px;
}

.detail-subtitle {
  color: var(--muted);
  margin-bottom: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.section-title {
  font-size: 16px;
  margin: 22px 0 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

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

.data-table th {
  background: var(--surface-soft);
  color: #41545d;
  font-size: 12px;
  text-transform: uppercase;
}

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

.empty-state {
  padding: 22px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .main-panel {
    padding: 20px 16px 28px;
  }

  .part-row {
    grid-template-columns: 1fr;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-grid,
  .model-facts {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 24px;
  }

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

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