:root {
  --bg: #06111f;
  --surface: rgba(21, 32, 48, .92);
  --surface-2: rgba(15, 25, 39, .94);
  --text: #f1f7ff;
  --muted: #9fb0c6;
  --line: rgba(255,255,255,.12);
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --danger: #fb7185;
  --warning: #facc15;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56,189,248,.24), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(34,197,94,.2), transparent 30rem),
    linear-gradient(180deg, #07111f 0%, #05101c 100%);
}

.app-shell { width: min(880px, 100%); margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); }
.app-header { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; margin: 12px 0 18px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-weight: 950; letter-spacing: .11em; text-transform: uppercase; font-size: 12px; }
h1 { margin: 0; font-size: clamp(30px, 8vw, 46px); line-height: 1.04; letter-spacing: -.04em; }
.desc { margin: 12px 0 0; color: var(--muted); line-height: 1.55; font-size: 15px; }
.badge { white-space: nowrap; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.08); color: var(--accent-2); font-weight: 950; box-shadow: inset 0 1px rgba(255,255,255,.12); }

.panel, .card, .search-box, .store-bar {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.07));
  border-radius: 28px;
  box-shadow: 0 22px 70px rgba(0,0,0,.28);
  backdrop-filter: blur(16px);
}

.login-panel { padding: 16px; }
.login-form { display: grid; gap: 12px; }
.store-bar { margin: 0 0 14px; padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; position: sticky; top: 10px; z-index: 7; }
.store-main { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; min-width: 0; }
.store-code { color: #06111f; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-radius: 18px; padding: 12px 14px; font-weight: 950; letter-spacing: .04em; }
.store-name { font-weight: 950; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.store-address { color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 3px; overflow-wrap: anywhere; }
.btn-logout { min-height: 44px; border-radius: 16px; color: #fecaca; background: rgba(251,113,133,.11); border: 1px solid rgba(251,113,133,.25); }

.search-panel { padding: 16px; }
.form { display: grid; gap: 12px; }
.field span { display: block; color: var(--muted); font-size: 13px; margin: 0 0 7px 2px; }
input { width: 100%; min-height: 56px; border: 1px solid var(--line); border-radius: 20px; background: rgba(5,12,22,.58); color: var(--text); padding: 0 16px; outline: none; font-size: 18px; font-weight: 900; text-transform: uppercase; box-shadow: inset 0 1px rgba(255,255,255,.05); }
input:focus { border-color: rgba(56,189,248,.7); box-shadow: 0 0 0 4px rgba(56,189,248,.14), inset 0 1px rgba(255,255,255,.05); }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn, button { min-height: 54px; border: 0; border-radius: 20px; padding: 0 16px; font-size: 16px; font-weight: 950; cursor: pointer; color: #04111f; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-secondary { color: var(--text); background: rgba(255,255,255,.1); border: 1px solid var(--line); }
.btn-ghost { color: #bfdbfe; background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.22); width: 100%; }
button:disabled { opacity: .55; cursor: not-allowed; }
.status { margin: 14px 4px 0; color: var(--muted); min-height: 24px; line-height: 1.45; font-size: 15px; }
.status.error { color: var(--danger); }
.status.ok { color: #86efac; }
.hidden { display: none !important; }

.search-box { margin-top: 16px; padding: 16px; }
.search-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.search-head h2 { margin: 0; font-size: 21px; }
.search-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.search-head span { color: var(--warning); font-weight: 950; white-space: nowrap; }
.search-list { display: grid; gap: 10px; }
.item-row { width: 100%; text-align: left; display: grid; grid-template-columns: 88px 1fr auto; grid-template-areas: "plu desc oh" "meta meta meta"; gap: 8px 10px; align-items: center; padding: 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 20px; background: rgba(5,12,22,.46); color: var(--text); }
.item-row:active { transform: scale(.99); }
.item-plu { grid-area: plu; color: #86efac; font-weight: 950; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.item-desc { grid-area: desc; font-weight: 950; line-height: 1.35; overflow-wrap: anywhere; }
.item-meta { grid-area: meta; color: var(--muted); font-size: 12px; line-height: 1.35; }
.item-oh { grid-area: oh; min-width: 74px; text-align: center; border-radius: 16px; padding: 8px 10px; background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.25); }
.item-oh span { display: block; color: var(--muted); font-size: 10px; line-height: 1; margin-bottom: 3px; }
.item-oh strong { display: block; color: #86efac; font-size: 22px; line-height: 1; }

.result { display: grid; gap: 14px; margin-top: 16px; }
.result-actions { margin-bottom: 2px; }
.card { padding: 16px; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; }
.card-title h2 { margin: 0; font-size: 21px; }
.data-list { display: grid; gap: 10px; margin: 0; }
.data-list div { display: grid; gap: 4px; padding: 14px; background: rgba(5,12,22,.46); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; font-weight: 950; overflow-wrap: anywhere; font-size: 17px; }
.big { font-size: 42px; color: #86efac; line-height: 1; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 15px; }
.product-name { margin-bottom: 12px; padding: 16px; border-radius: 22px; background: rgba(56,189,248,.15); border: 1px solid rgba(56,189,248,.25); font-size: 22px; line-height: 1.25; font-weight: 950; }

.scanner-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; padding: 16px; background: rgba(0,0,0,.72); }
.scanner-card { width: min(520px, 100%); border: 1px solid var(--line); border-radius: 28px; padding: 14px; background: #0b1625; box-shadow: 0 24px 90px rgba(0,0,0,.55); }
.scanner-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.scanner-head h2 { margin: 0; font-size: 20px; }
.scanner-head p { margin: 5px 0 0; color: var(--muted); line-height: 1.4; font-size: 13px; }
.icon-btn { width: 44px; min-height: 44px; border-radius: 999px; color: var(--text); background: rgba(255,255,255,.1); border: 1px solid var(--line); }
.scanner-actions { display: grid; grid-template-columns: 1fr; margin-bottom: 10px; }
#btnFlash { color: #fde68a; background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.25); }
.video-wrap { position: relative; overflow: hidden; border-radius: 22px; background: #000; aspect-ratio: 1 / 1; }
#qrVideo { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid rgba(56,189,248,.9); border-radius: 22px; box-shadow: 0 0 0 999px rgba(0,0,0,.22); }
.qr-status { color: var(--muted); margin: 12px 2px 2px; line-height: 1.45; }
footer { text-align: center; color: var(--muted); padding: 28px 0 8px; }

@media (min-width: 760px) {
  .login-form { grid-template-columns: 1fr auto; align-items: end; }
  .form { grid-template-columns: minmax(220px,1fr) auto; align-items: end; }
  .action-grid { grid-template-columns: auto auto; }
  .result { grid-template-columns: 1fr 1.15fr; }
  .result-actions { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .app-header { grid-template-columns: 1fr; }
  .badge { width: fit-content; }
  h1 { font-size: 34px; }
  .panel, .card, .search-box, .store-bar { border-radius: 24px; }
  .action-grid { grid-template-columns: 1fr; }
  .store-bar { grid-template-columns: 1fr; position: static; }
  .btn-logout { width: 100%; }
  .item-row { grid-template-columns: 1fr auto; grid-template-areas: "desc oh" "plu oh" "meta meta"; }
}
