/* ===== Entrenador · sistema visual =====
   Organització tipus TrainingPeaks, estètica pròpia: fons clar, números condensats, un sol accent. */
:root {
  /* 60 % blanc · 30 % blau · 10 % verd llima (només sobre blau o com a farciment amb text blau) */
  --white: #FFFFFF; --navy: #14284B; --lime: #D7FF1E;
  --navy2: #1E3763; --navy3: #2C4A7C; --on-navy: #C3CDE0; --on-navy2: #8D9CB8;
  --bg: #FFFFFF; --card: #FFFFFF; --soft: #F3F6FA; --line: #E3E8F0; --line2: #EDF1F6; --line3: #CBD3E0;
  --ink: #14284B; --ink2: #3E4E6C; --muted: #66748F; --muted2: #4A5A78;
  --nav: #14284B; --nav2: #1E3763; --nav-active: #2C4A7C; --nav-text: #C3CDE0;
  --accent: #14284B; --accent-ink: #14284B; --accent-soft: #EEF2F8; --accent-dark: #0C1A33; --accent-bright: #3D63A8;
  --ok: #2F8F6B; --ok-ink: #1F6B4F; --ok-soft: #E5F3EC; --ok-bg: #F0F8F4; --ok-line: #CDE6DA;
  --warn: #D39516; --warn-ink: #8A5D08; --warn-bg: #FDF5E4; --warn-line: #F1DFB2;
  --bad: #C2414F; --bad-ink: #9C2A38; --bad-bg: #FBECEE; --bad-line: #F1CBD1;
  --ctl: #14284B; --atl: #E8743F; --tsb: #7C8AA5;
  --z1: #A9B4C6; --z2: #4C7BD0; --z3: #2FA58A; --z4: #E3AA2E; --z5: #E8743F; --z6: #CF4659; --z7: #7B4FB0;
  --radius: 14px;
  --display: Archivo, "Arial Narrow", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 15px/1.45 Archivo, system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); font-variant-numeric: tabular-nums; }
