/* Customer catalog app */
body { overscroll-behavior-y: none; }
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff; padding-top: var(--safe-top); }
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; min-width: 0; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; background: var(--brass); color: var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 15px; flex-shrink: 0; }
.brand-text { min-width: 0; }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: #C9CCD3; }
.topnav { display: none; gap: 4px; margin-left: auto; }
.topnav a { color: #C9CCD3; text-decoration: none; padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; position: relative; }
.topnav a.active, .topnav a:hover { color: #fff; background: var(--ink-2); }
.topnav .count, .bottom-nav .count { position: absolute; top: 2px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--brass); color: var(--ink); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.searchbar { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 0 14px; height: 46px; color: var(--muted); }
.searchbar input { border: 0; outline: 0; flex: 1; font-size: 15px; background: transparent; min-width: 0; }
.topbar .searchbar { margin: 0 0 14px; }
.top-search-desktop { display: none; flex: 1; max-width: 460px; margin: 0 0 0 24px !important; }

/* Sub header (category / product pages) */
.subbar { position: sticky; top: calc(64px + var(--safe-top)); z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.subbar-inner { display: flex; align-items: center; gap: 8px; min-height: 60px; }
.subbar h1 { font-size: 19px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subbar .meta { font-size: 12px; color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

main { flex: 1; padding-bottom: calc(96px + var(--safe-bottom)); }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { font-size: 19px; }
.section-head a { font-size: 14px; font-weight: 500; text-decoration: none; }

/* Hero */
.hero { margin-top: 16px; position: relative; border-radius: 20px; overflow: hidden; background: var(--ink); color: #fff; min-height: 190px; }
.hero-slide { position: absolute; inset: 0; display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; padding: 22px; gap: 10px; opacity: 0; transform: translateX(30px); transition: opacity .6s ease, transform .6s ease; text-decoration: none; color: inherit; }
.hero-slide.on { opacity: 1; transform: none; position: relative; }
.hero .kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--brass); text-transform: uppercase; }
.hero h2 { font-size: 24px; line-height: 1.15; margin: 6px 0; }
.hero p { margin: 0 0 14px; color: #C9CCD3; font-size: 14px; }
.hero-img { justify-self: center; width: 100%; max-width: 230px; aspect-ratio: 1; border-radius: 16px; overflow: hidden; animation: float 5s ease-in-out infinite; }
.hero-dots { position: absolute; left: 22px; bottom: 12px; display: flex; gap: 6px; }
.hero-dots button { width: 8px; height: 8px; border-radius: 4px; border: 0; background: #4A4E57; padding: 0; transition: width .3s, background .3s; }
.hero-dots button.on { width: 22px; background: var(--brass); }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1deg) } 50% { transform: translateY(-8px) rotate(1deg) } }

/* Category grid */
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cat-card { display: flex; align-items: center; gap: 12px; padding: 12px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); animation: rise .45s ease both; transition: transform .2s ease, box-shadow .2s; }
.cat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(22,24,29,.1); }
.cat-card img { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.cat-card .t { font-weight: 600; font-size: 15px; line-height: 1.25; }
.cat-card .s { font-size: 12px; color: var(--muted); }

/* Product grid */
.p-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 16px; }
.p-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: flex; flex-direction: column; animation: rise .45s ease both; transition: transform .2s ease, box-shadow .2s; position: relative; }
.p-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(22,24,29,.12); }
.p-card .img { aspect-ratio: 1; background: #EFECE7; overflow: hidden; }
.p-card .img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.p-card:hover .img img { transform: scale(1.06); }
.p-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.p-card .name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.p-card .sub { font-size: 12px; color: var(--muted); }
.p-card .price { font-weight: 700; color: var(--brass-ink); font-size: 14px; margin-top: 4px; }
.p-card .dots { display: flex; gap: 4px; margin-top: 6px; }
.p-card .dots span { width: 12px; height: 12px; border-radius: 6px; border: 1px solid rgba(0,0,0,.2); }
.p-card .tag3d { position: absolute; top: 8px; left: 8px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 7px; }
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: 44%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; }

