/* Rovae Club app — brand system
   Navy #283E7B · White #FFFFFF · Surface #F2F2F2 · Square corners everywhere */

:root {
  --navy: #283E7B;
  --navy-90: #3E5188;          /* hover */
  --navy-75: #5E6E9C;          /* secondary text (75% tint, AA on white) */
  --navy-60: #7E8BB0;          /* 60% tint: meta, icons, borders */
  --navy-30: #BEC5D7;
  --navy-10: #E9ECF2;          /* selected states */
  --navy-05: #F4F5F8;
  --white: #FFFFFF;
  --surface: #F2F2F2;
  --line: #E5E5E5;
  --text: #1A1A1A;
  --success: #3F7A68;
  --success-10: #E8F0ED;
  --danger: #A23B3B;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, 'Times New Roman', serif;

  --header-h: 56px;
  --tabbar-h: 64px;
  --sidebar-w: 248px;
  --gutter: 16px;
  --max: 1100px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--white); color: var(--text);
  font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: var(--navy); text-decoration: none; }
button, input, select, textarea {
  font: inherit; color: inherit; border-radius: 0; -webkit-appearance: none; appearance: none;
}
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
h1, h2, h3, h4 { color: var(--navy); margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
h4 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 28px; height: 28px; }
.icon--xl { width: 40px; height: 40px; stroke-width: 1.5; }

.wordmark { font-family: var(--serif); font-weight: 700; color: var(--navy); font-size: 26px; letter-spacing: -0.01em; line-height: 1; }
.wordmark--lg { font-size: 44px; }
.wordmark--light { color: var(--white); }

.label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--navy-75);
}
.label--navy { color: var(--navy); }
.label--light { color: rgba(255,255,255,.85); }
.muted { color: var(--navy-75); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 700; }
.center { text-align: center; }

/* ------------------------------------------------------------ boot */
.boot { min-height: 100vh; display: grid; place-content: center; gap: 20px; justify-items: center; }
.boot__bar { width: 120px; height: 2px; background: var(--navy-10); overflow: hidden; display: block; }
.boot__bar span { display: block; height: 100%; width: 40%; background: var(--navy); animation: boot 1s var(--ease) infinite; }
@keyframes boot { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ------------------------------------------------------------ shell */
.shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--header-h) + var(--safe-t)); padding-top: var(--safe-t);
  background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { height: var(--header-h); max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; gap: 12px; }
.topbar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar__spacer { flex: 1; }
.member-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px;
  background: var(--navy); color: var(--white); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
}
.member-badge--outline { background: var(--navy-10); color: var(--navy); }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; color: var(--navy); border: 1px solid transparent; transition: background .2s; }
.icon-btn:hover { background: var(--navy-05); }
.icon-btn--boxed { border-color: var(--line); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; background: var(--navy-10); color: var(--navy); font-weight: 700; font-size: 14px; }

.main { padding: 20px var(--gutter) calc(var(--tabbar-h) + var(--safe-b) + 32px); max-width: var(--max); margin: 0 auto; }
.view { animation: viewIn .28s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--white); border-top: 1px solid var(--line);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex;
}
.tabbar__brand, .tabbar__foot { display: none; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--navy-60); font-size: 11px; font-weight: 600; position: relative; transition: color .2s;
}
.tab .icon { width: 22px; height: 22px; }
.tab::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; background: var(--navy); transform: scaleX(0); transition: transform .25s var(--ease); }
.tab[aria-current="page"] { color: var(--navy); }
.tab[aria-current="page"]::before { transform: scaleX(1); }

@media (min-width: 960px) {
  :root { --gutter: 32px; }
  .tabbar {
    top: 0; right: auto; width: var(--sidebar-w); height: 100vh; padding: 24px 0; flex-direction: column;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .tabbar__brand { display: block; padding: 4px 28px 28px; }
  .tabbar__foot { display: block; margin-top: auto; padding: 0 28px; }
  .tab { flex: none; flex-direction: row; justify-content: flex-start; gap: 14px; height: 48px; padding: 0 28px; font-size: 15px; }
  .tab::before { top: 8px; bottom: 8px; left: 0; right: auto; width: 3px; height: auto; transform: scaleY(0); }
  .tab[aria-current="page"] { background: var(--navy-05); }
  .tab[aria-current="page"]::before { transform: scaleY(1); }
  .tab:hover { color: var(--navy); }
  .shell { padding-left: var(--sidebar-w); }
  .topbar .wordmark { display: none; }
  .main { padding-top: 32px; padding-bottom: 64px; }
  h1 { font-size: 34px; }
}

/* ------------------------------------------------------------ layout helpers */
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.section { margin-top: 32px; }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section__head a, .link { font-size: 13px; font-weight: 600; color: var(--navy); display: inline-flex; align-items: center; gap: 4px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 24px 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid-md-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-md-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-md-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 960px) { .cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; align-items: start; } .cols > .section:first-child, .cols .section:first-child { margin-top: 0; } }
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 4px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: none; }

