:root {
  --navy: #720e24;
  --navy-2: #4d0b1b;
  --orange: #a6193a;
  --orange-dark: #87122b;
  --cream: #fff8f2;
  --surface: #ffffff;
  --text: #3f1d25;
  --muted: #7f6970;
  --line: #ead9d9;
  --success: #6d1731;
  --shadow: 0 18px 50px rgba(91, 18, 39, .11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--cream);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 100% 0, #f9e8e4 0, transparent 35%), var(--cream); }
button, input { font: inherit; }
button { cursor: pointer; }
svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar { min-height: 5rem; padding: max(1rem, env(safe-area-inset-top)) max(1rem, calc((100vw - 68rem)/2)); display: flex; align-items: center; gap: .85rem; color: #fff; background: var(--navy); box-shadow: 0 3px 16px rgba(91,18,39,.2); }
.brand-mark { width: 3.25rem; height: 3.25rem; border: 2px solid #e7a29d; border-radius: 50%; object-fit: cover; flex: none; }
.topbar h1 { margin: 0; font-size: 1.18rem; letter-spacing: -.02em; }
.topbar h1 span { font-size: .83em; font-weight: 500; color: #f6dad7; }
.topbar p { margin: .2rem 0 0; color: #f4d6d6; font-size: .83rem; }
.icon-button { margin-left: auto; width: 2.75rem; height: 2.75rem; border: 1px solid #ffffff33; border-radius: .8rem; color: #fff; background: #ffffff12; display: grid; place-items: center; }
main { width: min(68rem, calc(100% - 2rem)); margin: 1.25rem auto 3rem; }
.search-panel { position: relative; max-width: 46rem; margin: 0 auto; padding: 1rem; border: 1px solid #ead9d9; border-radius: 1.25rem; background: #fff; box-shadow: var(--shadow); }
.scan-button { width: 100%; min-height: 3.75rem; border: 0; border-radius: .95rem; display: flex; align-items: center; justify-content: center; gap: .7rem; color: #fff; background: linear-gradient(135deg, #94132f, #b82e4c); font-size: 1.05rem; font-weight: 800; box-shadow: 0 10px 24px #720e2433; }
.scan-button:active { transform: translateY(1px); }
.external-scanner-button { width: 100%; min-height: 3rem; margin-top: .7rem; border: 1.5px solid var(--line); border-radius: .85rem; color: var(--navy); background: #fff; font-size: .95rem; font-weight: 750; }
.external-scanner-button:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.external-scanner-status { margin: .55rem .2rem 0; color: var(--muted); font-size: .88rem; }
.or { margin: .85rem 0; display: flex; align-items: center; gap: .75rem; color: #8c95a4; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.or::before, .or::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.search-box { min-height: 3.4rem; padding: 0 .9rem; border: 1.5px solid var(--line); border-radius: .85rem; display: flex; align-items: center; gap: .65rem; color: #9b7a83; background: #fffaf8; }
.search-box:focus-within { border-color: var(--orange); box-shadow: 0 0 0 4px #a6193a18; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 1rem; }
.search-results { position: absolute; z-index: 10; left: 1rem; right: 1rem; top: calc(100% - .5rem); max-height: 23rem; overflow: auto; border: 1px solid var(--line); border-radius: .9rem; background: #fff; box-shadow: var(--shadow); }
.result-item { width: 100%; padding: .8rem; border: 0; border-bottom: 1px solid #edf0f4; display: grid; grid-template-columns: 3.2rem 1fr auto; gap: .75rem; align-items: center; text-align: left; background: #fff; }
.result-item:hover, .result-item:focus-visible { background: #fff4f2; }
.result-item:last-child { border-bottom: 0; }
.result-thumb { width: 3.2rem; height: 3.2rem; border-radius: .65rem; object-fit: contain; background: #f4f5f7; }
.result-name { display: block; font-weight: 750; line-height: 1.25; }
.result-meta { display: block; margin-top: .2rem; color: var(--muted); font-size: .78rem; }
.result-price { color: var(--navy); font-weight: 850; white-space: nowrap; }
.empty-state { max-width: 35rem; margin: 3rem auto; padding: 1rem; text-align: center; color: var(--muted); }
.empty-icon { width: 6rem; height: 6rem; margin: 0 auto 1rem; border-radius: 50%; display: grid; place-items: center; background: #fff; box-shadow: 0 12px 35px #720e241a; }
.empty-icon img { width: 5.5rem; height: 5.5rem; border-radius: 50%; object-fit: cover; }
.empty-state h2 { margin: 0 0 .4rem; color: var(--navy); font-size: 1.3rem; }
.empty-state p { margin: 0; line-height: 1.55; }
.product-card { max-width: 56rem; margin: 1.25rem auto; border-radius: 1.4rem; display: grid; grid-template-columns: minmax(17rem, .85fr) 1.15fr; overflow: hidden; background: #fff; box-shadow: var(--shadow); border: 1px solid #ead9d9; }
.product-visual { min-height: 25rem; padding: 1.5rem; display: grid; place-items: center; background: linear-gradient(145deg, #fbf0ed, #fff); }
.product-visual img { width: 100%; height: 100%; max-height: 23rem; object-fit: contain; mix-blend-mode: multiply; }
.image-fallback { color: #9aa3b0; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.image-fallback svg { width: 4rem; height: 4rem; }
.product-info { padding: clamp(1.3rem, 4vw, 2.5rem); }
.sku { margin: 0 0 .45rem; color: var(--orange-dark); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.product-info h2 { margin: 0 0 1.6rem; color: var(--navy); font-size: clamp(1.35rem, 4vw, 2rem); line-height: 1.18; letter-spacing: -.035em; }
.price-label { margin: 0 0 .15rem; color: var(--muted); font-size: .88rem; }
.base-price { margin: 0; color: var(--navy); font-size: clamp(2.25rem, 8vw, 3.75rem); font-weight: 900; letter-spacing: -.06em; }
.discount-box { margin-top: 1.7rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.discount-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.discount-heading label { font-weight: 800; }
.discount-heading button { border: 0; color: var(--orange-dark); background: transparent; font-size: .85rem; font-weight: 700; }
.discount-controls { display: flex; gap: .65rem; align-items: stretch; }
.discount-input-wrap { min-width: 6.6rem; padding: 0 .7rem; border: 1.5px solid var(--line); border-radius: .8rem; display: flex; align-items: center; background: #fff; }
.discount-input-wrap:focus-within { border-color: var(--orange); }
.discount-input-wrap input { width: 100%; min-height: 3rem; border: 0; outline: 0; color: var(--navy); font-size: 1.1rem; font-weight: 800; background: transparent; }
.quick-discounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; flex: 1; }
.quick-discounts button { min-width: 3rem; border: 1px solid var(--line); border-radius: .75rem; color: var(--navy); background: #fff7f4; font-weight: 750; }
.quick-discounts button.active { border-color: var(--orange); color: #fff; background: var(--orange); }
.final-price-box { margin-top: 1rem; padding: 1rem; border-radius: .95rem; color: #fff; background: linear-gradient(135deg, #670c22, #a51f3d); }
.final-price-box span, .final-price-box small { display: block; }
.final-price-box span { font-size: .8rem; opacity: .8; text-transform: uppercase; letter-spacing: .07em; }
.final-price-box strong { display: block; margin: .1rem 0; font-size: 2rem; letter-spacing: -.04em; }
.final-price-box small { opacity: .85; }
.modal { position: fixed; z-index: 100; inset: 0; padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom)); display: grid; place-items: center; background: #081426d9; backdrop-filter: blur(8px); }
.modal-card { width: min(34rem, 100%); max-height: 100%; overflow: auto; border-radius: 1.35rem; background: #fff; box-shadow: 0 30px 80px #0005; }
.modal-header { padding: 1.2rem; display: flex; align-items: flex-start; gap: 1rem; }
.modal-header h2 { margin: 0; color: var(--navy); font-size: 1.2rem; }
.modal-header p { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; }
.close-button { margin-left: auto; width: 2.6rem; height: 2.6rem; border: 0; border-radius: 50%; color: var(--navy); background: #eef1f5; font-size: 1.75rem; line-height: 1; }
.video-wrap { position: relative; aspect-ratio: 4/3; overflow: hidden; background: #06101d; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; }
.scan-frame { position: absolute; inset: 29% 6%; border: 3px solid #fff; border-radius: 1rem; box-shadow: 0 0 0 999px #0005; }
.scan-frame span { position: absolute; left: 5%; right: 5%; top: 50%; height: 2px; background: var(--orange); box-shadow: 0 0 12px var(--orange); animation: scan 1.8s ease-in-out infinite; }
@keyframes scan { 0%,100% { transform: translateY(-3rem); } 50% { transform: translateY(3rem); } }
.scanner-message { margin: 0; padding: .9rem 1.2rem 1.2rem; color: var(--muted); text-align: center; }
.settings-card { padding-bottom: 1.2rem; }
.upload-area { margin: .3rem 1.2rem 1rem; min-height: 10rem; border: 2px dashed #c8d0db; border-radius: 1rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; color: var(--navy); background: #fafbfc; cursor: pointer; }
.upload-area:hover { border-color: var(--orange); background: #fff4f2; }
.upload-area svg { width: 2rem; height: 2rem; color: var(--orange); }
.upload-area span, .privacy-note { color: var(--muted); font-size: .84rem; }
.privacy-note { margin: 0 1.2rem 1rem; line-height: 1.45; }
.secondary-button { margin: 0 1.2rem; width: calc(100% - 2.4rem); min-height: 3rem; border: 1px solid var(--line); border-radius: .8rem; color: var(--navy); background: #fff; font-weight: 750; }
.import-message { min-height: 1.2rem; margin: .8rem 1.2rem 0; color: var(--success); font-size: .88rem; text-align: center; }
.toast { position: fixed; z-index: 200; left: 50%; bottom: max(1.2rem, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(92%, 30rem); padding: .9rem 1rem; border-radius: .8rem; color: #fff; background: var(--navy); box-shadow: var(--shadow); text-align: center; font-weight: 650; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #a6193a66; outline-offset: 2px; }
@media (max-width: 720px) {
  .topbar { padding-inline: 1rem; }
  main { width: min(100% - 1rem, 40rem); margin-top: .5rem; }
  .search-panel { border-radius: 1rem; }
  .product-card { grid-template-columns: 1fr; border-radius: 1rem; }
  .product-visual { min-height: 15rem; max-height: 18rem; }
  .product-visual img { max-height: 16rem; }
  .product-info { padding: 1.2rem; }
  .product-info h2 { margin-bottom: 1rem; }
  .discount-controls { flex-direction: column; }
  .discount-input-wrap { width: 100%; }
  .quick-discounts button { min-height: 2.75rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; } }
