/* Bocado · warm, calm, food-friendly. Sage paper, aubergine ink, olive oil
   green for actions, saffron for protein, a clear water blue. */

@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/bricolage-grotesque-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --bg: #eef1e6;
  --surface: #fafbf6;
  --surface-2: #e2e7d6;
  --ink: #2a1f2d;
  --ink-2: #5b5160;
  --line: #d3d9c5;
  --olive: #46632a;
  --olive-ink: #f4f6ee;
  --olive-soft: #dde6cc;
  --saffron: #d48a1a;
  --saffron-soft: #f5e1bb;
  --water: #2c7383;
  --water-soft: #d2e6e9;
  --fiber: #6f8a2e;
  --beet: #963a4e;
  --beet-soft: #f3dde1;
  --focus: #2c7383;

  --display: 'Bricolage', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --r-lg: 22px;
  --r-md: 14px;
  --gutter: 16px;
  --tab-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1a22; --surface: #29232d; --surface-2: #362f3b; --ink: #f0ebe3; --ink-2: #c3bac5; --line: #433a4b;
    --olive: #a9c67c; --olive-ink: #1f1a22; --olive-soft: #36402a; --saffron: #eeac48; --saffron-soft: #4a3a22;
    --water: #78bccb; --water-soft: #223b41; --fiber: #b4c76d; --beet: #f093a5; --beet-soft: #47272f; --focus: #78bccb;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1f1a22; --surface: #29232d; --surface-2: #362f3b; --ink: #f0ebe3; --ink-2: #c3bac5; --line: #433a4b;
  --olive: #a9c67c; --olive-ink: #1f1a22; --olive-soft: #36402a; --saffron: #eeac48; --saffron-soft: #4a3a22;
  --water: #78bccb; --water-soft: #223b41; --fiber: #b4c76d; --beet: #f093a5; --beet-soft: #47272f; --focus: #78bccb;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--olive); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 2.1rem; line-height: 1.04; font-weight: 720; font-stretch: 86%; }
h2 { font-size: 1.22rem; line-height: 1.2; font-weight: 650; font-stretch: 92%; }
h3 { font-size: 1.05rem; font-weight: 650; margin: 1.4rem 0 .5rem; }
p { margin: 0 0 .6rem; }

.app { min-height: 100dvh; }
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot img { opacity: .9; }
.noscript { padding: 24px; }