.page-head { margin-bottom: 20px; }
.page-head p { margin-top: 6px; color: var(--navy-75); }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: var(--navy); margin-bottom: 16px; height: 32px; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px;
  background: var(--navy); color: var(--white); font-weight: 700; font-size: 15px; letter-spacing: .01em;
  border: 1px solid var(--navy); transition: background .2s, transform .1s, opacity .2s; white-space: nowrap;
}
.btn:hover { background: var(--navy-90); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--block { width: 100%; }
.btn--lg { height: 56px; font-size: 16px; }
.btn--sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn--ghost { background: var(--white); color: var(--navy); border-color: var(--navy); }
.btn--ghost:hover { background: var(--navy-05); }
.btn--soft { background: var(--navy-10); color: var(--navy); border-color: var(--navy-10); }
.btn--soft:hover { background: #DDE2EC; }
.btn--light { background: var(--white); color: var(--navy); border-color: var(--white); }
.btn--light:hover { background: var(--navy-05); }
.btn--text { background: none; border: 0; color: var(--navy); padding: 0 4px; height: 36px; }
.btn--text:hover { background: none; text-decoration: underline; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }

/* ------------------------------------------------------------ cards */
.card { background: var(--surface); padding: 18px; position: relative; }
.card--white { background: var(--white); border: 1px solid var(--line); }
.card--navy { background: var(--navy); color: var(--white); }
.card--navy h2, .card--navy h3, .card--navy h4 { color: var(--white); }
.card--link { display: block; color: inherit; transition: background .2s; }
.card--link.row { display: flex; }
.card--link:hover { background: #ECECEC; }
.card--white.card--link:hover { background: var(--navy-05); }

.media { position: relative; overflow: hidden; background: var(--navy-10); }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), opacity .4s; opacity: 0; }
.media img.loaded { opacity: 1; }
.media--sq { aspect-ratio: 1 / 1; }
.media--wide { aspect-ratio: 16 / 10; }
.media--hero { aspect-ratio: 4 / 3; }
@media (min-width: 720px) { .media--hero { aspect-ratio: 21 / 9; } }
.media__shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,31,62,0) 35%, rgba(20,31,62,.82) 100%); }
.media__tag { position: absolute; left: 10px; top: 10px; background: var(--white); color: var(--navy); font-size: 11px; font-weight: 700; padding: 4px 8px; letter-spacing: .04em; display: inline-flex; gap: 4px; align-items: center; }
a:hover .media img, button:hover .media img { transform: scale(1.03); }

.hero { position: relative; color: var(--white); }
.hero__body { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px; }
.hero__title { font-size: 26px; font-weight: 800; color: var(--white); margin: 6px 0 8px; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: rgba(255,255,255,.9); }
.hero__meta span { display: inline-flex; align-items: center; gap: 5px; }
.hero__actions { background: var(--navy); padding: 14px 18px; display: flex; align-items: center; gap: 12px; }
.hero__actions .btn { flex: 1; }
@media (min-width: 720px) { .hero__title { font-size: 32px; } .hero__body { padding: 28px; } }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; background: var(--navy-10); color: var(--navy); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag--white { background: var(--white); }
.tag--outline { background: transparent; border: 1px solid var(--line); color: var(--navy-75); }
.tag--success { background: var(--success-10); color: var(--success); }
.tag .icon { width: 13px; height: 13px; }

