/* The app's own layer on top of the design kit (tokens.css, then components.css).
   Only what the kit has no class for; every value comes from tokens.css. */

/* ---- fonts (served from /static/fonts; the security policy allows no other host) ---- */
@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/inter-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Manrope; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/manrope-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Manrope; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/manrope-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Manrope; font-style: normal; font-weight: 800; font-display: swap; src: url(/static/fonts/manrope-latin-800-normal.woff2) format("woff2"); }

/* ---- base ---- */
[hidden] { display: none !important; }     /* the kit's flex/grid classes must not beat the attribute */
.screen { padding-top: calc(env(safe-area-inset-top) + 28px); }
ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
.file-input { position: fixed; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.small, .hint { color: var(--ink-3); font-size: 14px; line-height: 20px; }
.small:empty { display: none; }
.opt { color: var(--ink-3); font-weight: 400; }
.pad { padding: 0 4px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hero-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.load-error { max-width: 430px; margin: 24px auto 0; }
button:disabled { cursor: default; }
.btn--secondary:disabled, .btn--quiet:disabled { background: #F1EEE8; color: var(--ink-3); }
.btn--text:disabled { background: transparent; color: var(--ink-3); }
.alert-inline { color: var(--warn-fg); font: 600 15px/22px var(--font-body); }

/* fields the script creates without a kit class get the kit look */
input[type=text], input[type=date], input[type=password], textarea {
  width: 100%; min-width: 0; border: 1px solid var(--control-border); border-radius: var(--r-field);
  background: var(--card); color: var(--ink); font: 500 16px/24px var(--font-body);
}
input[type=text], input[type=date], input[type=password] { height: 52px; padding: 0 16px; }
textarea { padding: 14px 16px; resize: none; font-weight: 400; }
input[type=text]:focus, input[type=date]:focus, input[type=password]:focus, textarea:focus { border: 1.5px solid var(--accent); outline: none; }
input[type=date] { -webkit-appearance: none; appearance: none; display: block; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
::placeholder { color: var(--ink-4); opacity: 1; }

/* chips the script makes are radios/checkboxes (aria-checked); same look as the kit's pressed chip */
.chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip:disabled { opacity: .5; }

/* ---- check-in ---- */
.field > label.card-heading { font: 700 18px/24px var(--font-display); color: var(--ink); }
.time-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.time-chips .chip { min-width: 0; padding: 0 4px; }

/* ---- today ---- */
#weekly-notice .banner { width: 100%; border: 0; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
#weekly-notice .banner > svg { color: var(--accent); flex-shrink: 0; }
.offline-bar svg { flex-shrink: 0; }
.empty-card { align-items: flex-start; gap: 12px; }
.banner-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.banner .banner-icon { background: var(--card); }
.checklist svg { color: var(--accent); flex-shrink: 0; }
.check-gap { width: 20px; flex-shrink: 0; }
.card .state-title + .muted { margin-top: -2px; }
.card--error .btn { margin-top: 8px; }

.step-list > .step:first-child { padding-top: 8px; }
.step-text { font-size: 16px; line-height: 22px; }
#session.busy > *, #session-side.busy > *, #planned.busy, .photo-card.busy, #gp-plan.busy, #w-card.busy, #w-days.busy { opacity: .45; }

/* session items: tap one to log it in the bottom panel */
.items.dim { opacity: .6; }
.item-btn { width: 100%; border: 0; border-bottom: 1px solid var(--divider); background: none; text-align: left;
  font: inherit; color: var(--ink); padding: 14px 0; min-height: 64px; touch-action: manipulation; }
.items > li:last-child .item-btn { border-bottom: 0; }
.item-btn > svg { color: var(--ink-4); flex-shrink: 0; }
.item-btn .step-num svg { display: block; margin: 8px auto; }
.item-btn.complete .item-name { color: var(--ink-2); }
.item-count { font: 600 14px/1 var(--font-body); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.item-btn.complete .item-count { color: var(--ok-fg); }
/* exercise rows: the row opens logging, the "How" button beside it opens the photos and guide */
.items > li.item-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--divider); }
.items > li.item-row:last-child { border-bottom: 0; }
.item-row .item-btn { flex: 1; min-width: 0; border-bottom: 0; }
.how-btn { flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: var(--accent-soft);
  color: var(--accent); font: 600 14px/1 var(--font-body); cursor: pointer; touch-action: manipulation; }
.how-btn:active { background: var(--hairline); }
.how-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* start and end photos of an exercise; tap to flip between them */
.fp-box { display: flex; flex-direction: column; gap: 6px; }
.fp { all: unset; box-sizing: border-box; position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  width: 100%; border-radius: 14px; cursor: pointer; touch-action: manipulation; }
.fp:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fp figure { margin: 0; position: relative; border-radius: 12px; overflow: hidden; background: var(--sunken); }
.fp img { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 850 / 567; object-fit: cover; }
.fp figcaption { position: absolute; left: 6px; bottom: 6px; padding: 3px 8px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .92); color: var(--ink); font: 600 11px/14px var(--font-body); letter-spacing: .06em; text-transform: uppercase; }
.fp-play { position: absolute; right: 6px; top: 6px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--accent);
  color: var(--on-accent); font: 600 12px/16px var(--font-body); }
.fp.playing { grid-template-columns: 1fr; }
.fp.playing figure { grid-area: 1 / 1; }
.fp.playing figure:nth-of-type(2) { animation: fp-flip 1.6s steps(1, end) infinite; }
.fp.playing .fp-play { background: var(--ink); }
@keyframes fp-flip { 0% { opacity: 0; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fp.playing figure:nth-of-type(2) { animation: none; } }
.yt-link { align-self: flex-start; color: var(--accent); font: 600 15px/20px var(--font-body); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.yt-link:hover, .yt-link:focus-visible { text-decoration: underline; }
.log-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.log-progress { font-weight: 600; }
.pbar { height: 6px; border-radius: var(--r-pill); background: var(--sunken); overflow: hidden; margin: 8px 0 4px; }
.pbar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .2s; }
.log-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.skip-link { width: 100%; color: var(--ink-2); font-weight: 500; }
.log-done { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px;
  border-radius: var(--r-button); background: var(--ok-bg); color: var(--ok-ink); }
.log-done.skipped { background: var(--info-bg); color: var(--ink-2); }
.log-done-title { font-weight: 600; }
.log-done-note { font-size: 15px; }
.log-done .btn--text { min-height: 40px; }
.sync { display: inline-flex; align-items: center; gap: 6px; font: 600 13px/1 var(--font-body); color: var(--ink-3); white-space: nowrap; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok-dot); flex: none; }
.sync.waiting { color: var(--warn-fg); }
.sync.waiting::before { background: var(--warn-dot); }
.sync.sending::before { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.watch-head { display: flex; gap: 14px; align-items: center; }
.watch-card .btn { margin-top: 6px; }
.disclosure-card { padding-top: 4px; padding-bottom: 4px; }
.disclosure { list-style: none; cursor: pointer; }
.disclosure::-webkit-details-marker { display: none; }
.disclosure svg { color: var(--ink-3); transition: transform .15s; }
details[open] > .disclosure svg { transform: rotate(180deg); }
details[open] > .disclosure + * { margin-bottom: 12px; }
.plain-list > li { padding: 10px 0; border-top: 1px solid var(--divider); font-size: 15px; line-height: 22px; color: var(--ink-2); }
.plain-list > li:first-child { border-top: 0; }

.change-link { width: 100%; background: transparent; font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.change-link svg { color: var(--accent); flex-shrink: 0; }
.change-link:disabled { opacity: .5; }

/* week strip: buttons that open the day */
.week-strip > li { display: flex; }
.week-day { flex: 1; border: 0; background: none; font: inherit; cursor: pointer; min-height: 72px; }
.week-day[data-state="missed"] i { border-color: var(--warn-dot); color: var(--warn-fg); background: var(--warn-bg); }
.week-day[data-state="planned"] i { border-color: var(--ink-4); }
.week-day[data-state="today"] small { color: var(--accent); }

/* ---- bottom panels ---- */
.sheet-lede { margin-top: 4px; font-size: 15px; }
#sheet-body { display: flex; flex-direction: column; gap: 10px; }
#sheet-body:empty { display: none; }
.sheet h3 { margin: 10px 0 0; font: var(--t-label); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.sheet #sheet-body > ul:not([class]) > li, .sheet .hist > li { padding: 10px 0; border-bottom: 1px solid var(--divider); }
.meta { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.sheet-strong { font: 800 22px/28px var(--font-display); }
.notice-text { color: var(--ink-2); }
.sheet-foot { margin-top: 6px; }
.tab-body { display: flex; flex-direction: column; gap: 12px; }
.inset { background: var(--ground); gap: 10px; }
.progress-title { font: 700 18px/24px var(--font-display); }
.photo-btn, .photo-update { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); color: var(--accent);
  font: 600 15px/20px var(--font-body); cursor: pointer; -webkit-user-select: none; user-select: none; }
.photo-btn { align-self: center; }
.photo-update { align-self: flex-start; }
.cam { width: 22px; height: 22px; flex: none; }

/* exercise panel: set logging */
.ls-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ls-target { font-weight: 600; }
.ls-last { color: var(--ink-2); font-size: 15px; }
.sets { display: flex; flex-direction: column; gap: 8px; }
.setrow { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr) 52px; gap: 8px; align-items: center; }
.setrow.single { grid-template-columns: 24px minmax(0, 1fr) 52px; }
.setrow--head { font: 600 12px/16px var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.setrow--head span { text-align: center; }
.setrow--head span:first-child { text-align: left; }
.setrow .n { font: 700 16px/1 var(--font-display); color: var(--ink-2); }
.bigstep { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; min-height: 56px; border: 1px solid var(--control-border);
  border-radius: var(--r-field); overflow: hidden; background: var(--card); }
.bs-btn { border: 0; background: var(--sunken); color: var(--ink); font: 500 22px/1 var(--font-body); padding: 0; touch-action: manipulation; }
.bs-btn:active { background: var(--accent-soft); }
.bs-val { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; min-width: 0;
  background: none; border: 0; padding: 0; font: inherit; color: var(--ink); touch-action: manipulation; }
.bs-val b { font: 600 18px/1.1 var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bs-val small { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.bigstep input.bs-input { height: auto; border: 0; border-radius: 0; text-align: center; font: 600 18px/1 var(--font-body);
  background: var(--accent-soft); padding: 0; }
.setrow.done .bigstep { background: var(--ground); }
.setrow.done .bs-val b { color: var(--ink-3); }
.two-btn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two-btn .btn { width: 100%; }
.cues { padding-left: 22px !important; list-style: decimal !important; }
.cues li, .plainlist li { padding: 6px 0; }
.plainlist li { border-bottom: 1px solid var(--divider); }
.muscles p { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mus-label { color: var(--ink-3); font-size: 14px; font-weight: 600; min-width: 42px; }
.mus { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); background: var(--sunken); font-size: 15px; }
.mus.main { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.fine { font-size: 12px; }
.swap-out { display: flex; flex-direction: column; gap: 10px; }
.opt-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--hairline); border-radius: var(--r-card); background: var(--card); }
.opt-name { font: 700 18px/24px var(--font-display); }
.opt-line { color: var(--ink-2); font-size: 15px; }
.opt-why { font-size: 15px; }
.opt-card .btn { margin-top: 8px; min-height: 48px; }
.best { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 14px 16px; border-radius: var(--r-button); background: var(--accent-soft); }
.best-label { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.best-val { grid-row: 1 / span 2; grid-column: 2; align-self: center; font: 700 22px/1 var(--font-display); }
.best-sub { font-size: 14px; color: var(--ink-2); }
.hist > li { display: grid; grid-template-columns: 64px 1fr; gap: 0 10px; }
.hist-date { color: var(--ink-3); font-weight: 600; font-size: 15px; }
.hist-sets { font-weight: 600; }
.hist-sub { grid-column: 2; color: var(--ink-3); font-size: 14px; }

/* chip groups the script builds (some in fixed columns) */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-wrap .chip { min-height: 44px; font-size: 15px; }
.chips-wrap.small .chip { min-width: 52px; padding: 0 12px; }
.chips-wrap.grid { display: grid; gap: 6px; }
.chips-wrap.grid .chip { min-width: 0; padding: 0 6px; line-height: 1.2; font-size: 14px; }
.chips-wrap.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chips-wrap.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chips-wrap.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chips-wrap.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.chips-wrap.cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.chips-wrap.cols-7 .chip { font-size: 13px; }
.gfield { display: flex; flex-direction: column; gap: 8px; }
.field-label { font: 600 14px/20px var(--font-body); color: var(--ink-2); }
.field-label .opt { font-weight: 400; }

/* ---- goal ---- */
.sections { padding: 0; gap: 0; overflow: hidden; }
.sec { border-top: 1px solid var(--divider); }
.sec:first-child { border-top: 0; }
.sec > summary { list-style: none; min-height: 68px; padding: 12px 48px 12px 20px; display: flex; flex-direction: column;
  justify-content: center; gap: 2px; position: relative; cursor: pointer; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: ""; position: absolute; right: 22px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .15s; }
.sec[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.sec-title { font: 700 17px/22px var(--font-display); }
.sec-sum { color: var(--ink-2); font-size: 14px; line-height: 20px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sec-sum.unset { color: var(--ink-3); }
.sec.dirty > summary .sec-title::after { content: " · not saved"; color: var(--warn-fg); font: 600 13px/1 var(--font-body); }
.sec-body { display: flex; flex-direction: column; gap: 16px; padding: 4px 20px 20px; }
.row-input { display: flex; align-items: center; gap: 10px; }
.row-input > input { flex: 1; min-width: 0; }
.row-input.two { flex-wrap: wrap; }
.row-input.two > input[type=date] { flex: 1 1 120px; }
.save-bar { display: flex; flex-direction: column; gap: 6px; }
.save-msg { text-align: center; }
.save-msg:empty { display: none; }
.btn--text.add { align-self: flex-start; }
.remove { color: var(--ink-2); font-size: 15px; font-weight: 500; flex: none; }
.entry-list { display: flex; flex-direction: column; gap: 10px; }
.entry-list:empty { display: none; }
.entry-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r-field); background: var(--ground); }
.item { border-top: 1px solid var(--divider); }
.item:first-child { border-top: 0; }
.item-details { display: flex; flex-direction: column; gap: 14px; padding: 2px 0 16px; }
.switch-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px;
  background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.toggle-text { display: flex; flex-direction: column; }
.toggle-label { font-weight: 600; }
.toggle-sub { color: var(--ink-3); font-size: 14px; }
.switch-btn[aria-checked="true"] .switch { background: var(--accent); justify-content: flex-end; }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stepper-field { display: flex; flex-direction: column; gap: 6px; }
.stepper-label { font-size: 13px; color: var(--ink-3); }
.stepper-field .stepper { display: flex; }
.stepper-field .stepper output { flex: 1; }
.stepper button { color: var(--ink); }
.routine { display: flex; flex-direction: column; gap: 4px; }
.routine-name { font: 700 16px/22px var(--font-display); }
.photo-notice { display: flex; flex-direction: column; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-field); background: var(--accent-soft); }
.photo-notice .btn--text { min-height: 36px; }

.timeline { position: relative; display: flex; gap: 3px; height: 10px; margin: 6px 0 4px; }
.tl-seg { border-radius: 4px; background: var(--accent-soft); min-width: 4px; }
.tl-seg.current { background: var(--accent); }
.tl-seg.past { background: var(--hairline); }
.tl-now { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.phases > li { padding: 10px 0; border-top: 1px solid var(--divider); }
.phases > li:first-child { border-top: 0; }
.ph-head { display: flex; justify-content: space-between; gap: 10px; }
.ph-name { font-weight: 600; }
.ph-dates { color: var(--ink-3); font-size: 14px; white-space: nowrap; }
.ph-focus { color: var(--ink-2); font-size: 15px; }
.now-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin-bottom: 4px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent); font: 600 12px/1 var(--font-body); }
.plan-cta { gap: 12px; }
.tint-text { color: #1F4A43; }
.tint-text:empty { display: none; }

/* day lists (Goal: next two weeks; Week: the proposed week) */
.day-list { padding: 4px 16px; }
.pday { display: flex; gap: 14px; align-items: flex-start; min-height: 64px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.pday:last-child { border-bottom: 0; }
.pday .date { width: 40px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; padding-top: 2px; }
.pday .date small { font: 600 12px/16px var(--font-body); color: var(--ink-3); }
.pday .date b { font: 700 18px/22px var(--font-display); }
.pday .date.is-today b, .pday .date.is-today small { color: var(--accent); }
.pday.rest { align-items: center; }
.pday-rest { color: var(--ink-3); font-size: 15px; }
.pday.off { opacity: .6; }
.away-tag { font: 600 11px/14px var(--font-body); color: var(--warn-fg); }
.pday-sessions { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.psess { display: flex; align-items: center; gap: 10px; width: 100%; padding: 4px 0; min-height: 48px; background: none; border: 0;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.psess + .psess { border-top: 1px dashed var(--divider); padding-top: 10px; }
.psess .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.psess-title { font-size: 15px; line-height: 21px; font-weight: 600; }
.psess-meta { font-size: 13px; line-height: 18px; color: var(--ink-3); }
.psess-reason { font-size: 13px; line-height: 18px; color: var(--ink-2); }
.psess > svg { color: var(--ink-4); flex-shrink: 0; }

/* editing a planned session's steps */
.ed-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.ed-item { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--hairline); border-radius: var(--r-field); background: var(--card); }
.ed-top { display: flex; gap: 6px; align-items: center; }
.ed-top input { height: 44px; font-weight: 600; }
.ed-icon { flex-shrink: 0; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--sunken); color: var(--ink-2); font: 500 18px/1 var(--font-body); cursor: pointer; }
.ed-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.ed-grid.block { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }
.ed-num { -moz-appearance: textfield; appearance: textfield; text-align: center; }
.ed-num::-webkit-inner-spin-button, .ed-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ed-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ed-label { font: var(--t-caption); color: var(--ink-3); }
.ed-amount { display: flex; gap: 4px; }
.ed-num, .ed-unit { width: 100%; min-width: 0; height: 40px; padding: 0 8px; border: 1px solid var(--control-border); border-radius: var(--r-field);
  background: var(--card); color: var(--ink); font: 500 16px/24px var(--font-body); }
.ed-unit { width: auto; flex-shrink: 0; padding: 0 4px; }
.ed-num:focus, .ed-unit:focus { border: 1.5px solid var(--accent); outline: none; }
.ed-item > input[type=text] { height: 40px; font-size: 15px; }
.ed-actions { display: flex; gap: 12px; align-items: center; }
.ed-actions .btn { flex: 1; }
.ed-actions .btn--text { flex: 0 0 auto; padding: 0 8px; }

/* ---- week ---- */
.review { gap: 12px; }
.facts > li { position: relative; padding: 2px 0 2px 16px; font-size: 15px; color: var(--ink-2); }
.facts > li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
.rv { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 12px; border-top: 1px solid var(--divider); }
.week-focus { padding: 0 4px; font-size: 16px; }
.quote { font-style: italic; }
.past { padding: 0; }
.past .list-row { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--divider); font: inherit; text-align: left; cursor: pointer; padding: 8px 0; }
.past > li:last-child .list-row { border-bottom: 0; }
.past .list-row svg { color: var(--ink-4); flex-shrink: 0; }
.again { align-self: center; }

/* ---- photos ---- */
#photo-compose { margin-top: 4px; }
.compose { gap: 12px; }
.h3 { font: 700 18px/24px var(--font-display); }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--sunken); border: 1px solid var(--hairline); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.loading { display: flex; align-items: center; justify-content: center; color: var(--ink-3); }
.thumb.add { display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--accent); background: none;
  color: var(--accent); font-size: 30px; cursor: pointer; }
.thumb-x { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(28, 30, 29, .6); color: #fff; font-size: 20px; line-height: 1; padding: 0; }
.thumbs.small { grid-template-columns: repeat(auto-fill, 52px); gap: 6px; }
.thumbs.small .thumb { border-radius: 10px; }
.photo-card h2 { font: 800 24px/30px var(--font-display); }
.why { color: var(--ink-2); }
.label { font: 600 14px/20px var(--font-body); color: var(--ink-2); }
.photo-card .steps > li, .sheet .steps > li { padding: 8px 0; border-top: 1px solid var(--divider); }
.eq-list { border-top: 1px solid var(--divider); }
.eq-list > li { border-bottom: 1px solid var(--divider); }
.eq { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 0; background: none; border: 0;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.eq .box { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--control-border); position: relative; }
.eq[aria-checked="true"] .box { background: var(--accent); border-color: var(--accent); }
.eq[aria-checked="true"] .box::after { content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
  border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(45deg); }
.eq[aria-checked="false"] .eq-text { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--control-border); }
.eq-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.eq-name { font-weight: 600; }
.eq-detail { color: var(--ink-3); font-size: 14px; }
.eq-tag { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--sunken); color: var(--ink-2); font: 600 12px/1 var(--font-body); }
.eq-tag.unsure { background: var(--warn-bg); color: var(--warn-fg); }
.eq-empty { padding: 12px 0; color: var(--ink-3); }
.save-place { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--divider); }
.saved { font-weight: 600; color: var(--ok-fg); }
.photo-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.quiet { color: var(--ink-2); font-weight: 500; font-size: 15px; text-decoration: underline; }
.photo-wait { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 0 8px; }

/* ---- login ---- */
.login-screen { padding-bottom: 32px; justify-content: center; min-height: 100dvh; }
.login-screen form { display: flex; flex-direction: column; gap: 16px; }

@media (prefers-reduced-motion: reduce) {
  .sync.sending::before { animation: none; }
}

/* ---- wide screens: tablet, laptop, phone on its side ----
   Phone portrait is the layout above and stays untouched. A screen marked .split holds a
   .col-main and a .col-side; on a phone they are see-through (display: contents) so the cards
   keep their phone order. Wide, the bottom bar becomes a side rail, the columns sit side by
   side, Trends becomes a grid of cards, and bottom panels open as centred dialogs. */
.col, #session, #session-side { display: contents; }
/* Today: the session's own cards and the side cards, back in phone order (the page holds them in
   wide-screen order: title and sets on the left, the reasons, watch and week on the right) */
#session > .card--hero { order: 1; }
#s-asked-card { order: 2; }
#s-plan-card { order: 3; }
#s-why-card { order: 4; }
#session > .subhead { order: 5; }
#session > .session-card { order: 6; }
.watch-card { order: 7; }
#s-history { order: 8; }
#change-open { order: 9; }
#week-card { order: 10; }

@media (min-width: 768px), (orientation: landscape) and (min-width: 600px) {
  body:has(> .nav) { padding-left: calc(var(--rail) + env(safe-area-inset-left)); }
  .nav {
    top: 0; right: auto; width: calc(var(--rail) + env(safe-area-inset-left)); flex-direction: column; justify-content: center;
    border-top: 0; border-right: 1px solid var(--hairline);
    padding: env(safe-area-inset-top) 4px env(safe-area-inset-bottom) calc(4px + env(safe-area-inset-left));
  }
  .nav-inner { flex-direction: column; gap: 4px; max-width: none; }
  .nav a { flex: 0 0 auto; min-height: 60px; }

  .screen[id^="view-"] { max-width: 600px; padding: calc(env(safe-area-inset-top) + 28px) 24px calc(40px + env(safe-area-inset-bottom)); }

  .sheet {
    inset: 0; margin: auto; width: min(560px, calc(100% - 48px)); height: fit-content; max-height: calc(100dvh - 48px);
    border-radius: var(--r-sheet); padding: 20px 28px 28px; box-shadow: 0 24px 64px rgba(28,30,29,.18);
    animation: sheet-pop .2s cubic-bezier(.2,.8,.2,1);
  }
  .sheet-grip { display: none; }
  .sheet > * { flex-shrink: 0; }      /* a short screen scrolls the dialog instead of squashing its fields */
}
@keyframes sheet-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

@media (min-width: 800px) {
  .screen[id^="view-"] { max-width: 1200px; padding-left: 32px; padding-right: 32px; }
  .split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--card-gap) 24px; align-items: start; align-content: start; }
  .split > :not(.col) { grid-column: 1 / -1; }
  .split > .col { display: flex; flex-direction: column; gap: var(--card-gap); min-width: 0; }
  .split > .col > .subhead:first-child { padding-top: 0; }
  .split #session { display: flex; flex-direction: column; gap: var(--card-gap); }
  .split #session > .subhead { padding-top: 8px; }
  #ci-form.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #ci-form .col-side { position: sticky; top: 24px; }
  /* nothing to show beside it (no review yet): the main column takes a readable width alone */
  .split:not(:has(> .col-side > :not([hidden]))) > .col-side { display: none; }
  .split:not(:has(> .col-side > :not([hidden]))) > .col-main { grid-column: 1 / -1; max-width: 720px; }

  #trends-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(352px, 1fr)); gap: var(--card-gap) 24px; align-items: start; }
  #trends-body > * { grid-column: 1 / -1; }
  #trends-body > .back-link { justify-self: start; }
  #trends-body > section.stack { grid-column: auto; }
  #trends-body > section.stack > .section-title { margin-top: 12px; }
  #trends-body > .segmented { max-width: 480px; }
  #trends-body.is-detail { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  #trends-body.is-detail > .card--hero { grid-column: 1; grid-row: span 2; }
  #trends-body.is-detail > .stat-tiles, #trends-body.is-detail > .card--flat { grid-column: 2; }
}
#ci-done { margin-top: 8px; }