a { color: var(--accent-ink); }
a:hover { color: var(--accent-dark); }
h1, h2, h3, p { margin: 0; }
svg { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ----- tipografia ----- */
.eyebrow { font-size: 13.5px; font-weight: 600; color: var(--muted); }
h2.eyebrow { font-family: var(--display); font-stretch: 72%; font-stretch: 78%; font-size: 19px; font-weight: 700; color: var(--ink); line-height: 1.15; }
.display-xl { font-family: var(--display); font-stretch: 70%; font-weight: 800; font-size: 46px; line-height: 1; letter-spacing: -.01em; }
.display-l { font-family: var(--display); font-stretch: 72%; font-weight: 700; font-size: 36px; line-height: 1; }
.display-m { font-family: var(--display); font-stretch: 72%; font-weight: 700; font-size: 28px; line-height: 1.05; }
.num { font-family: var(--display); font-stretch: 72%; font-weight: 700; line-height: 1; }
.sub { font-size: 14px; color: var(--ink2); }
.link { font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
h3 { margin: 24px 0 10px; font-family: var(--display); font-stretch: 80%; font-size: 18px; font-weight: 700; color: var(--ink); }

/* ----- estructura ----- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 232px; flex: none; padding: 24px 16px; background: var(--nav); color: #FFFFFF; display: flex; flex-direction: column; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand span { font-family: var(--display); font-stretch: 72%; font-weight: 700; font-size: 22px; }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-links a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--nav-text); text-decoration: none; font-weight: 500; font-size: 15px; cursor: pointer; }
.nav-links a:hover { background: var(--nav2); color: #fff; }
.nav-links a.active { background: var(--nav-active); color: #fff; font-weight: 600; }
.nav-links svg, .tabbar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.who { margin-top: auto; padding: 14px 12px; border-radius: 10px; background: var(--nav2); display: flex; flex-direction: column; gap: 4px; }
.who span { font-size: 13px; color: #AFBBD2; }
.who .who-cost { font-size: 12px; color: #8D9CB8; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 40px 56px; }
.view { display: none; flex-direction: column; gap: 20px; }
.view.active { display: flex; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 6px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 20px; }
.row > .card { flex: 1 1 340px; min-width: 0; }
.row > .today-card { flex: 2 1 560px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.card-head > div { display: flex; flex-direction: column; gap: 4px; }
.tabbar { display: none; }

/* ----- controls ----- */
.btn { font: inherit; font-weight: 600; font-size: 15px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line3); background: #fff; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #93A1B8; color: var(--ink); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.btn.icon { width: 44px; padding: 0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: var(--accent-dark); color: #fff; }
.btn.danger-outline { border: 1.5px solid var(--bad); color: var(--bad-ink); }
.btn.danger-outline.active { background: var(--bad); color: #fff; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }
.chip { font: inherit; font-size: 14px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid #D5DCE7; background: var(--soft); color: var(--ink2); cursor: pointer; }
.chip:hover { border-color: #93A1B8; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); }
.pill.accent { background: var(--accent-soft); color: var(--accent-dark); }
.pill.neutral { background: #fff; border: 1px solid #D5DCE7; color: var(--ink); font-weight: 600; }
.pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line3); border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 44px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible, a:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted2); }
label.full { margin-top: 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 12px 0; font-size: 14px; }
.checks label { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; font-weight: 500; }
.checks input { width: 18px; height: 18px; min-height: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form label { min-width: 160px; }
.inline-form .grow { flex: 1 1 260px; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
.avail { width: 100%; border-collapse: collapse; min-width: 560px; }
.avail th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; }
.avail td { padding: 4px 6px; }
.avail td:first-child { width: 100px; text-transform: capitalize; font-weight: 600; }
.avail td:nth-child(2) { width: 150px; }
.avail td:nth-child(3) { width: 70px; text-align: center; }
.avail input[type=checkbox] { width: 20px; height: 20px; min-height: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 28px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-size: 32px; }
.stat span { font-size: 13px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sq { display: inline-block; width: 11px; height: 11px; border-radius: 2px; }
.sq.ok { background: var(--ok); } .sq.warn { background: var(--warn); } .sq.bad { background: var(--bad); }
.sq.plan { background: #fff; border: 1.5px solid #93A1B8; } .sq.other { background: #F3F6FA; border: 1.5px dashed #93A1B8; }
.sq.off { background: repeating-linear-gradient(45deg, #F2C9CF, #F2C9CF 2px, #FBEDEF 2px, #FBEDEF 4px); } .sq.lim { background: #FBEBD3; border: 1px solid #E8C27E; }
.empty { padding: 18px; border: 1.5px dashed var(--line3); border-radius: 10px; color: var(--ink2); font-size: 14px; }

/* ----- banners i estat ----- */
#banner > div, #replan-status > div { max-width: 1160px; margin: 14px auto 0; padding: 12px 16px; border-radius: 10px; font-size: 14px; white-space: pre-wrap; }
#banner > div { background: var(--warn-bg); color: #6B4806; border: 1px solid var(--warn-line); }
#banner > div.err { background: var(--bad-bg); color: #7E1F2C; border-color: var(--bad-line); }
#replan-status { padding: 0 40px; }
.rp-pending { background: #EEF2F8; color: #14284B; border: 1px solid #D5DCE7; }
.rp-done { background: var(--ok-bg); color: #1F6B4F; border: 1px solid var(--ok-line); }
.rp-err { background: var(--bad-bg); color: #7E1F2C; border: 1px solid var(--bad-line); }
.rp-done .acts, .msg .acts, .rev-adj .acts { margin-top: 8px; font-size: 13px; color: var(--muted2); }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 60; font-size: 14px; }
#toast.show { opacity: .96; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } #toast { transition: none; } }

/* ----- Avui ----- */
.today-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.today-head > div { display: flex; flex-direction: column; gap: 6px; }
.today-title { font-family: var(--display); font-stretch: 72%; font-weight: 700; font-size: 32px; line-height: 1.05; }
.profile { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); }
.profile i { display: block; min-width: 2px; border-radius: 3px 3px 0 0; }
.profile.big { height: 120px; }
.profile.mid { height: 96px; }
.profile.tiny { height: 18px; gap: 1px; border: 0; }
.profile.tiny i { border-radius: 1px; min-width: 1px; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.tstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.tstat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--soft); }
.tstat .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.tstat .num { font-size: 28px; line-height: 1.1; }
.tstat .pl { font-size: 13px; color: var(--muted); }
.today-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.synced { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink2); }
.synced svg { width: 16px; height: 16px; fill: none; stroke: var(--ok-ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.rpe { display: flex; flex-direction: column; gap: 8px; }
.rpe-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rpe-row button { font: inherit; font-size: 14px; font-weight: 600; min-height: 44px; border-radius: 8px; border: 1.5px solid var(--line3); background: #fff; cursor: pointer; color: var(--ink); }
.rpe-row button:hover { border-color: #93A1B8; }
.rpe-row button.sel { background: var(--ink); border-color: var(--ink); color: #fff; }
.rec-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line2); }
.rec-row:last-of-type { border-bottom: 0; }
.rec-info { display: grid; gap: 2px; min-width: 0; }
.rec-row .lbl { font-size: 14px; color: var(--ink2); }
.rec-row .lbl .u { color: var(--muted); font-size: 12px; }
.rec-row .num { font-size: 30px; line-height: 1.1; }
.rec-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rec-tags .sub { font-size: 12px; }
.rec-chart { width: 100%; height: auto; display: block; overflow: visible; }
.rec-band { fill: var(--ok-soft); }
.rec-line { fill: none; stroke: var(--line3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rec-pt circle:first-child { fill: var(--ink2); }
.rec-pt .hit { fill: transparent; }
.rec-pt:hover circle:first-child { r: 4.5; }
.rec-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.rec-legend .sw { width: 18px; height: 10px; border-radius: 3px; background: var(--ok-soft); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--accent-ink); text-decoration: underline; cursor: pointer; }
.coach-note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.coach-note { margin-bottom: 4px; }
.coach-note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; line-height: 1.45; color: var(--ink); }
.coach-note.calm { background: var(--ok-bg); color: #1F6B4F; }
.coach-note svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.card-head > .pmc-legend, .pmc-legend { display: flex; flex-direction: row; gap: 28px; flex-wrap: wrap; }
.pmc-legend > div { display: flex; flex-direction: column; }
.pmc-legend .k { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.pmc-legend .k i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.pmc-legend .num { font-size: 34px; }
.pmc-chart svg { width: 100%; height: 250px; display: block; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wday { display: flex; flex-direction: column; gap: 6px; padding: 8px 6px; border-radius: 8px; background: #fff; border: 1.5px solid var(--line); min-height: 108px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.wday.today { border-color: var(--accent-bright); background: #F3F6FA; }
.wday .d { font-size: 12px; font-weight: 700; color: var(--muted); }
.wday .bar { height: 5px; border-radius: 3px; background: var(--line3); }
.wday .n { font-size: 13px; font-weight: 600; line-height: 1.2; overflow: hidden; overflow-wrap: anywhere; hyphens: auto; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.wday .m { margin-top: auto; font-size: 12px; color: var(--muted); }
.season-bar { display: flex; gap: 3px; height: 54px; position: relative; }
.season-bar div { min-width: 0; border-radius: 6px; color: #fff; display: flex; align-items: center; justify-content: center; padding: 0 6px; font-family: var(--display); font-stretch: 72%; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; }
.season-bar .now { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--ink); border-radius: 1px; }
.miles { display: flex; flex-direction: column; gap: 10px; }
.mile { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.mile .num { font-size: 18px; color: var(--accent-ink); }
.mile span { font-size: 14px; line-height: 1.4; color: var(--ink2); }
.mile b { color: var(--ink); }
.ph-transicio { background: #93A1B8; } .ph-base { background: var(--z2); } .ph-construccio { background: var(--z4); }
.ph-especific { background: var(--z5); } .ph-pic { background: var(--z6); } .ph-puesta_a_punt { background: var(--z7); }
.ph-competicio { background: var(--z6); } .ph-recuperacio { background: var(--z3); }

/* ----- Calendari ----- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar h1 { margin: 0 6px; }
.spacer { flex: 1 1 0; }
.mark-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px 14px; border-radius: 10px; background: var(--bad-bg); border: 1px solid var(--bad-line); font-size: 14px; }
.mark-bar[hidden] { display: none; }
.mark-bar label { min-width: 160px; }
.month-head, .wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 150px; gap: 6px; }
.month-head { font-size: 12px; font-weight: 700; color: var(--muted); }
.month-head span { padding-left: 8px; }
.month-grid { display: flex; flex-direction: column; gap: 6px; }
.mday { min-height: 150px; padding: 6px; border-radius: 8px; background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mday.out { background: #F7F9FC; opacity: .72; }
.mday.today { border: 2px solid var(--accent-bright); }
.mday.blocked { background: repeating-linear-gradient(45deg, #FBEDEF, #FBEDEF 8px, #F6DCE0 8px, #F6DCE0 16px); border: 1.5px solid #E3A3AD; }
.mday.limited { background: #FBEBD3; border: 1.5px solid #E8C27E; }
.mday-h { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-height: 20px; }
.mday-h .dn { font-size: 13px; font-weight: 700; }
.mday.today .dn { color: var(--accent-ink); }
.mday-h .tag { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.mday.today .tag { color: var(--accent-ink); }
.mday.blocked .tag { color: var(--bad-ink); }
.mday.limited .tag { color: var(--warn-ink); }
.it { padding: 6px 7px; border-radius: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; background: #fff; border: 1.5px solid #C6CFDD; }
.it:hover { box-shadow: 0 3px 10px rgba(20,40,75,.12); }
.it .t { display: flex; align-items: center; gap: 5px; min-width: 0; }
.it .t i { flex: none; width: 8px; height: 8px; border-radius: 2px; background: #93A1B8; }
.it .t b { font-size: 12.5px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it .m { font-size: 11.5px; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it.done { background: var(--ok-bg); border: 1px solid var(--ok-line); } .it.done .t i { background: var(--ok); }
.it.part { background: var(--warn-bg); border: 1px solid var(--warn-line); } .it.part .t i { background: var(--warn); }
.it.miss { background: var(--bad-bg); border: 1px solid var(--bad-line); } .it.miss .t i { background: var(--bad); }
.it.other { background: #F3F6FA; border: 1.5px dashed #B3BED0; }
.it.note { background: transparent; border: 1px dashed #C6CFDD; }
.it.gym .t i { background: var(--ink); }
.it.err { border-color: var(--bad); }
.month-grid.marking .mday { cursor: crosshair; }
.month-grid.marking .mday:not(.past):hover { border-color: var(--bad); }
.month-grid.marking .it { pointer-events: none; }
.wsum { padding: 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wsum .blk { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsum .num { font-size: 24px; }
.wsum span { font-size: 12px; color: var(--muted2); }
.wsum .meter { height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; }
.wsum .meter i { display: block; height: 6px; background: var(--ok); }
.cal-legend { padding-top: 4px; }

/* ----- calaix ----- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(20,40,75,.32); z-index: 40; }
.drawer { position: fixed; top: 16px; right: 16px; bottom: 16px; width: 400px; max-width: calc(100vw - 32px); overflow-y: auto; background: #fff; border: 1px solid #D5DCE7; border-radius: var(--radius); box-shadow: 0 18px 48px rgba(20,40,75,.22); padding: 20px 22px; z-index: 50; }
.drawer[hidden], .drawer-backdrop[hidden] { display: none; }
#drawer-body { display: flex; flex-direction: column; gap: 14px; }
.dhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dhead > div { display: flex; flex-direction: column; gap: 4px; }
.dstats { display: flex; flex-wrap: wrap; gap: 18px; }
.dstats > div { display: flex; flex-direction: column; }
.dstats span { font-size: 12px; color: var(--muted); }
.dstats .num { font-size: 24px; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.steps li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px; }
.note-box { padding: 12px 14px; border-radius: 10px; background: var(--soft); font-size: 14px; line-height: 1.45; color: var(--ink2); white-space: pre-wrap; }

/* ----- Pla ----- */
#plan-content { display: flex; flex-direction: column; gap: 22px; }
.plan-top { display: flex; flex-direction: column; gap: 16px; }
.plan-facts { display: flex; flex-wrap: wrap; gap: 10px; }
.plan-facts > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 10px; background: var(--soft); min-width: 140px; }
.plan-facts span { font-size: 12px; font-weight: 600; color: var(--muted); }
.plan-facts .num { font-size: 22px; }
.season-wrap { display: flex; flex-direction: column; gap: 6px; }
.season-dates { display: flex; gap: 3px; font-size: 12px; color: var(--muted); position: relative; }
.season-dates span { min-width: 0; white-space: nowrap; overflow: hidden; }
.season-dates .end { position: absolute; right: 0; top: 0; background: var(--card); padding-left: 6px; }
.plan-summary { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; border-radius: 12px; background: var(--soft); }
.plan-summary p { max-width: 78ch; font-size: 15px; line-height: 1.65; color: var(--ink2); }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.flow-lbl { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.flow-step { padding: 5px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.flow-arrow { color: var(--muted); font-weight: 700; }
.blocks { display: flex; flex-direction: column; gap: 12px; }
.block { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.block.past { opacity: .75; }
.block summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--ph); }
.block summary::-webkit-details-marker { display: none; }
.block summary:hover { background: #F7F9FC; }
.block summary:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: -2px; }
.block-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.block-title .ph-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--ph); flex: none; }
.block-name { font-family: var(--display); font-stretch: 72%; font-weight: 700; font-size: 23px; line-height: 1.1; }
.block-title .pill { font-size: 12px; padding: 3px 9px; }
.block-title::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 2.5px solid var(--muted); border-bottom: 2.5px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.block[open] .block-title::after { transform: rotate(225deg); }
.block-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bchip { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--ink2); white-space: nowrap; }
.bchip.strong { background: var(--ink); color: #fff; font-weight: 600; }
.block-body { padding: 4px 18px 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px 28px; }
.bsec { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bsec.wide { grid-column: 1 / -1; }
.bsec h5 { margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.bsec p, .bsec li { font-size: 14.5px; line-height: 1.6; color: var(--ink2); }
.bsec ol, .bsec ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.bsec ol li::marker { font-weight: 700; color: var(--ink); }
.wk-chip { display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--ok-bg); border: 1px solid var(--ok-line); color: #1F6B4F; margin: 0 6px 6px 0; }
@media (prefers-reduced-motion: reduce) { .block-title::after { transition: none; } }

/* ----- Coach ----- */
.chat-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.chat-card { flex: 999 1 520px; padding: 0; gap: 0; height: calc(100vh - 84px); min-height: 560px; }
.chat-top { padding: 18px 24px; border-bottom: 1px solid var(--line2); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chat-log { flex: 1 1 auto; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 640px; padding: 14px 16px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.msg.user { align-self: flex-end; max-width: 560px; border-radius: 14px 4px 14px 14px; background: var(--ink); color: #fff; }
.msg.assistant { align-self: flex-start; border-radius: 4px 14px 14px 14px; background: var(--bg); }
.msg.thinking { color: var(--muted2); font-style: italic; }
.sysnote { align-self: stretch; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); font-size: 14px; line-height: 1.45; color: var(--ink2); white-space: pre-wrap; }
.sysnote svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.acts-cards { display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.act { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 14px; color: var(--ink); }
.act svg { width: 18px; height: 18px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feedback { align-self: flex-start; max-width: 640px; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; }
.composer { padding: 14px 18px 18px; border-top: 1px solid var(--line2); display: flex; flex-direction: column; gap: 10px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer-row textarea { flex: 1; }
.chat-side { flex: 1 1 300px; min-width: 0; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.mem-item { display: flex; flex-direction: column; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line2); }
.mem-item .cat { font-size: 11px; font-weight: 700; color: var(--ctl); }
.mem-item span { font-size: 14px; line-height: 1.4; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini-stats > div { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; background: var(--soft); }
.mini-stats span { font-size: 12px; color: var(--muted); }
.mini-stats .num { font-size: 24px; }
.meter-lg { height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; }
.meter-lg i { display: block; height: 6px; background: var(--ok); }

/* ----- Objectius i memòria ----- */
.goal { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--soft); }
.goal + .goal { margin-top: 8px; }
.goal .prio { font-family: var(--display); font-stretch: 72%; font-weight: 700; font-size: 20px; width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; background: #8A939B; flex: none; }
.goal .prio.A { background: var(--accent); } .goal .prio.B { background: var(--ctl); }
.goal .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.goal .body b { font-size: 16px; }
.goal .body span { font-size: 14px; color: var(--muted2); }
.goal.closed { opacity: .55; }
.mem-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.mem-row .cat { font-size: 11px; font-weight: 700; color: var(--ctl); min-width: 150px; }
.mem-row .c { flex: 1; font-size: 15px; }
.mem-row .dt { font-size: 12px; color: var(--muted); }


/* ----- nutrició ----- */
.body-card { flex: 2 1 560px !important; }
.energy-card { flex: 1 1 340px; }
.card-head > .seg { display: flex; flex-direction: row; gap: 6px; flex-wrap: wrap; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.body-chart { position: relative; height: 230px; margin: 4px 44px 0 44px; }
.body-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.body-chart .empty { position: static; }
.bdot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); border: 2px solid #fff; box-sizing: content-box; }
.bdot.src-intervals { background: #fff; border: 2px solid var(--ink); width: 6px; height: 6px; }
.bdot.bf { background: var(--z7); }
.yl { position: absolute; left: -44px; transform: translateY(-50%); font-size: 12px; color: var(--muted); width: 40px; text-align: right; }
.yl.r { left: auto; right: -44px; text-align: left; color: var(--z7); }
#body-axis { margin: 0 44px; }
.body-log summary, .nday summary { cursor: pointer; }
.body-log summary { font-size: 14px; font-weight: 600; color: var(--ink2); }
.body-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.body-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; }
.body-table td { padding: 6px; border-top: 1px solid var(--line2); }
.body-table td.num { font-size: 18px; }
.src { margin-left: 6px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.calc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.calc li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.calc li span { font-weight: 600; font-size: 14px; }
.calc li .num { font-size: 22px; text-align: right; }
.calc li small { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.calc-ex { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.calc-ex > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--soft); }
.calc-ex span { font-size: 12px; color: var(--muted); font-weight: 600; }
.calc-ex .num { font-size: 24px; }
.calc-ex small { font-size: 12px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }
.meals-table td:first-child { width: 120px; text-transform: none; }
.meals-table td:nth-child(2) { width: 200px; }
.meals-table td:last-child { width: 52px; }
.meals-table td:nth-child(3) { width: auto; text-align: left; }
.nday summary > .pill { justify-self: start; }
.icon-sm svg { width: 14px; height: 14px; }
label.check-inline { flex-direction: row; align-items: center; gap: 8px; min-width: 0; min-height: 44px; color: var(--ink); font-size: 14px; font-weight: 500; }
label.check-inline input { width: 18px; height: 18px; min-height: 0; }
.nut-preview { display: flex; flex-direction: column; gap: 8px; }
.nut-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nchip { font-size: 13px; padding: 5px 10px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); color: var(--ink2); white-space: nowrap; }
.nchip.has { background: var(--ok-bg); border-color: var(--ok-line); color: #1F6B4F; }
.nchip.stale { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.macro-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--line2); min-width: 120px; }
.macro-bar i { display: block; }
.mc { background: var(--z4); } .mp { background: var(--z2); } .mf { background: #93A1B8; }
.mtxt { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.mtxt b { font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.mtxt b::before { content: ""; width: 8px; height: 8px; border-radius: 2px; }
.mc-t::before { background: var(--z4); } .mp-t::before { background: var(--z2); } .mf-t::before { background: #93A1B8; }
.ndays { display: flex; flex-direction: column; gap: 10px; }
.nday { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.nday summary { list-style: none; display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(180px, 1fr) auto; gap: 8px 20px; align-items: center; padding: 14px 18px; }
.nday summary::-webkit-details-marker { display: none; }
.nday-date { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nday-title { font-family: var(--display); font-stretch: 72%; font-size: 21px; line-height: 1.1; overflow-wrap: anywhere; }
.nday-kcal { display: flex; align-items: baseline; gap: 5px; }
.nday-kcal .num { font-size: 30px; }
.nday-kcal span { font-size: 13px; color: var(--muted); }
.nday-macros { display: flex; flex-direction: column; gap: 6px; }
.nday-body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.nday-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.warn-box { background: var(--warn-bg); color: #6B4806; }
.meals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.meal { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-top: 1px solid var(--line2); position: relative; }
.meal .mt { font-size: 19px; padding-top: 2px; }
.meal .mbody { display: flex; flex-direction: column; gap: 4px; padding-left: 14px; border-left: 3px solid var(--line3); min-width: 0; }
.meal.k-pre_entreno .mbody, .meal.k-post_entreno .mbody { border-left-color: var(--z4); }
.meal.k-durant .mbody { border-left-color: var(--navy); }
.meal.k-durant { background: linear-gradient(90deg, var(--soft), transparent 70%); }
.mhead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.mkcal { font-size: 13px; color: var(--muted); }
.meal ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink2); }
.meal em { font-size: 13px; color: var(--muted); }
.meals.compact .meal { padding: 6px 0; grid-template-columns: 50px minmax(0, 1fr); }
.meals.compact .mt { font-size: 16px; }
.nut-compact { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.nut-compact-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.nut-compact-h .eyebrow { display: inline-flex; align-items: center; gap: 6px; }
.nut-compact-h .eyebrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nut-compact-h .num { font-size: 24px; }

/* ===== Mòbil i tauleta ===== */
@media (max-width: 1000px) {
  .main { padding: 22px 20px 40px; }
  #replan-status { padding: 0 20px; }
  .month-head, .wk { grid-template-columns: repeat(7, minmax(0, 1fr)) 120px; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; height: calc(68px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted2); text-decoration: none; font-size: 11.5px; font-weight: 600; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--accent-ink); font-weight: 700; }
  .main { padding: calc(18px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  #replan-status { padding: 0 16px; }
  .display-xl { font-size: 36px; }
  .card { padding: 16px; }
  .row > .card, .row > .today-card { flex-basis: 100%; }
  .today-title { font-size: 25px; }
  .week-strip { grid-template-columns: repeat(7, minmax(84px, 1fr)); overflow-x: auto; }
  .pmc-legend { gap: 18px; }
  .pmc-legend .num { font-size: 28px; }
  /* calendari com a llista de dies */
  .month-head { display: none; }
  .wk { display: flex; flex-direction: column; gap: 6px; }
  .wsum { order: -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; background: var(--soft); }
  .wsum .meter { flex: 1 1 100%; }
  .mday { min-height: 52px; position: relative; padding-left: 76px; }
  .mday-h { position: absolute; left: 8px; top: 8px; width: 62px; flex-direction: column; align-items: flex-start; }
  .mday.out { display: none; }
  .mday.empty-day { opacity: .65; }
  .chat-card { height: calc(100vh - 150px); }
  .chat-top .sub { display: none; }
  .suggest { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .suggest .chip { flex: none; }
  .chat-side { max-width: none; }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: none; max-height: 88vh; border-radius: 16px 16px 0 0; }
  .toolbar .spacer { display: none; }
  .steps li { grid-template-columns: 100px minmax(0, 1fr); }
  .tabbar a { font-size: 10.5px; }
  .nday summary { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
  .nday-macros { grid-column: 1 / -1; }
  .nday-body { padding: 0 14px 14px; }
  .body-chart { height: 190px; margin: 4px 36px 0; }
  #body-axis { margin: 0 36px; }
  .yl { left: -38px; width: 34px; } .yl.r { right: -38px; }
  .meals-table { min-width: 520px; }
}

/* anàlisi de sessions */
#rev-list { display: grid; gap: 10px; margin: 4px 0 12px; }
.rev { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
#rev-list .rev:last-child { border-bottom: 0; }
.rev-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rev-name { min-width: 0; overflow-wrap: anywhere; }
.rev-note { font-size: 13px; }
.rev-adj summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.rev-adj > div { font-size: 14px; white-space: pre-line; margin-top: 6px; }
#drawer-rev .rev { border-bottom: 0; padding: 0; }
@media (max-width: 560px) {
  .rec-row { grid-template-columns: 1fr; gap: 6px; }
  .rec-info { grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; }
  .rec-info .lbl { grid-column: 1 / -1; }
  .rec-info .num { grid-row: 2; }
  .rec-info .rec-tags { grid-row: 2; }
}

/* despesa real del dia */
.actual-box { display: grid; gap: 4px; padding: 12px 14px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); margin: 8px 0; }
.actual-box p { margin: 0; font-size: 14px; line-height: 1.45; }
.actual-box .sub { font-size: 12px; }
.actual-box .eyebrow { display: flex; align-items: center; gap: 6px; }
.actual-box .eyebrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.actual-box.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.actual-box.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.actual-box.accent { background: var(--accent-soft); border-color: #D5DCE7; }

/* ===== guia i flux ===== */
.nav-group { margin: 14px 12px 4px; font-size: 11px; font-weight: 600; color: #8D9CB8; }
.nav-group:first-child { margin-top: 0; }
.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent-bright); } 100% { box-shadow: 0 0 0 3px transparent; } }
.link.small, a.small { font-size: 13px; }
.opt { font-family: Archivo, sans-serif; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; vertical-align: middle; letter-spacing: 0; text-transform: none; }
.req { font-size: 12px; font-weight: 600; color: var(--accent-ink); margin-left: 6px; }

.guide-card { border-color: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.guide-top { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.guide-top > div { flex: 1 1 280px; display: grid; gap: 4px; }
.guide-top .btn { flex: none; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px 14px; }
.setup-steps li { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.setup-steps a { color: var(--ink2); text-decoration: none; min-width: 0; }
.setup-steps a:hover b { text-decoration: underline; }
.setup-steps b { font-weight: 500; }
.setup-steps .dot, .plan-rail .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--soft); border: 1px solid var(--line3); color: var(--muted); }
.setup-steps .dot svg, .plan-rail .dot svg, .step-state svg, .all-good svg, #pin-status svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.setup-steps li.done .dot, .plan-rail li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.setup-steps li.done b { color: var(--muted); }
.setup-steps li.current .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.setup-steps li.current b { font-weight: 700; color: var(--ink); }
.setup-steps li.locked { opacity: .55; }
.todo { list-style: none; margin: 0; padding: 0; display: grid; }
.todo li { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.todo li:last-child { border-bottom: 0; }
.todo li > div { display: grid; gap: 2px; min-width: 0; }
.todo li.high b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.todo li.tip b { font-weight: 500; }
.todo .btn { flex: none; }
.all-good { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ok-ink); font-weight: 600; }

/* pàgina del pla com a passos */
.plan-rail { list-style: none; margin: 0 0 4px; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; counter-reset: none; }
.plan-rail li { flex: 1 1 140px; }
.plan-rail a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: var(--ink2); text-decoration: none; font-weight: 600; font-size: 14px; }
.plan-rail a:hover { border-color: var(--line3); }
.step-card { scroll-margin-top: 16px; }
.step-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.step-head > div { display: grid; gap: 4px; }
.step-n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font-family: var(--display); font-stretch: 72%; font-weight: 700; font-size: 19px; }
.step-state { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.step-state.done { background: var(--ok-soft); color: var(--ok-ink); border-color: var(--ok-line); }
.step-state.todo { background: var(--accent-soft); color: var(--accent-dark); border-color: #D5DCE7; }
.step-state.locked { opacity: .8; }
.locked-note { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--soft); border: 1px dashed var(--line3); color: var(--ink2); font-size: 14px; }
.step-more > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent-ink); padding: 4px 0; }
.step-more[open] > summary { margin-bottom: 8px; }
.goal-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.goal-mini li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.week-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.wpill { display: grid; gap: 1px; padding: 6px 12px; border-radius: 10px; border: 1px dashed var(--line3); background: var(--card); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--ink); text-align: left; }
.wpill small { font-size: 11px; font-weight: 500; color: var(--accent-ink); }
.wpill.has { border-style: solid; border-color: var(--ok-line); background: var(--ok-bg); }
.wpill.has small { color: var(--ok-ink); }

/* perfil */
.profile-nav { display: flex; gap: 6px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; padding: 8px 0; background: var(--bg); }
.profile-nav a { padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink2); text-decoration: none; font-size: 14px; font-weight: 500; }
.profile-nav a:hover { border-color: var(--line3); }
#profile-form h3 { scroll-margin-top: 64px; }
label.missing input { border-color: var(--warn); background: var(--warn-bg); }
label.missing::after { content: "Falta"; font-size: 12px; font-weight: 600; color: var(--warn-ink); }
#profile-security { scroll-margin-top: 64px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.set-block { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); min-width: 0; }
.set-block h3 { margin: 0; font-size: 16px; }
.set-block .inline-form { margin: 0; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#pin-status { display: flex; gap: 6px; align-items: baseline; }

/* bloqueig amb PIN */
body.locked .app, body.locked .tabbar { visibility: hidden; }
body.locked .lock { visibility: visible; }
.lock { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); padding: 16px; }
.lock-box { display: grid; justify-items: center; gap: 10px; width: min(340px, 100%); padding: 28px 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
.lock-box input { width: 100%; font-size: 28px; letter-spacing: .4em; text-align: center; padding: 10px; border: 1px solid var(--line3); border-radius: 10px; }
.lock-box .btn { width: 100%; justify-content: center; }
.lock-err { margin: 0; min-height: 1.2em; color: var(--bad-ink); font-size: 14px; }
@media (max-width: 560px) {
  .step-head { grid-template-columns: auto minmax(0, 1fr); }
  .step-head .step-state { grid-column: 2; justify-self: start; }
  .todo li { flex-wrap: wrap; }
}

/* App instal·lada a la pantalla d'inici (PWA) */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
.lock { padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
@media (max-width: 760px) {
  .drawer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* ===== Estil 2026: blanc, blau i verd llima ===== */
.brand span { font-family: var(--display); font-stretch: 72%; font-size: 24px; font-weight: 800; letter-spacing: 0; }
.nav-links a.active { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--lime); }
.nav-links a.active svg { stroke: var(--lime); }
.nav-group { color: var(--on-navy2); }
.who { background: var(--navy2); }
.card { border-color: var(--line); }
.btn { border-color: var(--line3); color: var(--ink); }
.btn:hover { border-color: var(--navy); color: var(--ink); }
.btn.primary, .btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover, .btn.dark:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn.lime { background: var(--lime); border-color: var(--lime); color: var(--navy); }
.btn.lime:hover { background: #E4FF66; border-color: #E4FF66; color: var(--navy); }
.pill.accent { background: var(--navy); color: #fff; }
.pill.lime { background: var(--lime); color: var(--navy); }
.chip.active, .rpe-row button.sel { background: var(--navy); border-color: var(--navy); color: #fff; }
.msg.user { background: var(--navy); }
.msg.assistant { background: var(--soft); }
.goal .prio.A { background: var(--navy); } .goal .prio.B { background: var(--z2); }
.mile .num { color: var(--ink); }
.todo li.high b::before { background: var(--lime); box-shadow: 0 0 0 1.5px var(--navy); }
.setup-steps li.current .dot { background: var(--lime); border-color: var(--navy); color: var(--navy); }
.guide-card { border-color: var(--line); box-shadow: inset 4px 0 0 var(--navy); }
.coach-note { background: var(--soft); color: var(--ink); }
.coach-note.calm { background: var(--ok-bg); color: var(--ok-ink); }
.step-state.todo { background: var(--accent-soft); color: var(--ink); border-color: var(--line3); }
.mday.today { border: 2px solid var(--navy); }
.mday.today .dn, .mday.today .tag { color: var(--ink); }
.mday.today .dn { background: var(--lime); padding: 0 6px; border-radius: 4px; }
.season-bar .now { background: var(--navy); box-shadow: 0 0 0 2px #fff; }
.step-n { background: var(--navy); }
.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--lime), 0 0 0 5px var(--navy); } 100% { box-shadow: 0 0 0 3px transparent; } }
input:focus, select:focus, textarea:focus { border-color: var(--navy); }
#toast { background: var(--navy); }

/* capçalera d'Avui */
.home-hero { background: var(--navy); color: #fff; border-radius: 20px; padding: 26px 28px 0; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.hero-date { color: var(--on-navy); font-size: 14px; }
.home-hero h1 { color: #fff; margin-top: 2px; }
.hero-state { font-size: 15px; color: #D3DCEB; max-width: 62ch; }
.hero-state b { color: var(--lime); font-weight: 600; }
.hero-chart { margin-top: 6px; }
.hero-chart svg { display: block; width: 100%; height: 84px; overflow: visible; }
.hero-days { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--on-navy2); padding: 6px 0 4px; }
.hero-days span { width: 0; display: flex; justify-content: center; white-space: nowrap; }
.hero-days .t { color: var(--lime); font-weight: 700; }
.hero-cap { font-size: 12px; color: var(--on-navy2); padding-bottom: 14px; }

/* setmana d'un cop d'ull */
.wk-cols { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wcol { display: flex; flex-direction: column; align-items: stretch; gap: 6px; font: inherit; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; text-align: center; min-width: 0; }
.wcol .d { font-size: 12px; }
.wcol .col { height: 76px; background: var(--soft); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.wcol .col i { display: block; width: 100%; border-radius: 8px 8px 0 0; min-height: 4px; }
.wcol .col i.pending { background: repeating-linear-gradient(135deg, transparent 0 3px, rgba(20,40,75,.16) 3px 5px) !important; border: 1.5px dashed var(--line3); border-bottom: 0; }
.wcol .mk { font-size: 12px; font-weight: 700; color: var(--ink); min-height: 16px; display: flex; justify-content: center; align-items: center; }
.wcol .mk svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.wcol.miss .mk { color: var(--bad); }
.wcol.part .mk { color: var(--warn-ink); }
.wcol.today { color: var(--ink); font-weight: 700; }
.wcol.today .col { outline: 2px solid var(--navy); outline-offset: 2px; }
.wcol.today .mk span { background: var(--lime); padding: 0 5px; border-radius: 4px; }
.wcol .n { font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.wcol .m { font-size: 11.5px; color: var(--muted); }
.wcol:hover .col { background: var(--line2); }
.wcol:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; border-radius: 8px; }
.zlegend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.zlegend span { display: inline-flex; align-items: center; gap: 5px; }
.zlegend i { width: 9px; height: 9px; border-radius: 2px; }
.wk-sum { display: flex; flex-wrap: wrap; gap: 8px 26px; font-size: 13px; color: var(--muted); }
.wk-sum .num { display: block; font-size: 26px; color: var(--ink); }
.z1 { background: var(--z1); } .z2 { background: var(--z2); } .z3 { background: var(--z3); } .z4 { background: var(--z4); } .z5 { background: var(--z5); } .z6 { background: var(--z6); } .zg { background: var(--navy); }

/* recuperació */
.rec-band { fill: #E6ECF5; }
.rec-line { stroke: var(--navy); stroke-width: 1.8; }
.rec-pt circle:first-child { fill: transparent; }
.rec-pt.off circle:first-child { fill: var(--warn); }
.rec-pt.bad circle:first-child { fill: var(--bad); }
.rec-legend .sw { background: #E6ECF5; }
.rec-row .num { font-size: 32px; }

@media (min-width: 761px) {
  .wcol .col { height: 96px; }
}
@media (max-width: 760px) {
  .tabbar { border-top-color: var(--line); }
  .tabbar a { color: var(--muted); }
  .tabbar a.active { color: var(--ink); }
  .tabbar a.active svg { background: var(--lime); border-radius: 7px; box-shadow: 0 0 0 4px var(--lime); }
  /* a la pantalla Avui la capçalera blava arriba fins a dalt de tot */
  .home-hero { margin: calc(-18px - env(safe-area-inset-top)) calc(-16px - env(safe-area-inset-right)) 0 calc(-16px - env(safe-area-inset-left));
    border-radius: 0; padding: calc(24px + env(safe-area-inset-top)) 20px 0; }
  .home-hero .btn { display: none; }
  /* al mòbil, seccions separades per línies en lloc de targetes */
  #view-home > .card, #view-home > .row > .card { border: 0; border-radius: 0; padding: 18px 4px 6px; box-shadow: none; }
  #view-home > .card + .card, #view-home > .row + .card, #view-home > .card + .row > .card, #view-home > .row > .card + .card, #view-home > .row + .row > .card { border-top: 1px solid var(--line); }
  #view-home .guide-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: inset 4px 0 0 var(--navy); margin-top: 14px; }
  #view-home { gap: 8px; }
  .wcol .n, .wcol .m { display: none; }
}
.hero-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--lime); }
.hero-dot.now { width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2.5px solid var(--navy); box-shadow: 0 0 0 2px var(--lime); }
.hero-dot.proj { background: var(--navy); border: 2px solid var(--lime); opacity: .8; }
.hero-chart .hero-days span:first-child { justify-content: flex-start; } .hero-chart .hero-days span:last-child { justify-content: flex-end; }
/* xifres de la sessió: netes, sense caixes */
.tstats { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px 14px; }
.tstat { background: none; padding: 0; }
.tstat .lbl { font-size: 12.5px; font-weight: 500; }
.tstat .num { font-size: 34px; }
@media (max-width: 760px) {
  .tstats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .tstat .num { font-size: 28px; }
  .tstat .pl { font-size: 12px; }
}
.rec-chart { max-width: 460px; margin-left: auto; }
@media (max-width: 560px) { .rec-chart { max-width: none; } }

/* proposta d'esborrar sessions d'altres eines */
.xdel { align-self: flex-start; max-width: 640px; display: grid; gap: 8px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.xdel.pending { border: 2px solid var(--navy); box-shadow: inset 4px 0 0 var(--lime); }
.xdel-h { font-weight: 700; }
.xdel ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
#toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
#toast button { font: inherit; font-weight: 700; background: var(--lime); color: var(--navy); border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