/* workout & recipe cards */
.wcard { display: block; color: inherit; }
.wcard__body { padding: 10px 0 0; }
.wcard__title { font-weight: 700; color: var(--navy); font-size: 15px; line-height: 1.25; }
.wcard__meta { font-size: 12px; color: var(--navy-75); margin-top: 3px; }
.wgrid { display: grid; gap: 20px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .wgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .wgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.rtile { aspect-ratio: 1 / 1; background: var(--surface); display: grid; place-items: center; position: relative; color: var(--navy); overflow: hidden; }
.rtile .icon { width: 44px; height: 44px; stroke-width: 1.25; opacity: .9; }
.rtile__kcal { position: absolute; right: 8px; bottom: 8px; font-size: 11px; font-weight: 700; color: var(--navy-75); }
.rtile__meal { position: absolute; left: 8px; top: 8px; }
.rtile--breakfast { background: #F2F2F2; }
.rtile--lunch { background: #EEF0F4; }
.rtile--dinner { background: var(--navy-10); }
.rtile--snack { background: #F6F6F6; }
.rtile__fav { position: absolute; right: 8px; top: 8px; color: var(--navy); }
.rhero { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--navy); background: var(--surface); }
.rhero > .icon { width: 72px; height: 72px; stroke-width: 1.1; margin-bottom: 28px; }
.rhero__facts { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 18px; padding: 12px; background: rgba(255,255,255,.7); font-size: 13px; font-weight: 700; color: var(--navy); }
.rhero__facts span { display: inline-flex; align-items: center; gap: 5px; }
.rhero__tags { margin-top: 20px; }
@media (min-width: 960px) { .rhero { aspect-ratio: 1 / 1; } .rhero__tags { margin-top: 0; } }
.rtile--sm .icon { width: 22px; height: 22px; stroke-width: 1.5; }

/* stat tiles */
.stat { background: var(--surface); padding: 14px 12px; aspect-ratio: 1 / 1; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.stat .icon { color: var(--navy); }
.stat__value { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1; letter-spacing: -0.02em; }
.stat__value small { font-size: 13px; font-weight: 600; margin-left: 2px; }
.stat__label { font-size: 11px; font-weight: 600; color: var(--navy-75); letter-spacing: .04em; text-transform: uppercase; line-height: 1.25; }
.stat--wide { aspect-ratio: auto; min-height: 112px; gap: 14px; }
@media (max-width: 380px) { .stat { padding: 12px 10px; } .stat__value { font-size: 26px; } .stat__label { font-size: 10px; } }
@media (min-width: 720px) { .stat { aspect-ratio: auto; min-height: 120px; } }

/* week strip */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week__day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--navy-75); }
.week__sq { width: 100%; aspect-ratio: 1 / 1; max-width: 44px; border: 1px solid var(--navy-30); display: grid; place-items: center; color: var(--white); transition: background .3s; }
.week__sq.is-done { background: var(--navy); border-color: var(--navy); }
.week__sq.is-planned { border-style: dashed; border-color: var(--navy-60); }
.week__sq.is-rest { background: var(--surface); border-color: var(--surface); color: var(--navy-60); font-size: 10px; }
.week__day.is-today { color: var(--navy); }
.week__day.is-today .week__sq:not(.is-done) { border: 2px solid var(--navy); }

/* progress bar */
.bar { height: 6px; background: var(--navy-10); overflow: hidden; }
.bar__fill { height: 100%; background: var(--navy); width: 0; transition: width .9s var(--ease); }
.bar--light { background: rgba(255,255,255,.25); }
.bar--light .bar__fill { background: var(--white); }

/* lists */
.list { border-top: 1px solid var(--line); }
.list__item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); color: inherit; width: 100%; text-align: left; }
.list__item .icon { color: var(--navy); }
.list__title { font-weight: 600; color: var(--text); }
.list__sub { font-size: 13px; color: var(--navy-75); }
.list__num { width: 28px; height: 28px; display: grid; place-items: center; background: var(--navy-10); color: var(--navy); font-weight: 700; font-size: 13px; flex: none; }
a.list__item:hover, button.list__item:hover { background: var(--navy-05); }

