:root {
  --bg: #E8EAEB;
  --surface: #F7F8F8;
  --ink: #1A2230;
  --muted: #5F6875;
  --rule: #C9CED3;
  --navy: #2C3E50;       /* matches the app icon */
  --accent: #27AE60;     /* icon green, for bars and lines (not text) */
  --on-navy: #FFFFFF;
  --heavy: #B8322A;
  --light: #2E6DB4;
  --good: #1F7A45;
  --good-bg: #D3EEDC;
  --great: #FFFFFF;
  --great-bg: #1F6B3E;
  --fair: #8A5A00;
  --fair-bg: #FBE8B8;
  --bad: #A3261E;
  --bad-bg: #F8D3CF;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --tabs-h: 3.6rem;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151A20; --surface: #1E252D; --ink: #E7EAED; --muted: #9AA3AD;
    --rule: #333C46; --navy: #8FB3E0; --accent: #3CCB7A; --on-navy: #10161D;
    --heavy: #E8665D; --light: #6FA6E8; --good: #5CC98A;
    --good-bg: #173524; --great: #0E1A12; --great-bg: #5CC98A; --fair: #F2C14E; --fair-bg: #3A2E10; --bad: #F08A80; --bad-bg: #3E1A17;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--body); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--light); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
.page { max-width: 34rem; margin: 0 auto; padding-left: 1.1rem; padding-right: 1.1rem; }
.muted { color: var(--muted); }
.brand { font: 700 1.25rem/1 var(--display); letter-spacing: .02em; color: var(--navy); }
.linkbtn { background: none; border: 0; color: var(--muted); font-size: .9rem; padding: .4rem; }

/* Forms */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
input, select { width: 100%; font: inherit; padding: .65rem .75rem; border: 1px solid var(--rule); border-radius: 8px;
                background: var(--surface); color: var(--ink); }
input[type="checkbox"], input[type="radio"] { width: auto; }
.primary { font-weight: 600; padding: .75rem 1rem; border: 0; border-radius: 8px; background: var(--navy); color: var(--on-navy); }
.secondary { font-weight: 600; padding: .7rem 1rem; border: 1.5px solid var(--navy); border-radius: 8px; background: none; color: var(--navy); }
.small { padding: .4rem .75rem; font-size: .9rem; }
.textbtn { background: none; border: 0; padding: .3rem 0; color: var(--muted); font-size: .88rem; text-decoration: underline; }
button:disabled { opacity: .55; cursor: default; }
.error { color: var(--heavy); font-size: .9rem; min-height: 1.3em; margin-top: .75rem; }

/* Login */
.login { padding-top: 2rem; }
.login h1 { font: 700 2.6rem/1 var(--display); margin: 2rem 0 .5rem; }
.login p { margin: 0 0 1.5rem; }
.login input { margin-bottom: 1rem; }
.login .primary { width: 100%; }

/* App frame */
.topbar { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; }
#view { padding-top: 1rem; padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 2rem); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--surface);
        border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs button { flex: 1; height: var(--tabs-h); background: none; border: 0; font-weight: 600; color: var(--muted);
               border-top: 3px solid transparent; }
.tabs button[aria-current="page"] { color: var(--ink); border-top-color: var(--ink); }

/* Day header */
.daynav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem; }
.navbtn { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface);
          font-size: 1.4rem; line-height: 1; }
.day { font: 700 3.2rem/.9 var(--display); margin: 0; }
.sub { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; color: var(--muted); margin: .45rem 0 1.6rem; }
.where { font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--rule);
         padding: .15rem .6rem; border-radius: 999px; font-size: .9rem; }
.where.travel { border-color: var(--light); color: var(--light); }

/* Slots and items */
.slot { border-top: 4px solid var(--ink); padding-top: .6rem; margin-bottom: 2rem; }
.slot h2 { font: 700 1.1rem/1 var(--display); letter-spacing: .04em; margin: 0 0 .4rem; color: var(--muted); }
.item { padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.item:last-child { border-bottom: 0; }
.itemhead { display: grid; grid-template-columns: 1fr auto; gap: .15rem 1rem; align-items: center; }
.name { font-weight: 600; }
.meta { color: var(--muted); font-size: .88rem; }
.weight { grid-row: 1 / span 2; grid-column: 2; font: 700 2rem/1 var(--display); text-align: right; }
.weight small { font-size: .9rem; color: var(--muted); margin-left: .15rem; }
.tag { font-size: .72rem; font-weight: 700; padding: .05rem .45rem; border-radius: 4px; margin-left: .4rem;
       vertical-align: .1rem; border: 1.5px solid currentColor; }
.tag.heavy { color: var(--heavy); }
.tag.light { color: var(--light); }
.tag.optional { color: var(--muted); }
.tag.done { color: var(--good); }
.tag.waiting { color: var(--fair); background: var(--fair-bg); }

.targets { margin: .4rem 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; font-size: .92rem; }
.targets li { display: contents; }
.targets span:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.logged { list-style: none; margin: .55rem 0 0; padding: 0; font-size: .92rem; }
.logged li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .3rem 0;
             border-top: 1px dashed var(--rule); font-variant-numeric: tabular-nums; }
