:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #607181;
  --line: #d8e0e7;
  --panel: #ffffff;
  --wash: #eef5f7;
  --blue: #087ca7;
  --blue-dark: #045a78;
  --green: #2d8a63;
  --amber: #a86916;
  --red: #ad3d36;
  --shadow: 0 16px 40px rgba(30, 45, 62, 0.12);
  --violet: #574b90;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7fafb;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #dff2f7;
}

.brand-mark svg,
.icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.brand-mark svg {
  color: var(--blue);
  width: 30px;
  height: 30px;
}

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

h1 {
  font-size: 1.12rem;
  line-height: 1.1;
}

.brand p,
.search-panel label,
#resultHint {
  color: var(--muted);
}

.brand p {
  margin-top: 4px;
  font-size: 0.88rem;
}

.search-panel {
  display: grid;
  gap: 12px;
}

.search-panel {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.search-panel label {
  font-size: 0.86rem;
  font-weight: 700;
}

.quick-actions,
.mode-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-actions button,
.mode-bar button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--blue-dark);
  font-weight: 800;
  background: #dff2f7;
}

.location-status {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(8, 124, 167, 0.2);
  outline-offset: 2px;
}

.icon-button,
.toolbar button,
.actions a,
.actions button {
  border-radius: 8px;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease;
}

.icon-button {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
}

.icon-button:hover,
.toolbar button:hover,
.actions a:hover,
.actions button:not(:disabled):hover {
  transform: translateY(-1px);
}

.range-block {
  display: grid;
  gap: 8px;
}

.range-meta {
  color: var(--blue-dark);
  font-weight: 800;
}

input[type="range"] {
  min-height: auto;
  padding: 0;
  accent-color: var(--blue);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink) !important;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--blue);
}

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

.security-panel,
.sync-panel {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.security-panel h2,
.sync-panel h2 {
  font-size: 0.95rem;
}

.security-panel p,
.sync-panel p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.sync-panel {
  display: grid;
  gap: 10px;
}

.sync-panel button {
  min-height: 38px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: var(--blue);
}

.sync-list {
  display: grid;
  gap: 8px;
}

.sync-item {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fff;
}

.sync-item[data-configured="true"] {
  border-left-color: var(--green);
}

.sync-item span,
.sync-item small {
  color: var(--muted);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 34%);
  align-items: stretch;
  gap: 24px;
  min-height: 240px;
  padding: 30px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #ffffff 0%, #e8f4f2 100%);
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  max-width: 720px;
}

.eyebrow,
.type-label {
  color: var(--blue-dark);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h2 {
  max-width: 780px;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.98;
}

.hero p:last-child {
  max-width: 620px;
  color: #415362;
  font-size: 1.02rem;
  line-height: 1.5;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.stats span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(8, 124, 167, 0.18);
  border-radius: 8px;
  color: #29424d;
  background: rgba(255, 255, 255, 0.72);
}

.part-visual {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  border-radius: 8px;
  background: #d7ecf0;
  box-shadow: inset 0 0 0 1px rgba(8, 124, 167, 0.13);
}

.filter-canister,
.pump-body,
.water-line {
  position: absolute;
}

.filter-canister {
  right: 12%;
  bottom: 42px;
  width: 82px;
  height: 132px;
  border: 8px solid #f4fbfd;
  border-radius: 40px 40px 12px 12px;
  background: repeating-linear-gradient(90deg, #65aebe 0 7px, #eaf7f8 7px 12px);
  box-shadow: 0 14px 26px rgba(4, 90, 120, 0.2);
}

.pump-body {
  left: 11%;
  bottom: 48px;
  width: 164px;
  height: 96px;
  border-radius: 48px 38px 28px 28px;
  background: #28546b;
  box-shadow: inset 24px 0 #356f87, 0 14px 28px rgba(40, 84, 107, 0.24);
}

.pump-body::before {
  content: "";
  position: absolute;
  right: -26px;
  top: 22px;
  width: 62px;
  height: 52px;
  border-radius: 50%;
  background: #f7fafb;
  box-shadow: inset 0 0 0 12px #438ca1;
}

.water-line {
  left: -12px;
  right: -12px;
  bottom: 0;
  height: 48px;
  background: repeating-linear-gradient(135deg, rgba(8, 124, 167, 0.24) 0 18px, rgba(8, 124, 167, 0.08) 18px 36px);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 0;
}

.mode-bar {
  padding: 18px 0 4px;
}

.mode-bar button {
  background: #edf4f7;
}

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

.toolbar button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--blue-dark);
  background: #dff2f7;
}