/* check items (habits, grocery) */
.check { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; color: var(--text); }
.check__box { width: 24px; height: 24px; border: 1.5px solid var(--navy); display: grid; place-items: center; flex: none; color: var(--white); transition: background .2s; }
.check__box .icon { width: 16px; height: 16px; stroke-width: 2.5; transform: scale(0); transition: transform .25s var(--ease); }
.check.is-on .check__box { background: var(--navy); }
.check.is-on .check__box .icon { transform: scale(1); }
.check.is-on.pop .check__box .icon { animation: pop .35s var(--ease); }
.check.is-on .check__text { color: var(--navy-75); text-decoration: line-through; text-decoration-color: var(--navy-30); }
.check__text { flex: 1; min-width: 0; }
.check__meta { font-size: 12px; color: var(--navy-75); white-space: nowrap; }
.check .icon.habit-ic { color: var(--navy-60); }
@keyframes pop { 0% { transform: scale(0); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* tabs (sub navigation) */
.subtabs { display: flex; border-bottom: 1px solid var(--line); margin: 0 calc(-1 * var(--gutter)) 20px; padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; position: sticky; top: calc(var(--header-h) + var(--safe-t)); background: var(--white); z-index: 20; }
.subtabs::-webkit-scrollbar { display: none; }
.subtab { height: 46px; padding: 0 2px; margin-right: 24px; font-weight: 600; color: var(--navy-75); border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; transition: color .2s, border-color .2s; }
.subtab[aria-current="page"] { color: var(--navy); border-bottom-color: var(--navy); }
@media (min-width: 960px) { .subtabs { margin-left: 0; margin-right: 0; padding: 0; top: calc(var(--header-h) + var(--safe-t)); } }

/* filter chips */
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter); }
.filters::-webkit-scrollbar { display: none; }
.fchip { height: 36px; padding: 0 12px; border: 1px solid var(--line); background: var(--white); color: var(--navy); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; transition: background .2s, border-color .2s; }
.fchip:hover { border-color: var(--navy-30); }
.fchip.is-on { background: var(--navy); color: var(--white); border-color: var(--navy); }
.fchip.is-set { background: var(--navy-10); border-color: var(--navy-10); }

/* forms */
.field { display: block; }
.field + .field { margin-top: 16px; }
.field__label { display: block; font-size: 12px; font-weight: 700; color: var(--navy); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.input {
  width: 100%; height: 52px; padding: 0 16px; background: var(--surface); border: 1px solid var(--surface); color: var(--text); font-size: 16px; transition: border-color .2s, background .2s;
}
.input:focus { outline: none; border-color: var(--navy); background: var(--white); }
.input::placeholder { color: #8F96A8; }
.input--sm { height: 44px; font-size: 15px; }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--navy-60); pointer-events: none; }
.search .input { padding-left: 44px; height: 48px; }
.field__hint { font-size: 13px; color: var(--navy-75); margin-top: 8px; }
#login-msg > div { margin-bottom: 16px; }
.error { background: #FBEFEF; color: var(--danger); padding: 12px 14px; font-size: 14px; border-left: 3px solid var(--danger); }
.notice { background: var(--navy-10); color: var(--navy); padding: 12px 14px; font-size: 14px; border-left: 3px solid var(--navy); }

.option { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; background: var(--surface); border: 1.5px solid var(--surface); text-align: left; transition: background .2s, border-color .2s; color: var(--text); }
.option + .option { margin-top: 10px; }
.option:hover { border-color: var(--navy-30); }
.option.is-on { background: var(--navy-10); border-color: var(--navy); }
.option__icon { width: 44px; height: 44px; display: grid; place-items: center; background: var(--white); color: var(--navy); flex: none; }
.option__title { font-weight: 700; color: var(--navy); }
.option__sub { font-size: 13px; color: var(--navy-75); }
.option__mark { margin-left: auto; width: 22px; height: 22px; border: 1.5px solid var(--navy-60); display: grid; place-items: center; color: var(--white); flex: none; }
.option.is-on .option__mark { background: var(--navy); border-color: var(--navy); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 1px solid var(--navy); }
.seg button { height: 48px; font-weight: 700; color: var(--navy); border-right: 1px solid var(--navy); transition: background .2s; }
.seg button:last-child { border-right: 0; }
.seg button.is-on { background: var(--navy); color: var(--white); }
.seg--sm button { height: 36px; font-size: 13px; }

.toggle { width: 48px; height: 28px; background: var(--navy-30); position: relative; transition: background .2s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: var(--white); transition: transform .2s var(--ease); }
.toggle.is-on { background: var(--navy); }
.toggle.is-on::after { transform: translateX(20px); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); }
.stepper button { width: 36px; height: 36px; display: grid; place-items: center; color: var(--navy); }
.stepper button:hover { background: var(--navy-05); }
.stepper span { min-width: 36px; text-align: center; font-weight: 700; color: var(--navy); }