.logged .x { background: none; border: 0; color: var(--muted); font-size: 1.2rem; line-height: 1; padding: .2rem .4rem; }
.actions { display: flex; gap: .6rem; align-items: center; margin-top: .6rem; flex-wrap: wrap; }

/* Inline editor */
.editor { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: .85rem; margin-top: .6rem; }
.editor h3 { margin: 0 0 .6rem; font-size: .95rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; }
.setrow { display: grid; grid-template-columns: 3.2rem 1fr 1fr; gap: .5rem; align-items: center; margin-bottom: .45rem; }
.setrow .n { color: var(--muted); font-size: .88rem; }
.fieldrow { display: grid; grid-template-columns: 1fr 6.5rem; gap: .75rem; align-items: center; margin-bottom: .45rem; }
.fieldrow input, .setrow input { text-align: center; font-variant-numeric: tabular-nums; }

.summary { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .7rem; }

/* Cards (trips, lifts) */
.pagehead { font: 700 2.4rem/1 var(--display); margin: 0 0 1.2rem; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 1rem; margin-bottom: 1.2rem; }
.panel h2 { margin: 0 0 .75rem; font-size: 1.05rem; }
.panel.current { border: 2px solid var(--light); }
.stack > * + * { margin-top: .7rem; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .95rem; color: var(--ink); margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--rule); }
.list li:first-child { border-top: 0; }

.lift { padding: 1rem 0; border-top: 1px solid var(--rule); }
.lift:first-of-type { border-top: 0; }
.lifthead { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.lifthead .weight { font-size: 1.8rem; }
.bar { height: 6px; background: var(--rule); border-radius: 3px; margin: .5rem 0 .3rem; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--navy); }

/* Toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 1rem);
         transform: translateX(-50%); max-width: min(30rem, calc(100% - 2rem)); background: var(--ink); color: var(--bg);
         padding: .75rem 1rem; border-radius: 10px; font-size: .95rem; box-shadow: 0 6px 20px rgba(0,0,0,.25);
         opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--heavy); color: #fff; }

/* Offline banner */
.offlinebar { margin: .75rem 0 0; padding: .6rem .8rem; border-radius: 8px; background: var(--fair-bg);
              color: var(--fair); font-size: .9rem; font-weight: 600; }
.outboxbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem .8rem; }
.outboxbar .textbtn { color: inherit; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* Profile */
.who { font-size: .9rem; color: var(--muted); margin-right: .25rem; }
.section { font: 700 1.1rem/1 var(--display); letter-spacing: .04em; color: var(--muted); margin: 1.4rem 0 .6rem;
           padding-top: .6rem; border-top: 4px solid var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 30rem) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: .7rem .8rem; }
