:root {
  --blue: #1a73e8;
  --blue-dark: #185abc;
  --ink: #202124;
  --muted: #5f6368;
  --line: #e3e7ee;
  --surface: #fff;
  --surface-soft: #f8f9fa;
  --green: #188038;
  --green-soft: #e6f4ea;
  --shadow: 0 2px 12px rgba(32, 33, 36, .1);
  --shadow-hover: 0 8px 24px rgba(32, 33, 36, .14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

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

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: 280px minmax(280px, 760px);
  align-items: center;
  gap: 32px;
  min-height: 104px;
  padding: 18px 36px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--blue);
  color: white;
  font-size: 1.35rem;
  font-weight: 750;
  box-shadow: 0 5px 14px rgba(26, 115, 232, .25);
}
.brand h1 { margin: 0; color: var(--blue); font-size: 1.35rem; line-height: 1.2; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: .75rem; }

.search-form {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 5px 6px 5px 18px;
  border: 1px solid #dfe1e5;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(32, 33, 36, .2);
  transition: border-color .2s, box-shadow .2s;
}
.search-form:focus-within {
  border-color: var(--blue);
  box-shadow: 0 2px 10px rgba(32, 33, 36, .24);
}
.search-icon { color: var(--muted); font-size: 1.45rem; transform: rotate(-20deg); }
.search-form input {
  min-width: 0;
  flex: 1;
  padding: 11px 12px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}
.search-button, .filter-button {
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 650;
}
.search-button:hover, .filter-button:hover { background: var(--blue-dark); }

.app-shell { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 104px); }
.sidebar {
  position: sticky;
  top: 104px;
  align-self: start;
  height: calc(100vh - 104px);
  overflow-y: auto;
  padding: 30px 24px;
  background: var(--surface-soft);
  border-right: 1px solid var(--line);
}
.sidebar-heading { display: flex; align-items: start; justify-content: space-between; }
.sidebar h2 { margin: 5px 0 0; font-size: 1.15rem; }
.eyebrow {
  color: var(--blue);
  font-size: .7rem;
  font-weight: 750;
  letter-spacing: .12em;
}
.sidebar-section { margin-top: 25px; padding-top: 25px; border-top: 1px solid var(--line); }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-heading label { color: #3c4043; font-size: .86rem; font-weight: 650; }
.field-heading output {
  padding: 5px 10px;
  border-radius: 999px;
  background: #e8f0fe;
  color: var(--blue-dark);
  font-size: .8rem;
  font-weight: 700;
}
input[type="range"] { width: 100%; margin: 18px 0 4px; accent-color: var(--blue); }
.margin-scale { display: flex; justify-content: space-between; color: #80868b; font-size: .68rem; }
.field-help { margin: 12px 0 0; color: var(--muted); font-size: .74rem; }
.filter-title { display: flex; align-items: center; gap: 8px; }
.filter-title h3 { margin: 0; font-size: .98rem; }
.filter-field { margin-top: 16px; }
.filter-field label { display: block; margin: 0 0 7px; color: #3c4043; font-size: .78rem; font-weight: 650; }
select {
  width: 100%;
  padding: 10px 34px 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 10px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}
select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26, 115, 232, .12); }
.text-button, .back-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 650;
}
.text-button { width: 100%; margin-top: 18px; padding: 8px; font-size: .8rem; }
.text-button:hover, .back-button:hover { text-decoration: underline; }
.sidebar-tip {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  padding: 14px;
  border-radius: 12px;
  background: #e8f0fe;
  color: #174ea6;
}
.sidebar-tip p { margin: 0; font-size: .78rem; line-height: 1.45; }