/* ---- layout ---- */
.view {
  max-width: 36rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) var(--gutter) calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px);
  outline: none;
}
.view > * + * { margin-top: 14px; }
.screen-head { padding: 4px 2px 6px; }
.screen-head .sub { color: var(--ink-2); margin: 6px 0 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.screen-head .sub .ic { width: 18px; height: 18px; }
.day-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; }
.day-nav > div { text-align: center; }
.day-nav h1 { font-size: 1.9rem; }
.view-hoy .day-nav h1::first-letter, .view-hoy .day-nav h1 { text-transform: none; }
.day-nav .sub { justify-content: center; }
.phase-link { color: var(--ink-2); }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--ink-2); text-decoration: none; margin-bottom: 4px; }
.back .ic { width: 20px; height: 20px; }
.rec-h1 { font-size: 1.8rem; font-stretch: 88%; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
}
.card > h2 { margin-bottom: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.figure { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.hint { color: var(--ink-2); font-size: .9rem; line-height: 1.45; }
.hint.center, .center { text-align: center; }
.label-sm { font-size: .9rem; font-weight: 600; color: var(--ink-2); margin: 12px 0 8px; display: block; }
.chip-note { background: var(--saffron-soft); color: var(--ink); border-radius: var(--r-md); padding: 10px 14px; font-size: .95rem; margin-top: 12px; }
.foot-note { color: var(--ink-2); font-size: .82rem; text-align: center; padding: 8px 12px 0; }
.empty { text-align: center; padding: 22px 14px; }
.empty p { color: var(--ink-2); }
.empty .btn { margin-top: 6px; }

/* ---- buttons & controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn .ic { width: 20px; height: 20px; }
.btn.primary { background: var(--olive); border-color: var(--olive); color: var(--olive-ink); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--beet); border-color: var(--beet); color: var(--surface); }
.btn.danger-ghost { background: transparent; color: var(--beet); border-color: var(--beet-soft); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-col { display: grid; gap: 10px; }
.file-btn { cursor: pointer; }
.card .btn.wide { margin-top: 12px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
}
.icon-btn .ic { width: 22px; height: 22px; }
.ghost-slot { visibility: hidden; }
.sheet .icon-btn { border: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: .92rem; font-weight: 600;
}
.pill .ic { width: 18px; height: 18px; }
.pill.on { background: var(--olive); border-color: var(--olive); color: var(--olive-ink); }
.pill.ghost { background: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin: 0 calc(var(--gutter) * -1); padding-left: var(--gutter); padding-right: var(--gutter); scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 550; font-size: .95rem; display: inline-flex; align-items: center;
}
.chip[aria-checked="true"], .chip[aria-pressed="true"] { background: var(--olive); color: var(--olive-ink); border-color: var(--olive); }
.chips.static { margin-top: 12px; gap: 6px; }
.chip.sm { min-height: 30px; padding: 0 12px; font-size: .85rem; background: var(--olive-soft); border-color: transparent; }
.chip.sm.muted { background: var(--surface-2); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 14px; }
.seg button { min-height: 40px; min-width: 40px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1.5px var(--olive) inset; }
.seg.wide { margin: 4px 0; }
.seg.wide button { min-height: 44px; }

.switch { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font-weight: 500; }
.switch .knob { flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--surface-2); border: 1.5px solid var(--line); position: relative; transition: background .15s; }
.switch .knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 23px; height: 23px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(42,31,45,.25); transition: transform .15s; }
.switch[aria-checked="true"] .knob { background: var(--olive); border-color: var(--olive); }
.switch[aria-checked="true"] .knob::after { transform: translateX(20px); }
.switch.sm .knob { width: 44px; height: 26px; }
.switch.sm .knob::after { width: 19px; height: 19px; }
.switch.sm[aria-checked="true"] .knob::after { transform: translateX(18px); }
.switch.sm .sw-label { font-size: .9rem; color: var(--ink-2); }

.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.field-row + .field-row { border-top: 1px solid var(--line); }
.field-row > label, .field-row .lbl { font-weight: 500; }
.stepper { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.stepper input, select, .search input, .gate-card #lk, textarea {
  border: 1.5px solid var(--line); background: var(--bg); border-radius: 12px; min-height: 46px; padding: 0 12px;
}
.stepper input { width: 84px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.stepper.small input { width: 78px; }
.stepper.dim { opacity: .5; }
.unit-s { color: var(--ink-2); font-size: .9rem; min-width: 22px; }
select { padding-right: 8px; max-width: 60%; }
textarea { width: 100%; padding: 10px 12px; resize: vertical; min-height: 84px; line-height: 1.45; }
.note-label { display: block; font-weight: 500; margin: 12px 0 6px; }

/* checkbox rows (meals, shopping, exercises) */
.meal-row, .shop-item, .ex, .check-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; cursor: pointer; }
.meal-row input, .shop-item input, .ex input, .check-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tick { flex: none; width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; background: var(--surface); }
.tick .ic { width: 18px; height: 18px; opacity: 0; color: var(--olive-ink); stroke-width: 2.6; }
input:checked + .tick { background: var(--olive); border-color: var(--olive); }
input:checked + .tick .ic { opacity: 1; }
input:focus-visible + .tick { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- HOY: the plate ---- */
.protein-card { padding-top: 22px; }
.plate-wrap { position: relative; width: min(250px, 72vw); margin: 0 auto; }
.plate { width: 100%; height: auto; }
.plate-rim { fill: var(--surface-2); }
.plate-well { fill: var(--surface); }
.plate-track { fill: none; stroke: var(--bg); stroke-width: 18; }
.plate-fill { fill: none; stroke: var(--saffron); stroke-width: 18; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.plate-range { fill: none; stroke: var(--olive); stroke-width: 3.5; stroke-linecap: round; }
.plate-target { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.plate-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.big-num { font-family: var(--display); font-size: 3.6rem; line-height: .95; font-weight: 760; font-stretch: 82%; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.big-num small { font-size: .45em; color: var(--ink-2); font-weight: 600; }
.big-num.sm { font-size: 2.3rem; }
.plate-center .unit { color: var(--ink-2); font-size: .9rem; max-width: 9.5em; line-height: 1.25; margin-top: 4px; }
.range-note { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 8px; font-size: .86rem; color: var(--ink-2); margin: 10px 0 2px; text-align: center; }
.swatch { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }
.swatch.range { background: var(--olive); }
.swatch.target { width: 4px; height: 14px; background: var(--ink); }
.range-note .lg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.range-note { gap: 4px 16px; }
.protein-card > .hint { text-align: center; }
.meals { margin: 14px 0 6px; border-top: 1px solid var(--line); }
.meal-row { border-bottom: 1px solid var(--line); padding: 6px 0; }
.meal-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.meal-txt .slot, .plan-item .slot { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.meal-txt .name { line-height: 1.3; }
.meal-row.done .name { color: var(--ink-2); }
.meal-p { font-family: var(--display); font-weight: 650; font-variant-numeric: tabular-nums; color: var(--saffron); filter: saturate(1.1); white-space: nowrap; }
:root:not([data-theme="dark"]) .meal-p { color: #9a5f06; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .meal-p { color: var(--saffron); } }

.water-card.emph { border-color: var(--water); box-shadow: 0 0 0 2px var(--water-soft); }
.emph-note { background: var(--water-soft); border-radius: 12px; padding: 10px 12px; font-size: .95rem; }
.glasses { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; margin: 6px 0 10px; }
.glass { width: 100%; max-width: 48px; justify-self: center; height: 52px; border: 0; background: none; padding: 4px 6px; cursor: pointer; border-radius: 10px; color: var(--ink-2); }
.glass svg { width: 100%; height: 100%; }
.g-out { fill: none; stroke: var(--water); stroke-width: 2; stroke-linejoin: round; }
.g-water { fill: var(--water); opacity: 0; transition: opacity .15s; }
.glass.on .g-water { opacity: .85; }
.glass.add { display: grid; place-items: center; border: 1.5px dashed var(--line); }
.glass.add .ic { width: 22px; height: 22px; }

.bar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--fiber); border-radius: 999px; }

.sym-list { display: grid; gap: 4px; }
.sym-row { display: grid; grid-template-columns: 1fr minmax(176px, 200px); align-items: center; gap: 10px; min-height: 52px; }
.sym-row:last-child { grid-template-columns: 1fr; }

.alert { background: var(--saffron-soft); border-radius: var(--r-md); padding: 12px 14px; }
.alert p:last-child { margin: 0; }
.alert-strong { background: var(--beet-soft); border-left: 5px solid var(--beet); }
.alert-strong strong { display: block; margin-bottom: 4px; }

/* ---- MENÚ ---- */
.day-card { padding: 0; }
.day-card summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 18px; min-height: 60px; cursor: pointer; }
.day-card summary::-webkit-details-marker { display: none; }
.day-card summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); margin-left: 4px; flex: none; transition: transform .15s; }
.day-card[open] summary::after { transform: rotate(-135deg); }
.d-name { font-family: var(--display); font-weight: 650; font-size: 1.1rem; text-transform: capitalize; flex: 1; }
.d-prot { color: var(--ink-2); font-size: .88rem; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; white-space: nowrap; }
.menu-kcal-note { background: var(--olive-soft); border-radius: 12px; padding: 10px 12px; font-size: .92rem; line-height: 1.45; margin-top: 10px; }
.today-dot { font-family: var(--body); font-size: .75rem; background: var(--saffron-soft); padding: 2px 8px; border-radius: 999px; margin-left: 4px; text-transform: none; font-weight: 600; vertical-align: 2px; }
.plan-list { list-style: none; margin: 0; padding: 0 18px 10px; }
.plan-item { border-top: 1px solid var(--line); padding: 12px 0; }
.plan-item .pi-main { display: flex; flex-direction: column; }
.pi-title { color: var(--ink); font-weight: 600; text-decoration: none; line-height: 1.3; padding: 2px 0; }
.pi-title:hover { text-decoration: underline; }
.pi-meta { color: var(--ink-2); font-size: .86rem; }
.pi-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.plan-item.done .pi-title { color: var(--ink-2); }
.empty-slot { color: var(--ink-2); display: flex; flex-direction: column; }

.alt-list { display: grid; gap: 6px; margin-top: 8px; }
.alt { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; cursor: pointer; }
.alt .ic { width: 20px; height: 20px; }
.alt-t { flex: 1; }
.alt-p { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }

/* ---- RECETAS ---- */
.search input { width: 100%; min-height: 52px; font-size: 1rem; background: var(--surface); }
.filters .label-sm { margin-top: 10px; }
.rec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rec-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'title p' 'meta p'; gap: 2px 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; text-decoration: none; color: var(--ink); min-height: 64px; }
.rec-title { grid-area: title; font-weight: 600; line-height: 1.3; }
.rec-meta { grid-area: meta; font-size: .86rem; color: var(--ink-2); }
.rec-p { grid-area: p; text-align: right; color: var(--ink-2); font-size: .85rem; }
.rec-p b { display: block; font-family: var(--display); font-size: 1.35rem; color: var(--ink); line-height: 1; }
.nut-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 8px; }
.nut-grid div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.nut-grid .nut-p { grid-column: span 2; background: var(--saffron-soft); display: flex; justify-content: space-between; align-items: baseline; }
.nut-grid dt { font-size: .85rem; color: var(--ink-2); }
.nut-grid dd { margin: 0; font-family: var(--display); font-weight: 650; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.nut-grid .nut-p dd { font-size: 1.6rem; }
.ing { list-style: none; padding: 0; margin: 0; }
.ing li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ing li:first-child { border-top: 0; }
.ing .g { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.steps { margin: 0; padding-left: 1.4em; }
.steps li { padding: 4px 0 8px; line-height: 1.5; }
.steps li::marker { font-family: var(--display); font-weight: 700; color: var(--olive); }
.tip { background: var(--olive-soft); border-radius: var(--r-lg); padding: 16px 18px; }
.tip h2 { font-size: 1rem; margin-bottom: 4px; }
.tip p { margin: 0; }

/* ---- COMPRA ---- */
.shop-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-actions { display: flex; gap: 8px; }
.shop-group ul { list-style: none; padding: 0; margin: 0; }
.shop-item { border-top: 1px solid var(--line); }
.shop-group li:first-child .shop-item { border-top: 0; }
.si-name { flex: 1; }
.si-g { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.shop-item.done .si-name { text-decoration: line-through; color: var(--ink-2); }

/* batch recipes */
.batch-card h2 { margin-bottom: 6px; }
.batch-list { list-style: none; padding: 0; margin: 6px 0 0; }
.batch-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); }
.batch-item:first-child { border-top: 0; }
.bi-title { color: var(--ink); font-weight: 600; text-decoration: none; line-height: 1.3; }
.bi-title:hover { text-decoration: underline; }
.batch-item .switch { margin-top: 2px; }
.batch-item .switch .sw-label { color: var(--ink); }
.batch-more summary { cursor: pointer; font-weight: 600; color: var(--olive); min-height: 44px; display: flex; align-items: center; }
.batch-more[open] summary { border-bottom: 1px solid var(--line); }

/* ---- PROGRESO ---- */
.chart { width: 100%; height: auto; margin-top: 4px; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-axis { fill: var(--ink-2); font: 10.5px var(--body); }
.c-bar { fill: var(--olive); }
.c-bar.protein { fill: var(--saffron); }
.c-bar.water { fill: var(--water); }
.c-bar.fiber { fill: var(--fiber); }
.c-bar.strength { fill: var(--olive); }
.c-empty { fill: var(--line); }
.c-target { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 4; }
.c-line { fill: none; stroke: var(--olive); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.c-line.sym { stroke: var(--beet); }
.c-dot { fill: var(--surface); stroke: var(--olive); stroke-width: 2.5; }
.c-dot.sym { stroke: var(--beet); }
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); }
.kv li:first-child { border-top: 0; }
.kv b { font-variant-numeric: tabular-nums; }

/* ---- RESUMEN ---- */
.report { padding: 20px 18px; }
.report-head { display: flex; flex-direction: column; gap: 6px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 12px; }
.brand-line { font-family: var(--display); font-weight: 750; color: var(--olive); margin: 0; font-size: 1.05rem; }
.report-head h2 { font-size: 1.4rem; }
.report-dates { color: var(--ink-2); font-size: .88rem; margin: 0; }
.report-meta { font-size: .92rem; }
.rtable { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.rtable th, .rtable td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rtable thead th { font-size: .8rem; color: var(--ink-2); font-weight: 600; border-bottom: 1.5px solid var(--ink-2); }
.rtable tbody th { font-weight: 500; }
.rtable.small { font-size: .82rem; }
.rtable.small th, .rtable.small td { padding: 6px 4px; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.report-notes { padding-left: 1.1em; font-size: .92rem; }
.report-notes li { margin-bottom: 4px; }
.write-lines span { display: block; height: 30px; border-bottom: 1px solid var(--line); }
.report-legal { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--ink-2); }

/* ---- FUERZA ---- */
.week-strength { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ws { display: flex; flex-direction: column; gap: 4px; }
.ex-list { list-style: none; padding: 0; margin: 0; }
.ex { border-top: 1px solid var(--line); align-items: flex-start; padding: 12px 0; }
.ex-list li:first-child .ex { border-top: 0; }
.ex .tick { margin-top: 2px; }
.ex-txt { display: flex; flex-direction: column; }
.ex-txt span { color: var(--ink-2); font-size: .92rem; }

/* ---- MÁS, AJUSTES, LEGAL ---- */
.more-list, .link-list { display: grid; gap: 8px; }
.link-list { padding: 6px 18px; gap: 0; }
.more-item, .link-list a { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); min-height: 64px; }
.more-item { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 16px; }
.more-item > span, .link-list a > span { flex: 1; display: flex; flex-direction: column; }
.more-item .hint { font-size: .86rem; }
.more-item .ic, .link-list .ic { width: 24px; height: 24px; color: var(--olive); flex: none; }
.more-item .ic:last-child, .link-list .ic:last-child { color: var(--ink-2); width: 20px; }
.link-list a + a { border-top: 1px solid var(--line); }
.set-block { border-top: 1px solid var(--line); padding: 6px 0; }
.set-block .field-row + .field-row { border-top: 0; }
/* medication block */
.med-block .field-row { border-top: 0; }
.seg button[disabled] { opacity: .4; cursor: not-allowed; }
.med-oral-note { margin-top: 8px; font-size: .95rem; }
.field-col { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 8px; }
.field-col > label { font-weight: 500; }
.text-in { width: 100%; border: 1.5px solid var(--line); background: var(--bg); border-radius: 12px; min-height: 46px; padding: 0 12px; }
.figure-line { font-family: var(--display); font-weight: 600; font-size: 1.05rem; margin: 0 0 4px; }

/* collaboration slot (config/partner.json) */
.partner-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); padding: 14px 16px; }
.partner-card > span { flex: 1; display: flex; flex-direction: column; }
.partner-card .ic { width: 22px; height: 22px; color: var(--olive); flex: none; }
.partner-card .ic:last-child { color: var(--ink-2); width: 20px; }
.partner-line { background: var(--olive-soft); border-radius: 10px; padding: 8px 12px; font-size: .93rem; }

