/* ==========================================================================
   Resha — storefront
   Gallery aesthetic: warm paper, ink, rose‑gold. Signature element: the arch.
   ========================================================================== */

:root {
  --paper: #F7F2EC;
  --paper-2: #EFE6DC;
  --paper-3: #E6DACD;
  --card: #FFFCF8;
  --ink: #1E1916;
  --ink-2: #4E443E;
  --muted: #8F837A;
  --line: rgba(30, 25, 22, .1);
  --rose: #B8735F;
  --rose-deep: #8E4F3E;
  --rose-soft: #EBCFC2;
  --gold: linear-gradient(120deg, #8E4F3E 0%, #C98B74 32%, #F0CDBB 50%, #B8735F 70%, #8E4F3E 100%);
  --ok: #4F7A5B;
  --danger: #A8473A;

  --f-display: "Amiri", "Times New Roman", serif;
  --f-body: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-latin: "Cormorant Garamond", Georgia, serif;

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 26px;
  --arch: 999px 999px var(--r) var(--r);
  --shadow: 0 1px 2px rgba(30,25,22,.05), 0 12px 32px -12px rgba(78,52,40,.22);
  --shadow-lg: 0 30px 80px -20px rgba(60,35,25,.35);
  --ease: cubic-bezier(.2,.8,.2,1);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { overflow-x: clip; }
body {
  font-family: var(--f-body);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* paper grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0 0.2 0 0 0 .06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }
.num, .price { font-family: var(--f-latin); font-feature-settings: "lnum"; letter-spacing: .01em; }

/* ---------- Logo (mask so we can paint it any colour) ---------- */
.logo-mark {
  width: 104px; aspect-ratio: 541 / 178;
  background: var(--gold); background-size: 200% 100%;
  -webkit-mask: url(/icons/logo-mask.png) center / contain no-repeat;
          mask: url(/icons/logo-mask.png) center / contain no-repeat;
  animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%,100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }

/* ---------- Splash ---------- */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--paper); transition: opacity .6s var(--ease), visibility .6s; }
.splash.out { opacity: 0; visibility: hidden; }
.splash-logo { width: 190px; animation: sheen 2.4s ease-in-out infinite, rise 1s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 26px; border-radius: 999px; font-weight: 500; font-size: 15px;
  transition: transform .2s var(--ease), box-shadow .2s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--ink); color: var(--paper); box-shadow: 0 10px 24px -10px rgba(30,25,22,.6); }
