:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --bg-elevated: #fbfaf7;
  --panel: #ffffff;
  --panel-strong: #f7f5ef;
  --ink: #17191c;
  --muted: #66717a;
  --soft: #89929a;
  --line: #d8d2c8;
  --line-strong: #b9b0a3;
  --accent: #b31422;
  --accent-strong: #8f101c;
  --steel: #3f5965;
  --amber: #b87518;
  --green: #24785a;
  --shadow: 0 18px 46px rgba(34, 31, 27, 0.12);
  --shadow-soft: 0 10px 28px rgba(34, 31, 27, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1214;
  --bg-elevated: #171c20;
  --panel: #1f262b;
  --panel-strong: #293138;
  --ink: #f5f1e8;
  --muted: #b7c0c7;
  --soft: #87939c;
  --line: #333d45;
  --line-strong: #53616c;
  --accent: #e33a46;
  --accent-strong: #ff5964;
  --steel: #9fb3bf;
  --amber: #d99b32;
  --green: #54b58c;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.26);
}

:root[data-theme="dark"] .result {
  background: #2a3139;
  border-color: #46515c;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

:root[data-theme="dark"] .result:hover {
  background: #303842;
  border-color: #596673;
}

:root[data-theme="dark"] .thumb,
:root[data-theme="dark"] .detail-image {
  background: #f4f1ea;
  border-color: #5c6772;
}

:root[data-theme="dark"] .thumb.placeholder,
:root[data-theme="dark"] .detail-image.placeholder {
  background: #303842;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(179, 20, 34, 0.13), transparent 28rem),
    linear-gradient(180deg, rgba(63, 89, 101, 0.12), transparent 18rem),
    var(--bg);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: clamp(64px, 11vw, 82px);
  height: clamp(48px, 7.5vw, 58px);
  flex: 0 0 auto;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 72%, transparent);
  border-radius: 6px;
  background: linear-gradient(180deg, #fbfaf4, #d9ddd8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), var(--shadow-soft);
}

.brand-logo {
  display: block;
  width: 100%;
  max-height: 100%;
  height: auto;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.kicker,
.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 4.8vw, 2.2rem);
  line-height: 1;
}

.top-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
  flex: 0 0 auto;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.theme-toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  transition: transform 160ms ease;
}

:root[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(20px);
}

.theme-toggle-label {
  font-size: 0.76rem;
  font-weight: 800;
}

.cart-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 850;
}

.cart-button {
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.cart-button svg {
  width: 18px;
  height: 18px;
  color: var(--accent-strong);
}

.cart-button b {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.secondary-button {
  background: var(--panel-strong);
  color: var(--ink);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.6;
}

.meta {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.meta strong {
  color: var(--ink);
  font-size: 0.88rem;
}

.search-panel {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 8px 0 12px;
  background: linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 86%, transparent));
  backdrop-filter: blur(16px);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 60px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search-box:focus-within {
  border-color: var(--accent);
}

.search-icon {
  width: 22px;
  height: 22px;
  margin-left: 16px;
  color: var(--accent);
}

#search {
  width: 100%;
  min-width: 0;
  height: 58px;
  padding: 0 54px 0 12px;
  border: 0;
  outline: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 1.12rem;
}

#search::placeholder {
  color: var(--soft);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
}

