/* Kolory i czcionki pochodzą z gabinet/config.php (zmienne CSS w <head>). */
:root {
  --bg: #F4EFE8; --surface: #FBF8F3; --ink: #2E3A2F; --muted: #5B675C; --line: #DDD3C4; --ring: #A9A08E;
  --in: #9FC1A0; --hold: #E3C59A; --out: #A7C3CF; --prep: #E6DED1;
  --btn: #3D5A45; --btn-ink: #FBF8F3; --focus: #8A5A2B; --danger: #A3412F; --ok: #3D6B47;
  --serif: Georgia, serif; --sans: system-ui, sans-serif;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.in-session { overflow: hidden; }
main { flex: 1; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.small { font-size: .88rem; color: var(--muted); }
.opt-label { color: var(--muted); font-weight: 400; }

h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 6.5vw, 2.8rem); line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 12px; }
.lede { margin: 0 0 24px; color: var(--muted); max-width: 36em; }
.sec { font-family: var(--serif); font-weight: 400; font-size: 1.45rem; margin: 36px 0 14px; }

/* ---------- Nagłówek i stopka ---------- */
.top { border-bottom: 1px solid var(--line); background: var(--surface); padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 1040px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { display: block; width: 40px; height: 40px; flex: none; color: var(--btn); }
.logo svg { width: 100%; height: 100%; display: block; }
img.logo { object-fit: contain; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--serif); font-size: 1.2rem; }
.brand-by { font-size: .82rem; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.nav a, .linkbtn { text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 0; }
.nav a:hover, .linkbtn:hover { text-decoration: underline; }
.nav form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 8px 0; color: inherit; }
.linkbtn.danger { color: var(--danger); }

.demo-ribbon { margin: 0; text-align: center; font-size: .85rem; padding: 6px 16px; background: var(--hold); color: var(--ink); }
.flash { max-width: 1000px; margin: 16px auto 0; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); width: calc(100% - 40px); }
main .flash { width: 100%; margin: 0 0 18px; }
.flash-ok { border-color: var(--ok); }
.flash-error { border-color: var(--danger); color: var(--danger); }

.foot { border-top: 1px solid var(--line); padding: 20px 20px calc(env(safe-area-inset-bottom, 0px) + 22px); text-align: center; font-size: .85rem; color: var(--muted); }
.foot p { margin: 0; }

/* ---------- Układ ---------- */
.wrap { max-width: 720px; width: 100%; margin: 0 auto; padding: 40px 20px 64px; }
.wrap.wide { max-width: 1040px; }
.narrow { max-width: 460px; width: 100%; margin: 0 auto; padding: 48px 20px 64px; }

.box { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 16px 18px; margin: 28px 0 0; }
.box p { margin: 0 0 8px; }
.box p:last-child { margin: 0; }
.box-danger { border-color: var(--danger); }
.plain { margin: 6px 0 10px; padding-left: 20px; }
.plain li { margin: 4px 0; }
.links { display: flex; flex-direction: column; gap: 8px; margin: 22px 0 0; font-size: .95rem; }
.empty { color: var(--muted); padding: 24px 0; }