.btn-primary:hover { background: #2C2420; }
.btn-gold { background: var(--gold); background-size: 200% 100%; color: #fff; text-shadow: 0 1px 1px rgba(80,40,30,.3); box-shadow: 0 12px 28px -12px rgba(142,79,62,.8); }
.btn-gold:hover { background-position: 100% 0; }
.btn-ghost { border: 1px solid var(--line); background: var(--card); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { height: 40px; padding: 0 18px; font-size: 14px; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; transition: background .2s; position: relative; }
.icon-btn:hover { background: rgba(30,25,22,.05); }
.glass { background: rgba(255,252,248,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field input, .field textarea, .field select {
  height: 52px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); outline: none; transition: border-color .2s, box-shadow .2s; width: 100%;
}
.field textarea { height: auto; padding: 14px 18px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(184,115,95,.14); }
.field.compact input { height: 46px; }
.hint { margin: -4px 0 0; color: var(--muted); font-size: 12.5px; }
.form-error { color: var(--danger); font-size: 13.5px; margin: 0; min-height: 1em; text-align: center; }

/* ---------- Auth ---------- */
.auth { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: 1fr; background: var(--paper); overflow: auto; }
.auth-art { position: relative; height: 38vh; min-height: 220px; overflow: hidden; }
.auth-art img { width: 100%; height: 100%; object-fit: cover; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, var(--paper)); }
.auth-card { position: relative; margin-top: -60px; padding: 0 24px calc(32px + var(--safe-b)); max-width: 460px; width: 100%; justify-self: center; text-align: center; animation: rise .8s var(--ease) both; }
.auth-logo { width: 210px; margin: 0 auto 6px; }
.auth-kicker { font-family: var(--f-display); font-size: 20px; color: var(--ink-2); margin: 0 0 26px; }
.auth .form { text-align: right; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--paper-2); border-radius: 999px; padding: 4px; margin-bottom: 22px; }
.seg-btn { height: 42px; border-radius: 999px; font-weight: 500; color: var(--ink-2); transition: all .25s var(--ease); }
.seg-btn.active { background: var(--card); color: var(--ink); box-shadow: 0 2px 10px rgba(0,0,0,.07); }
@media (min-width: 900px) {
  .auth { grid-template-columns: 1.1fr 1fr; align-items: center; }
  .auth-art { height: 100vh; }
  .auth-art::after { background: linear-gradient(to left, var(--paper), transparent 30%); }
  .auth-card { margin: 0; }
}

/* ---------- App shell ---------- */
.app { position: relative; z-index: 1; min-height: 100vh; padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
.announce { background: var(--ink); color: var(--rose-soft); text-align: center; font-size: 12.5px; padding: 8px 16px; padding-top: calc(8px + var(--safe-t)); letter-spacing: .02em; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 10px 14px; padding-top: max(10px, var(--safe-t));
  background: rgba(247,242,236,.85); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.announce:not([hidden]) + .topbar { padding-top: 10px; }
.topbar.scrolled { border-color: var(--line); }
.brand { justify-self: center; }
.brand .logo-mark { width: 92px; }
.top-actions { justify-self: end; display: flex; gap: 2px; }
.cart-btn b, .tabbar b {
  position: absolute; top: 4px; left: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--rose); color: #fff; font: 600 11px/18px var(--f-body); text-align: center;
}
.topnav { display: none; }
.view { position: relative; outline: none; min-height: 60vh; }
.view > * { animation: fadeUp .5s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,252,248,.9); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line);
}
.tabbar a, .tabbar button { display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11px; color: var(--muted); position: relative; transition: color .2s; }
.tabbar svg { width: 23px; height: 23px; }
.tabbar .active { color: var(--ink); }
.tabbar .active::before { content: ""; position: absolute; top: 0; width: 26px; height: 2px; border-radius: 2px; background: var(--gold); }
.tabbar b { top: 8px; left: calc(50% - 22px); }

@media (min-width: 900px) {
  .app { padding-bottom: 0; }
  .tabbar { display: none; }
  .topbar { grid-template-columns: auto 1fr auto; padding: 14px 40px; gap: 40px; }
  .topbar > [data-nav="search"] { display: none; }
  .brand { justify-self: start; grid-column: 1; grid-row: 1; }
  .brand .logo-mark { width: 110px; }
  .topnav { display: flex; gap: 34px; justify-content: center; }
  .topnav a { font-size: 14.5px; color: var(--ink-2); position: relative; padding: 6px 0; }
  .topnav a.active { color: var(--ink); }
  .topnav a.active::after { content: ""; position: absolute; inset: auto 0 -2px; height: 1.5px; background: var(--gold); }
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 18px; }
@media (min-width: 900px) { .wrap { padding: 0 40px; } }

/* ---------- Typography ---------- */
.eyebrow { font-size: 12px; letter-spacing: .18em; color: var(--rose); font-weight: 500; }
.h-display { font-family: var(--f-display); font-weight: 700; line-height: 1.25; margin: 0; letter-spacing: -.005em; }
.section { padding-top: 46px; padding-bottom: 8px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { font-family: var(--f-display); font-size: clamp(26px, 4vw, 38px); margin: 4px 0 0; font-weight: 700; line-height: 1.2; }
.link-more { font-size: 13.5px; color: var(--ink-2); border-bottom: 1px solid var(--rose); padding-bottom: 2px; white-space: nowrap; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: 26px; padding-bottom: 10px; }
.hero-grid { display: grid; gap: 26px; align-items: center; }
.hero-copy h1 { font-size: clamp(36px, 8.5vw, 72px); }
.hero-copy h1 em { font-style: normal; background: var(--gold); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: sheen 6s ease-in-out infinite; }
.hero-copy p { color: var(--ink-2); font-size: 16px; max-width: 34ch; margin: 14px 0 24px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-visual { position: relative; height: 420px; }
.arch-frame { position: absolute; border-radius: var(--arch); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--paper-2); }
.arch-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.arch-frame:hover img { transform: scale(1.04); }
.hero-visual .a1 { inset: 0 8% 0 30%; }
.hero-visual .a2 { width: 38%; height: 56%; left: 0; bottom: 6%; border: 6px solid var(--paper); }
.hero-badge { position: absolute; top: 18px; left: 4%; z-index: 2; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; text-align: center; font-size: 11.5px; line-height: 1.35; color: var(--ink); }
.hero-badge svg { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 900px) {
  .hero { padding-top: 50px; padding-bottom: 20px; }
  .hero-grid { grid-template-columns: 1fr 1.05fr; gap: 60px; }
  .hero-visual { height: 560px; }
}

.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 30px; }
.trust div { display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 12px; color: var(--ink-2); padding: 14px 6px; border-radius: var(--r); background: rgba(255,252,248,.6); border: 1px solid var(--line); }
.trust svg { color: var(--rose); }

/* ---------- Categories ---------- */
.cats { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 4px 18px 10px; margin: 0 -18px; scroll-snap-type: x mandatory; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: 0 0 auto; scroll-snap-align: start; display: grid; justify-items: center; gap: 8px; width: 92px; font-size: 13px; color: var(--ink-2); }
.cat-ic { width: 76px; height: 92px; border-radius: var(--arch); display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); transition: all .3s var(--ease); }
.cat-ic svg { width: 30px; height: 30px; color: var(--rose-deep); }
.cat:hover .cat-ic, .cat.active .cat-ic { background: var(--ink); border-color: var(--ink); }
.cat:hover .cat-ic svg, .cat.active .cat-ic svg { color: var(--rose-soft); }
.cat.active { color: var(--ink); font-weight: 500; }
@media (min-width: 900px) { .cats { margin: 0; padding: 4px 0 10px; gap: 22px; } }

