:root {
  color-scheme: light;
  --paper: #f4f3f0;
  --surface: #fffefa;
  --ink: #1b1b19;
  --muted: #797872;
  --line: #dfddd6;
  --accent: #cf5c46;
  --accent-deep: #a74335;
  --moss: #5d6b59;
  --shadow: 0 18px 50px rgba(24, 24, 21, 0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--paper); }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, ui-sans-serif, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app-shell { min-height: 100dvh; padding-bottom: calc(92px + var(--safe-bottom)); }

.topbar {
  align-items: center;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  height: 68px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(244, 243, 240, 0.94);
  border-bottom: 1px solid rgba(223, 221, 214, 0.8);
  backdrop-filter: blur(16px);
}

.wordmark { color: var(--ink); display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.wordmark span { font-size: 15px; font-weight: 800; letter-spacing: .12em; line-height: 1; }
.wordmark small, .eyebrow { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .14em; line-height: 1.4; }
.topbar-actions { align-items: center; display: flex; gap: 4px; justify-content: flex-end; }
.topbar-left { align-items: center; display: flex; gap: 2px; }
.topbar-left { justify-self: start; }
.topbar-actions { justify-self: end; }
.menu-panel, .account-panel { background: rgba(255,254,250,.94); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 0 0 16px 16px; box-shadow: var(--shadow); left: 12px; padding: 14px; position: fixed; right: 12px; top: 68px; z-index: 25; }
.menu-panel button:not(.icon-button) { background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; display: block; font-size: 15px; padding: 14px 4px; text-align: left; width: 100%; }
.menu-head { align-items: center; display: flex; justify-content: space-between; padding: 0 2px 8px; }
.profile-card { align-items: center; display: flex; gap: 12px; padding: 18px 4px; }
.profile-card span { color: var(--muted); display: block; font-size: 12px; margin-top: 4px; }
.profile-avatar { align-items: center; background: var(--line); border-radius: 50%; display: flex; height: 48px; justify-content: center; overflow: hidden; width: 48px; }
.profile-avatar img { height: 100%; object-fit: cover; width: 100%; }
.panel-copy { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 4px; }
.icon-button { align-items: center; background: transparent; border: 0; border-radius: 50%; cursor: pointer; display: inline-flex; height: 36px; justify-content: center; padding: 0; position: relative; width: 36px; }
.icon-button:hover { background: rgba(27, 27, 25, .06); }
.icon-button svg { height: 18px; stroke-width: 1.7; width: 18px; }
.bag-count { align-items: center; background: var(--accent); border: 2px solid var(--paper); border-radius: 50%; color: #fff; display: flex; font-size: 9px; font-weight: 800; height: 17px; justify-content: center; line-height: 1; min-width: 17px; padding: 0 3px; position: absolute; right: -1px; top: -1px; }

main, .screen-view { margin: 0 auto; max-width: 1240px; padding: 0 18px; }
.intro-block { padding: 52px 0 34px; }
.eyebrow { align-items: center; display: inline-flex; gap: 8px; }
.eyebrow-dot { background: var(--accent); border-radius: 50%; display: inline-block; height: 6px; width: 6px; }
.intro-block h1 { font-size: clamp(38px, 11vw, 74px); font-weight: 650; letter-spacing: 0; line-height: .98; margin: 17px 0 12px; max-width: 620px; }
.intro-block p { color: var(--muted); font-size: 15px; line-height: 1.45; margin: 0; }

.search-row { align-items: center; border-bottom: 1px solid var(--ink); display: flex; gap: 10px; margin: 0 0 24px; padding: 0 0 10px; }
.search-row > svg { color: var(--muted); height: 18px; width: 18px; }
.search-row input { background: transparent; border: 0; color: var(--ink); flex: 1; font-size: 16px; min-width: 0; outline: 0; }
.search-row input::placeholder { color: #a4a19a; }
.clear-search { background: transparent; border: 0; cursor: pointer; display: inline-flex; padding: 3px; }
.clear-search svg { height: 16px; width: 16px; }

.category-tabs { border-bottom: 1px solid var(--line); display: flex; gap: 23px; overflow-x: auto; padding-bottom: 11px; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.tab { background: transparent; border: 0; color: var(--muted); cursor: pointer; flex: 0 0 auto; font-size: 13px; padding: 0; position: relative; }
.tab::after { background: transparent; bottom: -12px; content: ""; height: 2px; left: 0; position: absolute; right: 0; }
.tab.is-active { color: var(--ink); font-weight: 700; }
.tab.is-active::after { background: var(--accent); }

.catalog-section { padding: 28px 0 48px; }
.section-heading { align-items: baseline; display: flex; justify-content: space-between; margin-bottom: 15px; }
.section-heading h2 { font-size: 17px; font-weight: 650; letter-spacing: 0; margin: 0; }
.section-heading span { color: var(--muted); font-size: 12px; }
.product-grid { display: grid; gap: 22px 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product-card { min-width: 0; }
.product-image-wrap { aspect-ratio: 4 / 5; background: #e6e3dc; border: 0; border-radius: 14px; cursor: pointer; overflow: hidden; padding: 0; position: relative; width: 100%; }
.product-image { display: block; height: 100%; object-fit: cover; transition: transform .45s ease; width: 100%; }
.product-card:hover .product-image { transform: scale(1.04); }
.stock-badge { background: rgba(255, 254, 250, .92); bottom: 8px; color: var(--moss); font-size: 9px; font-weight: 750; left: 8px; letter-spacing: .06em; padding: 5px 7px; position: absolute; text-transform: uppercase; }
.stock-badge.is-empty { color: var(--muted); }
.product-add { align-items: center; backdrop-filter: blur(14px); background: rgba(255,255,255,.48); border: 1px solid rgba(255,255,255,.72); border-radius: 50%; bottom: 10px; box-shadow: 0 5px 18px rgba(27,27,25,.14); color: var(--ink); cursor: pointer; display: inline-flex; height: 36px; justify-content: center; position: absolute; right: 10px; width: 36px; }
.product-add:hover { background: var(--accent); }
.product-add:disabled { background: rgba(27, 27, 25, .3); cursor: not-allowed; }
.product-add svg { height: 16px; width: 16px; }
.product-meta { padding-top: 10px; }
.product-brand { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.product-name { font-size: 14px; font-weight: 550; line-height: 1.25; margin-top: 3px; }
.product-price { font-size: 13px; margin-top: 7px; }
.product-price.is-request { color: var(--muted); }

.loading-state, .empty-state { align-items: center; color: var(--muted); display: flex; flex-direction: column; font-size: 13px; gap: 10px; grid-column: 1 / -1; justify-content: center; min-height: 180px; text-align: center; }
.spinner { animation: spin .8s linear infinite; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; height: 23px; width: 23px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state strong, .cart-empty strong { color: var(--ink); font-size: 16px; font-weight: 650; }
.empty-state svg, .cart-empty svg { color: var(--muted); height: 25px; width: 25px; }
.empty-state span { font-size: 12px; }

.bottom-cart { bottom: 0; left: 0; padding: 10px 18px calc(10px + var(--safe-bottom)); position: fixed; right: 0; z-index: 15; }
.bottom-cart-main { align-items: center; backdrop-filter: blur(18px); background: rgba(27,27,25,.84); border: 1px solid rgba(255,255,255,.16); border-radius: 14px; box-shadow: 0 8px 30px rgba(27, 27, 25, .22); color: #fff; cursor: pointer; display: flex; font-size: 13px; justify-content: space-between; padding: 15px 16px; width: 100%; }
.bottom-cart-main span { align-items: center; display: inline-flex; gap: 9px; }
.bottom-cart-main svg { height: 16px; width: 16px; }
.bottom-cart-main strong { color: #fff; font-size: 13px; }

.screen-view { padding-bottom: 40px; padding-top: 26px; }
.screen-heading { align-items: flex-start; display: flex; justify-content: space-between; margin-bottom: 26px; }
.screen-heading h1 { font-size: 42px; font-weight: 650; line-height: 1; margin: 11px 0 0; }
.detail-wrap { padding-bottom: 40px; }
.detail-title { padding: 6px 0 14px; }
.detail-title h1 { font-size: 25px; font-weight: 650; margin: 5px 0 0; }
.detail-hero { aspect-ratio: 1 / 1.22; background: #e6e3dc; border-radius: 16px; overflow: hidden; position: relative; }
.gallery-track { display: flex; height: 100%; transition: transform .3s ease; width: 100%; }
.detail-hero img { display: block; flex: 0 0 100%; height: 100%; object-fit: cover; width: 100%; }
.gallery-count { background: rgba(27,27,25,.64); border: 1px solid rgba(255,255,255,.35); border-radius: 20px; bottom: 10px; color: #fff; font-size: 11px; left: 50%; padding: 5px 9px; position: absolute; transform: translateX(-50%); }
.detail-info { padding-top: 22px; }
.detail-info h1 { font-size: 40px; font-weight: 650; line-height: .98; margin: 9px 0 13px; }
.detail-info p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0; max-width: 540px; }
.detail-price-row { align-items: center; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); display: flex; justify-content: space-between; margin: 24px 0; padding: 15px 0; }
.detail-price { font-size: 16px; font-weight: 700; }
.detail-stock { color: var(--moss); font-size: 12px; }
.detail-stock.is-empty { color: var(--muted); }

.cart-list { display: flex; flex-direction: column; gap: 0; }
.cart-item { align-items: center; border-bottom: 1px solid var(--line); display: grid; gap: 12px; grid-template-columns: 66px minmax(0, 1fr) auto; padding: 15px 0; }
.cart-item:first-child { border-top: 1px solid var(--line); }
.cart-thumb { aspect-ratio: 1 / 1.15; background: #e6e3dc; object-fit: cover; width: 66px; }
.cart-item-brand { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cart-item-name { font-size: 13px; font-weight: 600; line-height: 1.2; margin-top: 4px; }
.cart-item-price { font-size: 12px; margin-top: 7px; }
.qty-control { align-items: center; display: flex; gap: 7px; }
.qty-control button { align-items: center; background: transparent; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; display: inline-flex; height: 24px; justify-content: center; padding: 0; width: 24px; }
.qty-control button:disabled { cursor: not-allowed; opacity: .35; }
.qty-control svg { height: 12px; width: 12px; }
.qty-control span { font-size: 12px; min-width: 13px; text-align: center; }
.cart-empty { align-items: center; display: flex; flex-direction: column; gap: 13px; justify-content: center; min-height: 330px; text-align: center; }
.text-button { align-items: center; background: transparent; border: 0; color: var(--accent-deep); cursor: pointer; display: inline-flex; font-size: 13px; gap: 6px; padding: 4px 0; }
.text-button svg { height: 15px; width: 15px; }
.cart-summary { border-top: 1px solid var(--ink); margin-top: 20px; padding-top: 15px; }
.summary-line { align-items: center; color: var(--muted); display: flex; font-size: 13px; justify-content: space-between; padding: 4px 0; }
.summary-line strong { color: var(--ink); font-weight: 600; }
.total-line { color: var(--ink); font-size: 17px; padding: 11px 0 17px; }
.total-line strong { font-size: 18px; }
.primary-button { align-items: center; backdrop-filter: blur(16px); background: rgba(207,92,70,.88); border: 1px solid rgba(255,255,255,.35); border-radius: 14px; box-shadow: 0 8px 22px rgba(167,67,53,.18); color: #fff; cursor: pointer; display: inline-flex; font-size: 14px; font-weight: 650; gap: 10px; justify-content: center; min-height: 50px; padding: 0 17px; width: 100%; }
.primary-button:hover { background: var(--accent-deep); }
.primary-button svg { height: 16px; width: 16px; }

.overlay { background: rgba(27, 27, 25, .3); inset: 0; position: fixed; z-index: 30; }
.sheet { background: var(--surface); border: 0; border-radius: 12px 12px 0 0; bottom: 0; box-shadow: var(--shadow); color: var(--ink); margin: 0; max-height: min(92dvh, 680px); max-width: 680px; padding: 12px 18px calc(22px + var(--safe-bottom)); position: fixed; width: 100%; }
.sheet::backdrop { background: transparent; }
.sheet-handle { background: var(--line); border-radius: 2px; height: 4px; margin: 0 auto 22px; width: 38px; }
.sheet-heading { align-items: flex-start; display: flex; justify-content: space-between; }
.sheet-heading h2 { font-size: 32px; font-weight: 650; line-height: 1; margin: 9px 0 0; }
.sheet-copy { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 14px 0 23px; }
.field-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .03em; margin: 14px 0 7px; }
.field-label span { color: var(--muted); font-weight: 400; }
.text-input { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); display: block; font-size: 15px; outline: 0; padding: 9px 0 11px; width: 100%; }
.text-input:focus { border-bottom-color: var(--accent); }
.text-input::placeholder { color: #aaa79f; }
.text-area { min-height: 70px; resize: vertical; }
.form-error { background: #f9e8e3; color: #a74335; font-size: 12px; line-height: 1.4; margin-top: 14px; padding: 10px; }
.form-submit { margin-top: 25px; }
.success-sheet { align-items: flex-start; display: flex; flex-direction: column; gap: 12px; justify-content: center; min-height: 360px; padding: 32px 24px calc(28px + var(--safe-bottom)); }
.success-mark { align-items: center; background: var(--moss); border-radius: 50%; color: #fff; display: flex; height: 52px; justify-content: center; margin-bottom: 8px; width: 52px; }
.success-mark svg { height: 24px; width: 24px; }
.success-sheet h2 { font-size: 36px; font-weight: 650; line-height: 1; margin: 3px 0 0; }
.success-sheet p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 8px; }
.reference-box { background: var(--paper); display: flex; flex-direction: column; gap: 4px; margin: 4px 0 12px; padding: 12px 14px; width: 100%; }
.reference-box span { color: var(--muted); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.reference-box strong { font-size: 16px; letter-spacing: .06em; }

.toast { background: var(--ink); border-radius: 3px; bottom: calc(88px + var(--safe-bottom)); color: #fff; font-size: 12px; left: 50%; max-width: calc(100% - 36px); opacity: 0; padding: 11px 14px; pointer-events: none; position: fixed; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; z-index: 50; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 680px) {
  .topbar { padding-left: 34px; padding-right: 34px; }
  main, .screen-view { padding-left: 34px; padding-right: 34px; }
  .intro-block { padding-top: 76px; }
  .product-grid { gap: 34px 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-wrap { align-items: start; display: grid; gap: 54px; grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr); padding-top: 28px; }
  .detail-info { padding-top: 28px; }
  .detail-info h1 { font-size: 56px; }
  .sheet { left: 50%; transform: translateX(-50%); }
}

@media (min-width: 1020px) {
  .topbar { grid-template-columns: 1fr auto 1fr; height: 76px; padding-left: 52px; padding-right: 52px; }
  main, .screen-view { padding-left: 52px; padding-right: 52px; }
  .intro-block { padding-bottom: 48px; padding-top: 98px; }
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