/* ------------------------------------------------------------ login */
.auth { min-height: 100vh; display: grid; }
.auth__media { position: relative; min-height: 34vh; }
.auth__media .media { position: absolute; inset: 0; }
.auth__media .media__shade { background: linear-gradient(180deg, rgba(20,31,62,.15), rgba(20,31,62,.65)); }
.auth__media-copy { position: absolute; left: 24px; right: 24px; bottom: 22px; color: var(--white); }
.auth__panel { padding: 28px 24px 40px; display: flex; flex-direction: column; justify-content: center; max-width: 480px; width: 100%; margin: 0 auto; }
.auth__panel h1 { margin: 14px 0 8px; }
.auth__foot { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--navy-75); }
@media (min-width: 960px) {
  .auth { grid-template-columns: 1.1fr 1fr; }
  .auth__media { min-height: 100vh; }
  .auth__media-copy { left: 48px; bottom: 48px; max-width: 460px; }
  .auth__panel { padding: 48px; }
}

/* ------------------------------------------------------------ onboarding */
.onb { min-height: 100vh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 24px calc(24px + var(--safe-b)); }
.onb__top { display: flex; align-items: center; gap: 12px; height: 48px; }
.onb__steps { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.onb__steps span { height: 3px; background: var(--navy-10); transition: background .3s; }
.onb__steps span.is-on { background: var(--navy); }
.onb__body { flex: 1; padding: 28px 0 24px; }
.onb__body h1 { margin: 10px 0 8px; }
.onb__foot { display: flex; gap: 10px; position: sticky; bottom: 0; background: var(--white); padding-top: 12px; }
.onb__foot .btn { flex: 1; }
.gear-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gear-opt { display: flex; flex-direction: column; background: var(--surface); border: 1.5px solid var(--surface); text-align: left; position: relative; transition: border-color .2s, background .2s; }
.gear-opt .media { aspect-ratio: 1 / 1; background: #fff; }
.gear-opt span.gear-opt__name { padding: 10px 12px; font-weight: 700; font-size: 14px; color: var(--navy); }
.gear-opt.is-on { border-color: var(--navy); background: var(--navy-10); }
.gear-opt .option__mark { position: absolute; top: 8px; right: 8px; background: var(--white); z-index: 2; }
.gear-opt.is-on .option__mark { background: var(--navy); }
.gear-opt--none { justify-content: center; align-items: center; min-height: 100%; aspect-ratio: auto; padding: 24px; }
@media (min-width: 560px) { .gear-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ------------------------------------------------------------ meals */
.daypick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.daypick button { height: 56px; border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--navy-75); gap: 2px; }
.daypick button b { font-size: 16px; color: var(--navy); }
.daypick button.is-on { background: var(--navy); border-color: var(--navy); color: rgba(255,255,255,.8); }
.daypick button.is-on b { color: var(--white); }
.daypick button.is-today:not(.is-on) { border-color: var(--navy); }
.mslot { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mslot__img { width: 76px; flex: none; }
.mslot__img .rtile .icon { width: 30px; height: 30px; stroke-width: 1.4; }
.mslot__body { flex: 1; min-width: 0; }
.mslot__title { font-weight: 700; color: var(--navy); line-height: 1.25; display: block; }
.mslot__meta { font-size: 12px; color: var(--navy-75); margin-top: 2px; }
.mslot__actions { display: flex; gap: 4px; }
.mtable { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mtable th { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--navy-75); text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.mtable th.is-today { color: var(--navy); }
.mtable td { vertical-align: top; padding: 6px; border-bottom: 1px solid var(--line); }
.mtable td.mtable__meal { width: 92px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--navy); padding-top: 14px; }
.mcell { display: block; width: 100%; min-height: 76px; padding: 8px; background: var(--surface); text-align: left; font-size: 12px; font-weight: 600; color: var(--navy); line-height: 1.3; transition: background .2s; }
.mcell:hover { background: var(--navy-10); }
.mcell small { display: block; font-weight: 500; color: var(--navy-75); margin-top: 4px; }
.mcell--empty { background: var(--white); border: 1px dashed var(--navy-30); color: var(--navy-60); display: grid; place-items: center; }
.desktop-only { display: none; }
@media (min-width: 960px) { .desktop-only { display: block; } .mobile-only { display: none !important; } }

.macros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.macros div { background: var(--white); padding: 12px 6px; text-align: center; }
.macros b { display: block; font-size: 18px; color: var(--navy); font-weight: 800; }
.macros span { font-size: 11px; color: var(--navy-75); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ing { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ing__qty { width: 84px; flex: none; font-weight: 700; color: var(--navy); }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(step); width: 28px; height: 28px; background: var(--navy); color: var(--white); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

/* ------------------------------------------------------------ train */
.exlist { counter-reset: ex; }
.exrow { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.exrow__num { width: 28px; height: 28px; background: var(--navy-10); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.exrow__name { font-weight: 700; color: var(--navy); }
.exrow__meta { font-size: 13px; color: var(--navy-75); margin-top: 2px; }
.exrow__cue { font-size: 13px; color: var(--text); margin-top: 4px; }
.day-row { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; width: 100%; text-align: left; }
.day-row__n { width: 44px; flex: none; font-size: 11px; font-weight: 700; color: var(--navy-75); letter-spacing: .06em; text-transform: uppercase; }
.day-row__n b { display: block; font-size: 18px; color: var(--navy); letter-spacing: 0; }
.day-row.is-rest .day-row__title { color: var(--navy-75); font-weight: 500; }
.day-row.is-done .day-row__n b { color: var(--success); }
.day-row.is-today { background: var(--navy-05); margin: 0 -10px; padding-left: 10px; padding-right: 10px; width: calc(100% + 20px); }
.day-row__title { font-weight: 700; color: var(--navy); }
.week-label { padding: 18px 0 8px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal__dow { font-size: 11px; font-weight: 700; color: var(--navy-75); text-align: center; padding-bottom: 6px; letter-spacing: .06em; }
.cal__day { aspect-ratio: 1 / 1; border: 1px solid var(--line); padding: 5px; display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--text); text-align: left; position: relative; transition: border-color .2s; min-width: 0; }
.cal__day:hover { border-color: var(--navy-60); }
.cal__day.is-out { visibility: hidden; }
.cal__day.is-today { border: 2px solid var(--navy); }
.cal__day.is-planned { background: var(--navy-05); }
.cal__day.is-done { background: var(--navy); border-color: var(--navy); color: var(--white); }
.cal__day.is-rest .cal__mark { color: var(--navy-60); }
.cal__day.is-sel { outline: 2px solid var(--navy); outline-offset: 2px; }
.cal__mark { font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--navy); }
.cal__day.is-done .cal__mark { color: var(--white); }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--navy-75); margin-top: 12px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 12px; height: 12px; display: inline-block; border: 1px solid var(--line); }
@media (min-width: 720px) { .cal__day { padding: 8px; font-size: 13px; } .cal__mark { font-size: 10px; } }

/* ------------------------------------------------------------ player */
.player { position: fixed; inset: 0; z-index: 60; background: var(--white); display: flex; flex-direction: column; animation: viewIn .3s var(--ease); }
.player__top { display: flex; align-items: center; gap: 12px; padding: calc(8px + var(--safe-t)) 12px 8px; }
.player__progress { flex: 1; height: 4px; background: var(--navy-10); }
.player__progress div { height: 100%; background: var(--navy); transition: width .4s var(--ease); }
.player__stage { position: relative; flex: none; height: 32vh; min-height: 200px; background: var(--navy); color: var(--white); overflow: hidden; }
.player__stage .media { position: absolute; inset: 0; }
.player__stage .media img { opacity: .5 !important; }
.player__stage .media::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(40,62,123,.35), rgba(40,62,123,.9)); }
.player__stage-copy { position: absolute; left: 20px; right: 20px; bottom: 18px; z-index: 2; }
.player__ex { font-size: 28px; font-weight: 800; color: var(--white); line-height: 1.1; margin-top: 6px; }
.player__body { flex: 1; overflow-y: auto; padding: 20px 20px 12px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.ring { position: relative; width: 168px; height: 168px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .ring__bg { stroke: var(--navy-10); }
.ring .ring__fg { stroke: var(--navy); stroke-linecap: butt; transition: stroke-dashoffset 1s linear; }
.ring__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring__value { font-size: 46px; font-weight: 800; color: var(--navy); line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring__unit { font-size: 12px; font-weight: 700; color: var(--navy-75); letter-spacing: .12em; text-transform: uppercase; margin-top: 6px; }
.cues { text-align: left; width: 100%; max-width: 420px; margin-top: 18px; }
.cues li { padding: 6px 0 6px 18px; position: relative; font-size: 14px; }
.cues li::before { content: ''; position: absolute; left: 0; top: 14px; width: 6px; height: 6px; background: var(--navy); }
.cues ul { list-style: none; margin: 0; padding: 0; }
.player__side { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.player__body { min-height: 0; }
.player__next { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.player__controls { display: flex; gap: 10px; padding: 12px 20px calc(12px + var(--safe-b)); }
.player__controls .btn { flex: 1; }
.player__controls .btn--icon { flex: none; width: 56px; padding: 0; }
.player.is-rest .player__stage { background: var(--navy-10); color: var(--navy); }
.player.is-rest .player__stage .media { display: none; }
.player.is-rest .player__ex { color: var(--navy); }
.player.is-rest .label--light { color: var(--navy-75); }
@media (min-width: 960px) {
  .player { flex-direction: row; flex-wrap: wrap; }
  .player__top { width: 100%; }
  .player__stage { height: auto; width: 50%; min-height: 0; }
  .player__side { width: 50%; display: flex; flex-direction: column; }
  .player__body { justify-content: center; }
  .player { height: 100vh; }
  .player__top { height: 64px; }
  .player__stage, .player__side { height: calc(100vh - 64px); }
}
.finish { text-align: center; padding: 32px 24px; max-width: 520px; margin: 0 auto; }
.finish__check { width: 80px; height: 80px; background: var(--navy); color: var(--white); display: grid; place-items: center; margin: 0 auto 20px; animation: pop .5s var(--ease); }
.finish__check .icon { width: 40px; height: 40px; stroke-width: 2.5; }

/* ------------------------------------------------------------ progress */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 600 10px var(--font); fill: var(--navy-75); }
.chart .bar-rect { fill: var(--navy); transform-origin: bottom; transform-box: fill-box; animation: grow .8s var(--ease) both; }
.chart .bar-rect.is-zero { fill: var(--navy-10); }
.chart .line { fill: none; stroke: var(--navy); stroke-width: 2; }
.chart .dot { fill: var(--white); stroke: var(--navy); stroke-width: 2; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.htable { width: 100%; border-collapse: collapse; }
.htable th { font-size: 11px; font-weight: 700; color: var(--navy-75); padding: 6px 2px; text-align: center; letter-spacing: .06em; }
.htable th:first-child { text-align: left; }
.htable td { padding: 6px 2px; border-top: 1px solid var(--line); text-align: center; }
.htable td:first-child { text-align: left; font-size: 13px; font-weight: 600; padding-right: 8px; }
.htable td:first-child small { display: block; font-weight: 500; color: var(--navy-75); font-size: 11px; }
.hbox { width: 28px; height: 28px; border: 1.5px solid var(--navy-30); display: inline-grid; place-items: center; color: var(--white); transition: background .2s, border-color .2s; }
.hbox.is-on { background: var(--navy); border-color: var(--navy); }
.hbox .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.hbox[disabled] { opacity: .35; cursor: default; }
@media (max-width: 380px) { .hbox { width: 24px; height: 24px; } }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 14px 8px; background: var(--surface); }
.badge__icon { width: 52px; height: 52px; margin: 0 auto 10px; background: var(--navy); color: var(--white); display: grid; place-items: center; }
.badge__icon .icon { width: 26px; height: 26px; }
.badge.is-locked .badge__icon { background: #D9D9D9; color: #9A9A9A; }
.badge.is-locked .badge__name { color: #8A8A8A; }
.badge__name { font-size: 12px; font-weight: 700; color: var(--navy); line-height: 1.25; }
.badge__sub { font-size: 11px; color: var(--navy-75); margin-top: 2px; }
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.photo { position: relative; aspect-ratio: 3 / 4; background: var(--surface); overflow: hidden; border: 2px solid transparent; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(40,62,123,.85); color: var(--white); font-size: 11px; font-weight: 600; padding: 4px 6px; }
.photo.is-sel { border-color: var(--navy); }
.photo.is-sel::after { content: '✓'; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; background: var(--navy); color: var(--white); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.photo--add { display: grid; place-items: center; text-align: center; color: var(--navy); border: 1.5px dashed var(--navy-30); background: var(--white); gap: 6px; align-content: center; font-size: 12px; font-weight: 600; cursor: pointer; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.compare figure { margin: 0; }
.compare img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.compare figcaption { font-size: 12px; font-weight: 700; color: var(--navy); padding: 6px 0; }

/* ------------------------------------------------------------ perks */
.mcard { background: var(--navy); color: var(--white); padding: 22px; position: relative; overflow: hidden; aspect-ratio: 1.586 / 1; display: flex; flex-direction: column; justify-content: space-between; max-width: 460px; }
.mcard::before { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border: 1px solid rgba(255,255,255,.14); }
.mcard::after { content: ''; position: absolute; right: -20px; top: -20px; width: 140px; height: 140px; border: 1px solid rgba(255,255,255,.1); }
.mcard__name { font-size: 20px; font-weight: 700; }
.mcard__row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.mcard__label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.7); font-weight: 700; }
.perk { display: flex; gap: 14px; align-items: flex-start; }
.perk__icon { width: 44px; height: 44px; background: var(--white); color: var(--navy); display: grid; place-items: center; flex: none; }
.card--white .perk__icon { background: var(--navy-10); }
.drop { width: 148px; color: inherit; }
.drop .media { background: #fff; border: 1px solid var(--line); }
.drop__name { font-weight: 700; color: var(--navy); font-size: 14px; margin-top: 8px; }
.drop__price { font-size: 13px; color: var(--navy-75); }
.drop__price s { color: var(--navy-60); margin-right: 4px; }

/* ------------------------------------------------------------ gear */
.gcard { display: block; color: inherit; background: var(--white); border: 1px solid var(--line); transition: border-color .2s; }
.gcard:hover { border-color: var(--navy-30); }
.gcard .media { background: #fff; }
.gcard__body { padding: 10px 12px 12px; }
.gcard__name { font-weight: 700; color: var(--navy); font-size: 14px; }
.gcard__cat { font-size: 12px; color: var(--navy-75); }
.gear-row { display: flex; gap: 12px; }
.gear-row .gcard { width: 140px; flex: none; }

/* ------------------------------------------------------------ sheet / modal */
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(20,31,62,.45); animation: fade .2s ease; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--white); width: 100%; max-width: 640px; max-height: 88vh; display: flex; flex-direction: column; animation: up .3s var(--ease); padding-bottom: var(--safe-b); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet__body { padding: 16px 20px 24px; overflow-y: auto; }
.sheet__foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet__foot .btn { flex: 1; }
@media (min-width: 720px) { .sheet-backdrop { align-items: center; } .sheet { max-height: 80vh; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); transform: translateX(-50%); z-index: 90;
  background: var(--navy); color: var(--white); padding: 12px 18px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 10px;
  animation: up .3s var(--ease); max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(20,31,62,.18);
}
@media (min-width: 960px) { .toast { bottom: 28px; left: calc(50% + var(--sidebar-w) / 2); } }

.offline { background: var(--navy-10); color: var(--navy); font-size: 13px; font-weight: 600; padding: 8px var(--gutter); display: flex; gap: 8px; align-items: center; justify-content: center; }

.disclaimer { font-size: 12px; color: var(--navy-75); padding: 12px 14px; background: var(--surface); margin-top: 28px; display: flex; gap: 10px; align-items: flex-start; }
.disclaimer .icon { color: var(--navy-60); width: 16px; height: 16px; margin-top: 1px; }

.empty { text-align: center; padding: 32px 16px; background: var(--surface); }
.empty .icon { color: var(--navy-60); margin: 0 auto 10px; }

.footer-note { font-size: 12px; color: var(--navy-75); text-align: center; padding: 24px 0 8px; }

.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 16px 0; font-weight: 700; color: var(--navy); display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 20px; line-height: 1; font-weight: 400; }
.faq details[open] summary::after { content: '–'; }
.faq details p { padding: 0 0 16px; color: var(--text); }

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