/* ---------- Product grid & cards ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 14px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 34px 22px; } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card { position: relative; display: grid; gap: 10px; cursor: pointer; }
.card-media { position: relative; aspect-ratio: 4 / 5; border-radius: var(--arch); overflow: hidden; background: var(--paper-2); box-shadow: var(--shadow); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.card:hover .card-media img { transform: scale(1.05); }
.card-tag { position: absolute; bottom: 10px; right: 10px; padding: 3px 10px; border-radius: 99px; font-size: 11px; background: rgba(255,252,248,.92); color: var(--rose-deep); font-weight: 500; }
.card-tag.dark { background: var(--ink); color: var(--paper); }
.card-fav { position: absolute; bottom: 8px; left: 8px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,252,248,.92); color: var(--ink); transition: transform .2s; }
.card-fav svg { width: 18px; height: 18px; }
.card-fav.on { color: var(--rose); }
.card-fav:active { transform: scale(.85); }
.card-body { padding: 0 4px; }
.card-cat { font-size: 11.5px; color: var(--muted); }
.card-name { font-size: 14.5px; font-weight: 500; margin: 1px 0 2px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price-row { display: flex; align-items: baseline; gap: 8px; }
.price { font-size: 19px; font-weight: 600; }
.price small { font-family: var(--f-body); font-size: 11.5px; font-weight: 400; color: var(--ink-2); margin-inline-start: 2px; }
.price-old { font-family: var(--f-latin); color: var(--muted); text-decoration: line-through; font-size: 15px; }
.soldout .card-media::after { content: "نفدت الكمية"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(247,242,236,.65); font-weight: 500; }

/* ---------- Editorial band ---------- */
.band { margin: 56px 0 0; background: var(--ink); color: var(--paper); border-radius: var(--r-lg); overflow: hidden; display: grid; }
.band-copy { padding: 34px 26px; }
.band-copy h3 { font-family: var(--f-display); font-size: clamp(28px, 4vw, 42px); margin: 6px 0 10px; line-height: 1.25; }
.band-copy p { color: #CFC3B8; margin: 0 0 22px; }
.band-art { min-height: 240px; position: relative; }
.band-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 900px) { .band { grid-template-columns: 1fr 1fr; } .band-copy { padding: 60px; align-self: center; } }

