/* Parts Saver — shared styles (marketing pages + dashboard) */

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn-bg: #fff7ed;
  --warn-border: #fdba74;
  --warn-text: #9a3412;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;
  --info-text: #1e40af;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Top bar ---------- */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo:hover { text-decoration: none; }
.logo .mark {
  background: var(--brand);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
}

.topbar nav { display: flex; align-items: center; gap: 18px; }
.user-area { display: flex; align-items: center; gap: 10px; font-size: 14px; }

/* ---------- Buttons, badges, banners ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 16px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}
.badge-trial { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge-pro, .badge-business { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.badge-free { background: #f1f5f9; color: #475569; border-color: var(--border); }
.badge-locked { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); text-transform: none; }

.banner {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 16px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.banner-info { background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-text); }
.banner-warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); }
.banner .grow { flex: 1 1 320px; }
.banner strong { font-weight: 700; }

/* ---------- Cards / grids ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.car-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 18px 0 40px;
}

.car-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.car-card h3 { margin: 0; font-size: 16px; }
.car-card .meta { font-size: 13px; color: var(--muted); min-height: 20px; }
.car-card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.car-card.locked { opacity: .65; background: #fafafa; }
.car-card.add-card {
  border-style: dashed;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  min-height: 130px;
}
.car-card.add-card:hover { border-color: var(--brand); color: var(--brand); }
.car-card .first-tag { font-size: 11px; color: var(--ok); font-weight: 700; }

/* ---------- Parts table ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px;
}
.toolbar .spacer { flex: 1; }
.toolbar label.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  margin-bottom: 14px;
}

table.parts-table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.parts-table th, .parts-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.parts-table th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.parts-table tr:last-child td { border-bottom: none; }
.parts-table tr:hover td { background: #f8fafc; }
.parts-table td.num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.parts-table td.desc { max-width: 340px; }
.parts-table td.center { text-align: center; }
.parts-table .del-btn { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.parts-table .del-btn:hover { color: var(--danger); }

.pagination { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 18px 0 40px; font-size: 14px; }

/* ---------- retailer find-at chips ---------- */

.find-cell { min-width: 190px; }
.find-links { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.find-chip {
  display: inline-block;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.find-chip:hover { background: var(--brand); border-color: var(--brand); color: #fff; text-decoration: none; }
button.find-more { background: transparent; font-family: inherit; }

.find-modal-body { max-height: 55vh; overflow-y: auto; }
.find-region { margin: 14px 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.find-modal-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.find-modal-grid .find-chip { font-size: 12.5px; padding: 4px 11px; }

/* ---------- catalog browser ---------- */

.cat-group-title {
  margin: 26px 0 10px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.cat-item {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}
.cat-item:hover { border-color: var(--brand); color: var(--brand); }
.cat-item.cat-pending { opacity: .6; }
.cat-badge { display: block; font-size: 11px; color: var(--warn-text); margin-top: 2px; }
.car-card.cat-pick { cursor: pointer; }
.car-card.cat-pick:hover { border-color: var(--brand); }

.diagram-strip { display: flex; gap: 14px; overflow-x: auto; margin: 16px 0; padding-bottom: 4px; }
.diagram-fig {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  flex: 0 0 auto;
}
.diagram-fig img { max-height: 320px; max-width: 460px; display: block; }
.diagram-fig figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 6px; }
.part-thumb { width: 44px; height: 44px; object-fit: contain; display: inline-block; }

.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

/* ---------- Auth / forms / modal ---------- */

.auth-card { max-width: 400px; margin: 60px auto; }
.auth-card h2 { margin-top: 0; }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; background: var(--bg); padding: 4px; border-radius: 8px; }
.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
}
.tabs button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--card);
  color: var(--text);
}
.field input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.form-error { color: var(--danger); font-size: 13px; margin: 10px 0; min-height: 18px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal { width: 100%; max-width: 440px; }
.modal h3 { margin-top: 0; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 200;
  max-width: 90vw;
}

/* ---------- Marketing pages ---------- */

.hero { text-align: center; padding: 72px 20px 56px; }
.hero h1 { font-size: 42px; margin: 0 0 14px; letter-spacing: -.02em; }
.hero p.lead { font-size: 19px; color: var(--muted); max-width: 620px; margin: 0 auto 28px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 30px 0 60px;
}
.features .card h3 { margin: 8px 0 6px; font-size: 16px; }
.features .card p { margin: 0; font-size: 14px; color: var(--muted); }
.features .icon { font-size: 24px; }

.steps { counter-reset: step; margin: 0 0 60px; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.steps li { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; font-size: 14px; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: inline-flex;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 10px;
}
.steps li strong { display: block; margin-bottom: 4px; }

.section-title { text-align: center; font-size: 28px; margin: 0 0 24px; }

.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0 40px;
}
.price-card { display: flex; flex-direction: column; gap: 6px; }
.price-card h3 { margin: 0; font-size: 17px; }
.price-card .price { font-size: 32px; font-weight: 800; }
.price-card .price span { font-size: 14px; font-weight: 500; color: var(--muted); }
.price-card ul { margin: 8px 0 16px; padding-left: 18px; font-size: 14px; color: var(--muted); }
.price-card li { margin-bottom: 5px; }
.price-card.featured { border: 2px solid var(--brand); position: relative; }
.price-card.featured::after {
  content: "Most popular";
  position: absolute;
  top: -11px; right: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}
.price-card .btn { margin-top: auto; }

.prose { max-width: 760px; margin: 40px auto 60px; }
.prose h1 { font-size: 30px; }
.prose h2 { font-size: 20px; margin-top: 32px; }
.prose p, .prose li { font-size: 15px; color: #334155; }
.prose .updated { color: var(--muted); font-size: 13px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  background: var(--card);
}
.site-footer a { color: var(--muted); margin: 0 8px; }

@media (max-width: 640px) {
  .hero h1 { font-size: 30px; }
  .hero p.lead { font-size: 16px; }
}

/* Add-Car dropdowns + VIN */
.field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--card);
  color: var(--text);
}
.field select:disabled { background: var(--bg); color: var(--muted); }
.vin-row { display: flex; gap: 8px; }
.vin-row input { flex: 1; }
