:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #eaf2ff;
  --ink: #0a1730;
  --muted: #68748b;
  --line: rgba(10, 23, 48, 0.09);
  --blue: #146ef5;
  --blue-2: #0a4cc9;
  --cyan: #24c7f2;
  --orange: #ff8b32;
  --danger: #e23b4f;
  --success: #0b9f72;
  --shadow: 0 18px 45px rgba(26, 61, 118, 0.12);
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

.app-shell { min-height: 100dvh; max-width: 720px; margin: 0 auto; background: var(--bg); position: relative; }
.topbar { position: sticky; top: 0; z-index: 20; height: 72px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; background: rgba(243, 246, 251, .88); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(255,255,255,.7); }
.brand { border: 0; background: none; padding: 0; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.brand-mark { width: 42px; height: 42px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(145deg, var(--cyan), var(--blue)); color: white; font-weight: 900; font-size: 22px; box-shadow: 0 10px 22px rgba(20, 110, 245, .28); transform: rotate(-4deg); }
.brand strong { display: block; letter-spacing: .08em; font-size: 14px; }
.brand small { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }
.top-actions { display: flex; gap: 8px; }
.icon-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); cursor: pointer; box-shadow: 0 8px 18px rgba(26,61,118,.06); }
.icon-btn svg { width: 21px; height: 21px; }
.cart-badge { position: absolute; right: -4px; top: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; background: var(--orange); color: white; font-size: 10px; font-weight: 800; border: 2px solid var(--bg); }