/* install */
.install-now p { margin-bottom: 0; }
.install-os .steps { margin-top: 4px; }

.label-orient { background: var(--olive-soft); color: var(--ink); padding: 8px 12px; border-radius: 10px; }
.prose p { line-height: 1.6; }
.prose h2 { margin-bottom: 8px; }
.alert-card { background: var(--beet-soft); border-color: transparent; }
.sources { padding-left: 1.1em; margin: 0; }
.sources li { margin-bottom: 10px; line-height: 1.45; font-size: .93rem; }

/* ---- tab bar ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(6px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; color: var(--ink-2); text-decoration: none; font-size: .74rem; font-weight: 600; border-radius: 12px; }
.tabbar .ic { width: 26px; height: 26px; padding: 2px 10px; box-sizing: content-box; border-radius: 999px; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .ic { background: var(--olive-soft); color: var(--olive); }
.tab-brand { display: none; }
@media (min-width: 700px) { .tabbar { max-width: 36rem; margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 20px; } }

/* ---- desktop: side navigation, wider reading column, centred dialogs ---- */
@media (min-width: 1024px) {
  :root { --side: 236px; }
  .tabbar {
    top: 0; bottom: 0; right: auto; width: var(--side); max-width: none; margin: 0;
    display: flex; flex-direction: column; gap: 4px;
    padding: 28px 14px; border: 0; border-right: 1px solid var(--line); border-radius: 0;
  }
  .tab-brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 780; font-stretch: 80%; font-size: 1.7rem; letter-spacing: -0.02em; color: var(--olive); padding: 0 10px 22px; }
  .tab-brand img { width: 32px; height: 32px; }
  .tab-brand-line { font-size: 1.15rem; color: var(--ink); margin-left: -4px; white-space: nowrap; }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 10px; font-size: 1rem; }
  .tabbar a:hover { background: var(--surface-2); }
  .tabbar .ic { padding: 4px; }
  .view { max-width: 46rem; margin-left: calc(var(--side) + max(32px, (100vw - var(--side) - 46rem) / 2)); margin-right: auto; padding-top: 36px; padding-bottom: 48px; }
  dialog.sheet { margin: auto; max-width: 34rem; border-radius: 24px; }
  .sheet-body { max-height: 64vh; }
}

