:root {
  --bg: #f4f5f7; --surface: #ffffff; --text: #1d2330; --muted: #5b6475; --line: #e3e6eb;
  --accent: #0b3b8c; --accent-text: #ffffff; --ok-bg: #e7f5ec; --ok: #1d6b3a;
  --warn-bg: #fff5e0; --warn: #8a5a00; --err-bg: #fdecec; --err: #a12626;
  --radius: 10px; --gap: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151b; --surface: #1b2029; --text: #e7eaf0; --muted: #9aa3b5; --line: #2c3340;
    --accent: #6f9cff; --accent-text: #0b1220; --ok-bg: #173323; --ok: #7fd49f;
    --warn-bg: #3a2d10; --warn: #f0c46a; --err-bg: #3d1a1a; --err: #ff9b9b;
  }
}
:root[data-theme="dark"] {
  --bg: #12151b; --surface: #1b2029; --text: #e7eaf0; --muted: #9aa3b5; --line: #2c3340;
  --accent: #6f9cff; --accent-text: #0b1220; --ok-bg: #173323; --ok: #7fd49f;
  --warn-bg: #3a2d10; --warn: #f0c46a; --err-bg: #3d1a1a; --err: #ff9b9b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
body.panel .wrap { max-width: 1240px; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.brand span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.nav a { text-decoration: none; }
main { padding-top: 24px; padding-bottom: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: var(--gap); }
.card.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
h1 { font-size: 1.6rem; margin: 0 0 12px; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 22px 0 10px; }
.card > h2:first-child { margin-top: 0; }
.lead { color: var(--muted); margin-top: 0; }
.muted, small { color: var(--muted); }
.small { font-size: .88rem; }
.form label { display: block; margin-bottom: 12px; font-weight: 500; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .search input, select {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.inline select { display: inline-block; width: auto; margin: 0 6px 0 0; padding: 6px 8px; }
.form textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); column-gap: 16px; align-items: end; }
.narrow-field { max-width: 360px; }
.consent { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 4px; }
.consent p { margin: 10px 0; }
.check { display: flex !important; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 8px 0 !important;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-weight: 400 !important; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 6px; }
.li { padding-left: 18px; position: relative; }
.li::before { content: "•"; position: absolute; left: 4px; }
.req { color: var(--err); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.btn { display: inline-block; padding: 11px 18px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent);
  color: var(--accent-text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: transparent; color: var(--err); border-color: var(--err); }
.linkbtn { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row-between { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.alert { border-radius: 8px; padding: 12px 16px; margin: 12px 0; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.err { background: var(--err-bg); color: var(--err); }
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 12px 0; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--bg); }
.tile b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: .9rem; }
.tile.warn b { color: var(--warn); }
.tile.bad { border-color: var(--err); } .tile.bad b { color: var(--err); }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
tr.inactive td { opacity: .55; }
tr.sev-warning td:nth-child(2) { color: var(--warn); font-weight: 600; }
tr.sev-critical td { background: var(--err-bg); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .82rem; font-weight: 600; }
.badge.on { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
code { font-family: Consolas, ui-monospace, monospace; font-size: .84em; word-break: break-all; }
.prose p { margin: 8px 0; }
.event { border-left: 3px solid var(--line); padding-left: 12px; margin: 12px 0; }
.quote { border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px; background: var(--bg); }
.center { text-align: center; }
.qr svg { width: min(320px, 80vw); height: auto; background: #fff; padding: 8px; border-radius: 8px; }
.foot { color: var(--muted); font-size: .85rem; padding-bottom: 32px; }
@media (max-width: 560px) { .card { padding: 16px; } h1 { font-size: 1.35rem; } .search { flex-direction: column; } }
@media print { .top, .foot, .nav { display: none; } body { background: #fff; color: #000; } .card { border: none; padding: 0; } }

/* Pulpit: paski, żądania podmiotu danych */
.tile.ok b { color: var(--ok); }
a.tile { color: var(--text); text-decoration: none; }
.barrow { display: grid; grid-template-columns: minmax(120px, 240px) 1fr 3.5em; gap: 10px; align-items: center; margin: 6px 0; }
.barlabel { font-size: .95rem; }
.bar { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.barfill { display: block; height: 100%; background: var(--accent); }
.barfill.ok { background: var(--ok); }
.barnum { text-align: right; font-variant-numeric: tabular-nums; }
.dsr { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.dsr.closed { opacity: .75; }
.dsr.late, tr.late td { border-color: var(--err); background: var(--err-bg); }
.errtext { color: var(--err); }
.dsr-new { margin-top: 14px; }
.dsr-new summary { list-style: none; }
.dsr-new summary::-webkit-details-marker { display: none; }
@media (max-width: 560px) { .barrow { grid-template-columns: 1fr 3em; } .barrow .bar { grid-column: 1 / -1; grid-row: 2; } }

/* Formularz zgody do druku */
.sheet { background: #fff; color: #000; max-width: 190mm; margin: 0 auto 16px; padding: 12mm; border: 1px solid var(--line); font-size: 10.5pt; line-height: 1.4; }
.sheet h2 { font-size: 12pt; margin: 10px 0 4px; }
.sheet p { margin: 4px 0; }
.sheet .li { padding-left: 1em; }
.sheet-head { font-size: 9pt; border-bottom: 1px solid #000; padding-bottom: 4px; }
.sheet-foot { font-size: 8pt; border-top: 1px solid #000; padding-top: 4px; margin-top: 10px; }
.pbox { display: flex; gap: 8px; align-items: flex-start; }
.box { flex: none; width: 4.5mm; height: 4.5mm; border: 1.2px solid #000; margin-top: 1mm; }
.fill { width: 100%; border-collapse: collapse; margin: 10px 0; }
.fill th { width: 32%; text-align: left; font-weight: 400; font-size: 9.5pt; border: 1px solid #000; padding: 4px 6px; }
.fill td { border: 1px solid #000; height: 8mm; }
.fill tr.sig td { height: 16mm; }
@media print {
  .noprint { display: none; }
  .sheet { border: none; padding: 0; max-width: none; margin: 0; }
  .pagebreak { break-before: page; }
  @page { size: A4; margin: 12mm; }
}