/* ---------- Formularze ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
.form input:not([type="checkbox"]), .form select, .mini select {
  min-height: 46px; padding: 0 14px; border: 1.5px solid var(--ring); border-radius: 10px;
  background: var(--surface); width: 100%;
}
.form input:focus-visible, .form select:focus-visible { outline-offset: 1px; }
.form label.check, .check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--btn); }
.err { margin: -6px 0 0; color: var(--danger); font-size: .9rem; }
.form .btn { align-self: flex-start; margin-top: 4px; }
.form.inline { flex-direction: row; flex-wrap: wrap; align-items: stretch; }
.form.inline input { flex: 1 1 220px; width: auto; }
.form.inline .btn { margin: 0; }
.grid-form { display: grid; grid-template-columns: 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 0 0 28px; }
@media (min-width: 720px) {
  .grid-form { grid-template-columns: repeat(4, 1fr); align-items: end; }
  .grid-form .span2 { grid-column: span 3; }
}
.grid-form .btn { margin: 0; align-self: end; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  min-height: 46px; padding: 0 28px; border-radius: 999px; border: 0;
  background: var(--btn); color: var(--btn-ink); font-weight: 600;
}
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ring); font-weight: 500; padding: 0 22px; }
.btn.small-btn { min-height: 40px; padding: 0 16px; }

/* ---------- Dostęp i pakiety ---------- */
.plans { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.plan { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; }
.plan h3 { margin: 0; font-size: 1.05rem; }
.plan .price { font-family: var(--serif); font-size: 1.9rem; margin: 8px 0 2px; }
.plan .small { margin: 0 0 16px; flex: 1; }
.plan form { margin: 0; }
.code-box { margin-top: 12px; }

/* ---------- Panel terapeuty ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 8px 0 28px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stats dt { font-size: .85rem; color: var(--muted); }
.stats dd { margin: 4px 0 0; font-family: var(--serif); font-size: 1.8rem; line-height: 1.1; }
.tabs { display: flex; gap: 6px 22px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 24px; }
.tabs a { text-decoration: none; padding: 10px 0; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--btn); }
.search { margin-bottom: 18px; max-width: 520px; }

.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .small { font-size: .85rem; }
.muted-row { opacity: .55; }
.actions { min-width: 230px; }
.mini { display: flex; gap: 6px; margin: 0; }
.mini select { min-height: 40px; width: auto; padding: 0 10px; }
.more { margin-top: 6px; font-size: .9rem; }
.more summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.more form { margin: 4px 0; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--in); color: var(--ink); }
.pill-off { background: var(--hold); color: var(--ink); }
.pill-none { box-shadow: inset 0 0 0 1px var(--ring); color: var(--muted); }
.code { font-weight: 700; letter-spacing: .03em; }
.snippet { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; overflow-x: auto; margin: 0 0 12px; }
.snippet code { border: 0; padding: 0; background: none; white-space: pre; }

/* ---------- Lista ćwiczeń ---------- */
.hero { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; margin-bottom: 32px; }
.hero .small { margin: 10px 0 0; }
.hero .lede { margin: 0; }
.orb-slot { width: 112px; height: 112px; flex: none; display: grid; place-items: center; border: 1.5px solid var(--ring); border-radius: 50%; }
.orb { width: 100%; height: 100%; border-radius: 50%; background: var(--in); transform: scale(.5); animation: breathe 10s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { transform: scale(.5); background: var(--out); }
  50%      { transform: scale(1);  background: var(--in); }
}
.opt { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.switch { width: 52px; height: 30px; border-radius: 15px; border: 1.5px solid var(--ring); background: transparent; position: relative; padding: 0; flex: none; transition: background-color .2s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: var(--ink); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--in); border-color: var(--ink); }
.switch[aria-checked="true"] span { transform: translateX(22px); }

.list { list-style: none; margin: 0; padding: 0; }
.ex { border-top: 1px solid var(--line); padding: 30px 0; display: grid; gap: 22px; }
@media (min-width: 620px) { .ex { grid-template-columns: 1fr 210px; gap: 36px; } }
.ex h2 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1.2; margin: 0 0 8px; }
.ex .desc { margin: 0 0 16px; }
.badge { display: inline-block; margin: 0 0 10px; padding: 3px 12px; border-radius: 999px; background: var(--hold); font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
.bar { display: flex; gap: 3px; height: 12px; margin-bottom: 10px; }
.bar i { display: block; border-radius: 6px; min-width: 6px; }
.k-in { background: var(--in); }
.k-out { background: var(--out); }
.k-holdFull, .k-holdEmpty { background: var(--hold); }
.steps { margin: 0; color: var(--muted); font-size: .92rem; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper output { min-width: 5.6em; text-align: center; font-weight: 600; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--ring); background: transparent; font-size: 1.3rem; line-height: 1; display: grid; place-items: center; padding: 0; }
.round:disabled { opacity: .35; cursor: default; }
.dur { margin: 6px 0 16px; color: var(--muted); font-size: .92rem; }
.note { border-top: 1px solid var(--line); padding-top: 22px; color: var(--muted); font-size: .92rem; max-width: 38em; }

/* ---------- Ekran ćwiczenia ---------- */
.session {
  position: fixed; inset: 0; z-index: 10; background: var(--bg);
  display: flex; flex-direction: column; overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px calc(env(safe-area-inset-bottom, 0px) + 18px);
}
.run, .done { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 560px; margin: 0 auto; min-height: 0; }
.s-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.s-name { margin: 0; color: var(--muted); font-weight: 600; }
.s-top .btn { min-height: 44px; padding: 0 18px; }
.stage { flex: 1; display: grid; place-items: center; min-height: 190px; padding: 12px 0; }
.ring { --size: min(74vw, 40vh, 360px); width: var(--size); height: var(--size); position: relative; border-radius: 50%; border: 1.5px solid var(--ring); transition: opacity .3s; }
.fill { position: absolute; inset: 0; border-radius: 50%; background: var(--prep); transform: scale(.45); transition: background-color .9s ease; will-change: transform; }
.session[data-kind="in"] .fill { background: var(--in); }
.session[data-kind="out"] .fill { background: var(--out); }
.session[data-kind="holdFull"] .fill, .session[data-kind="holdEmpty"] .fill { background: var(--hold); }
.count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: calc(var(--size) * .34); font-variant-numeric: tabular-nums; line-height: 1; }
.session.paused .ring { opacity: .6; }
.say { text-align: center; padding: 6px 0 18px; min-height: 9.5rem; }
.do { font-family: var(--serif); font-size: clamp(1.7rem, 6.5vw, 2.4rem); line-height: 1.15; margin: 0 0 8px; }
.for { margin: 0 0 4px; font-size: 1.15rem; font-weight: 600; }
.tip { margin: 0; color: var(--muted); }
.s-foot { padding-top: 6px; }
.cyc { margin: 0 0 8px; color: var(--muted); font-size: .92rem; display: flex; justify-content: space-between; }
.prog { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 18px; }
.prog i { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(0); }
.ctl { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ctl .btn { min-width: 140px; }
.done { justify-content: center; text-align: center; gap: 12px; }
.done h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 8vw, 3.2rem); margin: 0; }
.done p { margin: 0 auto 18px; color: var(--muted); max-width: 28em; }

