/* ── Loghmac design tokens (from the handoff) ───────────────────────────────── */
:root {
  --emerald-50: #ECFDF5;
  --emerald-100: #D1FAE5;
  --primary: #10B981;
  --primary-deep: #047857;
  --primary-ink: #043D2C;
  --bg: #F4F7F5;
  --card: #FFFFFF;
  --ink: #11201B;
  --ink-2: #54635C;
  --ink-3: #8A988F;
  --line: #E7EEEA;
  --line-2: #EEF2F0;
  --protein: #F4506B;
  --carbs: #F5A623;
  --fat: #5B8DEF;
  --water: #38BDF8;
  --burn: #E8590C;
  --error: #BA1A1A;
  --radius-card: 20px;
  --radius-btn: 15px;
  --shadow-card: 0 1px 2px rgba(16,40,32,.05), 0 1px 3px rgba(16,40,32,.04);
  --shadow-lg: 0 12px 40px rgba(17,32,27,.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  font-size: 13.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
.tnum { font-variant-numeric: tabular-nums; }

/* ── App frame: mobile-first, centered on desktop ─────────────────────────── */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}
.screen { padding: 16px 18px calc(84px + env(safe-area-inset-bottom)) 18px; }
.screen--auth { padding: 24px; display: flex; flex-direction: column; min-height: 100dvh; }

/* ── Typography ───────────────────────────────────────────────────────────── */
.h1 { font-size: 27px; font-weight: 800; letter-spacing: -.6px; margin: 0; }
.h2 { font-size: 21px; font-weight: 700; letter-spacing: -.3px; margin: 0; }
.h3 { font-size: 16px; font-weight: 700; margin: 0; }
.caption { font-size: 11.5px; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.center { text-align: center; }

/* ── Card / button / chip ─────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 16px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 52px; border-radius: var(--radius-btn);
  font-size: 16px; font-weight: 700; color: #fff; background: var(--primary);
  box-shadow: 0 8px 20px rgba(16,185,129,.32); transition: transform .12s ease, opacity .12s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { background: var(--line); color: var(--ink-3); box-shadow: none; }
.btn--ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn--water { background: var(--water); box-shadow: none; height: 46px; width: auto; padding: 0 20px; font-size: 13px; }

.field-label { font-size: 11.5px; font-weight: 500; color: var(--ink-2); margin: 0 0 6px; }
.input {
  width: 100%; height: 52px; border-radius: var(--radius-btn); background: var(--card);
  border: 1.5px solid var(--primary); padding: 0 16px; font-size: 17px; font-weight: 700;
  color: var(--ink); outline: none;
}
.input::placeholder { color: var(--ink-3); font-weight: 700; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.brand-mark {
  width: 84px; height: 84px; border-radius: 26px; background: var(--primary);
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-size: 26px; font-weight: 800; box-shadow: 0 8px 24px rgba(16,185,129,.35);
  margin: 0 auto;
}
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.divider span { font-size: 11.5px; color: var(--ink-3); }
.footnote { font-size: 11.5px; color: var(--ink-3); text-align: center; }
.footnote a { color: var(--primary-deep); font-weight: 700; }

/* ── OTP boxes ────────────────────────────────────────────────────────────── */
.otp-row { display: flex; gap: 10px; direction: ltr; justify-content: center; margin: 28px 0 22px; }
.otp-box {
  width: 46px; height: 56px; border-radius: 14px; background: var(--card);
  border: 1.5px solid var(--line); text-align: center; font-size: 22px; font-weight: 800;
  color: var(--ink); outline: none;
}
.otp-box:focus, .otp-box.filled { border-color: var(--primary); }

/* ── Home ─────────────────────────────────────────────────────────────────── */
.home-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 128px; height: 128px; flex-shrink: 0; }
.ring .center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring .big { font-size: 26px; font-weight: 800; }
.stat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.dot { width: 8px; height: 8px; border-radius: 99px; }
.stat-row .label { flex: 1; font-size: 11.5px; color: var(--ink-2); }
.stat-row .val { font-size: 13px; font-weight: 800; }
.macros { display: flex; gap: 14px; margin-top: 4px; }
.macro { flex: 1; }
.macro .top { display: flex; justify-content: space-between; font-size: 10.5px; margin-bottom: 5px; }
.macro .track { height: 7px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.macro .fill { height: 7px; border-radius: 99px; }
.two-up { display: flex; gap: 12px; }
.tile { flex: 1; }
.tile .icon { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; }

/* ── Bottom nav ───────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: var(--card);
  border-top: 1px solid var(--line); display: flex; justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(17,32,27,.06);
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--ink-3); flex: 1; }
.nav-item.active { color: var(--primary); }
.nav-item .ic { font-size: 20px; }

/* ── Activity guide (آموزش فعالیت‌ها) ──────────────────────────────────────── */
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; margin: 0 -2px; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-radius: 99px; background: var(--card);
  border: 1.5px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink-2);
  white-space: nowrap;
}
.cat-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.act-card {
  background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-card);
  padding: 14px; text-align: right; display: flex; flex-direction: column; gap: 4px;
  transition: transform .12s ease;
}
.act-card:active { transform: scale(.98); }
.act-card .emoji {
  width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center;
  justify-content: center; font-size: 22px; margin-bottom: 4px;
}
.act-card .name { font-size: 13.5px; font-weight: 800; }
.act-card .en { font-size: 10px; color: var(--ink-3); direction: ltr; text-align: right; }
.act-card .short { font-size: 11px; color: var(--ink-2); line-height: 1.7; margin-top: 2px; flex: 1; }
.act-badge {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start;
  padding: 3px 9px; border-radius: 99px; font-size: 10px; font-weight: 700;
  background: var(--emerald-50); color: var(--primary-deep); margin-top: 4px;
}
.detail-hero {
  background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-card);
  padding: 20px 16px; text-align: center;
}
.detail-hero .emoji {
  width: 72px; height: 72px; border-radius: 22px; display: flex; align-items: center;
  justify-content: center; font-size: 38px; margin: 0 auto 12px;
}
.intensity-seg { display: flex; gap: 8px; }
.intensity-seg button {
  flex: 1; padding: 10px 4px; border-radius: 12px; font-size: 12px; font-weight: 700;
  background: var(--bg); color: var(--ink-2); transition: background .12s;
}
.intensity-seg button.on { background: var(--primary); color: #fff; }
.detail-sec { }
.detail-sec .sec-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.step-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; }
.step-num {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 8px; background: var(--emerald-50);
  color: var(--primary-deep); font-size: 11.5px; font-weight: 800; display: flex;
  align-items: center; justify-content: center; margin-top: 1px;
}
.bullet-row { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 12.5px; line-height: 1.8; }
.bullet-row .b-ic { flex: 0 0 auto; margin-top: 1px; }
.pill-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 5px 12px; border-radius: 99px; background: var(--line-2); font-size: 11.5px; font-weight: 600; color: var(--ink-2); }

/* ── Recipe cards / detail ─────────────────────────────────────────────────── */
.rec-thumb { width: 100%; height: 84px; border-radius: 13px; background-size: cover; background-position: center; background-color: var(--line-2); margin-bottom: 6px; }
.rec-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; font-size: 10.5px; color: var(--ink-2); }
.rec-meta span { white-space: nowrap; }
.rec-hero-img { width: 100%; height: 160px; border-radius: 16px; background-size: cover; background-position: center; background-color: var(--line-2); margin-bottom: 12px; }

/* ── Voice logging mic ─────────────────────────────────────────────────────── */
.btn.mic-live { background: var(--error) !important; color: #fff !important; box-shadow: 0 8px 20px rgba(186,26,26,.32) !important; border: none !important; }
.mic-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #fff; margin-inline-end: 6px; animation: micpulse 1s ease-in-out infinite; }
@keyframes micpulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }

/* ── Toast + spinner + section spacing ────────────────────────────────────── */
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; }
.toast {
  position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); background: var(--primary-ink); color: #fff;
  padding: 12px 18px; border-radius: 99px; font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-lg); z-index: 50; max-width: 88%;
}
.spinner {
  width: 22px; height: 22px; border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
