@font-face {
  font-family: "Vazirmatn";
  src: url("../lib/vazirmatn/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --brand: #b4436c;
  --brand-dark: #8e2f54;
  --brand-soft: #fbeef3;
  --ink: #2b2230;
  --muted: #7a6f7f;
  --bg: #faf7f5;
  --card: #ffffff;
  --line: #ece4e7;
  --bs-body-font-family: "Vazirmatn", Tahoma, sans-serif;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 180, 67, 108;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 180, 67, 108;
  --bs-link-hover-color: var(--brand-dark);
  --bs-border-radius: .75rem;
}

html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { background: var(--bg); min-height: 100vh; overflow-x: hidden; }
body.has-bottom-nav { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
main.container { max-width: 760px; }

/* Buttons and inputs sized for touch */
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; border-radius: .75rem; }
.btn-sm { min-height: 34px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand); }
.form-control, .form-select { min-height: 46px; font-size: 1rem; border-radius: .7rem; border-color: var(--line); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(180, 67, 108, .15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 600; margin-bottom: .35rem; }
.form-text { color: var(--muted); }
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }
.req { color: #d63c5e; }

/* App bar */
.app-bar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 1020; padding-top: env(safe-area-inset-top); }
.app-bar-inner { max-width: 760px; display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.app-bar .brand { color: #fff; font-weight: 800; font-size: 1.15rem; text-decoration: none; }

/* Bottom nav */
.bottom-nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 1030; background: #fff; border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(0,0,0,.04); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: .78rem; color: var(--muted); text-decoration: none; }
.bottom-nav a span { font-size: 1.25rem; line-height: 1; }
.bottom-nav a.active { color: var(--brand); font-weight: 700; }

/* Cards */
.card-soft { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; }
.card-soft + .card-soft { margin-top: .75rem; }
.page-title { font-size: 1.3rem; font-weight: 800; margin: .25rem 0 1rem; }
.muted { color: var(--muted); }
a.card-link-wrap { color: inherit; text-decoration: none; display: block; }
a.card-link-wrap:active .card-soft { background: var(--brand-soft); }

/* Status badges */
.status-badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.st-submitted { background: #e8f0fe; color: #1a56c4; }
.st-pending { background: #fff4d6; color: #8a6100; }
.st-confirmed { background: #e3f6f3; color: #0c7a68; }
.st-done { background: #efe6fb; color: #6a35b8; }
.st-delivered { background: #e6f5e6; color: #217a2b; }

/* Filter chips (horizontally scrollable on small screens) */
.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: .75rem; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: .4rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: .9rem; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip small { opacity: .75; }

/* Order list */
.order-row { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.order-row .title { font-weight: 700; }
.order-meta { font-size: .85rem; color: var(--muted); }

/* Store header */
.store-hero { text-align: center; padding: 2rem 1rem 1.25rem; background: linear-gradient(180deg, var(--brand-soft), transparent); margin: 0 calc(var(--bs-gutter-x) * -.5) 1rem; }
.store-logo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 4px 16px rgba(0,0,0,.08); background: #fff; }
.store-logo.placeholder { display: inline-flex; align-items: center; justify-content: center; font-size: 2.5rem; background: #fff; }
.store-name { font-weight: 800; font-size: 1.35rem; margin: .75rem 0 .15rem; }
.store-handle { color: var(--muted); direction: ltr; display: inline-block; }
.store-mini { display: flex; align-items: center; gap: .75rem; padding: .9rem 0; }
.store-mini img, .store-mini .store-logo { width: 48px; height: 48px; border-width: 2px; font-size: 1.4rem; }

/* Form builder */
.builder-item { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .65rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .8rem; background: #fff; }
.builder-item.off { opacity: .55; background: #fbfafa; }
.builder-item .grow { flex: 1 1 0; min-width: 0; }
.builder-item .ctrls { flex: 1 0 100%; display: flex; align-items: center; gap: .4rem; padding-inline-start: 2.05rem; }
.builder-item .js-inc { width: 1.4rem; height: 1.4rem; flex: none; }
.builder-item .lbl { font-weight: 600; }
.builder-item .type { font-size: .75rem; color: var(--muted); }
.icon-btn { min-height: 36px; min-width: 36px; padding: 0; border-radius: .6rem; }
.builder-extra { margin-top: .5rem; }

/* Invoice */
.invoice { background: #fff; border-radius: 1.1rem; overflow: hidden; border: 1px solid var(--line); font-family: "Vazirmatn", Tahoma, sans-serif; color: var(--ink); }
.invoice-head { background: var(--brand); color: #fff; padding: 1rem 1.1rem; display: flex; align-items: center; gap: .75rem; }
.invoice-head img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: #fff; border: 2px solid #fff; }
.invoice-head .ph { width: 52px; height: 52px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.invoice-head .n { font-weight: 800; font-size: 1.1rem; }
.invoice-meta { display: flex; justify-content: space-between; padding: .8rem 1.1rem; background: var(--brand-soft); font-size: .9rem; gap: .5rem; flex-wrap: wrap; }
.invoice-meta b { font-weight: 800; }
.invoice dl { margin: 0; padding: .4rem 1.1rem 1rem; }
.invoice dl > div { display: flex; gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.invoice dl > div:last-child { border-bottom: 0; }
.invoice dt { flex: 0 0 42%; font-weight: 600; color: var(--muted); font-size: .88rem; }
.invoice dd { flex: 1; margin: 0; white-space: pre-wrap; word-break: break-word; }
.invoice-foot { text-align: center; font-size: .8rem; color: var(--muted); padding: .7rem; border-top: 1px solid var(--line); }

.thanks { text-align: center; padding: 1.5rem 0 1rem; }
.thanks .big { font-size: 3rem; line-height: 1; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 1.25rem .8rem 0; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; right: 0; top: .45rem; width: .6rem; height: .6rem; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ""; position: absolute; right: .26rem; top: 1.2rem; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }

/* Status stepper on receipt */
.stepper { display: flex; justify-content: space-between; position: relative; margin: .5rem 0 0; }
.stepper::before { content: ""; position: absolute; top: 11px; inset-inline: 10%; height: 2px; background: var(--line); }
.stepper .s { position: relative; flex: 1; text-align: center; font-size: .72rem; color: var(--muted); }
.stepper .dot { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--line); margin: 0 auto .3rem; }
.stepper .s.on { color: var(--brand); font-weight: 700; }
.stepper .s.on .dot { background: var(--brand); border-color: var(--brand); }

/* Honeypot: visually hidden without off-screen offsets (those cause sideways scroll in RTL). */
.hp-field { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }
#order-form { position: relative; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 30%); padding: 1rem 0 .5rem; margin-top: 1rem; }
body.has-bottom-nav .sticky-actions { bottom: calc(60px + env(safe-area-inset-bottom)); }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .big { font-size: 2.5rem; }
