:root {
  --paper: #fafaf7;
  --card: #ffffff;
  --ink: #16201c;
  --ink-soft: #3f4a45;
  --line: #c9d1cd;
  /* Marka Lekowiedza: ciemny #0F5C63 (tekst/przyciski, 7,7:1 na białym), akcent #2A9D8F i jasny #7FD1C7
     tylko na ramki, ikony i duże elementy (za mały kontrast dla zwykłego tekstu), żółty #F2B544 tylko jako tło/akcent. */
  --brand: #0F5C63;
  --brand-accent: #2A9D8F;
  --brand-light: #7FD1C7;
  --brand-yellow: #F2B544;
  --green: var(--brand);
  --green-dark: #0A454B;
  --ok-bg: #e3f4f1;
  --amber-bg: #fff1cc;
  --amber-ink: #6b4a00;
  --amber-bar: var(--brand-yellow);
  --red-bg: #fbe4e1;
  --red-ink: #8e1f17;
  --red-bar: #c0392b;
  --focus: #1d4e89;
  --radius-s: 8px;
  --radius-l: 14px;
  font-size: 20px;
}
html.large { font-size: 24px; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Atkinson Hyperlegible', Verdana, Tahoma, sans-serif;
  line-height: 1.55;
}
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem; z-index: 10; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Pasek marki z logo (białe tło — logo ma ciemny napis) */
.brand { background: #fff; border-bottom: 4px solid var(--brand-accent); }
.brand-inner { padding: .5rem 1rem; }
.brand-title { margin: 0; line-height: 0; }
.brand-link { display: inline-block; line-height: 0; border-radius: var(--radius-s); }
.brand-logo { display: block; height: 5.5rem; width: auto; max-width: 100%; }  /* podpis w logo ≥ 12 px */

/* Linki w treści: kolor marki (7,7:1 na białym), grube podkreślenie; hover/focus wyraźnie inne */
main a:not(.btn), main a:not(.btn):visited {
  color: var(--brand); font-weight: 700;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em;
}
main a:not(.btn):hover { color: var(--green-dark); text-decoration-thickness: 4px; background: var(--ok-bg); }
main a:not(.btn):focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 3px;
  background: var(--brand-yellow); color: #16201c; text-decoration-thickness: 4px;
}

/* Wybór pliku (panel administratora) — przycisk w stylu marki */
input[type="file"] { font: inherit; font-size: .9rem; color: var(--ink-soft); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; color: var(--brand); background: #fff; cursor: pointer;
  border: 2px solid var(--brand); border-radius: var(--radius-s); padding: .45rem .9rem; margin-right: .7rem; min-height: 2.6rem;
}
input[type="file"]::file-selector-button:hover { background: var(--ok-bg); }
input[type="file"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: var(--radius-s); }

/* Nagłówek */
.top { background: var(--green); color: #fff; padding: 1.4rem 0 1.6rem; }
.top-inner { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 .4rem; }
.lead { margin: 0; font-size: 1.05rem; max-width: 32rem; }
.size-toggle { display: flex; gap: .3rem; flex-shrink: 0; }
.size-toggle button {
  min-width: 2.6rem; min-height: 2.6rem; border-radius: var(--radius-s);
  border: 2px solid rgba(255,255,255,.7); background: transparent; color: #fff;
  font: inherit; font-weight: 700; cursor: pointer;
}
.size-toggle .big-a { font-size: 1.3rem; }
.size-toggle button[aria-pressed="true"] { background: #fff; color: var(--green); }

/* Uwaga */
.notice {
  margin: 1.2rem 0; padding: .9rem 1.1rem; background: var(--amber-bg);
  border-left: 6px solid var(--amber-bar); border-radius: var(--radius-s); color: #3b2a00;
}
.notice p { margin: .2rem 0; }

/* Kroki */
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.2rem 1.2rem 1.4rem; margin: 1.2rem 0; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 0 0 .5rem; display: flex; align-items: center; gap: .6rem; }
/* Kółko z numerem tylko w nagłówkach kroków — klasa „num” jest też na komórkach liczbowych tabel */
h2 > .num {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex-shrink: 0;
  border-radius: 50%; background: var(--green); color: #fff; font-size: 1.05rem;
}
.hint { color: var(--ink-soft); margin: 0 0 1rem; }
.soft { background: var(--paper); padding: .6rem .8rem; border-radius: var(--radius-s); }

.field-label, label[for] { display: block; font-weight: 700; margin: 1rem 0 .35rem; }
input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 2px solid var(--line); border-radius: var(--radius-s); padding: .6rem .7rem; min-height: 2.8rem;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(29,78,137,.25); }