.tlabel { font-size: .78rem; font-weight: 600; color: var(--muted); }
.tvalue { font: 700 1.6rem/1.1 var(--display); margin-top: .15rem; }
.tsub { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
/* Levels always pair a color with a word, and differ in brightness as well as hue */
.tile.lv-good { background: var(--good-bg); border-color: var(--good); }
.tile.lv-good .tsub { color: var(--good); font-weight: 700; }
.tile.lv-fair { background: var(--fair-bg); border-color: var(--fair); }
.tile.lv-fair .tsub { color: var(--fair); font-weight: 700; }
.tile.lv-bad  { background: var(--bad-bg); border-color: var(--bad); }
.tile.lv-bad  .tsub { color: var(--bad); font-weight: 700; }
.tabs button { font-size: .95rem; }

/* Nutrition */
.gradecard { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-radius: 12px;
             padding: .9rem 1rem; margin-bottom: .9rem; border: 2px solid var(--rule); background: var(--surface); }
.gradeval { font: 700 3rem/1 var(--display); }
.gradeval small { font-size: 1.1rem; color: inherit; opacity: .7; margin-left: .15rem; }
.gradeword { font-weight: 700; font-size: .95rem; }
.gradecard.lv-great { background: var(--great-bg); border-color: var(--great-bg); color: var(--great); }
.gradecard.lv-great .tlabel, .gradecard.lv-great .check { color: var(--great); }
.gradecard.lv-good { background: var(--good-bg); border-color: var(--good); }
.gradecard.lv-good .gradeword { color: var(--good); }
.gradecard.lv-fair { background: var(--fair-bg); border-color: var(--fair); }
.gradecard.lv-fair .gradeword { color: var(--fair); }
.gradecard.lv-bad { background: var(--bad-bg); border-color: var(--bad); }
.gradecard.lv-bad .gradeword { color: var(--bad); }
.gradecard.lv-none .gradeword { color: var(--muted); }
.donebox { font-weight: 600; white-space: nowrap; }
.donebox input { width: 1.2rem; height: 1.2rem; }

.nhead, .nrow { display: grid; grid-template-columns: 5.2rem 1fr 1fr 3.4rem; gap: .5rem; align-items: center; }
.nhead { font-size: .78rem; color: var(--muted); font-weight: 600; padding: 0 .6rem .25rem; }
.nhead span:not(:first-child), .nrow span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.nrow { padding: .55rem .6rem; border-radius: 8px; margin-bottom: .35rem; border-left: 5px solid var(--rule); background: var(--surface); }
.nrow.lv-good { border-left-color: var(--good); }
.nrow.lv-fair { border-left-color: var(--fair); background: var(--fair-bg); }
.nrow.lv-bad  { border-left-color: var(--bad); background: var(--bad-bg); }
.nlabel { font-weight: 600; }
.neaten { font-weight: 700; }
.ntarget, .npts { color: var(--muted); font-size: .88rem; }
.actions.water { margin: .2rem 0 1.6rem; }
.mealtime { margin: -.15rem 0 .45rem; }
.mealtot { float: right; font: 600 .82rem var(--body); letter-spacing: 0; color: var(--muted); }
.logged li > span .meta { display: block; }

.foodlist { max-height: 22rem; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
            margin-top: .5rem; border: 1px solid var(--rule); border-radius: 8px; padding: .3rem .5rem; background: var(--bg); }
.foodrow { display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid var(--rule); }
.foodrow:last-child { border-bottom: 0; }
.foodrow .foodopt { flex: 1; border-bottom: 0; }
.foodrow .textbtn { flex: none; padding: .4rem .2rem; }
.foodedit { padding: .4rem 0 .6rem; border-bottom: 1px solid var(--rule); }
.foodedit .editor { margin: 0; }
.listhead { margin: .6rem 0 .1rem; font-weight: 600; }
.listhead:first-child { margin-top: .2rem; }
.foodopt { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; background: none;
           border: 0; border-bottom: 1px solid var(--rule); padding: .55rem .2rem; }
.foodopt:last-child { border-bottom: 0; }
.pending { margin-top: .7rem; }
.pendrow { display: grid; grid-template-columns: 4rem 1fr auto; gap: .5rem; align-items: center; margin-bottom: .35rem; }
.pendrow input { text-align: center; padding: .45rem; }
.pendrow .x { background: none; border: 0; color: var(--muted); font-size: 1.2rem; }

.balance { font-variant-numeric: tabular-nums; }
.balance > div { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; }
.balance .sum { border-top: 1px solid var(--rule); font-weight: 700; }
.tile.lv-none { opacity: .85; }
.tiles.two { grid-template-columns: 1fr; }
@media (min-width: 30rem) { .tiles.two { grid-template-columns: 1fr 1fr; } }
.libedit { display: block !important; }
.tabs button { font-size: .88rem; }
.tile.lv-great { background: var(--great-bg); border-color: var(--great-bg); color: var(--great); }
.tile.lv-great .tlabel, .tile.lv-great .tsub { color: var(--great); font-weight: 700; }

.gradeside { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }
.gradecard.lv-great .textbtn { color: var(--great); }
.travelnote { border-color: var(--light); font-size: .95rem; }
.dimmed { opacity: .55; }
.nrow.lv-none { border-left-color: var(--rule); }

/* Tables */
.tablewrap { overflow-x: auto; margin: .6rem 0 .3rem; }
.ptable { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.ptable th, .ptable td { padding: .45rem .4rem; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.ptable thead th { font-size: .78rem; color: var(--muted); font-weight: 600; }
.ptable tbody th { text-align: left; font-weight: 600; }
.ptable tr.strong td, .ptable tr.strong th { font-weight: 700; }
.ptable .total { font-weight: 700; background: var(--surface); }
.mealgrid td { color: var(--muted); }
.mealgrid td.total { color: var(--ink); }
.lvtext-good { color: var(--good); }
.lvtext-fair { color: var(--fair); }
.lvtext-bad  { color: var(--bad); }

.weighrow { display: grid; grid-template-columns: auto 4.6rem auto auto 4.2rem auto 1fr; gap: .45rem; align-items: center;
            background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: .6rem .75rem; margin-bottom: 1.4rem; }
.weighrow label { margin: 0; font-weight: 600; color: var(--ink); font-size: .95rem; white-space: nowrap; }
.weighrow input { text-align: center; padding: .45rem; }
.weighrow button { justify-self: end; }
/* Narrow phones: weight and body fat on the first line, the button under them */
@media (max-width: 430px) {
  .weighrow { grid-template-columns: auto 4.4rem auto auto 4rem auto; }
  .weighrow button { grid-column: 1 / 3; justify-self: start; }
}

/* Wide screens: laptop and desktop */
@media (min-width: 60rem) {
  .page { max-width: 68rem; padding-left: 2rem; padding-right: 2rem; }
  #app { padding-top: var(--tabs-h); }
  .tabs { top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--rule); justify-content: center; padding-bottom: 0; z-index: 5; }
  .tabs button { flex: 0 1 9rem; border-top: 0; border-bottom: 3px solid transparent; font-size: .95rem; }
  .tabs button[aria-current="page"] { border-bottom-color: var(--ink); }
  #view { padding-bottom: 3rem; }
  #toast { bottom: 1.5rem; }
  .twocol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
  .slots { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tiles.two { grid-template-columns: 1fr 1fr; }
  .login { max-width: 26rem; }
}

#forgot-btn { margin-top: .4rem; }

/* Plan */
.seg { display: flex; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 3px; margin-bottom: 1rem; }
.seg button { flex: 1; border: 0; background: none; padding: .55rem .4rem; border-radius: 8px; font-weight: 600; color: var(--muted); font-size: .92rem; }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); }
.seg.small button { padding: .4rem; font-size: .88rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--rule); background: var(--surface);
        border-radius: 999px; padding: .35rem .7rem; font-weight: 600; font-size: .9rem; margin: 0; color: var(--ink); }