.main-content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 48px clamp(24px, 4vw, 64px) 64px; }
.hero-copy { margin: 0 auto 34px; text-align: center; }
.hero-copy h2 { margin: 8px 0 8px; color: #3c4043; font-size: clamp(1.55rem, 3vw, 2.15rem); }
.hero-copy p { margin: 0; color: var(--muted); }
.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.category-card {
  min-height: 205px;
  padding: 25px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  text-align: center;
  box-shadow: 0 1px 3px rgba(60, 64, 67, .08);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.category-card:hover, .category-card:focus-visible {
  transform: translateY(-3px);
  border-color: #a8c7fa;
  box-shadow: var(--shadow-hover);
  outline: 0;
}
.category-icon {
  display: grid;
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 18px;
  background: #eef4fe;
  font-size: 2rem;
}
.category-card strong { display: block; color: #1a0dab; font-size: 1rem; }
.category-card span:last-child { display: block; height: 2.6em; margin: 8px 0 16px; overflow: hidden; color: var(--muted); font-size: .78rem; line-height: 1.3; }
.category-card em { color: var(--blue); font-size: .78rem; font-style: normal; font-weight: 650; }

.results-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.back-button { padding: 8px 0; }
.results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.results-toolbar p { margin: 0; color: var(--muted); font-size: .9rem; }
.results-toolbar select { min-width: 230px; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.product-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(60, 64, 67, .08);
  transition: transform .2s, box-shadow .2s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.product-card-image-wrap { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: #f1f3f4; }
.product-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.product-card:hover img { transform: scale(1.025); }
.product-card-body { display: flex; flex: 1; flex-direction: column; padding: 18px; }
.card-title {
  display: -webkit-box;
  height: 2.7em;
  margin: 0 0 11px;
  overflow: hidden;
  color: #1a0dab;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.card-specs { flex: 1; color: #4d5156; font-size: .82rem; line-height: 1.55; }
.spec-item { margin-bottom: 3px; }
.card-price-section { margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--line); }
.cost-line { color: #70757a; font-size: .78rem; }
.suggested-price-line { margin: 3px 0 8px; color: var(--green); font-size: 1.45rem; font-weight: 750; }
.profit-badge {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #137333;
  font-size: .73rem;
  font-weight: 650;
}
.details-button {
  margin-top: 13px;
  padding: 9px 12px;
  border: 1px solid #d2e3fc;
  border-radius: 999px;
  background: #f7faff;
  color: var(--blue-dark);
  font-size: .78rem;
  font-weight: 650;
}
.details-button:hover { background: #e8f0fe; }

.message {
  margin: 22px 0;
  padding: 16px 18px;
  border-radius: 13px;
  background: #fef7e0;
  color: #5f4b00;
  font-size: .9rem;
}
.message.error { background: #fce8e6; color: #a50e0e; }
.loading { display: grid; justify-items: center; gap: 12px; padding: 70px 20px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid #d2e3fc; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin-top: 30px; }
.page-button {
  min-width: 38px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #3c4043;
}
.page-button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.page-button.active { border-color: var(--blue); background: var(--blue); color: white; }
.page-button:disabled { cursor: default; opacity: .4; }
.page-summary { margin-left: 8px; color: var(--muted); font-size: .78rem; }

.product-modal {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .25);
}
.product-modal::backdrop { background: rgba(32, 33, 36, .55); backdrop-filter: blur(2px); }
.modal-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  font-size: 1.45rem;
  box-shadow: var(--shadow);
}
.modal-layout { display: grid; grid-template-columns: minmax(230px, 42%) 1fr; }
.modal-image { width: 100%; height: 100%; min-height: 390px; object-fit: cover; background: #f1f3f4; }
.modal-body { padding: 38px 32px 32px; }
.modal-body h2 { margin: 7px 0 18px; color: #1a0dab; font-size: 1.4rem; }
.modal-specs { display: grid; gap: 10px; margin: 0; }
.modal-specs div { padding-bottom: 9px; border-bottom: 1px solid #f0f1f2; }
.modal-specs dt { color: var(--muted); font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.modal-specs dd { margin: 3px 0 0; font-size: .9rem; }
.modal-price { margin-top: 22px; padding: 18px; border-radius: 15px; background: var(--green-soft); }
.modal-price .suggested-price-line { margin-bottom: 3px; }
.mobile-only { display: none; }

@media (max-width: 1080px) {
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .app-header { grid-template-columns: 1fr; gap: 14px; padding: 15px 20px 18px; }
  .brand { justify-content: center; }
  .brand p { display: none; }
  .app-shell { display: block; min-height: calc(100vh - 129px); }
  .main-content { padding: 34px 18px 50px; }
  .sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    width: min(350px, 88vw);
    height: 100vh;
    transform: translateX(-105%);
    box-shadow: 16px 0 40px rgba(0, 0, 0, .2);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    z-index: 40;
    inset: 0;
    background: rgba(32, 33, 36, .5);
  }
  .mobile-only { display: inline-flex; }
  .icon-button { align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #e8eaed; font-size: 1.4rem; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .search-form { padding-left: 14px; }
  .search-button { padding-inline: 14px; font-size: .82rem; }
  .hero-copy p { font-size: .9rem; }
  .category-grid, .product-grid { grid-template-columns: 1fr; }
  .category-card { min-height: 180px; }
  .results-toolbar { align-items: stretch; flex-direction: column; }
  .results-toolbar select { min-width: 0; }
  .modal-layout { grid-template-columns: 1fr; }
  .modal-image { height: 220px; min-height: 0; }
  .modal-body { padding: 26px 22px; }
}

