@font-face {
  font-family: "IRANYekanX";
  src: url("/assets/fonts/IRANYekanXVF.woff") format("woff");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Bonyade";
  src: url("/assets/fonts/BonyadeKoodak-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #000;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.17);
  --text: #ededef;
  --muted: #a0a0ab;
  --dim: #6c6c76;
  --green: #3dd68c;
  --green-bg: rgba(61, 214, 140, 0.12);
  --red: #ff6369;
  --red-bg: rgba(255, 99, 105, 0.12);
  --amber: #ffc53d;
  --amber-bg: rgba(255, 197, 61, 0.12);
  --blue: #70b8ff;
  --blue-bg: rgba(112, 184, 255, 0.12);
  --radius: 14px;
  --nav-h: 64px;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --body: "IRANYekanX", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --display: "Bonyade", "IRANYekanX", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); }
body {
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.7;
  font-feature-settings: "ss02";
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { display: block; flex: none; }
h1, h2, h3, p { margin: 0; }

#app { min-height: 100dvh; position: relative; isolation: isolate; }
/* Soft light falling from the top edge, the only decoration on an otherwise black canvas. */
#app::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 260px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 100% at 50% 0%, rgba(255, 255, 255, 0.09), transparent 70%),
    radial-gradient(40% 80% at 85% 0%, rgba(112, 184, 255, 0.07), transparent 70%);
}

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
.wrap.no-nav { padding-bottom: calc(var(--safe-b) + 28px); }