.chip small { font-weight: 700; color: var(--muted); font-size: .72rem; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-pressed="true"] small { color: var(--bg); opacity: .75; }
.slot.plain { margin-bottom: 1.4rem; }
.planlist { list-style: none; margin: 0; padding: 0; }
.planrow { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--rule); }
.rowbtns { display: flex; align-items: center; gap: .15rem; flex-shrink: 0; }
.iconbtn { width: 2rem; height: 2rem; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface); line-height: 1; }
.planrow .x { background: none; border: 0; color: var(--muted); font-size: 1.25rem; padding: .2rem .45rem; }
.circrow { display: grid; grid-template-columns: 1fr 7rem; gap: .6rem; align-items: center; margin-bottom: .35rem; }
.circrow input[data-pe-max] { text-align: center; padding: .45rem; }
.presets li.current { background: var(--surface); margin: 0 -.5rem; padding-left: .5rem; padding-right: .5rem; border-radius: 8px; }

/* Progress chart */
.chartcard { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: .9rem; }
.charthead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .6rem; margin-bottom: .4rem; }
.charthead .seg { margin: 0; }
.charthead .seg button { padding: .3rem .6rem; }
.stats { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-variant-numeric: tabular-nums; }
.stats strong { font: 700 1.25rem/1.1 var(--display); }
.chart { width: 100%; height: auto; display: block; }
.chart .gl { stroke: var(--rule); stroke-width: 1; }
.chart .ax { fill: var(--muted); font: 11px var(--body); }
.chart .avg { fill: none; stroke: var(--navy); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--muted); opacity: .75; }
.chart .tgt { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 6 5; }
.chart .tgtlabel { fill: var(--good); font: 700 11px var(--body); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.legend i { display: inline-block; vertical-align: middle; margin-right: .35rem; }
.k-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); }
.k-avg { width: 1rem; height: 3px; background: var(--navy); }
.k-tgt { width: 1rem; border-top: 2px dashed var(--good); }

/* Deload */
.panel.deload { border: 2px solid var(--light); font-size: .95rem; }
.panel.deload.soft { border-width: 1px; }
.panel.deload.due { border-color: var(--fair); background: var(--fair-bg); }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: .45rem; }
.logo { width: 1.7rem; height: 1.7rem; border-radius: 7px; display: block; }
.login .logo { width: 2.2rem; height: 2.2rem; border-radius: 9px; }
.bar span { background: var(--accent); }
.chart .tgt { stroke: var(--accent); }
.chart .tgtlabel { fill: var(--good); }
.k-tgt { border-top-color: var(--accent); }

/* Circuit grid */
table.grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.grid th { font-size: .78rem; color: var(--muted); font-weight: 600; padding: .25rem; text-align: center; white-space: nowrap; }
table.grid tbody th { font-size: .9rem; color: var(--ink); }
table.grid td { padding: .2rem; }
table.grid td input { width: 100%; min-width: 3.2rem; text-align: center; padding: .45rem .2rem; }
table.grid td.na { text-align: center; color: var(--muted); }
.logged .rowbtns .textbtn { margin-right: .2rem; }

