/* "Carnet de terrain": forest greens, amber, contour lines. Same tokens as the web dashboard. */
:root {
  --page: #F2F0E9;
  --surface: #FFFFFF;
  --ink: #1C241E;
  --muted: #69736A;
  --line: #E5E1D5;
  --forest: #173528;
  --forest-ink: #DCE6DE;
  --accent: #2C7A4E;
  --accent-soft: #E2F0E6;
  --sun: #E9A23B;
  --sun-soft: #FBEFD9;
  --sun-ink: #8A5409;
  --danger: #B4234F;
  --radius: 18px;
  --shadow: 0 1px 1px rgb(23 53 40 / .04), 0 6px 24px -8px rgb(23 53 40 / .14);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Outfit", "Manrope", system-ui, sans-serif;
  --contours: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='160' viewBox='0 0 240 160'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='1.2'%3E%3Cpath d='M-10 120 C40 90 70 130 120 100 S200 60 250 90'/%3E%3Cpath d='M-10 100 C40 70 80 110 125 80 S200 40 250 70'/%3E%3Cpath d='M-10 80 C45 50 85 90 130 60 S205 20 250 50'/%3E%3Cpath d='M-10 140 C40 110 70 150 120 120 S200 80 250 110'/%3E%3Cellipse cx='150' cy='45' rx='30' ry='14'/%3E%3Cellipse cx='150' cy='45' rx='16' ry='7'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #111813; --surface: #19221C; --ink: #E6ECE7; --muted: #9AA79D; --line: #2A352D;
    --forest: #0D1A12; --accent: #5DB583; --accent-soft: #1D3325; --sun-soft: #3A2C14; --sun-ink: #F0C27A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Header ---------- */
.top {
  background: var(--forest) var(--contours); color: var(--forest-ink);
  padding: calc(env(safe-area-inset-top) + 18px) 16px 22px; border-radius: 0 0 26px 26px;
}
.top h1 { color: #fff; font-size: 26px; }
.top .eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--sun); font-weight: 700; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-btn { background: rgb(255 255 255 / .1); border: 0; color: #fff; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }

main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 18px; margin-bottom: 8px; }

/* ---------- Tab bar ---------- */
.tabs {
  position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10;
}
.tabs button { background: none; border: 0; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 0; border-radius: 12px; }
.tabs button svg { width: 22px; height: 22px; }
.tabs button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .legend { font-weight: 700; font-size: 14px; }
.field .hint { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); min-height: 46px;
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn { border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 700; min-height: 48px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--line); }
.btn-sun { background: var(--sun); color: #2B1A02; }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--line); }
.btn-block { width: 100%; }
.actions { display: flex; gap: 10px; margin-top: 8px; }
.actions .btn { flex: 1; }
.error { background: #FBE3EA; color: var(--danger); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 11; box-shadow: var(--shadow); max-width: 608px; margin: 0 auto; }
.notice { background: var(--sun-soft); color: var(--sun-ink); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 600; min-height: 40px; }
.chip-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 8px; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 3px; accent-color: var(--accent); }

/* ---------- Onboarding ---------- */
.steps { display: flex; gap: 6px; margin-top: 14px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: rgb(255 255 255 / .18); }
.steps i.on { background: var(--sun); }

/* ---------- Home ---------- */
.countdown { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.countdown strong { font-family: var(--display); font-size: 54px; color: #fff; line-height: 1; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fact { background: rgb(255 255 255 / .1); color: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--accent-soft); border-radius: 14px; padding: 10px; }
.stat strong { display: block; font-family: var(--display); font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- Plan ---------- */
.phase-bar { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.phase-bar button { flex: 0 0 26px; height: 34px; border-radius: 7px; border: 0; font-size: 11px; font-weight: 700; color: rgb(0 0 0 / .55); }
.phase-bar button.shown { outline: 2.5px solid var(--ink); outline-offset: 1px; }
.phase-bar button.now { box-shadow: inset 0 -3px 0 var(--sun); }
.phase-base { background: #CFE3D5; } .phase-specific { background: #8FC3A2; } .phase-peak { background: #2C7A4E; color: #fff !important; }
.phase-shock { background: #E9A23B; } .phase-deload { background: #E7E2D3; } .phase-taper { background: #DCE7F5; } .phase-race { background: #B4234F; color: #fff !important; }
.legend-row { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 12px; }
.week-nav h2 { font-size: 20px; text-align: center; }
.week-nav .sub { font-size: 13px; color: var(--muted); text-align: center; }
.week-nav button { width: 44px; height: 44px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-size: 20px; }
.week-nav button:disabled { opacity: .35; }

.session { border-left: 5px solid var(--accent); }
.session.t-quality { border-left-color: var(--sun); }
.session.t-long { border-left-color: var(--forest); }
.session.t-race { border-left-color: var(--danger); }
.session.t-test { border-left-color: #2A5A9C; }
.session.t-renfo { border-left-color: #6B3FA0; }
.session.past { opacity: .7; }
.session-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.session-head .day { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: capitalize; }
.session-head h3 { font-size: 17px; margin-top: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.sun { background: var(--sun-soft); color: var(--sun-ink); }
.badge.sent { background: var(--forest); color: #fff; }
.toast.ok { background: var(--accent-soft); color: var(--accent); }
.today-tag { background: var(--sun); color: #2B1A02; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--accent); font-size: 14px; list-style: none; min-height: 32px; display: flex; align-items: center; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "▾"; margin-left: 6px; }
details.more[open] summary::after { content: "▴"; }
.steps-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.steps-list li { background: var(--page); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.steps-list li b { font-weight: 700; }
.steps-list .target { display: block; font-size: 12.5px; color: var(--muted); }
.steps-list .rep { background: transparent; border: 1.5px dashed var(--line); }
.steps-list .rep ul { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }

/* ---------- Strength ---------- */
.exercise { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.exercise:first-of-type { border-top: 0; }
.exercise svg { width: 96px; height: auto; background: var(--page); border-radius: 12px; }
.exercise h3 { font-size: 15px; }

.empty { text-align: center; padding: 28px 16px; }
.empty svg { width: 64px; height: 64px; color: var(--accent); }
.spinner { text-align: center; padding: 60px 0; color: var(--muted); }