/* ---- sheet & toast ---- */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 36rem; max-height: 86dvh; background: var(--surface); color: var(--ink); border-radius: 24px 24px 0 0; }
dialog.sheet::backdrop { background: rgba(31, 26, 34, .45); }
.sheet-inner { padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.sheet-body { overflow-y: auto; max-height: 60dvh; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: rise .22s ease-out; }
  @keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
}
#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 18px); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); z-index: 55; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100% - 32px); background: var(--surface); color: var(--ink); border: 1.5px solid var(--olive); border-radius: 16px; padding: 8px 8px 8px 16px; box-shadow: 0 6px 20px rgba(31, 26, 34, .18); font-size: .95rem; }
#update-bar .pill { background: var(--olive); color: var(--olive-ink); border-color: var(--olive); }
@media (min-width: 1024px) { #toast, #update-bar { bottom: 28px; left: calc(50% + var(--side) / 2); } }

/* ---- gate: license + onboarding ---- */
.gate { max-width: 30rem; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 28px) var(--gutter) 40px; min-height: 100dvh; display: flex; flex-direction: column; gap: 18px; }
.gate-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.gate-brand .logo { width: 72px; height: 72px; }
.gate-brand.small { flex-direction: row; justify-content: center; gap: 10px; }
.gate-brand.small .logo { width: 40px; height: 40px; }
.wordmark { font-family: var(--display); font-size: 2.4rem; font-weight: 780; font-stretch: 80%; letter-spacing: -0.03em; margin: 0; line-height: 1; color: var(--olive); }
.gate-brand.small .wordmark { font-size: 1.6rem; }
.tagline { color: var(--ink-2); max-width: 22em; margin: 6px 0 0; }
.gate-card { display: flex; flex-direction: column; gap: 10px; }
.gate-card h1 { font-size: 1.8rem; margin-bottom: 4px; }
.gate-card #lk { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .95rem; letter-spacing: .02em; background: var(--bg); }
.form-error { color: var(--beet); font-weight: 600; margin: 0; }
.lang-pick { align-self: center; }
.lang-pick select { max-width: none; background: transparent; }
.step-count { color: var(--ink-2); font-size: .9rem; margin: 0; }
.steps-dots { display: flex; gap: 6px; margin-bottom: 6px; }
.steps-dots span { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-2); }
.steps-dots span.on { background: var(--olive); }
.onb-list { padding-left: 1.2em; margin: 0 0 6px; }
.onb-list li { margin-bottom: 6px; }
.note-box { background: var(--olive-soft); border-radius: 12px; padding: 12px 14px; }
.onb-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.onb-actions .btn { min-width: 120px; }
.targets-preview { background: var(--bg); border-radius: 14px; padding: 4px 14px 10px; margin-top: 8px; }
.check-row { align-items: flex-start; padding: 8px 0; font-weight: 600; }
.check-row .tick { margin-top: 0; }

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

