:root {
  color-scheme: light;
  --ink: #12181d;
  --muted: #65717b;
  --line: #d8dde1;
  --paper: #ffffff;
  --surface: #eef1f3;
  --surface-strong: #e3e7ea;
  --red: #d71920;
  --red-dark: #a90f15;
  --red-soft: #fff0f1;
  --navy: #111820;
  --shadow: 0 18px 46px rgba(18, 24, 29, 0.1);
}

* { box-sizing: border-box; }

html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
}

[hidden] { display: none !important; }

body.cart-open { overflow: hidden; }

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  width: 100%;
  background: var(--navy);
  box-shadow: 0 8px 24px rgba(18, 24, 29, 0.14);
}

button,
input,
select { font: inherit; }

button { color: inherit; }

.topbar {
  width: 100%;
  min-height: 4.25rem;
  display: grid;
  grid-template-columns: auto auto minmax(15rem, 32rem) auto;
  grid-template-areas: "brand nav search cart";
  align-items: center;
  gap: clamp(0.7rem, 1.8vw, 1.7rem);
  padding: 0.65rem clamp(1rem, 3vw, 3rem);
  color: #fff;
  background: var(--navy);
}

.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  letter-spacing: 0.08em;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  font-size: 1.35rem;
}

.brand strong,
.brand small { display: block; }

