/* Helix Nutrition: phone app view.
   Everything here is scoped to body.appm (set by guide-app.js on screens narrower than 768px),
   so the computer layout is never touched. */

/* nothing of the app shows on computers */
body:not(.appm) .app-only { display: none !important; }
.app-off { display: none !important; }

/* ---- bottom bar ---- */
#appBar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr; align-items: end; padding: 6px 6px calc(18px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid rgba(15, 23, 42, .08); box-shadow: 0 -6px 24px rgba(15, 23, 42, .06); }
#appBar button { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; min-height: 52px; padding: 4px 2px; background: none; border: 0; color: #64748b; font: inherit; font-size: 10.5px; font-weight: 800; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#appBar button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#appBar button[aria-current="page"] { color: #0d9488; }
#appBar button[aria-current="page"] svg { stroke-width: 2.4; }
#appBar .ab-av { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #e2e8f0; color: #475569; font-size: 12px; font-weight: 900; line-height: 1; }
#appBar .ab-av svg { width: 16px; height: 16px; }
#appBar button[aria-current="page"] .ab-av { background: #0d9488; color: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0d9488; }
#appBar .ab-plus { justify-content: flex-start; }
#appBar .ab-plus i { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-top: -26px; border-radius: 50%; background: linear-gradient(135deg, #14b8a6, #0d9488); color: #fff; box-shadow: 0 8px 20px rgba(13, 148, 136, .45), 0 0 0 5px #fff; transition: transform .15s; }
#appBar .ab-plus:active i { transform: scale(.92); }
#appBar .ab-plus svg { width: 28px; height: 28px; stroke-width: 2.8; }
#appBar .ab-plus span { margin-top: 0; }