.icon-button:active,
.icon-button:hover {
  border-color: var(--line);
  background: var(--panel-strong);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

#clearSearch {
  position: absolute;
  right: 8px;
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 2px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.results {
  display: grid;
  gap: 10px;
  padding: 4px 0 24px;
}

.result {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.result:hover {
  border-color: var(--line-strong);
}

.result:active {
  transform: translateY(1px);
}

.result.service {
  border-left-color: var(--amber);
}

.result.disc {
  border-left-color: var(--soft);
}

.thumb,
.detail-image {
  display: block;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  object-fit: contain;
}

.thumb.placeholder,
.detail-image.placeholder {
  display: grid;
  place-items: center;
  color: var(--soft);
  font-weight: 900;
  letter-spacing: 0;
}

.result-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.part {
  font-size: 1.18rem;
  font-weight: 850;
  line-height: 1;
}

.desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-side {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 3px;
  min-width: 88px;
}

.pill {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.price {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 850;
  white-space: nowrap;
}

.price-label {
  color: var(--muted);
  font-size: 0.7rem;
  text-align: right;
}

.muted {
  color: var(--muted);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 32px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(760px, calc(100% - 18px));
  height: min(88dvh, 940px);
  max-height: calc(100dvh - 18px);
  margin: auto auto 10px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

dialog::backdrop {
  background: rgba(10, 12, 14, 0.46);
  backdrop-filter: blur(6px);
}

.detail-frame {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.detail-top {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.modal-titlebar {
  justify-content: space-between;
}

.modal-titlebar strong {
  padding-left: 6px;
  font-size: 1rem;
}

.detail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 14px max(28px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.detail-hero {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px 0 16px;
}

.detail-visual {
  display: grid;
  place-items: center;
}

.detail-image {
  width: 102px;
  height: 102px;
}

.detail-copy {
  min-width: 0;
}

.detail-hero h2 {
  margin: 0 0 7px;
  font-size: 2.05rem;
  line-height: 1;
}

.detail-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.32;
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.link-button:active,
.link-button:hover {
  border-color: var(--accent);
}

.cart-add-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.cart-add-panel strong {
  display: block;
  margin-bottom: 4px;
}

.cart-add-panel p,
.muted-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.qty-field,
.field,
.cart-qty {
  display: grid;
  gap: 5px;
}

.qty-field span,
.field span,
.cart-qty span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.qty-field input,
.field input,
.cart-qty input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--ink);
}

.qty-field input:focus,
.field input:focus,
.cart-qty input:focus {
  border-color: var(--accent);
  outline: 0;
}

.category-stack {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.category-stack span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
}

.detail-section {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.detail-section h4 {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.compact-rows {
  margin-top: 10px;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(118px, 38%) minmax(0, 1fr);
  gap: 10px;
  min-height: 30px;
  align-items: center;
  padding: 7px 9px;
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-grid.primary {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.metric {
  display: grid;
  gap: 5px;
  min-height: 74px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.metric.accent {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.metric.subtle {
  background: color-mix(in srgb, var(--panel-strong) 82%, var(--bg));
}

.metric span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  font-size: 1.22rem;
  line-height: 1;
}

.promo-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-strong) 78%, var(--panel));
}

.promo-card + .promo-card {
  margin-top: 9px;
}

.promo-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.promo-head span,
.promo-head b {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.promo-head span {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent-strong);
}

.promo-head b {
  background: color-mix(in srgb, var(--steel) 16%, var(--panel));
  color: var(--steel);
}

.promo-card strong {
  color: var(--ink);
  font-size: 0.94rem;
}

.promo-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.promo-dates {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 850;
}

.promo-prices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 6px;
}

.promo-prices span {
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
}

.promo-prices b {
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.promo-card small,
.promo-card footer {
  color: var(--muted);
  font-size: 0.74rem;
}

.faber-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.faber-card + .faber-card {
  margin-top: 8px;
}

.faber-card.primary {
  border-left: 4px solid var(--accent);
  background: var(--panel);
}

.faber-card strong {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  font-size: 0.9rem;
}

.faber-card strong span {
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent-strong);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.faber-card p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
}

.faber-card small {
  color: var(--muted);
  font-size: 0.72rem;
}

.faber-card b {
  white-space: nowrap;
}

.cart-body,
.checkout-body {
  display: grid;
  align-content: start;
  gap: 12px;
}

.cart-note {
  margin: 0;
  padding: 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.cart-items {
  display: grid;
  gap: 8px;
}

.cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 108px 38px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.cart-item-main {
  min-width: 0;
}

.cart-item-main strong {
  display: block;
  font-size: 0.96rem;
}

.cart-item-main p {
  margin: 3px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.cart-item-main small {
  color: var(--accent-strong);
  font-weight: 850;
}

.cart-line-total {
  text-align: right;
  white-space: nowrap;
}

.cart-summary {
  display: grid;
  gap: 7px;
  padding: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.cart-summary-row:last-child {
  color: var(--ink);
  font-size: 1.04rem;
}

.cart-summary strong {
  color: var(--ink);
}

.checkout-totals {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cart-empty {
  min-height: 160px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 760;
  text-align: right;
}

[hidden] {
  display: none !important;
}

@media (min-width: 720px) {
  .app-shell {
    padding-inline: 24px;
  }

  .results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result {
    min-height: 96px;
  }

  .detail-hero {
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .detail-image {
    width: 118px;
    height: 118px;
  }
}

@media (max-width: 520px) {
  .topbar {
    display: grid;
  }

  .top-actions {
    justify-items: start;
    width: 100%;
  }

  .meta {
    text-align: left;
  }
}

@media (max-width: 430px) {
  .result {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .thumb {
    width: 52px;
    height: 52px;
  }

  .result-side {
    grid-column: 2;
    justify-items: start;
    grid-auto-flow: column;
    align-items: center;
  }

  .price-label {
    text-align: left;
  }

  .metric-grid,
  .metric-grid.primary {
    grid-template-columns: 1fr;
  }

  .cart-add-panel,
  .cart-item {
    grid-template-columns: 1fr;
  }

  .cart-line-total {
    text-align: left;
  }

  .modal-actions {
    justify-content: stretch;
  }

  .modal-actions button {
    flex: 1 1 150px;
  }
}