/* ---------- Shop toolbar ---------- */
.shop-head { padding: 26px 0 6px; }
.shop-head h1 { font-size: clamp(32px, 6vw, 52px); }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 18px 0 8px; position: sticky; top: 62px; z-index: 10; padding: 8px 0; background: linear-gradient(var(--paper) 70%, transparent); }
.search { flex: 1; position: relative; }
.search input { width: 100%; height: 48px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); padding: 0 46px 0 18px; outline: none; }
.search input:focus { border-color: var(--rose); }
.search svg { position: absolute; right: 16px; top: 13px; color: var(--muted); }
.select { height: 48px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); padding: 0 16px; outline: none; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .h-display { color: var(--ink); font-size: 26px; margin-bottom: 6px; }
.empty .arch-mini { width: 90px; height: 110px; margin: 0 auto 18px; border-radius: var(--arch); border: 1.5px dashed var(--rose); display: grid; place-items: center; color: var(--rose); }

/* ---------- Sheet (bottom sheet on mobile, modal on desktop) ---------- */
.sheet, .drawer { position: fixed; inset: 0; z-index: 60; visibility: hidden; }
.sheet.open, .drawer.open { visibility: visible; }
.sheet-scrim, .drawer-scrim { position: absolute; inset: 0; background: rgba(30,25,22,.42); opacity: 0; transition: opacity .35s; backdrop-filter: blur(2px); }
.open .sheet-scrim, .open .drawer-scrim { opacity: 1; }
.sheet-panel {
  position: absolute; inset: auto 0 0 0; max-height: 94vh; overflow: auto; background: var(--paper);
  border-radius: 28px 28px 0 0; transform: translateY(100%); transition: transform .45s var(--ease);
  padding-bottom: calc(20px + var(--safe-b));
}
.sheet.open .sheet-panel { transform: none; }
.sheet-close { position: absolute; top: 12px; left: 12px; z-index: 3; background: rgba(255,252,248,.9); }
@media (min-width: 900px) {
  .sheet-panel { inset: 50% auto auto 50%; width: min(1000px, 92vw); max-height: 88vh; border-radius: var(--r-lg); transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: all .4s var(--ease); }
  .sheet.open .sheet-panel { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-panel.narrow { width: min(480px, 92vw); }
}

/* product detail */
.pd { display: grid; }
.pd-media { position: relative; padding: 16px 16px 0; }
.pd-main { aspect-ratio: 4/5; border-radius: var(--arch); overflow: hidden; background: var(--paper-2); }
.pd-main img { width: 100%; height: 100%; object-fit: cover; }
.pd-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.pd-thumbs button { width: 56px; height: 68px; border-radius: 30px 30px 8px 8px; overflow: hidden; opacity: .55; flex: none; border: 1.5px solid transparent; }
.pd-thumbs button.on { opacity: 1; border-color: var(--rose); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pd-info { padding: 22px 22px 8px; }
.pd-info h2 { font-family: var(--f-display); font-size: 32px; line-height: 1.3; margin: 4px 0 8px; }
.pd-info .price { font-size: 30px; }
.pd-desc { color: var(--ink-2); margin: 16px 0; white-space: pre-line; }
.specs { display: grid; gap: 0; border-top: 1px solid var(--line); margin: 14px 0 20px; }
.specs div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.specs span { color: var(--muted); }
.stock-note { font-size: 13px; color: var(--rose-deep); display: flex; align-items: center; gap: 6px; }
.stock-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.buy-row { display: flex; gap: 10px; align-items: center; margin-top: 16px; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--paper) 30%); }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; height: 52px; background: var(--card); }
.qty button { width: 44px; height: 100%; display: grid; place-items: center; }
.qty button svg { width: 18px; height: 18px; }
.qty span { min-width: 26px; text-align: center; font-family: var(--f-latin); font-size: 20px; font-weight: 600; }
.buy-row .btn { flex: 1; white-space: nowrap; padding: 0 16px; }
.buy-row .qty button { width: 38px; }
@media (min-width: 900px) {
  .pd { grid-template-columns: 1fr 1fr; }
  .pd-media { padding: 28px; }
  .pd-info { padding: 46px 34px 28px 10px; }
}