/* Product page */
.pd { display: grid; grid-template-columns: 1fr; gap: 0; }
.viewer { position: relative; background: radial-gradient(circle at 50% 40%, #fff, #E6E1D8 75%); aspect-ratio: 1; max-height: 64vh; width: 100%; overflow: hidden; touch-action: pan-y; perspective: 900px; user-select: none; }
.viewer .stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; transform-style: preserve-3d; cursor: grab; }
.viewer .stage img { width: 86%; height: 86%; object-fit: contain; transform-style: preserve-3d; transition: transform .25s ease-out; will-change: transform; filter: drop-shadow(0 18px 18px rgba(0,0,0,.12)); }
.viewer.idle .stage img { animation: sway 6s ease-in-out infinite; }
.viewer model-viewer { width: 100%; height: 100%; --poster-color: transparent; }
@keyframes sway { 0%,100% { transform: rotateY(-18deg) rotateX(4deg) } 50% { transform: rotateY(18deg) rotateX(-2deg) } }
.viewer .v-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; z-index: 3; pointer-events: none; }
.viewer .v-top > * { pointer-events: auto; }
.round { width: 44px; height: 44px; border-radius: 22px; border: 0; background: #fff; box-shadow: var(--shadow); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); }
.round.on { color: #C23B4A; }
.round.on .icon { fill: #C23B4A; }
.viewer .v-bottom { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-between; align-items: center; z-index: 3; gap: 8px; }
.hint { font-size: 12px; color: #4A463F; background: rgba(255,255,255,.8); padding: 6px 10px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; }
.hint .icon { width: 16px; height: 16px; }
.pd-info { padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 16px; }
.pd-info h1 { font-size: 24px; }
.pd-info .cat { font-size: 13px; color: var(--muted); }
.price-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price-line .p { font-size: 20px; font-weight: 700; color: var(--brass-ink); }
.stock { font-size: 13px; font-weight: 600; color: var(--ok); }
.stock.out { color: var(--danger); }
.opt-label { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.opt-label span { font-weight: 400; color: var(--muted); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 46px; height: 46px; border-radius: 23px; border: 2px solid var(--line); background: #fff; padding: 0; display: flex; align-items: center; justify-content: center; transition: border-color .15s, transform .15s; }
.swatch span { width: 32px; height: 32px; border-radius: 16px; border: 1px solid rgba(0,0,0,.2); }
.swatch.active { border-color: var(--ink); transform: scale(1.06); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { min-width: 56px; height: 42px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; }
.pill.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.qty { display: inline-flex; align-items: center; background: var(--field); border-radius: 12px; }
.qty button { width: 42px; height: 42px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.qty input { width: 54px; text-align: center; border: 0; background: transparent; font-weight: 600; font-size: 16px; outline: 0; }
.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.spec { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.spec .k { font-size: 12px; color: var(--muted); }
.spec .v { font-weight: 600; font-size: 14px; }
.desc { color: #3A3D45; margin: 0; }
.actionbar { position: sticky; bottom: calc(72px + var(--safe-bottom)); z-index: 15; background: #fff; border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 10px; }
.actionbar .btn { flex: 1; height: 50px; font-size: 15px; }

/* Lists (saved data) */
.tabs { display: inline-flex; gap: 4px; background: #E9E5DE; border-radius: 12px; padding: 4px; }
.tabs button { border: 0; background: transparent; height: 36px; padding: 0 16px; border-radius: 9px; font-weight: 500; font-size: 14px; color: var(--muted); }
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.list-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; margin-top: 14px; }
.list-scroll { max-height: calc(100dvh - 300px); overflow: auto; }
.list-head { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; padding: 10px 14px; background: #EFECE6; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.list-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid #F0EDE7; text-decoration: none; color: var(--ink); }
.list-row .sr { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.list-row .t { font-weight: 600; font-size: 14px; }
.list-row .s { font-size: 12px; color: var(--muted); }
.list-row img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; }
.qline { display: grid; grid-template-columns: 30px 64px 1fr; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid #F0EDE7; }
.qline img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; }
.qline .ctrl { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* Welcome / registration */
.welcome { min-height: 100dvh; display: grid; grid-template-columns: 1fr; background: var(--ink); }
.welcome-art { position: relative; overflow: hidden; min-height: 34dvh; display: flex; align-items: flex-end; padding: calc(28px + var(--safe-top)) 24px 28px; color: #fff; }
.welcome-art .imgs { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px; opacity: .35; }
.welcome-art .imgs img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; animation: float 6s ease-in-out infinite; }
.welcome-art .imgs img:nth-child(2n) { animation-delay: -2s; }
.welcome-art .copy { position: relative; }
.welcome-art h1 { font-size: 30px; line-height: 1.1; margin-top: 14px; }
.welcome-art p { color: #C9CCD3; margin: 8px 0 0; }
.welcome-form { background: var(--bg); border-radius: 24px 24px 0 0; padding: 24px 20px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 14px; animation: slideup .45s ease; }
.welcome-form h2 { font-size: 20px; }
.welcome-form .note { font-size: 12px; color: var(--muted); }

/* Bottom nav (mobile) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(8px + var(--safe-bottom)); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; color: var(--muted); text-decoration: none; position: relative; font-weight: 500; }
.bottom-nav a.active { color: var(--brass-ink); font-weight: 700; }
.bottom-nav a .icon { width: 22px; height: 22px; }
.bottom-nav .count { right: calc(50% - 22px); top: 0; }

/* Responsive */
@media (min-width: 600px) {
  .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .p-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .hscroll { grid-auto-columns: 30%; }
  .hero h2 { font-size: 30px; }
  .hero { min-height: 240px; }
}
@media (min-width: 960px) {
  .topnav { display: flex; }
  .top-search-desktop { display: flex; }
  .topbar .searchbar.mobile-only { display: none; }
  .bottom-nav { display: none; }
  main { padding-bottom: 40px; }
  .actionbar { bottom: 0; }
  .subbar { top: 64px; }
  .p-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
  .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .cat-card img { width: 76px; height: 76px; }
  .hscroll { grid-auto-columns: 22%; }
  .pd { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; padding-top: 24px; align-items: start; }
  .viewer { border-radius: 20px; max-height: none; position: sticky; top: 150px; }
  .pd-info { padding: 0; }
  .actionbar { position: static; padding: 0; border: 0; background: transparent; }
  .welcome { grid-template-columns: 1.1fr 1fr; }
  .welcome-art { min-height: 100dvh; align-items: center; padding: 48px; }
  .welcome-art h1 { font-size: 44px; }
  .welcome-form { border-radius: 0; justify-content: center; padding: 48px; }
  .welcome-form > * { width: 100%; max-width: 420px; margin: 0 auto; }
  .list-scroll { max-height: calc(100dvh - 260px); }
  .toast-host { bottom: 32px; }
}
@media (min-width: 1200px) { .p-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
