/* MadDiet powered by SugarSwap — one stylesheet, dark theme, mobile first. */

@font-face { font-family: "League Gothic"; src: url("../fonts/league-gothic.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("../fonts/dm-sans-latin-wght-italic.woff2") format("woff2"); font-weight: 100 1000; font-style: italic; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0d0d0e;
  --surface: #17171a;
  --raised: #1f1f23;
  --line: #2b2b31;
  --line-strong: #3a3a42;
  --text: #f6f5f2;
  --muted: #a9a8a2;
  --brand: #fea338;
  --brand-ink: #1b1204;
  --brand-soft: rgba(254, 163, 56, .14);
  --blue: #00aeef;
  --blue-soft: rgba(0, 174, 239, .14);
  --violet: #9b6bff;
  --good: #5fd35f;
  --warn: #ffcf1b;
  --danger: #ff7b72;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --rail: 92px;
  --tabbar: 68px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "League Gothic", "Arial Narrow", Impact, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg, picture, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: #ffbd6b; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--brand); color: var(--brand-ink); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--brand); color: var(--brand-ink); padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; color: var(--brand-ink); }
.icon { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- type ---------- */
.display { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .02em; line-height: .98; }
h1.display, .h1 { font-size: clamp(2.6rem, 8vw, 4.6rem); }
h2.display, .h2 { font-size: clamp(2rem, 5vw, 3rem); }
h3.display, .h3 { font-size: clamp(1.5rem, 3.4vw, 2rem); }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.accent { color: var(--brand); }
.blue { color: var(--blue); }
.center { text-align: center; }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 12px 22px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--brand); color: var(--brand-ink);
  font-weight: 700; text-decoration: none; line-height: 1.2; transition: transform .15s var(--ease), background .2s, border-color .2s, opacity .2s;
}
.btn:hover { background: #ffb659; color: var(--brand-ink); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn--ghost:hover { background: var(--raised); color: var(--text); border-color: var(--muted); }
.btn--blue { background: var(--blue); color: #00212e; }
.btn--blue:hover { background: #39c3f5; color: #00212e; }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: rgba(255, 123, 114, .12); color: var(--danger); }
.btn--lg { min-height: 56px; padding: 14px 30px; font-size: 1.06rem; border-radius: 18px; }
.btn--sm { min-height: 38px; padding: 8px 14px; font-size: .9rem; border-radius: 11px; }
.btn--block { display: flex; width: 100%; }
.btn--icon { min-height: 44px; width: 44px; padding: 0; border-radius: 50%; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--brand-ink); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn--ghost.is-busy::after { border-color: var(--text); border-right-color: transparent; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cards ---------- */
.card { background: linear-gradient(180deg, var(--surface), #141416); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card--raised { background: var(--raised); }
.card--brand { background: linear-gradient(135deg, rgba(254, 163, 56, .2), rgba(254, 163, 56, .04) 60%), var(--surface); border-color: rgba(254, 163, 56, .4); }
.card--blue { background: linear-gradient(135deg, rgba(0, 174, 239, .18), rgba(0, 174, 239, .03) 60%), var(--surface); border-color: rgba(0, 174, 239, .35); }
.card__title { display: flex; align-items: center; gap: 10px; font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.card__title .icon { color: var(--brand); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.chip--brand { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.chip--blue { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.chip--good { background: rgba(95, 211, 95, .14); border-color: transparent; color: var(--good); }
.chip--warn { background: rgba(255, 207, 27, .14); border-color: transparent; color: var(--warn); }
.chip--danger { background: rgba(255, 123, 114, .14); border-color: transparent; color: var(--danger); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--raised); border: 1px solid var(--line); }
.notice .icon { margin-top: 2px; color: var(--blue); }
.notice--warn { border-color: rgba(255, 207, 27, .4); } .notice--warn .icon { color: var(--warn); }
.notice--danger { border-color: rgba(255, 123, 114, .5); } .notice--danger .icon { color: var(--danger); }
.notice--good { border-color: rgba(95, 211, 95, .4); } .notice--good .icon { color: var(--good); }
.notice--brand { border-color: rgba(254, 163, 56, .4); } .notice--brand .icon { color: var(--brand); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: .86rem; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; background: #101012; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.textarea { min-height: 130px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #77766f; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 174, 239, .3); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a9a8a2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.error { color: var(--danger); font-size: .86rem; font-weight: 600; min-height: 1.2em; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: .84rem; }
.form-grid { display: grid; gap: 16px; }
@media (min-width: 560px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } .form-grid--3 { grid-template-columns: 2fr 1.4fr 1fr; } .span-2 { grid-column: 1 / -1; } }
.with-unit { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }

.seg { display: inline-flex; padding: 4px; background: #101012; border: 1px solid var(--line-strong); border-radius: 12px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: 9px 16px; border-radius: 9px; font-weight: 600; font-size: .92rem; color: var(--muted); cursor: pointer; transition: background .2s, color .2s; min-width: 52px; text-align: center; }
.seg input:checked + span { background: var(--brand); color: var(--brand-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }

.choices { display: grid; gap: 12px; }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice__body { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 14px 18px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; cursor: pointer; transition: border-color .2s, background .2s, transform .15s var(--ease); }
.choice__body:hover { border-color: var(--muted); }
.choice__body:active { transform: scale(.985); }
.choice__dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; transition: border-color .2s, background .2s; }
.choice__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-ink); transform: scale(0); transition: transform .2s var(--ease); }
.choice__label { font-weight: 700; }
.choice__hint { display: block; color: var(--muted); font-size: .88rem; font-weight: 400; }
.choice input:checked + .choice__body { border-color: var(--brand); background: var(--brand-soft); }
.choice input:checked + .choice__body .choice__dot { background: var(--brand); border-color: var(--brand); }
.choice input:checked + .choice__body .choice__dot::after { transform: scale(1); }
.choice input:focus-visible + .choice__body { outline: 3px solid var(--blue); outline-offset: 3px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 52px; height: 30px; margin: 0; cursor: pointer; }
.switch__track { width: 52px; height: 30px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------- app shell ---------- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: rgba(13, 13, 14, .86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar__logo img { height: 34px; width: auto; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--raised); border: 2px solid var(--line-strong); display: grid; place-items: center; font-weight: 700; color: var(--brand); text-decoration: none; overflow: hidden; }
.nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: rgba(20, 20, 22, .94); backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav__logo { display: none; }
.nav__list { display: flex; justify-content: space-around; margin: 0; }
.nav__item { flex: 1 1 0; }
.nav__link { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--tabbar); padding: 8px 4px; color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; transition: color .2s; }
.nav__link .icon { width: 24px; height: 24px; transition: transform .25s var(--ease); }
.nav__link:hover { color: var(--text); }
.nav__link[aria-current="page"] { color: var(--brand); }
.nav__link[aria-current="page"] .icon { transform: translateY(-2px) scale(1.08); }
.nav__link[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--brand); }
.nav__foot { display: none; }
.main { padding: 20px 16px 32px; max-width: 1180px; margin: 0 auto; animation: rise .45s var(--ease) both; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (min-width: 768px) {
  .shell { position: relative; padding-bottom: 0; padding-left: var(--rail); }
  /* the rail column is painted for the whole page height; the fixed nav sits on top of it */
  .shell::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: var(--rail); background: #141416; border-right: 1px solid var(--line); }
  .topbar { display: none; }
  .nav { top: 0; right: auto; width: var(--rail); border-top: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; padding: 18px 0; }
  .nav__logo { display: grid; place-items: center; margin-bottom: 18px; }
  .nav__logo img { width: 52px; height: 52px; border-radius: 14px; }
  .nav__list { flex-direction: column; justify-content: flex-start; gap: 4px; flex: 1; }
  .nav__item { flex: none; }
  .nav__link { min-height: 70px; }
  .nav__link[aria-current="page"]::before { top: 16px; bottom: 16px; left: 0; width: 3px; height: auto; border-radius: 0 4px 4px 0; }
  .nav__foot { display: grid; place-items: center; gap: 10px; }
  .main { padding: 36px 32px 56px; }
}
@media (min-width: 1280px) {
  :root { --rail: 232px; }
  .nav { padding: 22px 14px; }
  .nav__logo { justify-items: start; padding: 0 10px; }
  .nav__logo img { width: 150px; height: auto; border-radius: 0; }
  .nav__link { flex-direction: row; justify-content: flex-start; gap: 14px; min-height: 52px; padding: 10px 16px; border-radius: 14px; font-size: .82rem; }
  .nav__link:hover { background: var(--raised); }
  .nav__link[aria-current="page"] { background: var(--brand-soft); }
  .nav__link[aria-current="page"]::before { display: none; }
  .nav__link[aria-current="page"] .icon { transform: none; }
  .nav__foot { justify-items: stretch; padding: 0 6px; }
}

/* ---------- dashboard ---------- */
.grid { display: grid; gap: 16px; }
/* grid items may shrink below their content, so wide tables scroll inside their wrapper instead of widening the page */
.grid > * { min-width: 0; }
@media (min-width: 640px) { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } .grid--3 { grid-template-columns: repeat(3, 1fr); } .grid--side { grid-template-columns: 2fr 1fr; } }
@media (min-width: 640px) and (max-width: 1023px) { .grid--4 { grid-template-columns: repeat(2, 1fr); } .grid--3 { grid-template-columns: repeat(2, 1fr); } }
.stat__value { font-family: var(--display); font-size: clamp(2.6rem, 6vw, 3.4rem); line-height: 1; letter-spacing: .01em; }
.stat__unit { font-family: var(--font); font-size: 1rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.kv dt { font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kv dd { font-weight: 700; font-size: 1.12rem; }
.gauge { width: 100%; max-width: 300px; margin: 0 auto; }
.gauge__needle { transform-origin: 150px 150px; transition: transform 1.2s var(--ease); }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring__track { stroke: var(--line); }
.ring__bar { stroke: var(--blue); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.ring--brand .ring__bar { stroke: var(--brand); }
.ring__label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring__label b { font-family: var(--display); font-weight: 400; font-size: 2.2rem; }
.ring__label span { font-size: .72rem; color: var(--muted); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.glasses { display: flex; flex-wrap: wrap; gap: 5px; }
.glasses i { width: 12px; height: 18px; border-radius: 2px 2px 5px 5px; background: var(--blue); opacity: .9; }
.chart { width: 100%; height: auto; }
.chart text { fill: var(--muted); font: 600 11px var(--font); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .series { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .82rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.nudges { display: grid; gap: 12px; }
@media (min-width: 900px) { .nudges { grid-template-columns: repeat(2, 1fr); } }
.nudge { display: flex; gap: 14px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.nudge__icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); flex: none; }
.nudge--warn .nudge__icon { background: rgba(255, 207, 27, .14); color: var(--warn); }
.nudge--brand .nudge__icon { background: var(--brand-soft); color: var(--brand); }
.nudge h3 { font-size: 1rem; margin-bottom: 2px; }
.nudge p { color: var(--muted); font-size: .92rem; }
.hero-card { display: grid; gap: 18px; align-items: center; }
@media (min-width: 700px) { .hero-card { grid-template-columns: 1fr auto; } }

/* ---------- plans ---------- */
.plans { display: grid; gap: 16px; align-items: stretch; }
@media (min-width: 900px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { --tone: var(--blue); position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px 22px 22px; border-radius: 24px; background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 16%, var(--surface)), var(--surface) 55%); border: 1px solid color-mix(in srgb, var(--tone) 45%, var(--line)); }
.plan--2 { --tone: var(--violet); } .plan--3 { --tone: var(--brand); }
.plan--popular { box-shadow: 0 0 0 2px var(--brand), var(--shadow); }
@media (min-width: 900px) { .plan--popular { transform: translateY(-10px); } }
.plan__badge { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--brand); color: var(--brand-ink); font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 5px 14px; border-radius: 999px; white-space: nowrap; }
.plan__name { font-family: var(--display); font-size: 2.2rem; text-transform: uppercase; color: var(--tone); line-height: 1; }
.plan__price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.plan__price b { font-family: var(--display); font-weight: 400; font-size: 3rem; line-height: 1; }
.plan__price s { color: var(--muted); font-size: 1.05rem; }
.plan__list { display: grid; gap: 9px; flex: 1; font-size: .94rem; }
.plan__list li { display: flex; gap: 10px; align-items: flex-start; }
.plan__list .icon { color: var(--tone); margin-top: 3px; }
.plan .btn { background: var(--tone); color: #0b0b0c; }
.plan .btn:hover { filter: brightness(1.12); }
.summary { display: grid; gap: 8px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; }
.summary .total { border-top: 1px solid var(--line); padding-top: 10px; font-weight: 800; font-size: 1.2rem; }

/* ---------- tracker ---------- */
.tracker { display: grid; gap: 0; counter-reset: step; }
.tracker__step { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding-bottom: 26px; }
.tracker__step:last-child { padding-bottom: 0; }
.tracker__step::before { content: ""; position: absolute; left: 21px; top: 44px; bottom: 0; width: 3px; border-radius: 3px; background: var(--line); }
.tracker__step:last-child::before { display: none; }
.tracker__step.is-done::before { background: var(--brand); }
.tracker__dot { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); border: 2px solid var(--line-strong); color: var(--muted); z-index: 1; }
.is-done .tracker__dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.is-current .tracker__dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 6px var(--brand-soft); animation: pulse 2s ease-in-out infinite; }
.tracker__name { font-weight: 700; padding-top: 9px; }
.tracker__step:not(.is-done):not(.is-current) .tracker__name { color: var(--muted); }
@keyframes pulse { 50% { box-shadow: 0 0 0 11px rgba(254, 163, 56, .04); } }
@media (min-width: 900px) {
  .tracker { grid-template-columns: repeat(5, 1fr); }
  .tracker__step { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 0 8px; }
  .tracker__step::before { left: calc(50% + 28px); right: calc(-50% + 28px); top: 21px; bottom: auto; width: auto; height: 3px; }
  .tracker__name { padding-top: 4px; }
}
.otp { display: flex; gap: 8px; justify-content: center; }
.otp input { width: 46px; height: 58px; text-align: center; font-family: var(--display); font-size: 2rem; background: #101012; border: 1.5px solid var(--line-strong); border-radius: 12px; color: var(--text); }
.otp input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
@media (min-width: 420px) { .otp { gap: 10px; } .otp input { width: 52px; height: 64px; } }

/* ---------- diet view ---------- */
.banner { position: relative; overflow: hidden; border-radius: 24px; border: 1px solid var(--line); min-height: 170px; display: grid; align-items: end; background: var(--surface); }
.banner picture, .banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(13, 13, 14, .92) 20%, rgba(13, 13, 14, .35)); }
.banner__body { position: relative; z-index: 1; padding: 24px; }
.weekbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.daytabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; scroll-snap-type: x proximity; }
.daytabs::-webkit-scrollbar { display: none; }
.daytab { flex: none; min-width: 58px; padding: 9px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); text-align: center; scroll-snap-align: center; }
.daytab b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.5rem; color: var(--text); line-height: 1; }
.daytab span { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.daytab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.daytab[aria-selected="true"] b { color: var(--brand-ink); }
.daytab.is-today { border-color: var(--brand); }
.daytab.is-past { opacity: .6; }
.week { display: grid; gap: 14px; }
.day { display: none; gap: 12px; }
.day.is-shown { display: grid; animation: rise .35s var(--ease) both; }
.day__head { display: none; }
.meal { position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--raised); color: #fff; text-align: left; min-height: 150px; transition: transform .2s var(--ease), border-color .2s; }
.meal:hover { transform: translateY(-3px); border-color: var(--brand); }
.meal img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.meal:hover img { transform: scale(1.05); }
.meal::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, .1) 22%, rgba(8, 8, 9, .82) 52%, rgba(8, 8, 9, .96) 100%); }
.meal__ph { position: absolute; inset: 0 0 45% 0; display: grid; place-items: center; color: var(--line-strong); }
.meal__ph .icon { width: 34px; height: 34px; }
.meal--plain::after { background: linear-gradient(180deg, transparent, rgba(8, 8, 9, .5)); }
.meal__title, .meal__kcal, .meal__slot { text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.meal__body { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 12px 14px; display: grid; gap: 4px; }
.meal__slot { font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); }
.meal__title { font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meal__kcal { font-size: .78rem; color: #dcdbd6; }
@media (min-width: 1024px) {
  .daytabs { display: none; }
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
  .day, .day.is-shown { display: grid; align-content: start; gap: 10px; animation: none; }
  .day__head { display: block; text-align: center; padding: 8px 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .day__head b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.4rem; color: var(--text); letter-spacing: .02em; }
  .day.is-today .day__head { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
  .day.is-today .day__head b { color: var(--brand-ink); }
  .day.is-past { opacity: .55; }
  .meal { min-height: 172px; }
  .meal__title { font-size: .9rem; }
}

/* ---------- dialogs / drawer ---------- */
dialog { color: var(--text); border: 1px solid var(--line); background: var(--surface); padding: 0; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(4px); }
.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border-radius: 24px; box-shadow: var(--shadow); overflow: auto; }
.modal[open] { animation: pop .3s var(--ease) both; }
.modal__head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modal__body { padding: 22px; }
.modal__foot { position: sticky; bottom: 0; display: flex; gap: 12px; justify-content: flex-end; padding: 16px 22px; background: var(--surface); border-top: 1px solid var(--line); }
.drawer { margin: 0 0 0 auto; height: 100dvh; width: min(560px, 100vw); border-radius: 0; border-width: 0 0 0 1px; overflow-y: auto; }
.drawer[open] { animation: slide .35s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes slide { from { transform: translateX(60px); opacity: 0; } }
.recipe__hero { position: relative; aspect-ratio: 16 / 10; background: var(--raised); }
.recipe__hero img { width: 100%; height: 100%; object-fit: cover; }
.recipe__close { position: absolute; top: 14px; right: 14px; z-index: 3; background: rgba(0, 0, 0, .6); color: #fff; border: 1px solid rgba(255, 255, 255, .25); }
.recipe__body { padding: 22px; }
.recipe__meta { display: flex; flex-wrap: wrap; gap: 8px; }
.recipe h3 { font-size: 1.3rem; }
.recipe h4 { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }
.ingredients { display: grid; gap: 0; }
.ingredients li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.ingredients li span:last-child { color: var(--muted); white-space: nowrap; }
.steps { display: grid; gap: 16px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: start; }
.steps img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; background: var(--raised); }
.steps b { display: block; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- stories ---------- */
.stories { display: flex; gap: 14px; overflow-x: auto; padding: 6px 2px 12px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.stories--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); overflow: visible; gap: 20px 12px; }
.story { flex: none; width: 88px; display: grid; justify-items: center; gap: 8px; background: none; border: 0; padding: 0; color: var(--text); scroll-snap-align: start; text-align: center; }
.stories--grid .story { width: auto; }
.story__ring { width: 76px; height: 76px; border-radius: 50%; padding: 3px; background: conic-gradient(from 210deg, var(--brand), var(--blue), var(--brand)); transition: transform .2s var(--ease); }
.story:hover .story__ring { transform: scale(1.06); }
.story__ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--bg); }
.story__title { font-size: .74rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.viewer { width: 100vw; height: 100dvh; max-width: none; border: 0; background: #000; overflow: hidden; }
.viewer__stage { position: relative; height: 100%; max-width: calc(100dvh * 9 / 16); margin: 0 auto; display: grid; }
.viewer__img { width: 100%; height: 100%; object-fit: contain; }
.viewer__top { position: absolute; z-index: 3; top: 0; left: 0; right: 0; padding: calc(10px + env(safe-area-inset-top)) 12px 26px; background: linear-gradient(180deg, rgba(0, 0, 0, .7), transparent); }
.viewer__bars { display: flex; gap: 4px; }
.viewer__bars i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.viewer__bars i b { display: block; height: 100%; width: 0; background: #fff; }
.viewer__bars i.is-done b { width: 100%; }
.viewer__bars i.is-active b { animation: fill var(--story-ms, 8000ms) linear forwards; }
.viewer.is-paused .viewer__bars i.is-active b { animation-play-state: paused; }
@keyframes fill { to { width: 100%; } }
.viewer__head { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: #fff; }
.viewer__head h2 { font-size: .95rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer__head .btn--icon { background: rgba(0, 0, 0, .45); color: #fff; border-color: rgba(255, 255, 255, .25); }
.viewer__zone { position: absolute; z-index: 2; top: 90px; bottom: 90px; width: 34%; background: none; border: 0; }
.viewer__zone--prev { left: 0; } .viewer__zone--next { right: 0; width: 66%; }
.viewer__zone:focus-visible { outline-offset: -6px; }
.viewer__cta { position: absolute; z-index: 3; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom)); display: grid; place-items: center; }

/* ---------- quiz ---------- */
.quiz { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: radial-gradient(1200px 600px at 10% -10%, rgba(254, 163, 56, .16), transparent 60%), radial-gradient(900px 600px at 110% 110%, rgba(0, 174, 239, .14), transparent 60%), var(--bg); }
.quiz__top { display: flex; align-items: center; gap: 14px; padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top)); }
.quiz__top img { height: 40px; width: 40px; border-radius: 10px; }
.progress { flex: 1; height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.progress b { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--brand), #ffc978); transition: width .5s var(--ease); }
/* overflow-x: clip keeps the slide-in transform from widening the page (phones would zoom out) */
.quiz__stage { display: grid; align-items: center; padding: 12px 16px 24px; overflow-x: clip; }
.quiz__step { width: 100%; max-width: 620px; margin: 0 auto; }
.quiz__step.is-in { animation: stepin .45s var(--ease) both; }
.quiz__step.is-back { animation: stepback .45s var(--ease) both; }
@keyframes stepin { from { opacity: 0; transform: translateX(40px); } }
@keyframes stepback { from { opacity: 0; transform: translateX(-40px); } }
.quiz__step h1 { font-size: clamp(2rem, 7vw, 3.2rem); margin: 8px 0 22px; }
.quiz__actions { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 12px; justify-content: space-between; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--bg) 35%); }
.quiz__actions .btn { min-width: 120px; white-space: nowrap; }
/* Three buttons (Back, Skip for now, Next) must fit a 360px phone without widening the page. */
@media (max-width: 480px) {
  .quiz__actions { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .quiz__actions .btn { min-width: 0; padding-left: 14px; padding-right: 14px; }
  .quiz__actions [data-back] .icon { display: none; }
  .quiz__actions [data-next] { min-width: 96px; }
}
.quiz__info { display: grid; gap: 22px; justify-items: center; text-align: center; }
.quiz__info img { width: min(320px, 70vw); border-radius: 24px; }
.quiz__info p { font-size: 1.15rem; max-width: 46ch; }
.hello { display: grid; justify-items: center; gap: 18px; text-align: center; }
.hello .avatar { width: 96px; height: 96px; font-size: 2rem; border-color: var(--brand); }

/* ---------- public / landing ---------- */
.pub-head { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; padding-top: calc(12px + env(safe-area-inset-top)); background: rgba(13, 13, 14, .82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.pub-head img { height: 40px; width: auto; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.hero { position: relative; overflow: hidden; }
.hero__bg { position: absolute; inset: 0; }
.hero__bg img { width: 100%; height: 100%; object-fit: cover; opacity: .34; }
.hero__bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(900px 500px at 15% 20%, rgba(254, 163, 56, .25), transparent 60%), linear-gradient(180deg, rgba(13, 13, 14, .3), var(--bg)); }
.hero__inner { position: relative; display: grid; gap: 32px; align-items: center; padding: 56px 20px 64px; }
.hero__phone { justify-self: center; width: min(280px, 64vw); filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .6)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-12px); } }
@media (min-width: 880px) { .hero__inner { grid-template-columns: 1.15fr .85fr; padding: 90px 20px 100px; } .hero__phone { width: 320px; } }
.hero p.lead { font-size: 1.15rem; color: #e4e3de; max-width: 52ch; }
.section { padding: 64px 0; }
.steps3 { display: grid; gap: 16px; counter-reset: n; }
@media (min-width: 800px) { .steps3 { grid-template-columns: repeat(3, 1fr); } }
.steps3 li { counter-increment: n; padding: 26px 22px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); }
.steps3 li::before { content: counter(n); display: block; font-family: var(--display); font-size: 3.4rem; line-height: 1; color: var(--brand); margin-bottom: 10px; }
.feature { display: grid; gap: 24px; align-items: center; padding: 34px 0; }
.feature img { width: min(420px, 100%); margin: 0 auto; border-radius: 24px; }
@media (min-width: 800px) { .feature { grid-template-columns: 1fr 1fr; gap: 56px; } .feature:nth-child(even) .feature__media { order: 2; } }
.feature p { color: #d9d8d2; font-size: 1.05rem; margin: 12px 0 20px; }
.pub-foot { border-top: 1px solid var(--line); background: #0a0a0b; padding: 44px 0 32px; }
.pub-foot__grid { display: grid; gap: 28px; }
@media (min-width: 800px) { .pub-foot__grid { grid-template-columns: 1.2fr 1fr 1.6fr; } }
.pub-foot h2 { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; font-family: var(--font); font-weight: 700; }
.pub-foot a { color: var(--text); }
.social { display: flex; gap: 10px; }
.login { min-height: calc(100dvh - 70px); display: grid; place-items: center; padding: 32px 20px; background: radial-gradient(800px 500px at 50% 0, rgba(254, 163, 56, .16), transparent 60%); }
.login__card { width: min(440px, 100%); text-align: center; display: grid; gap: 20px; justify-items: center; }
.login__card img { width: 190px; }
.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 54px; padding: 12px 26px; border-radius: 14px; background: #fff; color: #1f1f1f; font-weight: 700; text-decoration: none; width: 100%; transition: transform .15s var(--ease), box-shadow .2s; }
.gbtn:hover { color: #1f1f1f; box-shadow: 0 8px 30px rgba(255, 255, 255, .16); }
.gbtn:active { transform: scale(.98); }
.prose { max-width: 74ch; }
.prose h2 { font-size: 1.25rem; margin: 28px 0 8px; color: var(--text); }
.prose p, .prose li { color: #d9d8d2; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 12px; }
.prose ul { padding-left: 20px; display: grid; gap: 6px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; }
.tabs a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---------- settings / lists ---------- */
.list { display: grid; }
.list__item { display: flex; align-items: center; gap: 14px; padding: 15px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.list__item:last-child { border-bottom: 0; }
a.list__item:hover, button.list__item:hover { color: var(--brand); }
.list__item > .icon:first-child { color: var(--brand); width: 22px; height: 22px; }
.list__item .chev { margin-left: auto; color: var(--muted); }
.breathe { position: fixed; inset: 0 0 calc(var(--tabbar) + env(safe-area-inset-bottom)) 0; display: grid; grid-template-rows: auto 1fr; background: #000; }
.breathe iframe { width: 100%; height: 100%; border: 0; }
.breathe__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
@media (min-width: 768px) { .breathe { inset: 0 0 0 var(--rail); } }

/* ---------- admin ---------- */
/* position: relative contains visually-hidden (absolutely positioned) cell content, which would otherwise widen the page */
.table-wrap { position: relative; overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 16px; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 640px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); background: var(--surface); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.subnav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 18px; }
.filters .field { min-width: 150px; }
.code-big { font-family: var(--display); font-size: 3.2rem; letter-spacing: .18em; color: var(--brand); line-height: 1; }

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { padding: 13px 18px; border-radius: 14px; background: #2a2a30; border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-weight: 600; animation: pop .3s var(--ease) both; pointer-events: auto; }
.toast--error { border-color: var(--danger); } .toast--ok { border-color: var(--good); }
@media (min-width: 768px) { .toasts { bottom: 24px; } }

/* ---------- print (packing slip) ---------- */
.slip { max-width: 720px; margin: 0 auto; padding: 28px; background: #fff; color: #111; min-height: 100dvh; }
.slip h1, .slip h2 { color: #111; } .slip .muted { color: #555; }
.slip__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }
.slip__box { border: 2px solid #111; border-radius: 14px; padding: 18px; }
.slip__code { font-family: var(--display); font-size: 4rem; letter-spacing: .2em; line-height: 1; }
.slip img.qr { width: 190px; height: 190px; }
@media print { .no-print { display: none !important; } body { background: #fff; } .slip { padding: 0; } @page { margin: 14mm; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .viewer__bars i.is-active b { animation: none; width: 100%; }
}