/* ---------- Drawer (cart) ---------- */
.drawer-panel {
  position: absolute; inset: 0 auto 0 0; width: min(440px, 100%); background: var(--paper); display: grid; grid-template-rows: auto 1fr auto;
  transform: translateX(-100%); transition: transform .45s var(--ease); box-shadow: var(--shadow-lg);
}
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; padding-top: max(16px, var(--safe-t)); border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-family: var(--f-display); font-size: 26px; margin: 0; }
.drawer-body { overflow: auto; padding: 10px 20px; }
.drawer-foot { padding: 16px 20px calc(18px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--card); }
.line { display: grid; grid-template-columns: 74px 1fr auto; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.line-img { width: 74px; height: 92px; border-radius: 40px 40px 10px 10px; overflow: hidden; background: var(--paper-2); }
.line-img img { width: 100%; height: 100%; object-fit: cover; }
.line-name { font-weight: 500; font-size: 14px; line-height: 1.4; }
.line .qty { height: 36px; margin-top: 8px; width: max-content; }
.line .qty button { width: 32px; }
.line .qty span { font-size: 16px; }
.line-end { display: grid; justify-items: end; gap: 10px; }
.line-end .price { font-size: 17px; }
.line-end .icon-btn { width: 34px; height: 34px; color: var(--muted); }
.line-end .icon-btn svg { width: 18px; height: 18px; }
.totals { display: grid; gap: 6px; font-size: 14px; margin-bottom: 14px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 16px; font-weight: 600; padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 4px; }
.totals .grand .price { font-size: 24px; }
.free-bar { font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; }
.free-bar i { display: block; height: 4px; border-radius: 4px; background: var(--paper-3); margin-top: 6px; overflow: hidden; }
.free-bar i::after { content: ""; display: block; height: 100%; width: var(--p, 0%); background: var(--gold); transition: width .5s var(--ease); }

/* ---------- Checkout map ---------- */
.checkout { position: fixed; inset: 0; z-index: 70; background: var(--paper-2); animation: fadeUp .4s var(--ease); }
.map { position: absolute; inset: 0; }
/* Custom Resha map style: warm paper‑toned tiles */
.map .leaflet-tile-pane { filter: sepia(.32) saturate(.85) hue-rotate(-12deg) brightness(1.02) contrast(.94); }
.map.leaflet-container { background: #EFE6DC; font-family: var(--f-body); }
.leaflet-control-attribution { background: rgba(255,252,248,.75) !important; font-size: 10px !important; border-radius: 8px 0 0 0; }
.leaflet-control-zoom { display: none; }
.map-pin { position: absolute; left: 50%; top: 50%; z-index: 500; width: 46px; height: 62px; transform: translate(-50%, -100%); pointer-events: none; transition: transform .25s var(--ease); }
.map-pin svg { width: 100%; height: 100%; filter: drop-shadow(0 8px 10px rgba(80,40,30,.35)); }
.map-pin .pin-shadow { position: absolute; left: 50%; bottom: -6px; width: 14px; height: 5px; margin-left: -7px; border-radius: 50%; background: rgba(30,25,22,.35); transition: all .25s; }
.map-pin.lift { transform: translate(-50%, calc(-100% - 14px)); }
.map-pin.lift .pin-shadow { bottom: -20px; width: 10px; margin-left: -5px; opacity: .5; }
.map-top { position: absolute; z-index: 600; top: calc(12px + var(--safe-t)); inset-inline: 12px; display: flex; gap: 10px; align-items: center; }
.map-top .icon-btn { width: 46px; height: 46px; }
.map-title { flex: 1; height: 46px; display: grid; place-items: center; border-radius: 999px; font-weight: 500; font-size: 14.5px; }
.co-card {
  position: absolute; z-index: 600; inset: auto 0 0 0; background: var(--paper); border-radius: 26px 26px 0 0;
  padding: 18px 18px calc(16px + var(--safe-b)); box-shadow: 0 -20px 50px -20px rgba(60,35,25,.3); display: grid; gap: 10px;
  max-height: 62vh; overflow: auto;
}
.co-card::before { content: ""; width: 40px; height: 4px; border-radius: 4px; background: var(--paper-3); justify-self: center; margin: -6px 0 4px; }
.co-addr { display: flex; gap: 12px; align-items: flex-start; }
.co-addr-ic { color: var(--rose); margin-top: 18px; }
.co-addr small { color: var(--muted); font-size: 12px; }
.co-addr p { margin: 0; font-weight: 500; font-size: 14.5px; line-height: 1.5; }
.co-sum { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--ink-2); padding: 4px 2px; }
.co-sum .price { font-size: 22px; color: var(--ink); }
@media (min-width: 900px) {
  .co-card { inset: auto auto 24px 24px; width: 420px; border-radius: var(--r-lg); }
  .co-card::before { display: none; }
}

/* ---------- Orders ---------- */
.page-head { padding: 26px 0 16px; }
.page-head h1 { font-size: clamp(30px, 6vw, 46px); }
.orders { display: grid; gap: 14px; padding-bottom: 30px; }
.order { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.order-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.order-id { font-family: var(--f-latin); font-size: 20px; font-weight: 600; letter-spacing: .03em; }
.order-date { font-size: 12.5px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px; font-size: 12.5px; font-weight: 500; background: var(--paper-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending { color: #9A6B1F; background: #F6EBD6; }
.st-confirmed { color: #3E5E8A; background: #E2E9F3; }
.st-preparing { color: #7A4F8C; background: #EEE3F2; }
.st-shipping { color: var(--rose-deep); background: #F5E1D8; }
.st-delivered { color: var(--ok); background: #E1ECE3; }
.st-cancelled { color: var(--danger); background: #F3E0DC; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); margin: 20px 0 8px; position: relative; }
.steps::before { content: ""; position: absolute; top: 11px; inset-inline: 10%; height: 2px; background: var(--paper-3); }
.steps .bar { position: absolute; top: 11px; right: 10%; height: 2px; background: var(--gold); transition: width .8s var(--ease); }
.step { display: grid; justify-items: center; gap: 6px; font-size: 11px; color: var(--muted); text-align: center; position: relative; }
.step i { width: 24px; height: 24px; border-radius: 50%; background: var(--paper-2); border: 2px solid var(--paper-3); display: grid; place-items: center; }
.step i svg { width: 13px; height: 13px; opacity: 0; color: #fff; }
.step.done { color: var(--ink); }
.step.done i { background: var(--rose); border-color: var(--rose); }
.step.done i svg { opacity: 1; }
.step.current i { box-shadow: 0 0 0 5px rgba(184,115,95,.2); }
.order-items { display: flex; gap: 8px; margin-top: 14px; overflow-x: auto; }
.order-items img { width: 52px; height: 64px; border-radius: 26px 26px 8px 8px; object-fit: cover; flex: none; }
.order-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- Account ---------- */
.profile { display: flex; align-items: center; gap: 16px; padding: 22px; background: var(--ink); color: var(--paper); border-radius: var(--r-lg); position: relative; overflow: hidden; }
.profile::after { content: ""; position: absolute; width: 200px; height: 240px; left: -130px; top: -40px; border-radius: var(--arch); border: 1px solid rgba(235,207,194,.25); }
.avatar { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); font-family: var(--f-display); font-size: 28px; color: #fff; flex: none; }
.profile h2 { margin: 0; font-family: var(--f-display); font-size: 26px; }
.profile p { margin: 0; color: #CFC3B8; font-family: var(--f-latin); font-size: 17px; direction: ltr; text-align: right; }
.list { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); width: 100%; text-align: right; }
.list-item:last-child { border-bottom: 0; }
.list-item .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--paper-2); color: var(--rose-deep); flex: none; }
.list-item .t { flex: 1; }
.list-item .t b { display: block; font-weight: 500; font-size: 14.5px; }
.list-item > svg:last-child { transform: scaleX(-1); color: var(--muted); }
.list-item .t small { color: var(--muted); font-size: 12.5px; }
.switch { width: 48px; height: 28px; border-radius: 99px; background: var(--paper-3); position: relative; transition: background .25s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: transform .25s var(--ease); }
.switch.on { background: var(--rose); }
.switch.on::after { transform: translateX(-20px); }
.install-card { margin-top: 16px; padding: 20px; border-radius: var(--r-lg); background: linear-gradient(135deg, #F5E3D8, #FBF3EC); border: 1px solid rgba(184,115,95,.25); display: flex; gap: 14px; align-items: center; }
.install-card img { width: 58px; height: 58px; border-radius: 14px; box-shadow: var(--shadow); }
.install-card .t { flex: 1; }
.install-card b { display: block; font-family: var(--f-display); font-size: 19px; }
.install-card small { color: var(--ink-2); }

/* floating install chip */
.install-fab { position: fixed; z-index: 25; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); inset-inline-start: 14px; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px 0 14px; border-radius: 99px; animation: rise .6s var(--ease); }
.install-fab button.x { width: 26px; height: 26px; display: grid; place-items: center; margin-inline-start: 4px; color: var(--muted); }
.install-fab button.x svg { width: 15px; height: 15px; }
@media (min-width: 900px) { .install-fab { bottom: 24px; } }

/* ---------- Footer ---------- */
.site-footer { text-align: center; padding: 60px 20px 30px; color: var(--muted); font-size: 13px; }
.footer-logo { width: 120px; margin: 0 auto 8px; }
.site-footer p { margin: 4px 0; }
.footer-contact a { color: var(--ink-2); border-bottom: 1px solid var(--rose-soft); }
.tiny { font-size: 11.5px; }

/* ---------- Toast ---------- */
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: 99px; font-size: 14px; box-shadow: var(--shadow-lg); transition: all .35s var(--ease); white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* success */
.success { text-align: center; padding: 40px 26px 10px; }
.success .seal { width: 96px; height: 116px; margin: 0 auto 18px; border-radius: var(--arch); background: var(--gold); display: grid; place-items: center; color: #fff; box-shadow: 0 20px 40px -16px rgba(142,79,62,.7); animation: rise .7s var(--ease); }
.success .seal svg { width: 44px; height: 44px; }
.success h2 { font-family: var(--f-display); font-size: 32px; margin: 0 0 6px; }
.success p { color: var(--ink-2); margin: 0 0 22px; }

/* skeleton */
.sk { background: linear-gradient(90deg, var(--paper-2), var(--paper-3), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--arch); aspect-ratio: 4/5; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