body.appm { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
body.appm .ct-bar { bottom: calc(98px + env(safe-area-inset-bottom)); }
body.appm .lg-toast { bottom: calc(108px + env(safe-area-inset-bottom)); }

/* ---- the website header becomes a slim app header ---- */
body.appm #authSlot, body.appm #mobileMenuBtn, body.appm #mobileMenu, body.appm #mode-selector { display: none !important; }
body.appm #ozempicEmergencyStrip { display: none !important; }
body.appm header .hdr-sub { display: none; }
#appSos { display: inline-flex; align-items: center; gap: 5px; height: 40px; padding: 0 12px; border: 0; border-radius: 14px; background: linear-gradient(135deg, #e11d48, #be123c); color: #fff; font: inherit; font-size: 12px; font-weight: 900; box-shadow: 0 3px 10px rgba(225, 29, 72, .35); -webkit-tap-highlight-color: transparent; }
#appSos[hidden] { display: none !important; }
#appSos:active { transform: scale(.96); }
a.as-opt { text-decoration: none; color: inherit; }
body.appm header > div > div { min-height: 3.4rem; }
/* the footer links live in the Profile page; the branding and the medical notice stay */
body.appm footer .ft-link, body.appm footer #ftSocial, body.appm footer #ftReview { display: none !important; }
body.appm footer { padding-top: 22px; padding-bottom: 22px; }
body.appm section[id] { padding-top: 18px !important; padding-bottom: 26px !important; }

/* ---- tidy footer ---- */
body.appm footer { background: #fff; }
body.appm footer > div > * + * { margin-top: 12px !important; }
body.appm footer > div > div:first-child { border-bottom: 0 !important; }
body.appm footer > div > div:first-child { flex-direction: column; gap: 14px; text-align: center; padding-bottom: 18px; }
body.appm footer > div > div:first-child > div:first-child { flex-direction: column; text-align: center !important; gap: 8px; }
body.appm footer > div > div:first-child > div:first-child img { height: 46px; }
body.appm footer > div > div:first-child > div:last-child { width: 100%; text-align: center; direction: ltr; padding: 10px 12px; background: #f0fdfa; border: 1px solid #ccfbf1; border-radius: 14px; line-height: 1.9; }
body.appm footer > div > div:last-child { padding: 12px 14px; background: #f8fafc; border-radius: 14px; font-size: 10.5px; line-height: 1.8; text-align: center; }

/* ---- sub bar: back button or segments ---- */
#appSub { position: sticky; top: 56px; z-index: 30; background: rgba(251, 251, 253, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(15, 23, 42, .06); padding: 8px 12px; }
#appSub[hidden] { display: none; }
.as-seg { display: flex; gap: 6px; padding: 4px; background: #e8edf3; border-radius: 14px; }
.as-seg button { flex: 1; padding: 9px 4px; border: 0; border-radius: 11px; background: transparent; color: #475569; font: inherit; font-size: 12px; font-weight: 800; }
.as-seg button[aria-selected="true"] { background: #fff; color: #0f172a; box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }
.as-back { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 2px; border: 0; background: none; color: #0f766e; font: inherit; font-size: 14px; font-weight: 900; }
.as-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
html[dir="rtl"] .as-back svg { transform: scaleX(-1); }

/* ---- Home ---- */
#appHome { padding: 4px 16px 8px; }
.ah-h { font-size: 15px; font-weight: 900; color: #0f172a; margin: 14px 2px 10px; }
.ah-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ah-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; min-height: 92px; text-align: start; background: #fff; border: 1px solid rgba(15, 23, 42, .07); border-radius: 18px; box-shadow: 0 2px 10px rgba(15, 23, 42, .05); font: inherit; color: #0f172a; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ah-tile:active { transform: scale(.98); }
.ah-tile .e { font-size: 26px; line-height: 1; }
.ah-tile b { font-size: 12.5px; font-weight: 900; line-height: 1.45; }
.ah-tile.red { background: #fff1f2; border-color: #fecdd3; }
.ah-path { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 28rem; margin: 0 auto; padding: 10px 14px; background: #fff; border: 1px solid rgba(15, 23, 42, .08); border-radius: 16px; font-size: 12.5px; font-weight: 800; color: #0f172a; }
.ah-path button { padding: 6px 12px; border: 0; border-radius: 99px; background: #ccfbf1; color: #0f766e; font: inherit; font-size: 11.5px; font-weight: 900; }
.ah-join { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; padding: 14px; background: linear-gradient(135deg, #f0fdfa, #ecfdf5); border: 1px solid #99f6e4; border-radius: 18px; }
.ah-join .t { flex: 1; font-size: 12px; line-height: 1.6; color: #134e4a; font-weight: 700; }
.ah-join .t b { display: block; font-size: 13.5px; font-weight: 900; color: #0f172a; }
.ah-join button { padding: 10px 14px; border: 0; border-radius: 12px; background: #0d9488; color: #fff; font: inherit; font-size: 12px; font-weight: 900; white-space: nowrap; }

/* ---- Profile ---- */
#appProfile { padding: 16px 16px 8px; }
.ap-head { display: flex; align-items: center; gap: 14px; padding: 16px; background: #fff; border: 1px solid rgba(15, 23, 42, .07); border-radius: 22px; box-shadow: 0 2px 12px rgba(15, 23, 42, .05); }
.ap-av { width: 68px; height: 68px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: linear-gradient(135deg, #14b8a6, #0d9488); color: #fff; font-size: 28px; font-weight: 900; box-shadow: 0 0 0 4px #ccfbf1; }
.ap-av svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ap-who { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ap-who b { font-size: 17px; font-weight: 900; color: #0f172a; overflow-wrap: anywhere; }
.ap-who span { font-size: 12.5px; color: #64748b; font-weight: 700; }
.ap-who em { align-self: flex-start; margin-top: 2px; padding: 2px 10px; border-radius: 99px; background: #e2e8f0; color: #475569; font-size: 11px; font-style: normal; font-weight: 900; }
.ap-who em.pro { background: #fef3c7; color: #92400e; }
.ap-who em.ok { background: #ccfbf1; color: #0f766e; }
.ap-h { margin: 18px 4px 8px; font-size: 12px; font-weight: 900; color: #64748b; }
.ap-list { background: #fff; border: 1px solid rgba(15, 23, 42, .07); border-radius: 18px; overflow: hidden; }
.ap-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid rgba(15, 23, 42, .06); background: #fff; font: inherit; font-size: 13.5px; font-weight: 800; color: #0f172a; text-align: start; cursor: pointer; }
.ap-row:last-child { border-bottom: 0; }
.ap-row .e { width: 28px; text-align: center; font-size: 18px; }
.ap-row .s { flex: 1; }
.ap-row svg.chev { width: 16px; height: 16px; fill: none; stroke: #94a3b8; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
html[dir="rtl"] .ap-row svg.chev { transform: scaleX(-1); }
.ap-row.red { color: #be123c; }
.ap-seg { display: flex; gap: 6px; padding: 5px; background: #e8edf3; border-radius: 16px; }
.ap-seg button { flex: 1; padding: 12px 6px; border: 0; border-radius: 12px; background: transparent; font: inherit; font-size: 12.5px; font-weight: 900; color: #475569; }
.ap-seg button[aria-pressed="true"] { background: #fff; color: #0f172a; box-shadow: 0 1px 5px rgba(15, 23, 42, .14); }
.ap-note { margin: 8px 4px 0; font-size: 11px; line-height: 1.6; color: #94a3b8; }
.ap-soc { display: flex; gap: 14px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.ap-up { display: block; width: 100%; margin-top: 10px; padding: 14px; border: 0; border-radius: 16px; background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; font: inherit; font-size: 13.5px; font-weight: 900; }
.ap-out { display: block; width: 100%; margin: 18px 0 0; padding: 14px; border: 1px solid #fecdd3; border-radius: 16px; background: #fff; color: #be123c; font: inherit; font-size: 13.5px; font-weight: 900; }

/* ---- the + sheet ---- */
.as-ov { position: fixed; inset: 0; z-index: 94; display: flex; align-items: flex-end; justify-content: center; background: rgba(15, 23, 42, .55); }
.as-ov[hidden] { display: none; }
.as-card { width: 100%; max-width: 30rem; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); background: #fff; border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(15, 23, 42, .25); animation: asUp .22s ease-out; }
@keyframes asUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .as-card { animation: none; } }
.as-grip { width: 42px; height: 5px; margin: 0 auto 12px; border-radius: 9px; background: #cbd5e1; }
.as-t { font-size: 16px; font-weight: 900; color: #0f172a; margin: 0 2px 12px; }
.as-opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; margin-bottom: 10px; border: 1px solid rgba(15, 23, 42, .08); border-radius: 18px; background: #f8fafc; font: inherit; text-align: start; cursor: pointer; }
.as-opt i { width: 46px; height: 46px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 14px; font-size: 22px; font-style: normal; }
.as-opt b { display: block; font-size: 14px; font-weight: 900; color: #0f172a; }
.as-opt span { display: block; font-size: 11.5px; color: #64748b; font-weight: 700; margin-top: 2px; }
.as-form label { display: block; margin-bottom: 12px; }
.as-form label > span { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 800; color: #475569; }
.as-form input { width: 100%; padding: 13px 14px; border: 1.5px solid #cbd5e1; border-radius: 14px; background: #fff; font: inherit; font-size: 20px; font-weight: 800; color: #0f172a; }
.as-form input[type="date"] { font-size: 15px; }
.as-form input:focus { outline: 0; border-color: #0d9488; box-shadow: 0 0 0 3px rgba(13, 148, 136, .18); }
.as-msg { margin: 0 0 10px; padding: 9px 12px; border-radius: 12px; background: #fff1f2; color: #be123c; font-size: 12px; font-weight: 800; }
.as-go { width: 100%; padding: 14px; border: 0; border-radius: 15px; background: #0d9488; color: #fff; font: inherit; font-size: 14.5px; font-weight: 900; }
.as-go:disabled { opacity: .6; }
.as-cancel { width: 100%; margin-top: 8px; padding: 12px; border: 0; background: none; color: #64748b; font: inherit; font-size: 13px; font-weight: 800; }

/* ---- guests see only a few foods ---- */
#dishesGrid .dish-card.app-lock, #dishesGrid .food-group.app-lock { display: none !important; }
.app-lockcard { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 18px; text-align: center; background: linear-gradient(135deg, #f0fdfa, #ecfdf5); border: 1.5px dashed #5eead4; border-radius: 22px; }
.app-lockcard .e { font-size: 30px; }
.app-lockcard b { font-size: 15px; font-weight: 900; color: #0f172a; }
.app-lockcard p { margin: 0; font-size: 12px; line-height: 1.7; color: #475569; font-weight: 700; }
.app-lockcard button { padding: 11px 22px; border: 0; border-radius: 13px; background: #0d9488; color: #fff; font: inherit; font-size: 13px; font-weight: 900; }

/* ---- computer view chosen on a phone: a small way back ---- */
#appFullPill { position: fixed; z-index: 50; bottom: 14px; inset-inline-end: 14px; padding: 10px 16px; border: 0; border-radius: 99px; background: #0f172a; color: #fff; font: inherit; font-size: 12px; font-weight: 900; box-shadow: 0 6px 18px rgba(15, 23, 42, .3); }
@media (min-width: 768px) { #appFullPill { display: none !important; } }
@media print { #appBar, #appSub, #appFullPill, .as-ov { display: none !important; } body.appm { padding-bottom: 0 !important; } }

/* ---- profile photo ---- */
#appBar .ab-av { overflow: hidden; }
#appBar .ab-av img, .ap-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.ap-av { position: relative; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ap-av img { box-shadow: none; }
.ap-cam { position: absolute; bottom: -2px; inset-inline-end: -2px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #fff; border: 1px solid #cbd5e1; font-size: 13px; font-style: normal; box-shadow: 0 2px 6px rgba(15, 23, 42, .18); }

/* ---- Home dashboard ---- */
#appDash { padding: 0 16px; }
#appDash:empty { display: none; }
.ad-hi { margin: 16px 2px 10px; font-size: 18px; font-weight: 900; color: #0f172a; }
.ad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ad-c { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 104px; padding: 13px 14px; text-align: start; background: #fff; border: 1px solid rgba(15, 23, 42, .07); border-radius: 18px; box-shadow: 0 2px 10px rgba(15, 23, 42, .05); font: inherit; color: #0f172a; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ad-c:active { transform: scale(.98); }
.ad-c .l { font-size: 11.5px; font-weight: 800; color: #64748b; }
.ad-c b { font-size: 22px; font-weight: 900; line-height: 1.2; }
.ad-c b.sm { font-size: 13.5px; line-height: 1.5; }
.ad-c b small { font-size: 12px; font-weight: 800; color: #64748b; }
.ad-c em { font-size: 11.5px; font-style: normal; font-weight: 900; padding: 1px 8px; border-radius: 99px; background: #f1f5f9; color: #475569; }
.ad-c em.dn { background: #dcfce7; color: #166534; }
.ad-c em.up { background: #fef3c7; color: #92400e; }
.ad-c.hot { background: #fff7ed; border-color: #fed7aa; }
.ad-sp { width: 84px; height: 26px; margin-top: auto; }
.ad-bar { display: block; width: 100%; height: 7px; margin-top: auto; border-radius: 9px; background: #e2e8f0; overflow: hidden; }
.ad-bar i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, #14b8a6, #0d9488); }

/* ---- swipe between screens ---- */
@keyframes appSwL { from { opacity: .2; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes appSwR { from { opacity: .2; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.app-swl { animation: appSwL .26s ease-out; }
.app-swr { animation: appSwR .26s ease-out; }
@media (prefers-reduced-motion: reduce) { .app-swl, .app-swr { animation: none; } }

/* ---- notification switches ---- */
.ap-msg { padding: 13px 16px; font-size: 12px; line-height: 1.7; color: #64748b; font-weight: 700; border-bottom: 1px solid rgba(15, 23, 42, .06); background: #fff; }
.ap-row:disabled { opacity: .6; }
.ap-sw { position: relative; flex: none; width: 46px; height: 28px; border-radius: 99px; background: #cbd5e1; transition: background .15s; }
.ap-sw::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .3); transition: inset-inline-start .15s; }
.ap-sw.on { background: #0d9488; }
.ap-sw.on::after { inset-inline-start: 21px; }

/* ===== Colour palette (phone app): one calm colour per area. Blue = home, green = food, teal = add, purple = progress, slate = account, orange = exercise, gold = premium, red = emergency only ===== */
#appBar button[data-t="home"] { --tc: var(--c-blue); --tt: var(--c-blue-t); }
#appBar button[data-t="foods"] { --tc: var(--c-green); --tt: var(--c-green-t); }
#appBar button[data-t="progress"] { --tc: var(--c-purple); --tt: var(--c-purple-t); }
#appBar button[data-t="profile"] { --tc: var(--c-slate); --tt: var(--c-slate-t); }
#appBar button[data-t] svg { stroke: var(--tc); opacity: .62; }
#appBar button[data-t] span { color: #475569; }
#appBar button[data-t][aria-current="page"] { color: var(--tc); position: relative; }
#appBar button[data-t][aria-current="page"] svg { opacity: 1; }
#appBar button[data-t][aria-current="page"] span { color: var(--tc); font-weight: 900; }
#appBar button[data-t][aria-current="page"]::before { content: ""; position: absolute; top: -7px; left: 22%; right: 22%; height: 3px; border-radius: 0 0 4px 4px; background: var(--tc); }
#appBar button[data-t="profile"] .ab-av { background: var(--tt); color: var(--tc); }
#appBar button[data-t="profile"][aria-current="page"] .ab-av { background: var(--tc); color: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--tc); }
.ah-tile { --tc: var(--c-blue); --tt: var(--c-blue-t); background: var(--tt); border-color: transparent; }
.ah-tile b { color: var(--tc); }
.ah-tile .e { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.ah-tile[data-open="plate-concept"] { --tc: var(--c-green); --tt: var(--c-green-t); }
.ah-tile[data-open="exercises-section"], .ah-tile[data-open="workout-section"] { --tc: var(--c-move); --tt: var(--c-move-t); }
.ah-tile[data-open="stomach-care"] { --tc: var(--c-teal); --tt: var(--c-teal-t); }
.ah-tile[data-open="ramadan-muscles"] { --tc: var(--c-purple); --tt: var(--c-purple-t); }
.ah-tile[data-open="faq"] { --tc: var(--c-slate); --tt: var(--c-slate-t); }
.ah-tile.red { --tc: var(--c-red); --tt: var(--c-red-t); border-color: #fecaca; }
body.appm[data-app-tab="foods"] .as-seg button[aria-selected="true"] { color: var(--c-green); box-shadow: inset 0 -3px 0 var(--c-green), 0 1px 4px rgba(15, 23, 42, .12); }
body.appm[data-app-tab="progress"] .as-seg button[aria-selected="true"] { color: var(--c-purple); box-shadow: inset 0 -3px 0 var(--c-purple), 0 1px 4px rgba(15, 23, 42, .12); }
.ap-up { background: linear-gradient(135deg, #b45309, #92400e); }
.pl-lock button { background: linear-gradient(135deg, #b45309, #92400e) !important; }