.results {
  display: grid;
  gap: 14px;
}

.result-card {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.part-thumb {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 104px;
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: #e9f4f7;
  text-align: center;
}

.part-thumb img {
  max-width: 100%;
  max-height: 112px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.part-thumb figcaption {
  color: #45606d;
  font-size: 0.8rem;
  font-weight: 800;
}

.part-thumb.pump {
  background: radial-gradient(circle at 70% 50%, #f7fafb 0 14%, #438ca1 15% 26%, transparent 27%), linear-gradient(145deg, #28546b 0 58%, #3e899b 59%);
}

.part-thumb.filter {
  background: repeating-linear-gradient(90deg, #65aebe 0 9px, #eef8fa 9px 16px);
}

.part-thumb.cleaner {
  background: radial-gradient(circle at 30% 72%, #1e495a 0 13%, transparent 14%), radial-gradient(circle at 74% 72%, #1e495a 0 13%, transparent 14%), linear-gradient(135deg, #f5fbfd, #62aebe);
}

.part-thumb.heater {
  background: linear-gradient(90deg, #35424d 0 35%, #eef5f7 35% 42%, #35424d 42% 100%);
}

.part-thumb.valve,
.part-thumb.plumbing {
  background: radial-gradient(circle, transparent 0 29%, #2d8a63 30% 45%, transparent 46%), conic-gradient(from 20deg, #aad8c5, #2d8a63, #dff2f7, #aad8c5);
}

.part-thumb.chemical,
.part-thumb.salt-cell,
.part-thumb.automation {
  background: linear-gradient(180deg, transparent 0 20%, #f7fafb 20% 28%, #087ca7 28% 100%);
}

.part-thumb.light {
  background: radial-gradient(circle at 50% 45%, #fff8c7 0 16%, #62aebe 17% 30%, transparent 31%), linear-gradient(135deg, #1d3557, #4f7cac);
}

.result-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.result-head h3 {
  margin-top: 3px;
  font-size: 1.18rem;
  line-height: 1.25;
}

.price-pill {
  flex: 0 0 auto;
  align-self: start;
  padding: 8px 10px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  background: var(--green);
}

.confidence-badge {
  justify-self: start;
  padding: 7px 10px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  background: var(--muted);
}

.confidence-badge[data-confidence="Exact Replacement"] {
  background: var(--green);
}

.confidence-badge[data-confidence="Direct Compatible"] {
  background: var(--blue);
}

.confidence-badge[data-confidence="Minor Modification Required"] {
  background: var(--amber);
}

.confidence-badge[data-confidence="Not Recommended"] {
  background: var(--red);
}

.confidence-badge[data-confidence="Unverified"] {
  background: var(--violet);
}

.description,
.compatibility,
.tech-notes,
.comparison,
.related,
.specs {
  color: #40515e;
  line-height: 1.45;
}

.specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.specs div {
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--wash);
}

.specs dt,
.specs dd {
  display: inline;
  margin: 0;
}

.specs dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.compatibility {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-left: 4px solid var(--amber);
  background: #fff7ea;
}

.comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.comparison span,
.related {
  padding: 9px 10px;
  border-radius: 8px;
  background: #f4f8f9;
}

.compatibility strong {
  color: #253746;
}

.compatibility.exact {
  border-color: var(--green);
  background: #ecf8f2;
}

.tech-notes {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4f6f8;
}

.supplier-offers {
  display: grid;
  gap: 8px;
}

.supplier-offers h4 {
  margin: 0;
  font-size: 0.92rem;
}

.offer-card {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.offer-card strong {
  color: var(--ink);
}

.offer-card span,
.offer-card small {
  color: var(--muted);
}

.offer-card b {
  color: var(--green);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions a,
.actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  color: #fff;
  text-decoration: none;
  background: var(--blue);
}

.actions button {
  background: #7a8792;
}

.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
}

.sources-panel {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sources-panel h2 {
  font-size: 1rem;
}

.sources-panel p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.sources-panel ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 18px;
  margin: 14px 0 0;
  padding-left: 18px;
}

.sources-panel a {
  color: var(--blue-dark);
  font-weight: 700;
}

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

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

  .main {
    padding: 18px;
  }

  .hero {
    padding: 22px;
  }

  .part-visual {
    min-height: 160px;
  }
}

@media (max-width: 560px) {
  .result-card,
  .result-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .price-pill {
    justify-self: start;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
