:root {
  --bg:        #F1EFEB;
  --surface:   #FBFAF8;
  --ink:       #2B2E2A;
  --muted:     #7A8076;
  --accent:    #88B04B;
  --accent-dk: #6C9038;
  --sage:      #DDE5D2;
  --line:      #E3E0D8;
  --alert:     #C77E4A;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#20241F; --surface:#2A2F28; --ink:#EDEBE5; --muted:#9AA394;
    --accent:#9CC162; --accent-dk:#88B04B; --sage:#39422F;
    --line:#3A4136; --alert:#D6975C;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

.wrap { max-width: 680px; margin: 0 auto; padding: 24px 20px 96px; }

h1 { font-weight: 600; font-size: 28px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-weight: 600; font-size: 18px; margin: 0 0 12px; }
p  { margin: 0 0 12px; }
a  { color: var(--accent-dk); text-decoration: none; }
a:hover { text-decoration: underline; }

.section-label { text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px;
  color: var(--muted); margin: 0 0 4px; }
.date-headline { font-size: 32px; margin-bottom: 16px; }
.lead  { color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); }
.hint  { color: var(--muted); font-size: 13px; font-weight: 400; }

.card { background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 20px; margin: 16px 0; }

.checklist { padding-left: 20px; margin: 0; }
.checklist li { margin: 6px 0; }

.alert { background: var(--alert); color: #FBFAF8; padding: 10px 14px;
  border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

form label { display: block; margin: 14px 0 4px; font-size: 14px; color: var(--muted); }
form input { display: block; width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink); font-size: 16px; font-family: inherit; }
form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn { display: inline-block; margin-top: 20px; padding: 12px 20px;
  background: var(--accent); color: #1F2A0F; border: 0; border-radius: 8px;
  font-size: 16px; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn:hover { background: var(--accent-dk); color: #FBFAF8; }

.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; }

.auth { max-width: 380px; }
.logout-form { margin-top: 32px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 10; }
.tabbar a { flex: 1; text-align: center; padding: 8px 4px; color: var(--muted);
  font-size: 13px; min-height: 44px; }
.tabbar a:hover { text-decoration: none; color: var(--accent-dk); }

@media (min-width: 700px) {
  .tabbar { position: static; border-top: 0; border-bottom: 1px solid var(--line);
    max-width: 680px; margin: 0 auto; }
}

table.activities { width: 100%; border-collapse: collapse; font-size: 14px; }
table.activities th, table.activities td { text-align: left; padding: 8px 6px;
  border-bottom: 1px solid var(--line); }
table.activities th { color: var(--muted); font-weight: 600; }

.coach-note { background: var(--sage); padding: 14px 16px; border-radius: 8px;
  border-left: 3px solid var(--accent); margin: 16px 0; }
.coach-note p { margin: 0; font-size: 15px; color: var(--ink); line-height: 1.5; }

.sport-fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 20px 0; }
.sport-fieldset legend { padding: 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.sport-row { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 400; margin: 0; }
.sport-row:last-child { border-bottom: 0; }
.sport-row input[type="checkbox"] { width: 20px; height: 20px; margin: 0; }
.sport-name { font-size: 16px; }
.sport-stats { color: var(--muted); font-size: 13px; }
.priority-radio { display: flex; gap: 6px; align-items: center; margin: 0; font-size: 13px; color: var(--muted); }

textarea { display: block; width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 15px;
  font-family: inherit; resize: vertical; }

table.week-plan { width: 100%; border-collapse: collapse; }
table.week-plan th { text-align: left; padding: 10px 8px 10px 0; width: 40px; color: var(--muted); font-weight: 600; font-size: 14px; vertical-align: top; }
table.week-plan td { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
table.week-plan tr:last-child td { border-bottom: 0; }

/* --- Viikko view --- */
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 24px; }
.totals .total { background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.totals .total-value { font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.totals .total-label { font-size: 12px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.06em; }
.totals .total-adherence { grid-column: 1 / -1; margin-top: 4px; }
.totals .total-adherence .total-value { color: var(--accent-dk); }

.week-days { display: flex; flex-direction: column; gap: 8px; }
.day-row { display: grid; grid-template-columns: 60px 1fr; gap: 12px; padding: 14px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.day-row.today { border-color: var(--accent); border-width: 2px; padding: 13px 11px; }
.day-row.past { opacity: 0.85; }
.day-row.future { opacity: 0.7; }
.day-head { text-align: center; }
.day-abbr { display: block; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.day-row.today .day-abbr { color: var(--accent-dk); }
.day-num { display: block; font-size: 20px; font-weight: 600; color: var(--ink); }
.day-items { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.day-item { display: flex; gap: 6px; align-items: baseline; }
.day-item .check { color: var(--muted); font-size: 14px; width: 12px; }
.day-item.done .check { color: var(--accent); }
.day-item.done { color: var(--muted); text-decoration: line-through; }
.day-item.advisory { color: var(--muted); }
.day-actual { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.activity-chip { font-size: 12px; padding: 2px 8px; background: var(--sage); color: var(--ink);
  border-radius: 10px; }

/* --- Tänään: strength exercise breakdown --- */
.plan-item-head { display: flex; gap: 12px; align-items: baseline; }
.exercise-list { list-style: none; margin: 12px 0 0 0; padding: 0 0 0 34px; }
.exercise-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px;
  align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.exercise-row.single { padding-left: 34px; }
.exercise-list .exercise-row:first-child { border-top: 0; }
.ex-fig { width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; }
.ex-fig svg { width: 100%; height: 100%; color: var(--ink); }
.ex-fig svg .ink { stroke: currentColor; fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.ex-fig svg .accent { stroke: var(--accent); fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.ex-fig svg .arrow { stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; }
.ex-fig svg .head { fill: currentColor; stroke: none; }
.ex-fig svg .head-accent { fill: var(--accent); stroke: none; }
.ex-fig svg .ghost { opacity: 0.35; }
.ex-fig svg .ground { stroke: var(--line); stroke-width: 1; fill: none; }
.ex-fig svg .equip { stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; }
.ex-fig-fallback { color: var(--muted); font-size: 20px; }
.ex-label { font-size: 14px; color: var(--ink); }
.ex-reps { font-size: 13px; color: var(--muted); white-space: nowrap; }
.plan-item.done .exercise-list, .plan-item.done .exercise-row.single { opacity: 0.6; }

.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-item { display: flex; align-items: baseline; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--line); font-size: 17px; }
.plan-item:last-child { border-bottom: 0; }
.plan-item .check { color: var(--muted); font-size: 20px; width: 22px; text-align: center; }
.plan-item.done { color: var(--muted); }
.plan-item.done .check { color: var(--accent); }
.plan-item.done .label { text-decoration: line-through; }
.plan-item.advisory .label { color: var(--muted); font-weight: 400; }
