:root {
  --ink: #20242a;
  --muted: #68717d;
  --line: #dfe3e8;
  --surface: #ffffff;
  --canvas: #f4f5f7;
  --red: #d71920;
  --red-dark: #ac1117;
  --soft-red: #fff1f1;
  --green: #147a45;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, a { font: inherit; }
button { color: inherit; }
.site-header { position: sticky; top: 0; z-index: 50; background: #20242a; color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.16); }
.header-inner { min-height: 66px; max-width: 1800px; margin: auto; padding: 10px 24px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-weight: 700; }
.brand img { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 5px; padding: 3px; }
.brand span { font-size: 18px; }
.header-label { color: #c9ced5; font-size: 13px; border-left: 1px solid #4b525b; padding-left: 18px; }
.warehouse-link, .primary-button, .secondary-button { border-radius: 5px; font-weight: 700; text-decoration: none; cursor: pointer; transition: .16s ease; }
.warehouse-link { margin-left: auto; padding: 10px 14px; color: #fff; border: 1px solid #5b636e; background: #30363e; font-size: 13px; }
.warehouse-link:hover { border-color: #fff; }
.app-shell { max-width: 1520px; margin: 0 auto; padding: 28px 24px 44px; }
.loading, .empty { min-height: 420px; display: grid; place-items: center; color: var(--muted); text-align: center; }
.spinner { width: 22px; height: 22px; border: 3px solid #ddd; border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.eyebrow { margin: 0 0 7px; color: var(--red); font-weight: 800; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.03em; }
h2 { margin-bottom: 6px; font-size: 25px; letter-spacing: -.02em; }
.lede { max-width: 760px; color: var(--muted); line-height: 1.55; }
.topline { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.count-chip, .badge { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 5px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.variant-series-list { display: grid; gap: 30px; }
.variant-series { display: grid; gap: 14px; }
.series-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.series-head h2 { margin: 2px 0 0; font-size: 22px; }
.variant-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.diagram-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.variant-card, .diagram-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; text-align: left; text-decoration: none; padding: 0; cursor: pointer; overflow: hidden; box-shadow: 0 2px 9px rgba(25,33,43,.04); transition: .16s ease; }
.variant-card { padding: 18px; min-height: 164px; display: flex; flex-direction: column; }
.variant-card:hover, .diagram-card:hover { border-color: var(--red); box-shadow: 0 8px 22px rgba(25,33,43,.1); transform: translateY(-1px); }
.variant-name { color: var(--red-dark); font-size: 19px; font-weight: 800; }
.variant-spec { margin-top: 7px; color: var(--ink); font-size: 14px; line-height: 1.45; }
.variant-meta { margin-top: auto; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.variant-code { margin-top: 10px; color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.crumbs button { appearance: none; border: 0; padding: 0; background: none; cursor: pointer; color: var(--muted); }
.crumbs button:hover { color: var(--red); }
.vehicle-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: var(--surface); box-shadow: 0 2px 9px rgba(25,33,43,.04); }
.vehicle-panel strong { display: block; font-size: 19px; }
.vehicle-panel small { display: block; margin-bottom: 3px; color: var(--muted); }
.vehicle-panel .spec { padding-left: 22px; border-left: 1px solid var(--line); font-size: 13px; }
.vehicle-panel .secondary-button { margin-left: auto; }
.primary-button, .secondary-button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid transparent; padding: 10px 14px; }
.primary-button { background: var(--red); color: #fff; }
.primary-button:hover { background: var(--red-dark); }
.secondary-button { background: #fff; color: var(--ink); border-color: var(--line); }
.secondary-button:hover { border-color: var(--red); color: var(--red); }
.catalog-tools { display: grid; grid-template-columns: 1fr minmax(320px, 420px); gap: 20px; align-items: end; margin: 26px 0 14px; }
.search-box { position: relative; }
.search-box input { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 5px; padding: 0 14px 0 42px; background: var(--surface); outline: none; }
.search-box input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(215,25,32,.1); }
.search-box::before { content: "⌕"; position: absolute; left: 14px; top: 8px; color: var(--muted); font-size: 22px; }
.category-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 24px; }
.category-tab { min-height: 62px; border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; background: var(--surface); cursor: pointer; text-align: left; }
.category-tab strong { display: block; font-size: 13px; }
.category-tab small { color: var(--muted); }
.category-tab.active { background: var(--red); color: #fff; border-color: var(--red); }
.category-tab.active small { color: #ffd8da; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.diagram-card { position: relative; content-visibility: auto; contain-intrinsic-size: 220px; }
.diagram-card-image { height: 112px; display: grid; place-items: center; padding: 10px; overflow: hidden; border-bottom: 1px solid var(--line); background: #fff; }
.diagram-card-image img { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 92px; object-fit: contain; mix-blend-mode: multiply; }
.diagram-card-body { position: relative; z-index: 2; display: block; min-height: 104px; padding: 11px 12px 13px; background: #fff; box-shadow: 0 -1px 0 var(--line); }
.figure-no { color: var(--red); font-weight: 800; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.diagram-card h3 { display: -webkit-box; margin: 5px 0 8px; min-height: 35px; overflow: hidden; color: #171a1f; font-size: 13px; line-height: 1.35; text-transform: capitalize; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.diagram-card p { margin: 0; color: var(--muted); font-size: 12px; }
.diagram-page { max-width: none; padding-top: 12px; padding-bottom: 12px; }
.diagram-page > .crumbs { margin-bottom: 8px; }
.diagram-header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); padding: 13px 16px; }
.diagram-header .title { min-width: 0; flex: 1; }
.diagram-header h1 { margin: 0; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoom-controls { display: flex; align-items: center; gap: 6px; }
.zoom-controls button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer; font-weight: 800; }
.zoom-value { width: 48px; text-align: center; color: var(--muted); font-size: 12px; }
.image-pages { display: flex; gap: 8px; overflow-x: auto; border: 1px solid var(--line); border-bottom: 0; background: #f8f8f8; padding: 8px; }
.image-page { width: 92px; height: 62px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; padding: 3px; cursor: pointer; }
.image-page.active { border-color: var(--red); box-shadow: 0 0 0 2px rgba(215,25,32,.12); }
.image-page img { width: 100%; height: 100%; object-fit: contain; }
.diagram-stage { height: 72vh; min-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: #fff; }
.diagram-inner { margin: 0 auto; padding: 20px; }
.diagram-image-wrap { position: relative; }
.diagram-image-wrap > img { display: block; width: 100%; height: auto; user-select: none; }
.hotspot { position: absolute; border: 2px solid transparent; border-radius: 2px; padding: 0; background: transparent; cursor: pointer; }
.hotspot:hover { border-color: var(--red); background: rgba(215,25,32,.13); }
.hotspot.active { z-index: 3; border-color: #e00000; background: rgba(255,0,0,.23); box-shadow: 0 0 0 3px rgba(224,0,0,.16); }
.parts-panel { margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.parts-panel-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.parts-panel-head h2 { margin: 0; font-size: 18px; }
.parts-panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 1320px; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 13px; text-align: left; background: #f4f5f7; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td { padding: 12px 13px; border-top: 1px solid var(--line); }
tr[data-code] { cursor: pointer; }
tr[data-code]:hover, tr.active { background: var(--soft-red); }
.part-number { color: var(--red-dark); font: 700 13px ui-monospace, SFMono-Regular, Consolas, monospace; }
.compact-part .part-number { text-decoration: none; }
.compact-part .part-number:hover { text-decoration: underline; }
.stock-link { color: var(--red-dark); font-weight: 700; text-decoration: none; white-space: nowrap; }
.stock-link:hover { text-decoration: underline; }
.stock-link.secondary { color: var(--muted); }
.part-photo-cell { width: 112px; }
.real-photo { position: relative; width: 92px; height: 68px; display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: #fff; text-decoration: none; }
.real-photo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.real-photo span { position: absolute; right: 3px; bottom: 3px; padding: 2px 4px; border-radius: 3px; background: rgba(32,36,42,.82); font-size: 9px; font-weight: 700; }
.photo-status { color: var(--muted); font-size: 11px; }
.photo-search { display: inline-block; max-width: 90px; color: var(--muted); font-size: 11px; line-height: 1.25; }
.cart-actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.qty-stepper { display: inline-flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.qty-stepper button { width: 27px; height: 30px; border: 0; background: #f3f4f6; cursor: pointer; }
.qty-stepper input { width: 32px; height: 30px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; outline: 0; }
.add-btn, .send-btn { border: 0; border-radius: 4px; background: var(--red); color: #fff; font-weight: 800; cursor: pointer; }
.add-btn { padding: 8px 10px; font-size: 11px; }
.add-btn:hover, .send-btn:hover { background: var(--red-dark); }
.add-btn.added { background: var(--green); }

/* Full-screen figure workspace: fitted diagram on the left, compact list on the right. */
.diagram-page .diagram-header { border-bottom: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; margin-bottom: 10px; }
.figure-workspace { height: calc(100vh - 184px); min-height: 520px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(430px, 34vw); gap: 12px; }
.diagram-canvas-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.diagram-canvas-panel .image-pages { flex: 0 0 auto; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.diagram-canvas-panel .image-pages + .diagram-stage { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.figure-workspace .diagram-stage { flex: 1 1 auto; height: auto; min-height: 0; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); }
.figure-workspace .diagram-inner { flex: 0 0 auto; padding: 10px; }
.side-parts { min-height: 0; height: 100%; margin-top: 0; display: flex; flex-direction: column; }
.side-parts .parts-panel-head { flex: 0 0 auto; padding: 11px 13px; }
.side-parts .parts-panel-head h2 { font-size: 17px; }
.side-parts .parts-panel-head p { font-size: 11px; }
.parts-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.compact-part { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 11px; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; transition: background .14s ease; }
.compact-part:last-child { border-bottom: 0; }
.compact-part:hover { background: #fff8f8; }
.compact-part.active { position: relative; z-index: 1; background: #ffe3e4; box-shadow: inset 5px 0 0 var(--red), inset 0 0 0 2px rgba(215,25,32,.42); }
.compact-part.active .part-number, .compact-part.active .compact-part-name { color: #8f0b10; }
.compact-part.selected-pulse { animation: selected-part-pulse .9s ease-out; }
@keyframes selected-part-pulse { 0%, 35% { background: #ffc8ca; box-shadow: inset 7px 0 0 var(--red), inset 0 0 0 3px rgba(215,25,32,.62), 0 0 0 4px rgba(215,25,32,.12); } 100% { background: #ffe3e4; box-shadow: inset 5px 0 0 var(--red), inset 0 0 0 2px rgba(215,25,32,.42); } }
.compact-part-copy { min-width: 0; }
.compact-part-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.compact-part-name { margin-top: 4px; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 650; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.compact-part-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 5px; color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.compact-part .part-number { font-size: 12px; }
.compact-part .cart-actions { gap: 5px; }
.compact-part .qty-stepper button { width: 24px; height: 28px; }
.compact-part .qty-stepper input { width: 28px; height: 28px; }
.compact-part .add-btn { min-width: 43px; padding: 8px 7px; }
.actual-photo-button { display: inline-flex; gap: 4px; align-items: center; padding: 3px 6px; border: 1px solid #b9c8bf; border-radius: 4px; background: #f1faf5; color: var(--green); cursor: pointer; font-size: 9px; font-weight: 800; white-space: nowrap; }
.actual-photo-button:hover { border-color: var(--green); background: #e2f5e9; }
.photo-lightbox { position: fixed; inset: 0; z-index: 130; visibility: hidden; opacity: 0; display: grid; place-items: center; transition: .18s ease; }
.photo-lightbox.open { visibility: visible; opacity: 1; }
.photo-lightbox-scrim { position: absolute; inset: 0; border: 0; background: rgba(16,20,24,.76); cursor: zoom-out; }
.photo-lightbox-card { position: relative; z-index: 1; width: min(920px, 90vw); max-height: 90vh; padding: 12px; border-radius: 8px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.photo-lightbox-card img { width: 100%; max-height: calc(90vh - 62px); display: block; object-fit: contain; }
.photo-lightbox-close { position: absolute; top: 18px; right: 18px; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(32,36,42,.86); color: #fff; cursor: pointer; font-size: 24px; line-height: 1; }
.photo-lightbox-title { padding: 8px 4px 0; font-size: 12px; font-weight: 800; }

/* Shared Warehouse V1 inquiry cart, scoped to this full-width EPC page. */
.cart-tab { position: fixed; right: 0; top: 42%; z-index: 80; display: grid; grid-template-columns: auto auto; gap: 2px 7px; align-items: center; padding: 11px 10px; border: 0; border-radius: 7px 0 0 7px; background: var(--red); color: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.23); cursor: pointer; }
.cart-tab-icon { grid-row: 1 / span 2; font-size: 18px; }
.cart-tab-label { font-size: 11px; font-weight: 800; }
.cart-badge, #cartBadge { justify-self: start; min-width: 20px; padding: 2px 6px; border-radius: 999px; background: #fff; color: var(--red); font-size: 11px; font-weight: 900; text-align: center; }
.scrim { position: fixed; inset: 0; z-index: 90; visibility: hidden; opacity: 0; background: rgba(18,22,27,.48); transition: .2s ease; }
.scrim.open { visibility: visible; opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; z-index: 100; width: min(430px, 100vw); height: 100vh; display: grid; grid-template-rows: auto 1fr auto; transform: translateX(102%); background: #fff; box-shadow: -10px 0 35px rgba(0,0,0,.22); transition: transform .23s ease; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 18px; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 19px; }
.drawer-back { border: 0; background: transparent; color: var(--red); cursor: pointer; font-weight: 700; }
.drawer-body { overflow-y: auto; padding: 14px 16px; }
.cart-empty { padding: 40px 20px; color: var(--muted); text-align: center; line-height: 1.5; }
.cart-summary-row { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; color: var(--muted); font-size: 12px; }
.clear-cart-btn, .remove-btn { border: 0; background: transparent; color: var(--red); cursor: pointer; }
.cart-line { display: grid; grid-template-columns: 65px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.cart-line .swatch { width: 65px; height: 55px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; }
.cart-line .swatch img, .cart-line .placeholder-icon { width: 100%; height: 100%; object-fit: contain; }
.cart-line .name { font-size: 13px; font-weight: 800; }
.cart-line .code { margin-top: 3px; color: var(--muted); font-size: 10px; }
.cart-line .row2 { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }
.drawer-foot { padding: 14px 16px 18px; border-top: 1px solid var(--line); background: #f7f8f9; }
.field { margin-bottom: 9px; }
.field label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }
.field input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.send-btn { width: 100%; padding: 11px; margin-top: 3px; }
.send-note { margin-top: 6px; color: var(--muted); font-size: 10px; text-align: center; }
.send-error { display: none; margin-top: 7px; color: var(--red-dark); font-size: 11px; }
.send-error.show { display: block; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 120; transform: translate(-50%, 20px); visibility: hidden; opacity: 0; padding: 10px 15px; border-radius: 5px; background: #20242a; color: #fff; font-size: 12px; transition: .18s ease; }
.toast.show { visibility: visible; opacity: 1; transform: translate(-50%, 0); }
.error { max-width: 600px; margin: 80px auto; padding: 26px; border: 1px solid #e1bcbc; border-radius: var(--radius); background: #fff; text-align: center; }
@media (max-width: 1050px) { .variant-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .diagram-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } .category-tabs { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 960px) {
  .figure-workspace { height: auto; min-height: 0; grid-template-columns: 1fr; }
  .figure-workspace .diagram-stage { height: 58vh; min-height: 420px; }
  .side-parts { height: min(620px, 65vh); }
}
@media (max-width: 760px) {
  .header-inner, .app-shell { padding-left: 14px; padding-right: 14px; }
  .header-label { display: none; }
  .warehouse-link { padding: 9px 10px; font-size: 11px; }
  .variant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diagram-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .catalog-tools { grid-template-columns: 1fr; }
  .category-tabs { grid-template-columns: repeat(2, 1fr); }
  .vehicle-panel .spec { width: calc(50% - 11px); border-left: 0; padding-left: 0; }
  .diagram-stage { min-height: 480px; height: 65vh; }
  .cart-tab-label { display: none; }
  .cart-tab { grid-template-columns: auto; }
  .cart-tab-icon { grid-row: auto; }
}
@media (max-width: 500px) { .variant-grid, .diagram-grid { grid-template-columns: 1fr; } .topline, .series-head { align-items: start; flex-direction: column; } .brand span { display: none; } }
