/* Plus Jakarta Sans (SIL OFL 1.1, assets/fonts/OFL-plus-jakarta-sans.txt), tylko znaki łacińskie i polskie. */
@font-face {
    font-family: 'Jakarta';
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    src: url(fonts/plus-jakarta-sans-latin-wght-normal.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: 'Jakarta';
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    src: url(fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --bg: #f2f3f9;
    --surface: #ffffff;
    --ink: #151933;
    --muted: #61688a;
    --line: #e3e6f0;
    --grid: #eef0f7;
    --accent: #f0365f;
    --blue: #4f46e5;
    --blue-soft: #eef0ff;
    --ideal: #059669;
    --future: #f6f7fc;
    --danger: #e11d48;
    --brand: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
    --radius: 16px;
    --shadow: 0 1px 2px rgba(21, 25, 51, .04), 0 8px 24px rgba(21, 25, 51, .06);
    --shadow-hover: 0 2px 4px rgba(21, 25, 51, .06), 0 14px 32px rgba(21, 25, 51, .1);
    /* Kolor kategorii: domyślnie marka, nadpisywany klasą cat-*. */
    --cat: #4f46e5;
    --cat2: #7c3aed;
    --sans: 'Jakarta', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color-scheme: light;
}
.cat-weight { --cat: #4f46e5; --cat2: #7c3aed; }
.cat-food { --cat: #f97316; --cat2: #f43f5e; }
.cat-move { --cat: #10b981; --cat2: #0ea5e9; }
.cat-body { --cat: #a855f7; --cat2: #6366f1; }
.cat-photo { --cat: #ec4899; --cat2: #f97316; }

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 15px/1.5 var(--sans);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

button, input, select, textarea { font: inherit; color: inherit; word-spacing: inherit; }

button {
    min-height: 36px;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
}
button:hover { border-color: var(--muted); }

/* Ikony Tabler (kreska), kolor z tekstu */
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
button .icon { margin-right: 6px; }
.pan .icon, .photo-row-nav .icon, .viewer-nav .icon { margin-right: 0; }
h2 .icon { margin-right: 8px; color: var(--muted); }
.plus .icon { width: 36px; height: 36px; margin: 0; stroke-width: 1.5; }
td .icon { margin-right: 6px; }
td.verdict .icon { width: 1em; height: 1em; }
.today-tile span .icon { margin-right: 6px; }
.today-tile .icon-done { margin: 0 0 0 4px; color: var(--ideal); }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 500; }
button.primary:hover { background: #2f39a8; border-color: #2f39a8; }
button.danger { color: var(--danger); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chart:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

input, select, textarea {
    width: 100%;
    min-height: 36px;
    padding: 6px 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
}

label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 3px; color: var(--ink); font-size: 15px; font-weight: 400; }

.error { color: var(--danger); margin: 0; font-size: 14px; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }

/* Ekran PIN */
.lock {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 48px;
    padding: 24px 16px;
}
.lock-form { display: grid; gap: 10px; width: min(100%, 280px); }
.lock-form h1 { font-size: 26px; margin-bottom: 14px; }
.lock-form label { margin-bottom: -6px; }
.lock-form input { font-size: 20px; letter-spacing: .25em; }

/* Nagłówek */
.top {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 24px;
}
.top .brand-mark { flex: none; }
.top nav { margin-left: auto; display: flex; gap: 8px; }

.page { max-width: 1280px; margin: 0 auto; padding: 0 24px 48px; display: grid; gap: 16px; }
.page > * { min-width: 0; }

.setup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border-left: 3px solid var(--accent);
}
.setup[hidden], .banner[hidden] { display: none; }
.setup p { margin: 0; }
.banner { padding: 10px 14px; background: var(--surface); border-left: 3px solid var(--danger); }

/* Podsumowanie */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat { background: var(--surface); padding: 12px 16px; min-width: 0; }
.stat span { display: block; font-size: 13px; color: var(--muted); }
.stat b { display: block; margin-top: 2px; font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.stat small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
@media (max-width: 720px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat b { font-size: 19px; }
}

/* Dziś: co już wpisane, a czego brakuje */
.today { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.today-tile { display: block; min-width: 0; height: auto; min-height: 0; padding: 12px 16px; text-align: left; background: var(--surface); border: 0; border-radius: 0; }
.today-tile:hover { background: var(--future); }
.today-tile span { display: block; font-size: 13px; color: var(--muted); }
.today-tile b { display: block; margin-top: 2px; font-size: 19px; font-weight: 600; line-height: 1.25; }
.today-tile small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.today-tile.is-done span { color: var(--ideal); }
.today-tile.is-due { box-shadow: inset 3px 0 0 var(--accent); }
.today-tile.is-due b { color: var(--accent); }
.today-tile.is-optional b { color: var(--muted); font-weight: 500; }
@media (max-width: 720px) {
    .today { grid-template-columns: 1fr 1fr; }
    .today-tile:last-child { grid-column: span 2; }
}

/* Najbliższe cele */
.goals[hidden] { display: none; }
.goal-grid { display: grid; grid-template-columns: var(--goal-cols, 2fr 1fr 1fr 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.goal { background: var(--surface); padding: 12px 16px; min-width: 0; }
.goal p { margin: 2px 0 0; font-size: 14px; }
.goal .hint { font-size: 13px; }
.goal .hint:empty { display: none; }
.goal h2 { margin: 2px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.goal h3 { margin: 2px 0 0; font-size: 15px; font-weight: 600; }
.goal-kicker { font-size: 12px; font-weight: 600; color: var(--muted); }
.goal-left { font-weight: 500; }
.goal-bar { height: 8px; margin: 8px 0; background: var(--grid); border-radius: 4px; overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.goal-main.is-near .goal-kicker { color: var(--accent); }
.goal.is-ideal h3, .goal.is-ideal .goal-kicker { color: var(--ideal); }
.goal-notes { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.goal-notes:empty { display: none; }
@media (max-width: 900px) {
    .goal-grid { grid-template-columns: 1fr 1fr; }
    .goal-main { grid-column: span 2; }
    .goal:last-child:nth-child(even) { grid-column: span 2; }
}

/* Oś czasu */
.timeline { background: var(--surface); border: 1px solid var(--line); padding: 12px 16px; }
.timeline-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-bottom: 8px; }
.scales { display: flex; flex-wrap: wrap; gap: 4px; }
.scales button { min-width: 44px; padding: 0 10px; font-size: 14px; }
.scales button[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); font-weight: 600; }
.pan { display: flex; gap: 4px; }

.chart { position: relative; height: 500px; touch-action: pan-y; cursor: grab; user-select: none; }
.chart.dragging { cursor: grabbing; }
.chart svg { display: block; width: 100%; height: 100%; font-family: var(--sans); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); pointer-events: none; }
.chart-empty[hidden] { display: none; }
@media (max-width: 640px) { .chart { height: 430px; } }

.s-future { fill: var(--future); }
.s-grid { stroke: var(--grid); stroke-width: 1; }
.s-month { stroke: var(--grid); stroke-width: 1; }
.s-photo-line { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 3; pointer-events: none; }
.s-photo-dot { fill: var(--surface); stroke: var(--ink); stroke-width: 2; pointer-events: none; }
.s-year { stroke: var(--line); stroke-width: 1.5; }
.s-mass { stroke: var(--line); stroke-width: 1; }
.s-bmi { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.s-ideal { stroke: var(--ideal); stroke-width: 1.5; }
.s-today { stroke: var(--muted); stroke-width: 1; }
.s-line { fill: none; stroke: var(--blue); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.s-forecast { fill: none; stroke: var(--blue); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: .75; }
.s-band { fill: var(--blue); opacity: .1; stroke: none; }
.s-point { fill: var(--surface); stroke: var(--blue); stroke-width: 2; }
.s-hit { fill: transparent; cursor: pointer; }
.s-stem { stroke: var(--muted); stroke-width: 1; opacity: .55; }
.s-stem.next { stroke-dasharray: 2 3; }
.s-axis { fill: var(--muted); font-size: 12px; }
.s-axis.major { fill: var(--ink); font-weight: 600; }
.s-axis.ideal { fill: var(--ideal); font-weight: 600; }
.s-today-label { fill: var(--ink); font-size: 11px; font-weight: 600; }
.m-pill { cursor: pointer; }
.m-pill rect { fill: var(--accent); }
.m-pill text { fill: #fff; font-size: 12px; font-weight: 600; }
.m-pill.next rect { fill: var(--surface); stroke: var(--accent); stroke-width: 1.25; }
.m-pill.next text { fill: var(--accent); }
.m-pill.ideal rect { fill: var(--ideal); }
.m-pill.ideal.next rect { fill: var(--surface); stroke: var(--ideal); }
.m-pill.ideal.next text { fill: var(--ideal); }
.m-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; cursor: pointer; }
.m-dot.next { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.m-dot.ideal { fill: var(--ideal); }
.m-dot.ideal.next { fill: var(--surface); stroke: var(--ideal); }

.tip {
    position: absolute;
    z-index: 2;
    max-width: 260px;
    padding: 8px 10px;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(38, 42, 64, .12);
    font-size: 13px;
    pointer-events: none;
}
.tip[hidden] { display: none; }
.tip b { display: block; }

/* Treningi */
.activity-strip { height: 36px; margin-top: 4px; border-top: 1px solid var(--grid); }
.activity-strip[hidden] { display: none; }
.activity-strip svg { display: block; width: 100%; height: 100%; font-family: var(--sans); }
.a-bar { fill: var(--blue); opacity: .55; }
.a-bar:hover { opacity: .9; }
.key-activity { background: var(--blue); opacity: .55; }

/* Bilans dnia */
.balance-block { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--grid); }
.balance-block[hidden] { display: none; }
.balance-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.balance-title .hint { font-weight: 400; margin-left: 6px; }
.balance-strip { position: relative; height: 140px; }
.balance-strip svg { display: block; width: 100%; height: 100%; font-family: var(--sans); }
.b-diet { fill: var(--blue); opacity: .75; }
.b-move { fill: var(--ideal); opacity: .6; }
.b-surplus { fill: var(--accent); opacity: .7; }
.b-net { stroke: var(--ink); stroke-width: 2; }
.b-goal { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: .6; }
.b-zero { stroke: var(--muted); stroke-width: 1; }
.b-missing { fill: url(#b-hatch); }
.b-hit { fill: transparent; cursor: pointer; }
.b-hit:hover { fill: rgba(38, 42, 64, .05); }
.key-diet { background: var(--blue); opacity: .75; }
.key-move { background: var(--ideal); opacity: .6; }
.key-surplus { background: var(--accent); opacity: .7; }
.key-net { height: 2px; vertical-align: 3px; background: var(--ink); }
.key-goal { height: 0; vertical-align: 3px; border-top: 1.5px dashed var(--ink); border-radius: 0; opacity: .6; }
.key-missing { background: repeating-linear-gradient(45deg, #c9ccd8 0 1px, transparent 1px 4px); border: 1px solid var(--line); }
.activities { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; }

/* Dieta */
.diet, .body { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; }
.diet-window { display: flex; gap: 4px; }
.diet-window button { min-height: 32px; padding: 0 10px; font-size: 14px; }
.diet-window button[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); font-weight: 600; }
.diet-stats { margin-bottom: 12px; }
.energy-stats { grid-template-columns: repeat(4, 1fr); }
.energy-stats .is-warn { color: var(--accent); }
.check-stats { grid-template-columns: repeat(3, 1fr); }
.check-stats .is-good { color: var(--ideal); }
.check-stats .is-warn { color: var(--accent); }
.diet-stats .stat b { font-size: 19px; }
.diet-stats .is-good { color: var(--ideal); }
.diet-goals-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
td.is-off { color: var(--accent); font-weight: 600; }
td.verdict { font-size: 13px; }
td.verdict.is-good { color: var(--ideal); font-weight: 600; }
td.verdict.is-bad { color: var(--accent); }
td .hint { font-size: 12px; font-weight: 400; }
.nutrition-row { cursor: pointer; }
.nutrition-row:hover td { background: var(--future); }
@media (max-width: 560px) { #nutrition-list .edit, #measurements-list .edit { display: none; } }
.stat .is-down { color: var(--ideal); }
.macro-fields, .field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.macro-fields label:first-child { grid-column: span 2; }
.goal-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); }
.goal-fields legend { padding: 0; font-size: 14px; font-weight: 600; }
.goal-fields label:first-of-type, .goal-fields .hint { grid-column: span 2; }
#nutrition-existing:empty, #nutrition-calc:empty, #measurements-existing:empty, #nutrition-paste-result:empty { display: none; }
#nutrition-paste-result.is-miss { color: var(--accent); }
.paste-prompt code { font-size: 12px; overflow-wrap: anywhere; }
.link-button { min-height: 0; padding: 0; color: var(--blue); background: none; border: 0; font-size: inherit; text-decoration: underline; }
@media (max-width: 720px) { .diet-stats, .energy-stats { grid-template-columns: repeat(2, 1fr); } .check-stats { grid-template-columns: 1fr; } }

/* Zdjęcia */
.photo-strip { position: relative; height: 66px; margin-top: 4px; border-top: 1px solid var(--grid); }
.photo-strip[hidden] { display: none; }
.strip-thumb { position: absolute; top: 6px; width: 44px; height: 58px; min-height: 0; padding: 0; transform: translateX(-50%); overflow: hidden; border-radius: 4px; }
.strip-thumb[hidden] { display: none; }
.strip-thumb.is-active { outline: 2px solid var(--ink); outline-offset: 1px; }
.strip-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.strip-thumb i { position: absolute; right: 2px; bottom: 2px; padding: 0 4px; background: #fff; border-radius: 3px; font-size: 11px; font-style: normal; font-weight: 600; }
.strip-thumb i[hidden] { display: none; }

.photos { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-head h2 { margin: 0 auto 0 0; }
#training-progress.is-good { color: var(--ideal); font-weight: 600; }
.section-head button[hidden] { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Pole wyboru zdjęcia: pusty stan jak plusik w rzędzie zdjęć, po wyborze podgląd. */
.file-pick { position: relative; display: grid; place-items: center; min-height: 150px; overflow: hidden; color: var(--blue); text-align: center; background: var(--surface); border: 1.5px dashed var(--line); border-radius: 6px; cursor: pointer; }
.file-pick:hover, .file-pick.is-over { border-color: var(--blue); background: var(--blue-soft); }
/* Obwódka tylko przy klawiaturze; okno otwarte myszką od razu ustawia fokus na tym polu. */
.file-pick:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.file-pick-empty { display: grid; justify-items: center; gap: 2px; padding: 16px; }
.file-pick-empty .plus { line-height: 1; }
.file-pick-empty b { font-size: 14px; }
.file-pick-empty small { font-size: 12px; color: var(--muted); }
#photo-preview { display: block; width: 100%; height: 240px; object-fit: contain; background: var(--future); }
.file-pick-change { position: absolute; bottom: 8px; left: 50%; padding: 4px 10px; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-weight: 500; }
.file-pick.has-file { border-style: solid; }
.file-pick-name { padding: 16px 16px 48px; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.file-pick.has-file .file-pick-empty, .file-pick:not(.has-file) .file-pick-change, .file-pick:not(.has-file) .file-pick-name { display: none; }
.file-pick:not(.has-preview) #photo-preview, .file-pick.has-preview .file-pick-name { display: none; }
@media (hover: none) { .file-pick-drop { display: none; } }
#photo-date-source { margin-top: -6px; }
#photo-date-source:empty { display: none; }
/* Jeden rząd przewijany w bok: plusik z lewej, dalej zdjęcia od najnowszych. */
.photo-row { position: relative; }
.photo-scroll { position: relative; display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; scrollbar-width: thin; }
.photo-grid { display: contents; }
.photo-grid > .hint { align-self: center; max-width: 260px; }
.photo-tile { display: block; flex: 0 0 140px; height: auto; min-height: 0; padding: 0; text-align: left; overflow: hidden; background: var(--surface); scroll-snap-align: start; }
.photo-add-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; color: var(--blue); border: 1.5px dashed var(--line); }
.photo-add-tile:hover { border-color: var(--blue); background: var(--blue-soft); }
.photo-tile.photo-add-tile .plus { min-height: 0; padding: 0; line-height: 1; color: inherit; }
.photo-tile.photo-add-tile b { padding: 0 8px; }
.photo-row-nav { position: absolute; top: 93px; z-index: 1; display: none; width: 40px; height: 40px; padding: 0; transform: translateY(-50%); border-radius: 50%; box-shadow: 0 1px 4px rgba(38, 42, 64, .2); font-size: 18px; }
.photo-row-nav.prev { left: 4px; }
.photo-row-nav.next { right: 4px; }
/* Strzałki tylko przy myszce; palcem przewija się rząd bezpośrednio. */
@media (hover: hover) { .photo-row-nav:not([hidden]) { display: block; } }
@media (max-width: 640px) { .photo-tile { flex-basis: 120px; } }
.photo-tile img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--grid); }
.photo-tile b { display: block; padding: 6px 8px 0; font-size: 13px; font-weight: 600; }
.photo-tile span { display: block; min-height: 18px; padding: 0 8px 6px; font-size: 12px; color: var(--muted); }

dialog.wide { width: min(880px, calc(100vw - 32px)); }
.viewer { padding: 0; max-height: calc(100dvh - 32px); overflow-y: auto; }
.viewer[open] { display: flex; flex-direction: column; width: min(880px, calc(100vw - 32px)); }
.viewer-stage { position: relative; flex: none; height: min(62vh, 640px); background: var(--future); touch-action: pan-y; }
#photo-full { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; transition: opacity .12s; }
#photo-full.is-loading { opacity: .35; }
.viewer-count { position: absolute; top: 8px; left: 8px; padding: 0 8px; background: var(--surface); border-radius: 4px; font-size: 13px; }
.viewer-nav { position: absolute; top: 50%; width: 44px; height: 44px; padding: 0; transform: translateY(-50%); font-size: 22px; line-height: 1; }
.viewer-nav.prev { left: 8px; }
.viewer-nav.next { right: 8px; }
.viewer-nav:disabled { visibility: hidden; }
.viewer-info { flex: none; padding: 12px 16px 0; }
.viewer-info p { margin: 0; overflow-wrap: anywhere; }
.viewer-info p[hidden] { display: none; }
.viewer-actions { flex: none; padding: 12px 16px 16px; }
.viewer-edit { flex: none; padding: 12px 16px 16px; }
.viewer form[hidden], .actions[hidden] { display: none; }
.viewer.is-editing .viewer-stage { height: min(30vh, 260px); }
.viewer.is-editing .viewer-nav { display: none; }
/* Na szerokim ekranie okno stoi z boku, żeby wykres ze znacznikiem został widoczny. */
@media (min-width: 1100px) {
    .viewer[open] { width: 440px; height: 100dvh; max-width: none; max-height: none; margin: 0 0 0 auto; border-width: 0 0 0 1px; border-radius: 0; }
    .viewer[open] .viewer-stage { flex: 1 1 0; height: auto; min-height: 240px; }
    .viewer::backdrop { background: rgba(38, 42, 64, .08); }
}
.compare { display: grid; gap: 12px; }
.compare h2 { margin: 0; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-grid figure { margin: 0; display: grid; gap: 6px; min-width: 0; }
.compare-grid img { display: block; width: 100%; height: min(56vh, 520px); object-fit: contain; background: var(--future); }
.compare-grid figcaption { font-size: 13px; color: var(--muted); }
.compare p { margin: 0; font-size: 14px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.key { display: inline-block; width: 11px; height: 11px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.key-done { background: var(--accent); }
.key-next { border: 1.5px solid var(--accent); }
.key-ideal { background: var(--ideal); }
.key-band { background: var(--blue); opacity: .18; }

/* Listy */
.columns { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.columns > section { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; min-width: 0; }
/* Milowe kroki: przed Tobą i osiągnięte obok siebie na szerokim ekranie. */
.m-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; align-items: start; }
.m-columns .m-group:first-child { margin-top: 0; }
@media (max-width: 900px) { .m-columns { grid-template-columns: 1fr; } }

.m-group { margin: 12px 0 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.m-group:first-child { margin-top: 0; }
.m-row {
    display: grid;
    grid-template-columns: 1fr 66px 128px;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    align-items: center;
    padding: 4px 6px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--grid);
    border-radius: 0;
    text-align: left;
}
.m-row:hover { background: var(--future); }
.m-row:disabled { cursor: default; background: none; }
.m-row .w, .m-row .d { font-size: 13px; text-align: right; }
.m-row .d { color: var(--muted); }
.m-row small { color: var(--muted); margin-left: 6px; }
.m-row.is-next { background: var(--blue-soft); font-weight: 600; }
.m-row.is-ideal .n { color: var(--ideal); font-weight: 600; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 0 6px 4px; }
td { padding: 4px 6px; border-top: 1px solid var(--grid); vertical-align: top; }
td.num, th.num { text-align: right; font-size: 13px; white-space: nowrap; }
td.date { white-space: nowrap; }
td.note { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
td.edit { text-align: right; }
td.edit button { min-height: 30px; padding: 0 8px; font-size: 13px; }
.more { margin-top: 10px; }
div.more { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 560px) { .col-note { display: none; } }

dialog { width: min(420px, calc(100vw - 32px)); padding: 20px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; }
dialog::backdrop { background: rgba(38, 42, 64, .25); }
dialog form { display: grid; gap: 12px; }
dialog h2 { margin: 0; font-size: 17px; }
.actions { display: flex; gap: 8px; align-items: center; }
.actions span { flex: 1; }
.actions button[hidden] { display: none; }

@media (max-width: 640px) {
    .top { padding: 12px 16px; }
    .page { padding: 0 16px 32px; }
    .timeline, .columns > section, .photos, .activities, .diet, .body { padding: 12px; }
    .top h1 { font-size: 16px; }
    .top nav button { padding: 0 10px; font-size: 13px; }
    /* Na wąskim ekranie w nagłówku zostają same ikony; nazwę podaje aria-label. */
    .top nav .label { display: none; }
    .top nav .icon { margin-right: 0; width: 20px; height: 20px; }
}

/* ================= Motyw: energia =================
 * Karty zamiast ramek, kolor kategorii w ikonach i akcentach, gradient marki w nagłówku i najbliższym celu.
 */
/* Jakarta ma wąską spację; lekko ją poszerzamy, żeby słowa się nie zlewały. */
body { background: var(--bg); word-spacing: .08em; }
h1, h2, .stat b, .today-tile b, .goal h2, dialog h2 { letter-spacing: -.02em; }

/* Nagłówek: baner w gradiencie marki */
.top { max-width: none; margin: 0 0 20px; padding: 18px max(24px, calc((100vw - 1232px) / 2)); background: var(--brand); color: #fff; box-shadow: 0 10px 30px rgba(79, 70, 229, .25); }
.top h1 { font-size: 22px; font-weight: 800; }
.top .brand-mark { filter: drop-shadow(0 2px 6px rgba(21, 25, 51, .25)); }
.top nav button { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .28); color: #fff; font-weight: 600; }
.top nav button:hover { background: rgba(255, 255, 255, .28); border-color: rgba(255, 255, 255, .5); }

/* Przyciski */
button { border-radius: 10px; font-weight: 600; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s; }
button:hover { border-color: #c7cbe0; }
button.primary { background: var(--brand); border: 0; box-shadow: 0 6px 16px rgba(79, 70, 229, .28); }
@media (hover: hover) { button.primary:hover { background: var(--brand); box-shadow: 0 8px 22px rgba(79, 70, 229, .38); transform: translateY(-1px); } }
[id$="-add"]:not(.photo-tile) { background: color-mix(in srgb, var(--cat) 12%, white); border-color: transparent; color: color-mix(in srgb, var(--cat) 80%, black); }
[id$="-add"]:not(.photo-tile):hover { background: color-mix(in srgb, var(--cat) 20%, white); }
input, select, textarea { border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79, 70, 229, .18); }
label { font-weight: 600; }

/* Ikona w kolorowym kafelku kategorii */
.icon.chip, h2 .icon { box-sizing: border-box; width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: linear-gradient(135deg, var(--cat), var(--cat2)); color: #fff; stroke-width: 2; vertical-align: middle; box-shadow: 0 4px 12px color-mix(in srgb, var(--cat) 35%, transparent); }
h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; }
h2 .icon { margin-right: 0; }

/* Karty */
.timeline, .columns > section, .photos, .activities, .diet, .body { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }

/* Dziś: osobne kafelki z kolorem kategorii */
.today { gap: 12px; background: none; border: 0; }
.today-tile { position: relative; display: flex; flex-direction: column; padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
@media (hover: hover) { .today-tile:hover { background: var(--surface); box-shadow: var(--shadow-hover); transform: translateY(-2px); } }
.today-tile .today-head { display: flex; align-items: center; gap: 10px; height: 34px; margin-bottom: 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.today-tile .today-head .icon { margin-right: 0; }
.today-tile .today-label { display: block; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.today-tile b { font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-tile.is-done .today-head { color: var(--ink); }
.today-tile.is-done span { color: inherit; }
.today-tile .icon-done { width: 22px; height: 22px; margin: 0; color: var(--ideal); stroke-width: 2.25; }
.today-tile.is-due { box-shadow: var(--shadow), inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.today-tile.is-due b { color: var(--accent); }
.today-tile.is-due::after { content: ''; position: absolute; top: 28px; right: 22px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: due-pulse 1.8s infinite; }
.today-tile.is-optional .chip { filter: saturate(.35); opacity: .75; }
@keyframes due-pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .today-tile.is-due::after { animation: none; } button, .today-tile, .stat { transition: none; } }
@media (max-width: 720px) { .today { gap: 10px; } .today-tile b { font-size: 20px; } }

/* Podsumowanie: duże liczby */
#stats { gap: 12px; background: none; border: 0; }
#stats .stat { border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stat span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat b { font-size: 24px; font-weight: 800; white-space: nowrap; }
.stat b.is-good, .stat .is-good { color: var(--ideal); }
.stat b.is-warn { color: var(--accent); }
@media (max-width: 720px) { #stats { gap: 10px; } .stat b { font-size: 20px; white-space: normal; } }

/* Kafelki w sekcjach: miękkie tło zamiast ramek */
.diet-stats { gap: 8px; background: none; border: 0; }
.diet-stats .stat { background: color-mix(in srgb, var(--cat) 5%, var(--future)); border-radius: 12px; }
.diet-stats .stat b { font-size: 20px; }

/* Cele: najbliższy jako baner */
.goal-grid { gap: 12px; background: none; border: 0; }
.goal { border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.goal-main { background: var(--brand); color: #fff; box-shadow: 0 12px 30px rgba(124, 58, 237, .3); }
.goal-main .goal-kicker, .goal-main .hint, .goal-main.is-near .goal-kicker { color: rgba(255, 255, 255, .85); }
.goal-main h2 { font-size: 26px; font-weight: 800; }
.goal-main .goal-bar { height: 10px; background: rgba(255, 255, 255, .25); border-radius: 6px; }
.goal-main .goal-bar i { background: #fff; border-radius: 6px; box-shadow: 0 0 12px rgba(255, 255, 255, .6); }
.goal-kicker { text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.goal h3 { font-size: 17px; font-weight: 800; }

/* Oś czasu */
.scales button, .diet-window button { border-radius: 999px; }
.scales button[aria-pressed="true"], .diet-window button[aria-pressed="true"] { background: var(--brand); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, .3); }
.pan button { border-radius: 999px; }
.s-line { stroke-width: 3; }
.s-point { stroke-width: 2.5; }
.a-bar, .key-activity { fill: #10b981; background: #10b981; opacity: .7; }
.b-diet, .key-diet { fill: #6366f1; background: #6366f1; opacity: .85; }
.b-move, .key-move { fill: #10b981; background: #10b981; opacity: .85; }
.b-surplus, .key-surplus { fill: #f43f5e; background: #f43f5e; opacity: .85; }
.balance-title { font-size: 14px; font-weight: 800; color: var(--ink); }
.tip { border: 0; border-radius: 12px; box-shadow: 0 12px 32px rgba(21, 25, 51, .18); }
.legend { font-weight: 600; }

/* Tabele */
th { text-transform: uppercase; letter-spacing: .05em; font-size: 11px; font-weight: 800; }
td { padding: 9px 8px; }
tbody tr { transition: background-color .12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--cat) 5%, white); }
td.edit button { background: var(--grid); border-color: transparent; }
td.edit button:hover { background: color-mix(in srgb, var(--cat) 14%, white); }
.cat-move td:nth-child(2) .icon { box-sizing: border-box; width: 26px; height: 26px; padding: 4px; margin-right: 8px; border-radius: 8px; background: color-mix(in srgb, var(--cat) 15%, white); color: color-mix(in srgb, var(--cat) 85%, black); stroke-width: 2; vertical-align: middle; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.4; }
.pill .icon { margin: 0; width: 14px; height: 14px; stroke-width: 2.25; }
td.verdict.is-good .pill { background: #d1fae5; color: #047857; }
td.verdict.is-bad .pill { background: #ffe4e6; color: #be123c; }
td.verdict.is-bad { color: inherit; }
td.is-off { color: #e11d48; }

/* Zdjęcia */
.photo-tile { border-radius: 14px; border: 0; box-shadow: var(--shadow); }
@media (hover: hover) { .photo-tile:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); } }
.photo-add-tile { color: var(--cat); border: 2px dashed color-mix(in srgb, var(--cat) 45%, white); box-shadow: none; }
.photo-add-tile:hover { background: color-mix(in srgb, var(--cat) 8%, white); border-color: var(--cat); }
.file-pick { border-radius: 14px; color: #ec4899; border-color: #f9a8d4; }
.file-pick:hover, .file-pick.is-over { border-color: #ec4899; background: #fdf2f8; }
.strip-thumb { border-radius: 8px; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(21, 25, 51, .18); }

/* Okna */
dialog { border: 0; border-radius: 20px; box-shadow: 0 30px 80px rgba(21, 25, 51, .3); padding: 22px; }
dialog::backdrop { background: rgba(21, 25, 51, .35); backdrop-filter: blur(3px); }
dialog h2 { font-size: 20px; font-weight: 800; }
.viewer { padding: 0; }

/* Ekran PIN */
.lock { background: var(--brand); }
.lock-form { padding: 28px; background: var(--surface); border-radius: 22px; box-shadow: 0 30px 80px rgba(21, 25, 51, .35); }
.lock-form h1 { font-weight: 800; }

@media (max-width: 640px) {
    .top { padding: 14px 16px; margin-bottom: 14px; }
    .top h1 { font-size: 18px; }
    .timeline, .columns > section, .photos, .activities, .diet, .body { padding: 14px; }
}

/* Ujęcia zdjęć */
.pose-pick { display: flex; gap: 6px; margin: 0; padding: 0; border: 0; }
.pose-pick legend { width: 100%; margin-bottom: 4px; padding: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.pose-pick label { position: relative; flex: 1; margin: 0; }
/* Ukryte jak .visually-hidden: bez tego dziedziczą width: 100% i rozpychają okno w bok. */
.pose-pick input { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
.pose-pick span { display: block; padding: 8px 0; text-align: center; border-radius: 999px; background: var(--grid); color: var(--ink); font-size: 14px; font-weight: 700; cursor: pointer; transition: background-color .15s, box-shadow .15s; }
.pose-pick label:hover span { background: color-mix(in srgb, #ec4899 12%, white); }
.pose-pick input:checked + span { background: linear-gradient(135deg, #ec4899, #f97316); color: #fff; box-shadow: 0 4px 12px rgba(236, 72, 153, .3); }
.pose-pick input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.session:empty { display: none; }
.session { padding: 8px 12px; border-radius: 10px; background: #fdf2f8; color: #9d174d; font-weight: 600; }
.photo-tile { position: relative; }
.pose-badge { position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: #9d174d; font-size: 11px; font-style: normal; font-weight: 800; box-shadow: 0 2px 6px rgba(21, 25, 51, .15); }
.compare-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.compare-head label { width: 160px; }

/* ================= Telefony i ekrany dotykowe ================= */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
/* Krótka reakcja na dotknięcie zamiast efektów najechania. */
button:active, .today-tile:active, .photo-tile:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) { button:active, .today-tile:active, .photo-tile:active { transform: none; } }

/* Palec potrzebuje większych celów niż kursor. */
@media (pointer: coarse) {
    button, select, input:not([type=radio]):not([type=checkbox]):not([type=file]) { min-height: 44px; }
    td.edit button { min-height: 38px; }
    .link-button { min-height: 0; }
    .photo-row-nav { display: none !important; }
    .diet-window button, .m-row { min-height: 44px; }
}

@media (max-width: 640px) {
    /* Telefon przybliża stronę po dotknięciu pola z czcionką mniejszą niż 16 px. */
    input, select, textarea, label > input, label > select, label > textarea { font-size: 16px; }

    /* Nagłówek z miejscem na wycięcie ekranu, gdy aplikacja działa z ikony na ekranie głównym. */
    .top { padding-top: max(14px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
    .page { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }

    /* Nagłówki sekcji: elementy zawijają się zamiast ściskać. */
    .section-head { flex-wrap: wrap; row-gap: 8px; }
    .section-head button { white-space: nowrap; }
    #training-progress { order: 3; flex-basis: 100%; }

    /* Pasek osi czasu w jednej linii: skale przesuwane palcem, strzałki obok. */
    .timeline-bar { flex-wrap: nowrap; align-items: center; }
    .scales { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
    .scales::-webkit-scrollbar { display: none; }
    .scales button { flex: none; scroll-snap-align: start; }
    .pan { flex: none; }
    .chart { height: 380px; }
    .legend { gap: 2px 12px; font-size: 12px; }

    /* Kafelki w sekcjach: jeden rząd przesuwany palcem zamiast kilku rzędów po dwa. */
    /* Kafelki w sekcjach: siatka po dwa, bez przesuwania w bok; mniejsze odstępy i czcionki, żeby wszystko było widać. */
    .diet-stats, .energy-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .check-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .check-stats .stat:last-child { grid-column: 1 / -1; }
    .diet-stats .stat { padding: 10px 12px; min-width: 0; }
    .diet-stats .stat span { font-size: 10.5px; white-space: normal; overflow: visible; }
    .diet-stats .stat b { font-size: 17px; }
    .diet-stats .stat small { font-size: 11.5px; line-height: 1.35; overflow-wrap: anywhere; }

    /* Tabele jako karty: data na górze, wartości w siatce pod nią, edycja dotknięciem karty. */
    .table-scroll { overflow: visible; }
    table.stack thead { display: none; }
    table.stack, table.stack tbody { display: block; }
    table.stack tr { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 4px 10px; padding: 12px 4px; border-top: 1px solid var(--grid); }
    table.stack td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; font-size: 14px; }
    table.stack td.date { grid-column: 1 / -1; font-weight: 800; font-size: 15px; }
    table.stack td.note:not(:empty) { grid-column: 1 / -1; }
    /* Dieta: ocena w pierwszej linii obok daty, więc karta ma dwie linie. */
    table.stack td.verdict { grid-column: 3 / -1; grid-row: 1; justify-self: end; text-align: right; }
    table.stack td.verdict ~ td.date, table.stack tr:has(td.verdict) td.date { grid-column: 1 / 3; }
    /* Treningi: bez podpisów, czas, dystans i kalorie w jednej linii. */
    table.stack.plain td { align-self: center; }
    table.stack.plain td.num > div { display: inline; }
    table.stack.plain td.num > div + div::before { content: ' · '; color: var(--muted); }
    table.stack td.edit, table.stack td.col-note:empty { display: none; }
    table.stack:not(.plain) td[data-label]:not(.date):not(.verdict):not(.note)::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
    tbody tr:hover td { background: none; }

    /* Okna jako panel wysuwany od dołu, z przyciskami zawsze widocznymi. */
    dialog:not(.viewer) { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; padding: 20px 18px 0; overflow-y: auto; border-radius: 22px 22px 0 0; animation: sheet-in .22s ease-out; }
    dialog:not(.viewer)::before { content: ''; display: block; width: 40px; height: 4px; margin: -8px auto 12px; border-radius: 2px; background: var(--line); }
    dialog:not(.viewer) .actions { position: sticky; bottom: 0; z-index: 1; margin: 4px -18px 0; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); box-shadow: 0 -8px 16px rgba(21, 25, 51, .06); }
    dialog.wide:not(.viewer) .compare-grid img { height: 40vh; }
    .compare-head { flex-wrap: wrap; }
    /* Podgląd zdjęcia na cały ekran. */
    .viewer[open] { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
    .viewer[open] .viewer-stage { flex: 1 1 0; height: auto; min-height: 50vh; }
    .viewer-actions, .viewer-edit { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog { animation: none !important; } }

/* ================= Konto: logowanie, rejestracja, ustawienia konta ================= */
.lock-form.auth { width: min(100%, 380px); gap: 12px; grid-template-columns: minmax(0, 1fr); }
.auth-view > * { min-width: 0; }
.auth-view { display: grid; gap: 12px; }
.auth-view[hidden] { display: none; }
.auth h2 { margin: 0; font-size: 18px; font-weight: 800; }
.auth input { font-size: 16px; letter-spacing: normal; }
.auth-notice { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.auth-notice[hidden] { display: none; }
.auth-notice.is-ok { background: #d1fae5; color: #047857; }
.auth-notice.is-error { background: #ffe4e6; color: #be123c; }
.auth-links { margin: 0; font-size: 14px; text-align: center; color: var(--muted); }
.legal-links { margin: 4px 0 0; font-size: 12px; text-align: center; color: var(--muted); }
.legal-links a, .auth a, .account-fields a { color: var(--blue); }
label.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; font-weight: 500; line-height: 1.45; color: var(--ink); }
label.check input { flex: none; width: 18px; height: 18px; min-height: 0; margin: 1px 0 0; accent-color: var(--blue); }
/* Pole-pułapka dla botów: poza ekranem, ale nie display:none, bo część botów to sprawdza. */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.account-fields { display: grid; gap: 10px; margin: 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); }
.account-fields legend { padding: 0; font-size: 14px; font-weight: 600; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-view { display: grid; gap: 12px; }
.account-view[hidden] { display: none; }
.account-view p { margin: 0; }
button.danger:not(.link-button) { color: var(--danger); }
#delete-form button[type=submit] { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Strony dokumentów: regulamin, polityka prywatności */
.doc-page { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; line-height: 1.65; }
.doc-page h1 { font-size: 28px; font-weight: 800; margin: 12px 0 4px; }
.doc-page h2 { display: block; margin: 28px 0 8px; font-size: 18px; }
.doc-page p, .doc-page li { font-size: 15px; }
.doc-page ul, .doc-page ol { padding-left: 22px; }
.doc-page a { color: var(--blue); }
.doc-table { width: 100%; margin: 8px 0; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.doc-table th, .doc-table td { padding: 10px 12px; vertical-align: top; }
@media (max-width: 640px) { .doc-table thead { display: none; } .doc-table tr { display: grid; padding: 8px 0; border-top: 1px solid var(--grid); } .doc-table td { border: 0; padding: 2px 12px; } }

/* ================= Ekran logowania: linki i przyciski drugiego planu ================= */
.text-link { display: inline-flex; align-items: center; gap: 4px; min-height: 0; padding: 0; background: none; border: 0; border-radius: 0; color: var(--blue); font-size: 13px; font-weight: 700; text-decoration: none; box-shadow: none; }
.text-link:hover { background: none; text-decoration: underline; }
.text-link[hidden] { display: none; }
.text-link .icon { width: 16px; height: 16px; margin: 0; }
.forgot-link { justify-self: end; margin-top: -6px; }
.back-link { justify-self: start; color: var(--muted); }
button.secondary { width: 100%; background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--blue) 35%, white); color: var(--blue); font-weight: 700; }
button.secondary:hover { background: var(--blue-soft); border-color: var(--blue); }
.auth-alt { display: grid; gap: 8px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
.auth-alt span { font-size: 13px; color: var(--muted); }
.price-pill { justify-self: start; margin-top: -6px; padding: 5px 12px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 13px; font-weight: 700; text-decoration: none; }
.price-pill:hover { background: color-mix(in srgb, var(--blue) 16%, white); }
/* Stopka z dokumentami: ciche linki rozdzielone kropkami. */
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 0; margin: 4px 0 0; font-size: 12px; }
.legal-links a { color: var(--muted); font-weight: 600; text-decoration: none; }
.legal-links a:hover { color: var(--ink); text-decoration: underline; }
.legal-links a + a::before { content: '·'; display: inline-block; margin: 0 8px; color: var(--line); text-decoration: none; }
.account-fields .legal-links { justify-content: flex-start; }

/* ================= Strony informacyjne: nagłówek, treść na karcie ================= */
body.doc { min-height: 100vh; }
.top .brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.top .nav-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 10px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28); color: #fff; font-weight: 700; text-decoration: none; }
.top .nav-link:hover { background: rgba(255, 255, 255, .28); }
.doc-page { margin: 0 auto 24px; padding: 28px 32px 36px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-page h1 { margin-top: 0; }
.doc-footer { padding: 8px 16px calc(32px + env(safe-area-inset-bottom)); }
.doc-footer .legal-links { font-size: 13px; }
@media (max-width: 640px) { .doc-page { margin: 0 12px 16px; padding: 20px 18px 28px; } .top .nav-link { min-height: 40px; } }

/* ================= Cennik ================= */
.pricing { max-width: 880px; margin: 0 auto; padding: 8px 20px 24px; }
.pricing h1 { margin: 8px 0 6px; font-size: 32px; font-weight: 800; text-align: center; }
.pricing-lead { margin: 0 0 24px; text-align: center; color: var(--muted); font-size: 16px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.plan { position: relative; padding: 24px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); }
.plan h2 { margin: 0 0 6px; font-size: 18px; }
.plan-price { margin: 0 0 10px; display: flex; align-items: baseline; gap: 6px; }
.plan-price b { font-size: 40px; font-weight: 800; letter-spacing: -.03em; }
.plan-price span { color: var(--muted); font-weight: 600; }
.plan-note { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.plan.is-featured { background: var(--brand); color: #fff; box-shadow: 0 16px 40px rgba(124, 58, 237, .35); }
.plan.is-featured .plan-price span, .plan.is-featured .plan-note { color: rgba(255, 255, 255, .88); }
.plan.is-featured h2 { color: #fff; }
.plan-badge { position: absolute; top: -12px; right: 20px; padding: 5px 12px; border-radius: 999px; background: #10b981; color: #fff; font-size: 13px; font-weight: 800; box-shadow: 0 6px 16px rgba(16, 185, 129, .4); }
.plan-features { margin-top: 20px; padding: 22px 24px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); }
.plan-features h2 { margin: 0 0 10px; font-size: 18px; }
.plan-features ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.plan-features li { position: relative; padding-left: 28px; line-height: 1.5; }
.plan-features li::before { content: '✓'; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: #d1fae5; color: #047857; font-size: 12px; font-weight: 800; text-align: center; line-height: 20px; }
.pricing-info { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.pricing-cta { margin: 16px 0 0; text-align: center; }
.cta { display: inline-flex; align-items: center; min-height: 48px; padding: 0 28px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 800; text-decoration: none; box-shadow: 0 8px 22px rgba(79, 70, 229, .35); }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; gap: 20px; } .pricing h1 { font-size: 26px; } .plan-price b { font-size: 34px; } }

/* ================= Płatności: pasek próby, ekran blokady, zamówienie, panel administratora ================= */
.access-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; border-radius: var(--radius); background: linear-gradient(135deg, #fff7ed, #fdf2f8); box-shadow: var(--shadow); }
.access-banner[hidden] { display: none; }
.access-banner p { margin: 0; font-weight: 700; color: #9a3412; }
.paywall { max-width: 720px; }
.paywall[hidden], #app-page[hidden] { display: none; }
.paywall-card, .paywall-account { padding: 22px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.paywall-card h2 { font-size: 22px; }
.paywall-card > p { margin: 0 0 16px; color: var(--muted); }
.billing h3 { margin: 4px 0 0; font-size: 15px; }
.order-form { display: grid; gap: 12px; }
.plan-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-option { position: relative; display: block; margin: 0; cursor: pointer; }
.plan-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.plan-option > span { display: grid; gap: 2px; height: 100%; padding: 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.plan-option b { font-size: 14px; }
.plan-option strong { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.plan-option small { font-size: 12px; font-weight: 500; color: var(--muted); }
.plan-option .saving { color: #047857; font-weight: 800; }
.plan-option input:checked + span { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.plan-option input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.billing-status { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: var(--blue-soft); font-size: 14px; }
.transfer { display: grid; gap: 8px; margin-bottom: 12px; }
.transfer-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--future); }
.transfer-row span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.transfer-row b { overflow-wrap: anywhere; }
button.copy { min-height: 32px; padding: 0 10px; font-size: 13px; }
.account-access { margin: 0; font-weight: 700; }
#account-billing { justify-self: start; }
#account-billing[hidden] { display: none; }
.invoice-list { margin: 0; padding-left: 18px; font-size: 14px; }
.invoice-list a { color: var(--blue); }
.billing-dialog { display: grid; gap: 14px; }
.top .nav-link .icon { margin-right: 6px; }
@media (max-width: 640px) {
    .plan-pick { grid-template-columns: 1fr; }
    .transfer-row { grid-template-columns: 1fr auto; }
    .transfer-row span { grid-column: 1 / -1; }
    .top nav .nav-link .label { display: none; }
    .top nav .nav-link .icon { margin: 0; width: 20px; height: 20px; }
}
.admin { max-width: 960px; margin: 0 auto; padding: 8px 20px 24px; display: grid; gap: 16px; }
.admin h1 { margin: 8px 0 0; font-size: 28px; font-weight: 800; }
.admin section { padding: 18px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-order { display: grid; gap: 6px; padding: 14px 0; border-top: 1px solid var(--grid); }
.admin-order:first-child { border-top: 0; padding-top: 0; }
.admin-order h3 { margin: 0; font-size: 16px; }
.admin-order p { margin: 0; font-size: 14px; }
.admin-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.admin-pay .actions { grid-column: 1 / -1; }
@media (max-width: 640px) { .admin-pay { grid-template-columns: 1fr; } }
.doc-form { padding: 14px 16px; border-radius: 12px; background: var(--future); font-size: 14px; }

/* Logo w karcie logowania: znak w gradiencie i nazwa krojem aplikacji. */
.brand-lockup { display: flex; align-items: center; gap: 12px; font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.brand-lockup img { flex: none; }
.lock-form.auth { width: min(100%, 400px); }

/* Podpis wykonawcy pod kartą logowania: czarne logo ReadyToCode odwrócone na biało, żeby było widać je na gradiencie. */
.lock { flex-direction: column; gap: 22px; }
.made-by { display: grid; justify-items: center; gap: 6px; color: rgba(255, 255, 255, .8); font-size: 12px; font-weight: 600; text-decoration: none; opacity: .85; transition: opacity .15s; }
.made-by:hover { opacity: 1; }
.made-by img { display: block; height: auto; filter: invert(1); }
/* Na telefonie podpis ReadyToCode nad kartą: pod nią wypadał poza ekran i trzeba było przewijać. */
@media (max-width: 640px) {
    .lock { justify-content: flex-start; gap: 14px; padding-top: max(18px, env(safe-area-inset-top)); }
    .made-by { order: -1; grid-auto-flow: column; align-items: center; gap: 8px; }
    .made-by img { width: 112px; }
}

/* ================= Strona logowania: opis aplikacji ================= */
/* Komputer: opis obok karty; telefon: podpis ReadyToCode, karta, potem opis. */
.lock { display: grid; grid-template-columns: minmax(0, 540px) minmax(0, 400px); align-items: center; justify-content: center; align-content: center; gap: 28px 64px; padding: 40px 24px; }
.lock .made-by { grid-column: 2; }
.hero-copy { grid-row: 1 / span 2; color: #fff; }
.hero-copy h2 { display: block; margin: 14px 0 12px; font-size: 40px; line-height: 1.12; font-weight: 800; letter-spacing: -.03em; }
.hero-copy > p { margin: 0 0 18px; font-size: 17px; line-height: 1.6; color: rgba(255, 255, 255, .88); }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .18); font-size: 13px; font-weight: 800; }
.hero-badge .icon { width: 16px; height: 16px; margin: 0; }
.hero-points { display: grid; gap: 10px; margin: 0 0 22px; padding: 0; list-style: none; }
.hero-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.45; color: rgba(255, 255, 255, .92); }
.hero-points .icon { flex: none; width: 30px; height: 30px; padding: 6px; margin: -3px 0 0; border-radius: 9px; background: rgba(255, 255, 255, .18); stroke-width: 2; box-sizing: border-box; }
.hero-points b { color: #fff; }
.hero-cta { min-height: 48px; padding: 0 24px; border: 0; border-radius: 12px; background: #fff; color: #5b21b6; font-size: 16px; font-weight: 800; box-shadow: 0 10px 26px rgba(21, 25, 51, .25); }
.hero-cta:hover { background: #fff; transform: translateY(-1px); }
.landing { max-width: 1040px; margin: 0 auto; padding: 48px 20px 24px; display: grid; gap: 28px; }
.landing-section { padding: 26px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); }
.landing-section > h2 { margin: 0 0 18px; font-size: 24px; font-weight: 800; }
.landing-section > h2 .icon { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: #d1fae5; color: #047857; box-sizing: border-box; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.feature { padding: 18px; border-radius: 16px; background: color-mix(in srgb, var(--cat) 6%, var(--future)); }
.feature .icon { box-sizing: border-box; width: 40px; height: 40px; padding: 8px; border-radius: 12px; background: linear-gradient(135deg, var(--cat), var(--cat2)); color: #fff; stroke-width: 2; box-shadow: 0 6px 14px color-mix(in srgb, var(--cat) 35%, transparent); }
.feature h3 { margin: 12px 0 6px; font-size: 16px; font-weight: 800; }
.feature p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; display: grid; gap: 4px; padding: 18px 18px 18px 64px; border-radius: 16px; background: var(--future); counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 16px; top: 16px; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; }
.steps b { font-size: 16px; }
.steps span { font-size: 14px; color: var(--muted); line-height: 1.5; }
.trust ul { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin: 0; padding: 0; list-style: none; }
.trust li { position: relative; padding-left: 28px; line-height: 1.5; font-size: 15px; }
.trust li::before { content: '✓'; position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: #d1fae5; color: #047857; font-size: 12px; font-weight: 800; text-align: center; line-height: 20px; }
.price-teaser { background: var(--brand); color: #fff; }
.price-teaser > h2 { color: #fff; }
.price-teaser p { margin: 0 0 16px; font-size: 16px; line-height: 1.6; color: rgba(255, 255, 255, .9); }
.price-teaser b { color: #fff; font-size: 20px; }
.price-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.price-teaser .text-link { color: #fff; font-size: 15px; }
.landing-footer { display: grid; gap: 10px; justify-items: center; padding: 8px 0 24px; text-align: center; }
@media (max-width: 960px) {
    .lock { grid-template-columns: minmax(0, 440px); }
    .lock .made-by { grid-column: 1; }
    .hero-copy { grid-row: auto; order: 3; }
    .hero-copy h2 { font-size: 30px; }
    .feature-grid { grid-template-columns: 1fr 1fr; }
    .steps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .lock { display: flex; flex-direction: column; align-items: stretch; padding: 18px 14px 28px; }
    .hero-copy h2 { font-size: 26px; }
    .hero-copy > p { font-size: 15px; }
    .landing { padding: 20px 14px 16px; gap: 16px; }
    .landing-section { padding: 18px; }
    .landing-section > h2 { font-size: 20px; }
    .feature-grid, .trust ul { grid-template-columns: 1fr; }
    .hero-cta { width: 100%; }
}