/* Grade while in progress: colored outline and label, fill only when finished */
.gradecard.soft { background: var(--surface) !important; color: var(--ink) !important; border-width: 3px; }
.gradecard.soft.lv-great { border-color: var(--great-bg); }
.gradecard.soft.lv-great .gradeword, .gradecard.soft.lv-great .tlabel, .gradecard.soft.lv-great .check, .gradecard.soft.lv-great .textbtn { color: var(--good); }
.gradecard.soft .tlabel { color: var(--muted); }
.gradecard.soft .check { color: var(--ink); }
.gradecard.soft .textbtn { color: var(--muted); }
.nrow.soft { background: var(--surface) !important; }

/* Why this score */
.reasons { list-style: none; margin: -.4rem 0 1rem; padding: 0; font-size: .92rem; }
.reasons li { display: flex; justify-content: space-between; gap: .75rem; padding: .45rem .6rem; border-left: 4px solid var(--rule);
              background: var(--surface); border-radius: 0 6px 6px 0; margin-bottom: .3rem; }
.reasons li.lv-fair { border-left-color: var(--fair); }
.reasons li.lv-bad { border-left-color: var(--bad); }
.reasons .pts { font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.reasons-ok { margin: -.4rem 0 1rem; font-weight: 600; color: var(--good); }

/* Goals */
.goal { margin: .7rem 0 1rem; }
.goalhead, .goalfoot { display: flex; justify-content: space-between; gap: 1rem; }
.goalhead .lvtext-good { font-weight: 700; }
.bar.big { height: 10px; border-radius: 5px; margin: .35rem 0 .25rem; }
.goalfoot { font-size: .82rem; }

/* Polish */
.extra-only { margin: -.8rem 0 1.4rem; }
details.totalswrap > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: .75rem; }
details.totalswrap > summary::-webkit-details-marker { display: none; }
details.totalswrap > summary h2 { margin: 0; }
details.totalswrap > summary::after { content: "Show"; margin-left: auto; font-size: .88rem; color: var(--navy); font-weight: 600; text-decoration: underline; }
details.totalswrap[open] > summary::after { content: "Hide"; }
.version { text-align: center; margin: 1.5rem 0 0; }

.goallinks { margin-top: .4rem; }

/* Photo logging */
.editor.photo .seg { margin-bottom: .7rem; }
.photodrop { position: relative; display: flex; align-items: center; justify-content: center; min-height: 8rem; margin: 0 0 .7rem;
             border: 2px dashed var(--rule); border-radius: 10px; background: var(--bg); color: var(--muted); text-align: center;
             padding: .8rem; cursor: pointer; overflow: hidden; }
.pastebox { min-height: 2.6rem; margin: 0; padding: .6rem .75rem; border: 1px solid var(--rule); border-radius: 8px;
            background: var(--surface); color: var(--muted); font-size: .9rem; caret-color: transparent; -webkit-user-select: text; user-select: text; }
.pastebox:empty::before { content: 'Or press and hold here, then tap Paste'; }
.photodrop img { max-width: 100%; max-height: 14rem; border-radius: 6px; display: block; }
.photodrop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
textarea { width: 100%; font: inherit; padding: .6rem .75rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); resize: vertical; }
.photoresult { display: grid; grid-template-columns: 5.5rem 1fr; gap: .8rem; align-items: start; }
.photoresult img { width: 100%; border-radius: 8px; }
.photoresult .items { list-style: none; margin: .4rem 0 0; padding: 0; font-size: .9rem; }
.photoresult .items li { display: flex; justify-content: space-between; gap: .6rem; padding: .2rem 0; border-bottom: 1px dashed var(--rule); }
.perserving { margin-top: .3rem; font-size: .92rem; }
.labeltotal { font-weight: 700; margin: .6rem 0; }

