:root {
  --bg: #0d1117;
  --panel: #121926;
  --panel-soft: #172033;
  --card: #f7f8fb;
  --text: #111827;
  --muted: #6b7280;
  --line: #dbe2ee;
  --accent: #e4512a;
  --accent-dark: #b9381c;
  --gold: #f7b731;
  --green: #1f9d62;
  --blue: #2563eb;
  --white: #fff;
  --shadow: 0 24px 60px rgba(15, 23, 42, .16);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #101622 0%, #1b2639 45%, #eef2f7 45%, #eef2f7 100%);
  color: var(--text);
  min-height: 100vh;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(13, 17, 23, .95);
  color: var(--white);
  padding: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  font-weight: 900; letter-spacing: -1px;
}
.brand h1 { margin: 0; font-size: 22px; line-height: 1; }
.brand p { margin: 4px 0 0; color: #aab4c5; }
.nav-menu { display: grid; gap: 10px; }
.nav-item {
  border: 0; border-radius: 14px; padding: 13px 15px;
  background: transparent; color: #cbd5e1; text-align: left;
  transition: .2s ease;
}
.nav-item:hover, .nav-item.active { background: #202c40; color: #fff; }
.sidebar-card {
  margin-top: auto;
  background: #182235;
  border: 1px solid #29354a;
  border-radius: 22px;
  padding: 20px;
}
.sidebar-card strong { display: block; font-size: 24px; margin: 8px 0; }
.sidebar-card p { margin: 0; color: #aab4c5; line-height: 1.5; }

.main-content { padding: 32px; overflow: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.topbar h2 { margin: 6px 0 0; color: #fff; font-size: clamp(28px, 4vw, 48px); letter-spacing: -2px; max-width: 820px; }
.eyebrow { color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .13em; font-weight: 800; }
.top-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.primary-btn, .ghost-btn {
  border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.primary-btn { background: var(--accent); color: #fff; box-shadow: 0 12px 28px rgba(228,81,42,.28); }
.primary-btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
.ghost-btn { background: #fff; color: #111827; border: 1px solid var(--line); }
.ghost-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.ghost-btn.small { padding: 9px 13px; border-radius: 12px; }
.full { width: 100%; }

.hero-panel, .search-card, .results-panel, .order-panel, .vendor-strip {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(219,226,238,.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.hero-panel {
  display: grid; grid-template-columns: 1.4fr .9fr; gap: 20px;
  padding: 28px; margin-bottom: 22px;
}
.status-pill { display: inline-flex; padding: 8px 12px; border-radius: 999px; background: #fff0e9; color: var(--accent-dark); font-weight: 800; font-size: 12px; }
.hero-copy h3 { font-size: clamp(26px, 4vw, 42px); letter-spacing: -1.6px; margin: 14px 0 10px; }
.hero-copy p { color: var(--muted); line-height: 1.7; max-width: 760px; margin: 0; }
.hero-stats { display: grid; gap: 14px; }
.hero-stats div { background: var(--panel-soft); color: #fff; border-radius: 22px; padding: 20px; }
.hero-stats strong { display: block; font-size: 34px; letter-spacing: -1px; }
.hero-stats span { color: #aab4c5; }

.search-card { padding: 24px; margin-bottom: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h3 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.7px; }
.section-heading.compact { margin-bottom: 14px; }
.search-grid { display: grid; grid-template-columns: 1.8fr .8fr 1fr .8fr; gap: 14px; }
label { display: grid; gap: 8px; color: #374151; font-weight: 700; font-size: 13px; }
input, select {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px;
  background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(228,81,42,.12); }
.quick-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; font-weight: 800; color: #374151; }
.chip.active { background: var(--panel); color: #fff; border-color: var(--panel); }

.content-grid { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.results-panel, .order-panel, .vendor-strip { padding: 24px; }
.mini-select { max-width: 190px; padding: 10px 12px; }
.parts-list { display: grid; gap: 14px; }
.part-card {
  border: 1px solid var(--line); border-radius: 22px; padding: 18px;
  display: grid; grid-template-columns: 1fr auto; gap: 16px;
  background: #fff;
}
.part-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.part-title h4 { margin: 0; font-size: 18px; }
.source-badge { border-radius: 999px; padding: 6px 10px; font-size: 11px; font-weight: 900; background: #eef2ff; color: #3730a3; }
.source-badge.salvage { background: #ecfdf5; color: #047857; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.meta span { background: #f3f4f6; border-radius: 999px; padding: 7px 10px; }
.price-box { text-align: right; min-width: 150px; }
.price-box strong { display: block; font-size: 24px; margin-bottom: 10px; }
.reserve-btn { border: 0; border-radius: 12px; padding: 10px 12px; font-weight: 900; color: #fff; background: var(--green); }
.reserve-btn.added { background: #94a3b8; }

.delivery-box, .cart-box { border: 1px solid var(--line); border-radius: 22px; padding: 18px; background: #fff; }
.delivery-box { display: grid; gap: 14px; }
.quote-summary { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; display: grid; gap: 10px; }
.quote-summary div { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); }
.quote-summary div:last-child { color: var(--text); font-size: 18px; }
.fine-print { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.cart-box { margin-top: 16px; }
.cart-items { margin-top: 12px; display: grid; gap: 10px; }
.cart-items.empty { color: var(--muted); font-size: 14px; }
.cart-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.vendor-strip { margin-top: 22px; }
.vendor-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.vendor-grid article { background: var(--panel); color: #fff; padding: 18px; border-radius: 20px; display: grid; gap: 7px; }
.vendor-grid span { color: #aab4c5; }
.vendor-grid em { color: var(--gold); font-style: normal; font-weight: 800; }
.toast {
  position: fixed; right: 24px; bottom: 24px; background: #111827; color: #fff;
  padding: 14px 18px; border-radius: 16px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: .25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .nav-menu { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; }
  .content-grid, .hero-panel { grid-template-columns: 1fr; }
  .search-grid { grid-template-columns: 1fr 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar h2 { color: #fff; }
}
@media (max-width: 720px) {
  .main-content, .sidebar { padding: 20px; }
  .search-grid, .vendor-grid { grid-template-columns: 1fr; }
  .part-card { grid-template-columns: 1fr; }
  .price-box { text-align: left; }
  .top-actions { width: 100%; }
  .top-actions button { flex: 1; }
}

/* Mobile-first refinements added after review */
@media (max-width: 900px) {
  body {
    background: #eef2f7;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-radius: 0 0 28px 28px;
    padding: 18px;
    gap: 18px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .nav-menu {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-menu::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    white-space: nowrap;
    flex: 0 0 auto;
    padding: 11px 13px;
    border-radius: 999px;
  }

  .sidebar-card {
    display: none;
  }

  .main-content {
    padding: 18px;
    overflow: visible;
  }

  .topbar {
    background: #111827;
    color: #fff;
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 18px;
  }

  .topbar h2 {
    color: #fff;
    letter-spacing: -1.2px;
  }

  .top-actions {
    justify-content: stretch;
  }

  .hero-panel,
  .search-card,
  .results-panel,
  .order-panel,
  .vendor-strip {
    border-radius: 22px;
  }

  .hero-panel {
    padding: 20px;
  }

  .hero-copy h3 {
    letter-spacing: -1px;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-stats div {
    padding: 14px;
    border-radius: 18px;
  }

  .hero-stats strong {
    font-size: 24px;
  }

  .hero-stats span {
    display: block;
    font-size: 12px;
  }

  .content-grid {
    display: flex;
    flex-direction: column;
  }

  .results-panel,
  .order-panel,
  .vendor-strip,
  .search-card {
    width: 100%;
    padding: 20px;
  }

  .order-panel {
    order: 2;
  }

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

@media (max-width: 640px) {
  .main-content,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .hero-panel,
  .search-card,
  .results-panel,
  .order-panel,
  .vendor-strip {
    border-radius: 20px;
  }

  .topbar {
    padding: 18px;
  }

  .topbar h2 {
    font-size: 28px;
    line-height: 1.05;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .top-actions button,
  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .hero-panel {
    gap: 16px;
  }

  .hero-copy h3 {
    font-size: 26px;
    line-height: 1.08;
  }

  .hero-copy p {
    font-size: 15px;
    line-height: 1.6;
  }

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

  .hero-stats div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .section-heading,
  .section-heading.compact {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .section-heading h3 {
    font-size: 21px;
    line-height: 1.15;
  }

  .section-heading .ghost-btn.small,
  .mini-select {
    width: 100%;
    max-width: none;
  }

  .search-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  input,
  select {
    min-height: 48px;
    font-size: 16px;
  }

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

  .chip {
    width: 100%;
    padding: 11px 12px;
  }

  .part-card {
    padding: 16px;
    border-radius: 18px;
  }

  .part-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .part-title h4 {
    font-size: 17px;
    line-height: 1.25;
  }

  .meta {
    gap: 8px;
  }

  .meta span {
    width: 100%;
    border-radius: 12px;
  }

  .price-box {
    background: #f8fafc;
    border-radius: 16px;
    padding: 14px;
  }

  .price-box strong {
    font-size: 26px;
  }

  .reserve-btn {
    width: 100%;
    min-height: 46px;
  }

  .quote-summary div,
  .cart-line {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    text-align: center;
  }
}

@media (max-width: 390px) {
  .brand h1 {
    font-size: 18px;
  }

  .brand p {
    font-size: 13px;
  }

  .topbar h2,
  .hero-copy h3 {
    font-size: 24px;
  }

  .quick-filters {
    grid-template-columns: 1fr;
  }
}

/* Dedicated mobile header/navigation fix */
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #29354a;
  border-radius: 14px;
  background: #182235;
  color: #fff;
  min-height: 46px;
  padding: 10px 12px;
  font-weight: 800;
}

.mobile-menu-btn span {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
}

.mobile-menu-btn em {
  font-style: normal;
  font-size: 13px;
}

@media (max-width: 760px) {
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    border-radius: 0;
    box-shadow: 0 14px 35px rgba(15, 23, 42, .18);
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .mobile-menu-btn span:nth-child(2),
  .mobile-menu-btn span:nth-child(3) {
    display: none;
  }

  .nav-menu {
    display: none;
    overflow: visible;
    padding: 8px 0 0;
  }

  .sidebar.nav-open .nav-menu {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .nav-item {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
    padding: 13px 14px;
    text-align: left;
    background: #121926;
  }

  .nav-item.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  }

  .main-content {
    padding-top: 14px;
  }
}

@media (max-width: 430px) {
  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 14px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .brand p {
    font-size: 12px;
  }

  .mobile-menu-btn {
    min-height: 42px;
    padding: 8px 10px;
  }
}