/* ---------- headings ---------- */
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.title { font-family: var(--display); font-size: 26px; line-height: 1.35; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 24px 2px 10px; font-size: 12px; color: var(--dim); font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 650;
  white-space: nowrap; transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn.primary { background: #fff; color: #000; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 6px 20px -8px rgba(255, 255, 255, 0.5); }
.btn.ghost { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: var(--red-bg); border: 1px solid rgba(255, 99, 105, 0.25); color: var(--red); }
.btn.lg { height: 46px; width: 100%; border-radius: 12px; font-size: 15px; }
.btn.sm { height: 32px; padding: 0 12px; }
.btn.icon { width: 36px; padding: 0; }
.btn .spin { width: 14px; height: 14px; }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.red { color: var(--red); background: var(--red-bg); }
.badge.amber { color: var(--amber); background: var(--amber-bg); }
.badge.blue { color: var(--blue); background: var(--blue-bg); }
.badge.gray { color: var(--muted); background: var(--surface-2); }

/* ---------- cards & lists ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)); overflow: hidden; }
.card + .card { margin-top: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.card-head .name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; width: 100%; text-align: start; }
.row + .row { border-top: 1px solid var(--line); }
button.row { transition: background 0.15s ease; }
button.row:active { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .main { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .meta { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.row .meta span { display: inline-flex; align-items: center; gap: 4px; }
.row .chev { color: var(--dim); }
.row.dimmed .main, .row.dimmed .dots { opacity: 0.55; }
.chip { font-size: 11px; font-weight: 650; color: var(--blue); background: var(--blue-bg); padding: 1px 7px; border-radius: 999px; }

.dots { display: inline-flex; gap: 5px; align-items: center; }
.dot { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--dim); }
.dot i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--dim); }
.dot.on { color: var(--text); }
.dot.on i { background: var(--green); border-color: var(--green); box-shadow: 0 0 8px rgba(61, 214, 140, 0.6); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); min-width: 0; }
.stat .k { color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-family: var(--display); font-size: 19px; line-height: 1.5; white-space: nowrap; }
.stat .v small { font-family: var(--body); font-size: 11px; color: var(--muted); font-weight: 500; margin-inline-start: 3px; }

/* ---------- segmented control ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 14px; }
.seg button { height: 34px; border-radius: 9px; font-size: 13px; font-weight: 650; color: var(--muted); transition: background 0.18s ease, color 0.18s ease; }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---------- notes ---------- */
.note { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--muted); font-size: 12.5px; background: var(--surface); margin-bottom: 14px; }
.note svg { margin-top: 3px; color: var(--blue); }
.note.warn svg { color: var(--amber); }

/* ---------- food rows (day page) ---------- */
.food { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.food + .food { border-top: 1px solid var(--line); }
.food .grow { flex: 1; min-width: 0; }
.food .fname { font-weight: 650; font-size: 14px; }
.food.sel .fname { color: #fff; }
.food .fsub { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 3px 10px; }
.food .fsub span { display: inline-flex; align-items: center; gap: 4px; }
.food .price { font-family: var(--display); font-size: 15px; }
.food .mark { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); color: transparent; }
.food.sel .mark { background: var(--green); border-color: var(--green); color: #000; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.pager .btn { height: 42px; }

/* ---------- forms / stepper ---------- */
.steps { position: relative; margin-top: 22px; }
.step { position: relative; padding-inline-start: 44px; padding-bottom: 22px; }
.step::before { content: ""; position: absolute; inset-inline-start: 13px; top: 30px; bottom: 0; width: 1px; background: var(--line); }
.step:last-child::before { display: none; }
.step .num { position: absolute; inset-inline-start: 0; top: 0; width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 1px solid var(--line-strong); color: var(--muted); background: #000; }
.step.active .num { background: #fff; color: #000; border-color: #fff; box-shadow: 0 0 18px rgba(255, 255, 255, 0.35); }
.step.done .num { background: var(--green-bg); color: var(--green); border-color: rgba(61, 214, 140, 0.35); }
.step .st { font-weight: 700; font-size: 15px; line-height: 27px; }
.step:not(.active) .st { color: var(--muted); }
.step .sd { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.step .body { margin-top: 12px; display: grid; gap: 10px; }

.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.input { width: 100%; height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.03); padding: 0 12px; font-size: 15px; outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.input:focus { border-color: rgba(255, 255, 255, 0.45); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08); }
.input.ltr { direction: ltr; text-align: left; letter-spacing: 0.04em; }
.captcha { display: flex; gap: 8px; align-items: center; }
.captcha img { height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; flex: none; }
.err { color: var(--red); font-size: 12.5px; }
.hint { color: var(--dim); font-size: 12px; display: flex; gap: 6px; align-items: center; }

/* ---------- brand / hero ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; border: 1px solid var(--line-strong); background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03)); }
.center { min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 24px; }
.center .logo { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; }

/* ---------- profile ---------- */
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 20px; border: 1px solid var(--line-strong); background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03)); }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; font-size: 13px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv .k { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.kv .v { font-weight: 650; text-align: end; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; direction: ltr; unicode-bidi: embed; font-size: 12.5px; }
.balance { padding: 16px 14px; }
.balance .k { color: var(--muted); font-size: 12px; }
.balance .v { font-family: var(--display); font-size: 32px; line-height: 1.4; }
.balance .v small { font-family: var(--body); font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .ico { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 10px; color: var(--dim); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }

/* ---------- skeleton ---------- */
.sk { border-radius: 10px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.09) 37%, rgba(255, 255, 255, 0.04) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- bottom nav ---------- */
.nav { position: fixed; inset: auto 0 0 0; z-index: 20; padding-bottom: var(--safe-b); background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%); border-top: 1px solid var(--line); }
.nav .in { max-width: 560px; margin: 0 auto; height: var(--nav-h); display: grid; grid-template-columns: repeat(3, 1fr); }
.nav button { display: grid; place-items: center; align-content: center; gap: 3px; color: var(--dim); font-size: 11px; font-weight: 600; transition: color 0.15s ease; }
.nav button.on { color: #fff; }
.nav button.on svg { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.45)); }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); display: flex; align-items: flex-end; animation: fade 0.18s ease; }
.sheet { width: 100%; max-width: 560px; margin: 0 auto; background: #0b0b0c; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 18px 18px 0 0; padding: 10px 16px calc(var(--safe-b) + 18px); animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); max-height: 82dvh; overflow: auto; }
.sheet .grab { width: 36px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 14px; }
.sheet h3 { font-family: var(--display); font-size: 20px; }
.sheet .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- toasts ---------- */
/* Above the tab bar, so a toast never covers the page title or its status badge. */
#toasts { position: fixed; inset: auto 12px calc(var(--nav-h) + var(--safe-b) + 12px) 12px; z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; max-width: 520px; padding: 10px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; background: rgba(20, 20, 22, 0.94); border: 1px solid var(--line-strong); box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.9); animation: drop 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.toast.ok svg { color: var(--green); }
.toast.bad svg { color: var(--red); }
.toast.out { opacity: 0; transform: translateY(8px); transition: all 0.25s ease; }
@keyframes drop { from { transform: translateY(14px); opacity: 0; } }

.view { animation: enter 0.22s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.foot { text-align: center; color: var(--dim); font-size: 11.5px; margin-top: 22px; }

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