.brand strong { font-size: 1rem; line-height: 1.1; }
.brand small { margin-top: 0.18rem; color: #aeb8c0; font-size: 0.72rem; }

.main-nav {
  grid-area: nav;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.main-nav a,
.main-nav button {
  min-height: 2.45rem;
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.65rem;
  color: #c8d0d5;
  background: transparent;
  border: 0;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.main-nav a:hover,
.main-nav button:hover,
.main-nav .active { color: #fff; background: #222c35; }

.menu-toggle {
  grid-area: menu;
  display: none;
  width: 2.55rem;
  height: 2.55rem;
  place-content: center;
  gap: 0.28rem;
  padding: 0;
  background: transparent;
  border: 1px solid #46515a;
  cursor: pointer;
}

.menu-toggle span {
  width: 1.15rem;
  height: 2px;
  display: block;
  background: #fff;
}

.global-search-shell {
  position: relative;
  grid-area: search;
  width: 100%;
  min-width: 0;
}

.global-search-field {
  min-height: 2.7rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.8rem;
  background: #fff;
  border: 1px solid #fff;
}

.global-search-field:focus-within { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18); }
.global-search-field svg { width: 1.1rem; flex: none; fill: none; stroke: #65717b; stroke-width: 2; }
.global-search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 0.9rem; }

.global-search-results {
  position: absolute;
  z-index: 130;
  top: calc(100% + 0.45rem);
  right: 0;
  left: 0;
  max-height: min(70vh, 34rem);
  overflow: auto;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.global-search-results[hidden] { display: none; }
.global-search-status { margin: 0; padding: 1rem; color: var(--muted); font-size: 0.86rem; }
.global-result { display: grid; grid-template-columns: minmax(0, 1fr) 2.6rem; border-bottom: 1px solid #e7eaec; }
.global-result:last-child { border-bottom: 0; }
.global-result-main { min-width: 0; display: grid; gap: 0.08rem; padding: 0.7rem 0.8rem; text-align: left; background: #fff; border: 0; cursor: pointer; }
.global-result-main:hover { background: #f5f7f8; }
.global-result-main strong { color: var(--red-dark); font-size: 0.92rem; }
.global-result-main span { overflow: hidden; text-overflow: ellipsis; font-size: 0.84rem; white-space: nowrap; }
.global-result-main small { overflow: hidden; color: var(--muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.global-result-cart { align-self: center; width: 2rem; height: 2rem; padding: 0; color: #fff; background: var(--red); border: 0; font-size: 1.2rem; font-weight: 800; cursor: pointer; }

.cart-toggle {
  grid-area: cart;
  min-height: 2.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.7rem;
  color: #fff;
  background: #222c35;
  border: 1px solid #46515a;
  cursor: pointer;
  white-space: nowrap;
}

.cart-toggle:hover { background: #303c46; }
.cart-toggle svg { width: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.cart-toggle span { font-size: 0.84rem; font-weight: 700; }
.cart-toggle strong { min-width: 1.45rem; height: 1.45rem; display: grid; place-items: center; padding: 0 0.3rem; color: #fff; background: var(--red); font-size: 0.72rem; }

.topbar-context {
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem clamp(1rem, 3vw, 3rem);
  color: #b9c1c7;
  background: #0b1117;
  border-bottom: 3px solid var(--red);
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  color: #b9c1c7;
  font-size: 0.875rem;
}

.topbar-meta strong { color: #fff; }

.topbar-divider {
  width: 1px;
  height: 1.4rem;
  background: #46515a;
}

.search-scope { color: #8f9aa3; font-size: 0.75rem; white-space: nowrap; }

.catalog-page {
  width: min(100%, 118rem);
  max-width: 100%;
  margin: 0 auto;
  padding: 1.35rem clamp(0.75rem, 2.2vw, 2.25rem) 2rem;
}

#catalog-controls { scroll-margin-top: 8.5rem; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.breadcrumbs b { color: #aab2b9; font-weight: 400; }
.breadcrumbs a { color: inherit; text-decoration: none; }
.breadcrumbs a:hover { color: var(--red-dark); }

.catalog-controls {
  display: grid;
  grid-template-columns: minmax(13rem, 0.9fr) minmax(12rem, 0.8fr) minmax(20rem, 1.6fr) auto;
  gap: 0.7rem;
  align-items: end;
  margin-bottom: 1.05rem;
  padding: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(18, 24, 29, 0.05);
}

.catalog-controls label {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.catalog-controls label > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.catalog-controls select,
.drawing-select-wrap select {
  width: 100%;
  min-width: 0;
  height: 2.45rem;
  padding: 0 2rem 0 0.7rem;
  color: var(--ink);
  background: #f7f8f9;
  border: 1px solid var(--line);
  cursor: pointer;
}

.catalog-controls select:focus,
.drawing-select-wrap select:focus {
  border-color: #7f8a93;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(17, 24, 32, 0.07);
}

.page-buttons {
  display: flex;
  gap: 0.4rem;
}

.page-button {
  width: 2.45rem;
  height: 2.45rem;
  padding: 0;
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 800;
}

.page-button:hover:not(:disabled) { color: #fff; background: var(--navy); border-color: var(--navy); }
.page-button:disabled { color: #afb6bc; background: #f4f6f7; cursor: not-allowed; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.35rem;
}

.page-heading > *,
.panel-header > *,
.selected-title-row > * {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--red-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(1.85rem, 2.5vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.heading-facts {
  display: flex;
  flex-wrap: wrap;
  max-width: 100%;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(18, 24, 29, 0.05);
}

.heading-facts span {
  min-width: 8.5rem;
  padding: 0.7rem 1rem;
  border-left: 1px solid var(--line);
}

.heading-facts span:first-child { border-left: 0; }
.heading-facts small,
.heading-facts strong { display: block; }
.heading-facts small { color: var(--muted); font-size: 0.75rem; }
.heading-facts strong { margin-top: 0.12rem; font-size: 0.95rem; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(22rem, 0.72fr);
  gap: 1rem;
  align-items: start;
}

.drawing-panel,
.parts-panel {
  min-width: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel-header {
  min-height: 4.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 { margin-bottom: 0.05rem; font-size: 1.05rem; }
.panel-header p { margin-bottom: 0; color: var(--muted); font-size: 0.8rem; }

.toolbar-actions,
.zoom-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.toolbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.drawing-select-wrap {
  width: min(10rem, 100%);
}

.drawing-select-wrap select {
  height: 2.35rem;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.tool-button,
.icon-button {
  min-height: 2.35rem;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.tool-button { padding: 0.45rem 0.72rem; font-size: 0.82rem; font-weight: 700; }
.icon-button { width: 2.35rem; padding: 0; font-size: 1.25rem; font-weight: 700; }
.tool-button:hover,
.icon-button:hover { border-color: #9ba5ad; background: #f4f6f7; }
.tool-button.active { border-color: var(--red); color: var(--red-dark); background: var(--red-soft); }

.zoom-group output {
  width: 3.4rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.drawing-viewport {
  position: relative;
  height: min(72vh, 58rem);
  overflow: auto;
  background-color: #f4f6f7;
  background-image: linear-gradient(#e7eaed 1px, transparent 1px), linear-gradient(90deg, #e7eaed 1px, transparent 1px);
  background-size: 2rem 2rem;
  scrollbar-color: #aab2b9 transparent;
}

.drawing-loading {
  position: absolute;
  z-index: 3;
  top: 3rem;
  left: 50%;
  max-width: calc(100% - 2rem);
  padding: 0.7rem 1rem;
  transform: translateX(-50%);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(18, 24, 29, 0.09);
  text-align: center;
  font-size: 0.85rem;
  pointer-events: none;
}

.drawing-loading[hidden],
.selected-card[hidden],
.drawing-select-wrap[hidden] { display: none; }

.drawing-stage {
  position: relative;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  background: #fff;
  transition: width 180ms ease;
}

.drawing-stage img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

#hotspot-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hotspot {
  fill: rgba(215, 25, 32, 0.03);
  stroke: rgba(215, 25, 32, 0.18);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 130ms ease, stroke 130ms ease;
}

.hotspot:hover,
.hotspot:focus {
  outline: none;
  fill: rgba(215, 25, 32, 0.16);
  stroke: var(--red);
  stroke-width: 3;
}

.hotspot.selected {
  fill: rgba(215, 25, 32, 0.25);
  stroke: var(--red);
  stroke-width: 4;
}

.zones-hidden .hotspot { opacity: 0; pointer-events: none; }

.drawing-hint {
  margin: 0;
  padding: 0.7rem 1rem;
  color: var(--muted);
  background: #fafbfb;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.parts-panel {
  height: min(79.5vh, 64rem);
  display: flex;
  flex-direction: column;
}

.parts-header { align-items: flex-start; }

.search-field {
  width: min(17.5rem, 63%);
  min-height: 2.55rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.7rem;
  background: #f4f6f7;
  border: 1px solid var(--line);
}

.search-field:focus-within { border-color: #7f8a93; box-shadow: 0 0 0 3px rgba(17, 24, 32, 0.07); }
.search-field svg { width: 1.05rem; fill: none; stroke: #77828b; stroke-width: 2; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 0.875rem; }

.selected-card {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  margin: 0.85rem;
  color: #fff;
  background: var(--navy);
  border-left: 4px solid var(--red);
}

.selected-position {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 0.45rem;
  border-right: 1px solid #34414b;
}

.selected-position small { color: #aeb8c0; font-size: 0.7rem; text-transform: uppercase; }
.selected-position strong { margin-top: 0.1rem; font-size: 1.7rem; line-height: 1; }

.selected-main { min-width: 0; padding: 0.78rem 0.9rem; }
.selected-title-row { display: flex; justify-content: space-between; gap: 0.75rem; }
.selected-title-row > div { min-width: 0; }
.selected-title-row h3 { margin-bottom: 0.08rem; font-size: 0.98rem; line-height: 1.3; }
.selected-title-row p { margin-bottom: 0; overflow-wrap: anywhere; color: #aeb8c0; font-size: 0.72rem; }
.qty-badge { flex: none; align-self: flex-start; padding: 0.22rem 0.45rem; color: #fff; background: #34414b; font-size: 0.75rem; }

.part-number-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.65rem;
  padding-top: 0.58rem;
  border-top: 1px solid #34414b;
}

.part-number-line > div { min-width: 0; }
.part-number-line span,
.part-number-line strong { display: block; }
.part-number-line span { color: #aeb8c0; font-size: 0.75rem; }
.part-number-line strong { min-width: 0; overflow-wrap: anywhere; color: #fff; font-size: 1rem; letter-spacing: 0.035em; }
.part-number-line strong.not-orderable { color: #f0b7b9; font-size: 0.78rem; letter-spacing: 0; }

.add-cart-button,
.request-button {
  min-height: 2.45rem;
  padding: 0.5rem 0.85rem;
  color: #fff;
  background: var(--red);
  border: 1px solid var(--red);
  font-weight: 800;
  cursor: pointer;
}

.add-cart-button { flex: none; font-size: 0.78rem; }
.add-cart-button:hover,
.request-button:hover { background: var(--red-dark); border-color: var(--red-dark); }

.table-head {
  display: grid;
  grid-template-columns: 3.3rem minmax(0, 1fr) 3rem;
  padding: 0.5rem 1rem;
  color: var(--muted);
  background: #f4f6f7;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.table-head span:last-child { text-align: right; }

.parts-table-wrap {
  min-height: 0;
  flex: 1;
  overflow: auto;
  scrollbar-color: #aab2b9 transparent;
}

.parts-table-wrap table { width: 100%; border-collapse: collapse; }

.part-row {
  cursor: pointer;
  transition: background 120ms ease;
}

.part-row:hover { background: #f7f8f9; }
.part-row:focus { outline: 2px solid var(--red); outline-offset: -2px; }
.part-row.selected { background: var(--red-soft); box-shadow: inset 4px 0 0 var(--red); }

.part-row td {
  padding: 0.68rem 0.55rem;
  border-bottom: 1px solid #e6e9eb;
  vertical-align: middle;
}

.part-row td:first-child { width: 3.3rem; padding-left: 1rem; }
.part-row td:last-child {
  width: 3.8rem;
  padding-right: 0.75rem;
  text-align: right;
}

.position-chip {
  min-width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  padding: 0 0.35rem;
  color: var(--ink);
  background: var(--surface-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.part-row.selected .position-chip { color: #fff; background: var(--red); }
.part-name { display: block; overflow-wrap: anywhere; font-size: 0.88rem; font-weight: 750; line-height: 1.25; }
.part-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem; margin-top: 0.16rem; color: var(--muted); font-size: 0.72rem; }
.part-number { color: var(--red-dark); font-weight: 800; letter-spacing: 0.025em; }
.part-number.unavailable { color: #8a949c; font-weight: 600; letter-spacing: 0; }
.supersession { color: #3f6b4f; font-weight: 700; }
.part-qty { font-size: 0.85rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.row-cart-button {
  width: 1.75rem;
  height: 1.75rem;
  display: block;
  margin: 0.25rem 0 0 auto;
  padding: 0;
  color: #fff;
  background: var(--red);
  border: 0;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.row-cart-button:hover { background: var(--red-dark); }

.empty-state { padding: 2rem 1rem; color: var(--muted); text-align: center; font-size: 0.9rem; }

.data-note {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.data-note strong { color: #3f4951; }

.cart-backdrop {
  position: fixed;
  z-index: 200;
  inset: 0;
  background: rgba(4, 9, 13, 0.54);
  backdrop-filter: blur(2px);
}

.cart-drawer {
  position: fixed;
  z-index: 210;
  top: 0;
  right: 0;
  width: min(30rem, 100%);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: #fff;
  box-shadow: -22px 0 64px rgba(0, 0, 0, 0.28);
  transform: translateX(105%);
  transition: transform 220ms ease;
  visibility: hidden;
}

.cart-drawer.open { transform: translateX(0); visibility: visible; }

.cart-header {
  min-height: 5.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  color: #fff;
  background: var(--navy);
  border-bottom: 3px solid var(--red);
}

.cart-header small { color: #aeb8c0; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.cart-header h2 { margin: 0.1rem 0 0; font-size: 1.35rem; }
.cart-close { width: 2.6rem; height: 2.6rem; padding: 0; color: #fff; background: transparent; border: 1px solid #46515a; cursor: pointer; font-size: 1.55rem; }
.cart-close:hover { background: #26313a; }

.cart-items { min-height: 0; flex: 1; overflow: auto; }

.cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #e5e8ea;
}

.cart-item > div:first-child { min-width: 0; display: grid; gap: 0.18rem; }
.cart-item strong { overflow-wrap: anywhere; color: var(--red-dark); font-size: 0.95rem; }
.cart-item span { overflow-wrap: anywhere; font-size: 0.86rem; font-weight: 700; }
.cart-item small { overflow-wrap: anywhere; color: var(--muted); font-size: 0.72rem; }

.cart-item-controls {
  display: grid;
  grid-template-columns: 1.9rem 2rem 1.9rem;
  align-content: center;
  align-items: center;
  text-align: center;
}

.cart-item-controls button {
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  background: #f2f4f5;
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 800;
}

.cart-item-controls button:hover { background: #e5e9eb; }
.cart-item-controls b { font-size: 0.86rem; }
.cart-item-controls .cart-item-remove { grid-column: 1 / -1; width: auto; margin-top: 0.35rem; color: var(--red-dark); background: transparent; border: 0; font-size: 0.7rem; font-weight: 700; }

.cart-empty {
  display: grid;
  place-content: center;
  gap: 0.4rem;
  min-height: 0;
  flex: 1;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.cart-empty strong { color: var(--ink); font-size: 1rem; }
.cart-empty span { max-width: 20rem; font-size: 0.85rem; }

.cart-footer {
  display: grid;
  gap: 0.8rem;
  padding: 1rem 1.15rem calc(1rem + env(safe-area-inset-bottom));
  background: #f4f6f7;
  border-top: 1px solid var(--line);
}

.cart-footer > span { font-size: 0.86rem; }
.request-button { width: 100%; }
.request-button:disabled { color: #8a949c; background: #dfe3e6; border-color: #dfe3e6; cursor: not-allowed; }

.quote-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.quote-form label { min-width: 0; display: grid; gap: 0.22rem; }
.quote-form label > span { color: var(--muted); font-size: 0.7rem; font-weight: 800; }
.quote-form input,
.quote-form textarea {
  width: 100%;
  min-width: 0;
  padding: 0.58rem 0.65rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  outline: 0;
}

.quote-form input { min-height: 2.45rem; }
.quote-form textarea { resize: vertical; }
.quote-form input:focus,
.quote-form textarea:focus { border-color: #7f8a93; box-shadow: 0 0 0 3px rgba(17, 24, 32, 0.07); }
.quote-form .quote-wide { grid-column: 1 / -1; }
.quote-form .quote-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.quote-form .quote-consent { display: flex; align-items: flex-start; grid-template-columns: none; gap: 0.5rem; }
.quote-consent input { width: 1rem; min-height: 0; height: 1rem; flex: none; margin-top: 0.13rem; }
.quote-consent span { font-weight: 500 !important; line-height: 1.35; }
.quote-feedback { margin: 0; padding: 0.65rem 0.7rem; color: #24573a; background: #e8f5ed; border: 1px solid #bdddc9; font-size: 0.78rem; }
.quote-feedback.error { color: #842329; background: #fff0f1; border-color: #efc1c4; }

.toast {
  position: fixed;
  z-index: 230;
  right: 1rem;
  bottom: 1rem;
  max-width: min(24rem, calc(100% - 2rem));
  padding: 0.75rem 1rem;
  color: #fff;
  background: #1e6c40;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
  font-size: 0.84rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(0.75rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible { opacity: 1; transform: translateY(0); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 90rem) {
  .catalog-page { padding-inline: 1rem; }
  .workspace { grid-template-columns: minmax(0, 1.32fr) minmax(21rem, 0.68fr); }
  .panel-header { padding-inline: 0.8rem; }
  .heading-facts span { min-width: 7.4rem; padding-inline: 0.8rem; }
  .drawing-toolbar { align-items: flex-start; }
  .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (min-width: 68.01rem) and (min-height: 40rem) {
  body {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .site-header { flex: none; }

  .catalog-page {
    height: auto;
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 0.8rem;
    padding-bottom: 0.65rem;
    overflow: hidden;
  }

  .breadcrumbs {
    flex: none;
    margin-bottom: 0.55rem;
  }

  .catalog-controls {
    flex: none;
    margin-bottom: 0.65rem;
    padding-block: 0.55rem;
  }

  .page-heading {
    flex: none;
    margin-bottom: 0.8rem;
  }

  .workspace {
    min-height: 0;
    flex: 1;
    align-items: stretch;
  }

  .drawing-panel,
  .parts-panel {
    height: 100%;
    min-height: 0;
  }

  .drawing-panel {
    display: flex;
    flex-direction: column;
  }

  .drawing-viewport {
    height: auto;
    min-height: 0;
    flex: 1;
  }

  .parts-panel {
    max-height: none;
  }

  .data-note {
    flex: none;
    margin-top: 0.45rem;
  }
}

@media (max-width: 76rem) {
  .catalog-controls { grid-template-columns: 1fr 1fr; }
  .page-control { grid-column: 1 / -1; }
  .page-buttons { grid-column: 1 / -1; justify-content: flex-end; margin-top: -3.15rem; pointer-events: none; }
  .page-button { pointer-events: auto; }
  .page-control select { padding-right: 6.5rem; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .heading-facts { width: 100%; }
  .heading-facts span { flex: 1; min-width: 0; }
  .workspace { grid-template-columns: minmax(0, 1.25fr) minmax(20rem, 0.75fr); }
  .search-field { width: 100%; }
  .parts-header { align-items: stretch; flex-direction: column; }
}

@media (max-width: 68rem) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "brand menu cart"
      "nav nav nav"
      "search search search";
    gap: 0.55rem 0.75rem;
  }

  .menu-toggle { display: grid; justify-self: end; }
  .main-nav { display: none; width: 100%; padding: 0.25rem 0; border-top: 1px solid #303a43; border-bottom: 1px solid #303a43; }
  .main-nav.open { display: flex; }
  .main-nav a,
  .main-nav button { flex: 1; justify-content: center; }
  .global-search-results { max-height: 55vh; }
  .workspace { grid-template-columns: 1fr; }
  .drawing-viewport { height: min(70vh, 50rem); }
  .parts-panel { height: auto; max-height: 52rem; }
  .parts-table-wrap { max-height: 34rem; }
}

@media (max-width: 40rem) {
  .topbar { padding: 0.55rem 0.65rem; }
  .brand { gap: 0.5rem; }
  .brand-mark { width: 2.25rem; height: 2.25rem; }
  .brand small { display: none; }
  .cart-toggle { padding-inline: 0.55rem; }
  .cart-toggle > span { display: none; }
  .topbar-context { align-items: flex-start; padding: 0.35rem 0.65rem; }
  .topbar-meta { gap: 0.35rem 0.65rem; font-size: 0.72rem; }
  .search-scope { display: none; }
  .topbar-divider { display: none; }
  .catalog-page { padding-inline: 0.55rem; }
  .catalog-controls { grid-template-columns: 1fr; }
  .page-control,
  .page-buttons { grid-column: auto; }
  .page-buttons { justify-content: flex-start; margin-top: 0; }
  .page-control select { padding-right: 2rem; }
  .heading-facts { display: grid; grid-template-columns: 1fr 1fr; }
  .heading-facts span { border-top: 1px solid var(--line); }
  .heading-facts span:nth-child(2) { border-left: 1px solid var(--line); }
  .heading-facts span:nth-child(3) { grid-column: 1 / -1; border-left: 0; }
  .drawing-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { justify-content: flex-start; }
  .tool-button { flex: 1 1 auto; }
  .drawing-viewport { height: 64vh; }
  .parts-header { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
  .selected-card { grid-template-columns: 4.25rem minmax(0, 1fr); margin: 0.6rem; }
  .selected-title-row { gap: 0.45rem; }
  .part-number-line { align-items: stretch; flex-direction: column; gap: 0.45rem; }
  .add-cart-button { width: 100%; }
  .cart-item { grid-template-columns: 1fr; }
  .cart-item-controls { justify-self: start; }
  .quote-form { grid-template-columns: 1fr; }
  .quote-form .quote-wide { grid-column: auto; }
  .data-note { flex-direction: column; gap: 0.2rem; }
}

@media (max-width: 30rem) {
  .topbar-meta { width: 100%; }
  .main-nav.open { flex-direction: column; align-items: stretch; }
  .heading-facts { grid-template-columns: 1fr; }
  .heading-facts span,
  .heading-facts span:nth-child(2),
  .heading-facts span:nth-child(3) { grid-column: auto; border-left: 0; }
  .toolbar-actions { display: grid; grid-template-columns: 1fr auto 1fr; width: 100%; }
  .selected-card { grid-template-columns: 1fr; }
  .selected-position { align-items: flex-start; border-right: 0; border-bottom: 1px solid #34414b; }
  .selected-title-row { align-items: flex-start; flex-direction: column; }
  .table-head { grid-template-columns: 2.8rem minmax(0, 1fr) 2.4rem; padding-inline: 0.55rem; }
  .part-row td:first-child { width: 2.8rem; padding-left: 0.55rem; }
  .part-row td:last-child { width: 2.4rem; padding-right: 0.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
