/* Genki — design system rodziny Ordo: kość słoniowa, atrament; akcent zieleń lasu, bursztyn dla wyzwań. Nigdy czerwieni. */
/* Fonty lokalnie (SIL OFL) — działają offline, bez Google Fonts. */
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(../fonts/fraunces-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(../fonts/fraunces-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/manrope-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(../fonts/manrope-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F5F1EA;
  --surface: #FFFFFF;
  --ink: #1E1B18;
  --muted: #6E665C;
  --line: #E6DED2;
  --line-strong: #DDD5C8;
  --accent: #2F5D4A;          /* zieleń lasu — spokój i regeneracja */
  --accent-soft: #DCE7E0;
  --accent-ink: #FFFFFF;
  --amber: #D9A441;           /* wyzwania, poziomy, „umiarkowany” */
  --amber-ink: #6B4A0E;
  --amber-soft: #F6E8C8;
  --rest: #6F8797;            /* szarobłękit — „odpocznij” */
  --rest-soft: #E1E8ED;
  --chart-dot: #B9CBC1;
  --chart-2: #9C6B8E;         /* druga seria (masa mięśniowa, score) */
  --chip: #F5F1EA;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Manrope', system-ui, sans-serif;
  --radius: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14150F;
    --surface: #1F211B;
    --ink: #EDE7DD;
    --muted: #A39A8D;
    --line: #34362E;
    --line-strong: #45473D;
    --accent: #7FB59A;
    --accent-soft: #24352C;
    --accent-ink: #14150F;
    --amber: #E3B65C;
    --amber-ink: #F3D9A0;
    --amber-soft: #3A3020;
    --rest: #9AB0BF;
    --rest-soft: #263038;
    --chart-dot: #3E5A4B;
    --chart-2: #C79BBB;
    --chip: #2A2C25;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Układ: boczny pasek na komputerze, dolny pasek na telefonie ---------- */
.shell { display: flex; min-height: 100dvh; }
.content { flex: 1; min-width: 0; max-width: 760px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 28px) 16px 120px; display: flex; flex-direction: column; gap: 16px; }
.side { display: none; }
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(68px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: center;
}
.tab { flex: 1; min-width: 0; max-width: 76px; letter-spacing: -.01em; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 10px; font-weight: 600; }
.tab.active { color: var(--accent); font-weight: 700; }
.topbar { display: flex; justify-content: flex-end; margin: -20px -6px -8px 0; }
.topbar-link { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 22px; }
.topbar-link.active { color: var(--ink); }

@media (min-width: 900px) {
  .bottom { display: none; }
  .side { display: flex; flex-direction: column; gap: 4px; width: 210px; padding: 24px 12px; background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; }
  .side-link { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
  .side-link.active { background: var(--accent-soft); color: var(--accent); }
  .side-link.settings { margin-top: auto; }
  .content { padding: 44px 32px; }
  .content.wide { max-width: 1040px; }
  .topbar { display: none; }
}

.logo { width: 40px; height: 40px; margin: 0 0 20px 12px; }
.logo.big { width: 84px; height: 84px; margin: 0; }
.splash { min-height: 100dvh; display: flex; align-items: center; justify-content: center; }

/* ---------- Typografia ---------- */
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.display { margin: 6px 0 0; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; letter-spacing: -.01em; }
.display.small { font-size: 28px; margin: 0; }
.serif { font-family: var(--serif); font-weight: 400; margin: 0; }
h2.serif { font-size: 22px; line-height: 1.2; }
h3.serif { font-size: 18px; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ok-note { color: var(--accent); font-weight: 600; }
.note { font-size: 13px; color: var(--amber-ink); font-weight: 600; }
p { margin: 0; line-height: 1.45; }

/* ---------- Elementy ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 6px; }
.push { margin-left: auto; }
.grow { flex: 1; min-width: 0; }
.page-head { display: flex; flex-direction: column; gap: 4px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; gap: 12px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 0 var(--line); display: flex; flex-direction: column; gap: 12px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.tight { gap: 8px; padding: 14px 16px; }
.meta { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }

.btn { min-height: 52px; padding: 0 22px; border-radius: 26px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line-strong); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn.quiet { border: 0; background: transparent; color: var(--muted); }

.pill { min-height: 26px; padding: 0 10px; border-radius: 13px; background: var(--chip); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pill.ready { background: var(--accent-soft); color: var(--accent); }
.pill.moderate { background: var(--amber-soft); color: var(--amber-ink); }
.pill.rest { background: var(--rest-soft); color: var(--rest); }
.dot { width: 8px; height: 8px; border-radius: 4px; display: inline-block; background: currentColor; }

.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--amber-soft); color: var(--amber-ink); font-size: 14px; font-weight: 600; }
.banner.info { background: var(--rest-soft); color: var(--rest); }

.segmented { display: inline-flex; background: var(--chip); border-radius: 22px; padding: 3px; flex-wrap: wrap; }
.segmented button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 19px; background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(30, 27, 24, .12); }

input.field, select.field, textarea.field { min-height: 48px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0 14px; font-size: 16px; width: 100%; }
textarea.field { padding: 12px 14px; min-height: 90px; resize: vertical; }
input.field.narrow { width: 110px; }
.field-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--accent); height: 44px; }
input[type=checkbox] { accent-color: var(--accent); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.divided > * + * { border-top: 1px solid var(--line); }

/* ---------- Hodie ---------- */
.readiness { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.workout-card .title { font-family: var(--serif); font-size: 26px; line-height: 1.15; }
.reason { font-size: 14px; color: var(--muted); border-left: 3px solid var(--amber); padding-left: 10px; }
.status-done { color: var(--accent); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }

.habit { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 4px; }
.habit .grow { display: flex; flex-direction: column; gap: 2px; }
.habit-name { font-weight: 600; font-size: 15px; }
.check { width: 44px; height: 44px; flex: none; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; color: #FFFFFF; }
.check::before { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 13px; border: 1.5px solid var(--line-strong); }
.check[aria-pressed=true]::before { background: var(--accent); border-color: var(--accent); }
.check svg { position: relative; }
.counter { display: inline-flex; align-items: center; gap: 4px; }
.counter .value { min-width: 46px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.meter { height: 10px; border-radius: 5px; background: var(--chip); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.meter.amber > span { background: var(--amber); }
.big-num { font-family: var(--serif); font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.trend { display: flex; align-items: baseline; gap: 10px; }
.trend .arrow { font-size: 28px; color: var(--accent); }

/* ---------- Exercitium ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-tile { background: var(--surface); border-radius: 14px; padding: 8px 6px; min-height: 108px; display: flex; flex-direction: column; gap: 4px; border: 1.5px solid transparent; text-decoration: none; color: inherit; font-size: 12px; }
.day-tile.today { border-color: var(--accent); }
.day-tile .d { font-weight: 700; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.day-tile .w { font-weight: 700; font-size: 12.5px; line-height: 1.2; overflow-wrap: anywhere; }
.day-tile .s { margin-top: auto; }
.st { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 11px; }
.st.done { color: var(--accent); }
.st.minimum { color: var(--amber-ink); }
.st.rest, .st.planned { color: var(--muted); }
.st.skipped { color: var(--rest); }
@media (max-width: 520px) {
  .week { grid-template-columns: 1fr; }
  .day-tile { min-height: 0; flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; }
  .day-tile .d { width: 34px; }
  .day-tile .w { flex: 1; font-size: 14px; }
  .day-tile .s { margin: 0; }
}
.exercise { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.sets { display: grid; grid-template-columns: 34px 1fr 1fr 44px; gap: 6px; align-items: center; }
.sets input { min-height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg); padding: 0 10px; font-size: 16px; width: 100%; font-variant-numeric: tabular-nums; }
.sets .n { font-weight: 700; color: var(--muted); text-align: center; }
.timer { font-family: var(--serif); font-size: 54px; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.sticky-bottom { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 5; }
@media (min-width: 900px) { .sticky-bottom { bottom: 16px; } }

/* ---------- Victus ---------- */
.meal { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.meal .grow { display: flex; flex-direction: column; gap: 3px; }
.macros { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ingredients { list-style: none; margin: 0; padding: 0; font-size: 14px; display: flex; flex-direction: column; }
.ingredients li { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients .amt { margin-left: auto; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.scale { color: var(--amber-ink); }
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; min-height: 32px; }
details.card > summary::-webkit-details-marker { display: none; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
table.data td.r, table.data th.r { text-align: right; }
.table-wrap { overflow-x: auto; }

/* ---------- Mos ---------- */
.streak { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.week-dots { display: inline-flex; gap: 4px; }
.week-dots span { width: 10px; height: 10px; border-radius: 5px; background: var(--chip); border: 1px solid var(--line-strong); }
.week-dots span.on { background: var(--accent); border-color: var(--accent); }

/* ---------- Analytica i wykresy ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 0 var(--line); }
.tile .v { font-family: var(--serif); font-size: 26px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile .d { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart { width: 100%; max-width: 640px; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 15px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart .dot { fill: var(--chart-dot); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.c2 { stroke: var(--chart-2); }
.chart .line.c3 { stroke: var(--amber); }
.chart .line.thin { stroke-width: 1.4; }
.chart .dashed { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 5 5; }
.chart .dashed.c3 { stroke: var(--amber); }
.chart .bar { fill: var(--chart-dot); }
.chart .bar.c1 { fill: var(--accent); opacity: .55; }
.chart .band { fill: var(--accent-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend .sw { width: 14px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; background: var(--accent); }
.legend .sw.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--chart-dot); }
.legend .sw.c2 { background: var(--chart-2); }
.legend .sw.c3 { background: var(--amber); }
.legend .sw.dashed { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }
.insight { font-family: var(--serif); font-size: 17px; line-height: 1.35; }

.login { min-height: 80dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px; background: var(--ink); color: var(--bg); z-index: 100; }
#blazor-error-ui .reload { color: var(--bg); }
h1:focus, h1:focus-visible { outline: none; }