@media (max-height: 640px) {
  .say { min-height: 8rem; }
  .ring { --size: min(60vw, 34vh, 300px); }
}
@media (max-width: 520px) {
  .wrap, .narrow { padding-top: 28px; }
  .brand-by { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; transform: scale(.8); }
  .fill, .switch, .switch span { transition: none; }
}

/* ---------- Stopka: dokumenty ---------- */
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 10px; }
.foot-links a { padding: 6px 0; }

/* ---------- Strony prawne ---------- */
.legal-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; border-bottom: 1px solid var(--line); margin: 0 0 24px; }
.legal-nav a { text-decoration: none; padding: 10px 0; font-weight: 600; font-size: .95rem; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.legal-nav a[aria-current="page"] { color: var(--ink); border-color: var(--btn); }
.legal-page h2 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin: 32px 0 10px; }
.legal-page ol, .legal-page ul { padding-left: 22px; }
.legal-page li { margin: 6px 0; }
.legal-page .tbl { margin: 8px 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: block; overflow-x: auto; }
.legal-page blockquote { margin: 12px 0; padding: 12px 16px; border-left: 4px solid var(--btn); background: var(--surface); border-radius: 0 10px 10px 0; }
.form-sample p { margin: 0 0 10px; }
.contact { margin: 16px 0; }
.contact div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact dt { color: var(--muted); }
.contact dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Zakup ---------- */
.buy { display: flex; flex-direction: column; gap: 14px; }
.buy fieldset.plans { border: 0; padding: 0; margin: 0; }
label.plan { cursor: pointer; position: relative; }
label.plan input { position: absolute; top: 18px; right: 18px; width: 20px; height: 20px; accent-color: var(--btn); }
label.plan:has(input:checked) { border-color: var(--btn); box-shadow: inset 0 0 0 1.5px var(--btn); }
label.plan:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.plan-name { font-weight: 700; padding-right: 30px; }
.plan .price { display: block; }
.precontract { font-size: .92rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.precontract p { margin: 0 0 6px; }
.precontract p:last-child { margin: 0; }
.buy .check { font-size: .95rem; }
.buy .btn { align-self: flex-start; }
.legal-page > .box { margin: 0 0 22px; }