/* ---- print: summary for the appointment ---- */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #eee; --ink: #111; --ink-2: #444; --line: #bbb; --olive: #2f4a17;
    color-scheme: light;
  }
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .tabbar, .no-print, .foot-note, .skip, #toast, #update-bar { display: none !important; }
  .view { padding: 0; max-width: none; }
  .report { border: 0; padding: 0; }
  .table-scroll { overflow: visible; }
  .rtable { font-size: 9.5pt; }
  .rtable.small { font-size: 8.5pt; }
  .rtable tr { break-inside: avoid; }
  h3 { break-after: avoid; }
}

/* 1.2 · complementos para completar el día (QA C2) */
.extras { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.extras-head { margin: 0 0 4px; font-weight: 700; font-size: .92rem; }
.extras .hint { margin: 4px 0; }
.extra-list { list-style: none; margin: 4px 0 0; padding: 0; }
.extra-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.extra-item:first-child { border-top: 0; }
.ei-main { display: flex; flex-direction: column; min-width: 0; }
.ei-title { font-weight: 600; line-height: 1.3; }
.extra-item .switch { flex: none; }
.kcal-ref-block .field-row b { font-variant-numeric: tabular-nums; }
.si-g { text-align: right; }
.si-g small { display: block; font-size: .78rem; }
.ex-var { display: block; color: var(--ink-2); font-size: .86rem; margin-top: 2px; }
