/* ===== Kokodezh ordering app (order.html) ===== */
.order-page { background: var(--cream); }
.order-page .ord-wrap {
  width: min(560px, 100%);
  margin-inline: auto;
  padding: 14px 14px 40px;
}
body.has-cartbar .ord-wrap { padding-bottom: 120px; }

/* --- header --- */
.ord-header {
  position: sticky; top: 0; z-index: 70;
  background: linear-gradient(135deg, #FF8A00 0%, var(--orange) 100%); color: #fff;
  box-shadow: 0 4px 18px rgba(242, 92, 0, .30);
}
.ord-header-in {
  width: min(560px, 100%); margin-inline: auto;
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  padding: 8px 10px; min-height: 60px;
}
.ord-brand { display: flex; align-items: center; gap: 6px; color: #fff; flex: 0 1 auto; min-width: 0; }
.ord-brand img { width: 34px; height: auto; flex-shrink: 0; }
.ord-title { font-family: "FarMorvarid", "Vazirmatn", sans-serif; font-size: clamp(1.05rem, 4.9vw, 1.3rem); color: #fff; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 6px rgba(122, 46, 0, .45); }
.ord-header-actions { margin-inline-start: auto; display: flex; gap: 6px; flex-shrink: 0; }
.ord-hbtn {
  min-height: 44px; padding: 6px 9px;
  background: rgba(255,255,255,.14); color: #fff;
  border: 1.5px solid rgba(255,255,255,.4); border-radius: 999px;
  font-family: inherit; font-weight: 700; font-size: .77rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
@media (max-width: 380px) {
  .ord-hbtn { padding: 6px 7px; font-size: .74rem; }
  .ord-brand img { width: 30px; }
}
.ord-hbtn:active { transform: scale(.96); }

/* --- home header: one row, big logo + name, no action buttons --- */
.ord-header-in, .ord-brand img, .ord-title { transition: all .35s ease; }
body.on-home .ord-header-in {
  justify-content: center; gap: 10px;
  padding: 12px 12px; min-height: 0;
}
body.on-home .ord-brand { gap: 10px; }
body.on-home .ord-brand img { width: 52px; }
body.on-home .ord-title { font-size: 1.7rem; }
body.on-home .ord-header-actions { display: none; }

.ord-badge {
  background: var(--yellow); color: var(--purple-deep);
  border-radius: 999px; min-width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; padding: 0 6px;
}

.closed-banner {
  background: #FFF3CD; color: #7A5B00; text-align: center;
  padding: 10px 14px; font-weight: 700; font-size: .93rem;
  border-bottom: 1px solid #F0DFA8;
}

/* --- views --- */
.view { display: none; }
.view.active { display: block; }

/* --- entry gate (one-time identity: phone OTP + name) --- */
.gate-sub { color: var(--muted); font-size: .95rem; line-height: 1.95; margin: 0 0 6px; }
.gate-back {
  display: block; box-sizing: border-box; text-align: center; text-decoration: none;
}

/* --- home: banner --- */
.home-banner {
  border-radius: 18px; overflow: hidden; margin-top: 4px;
  border: 1.5px solid var(--line); box-shadow: var(--shadow);
  animation: bannerIn .5s ease-out backwards;
}
.home-banner img {
  display: block; width: 100%; height: 160px;
  object-fit: cover; object-position: center 72%;
}
@keyframes bannerIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .home-banner { animation: none; } }

/* --- home: choose how to order (two square cards) --- */
.home-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  max-width: 400px; margin: 14px auto 0;
}
.home-card {
  aspect-ratio: 1 / 1; cursor: pointer; text-align: center; overflow: hidden;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 10px 8px; color: var(--ink);
  box-shadow: var(--shadow);
}
.home-card:active { transform: scale(.97); border-color: var(--orange); }
.home-card:first-child { animation: cardInR .45s ease-out backwards; }
.home-card:last-child { animation: cardInL .45s .08s ease-out backwards; }
@keyframes cardInR { from { opacity: 0; transform: translateX(46px); } to { opacity: 1; transform: translateX(0); } }
@keyframes cardInL { from { opacity: 0; transform: translateX(-46px); } to { opacity: 1; transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .home-card { animation: none; } }
.ai-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; border-radius: 18px;
  background: linear-gradient(135deg, #FF8A00, #FF7300);
  color: #fff; font-family: "Vazirmatn", sans-serif; font-weight: 800;
  font-size: 1.55rem; letter-spacing: .5px;
  box-shadow: 0 6px 16px rgba(255, 115, 0, .35);
}
.home-card-icon { font-size: 2.1rem; line-height: 1.15; }
.home-card-title {
  font-family: "FarMorvarid", "Vazirmatn", sans-serif;
  font-size: 1.08rem; line-height: 1.6; color: var(--yellow);
}
.home-card-desc { font-size: .76rem; line-height: 1.65; color: var(--muted); }
.back-home { margin-bottom: 10px; }

/* --- browse: category tiles (categories first) --- */
.cat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat-tile {
  cursor: pointer; text-align: center; overflow: hidden; padding: 0 0 10px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 18px;
  color: var(--ink); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center;
}
.cat-tile:active { transform: scale(.97); border-color: var(--orange); }
.cat-tile-photo { width: 100%; height: 96px; object-fit: cover; display: block; }
.cat-tile-ph {
  background: linear-gradient(135deg, var(--orange), var(--purple-dark));
  display: flex; align-items: center; justify-content: center;
}
.cat-tile-ph img { width: 46px; height: auto; }
.cat-tile-name {
  font-family: "FarMorvarid", "Vazirmatn", sans-serif;
  font-size: 1.1rem; line-height: 1.6; margin-top: 8px; padding: 0 6px;
}
.cat-tile-count { font-size: .78rem; color: var(--muted); margin-top: 1px; }
.back-row { margin-bottom: 12px; }

/* --- home: guarantee strip --- */
.guarantee-strip {
  max-width: 400px; margin: 14px auto 0; text-align: center;
  background: #10234E; border: 1.5px solid var(--orange); border-radius: 16px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.guarantee-title {
  font-family: "FarMorvarid", "Vazirmatn", sans-serif;
  font-size: 1.25rem; line-height: 1.7; color: var(--yellow);
}
.guarantee-text { font-size: .9rem; line-height: 1.9; color: var(--ink); }

/* --- home: shop info strip --- */
.shop-strip {
  max-width: 400px; margin: 14px auto 0;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.shop-strip-row { font-size: .88rem; line-height: 1.95; color: var(--ink); }
.shop-strip-row a { color: var(--yellow); text-decoration: none; font-weight: 700; }
.strip-dot { color: var(--muted); margin: 0 4px; }
.view-title { font-size: 2rem; color: var(--purple); line-height: 1.7; margin: 6px 0 12px; }
.loading-note { text-align: center; color: var(--muted); padding: 34px 0; }
.empty-note { text-align: center; color: var(--muted); padding: 30px 0; line-height: 2; }
.hint { color: var(--muted); font-size: .86rem; margin-top: 6px; }
.error-box {
  background: #4A1420; color: #FFB4AC; border: 1px solid #7A2434;
  border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: .95rem;
}

/* --- guide button --- */
.guide-btn {
  width: 100%; min-height: 64px; cursor: pointer;
  background: linear-gradient(135deg, var(--orange) 0%, #F25C00 100%);
  color: #fff; border: none; border-radius: var(--radius);
  font-family: "FarMorvarid", "Vazirmatn", sans-serif; font-size: 1.5rem; line-height: 1.7;
  padding: 12px 16px; box-shadow: var(--shadow);
}
.guide-btn .guide-sub {
  display: block; font-family: "Vazirmatn", sans-serif;
  font-size: .85rem; color: #E4D8F8; margin-top: 2px;
}
.guide-btn:active { transform: scale(.98); }

/* --- chips --- */
.chips-bar {
  position: sticky; top: 60px; z-index: 60;
  background: rgba(8, 22, 54, .97); backdrop-filter: blur(6px);
  margin: 14px -14px 0; padding: 10px 14px 4px;
  border-bottom: 1px solid var(--line);
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; min-height: 44px; padding: 6px 16px;
  background: var(--card); border: 1.5px solid var(--purple); color: var(--purple);
  border-radius: 999px; font-family: inherit; font-weight: 700; font-size: .92rem; cursor: pointer;
}
.chip.active { background: var(--purple); color: #fff; }
.chips.sub .chip { min-height: 40px; font-size: .86rem; border-color: #BFD2FF; color: #BFD2FF; }
.chips.sub .chip.active { background: var(--purple-dark); color: #fff; }

/* --- menu --- */
.cat-section { padding-top: 26px; }
.cat-title { font-size: 1.8rem; color: var(--purple); line-height: 1.7; }
.cat-note {
  background: #16296B; border-radius: 12px; padding: 10px 14px;
  color: #BFD2FF; font-size: .92rem; margin-top: 8px;
}
.item-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 14px; }
@media (min-width: 480px) { .item-grid { grid-template-columns: 1fr 1fr; } }
.item-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.25);
  display: flex; flex-direction: column; cursor: pointer;
}
.item-card img.item-photo { width: 100%; height: 132px; object-fit: cover; }
.item-ph {
  height: 132px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, var(--purple) 0%, var(--purple-dark) 60%, var(--purple-deep) 100%);
}
.item-ph img { width: 62px; height: auto; opacity: .95; }
.item-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.item-name { font-weight: 700; font-size: .99rem; line-height: 1.7; }
.item-desc {
  color: var(--muted); font-size: .84rem; line-height: 1.7; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.price { color: var(--purple); font-weight: 700; font-size: .98rem; }
.price .old { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; text-decoration: line-through; }
.add-btn {
  min-height: 44px; padding: 6px 20px; cursor: pointer;
  background: var(--yellow); color: var(--purple-deep);
  border: none; border-radius: 999px;
  font-family: inherit; font-weight: 700; font-size: .95rem;
  box-shadow: 0 6px 16px rgba(255, 200, 26, .35);
}
.add-btn:active { transform: scale(.95); }
.stepper { display: inline-flex; align-items: center; gap: 3px; }
.stepper button {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1.5px solid var(--purple); background: var(--card); color: var(--purple);
  font-size: 1.25rem; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.stepper button:active { background: var(--purple); color: #fff; }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper button:disabled:active { background: var(--card); color: var(--purple); }
.stepper.zero .qty { color: var(--muted); }
.stepper .qty { min-width: 28px; text-align: center; font-weight: 700; font-size: 1.05rem; }

/* --- sticky cart bar --- */
.cart-bar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 65;
  background: var(--purple-deep); color: #fff;
  box-shadow: 0 -6px 22px rgba(10, 37, 112, .35);
}
.cart-bar-in {
  width: min(560px, 100%); margin-inline: auto;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
}
.cart-bar-info { display: flex; flex-direction: column; line-height: 1.5; }
.cart-bar-info b { font-size: .92rem; }
.cart-bar-info span { color: var(--yellow); font-weight: 700; }
.cart-bar .btn-main { margin-inline-start: auto; width: auto; }

/* --- generic buttons --- */
.btn-main {
  width: 100%; min-height: 52px; padding: 10px 18px; cursor: pointer;
  background: var(--orange); color: #fff;
  border: none; border-radius: 14px;
  font-family: inherit; font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 8px 20px rgba(255, 115, 0, .3);
}
.btn-main.big { min-height: 56px; font-size: 1.12rem; }
.btn-main.small { min-height: 46px; width: auto; border-radius: 999px; }
.btn-main:disabled { opacity: .5; box-shadow: none; cursor: not-allowed; }
.btn-main:active:not(:disabled) { transform: scale(.98); }
.btn-ghost2 {
  width: 100%; min-height: 48px; margin-top: 10px; padding: 8px 18px; cursor: pointer;
  background: transparent; color: var(--purple);
  border: 1.5px solid var(--purple); border-radius: 14px;
  font-family: inherit; font-weight: 700; font-size: .98rem;
}
.mini-btn {
  min-height: 44px; padding: 6px 16px; cursor: pointer;
  background: var(--card); color: var(--purple);
  border: 1.5px solid var(--purple); border-radius: 999px;
  font-family: inherit; font-weight: 700; font-size: .9rem;
  display: inline-flex; align-items: center; gap: 6px;
}

/* --- cart view --- */
.cart-line {
  display: flex; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; margin-bottom: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.cart-line img, .cart-line .cl-ph { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex: none; }
.cart-line .cl-ph { background: linear-gradient(140deg, var(--purple), var(--purple-deep)); display: flex; align-items: center; justify-content: center; }
.cart-line .cl-ph img { width: 26px; height: auto; }
.cart-line .cl-info { flex: 1; min-width: 0; }
.cart-line .cl-name { font-weight: 700; font-size: .95rem; line-height: 1.6; }
.cart-line .cl-unit { color: var(--muted); font-size: .82rem; }
.cart-line .cl-note { color: var(--yellow, #FFC81A); font-size: .82rem; margin-top: 2px; }
.cart-line .cl-total { font-weight: 700; color: var(--purple); font-size: .92rem; white-space: nowrap; }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; }
.sum-row.total { border-top: 2px dashed var(--line); margin-top: 8px; padding-top: 12px; font-size: 1.08rem; }
.sum-row.total b { color: var(--purple); }

/* --- upsell --- */
.upsell-text { background: #16296B; border-radius: 12px; padding: 12px 14px; color: #BFD2FF; margin-bottom: 6px; }
.upsell-group { font-family: "FarMorvarid", "Vazirmatn", sans-serif; font-size: 1.4rem; color: var(--purple); margin: 16px 0 4px; }
.offer-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px; margin-top: 8px;
}
.offer-row .of-info { flex: 1; }
.offer-row .of-name { font-weight: 700; font-size: .94rem; }
.offer-row .of-price { color: var(--purple); font-weight: 700; font-size: .88rem; }

/* --- checkout form --- */
.fld { display: block; margin: 14px 0; }
.fld > span, .fld-label { display: block; font-weight: 700; color: #BFD2FF; font-size: .92rem; margin-bottom: 6px; }
.fld input, .fld select, .fld textarea, .track-form input, #fArrivalText {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  font-family: inherit; font-size: 1rem; color: var(--ink);
}
.fld textarea { resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus, #fArrivalText:focus {
  border-color: var(--purple); outline: none; box-shadow: 0 0 0 3px rgba(255, 115, 0, .25);
}
.seg { display: flex; gap: 8px; margin: 12px 0; }
.seg-btn {
  flex: 1; min-height: 48px; padding: 8px 6px; cursor: pointer;
  background: var(--card); color: var(--purple);
  border: 1.5px solid var(--purple); border-radius: 12px;
  font-family: inherit; font-weight: 700; font-size: .93rem;
}
.seg-btn.active { background: var(--purple); color: #fff; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.chip-row .chip { min-height: 44px; }
#mapBox { position: relative; border-radius: 14px; overflow: hidden; border: 1.5px solid var(--line); }
#map { height: 260px; width: 100%; background: #132A5E; }
.center-pin {
  position: absolute; top: 50%; left: 50%; z-index: 1000;
  transform: translate(-50%, -88%); font-size: 34px; line-height: 1;
  pointer-events: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35));
}
.map-btns { display: flex; gap: 8px; margin-top: 8px; }
.summary-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px; margin: 16px 0; box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.summary-box .sum-item { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: .94rem; }
.summary-box .sum-item span:last-child { white-space: nowrap; font-weight: 700; }
.summary-box .sum-note { color: var(--yellow, #FFC81A); font-size: .85rem; padding: 0 2px 3px; }
.free-note { color: #4ADE80; font-weight: 700; font-size: .9rem; margin-top: 6px; }
.pay-box { margin: 16px 0; }
.pay-opt {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; min-height: 48px;
}
.pay-opt input { margin-top: 7px; accent-color: var(--purple); width: 18px; height: 18px; }
.pay-opt .pay-name { font-weight: 700; }
.pay-opt small { display: block; color: var(--muted); font-size: .85rem; }
.pay-opt.disabled { opacity: .55; cursor: not-allowed; }

/* --- success --- */
.success-hero { text-align: center; padding: 18px 0 6px; }
.success-hero .big-check { font-size: 3.4rem; line-height: 1.2; }
.success-hero h2 { font-size: 2.2rem; color: var(--purple); line-height: 1.7; }
.order-code { font-size: 2.6rem; font-weight: 700; color: #BFD2FF; letter-spacing: 1px; }
.eta-line { text-align: center; color: #BFD2FF; font-weight: 700; margin-top: 4px; }
.card-panel, .shop-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-top: 16px; box-shadow: var(--shadow);
}
.card-panel h3, .shop-panel h3 { color: var(--purple); font-size: 1.5rem; margin-bottom: 8px; }
.card-panel img { width: 100%; border-radius: 12px; margin-bottom: 10px; }
.card-number {
  display: block; width: 100%; text-align: center; cursor: pointer;
  background: #16296B; border: 1.5px dashed var(--purple); border-radius: 12px;
  padding: 12px; font-family: inherit; font-size: 1.35rem; font-weight: 700; color: var(--purple-deep);
  letter-spacing: 1px;
}
.copy-hint { text-align: center; color: var(--muted); font-size: .84rem; margin-top: 4px; }
.card-holder, .card-amount { text-align: center; margin-top: 8px; }
.card-amount b { color: var(--purple); font-size: 1.15rem; }
.receipt-box { margin-top: 14px; border-top: 2px dashed var(--line); padding-top: 12px; }
.receipt-box .file-btn { position: relative; overflow: hidden; }
.shop-panel p { margin: 4px 0; }
.shop-panel a { font-weight: 700; }

/* --- track --- */
.track-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 16px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.track-result-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-top: 14px; box-shadow: var(--shadow);
}
.track-head { font-weight: 700; color: #BFD2FF; margin-bottom: 10px; }
.stage-row { display: flex; gap: 10px; align-items: center; padding: 5px 0; color: var(--muted); }
.stage-row.done { color: var(--ink); }
.stage-row.cur { color: var(--purple); font-weight: 700; }
.status-line { margin-top: 10px; background: #16296B; border-radius: 10px; padding: 9px 12px; color: #BFD2FF; font-size: .94rem; }
.status-line.bad { background: #4A1420; color: #FFB4AC; }

/* --- overlays: item sheet --- */
.overlay[hidden] { display: none; }
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(20, 8, 40, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 20px; } }
.sheet {
  position: relative; background: var(--cream); width: 100%; max-width: 560px;
  max-height: 92dvh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 18px 16px 22px;
  animation: sheetUp .22s ease-out;
}
@media (min-width: 640px) { .sheet { border-radius: 22px; } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.sheet-close {
  position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.92); border: 1px solid var(--line); color: #0A2570;
  font-size: 1rem; font-weight: 700;
}
.sheet-photo { width: 100%; height: 230px; object-fit: cover; border-radius: 14px; }
.sheet-ph { height: 190px; border-radius: 14px; }
.sheet-name { font-size: 1.9rem; color: var(--purple); line-height: 2.05; padding-top: .15em; margin-top: 6px; }
.sheet-desc { color: var(--muted); margin-top: 4px; }
.sheet-price-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.sheet-price { color: var(--purple); font-weight: 700; font-size: 1.2rem; }
.sheet-price .old { color: var(--muted); font-weight: 400; font-size: .9rem; text-decoration: line-through; margin-inline-end: 8px; }
.sheet .add-btn.big { min-height: 52px; padding: 8px 30px; font-size: 1.05rem; }

/* --- wizard (retired; .wiz-q is still used by the checkout code step) --- */
.wiz-q { font-weight: 700; font-size: 1.12rem; color: #BFD2FF; margin: 8px 0 10px; }

/* --- AI assistant chat --- */
.ai-sub { color: var(--muted); margin-bottom: 8px; }
.ai-thread {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 54dvh; overflow-y: auto; padding: 8px 2px;
}
.ai-msg { display: flex; }
.ai-msg.bot { justify-content: flex-start; }
.ai-msg.me { justify-content: flex-end; }
.ai-bubble {
  max-width: 86%; padding: 10px 14px; border-radius: 16px;
  line-height: 1.9; font-size: .98rem; overflow-wrap: anywhere;
}
.ai-msg.bot .ai-bubble {
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  border-start-start-radius: 4px;
}
.ai-msg.me .ai-bubble {
  background: var(--purple); color: #fff;
  border-start-end-radius: 4px;
}
.ai-sys {
  align-self: center; text-align: center; max-width: 92%;
  background: #16296B; color: #BFD2FF; border-radius: 999px;
  padding: 6px 14px; font-size: .87rem; font-weight: 700; line-height: 1.8;
}
.ai-card {
  max-width: 86%; width: 320px; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; border-start-start-radius: 4px; color: var(--ink);
}
.ai-card-img {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  background: #000;
}
.ai-card-body { padding: 10px 14px 12px; line-height: 1.9; font-size: .95rem; }
.ai-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 2px;
}
.ai-card-name { font-weight: 800; font-size: 1.02rem; }
.ai-card-price { color: var(--purple); font-weight: 800; white-space: nowrap; }
.ai-card-row { overflow-wrap: anywhere; }
.ai-typing { color: var(--muted); font-size: .9rem; padding: 4px 2px; }
.ai-typing .dot {
  display: inline-block; width: 6px; height: 6px; margin-inline-end: 3px;
  border-radius: 50%; background: var(--purple);
  animation: aiBlink 1.1s infinite;
}
.ai-typing .dot:nth-child(2) { animation-delay: .18s; }
.ai-typing .dot:nth-child(3) { animation-delay: .36s; }
@keyframes aiBlink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ai-form { display: flex; gap: 8px; margin-top: 10px; }
.ai-form input {
  flex: 1; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  font-family: inherit; font-size: 1rem; color: var(--ink);
}
.ai-form input:focus {
  border-color: var(--purple); outline: none; box-shadow: 0 0 0 3px rgba(255, 115, 0, .25);
}
.ai-form .btn-main.small { min-height: 48px; padding: 8px 22px; }
.ai-mic {
  flex: 0 0 auto; width: 48px; min-height: 48px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  font-family: inherit; font-size: 1.25rem; line-height: 1; color: var(--ink);
}
.ai-mic[hidden] { display: none; }
.ai-mic:disabled { opacity: .55; cursor: default; }
.ai-mic:active { transform: scale(.95); }
.ai-mic.listening {
  border-color: var(--purple); background: rgba(255, 115, 0, .20); color: #fff;
  animation: aiMicPulse 1.1s ease-in-out infinite;
}
@keyframes aiMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 115, 0, .45); }
  50% { box-shadow: 0 0 0 9px rgba(255, 115, 0, 0); }
}
.ai-listen {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  color: var(--yellow, #FFC81A); font-weight: 700; font-size: .95rem; line-height: 1.8;
}
.ai-listen[hidden] { display: none; }
.ai-listen-dot {
  flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%;
  background: #FF453A; animation: aiBlink 1s infinite;
}
.ai-listen-time { font-variant-numeric: tabular-nums; opacity: .85; }
/* live voice waveform: bars dance with the customer's voice while recording */
.ai-wave {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 3px; height: 28px; min-width: 72px; direction: ltr;
}
.ai-wave i {
  display: block; width: 4px; height: 4px; border-radius: 999px;
  background: linear-gradient(to top, var(--purple), var(--yellow, #FFC81A));
  transition: height .07s linear;
}
/* fallback (SpeechRecognition gives us no stream): gentle CSS pulsing bars */
.ai-wave.idle i { height: 14px; animation: aiWaveIdle 1s ease-in-out infinite; }
.ai-wave.idle i:nth-child(3n) { animation-delay: .18s; }
.ai-wave.idle i:nth-child(3n+1) { animation-delay: .36s; }
.ai-wave.idle i:nth-child(4n) { animation-delay: .54s; }
@keyframes aiWaveIdle {
  0%, 100% { transform: scaleY(.3); }
  50% { transform: scaleY(1); }
}
.ai-form input.listening { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(255, 115, 0, .25); }
.ai-form input:disabled { opacity: .6; }
.ai-form .btn-main.small:disabled { opacity: .55; cursor: default; }
.ai-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ai-chip {
  min-height: 40px; padding: 7px 14px; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--purple); border-radius: 999px;
  font-family: inherit; font-weight: 700; font-size: .92rem; color: #BFD2FF;
}
.ai-chip:active { background: var(--purple); color: #fff; }
.ai-actions-row { display: flex; gap: 8px; margin-top: 16px; }
.ai-actions-row .btn-main { flex: 1; }

/* --- toast --- */
.toast {
  position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%);
  z-index: 120; max-width: 92vw; text-align: center;
  background: var(--purple-deep); color: #fff;
  padding: 11px 20px; border-radius: 999px; font-weight: 700; font-size: .94rem;
  box-shadow: 0 10px 26px rgba(20, 8, 40, .4);
}

/* --- stepped checkout --- */
.ck-steps-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.ck-step-name {
  display: inline-flex; align-items: center; min-height: 34px; padding: 3px 12px;
  background: var(--card); color: var(--muted);
  border: 1.5px solid var(--line); border-radius: 999px;
  font-size: .8rem; font-weight: 700;
}
.ck-step-name.done { color: #BFD2FF; border-color: var(--purple); }
.ck-step-name.active { background: var(--purple); border-color: var(--purple); color: #fff; }
#fCode {
  text-align: center; font-size: 1.45rem; font-weight: 700;
  letter-spacing: 8px; direction: ltr;
}
.fee-line {
  background: #16296B; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-top: 10px; color: #BFD2FF; font-weight: 700; font-size: .95rem;
}
.fee-line .free { color: #4ADE80; }
.zone-notice {
  border-radius: 12px; padding: 10px 14px; margin-top: 10px;
  font-weight: 700; font-size: .95rem; line-height: 1.9;
}
.zone-notice.warn { background: #3D2E05; border: 1.5px solid #8A6D00; color: #FFD97A; }
.zone-notice.blocked { background: #4A1420; border: 1.5px solid #7A2233; color: #FFB4AC; }
.summary-box .zone-notice { margin: 10px 0 4px; }
.summary-box .addr-line { color: var(--muted); font-size: .9rem; padding-top: 6px; line-height: 1.8; }

/* --- dashboard: my account (profile card + purchase history) --- */
.home-dash-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  max-width: 400px; margin: 12px auto 0; padding: 13px 16px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 20px;
  color: var(--ink); cursor: pointer; text-align: start; box-shadow: var(--shadow);
}
.home-dash-btn:active { transform: scale(.98); border-color: var(--orange); }
.home-dash-icon { font-size: 1.7rem; line-height: 1.15; }
.home-dash-texts { display: flex; flex-direction: column; gap: 2px; }
.home-dash-title {
  font-family: "FarMorvarid", "Vazirmatn", sans-serif;
  font-size: 1.05rem; line-height: 1.6; color: var(--yellow);
}
.home-dash-desc { font-size: .76rem; line-height: 1.65; color: var(--muted); }
.dash-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.dash-row {
  display: flex; gap: 10px; align-items: baseline; justify-content: space-between;
  padding: 7px 0; border-bottom: 1px dashed var(--line); line-height: 1.9;
}
.dash-row:last-of-type { border-bottom: none; }
.dash-label { color: var(--muted); font-size: .88rem; flex-shrink: 0; }
.dash-phone { display: inline-flex; align-items: center; gap: 8px; }
.dash-verified {
  font-size: .72rem; font-weight: 700; color: #8FE3B0;
  background: #12351F; border: 1px solid #1F5C36; border-radius: 999px; padding: 1px 8px;
}
.dash-edit .fld { margin-top: 10px; }
.dash-hist-title {
  font-family: "FarMorvarid", "Vazirmatn", sans-serif;
  font-size: 1.15rem; line-height: 1.7; color: var(--yellow); margin: 22px 0 4px;
}
.hist-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-top: 10px; box-shadow: var(--shadow);
}
.hist-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; background: none; border: none; padding: 2px 0; cursor: pointer;
  color: var(--ink); font-family: inherit; text-align: start;
}
.hist-head::after { content: "▾"; color: var(--muted); font-size: .85rem; }
.hist-head.open::after { content: "▴"; }
.hist-code { font-weight: 800; font-size: .98rem; }
.hist-status {
  font-size: .74rem; font-weight: 700; color: #BFD2FF;
  background: #16296B; border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.hist-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--muted); font-size: .84rem; padding-top: 7px; flex-wrap: wrap;
}
.hist-meta b { color: var(--ink); }
.hist-items { border-top: 1px dashed var(--line); margin-top: 9px; padding-top: 7px; }
.hist-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0; font-size: .92rem; line-height: 1.8;
}
.hist-qty { color: var(--muted); }