/* Przyciski */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 700; min-height: 3rem; padding: .6rem 1.2rem;
  border-radius: var(--radius-s); border: 2px solid var(--green); cursor: pointer;
  background: #fff; color: var(--green); text-decoration: none;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline:hover { background: var(--ok-bg); }
.btn-big { background: var(--green); color: #fff; min-height: 4rem; font-size: 1.1rem; flex: 1; }
.btn-big.btn-outline { background: #fff; color: var(--green); }
.btn-wide { width: 100%; margin-top: 1.3rem; min-height: 3.4rem; font-size: 1.1rem; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn-remove {
  font: inherit; border: none; background: none; color: var(--red-ink); cursor: pointer;
  padding: .4rem .5rem; min-height: 2.6rem; text-decoration: underline;
}
.photo-buttons { display: flex; gap: .7rem; flex-wrap: wrap; }
.photo-buttons label { margin: 0; }
.photo-buttons label:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }

.thumbs { list-style: none; padding: 0; margin: .8rem 0 0; display: flex; gap: .6rem; flex-wrap: wrap; }
.thumbs li { position: relative; }
.thumbs img { width: 6rem; height: 6rem; object-fit: cover; border-radius: var(--radius-s); border: 1px solid var(--line); display: block; }
.btn-docs { flex-basis: 100%; }
.photo-thumb { margin: 0; position: relative; }
.photo-thumb figcaption {
  position: absolute; left: .3rem; bottom: .3rem; min-width: 1.5rem; height: 1.5rem; padding: 0 .3rem;
  display: grid; place-items: center; border-radius: 1rem; background: rgba(22,32,28,.8); color: #fff; font-size: .75rem; font-weight: 700;
}
.pdf-thumb {
  width: 6rem; height: 6rem; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; padding: .3rem; overflow: hidden;
}
.pdf-ico { background: var(--red-bar); color: #fff; font-weight: 700; font-size: .75rem; padding: .1rem .4rem; border-radius: 4px; }
.pdf-name { font-size: .65rem; line-height: 1.2; text-align: center; word-break: break-all; max-height: 3.6em; overflow: hidden; }
.filled-note { border-left: 6px solid var(--green); background: var(--ok-bg); }
.thumbs button {
  position: absolute; top: -.5rem; right: -.5rem; width: 2rem; height: 2rem; border-radius: 50%;
  border: 2px solid #fff; background: var(--red-bar); color: #fff; font-size: 1rem; cursor: pointer; line-height: 1;
}

.error { color: var(--red-ink); background: var(--red-bg); padding: .6rem .8rem; border-radius: var(--radius-s); margin-top: 1rem; font-weight: 700; }

/* Lista leków do poprawy */
.med-list { padding: 0; margin: 0 0 1rem; list-style: none; counter-reset: med; }
.med-list li {
  counter-increment: med; display: grid; grid-template-columns: 2rem 1fr auto; gap: .3rem .6rem;
  align-items: start; padding: .8rem 0; border-bottom: 1px solid var(--line);
}
.med-list li::before { content: counter(med) "."; font-weight: 700; padding-top: .6rem; }
.med-list li.low { background: var(--amber-bg); margin: 0 -.6rem; padding: .8rem .6rem; border-radius: var(--radius-s); }
.med-fields { display: grid; gap: .4rem; }
.med-fields input { min-height: 2.6rem; }
.med-fields .sub { font-size: .85rem; color: var(--ink-soft); margin: 0; }

/* Podpowiedzi leków */
.btn-second { margin-top: .7rem; min-height: 3rem; font-size: 1rem; }
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  max-height: min(60vh, 26rem); overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border: 2px solid var(--focus); border-radius: var(--radius-s);
  box-shadow: 0 8px 24px rgba(22,32,28,.18);
}
.ac-group { padding: .55rem .7rem .65rem; border-top: 1px solid var(--line); }
.ac-group:first-child { border-top: none; }
.ac-head strong { display: block; line-height: 1.25; }
.ac-meta { display: block; font-size: .8rem; color: var(--ink-soft); line-height: 1.3; }
.ac-doses { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.ac-opt {
  cursor: pointer; font-size: .9rem; line-height: 1.2; padding: .45rem .7rem; min-height: 2.3rem;
  display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: 2rem; background: var(--paper);
}
.ac-opt:hover { border-color: var(--green); background: var(--ok-bg); }
.ac-opt.active { border-color: var(--focus); background: var(--focus); color: #fff; }

/* Choroby */
.checks { border: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .5rem; }
.checks label {
  display: flex; gap: .6rem; align-items: center; margin: 0; font-weight: 400;
  border: 2px solid var(--line); border-radius: var(--radius-s); padding: .55rem .7rem; cursor: pointer; min-height: 3rem;
}
.checks input { width: 1.4rem; height: 1.4rem; accent-color: var(--green); flex-shrink: 0; }
.checks label:has(input:checked) { border-color: var(--green); background: var(--ok-bg); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid3 > div:last-child { grid-column: span 2; } }

/* Ładowanie */
.loading { text-align: center; padding: 2rem 1rem; }
.pill-anim { display: flex; justify-content: center; gap: .6rem; margin-bottom: 1rem; }
.pill-anim span { width: 2.4rem; height: 1rem; border-radius: 1rem; background: linear-gradient(90deg, var(--green) 50%, #fff 50%); border: 2px solid var(--green); animation: bob 1.4s ease-in-out infinite; }
.pill-anim span:nth-child(2) { animation-delay: .2s; }
.pill-anim span:nth-child(3) { animation-delay: .4s; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-.5rem) rotate(20deg); } }
@media (prefers-reduced-motion: reduce) { .pill-anim span { animation: none; } }

/* Wynik */
.result { margin: 1.5rem 0; outline: none; }
.result > h2 { font-size: 1.6rem; }
.print-date { color: var(--ink-soft); margin: 0 0 1rem; }
.block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.1rem 1.2rem; margin: 1rem 0; }
.block h3 { font-size: 1.15rem; margin: 0 0 .6rem; }
.block ul { margin: 0; padding-left: 1.2rem; }
.block li { margin: .35rem 0; }
.summary { font-size: 1.1rem; border-left: 6px solid var(--green); }
.urgent { background: var(--red-bg); border-color: var(--red-bar); border-left: 6px solid var(--red-bar); color: #4a0f0a; }

.item { border-top: 1px solid var(--line); padding: .8rem 0; }
.item:first-of-type { border-top: none; padding-top: 0; }
.item strong { display: block; }
.item p { margin: .25rem 0; }
.sev { display: inline-block; font-weight: 700; font-size: .85rem; padding: .1rem .55rem; border-radius: 1rem; margin-bottom: .3rem; }
.sev-high { background: var(--red-bg); color: var(--red-ink); }
.sev-moderate { background: var(--amber-bg); color: var(--amber-ink); }
.sev-low { background: var(--ok-bg); color: var(--green); }

/* Karta leku — kolorowy pasek jak naklejka apteczna */
.drug { display: grid; grid-template-columns: .5rem 1fr; gap: .9rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.drug:first-of-type { border-top: none; }
.drug .bar { border-radius: 4px; }
.drug h4 { margin: 0; font-size: 1.1rem; }
.drug .subst { color: var(--ink-soft); margin: 0 0 .3rem; }
.drug .verdict { display: inline-block; font-weight: 700; padding: .15rem .6rem; border-radius: var(--radius-s); margin: .2rem 0 .4rem; }
.drug p { margin: .2rem 0; }
.drug .crit { font-size: .85rem; color: var(--ink-soft); }
.drug .taper { background: var(--amber-bg); padding: .4rem .6rem; border-radius: var(--radius-s); }
.v-keep .bar { background: var(--green); } .v-keep .verdict { background: var(--ok-bg); color: var(--green); }
.v-review .bar { background: var(--amber-bar); } .v-review .verdict { background: var(--amber-bg); color: var(--amber-ink); }
.v-consider_stop .bar, .v-duplicate .bar { background: var(--red-bar); }
.v-consider_stop .verdict, .v-duplicate .verdict { background: var(--red-bg); color: var(--red-ink); }

.sources a { color: var(--focus); word-break: break-word; }
.result-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.4rem 0 2rem; }
.result-actions .btn { flex: 1; min-width: 12rem; }

.foot { color: var(--ink-soft); font-size: .85rem; padding-bottom: 2rem; }

/* Wydruk */
@media print {
  :root, html.large { font-size: 12pt; }
  body { background: #fff; }
  .top, .notice, .step, .loading, .result-actions, .foot, .skip { display: none !important; }
  .result { display: block !important; margin: 0; }
  .block { break-inside: avoid; border-color: #999; }
  .drug { break-inside: avoid; }
  a { color: #000; }
}

.key-points { border: 2px solid var(--green); border-left-width: 6px; background: var(--ok-bg); }
.key-points li { font-weight: 700; }
.sp-key { border: 1pt solid #000; padding: 2pt 4pt; }
@media print { .key-points { break-inside: avoid; } }

.disclaimer { background: var(--amber-bg); border-left: 6px solid var(--amber-bar); color: #3b2a00; }
@media print { .disclaimer { display: block !important; } }

/* Krótki PDF */
.pdf-panel { background: var(--card); border: 2px solid var(--green); border-radius: var(--radius-l); padding: 1rem 1.2rem 1.2rem; margin: 0 0 2rem; }
.pdf-panel p { margin: 0 0 .7rem; }
.pdf-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.pdf-actions .btn { flex: 1; min-width: 9rem; }
.pdf-frame { width: 100%; height: 80vh; margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; }
@media print { .pdf-panel, #err-pdf { display: none !important; } }

/* Krótki wydruk — jedna kartka */
.short-print { display: none; }
.short-print.measure {
  display: block; position: absolute; left: -10000px; top: 0;
  width: calc(210mm - 20mm); font-size: 8.5pt; background: #fff;
}
.short-print { font-size: 8.5pt; line-height: 1.3; color: #000; }
.sp-head { display: flex; justify-content: space-between; gap: 1em; border-bottom: 1.5pt solid #000; padding-bottom: 2pt; margin-bottom: 3pt; font-size: 10.5pt; }
.sp-pat { margin: 0 0 4pt; }
.sp-sec { margin: 0 0 4pt; break-inside: avoid-page; }
.sp-sec h3 { font-size: 9pt; margin: 0 0 1pt; text-transform: uppercase; letter-spacing: .03em; border-bottom: .5pt solid #888; }
.sp-sec p { margin: 0 0 1.5pt; }
.sp-urgent { border: 1pt solid #000; padding: 2pt 4pt; }
.sp-foot { margin: 5pt 0 0; font-size: 7pt; font-style: italic; border-top: .5pt solid #888; padding-top: 2pt; }

@media print {
  html.print-short body > *:not(.short-print) { display: none !important; }
  html.print-short .short-print { display: block !important; }
}
@page { size: A4; margin: 10mm; }

/* Konto użytkownika */
.auth-pending main, .auth-pending .userbar { visibility: hidden; }
.userbar { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-top: .9rem; font-size: .9rem; }
.userbar a, .userbar button { color: #fff; font: inherit; background: none; border: none; padding: .2rem 0; text-decoration: underline; cursor: pointer; min-height: 2rem; }
.pw-dialog { border: none; border-radius: var(--radius-l); padding: 1.3rem; width: min(26rem, calc(100vw - 2rem)); }
.pw-dialog::backdrop { background: rgba(0,0,0,.45); }
.pw-dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; gap: .6rem; margin-top: 1.2rem; }
.dialog-actions .btn { flex: 1; }
@media print { .userbar, .pw-dialog, #saved-note { display: none !important; } }
.login-box { max-width: 26rem; margin: 2rem auto; }
.login-hint { margin: 1rem 0 0; font-size: .9rem; }

/* Panel administratora */
.wrap.wide { max-width: 76rem; }
.admin { font-size: .9rem; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .6rem 1rem; align-items: end; }
.filters label { margin-top: 0; }
.filters .quick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font: inherit; font-size: .85rem; padding: .35rem .8rem; border-radius: 2rem; border: 2px solid var(--line); background: #fff; cursor: pointer; min-height: 2.3rem; }
.chip:hover { border-color: var(--green); background: var(--ok-bg); }
input[type="date"] { width: 100%; font: inherit; border: 2px solid var(--line); border-radius: var(--radius-s); padding: .5rem .6rem; min-height: 2.8rem; background: #fff; }
.exports { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.2rem 0 .6rem; }
.exports .btn { flex: 1; min-width: 14rem; }
.small { font-size: .85rem; }
.rev-count { font-weight: 700; margin: 1rem 0 .4rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-s); }
table.data { border-collapse: collapse; width: 100%; font-size: .85rem; }
table.data th, table.data td { padding: .45rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { background: var(--paper); position: sticky; top: 0; white-space: nowrap; }
table.data td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data td.sum { min-width: 18rem; }
table.data tr.inactive td { color: var(--ink-soft); }
table.data a { color: var(--focus); white-space: nowrap; }
.actions { white-space: nowrap; }
.link-btn { font: inherit; background: none; border: none; color: var(--focus); text-decoration: underline; cursor: pointer; padding: .2rem .3rem; }
.add-user { background: var(--paper); border-radius: var(--radius-s); padding: 1rem; margin-bottom: 1.2rem; }
.add-user h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.grid-add { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1rem; }
.pass-row { display: flex; gap: .4rem; }
.pass-row .btn { min-height: 2.8rem; padding: .4rem .8rem; }
.check-inline { display: flex !important; gap: .5rem; align-items: center; font-weight: 400 !important; margin: .9rem 0 !important; }
.check-inline input { width: 1.3rem; height: 1.3rem; accent-color: var(--green); }
.credentials { margin-top: 1rem; padding: .9rem 1rem; border: 2px solid var(--green); background: var(--ok-bg); border-radius: var(--radius-s); }
.credentials pre { background: #fff; padding: .6rem .8rem; border-radius: var(--radius-s); font-size: .95rem; white-space: pre-wrap; margin: .5rem 0; }

/* Edytor przycinania i zamazywania */
.redact {
  width: 100vw; max-width: 60rem; height: 100dvh; max-height: 100dvh; margin: 0 auto; padding: .8rem 1rem 1rem;
  border: none; overflow-y: auto; background: var(--paper); color: var(--ink);
}
.redact::backdrop { background: rgba(0,0,0,.6); }
.rd-status { font-weight: 700; padding: 2rem 0; text-align: center; }
.rd-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; position: sticky; top: -.8rem; background: var(--paper); padding: .4rem 0; z-index: 2; }
.rd-head h2 { margin: 0; font-size: 1.2rem; }
.rd-close { font: inherit; background: none; border: none; color: var(--red-ink); text-decoration: underline; cursor: pointer; min-height: 2.6rem; }
.rd-hint { margin: .4rem 0 .6rem; font-size: .9rem; color: var(--ink-soft); }
.rd-guide { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s); padding: .5rem .8rem; margin: .3rem 0; font-size: .85rem; }
.rd-guide summary { font-weight: 700; cursor: pointer; min-height: 2rem; }
.rd-guide-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1.2rem; margin-top: .3rem; }
@media (max-width: 600px) { .rd-guide-cols { grid-template-columns: 1fr; } }
.rd-guide ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.rd-keep strong { color: var(--green); }
.rd-cut strong { color: var(--red-ink); }
.rd-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.rd-tool, .rd-btn {
  font: inherit; font-size: .9rem; font-weight: 700; min-height: 2.6rem; padding: .3rem .8rem; cursor: pointer;
  border-radius: var(--radius-s); border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.rd-tool.keep[aria-pressed="true"] { border-color: #1f9d55; background: #1f9d55; color: #fff; }
.rd-tool.mask[aria-pressed="true"] { border-color: #000; background: #000; color: #fff; }
.rd-stage { background: #444; border-radius: var(--radius-s); padding: .4rem; }
.rd-canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; border-radius: 4px; }
.rd-nav { display: flex; gap: .6rem; margin-top: .8rem; position: sticky; bottom: -1rem; background: var(--paper); padding: .5rem 0; }
.rd-nav .btn { flex: 1; }
.rd-review { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .8rem; }
.rd-review figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s); padding: .4rem; }
.rd-review img { width: 100%; display: block; border: 1px solid #ddd; }
.rd-review figcaption { font-size: .8rem; color: var(--ink-soft); margin-top: .3rem; word-break: break-word; }
.rd-checks { border: 2px solid var(--amber-bar); background: var(--amber-bg); border-radius: var(--radius-s); margin: 1rem 0 0; padding: .6rem .9rem; }
.rd-checks legend { font-weight: 700; padding: 0 .3rem; }
.rd-checks label { display: flex; gap: .6rem; align-items: flex-start; margin: .5rem 0; font-weight: 400; cursor: pointer; }
.rd-checks input { width: 1.4rem; height: 1.4rem; flex-shrink: 0; accent-color: var(--green); margin-top: .1rem; }

@media print { .brand { display: none; } }

/* Planowany lek */
.planned { margin-top: 2rem; padding-top: 1.2rem; border-top: 2px solid var(--line); }
.planned-title { font-size: 1.2rem; margin: 0 0 .5rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }

/* Wynik: planowany lek */
.planned-out { margin: 1.5rem 0 2rem; }
.planned-out:focus { outline: none; }
.verdict-bar { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border-radius: var(--radius-l); border: 2px solid; margin: 0 0 .8rem; }
.verdict-icon { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; color: #fff; }
.verdict-text { display: flex; flex-direction: column; gap: .15rem; }
.verdict-text strong { font-size: 1.3rem; line-height: 1.2; }
.verdict-drug { font-size: .95rem; }
.pv-ok { background: #e3f3e6; border-color: #2d7a3e; color: #123d1c; } .pv-ok .verdict-icon { background: #2d7a3e; }
.pv-warn { background: #fff3cf; border-color: #b27a00; color: #3b2a00; } .pv-warn .verdict-icon { background: #8a5d00; }
.pv-bad { background: var(--red-bg); border-color: var(--red-bar); color: #4a0f0a; } .pv-bad .verdict-icon { background: #b3261e; }
.pv-na { background: #ececec; border-color: #6b6b6b; color: #222; } .pv-na .verdict-icon { background: #555; }
.verdict-summary { margin: 0 0 1rem; font-size: 1.05rem; }
.sev-tag, .ap-tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: .1rem .5rem; border-radius: 1rem; margin-left: .3rem; vertical-align: middle; border: 1px solid; }
.psev-high { background: var(--red-bg); color: var(--red-ink); border-color: var(--red-bar); }
.psev-moderate { background: #fff3cf; color: #5c3f00; border-color: #b27a00; }
.psev-low { background: #eef3f2; color: #26413c; border-color: #8aa39e; }
.ap-yes { background: var(--red-bg); color: var(--red-ink); border-color: var(--red-bar); }
.ap-possible { background: #fff3cf; color: #5c3f00; border-color: #b27a00; }
.ap-unknown, .ap-no { background: #eef3f2; color: #26413c; border-color: #8aa39e; }
.fold summary, .fold-block summary { cursor: pointer; font-weight: 700; padding: .4rem 0; min-height: 2.2rem; }
.table-wrap { overflow-x: auto; }
.mon-table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.mon-table th, .mon-table td { text-align: left; vertical-align: top; padding: .5rem .6rem; border-top: 1px solid var(--line); }
.mon-table thead th { border-top: none; border-bottom: 2px solid var(--line); }
@media print {
  .planned-out:not([hidden]) { display: block !important; break-before: auto; }
  .no-print { display: none !important; }
  #result[hidden] { display: none !important; }
  .verdict-bar { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .planned { display: none !important; }
}

/* Decyzja po przeglądzie (planowany lek) */
.planned-decision { margin-top: 1.2rem; padding: 1rem 1.1rem; border: 2px solid var(--line); border-radius: var(--radius-l); background: var(--card); }
.planned-decision h3 { margin-top: 0; }
.pd-options { border: none; padding: 0; margin: 0 0 .8rem; display: grid; gap: .4rem; }
.pd-options label { display: flex; align-items: center; gap: .6rem; min-height: 2.6rem; cursor: pointer; }
.pd-options input { width: 1.3rem; height: 1.3rem; accent-color: var(--green); }

/* QTc — ocena wg stałych progów w kodzie */
.qtc-box { padding: .6rem .9rem; border-radius: var(--radius-s); border-left: 6px solid var(--line); background: var(--paper); margin: 0 0 1rem; }
.qtc-box.qtc-wydluzone { border-left-color: var(--amber-bar); background: var(--amber-bg); }
.qtc-box.qtc-wysokie_ryzyko { border-left-color: var(--red-bar); background: var(--red-bg); color: var(--red-ink); }
.qtc-note { font-size: .85rem; color: var(--ink-soft); font-weight: 400; }

/* Uzupełnienie brakujących danych po przeglądzie */
.supplement { margin: 1.2rem 0; padding: 1rem 1.1rem; border: 2px solid var(--brand-accent); border-radius: var(--radius-l); background: var(--card); }
.supplement h3 { margin-top: 0; }
.sup-items { display: grid; gap: .6rem; margin-bottom: .9rem; }
.sup-row .field-label { font-weight: 400; margin-bottom: .2rem; }