/* Strength levels */
.strength .lvtop { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.strength select { width: auto; padding: .35rem .5rem; }
label.inline { display: inline; margin: 0; }
.lvlegend { display: grid; grid-template-columns: repeat(5, 1fr); text-align: center; font-size: .72rem; margin-bottom: -.3rem; }
.lvrow { padding: .5rem 0 .2rem; border-top: 1px solid var(--rule); }
.lvhead, .lvfoot { display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.lvfoot { font-size: .8rem; }
.lvbar { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin: .45rem 0 .2rem; }
.lvbar span { height: 12px; background: var(--rule); border-radius: 3px; position: relative; }
.lvbar span.on { background: var(--accent); }
.lvbar span.goal { outline: 2px solid var(--navy); outline-offset: 1px; }
.lvbar span em { position: absolute; top: 14px; left: 0; right: 0; text-align: center; font-style: normal; font-size: .7rem; color: var(--muted); }
.lvbar i { position: absolute; top: -4px; width: 4px; height: 20px; margin-left: -2px; background: var(--ink); border-radius: 2px; }
.lvfoot { margin-top: 1rem; }

/* Form guides */
.howto { margin-left: .4rem; font-size: .85rem; }
.howtos { margin-top: .2rem; }
.howtos .howto { margin-left: 0; margin-right: .5rem; }
#form-dialog { border: 0; border-radius: 14px; padding: 0; width: min(36rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem);
               background: var(--bg); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
#form-dialog::backdrop { background: rgba(15, 20, 28, .55); }
.formguide { padding: 1rem 1.1rem 1.3rem; }
.fghead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.fghead h2 { font: 700 1.9rem/1 var(--display); margin: 0; }
.fghead .x { background: none; border: 0; font-size: 1.8rem; color: var(--muted); padding: .2rem .5rem; }
.formguide h3 { font-size: .95rem; margin: 1.1rem 0 .45rem; }
.cues { margin: 0; padding-left: 1.2rem; }
.cues li { margin-bottom: .4rem; line-height: 1.4; }
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; margin-bottom: .6rem; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.fgrow { display: grid; grid-template-columns: 1fr auto; gap: .5rem; margin: .6rem 0 .2rem; }
a.linkbtn2 { display: inline-block; text-decoration: none; }
.mymedia img, .mymedia video { width: 100%; border-radius: 10px; display: block; background: #000; }
.filebtn { position: relative; display: inline-block; overflow: hidden; margin-top: .3rem; cursor: pointer; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Muscle maps: primary darker, secondary lighter, always with a written list */
:root { --mm-body: #DFE3E7; --mm-idle: #C3C9D0; --mm-pri: #B03A2E; --mm-sec: #F2A39A; --mm-line: #F7F8F8; }
@media (prefers-color-scheme: dark) {
  :root { --mm-body: #2A323B; --mm-idle: #3D4752; --mm-pri: #E8665D; --mm-sec: #7E4540; --mm-line: #151A20; }
}
.musclemap { width: 100%; max-width: 22rem; display: block; margin: 0 auto; }
.musclemap .mm-body * { fill: var(--mm-body); }
.musclemap .mm-m { fill: var(--mm-idle); stroke: var(--mm-line); stroke-width: 1; }
.musclemap .mm-m.pri { fill: var(--mm-pri); }
.musclemap .mm-m.sec { fill: var(--mm-sec); }
.musclemap .mm-label { font: 600 11px var(--body); fill: var(--muted); }
.mmlegend { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; margin-top: .4rem; }
.mmlegend i { display: inline-block; width: .85rem; height: .85rem; border-radius: 3px; margin-right: .4rem; vertical-align: -.1rem; }
.mmlegend i.pri { background: var(--mm-pri); }
.mmlegend i.sec { background: var(--mm-sec); }

/* Combined muscle views: list by muscle, and the weekly shading (light = helping only, dark = 3+ days) */
:root { --mm-h1: #F6D3CE; --mm-h2: #EE9C91; --mm-h3: #D0604F; --mm-h4: #962A1F; }
@media (prefers-color-scheme: dark) {
  :root { --mm-h1: #4A2D2A; --mm-h2: #7E4239; --mm-h3: #B9584C; --mm-h4: #F08A80; }
}
.musclemap .mm-m.h1 { fill: var(--mm-h1); }
.musclemap .mm-m.h2 { fill: var(--mm-h2); }
.musclemap .mm-m.h3 { fill: var(--mm-h3); }
.musclemap .mm-m.h4 { fill: var(--mm-h4); }
.mmlegend i.h1, .mmdot.h1 { background: var(--mm-h1); }
.mmlegend i.h2, .mmdot.h2 { background: var(--mm-h2); }
.mmlegend i.h3, .mmdot.h3 { background: var(--mm-h3); }
.mmlegend i.h4, .mmdot.h4 { background: var(--mm-h4); }
.mmlegend.heat { flex-direction: row; flex-wrap: wrap; gap: .3rem 1rem; font-size: .85rem; }
.mmlist { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.mmlist li { display: flex; gap: .5rem; align-items: baseline; padding: .35rem 0; border-top: 1px solid var(--rule); }
.mmlist li:first-child { border-top: 0; }
.mmlist li > i { flex: none; width: .85rem; height: .85rem; border-radius: 3px; transform: translateY(.1rem); }
.mmlist li > i.pri { background: var(--mm-pri); }
.mmlist li > i.sec { background: var(--mm-sec); }
.mmlist .meta { display: block; }
.mmweek th, .mmweek td { text-align: left; white-space: normal; }
.mmdot { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .4rem; vertical-align: -.05rem; }

/* Stall reset suggestion */
.panel.stall { border: 2px solid var(--fair); background: var(--fair-bg); font-size: .93rem; margin: .6rem 0 0; }

/* Totals: All exercise (time and calories for every workout together) */
.alltotals { margin: .9rem 0 .4rem; padding: .9rem 1rem 1rem; border-radius: 12px; background: var(--navy); color: var(--on-navy);
             border-top: 5px solid var(--accent); }
.alltitle { margin: 0 0 .6rem; font: 700 1.1rem/1 var(--display); letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.allgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem 1rem; }
.allcell { display: flex; flex-direction: column; min-width: 0; }
.allperiod { font-size: .78rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; opacity: .75; }
.allbig { font: 700 2.4rem/1.05 var(--display); white-space: nowrap; }
.allcal { font: 700 1.5rem/1.1 var(--display); color: var(--accent); white-space: nowrap; }
.allbig small, .allcal small { font-size: .55em; font-weight: 600; opacity: .8; }
.allcal small { color: var(--on-navy); }
@media (max-width: 560px) {
  .allgrid { grid-template-columns: repeat(2, 1fr); }
  .allbig { font-size: 2.2rem; }
}
@media (prefers-color-scheme: dark) {
  /* Deep navy card in dark mode too, so the green calories stay easy to read */
  .alltotals { background: #1B2B3C; color: #F2F5F7; }
  .allcal small { color: #F2F5F7; }
}

/* Totals: one card per activity, in the same style as All exercise.
   Each card has its own accent color, the big condensed numbers, the Year column (your running
   total) a little stronger, and time and calories in a dark band along the bottom. */
:root {
  --lift: #C8681C;
  --band: #2C3E50; --band-ink: #FFFFFF;
}
@media (prefers-color-scheme: dark) {
  :root { --lift: #F0A04B; --band: #1B2B3C; --band-ink: #F2F5F7; }
}
.totalsgrid { margin-top: 1rem; }
.tstack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.totalsgrid > .tstack + .tstack { margin-top: 1rem; }
@media (min-width: 60rem) {
  .totalsgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .totalsgrid > .tstack + .tstack { margin-top: 0; }
}

.tcard { --tc: var(--accent); background: var(--surface); border: 1px solid var(--rule); border-top: 5px solid var(--tc);
         border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(20, 30, 45, .05), 0 4px 14px rgba(20, 30, 45, .05); }
.tcard.walk { --tc: var(--light); }
.tcard.weights { --tc: var(--lift); }
.tchead { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; padding: .8rem 1rem .3rem; }
.tchead h3 { margin: 0; font: 700 1.2rem/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--tc); }
.tcsub { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tcard .tablewrap { margin: 0; }

.ttable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ttable th, .ttable td { padding: .5rem .55rem; text-align: right; white-space: nowrap; vertical-align: middle; border: 0; }
.ttable th:first-child { padding-left: 1rem; text-align: left; }
.ttable th:last-child, .ttable td:last-child { padding-right: 1rem; }
.ttable thead th { padding-top: .15rem; padding-bottom: .4rem; font-size: .68rem; font-weight: 700; letter-spacing: .08em;
                   text-transform: uppercase; color: var(--muted); }
.ttable thead th:last-child { color: var(--ink); }
.ttable tbody th { font-size: .92rem; font-weight: 600; }
.ttable tbody tr:nth-child(odd) { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.ttable td { font: 600 1.25rem/1.1 var(--display); color: color-mix(in srgb, var(--ink) 78%, var(--surface)); }
.ttable td:last-child { font-weight: 700; color: var(--ink); }
.ttable td small { margin-left: .04em; font-size: .62em; font-weight: 600; color: var(--muted); }
.ttable td.zero { color: color-mix(in srgb, var(--muted) 45%, var(--surface)); font-weight: 600; }

/* Weight training: the heaviest weight sits under the average, only when it's higher */
.ttable .top { display: block; margin-top: .1rem; font: 700 .7rem/1.1 var(--body); letter-spacing: .02em; color: var(--tc); }
/* Year by year: the change against last year sits under this year's pace */
.yearcard { margin-top: 1rem; }
.ttable .chg { display: block; margin-top: .1rem; font: 700 .7rem/1.1 var(--body); letter-spacing: .02em; }
.ttable .chg.up { color: var(--good); }
.ttable .chg.down { color: var(--bad); }
.ttable .lightonly { font: 600 .78rem var(--body); color: var(--muted); }

/* The dark band: time and calories */
.ttable tfoot tr { background: var(--band); color: var(--band-ink); }
.ttable tfoot th { font-size: .82rem; font-weight: 600; letter-spacing: .02em; opacity: .8; }
.ttable tfoot td, .ttable tfoot td:last-child { color: var(--band-ink); }
.ttable tfoot td small { color: inherit; opacity: .7; }
.ttable tfoot tr.cal td, .ttable tfoot tr.cal td:last-child { color: var(--accent); }
.ttable tfoot tr.cal td small { color: var(--band-ink); }
.ttable tfoot tr td.zero { color: color-mix(in srgb, var(--band-ink) 30%, var(--band)); }
.ttable tfoot tr:first-child > * { padding-top: .75rem; }
.ttable tfoot tr:last-child > * { padding-bottom: .8rem; }

.tcnote { margin: -.4rem .2rem 0; font-size: .78rem; font-style: italic; line-height: 1.4; color: var(--muted); }

.ttable tbody th small { font-size: .75em; font-weight: 600; color: var(--muted); }

/* Phones: tighter so all four columns fit without scrolling */
@media (max-width: 560px) {
  .tchead { padding-left: .75rem; padding-right: .75rem; }
  .ttable th, .ttable td { padding-left: .2rem; padding-right: .2rem; }
  .ttable th:first-child { padding-left: .75rem; }
  .ttable th:last-child, .ttable td:last-child { padding-right: .75rem; }
  .ttable tbody th, .ttable tfoot th { font-size: .8rem; white-space: normal; }
  .ttable td { font-size: 1.02rem; }
  .ttable td small { font-size: .58em; }
  .ttable thead th { font-size: .62rem; letter-spacing: .05em; }
}

/* Should I eat this? */
.eatcheck { margin-top: .7rem; display: flex; flex-direction: column; gap: .6rem; }
.eatcard { border: 1.5px solid var(--rule); border-radius: 10px; padding: .75rem .85rem; background: var(--bg); }
.eatcard p { margin: .3rem 0 0; }
.eatcard.lv-good { background: var(--good-bg); border-color: var(--good); }
.eatcard.lv-fair { background: var(--fair-bg); border-color: var(--fair); }
.eatcard.lv-bad  { background: var(--bad-bg); border-color: var(--bad); }
.eatverdict { font: 700 1.5rem/1 var(--display); }
.eatcard.lv-good .eatverdict { color: var(--good); }
.eatcard.lv-fair .eatverdict { color: var(--fair); }
.eatcard.lv-bad  .eatverdict { color: var(--bad); }
.eatflags { margin: .5rem 0 0; padding-left: 1.1rem; }
.eatflags li + li { margin-top: .35rem; }
.eatgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.eatcol { border: 1px solid var(--rule); border-radius: 10px; padding: .6rem .7rem; display: flex; flex-direction: column; gap: .45rem; }
.eathead { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.eatval { font-weight: 700; }
.eatline .meta { font-size: .8rem; }
.eatcoach { border: 1px solid var(--rule); border-radius: 10px; padding: .6rem .8rem; }
.eatcoach ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.eatcoach li + li { margin-top: .3rem; }
.weekcounts { margin: .8rem 0 .2rem; }
.weekcounts .tvalue .meta { font: 400 .9rem var(--body); }

/* Coach note under a lift in the lifting summary and history */
.coachnote { display: inline-block; margin-top: .2rem; font-size: .88rem; color: var(--ink); }

/* Merge duplicate foods (v59) */
.dupbox .list li { align-items: flex-start; }
.dupbtns { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex: none; }
.mergebox .list li { align-items: flex-start; }
.mergepick { align-items: flex-start; flex: 1; }
.mergepick input { margin-top: .25rem; }
.mergebox select { margin-bottom: .2rem; }

/* Check a product (v60) */
.storecheck { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: 0 0 1rem; }
.prodslots { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .7rem; }
.prodslot { min-height: 7.5rem; margin: 0; padding: .4rem; text-align: center; font-size: .85rem; }
.prodslot img { max-height: 9rem; }
.verdictcard { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-radius: 12px; padding: 1rem 1.1rem; margin: .4rem 0 1rem;
  background: var(--surface); border: 1px solid var(--rule); }
.verdictcard.lv-great { background: var(--great-bg); color: var(--great); border-color: var(--great-bg); }
.verdictcard.lv-good { background: var(--good-bg); color: var(--good); border-color: var(--good-bg); }
.verdictcard.lv-fair { background: var(--fair-bg); color: var(--fair); border-color: var(--fair-bg); }
.verdictcard.lv-bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-bg); }
.verdictcard .tlabel { text-transform: capitalize; }
.verdictcard .gradeval, .verdictcard .gradeword, .verdictcard .tlabel { color: inherit; }
.prodthumbs { display: flex; gap: .35rem; flex: none; }
.prodthumbs img { width: 3.2rem; height: 4.2rem; object-fit: cover; border-radius: 6px; }
.prodname { margin: 0 0 .2rem; font-size: 1.15rem; }
.prodhead { margin: 0 0 1rem; font-size: 1.02rem; }
.prodfacts { padding: .75rem 1rem; }
.prodfacts .perserving { margin: .15rem 0; font-weight: 600; }
.prodlist { margin: 0 0 1rem; padding-left: 1.2rem; }
.prodlist li { margin: .25rem 0; }
.prodlist.pros li::marker { color: var(--good); }
.prodlist.cons li::marker { color: var(--heavy); }
.prodresult h3 { font-size: .98rem; margin: 1rem 0 .3rem; }
.prodresult p { margin: 0 0 .6rem; }
.prodresult a { color: inherit; }