.main-content { padding: 4px 16px calc(102px + var(--safe-bottom)); }
.hero { margin-top: 8px; border-radius: 28px; padding: 24px 22px; min-height: 210px; overflow: hidden; position: relative; color: white; background: radial-gradient(circle at 80% 10%, rgba(55,229,255,.65), transparent 30%), linear-gradient(135deg, #061a3a 0%, #0a4cc9 55%, #1887f7 100%); box-shadow: 0 20px 50px rgba(10, 76, 201, .25); }
.hero::after { content: ""; position: absolute; width: 170px; height: 170px; right: -35px; bottom: -62px; border: 28px solid rgba(255,255,255,.12); border-radius: 50%; }
.hero-kicker { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 12px; font-weight: 700; }
.hero h1 { max-width: 390px; font-size: clamp(28px, 8vw, 43px); line-height: .98; letter-spacing: -.04em; margin: 17px 0 12px; }
.hero p { max-width: 360px; margin: 0 0 20px; color: rgba(255,255,255,.78); font-size: 14px; line-height: 1.45; }
.hero-actions { display: flex; gap: 10px; position: relative; z-index: 2; }
.btn { min-height: 46px; border: 0; border-radius: 15px; padding: 0 17px; font-weight: 800; cursor: pointer; display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
.btn-primary { background: var(--blue); color: white; box-shadow: 0 10px 22px rgba(20,110,245,.25); }
.btn-light { background: white; color: #0a4cc9; }
.btn-dark-glass { background: rgba(255,255,255,.15); color: white; border: 1px solid rgba(255,255,255,.2); }
.btn-secondary { background: var(--surface-2); color: var(--blue-2); }
.btn-danger { background: #fff0f2; color: var(--danger); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.search-box { margin: 16px 0; height: 54px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(26,61,118,.07); display: flex; align-items: center; gap: 10px; padding: 0 15px; }
.search-box svg { width: 21px; height: 21px; color: var(--muted); }
.search-box input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--ink); }
.search-box input::placeholder { color: #9aa3b3; }
.search-clear { border: 0; background: #eef2f8; border-radius: 10px; width: 29px; height: 29px; cursor: pointer; }

.section-head { display: flex; align-items: end; justify-content: space-between; margin: 24px 2px 13px; }
.section-head h2 { font-size: 21px; letter-spacing: -.02em; margin: 0; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.text-btn { border: 0; background: none; color: var(--blue); font-weight: 750; cursor: pointer; padding: 5px; }

.category-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(118px, 1fr); gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; }
.category-strip::-webkit-scrollbar { display: none; }
.category-card { min-height: 125px; border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 14px; text-align: left; cursor: pointer; box-shadow: 0 10px 22px rgba(26,61,118,.06); }
.category-card .emoji { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(145deg, #edf8ff, #dfeaff); font-size: 25px; margin-bottom: 13px; }
.category-card strong { display: block; font-size: 13px; line-height: 1.18; }
.category-card small { display: block; color: var(--muted); margin-top: 5px; }

.filter-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 0 0 8px; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 13px; font-size: 13px; font-weight: 700; cursor: pointer; }
.filter-chip.active { background: var(--ink); color: white; border-color: var(--ink); }

.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.product-card { background: var(--surface); border: 1px solid var(--line); border-radius: 21px; overflow: hidden; box-shadow: 0 12px 26px rgba(26,61,118,.07); cursor: pointer; min-width: 0; }
.product-image { position: relative; aspect-ratio: 1 / .82; background: radial-gradient(circle at 30% 25%, #fff, transparent 18%), linear-gradient(145deg, #dff7ff, #dce7ff); overflow: hidden; display: grid; place-items: center; }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-placeholder { font-size: 46px; filter: drop-shadow(0 12px 14px rgba(10,76,201,.2)); }
.stock-pill { position: absolute; top: 9px; left: 9px; border-radius: 999px; padding: 5px 8px; background: rgba(255,255,255,.88); backdrop-filter: blur(8px); font-size: 10px; font-weight: 800; }
.stock-pill.preorder { color: #b96004; }
.stock-pill.out_of_stock { color: var(--danger); }
.product-info { padding: 13px; }
.product-brand { color: var(--blue); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-name { font-weight: 800; font-size: 14px; line-height: 1.25; min-height: 35px; margin-top: 4px; }
.price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.price { font-weight: 900; font-size: 17px; }
.old-price { font-size: 11px; text-decoration: line-through; color: #9aa3b3; }
.card-add { margin-left: auto; width: 35px; height: 35px; border: 0; background: var(--ink); color: white; border-radius: 12px; cursor: pointer; font-size: 20px; display: grid; place-items: center; }

.page-header { padding: 12px 2px 7px; }
.page-header h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.page-header p { margin: 6px 0 0; color: var(--muted); }
.empty-state { text-align: center; padding: 48px 20px; background: var(--surface); border-radius: 24px; border: 1px solid var(--line); }
.empty-icon { width: 76px; height: 76px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 26px; background: var(--surface-2); font-size: 36px; }
.empty-state h3 { margin: 0 0 7px; }
.empty-state p { margin: 0 auto 20px; max-width: 320px; color: var(--muted); line-height: 1.45; }

.bottom-nav { position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%); width: min(720px, 100%); min-height: calc(72px + var(--safe-bottom)); padding: 7px 10px calc(7px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: rgba(255,255,255,.93); backdrop-filter: blur(20px); border-top: 1px solid var(--line); }
.nav-item { border: 0; background: none; border-radius: 15px; padding: 7px 3px 5px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #7c879a; font-size: 10px; font-weight: 700; cursor: pointer; }
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--blue); background: #edf4ff; }
.nav-icon-wrap { position: relative; line-height: 0; }
.nav-icon-wrap i { position: absolute; top: -7px; right: -10px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 10px; display: grid; place-items: center; background: var(--orange); color: white; font-size: 9px; font-style: normal; border: 2px solid white; }

.modal-overlay { position: fixed; z-index: 100; inset: 0; background: rgba(4,14,32,.55); backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; }
.modal-sheet { width: min(720px, 100%); max-height: 93dvh; overflow-y: auto; background: var(--surface); border-radius: 28px 28px 0 0; padding: 10px 18px calc(22px + var(--safe-bottom)); animation: sheetUp .22s ease-out; }
.modal-grabber { width: 42px; height: 5px; border-radius: 999px; background: #d8dde7; margin: 1px auto 12px; }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 15px; }
.modal-head h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.modal-close { border: 0; background: #eef2f7; border-radius: 13px; width: 40px; height: 40px; cursor: pointer; font-size: 22px; }
.detail-image { aspect-ratio: 1.45; border-radius: 22px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 25% 25%, #fff, transparent 18%), linear-gradient(145deg, #dff7ff, #dce7ff); font-size: 70px; }
.detail-image img { width: 100%; height: 100%; object-fit: cover; }
.detail-brand { margin-top: 18px; color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.detail-title { font-size: 27px; line-height: 1.05; letter-spacing: -.04em; margin: 5px 0 9px; }
.detail-description { color: var(--muted); line-height: 1.5; font-size: 14px; }
.option-group { margin-top: 20px; }
.option-group h4 { margin: 0 0 10px; }
.option-list { display: flex; flex-wrap: wrap; gap: 8px; }
.option-btn { min-width: 45px; min-height: 40px; padding: 0 13px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; font-weight: 800; cursor: pointer; }
.option-btn.selected { border-color: var(--blue); color: var(--blue); background: #edf4ff; box-shadow: 0 0 0 2px rgba(20,110,245,.08); }
.detail-footer { position: sticky; bottom: calc(-22px - var(--safe-bottom)); margin: 22px -18px calc(-22px - var(--safe-bottom)); padding: 14px 18px calc(14px + var(--safe-bottom)); background: rgba(255,255,255,.94); backdrop-filter: blur(18px); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.detail-price { min-width: 100px; }
.detail-price strong { display: block; font-size: 22px; }
.detail-price small { color: var(--muted); }
.detail-footer .btn { flex: 1; }

.cart-list { display: grid; gap: 10px; }
.cart-item { display: grid; grid-template-columns: 82px 1fr; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 10px; }
.cart-thumb { border-radius: 15px; background: linear-gradient(145deg,#e0f6ff,#e1e9ff); display: grid; place-items: center; font-size: 35px; overflow: hidden; min-height: 93px; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-title { font-weight: 850; line-height: 1.2; }
.cart-meta { color: var(--muted); font-size: 12px; margin-top: 5px; }
.cart-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qty button { width: 34px; height: 32px; border: 0; background: #f4f6fa; cursor: pointer; }
.qty span { min-width: 30px; text-align: center; font-weight: 800; }
.remove-btn { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 12px; }
.summary-card { margin-top: 14px; background: var(--ink); color: white; border-radius: 22px; padding: 18px; }
.summary-line { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; color: rgba(255,255,255,.72); }
.summary-total { display: flex; justify-content: space-between; align-items: baseline; margin: 15px 0 17px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.15); }
.summary-total strong { font-size: 25px; }

.form-grid { display: grid; gap: 13px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 12px; font-weight: 800; color: #43506a; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); background: #f8fafe; border-radius: 14px; padding: 13px 14px; outline: none; color: var(--ink); }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,110,245,.09); background: white; }
.field-hint { color: var(--muted); font-size: 11px; line-height: 1.4; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--blue); }

.admin-toolbar { display: flex; gap: 9px; margin: 14px 0; }
.admin-toolbar .btn { flex: 1; }
.admin-list { display: grid; gap: 10px; }
.admin-product { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; }
.admin-thumb { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(145deg,#e0f6ff,#e1e9ff); font-size: 28px; overflow: hidden; }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-product strong { display: block; line-height: 1.15; }
.admin-product small { display: block; color: var(--muted); margin-top: 4px; }
.admin-edit { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--blue); cursor: pointer; }
.size-builder { border: 1px solid var(--line); border-radius: 16px; padding: 12px; background: #f8fafe; }
.size-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.size-tag { border-radius: 999px; background: #e7effd; color: #244878; padding: 7px 9px 7px 11px; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.size-tag button { border: 0; background: rgba(0,0,0,.08); border-radius: 50%; width: 18px; height: 18px; cursor: pointer; line-height: 1; }
.inline-add { display: flex; gap: 8px; }
.inline-add input { flex: 1; }
.inline-add button { min-width: 88px; }
.notice { border-radius: 15px; padding: 12px 13px; background: #eef8ff; color: #26577e; font-size: 12px; line-height: 1.45; border: 1px solid #d6edff; }

.toast-root { position: fixed; z-index: 150; left: 50%; bottom: calc(88px + var(--safe-bottom)); transform: translateX(-50%); width: min(90%, 460px); display: grid; gap: 8px; pointer-events: none; }
.toast { background: #0a1730; color: white; padding: 13px 15px; border-radius: 14px; box-shadow: var(--shadow); animation: toastIn .2s ease-out; font-size: 13px; text-align: center; }
.toast.error { background: #b7283a; }
.loading { min-height: 45dvh; display: grid; place-items: center; color: var(--muted); }
.loader { width: 42px; height: 42px; border: 4px solid #dfe7f3; border-top-color: var(--blue); border-radius: 50%; animation: spin .75s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sheetUp { from { transform: translateY(30px); opacity: .5; } }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }

@media (min-width: 620px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { padding: 30px; }
  .main-content { padding-left: 22px; padding-right: 22px; }
}

@media (max-width: 360px) {
  .product-grid { gap: 8px; }
  .product-info { padding: 10px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .form-row { grid-template-columns: 1fr; }
}
