/* MZW RODO — warstwa czytelności (v2.5.41)
   Ładowana PO style.css. Nie zmienia układu ani kolorystyki — podnosi minimalną
   wielkość pisma do 12 px, kontrast tekstu do min. 4,5:1 (WCAG 2.1 AA) i wielkość
   przycisków akcji w tabelach do 32×32 px.
   Dlaczego selektory po atrybucie style: rozmiary i kolory są wpisane w ok. 2000
   miejsc w kodzie JS jako style inline; ta warstwa koryguje je w jednym miejscu.
   Wszystko jest w @media screen — wydruki i generowane dokumenty (tabliczki CCTV,
   raporty, pisma) otwierają się w osobnych oknach i NIE są tym objęte.
   Wycofanie zmian = usunięcie jednej linii <link> z index.html. */

@media screen {

/* ── 1. Minimalna wielkość pisma: 12 px ─────────────────────────────────── */
[style*="font-size:8px"], [style*="font-size:9px"], [style*="font-size:9.5px"],
[style*="font-size:10px"], [style*="font-size:10.5px"], [style*="font-size:11px"],
[style*="font-size:11.5px"],
[style*="font-size: 8px"], [style*="font-size: 9px"], [style*="font-size: 10px"],
[style*="font-size: 11px"], [style*="font-size: 9.5px"], [style*="font-size: 10.5px"],
[style*="font-size: 11.5px"] { font-size: 12px !important; }

/* wyjątki: liczniki w kółkach i skróty klawiszowe mają stałe wymiary */
.mzw-tab-badge[style], kbd[style] { font-size: 11px !important; }

/* klasy z drobnym pismem (lista z pomiaru wszystkich zakładek).
   Prefiks „body” podnosi specyficzność o jeden stopień — część modułów wstrzykuje
   własne <style> później niż ten plik i przy równej specyficzności by wygrywała. */
body .mzw-app-sub, body .mzw-footer, body .mzw-footer span, body .mzw-footer b, body .mzw-footer-right,
body .sb-title, body .sb-group-label, body .sb-item,
body .kpill, body .mzw-content small,
body .dsh-tile-lbl, body .dsh-event-msg, body .dsh-event-ts, body .dsh-shortcut-btn, body .dsh-customize-btn,
body .dsh-tile-panel-hdr, body .dsh-pill, body .dsh-alert-row, body .dsh-db-bar, body .dsh-db-lbl,
body .dsh-alert-btn-warn,
body .cl-item-ref, body .cl-group-prog, body .cl-ver-date,
body .rhm-legend, body .tbl-counter, body .mf-label, body .mf-hint,
body .mzw-user-role, body .mzw-ng-btn, body .mzw-tab, body .mzw-dd-item,
body .tb-action-btn, body .inc-thresh-lbl,
body .ai-input-hint, body .ai-model-info, body .ai-context-badge, body .ai-sidebar-header,
body .air-stat-l { font-size: 12px; }
body .mzw-content table td { font-size: 13px; }
body .mzw-content table th { font-size: 12px; letter-spacing: .03em; }
body .mzw-content table th, body .mzw-content table td { padding-left: 8px; padding-right: 8px; }
body .mzw-content .insp-small td, body .mzw-content .insp-small th { font-size: 12px; }
body .rhm-cell .rhm-sub { font-size: 11px; opacity: 1; }
body .rhm-cell { height: 44px; }

/* ── 2. Przyciski akcji w wierszach tabel: min. 32×32 px ────────────────── */
.mzw-content tbody button {
  min-width: 32px; min-height: 32px;
  font-size: 13px !important;
  padding: 4px 7px !important;
  border-radius: 6px;
}
/* odstęp między przyciskami w jednym wierszu */
.mzw-content tbody td > button + button { margin-left: 2px; }
.mzw-content tbody td { padding-top: 8px; padding-bottom: 8px; }

/* ── 3. Długie komórki: skrót do 3 linii (rozwija kliknięcie) ───────────── */
.table td .clamp3 {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  overflow: hidden; line-height: 1.45;
}
.table td.expanded .clamp3 { display: block; -webkit-line-clamp: unset; overflow: visible; }
.table td .clamp3-more {
  display: inline-block; margin-top: 3px; font-size: 12px; font-weight: 600;
  color: #7a5f10; cursor: pointer;
}
.table td.expanded .clamp3-more { display: none; }
.table td.clamp-multi { white-space: normal !important; max-width: none !important; overflow: visible !important; cursor: pointer; }

/* (Rejestr czynności ma od 2.5.42 własny układ listy z panelem — ui-views.css) */
#rcpTable td { white-space: normal; line-height: 1.45; hyphens: manual; word-break: normal; overflow-wrap: break-word; }

/* ── 4. Pulpit: koniec kafli rozciągniętych na wysokość panelu ───────────── */
.dsh-grid { grid-auto-flow: dense; grid-auto-rows: minmax(72px, auto); }
.dsh-grid > .dsh-tile-panel { grid-row: span 5; }

} /* @media screen */

/* ── 5. Kontrast tekstu — tylko motyw jasny ─────────────────────────────── */
@media screen {
:root:not([data-theme="dark"]) {
  --text3: #5f5a55;            /* było #78716C: 3,86:1 na kremowym tle */
}
/* szary tekst pomocniczy */
:root:not([data-theme="dark"]) [style^="color:#94a3b8" i],
:root:not([data-theme="dark"]) [style*=";color:#94a3b8" i],
:root:not([data-theme="dark"]) [style*=" color:#94a3b8" i],
:root:not([data-theme="dark"]) [style*=";color: #94a3b8" i] { color: #525d6e !important; }
:root:not([data-theme="dark"]) [style^="color:#64748b" i],
:root:not([data-theme="dark"]) [style*=";color:#64748b" i],
:root:not([data-theme="dark"]) [style*=" color:#64748b" i],
:root:not([data-theme="dark"]) [style*=";color: #64748b" i] { color: #4b5563 !important; }
:root:not([data-theme="dark"]) [style^="color:#a8a29e" i],
:root:not([data-theme="dark"]) [style*=";color:#a8a29e" i],
:root:not([data-theme="dark"]) [style*=" color:#a8a29e" i] { color: #5f5a55 !important; }
/* kolory statusów (tekst na białym lub na własnym jasnym odcieniu) */
:root:not([data-theme="dark"]) [style^="color:#16a34a" i],
:root:not([data-theme="dark"]) [style*=";color:#16a34a" i],
:root:not([data-theme="dark"]) [style*=" color:#16a34a" i] { color: #166534 !important; }
:root:not([data-theme="dark"]) [style^="color:#dc2626" i],
:root:not([data-theme="dark"]) [style*=";color:#dc2626" i],
:root:not([data-theme="dark"]) [style*=" color:#dc2626" i] { color: #991b1b !important; }
:root:not([data-theme="dark"]) [style^="color:#d97706" i],
:root:not([data-theme="dark"]) [style*=";color:#d97706" i],
:root:not([data-theme="dark"]) [style*=" color:#d97706" i],
:root:not([data-theme="dark"]) [style^="color:#f59e0b" i],
:root:not([data-theme="dark"]) [style*=";color:#f59e0b" i],
:root:not([data-theme="dark"]) [style*=" color:#f59e0b" i] { color: #92400e !important; }
:root:not([data-theme="dark"]) [style^="color:#6366f1" i],
:root:not([data-theme="dark"]) [style*=";color:#6366f1" i],
:root:not([data-theme="dark"]) [style*=" color:#6366f1" i] { color: #4338ca !important; }
:root:not([data-theme="dark"]) [style^="color:#0891b2" i],
:root:not([data-theme="dark"]) [style*=";color:#0891b2" i],
:root:not([data-theme="dark"]) [style*=" color:#0891b2" i] { color: #155e75 !important; }
:root:not([data-theme="dark"]) [style^="color:#7c3aed" i],
:root:not([data-theme="dark"]) [style*=";color:#7c3aed" i],
:root:not([data-theme="dark"]) [style*=" color:#7c3aed" i] { color: #6d28d9 !important; }

:root:not([data-theme="dark"]) [style^="color:#6b7280" i],
:root:not([data-theme="dark"]) [style*=";color:#6b7280" i],
:root:not([data-theme="dark"]) [style*=" color:#6b7280" i] { color: #4b5563 !important; }
:root:not([data-theme="dark"]) [style^="color:#ca8a04" i],
:root:not([data-theme="dark"]) [style*=";color:#ca8a04" i],
:root:not([data-theme="dark"]) [style*=" color:#ca8a04" i] { color: #854d0e !important; }

/* klasy */
:root:not([data-theme="dark"]) body .ai-context-badge { color: #166534; }
:root:not([data-theme="dark"]) body .instr-nav-btn.active { color: #0D1B2A; }
/* mapa ryzyka: biały tekst na jasnoczerwonym polu (2,77:1) */
body .rhm-8 { color: #450a0a; }
body .rhm-9 { background: #dc2626; }
/* przycisk „Resetuj”: granatowy tekst na ciemnoczerwonym tle (1,87:1) → obrys */
body button.secondary.danger { background: transparent; color: #8B1A1A; border-color: #8B1A1A; }
body button.secondary.danger:hover { background: #8B1A1A; color: #fff; }
:root:not([data-theme="dark"]) .tbl-counter,
:root:not([data-theme="dark"]) td.xr-empty,
:root:not([data-theme="dark"]) .xr-detail-inner.xr-detail-empty { color: #525d6e; }
:root:not([data-theme="dark"]) .dsh-tile-warn .dsh-tile-val { color: #92400e; }
:root:not([data-theme="dark"]) .dsh-tile-ok .dsh-tile-val { color: #166534; }
:root:not([data-theme="dark"]) .dsh-tile-danger .dsh-tile-val { color: #991b1b; }

/* biały tekst na złotym tle (2,82:1) → granatowy na złotym (6,2:1) */
:root:not([data-theme="dark"]) .auth-sf-btn.active,
:root:not([data-theme="dark"]) [style*="background:#B8962A" i][style*="color:#fff" i],
:root:not([data-theme="dark"]) [style*="background:var(--gold)"][style*="color:#fff" i] { color: #0D1B2A !important; }
:root:not([data-theme="dark"]) a[style*="color:var(--gold)"] { color: #7a5f10 !important; }
}

/* ── 6. Nagłówek, panel boczny, stopka (ciemne tło w obu motywach) ───────── */
@media screen {
.sb-group-label { color: rgba(255,255,255,.66); }
.mzw-app-sub { color: rgba(255,255,255,.72); }
.mzw-footer, .mzw-footer span, .mzw-footer-right { color: rgba(255,255,255,.72); }
#appHeader [style*="color:rgba(255,255,255,.45)"],
#appHeader [style*="color:rgba(255,255,255,.4)"],
#appHeader [style*="color:rgba(255,255,255,.35)"] { color: rgba(255,255,255,.75) !important; }
}

/* ── 7. Motyw ciemny: kontrast tekstu ────────────────────────────────────
   Kolory wpisane inline były dobrane pod jasne tło. W motywie ciemnym szary i
   kolory statusów są rozjaśniane, a jasne panele (np. #fef2f2) zamieniane na
   półprzezroczyste odcienie — inaczej jasny tekst lądował na jasnym tle. */
@media screen {
[data-theme="dark"] { --text3: #a89f94; }
[data-theme="dark"] [style^="color:#64748b" i],
[data-theme="dark"] [style*=";color:#64748b" i],
[data-theme="dark"] [style*=" color:#64748b" i],
[data-theme="dark"] [style^="color:#6b7280" i],
[data-theme="dark"] [style*=";color:#6b7280" i],
[data-theme="dark"] [style*=" color:#6b7280" i],
[data-theme="dark"] [style^="color:#475569" i],
[data-theme="dark"] [style*=";color:#475569" i],
[data-theme="dark"] [style*=" color:#475569" i],
[data-theme="dark"] [style^="color:#57534e" i],
[data-theme="dark"] [style*=";color:#57534e" i],
[data-theme="dark"] [style*=" color:#57534e" i],
[data-theme="dark"] [style^="color:#78716c" i],
[data-theme="dark"] [style*=";color:#78716c" i],
[data-theme="dark"] [style*=" color:#78716c" i],
[data-theme="dark"] [style^="color:#5f5a55" i],
[data-theme="dark"] [style*=";color:#5f5a55" i],
[data-theme="dark"] [style*=" color:#5f5a55" i],
[data-theme="dark"] [style^="color:#a8a29e" i],
[data-theme="dark"] [style*=";color:#a8a29e" i],
[data-theme="dark"] [style*=" color:#a8a29e" i] { color: #a3b1c2 !important; }
[data-theme="dark"] [style^="color:#374151" i],
[data-theme="dark"] [style*=";color:#374151" i],
[data-theme="dark"] [style*=" color:#374151" i],
[data-theme="dark"] [style^="color:#334155" i],
[data-theme="dark"] [style*=";color:#334155" i],
[data-theme="dark"] [style*=" color:#334155" i],
[data-theme="dark"] [style^="color:#1e293b" i],
[data-theme="dark"] [style*=";color:#1e293b" i],
[data-theme="dark"] [style*=" color:#1e293b" i],
[data-theme="dark"] [style^="color:#1f2937" i],
[data-theme="dark"] [style*=";color:#1f2937" i],
[data-theme="dark"] [style*=" color:#1f2937" i],
[data-theme="dark"] [style^="color:#0f172a" i],
[data-theme="dark"] [style*=";color:#0f172a" i],
[data-theme="dark"] [style*=" color:#0f172a" i],
[data-theme="dark"] [style^="color:#111827" i],
[data-theme="dark"] [style*=";color:#111827" i],
[data-theme="dark"] [style*=" color:#111827" i],
[data-theme="dark"] [style^="color:#1c1917" i],
[data-theme="dark"] [style*=";color:#1c1917" i],
[data-theme="dark"] [style*=" color:#1c1917" i],
[data-theme="dark"] [style^="color:#44403c" i],
[data-theme="dark"] [style*=";color:#44403c" i],
[data-theme="dark"] [style*=" color:#44403c" i],
[data-theme="dark"] [style^="color:#0D1B2A" i],
[data-theme="dark"] [style*=";color:#0D1B2A" i],
[data-theme="dark"] [style*=" color:#0D1B2A" i],
[data-theme="dark"] [style^="color:#1a2f4a" i],
[data-theme="dark"] [style*=";color:#1a2f4a" i],
[data-theme="dark"] [style*=" color:#1a2f4a" i],
[data-theme="dark"] [style^="color:var(--navy)" i],
[data-theme="dark"] [style*=";color:var(--navy)" i],
[data-theme="dark"] [style*=" color:var(--navy)" i] { color: #e2e8f0 !important; }
[data-theme="dark"] [style^="color:#16a34a" i],
[data-theme="dark"] [style*=";color:#16a34a" i],
[data-theme="dark"] [style*=" color:#16a34a" i],
[data-theme="dark"] [style^="color:#15803d" i],
[data-theme="dark"] [style*=";color:#15803d" i],
[data-theme="dark"] [style*=" color:#15803d" i],
[data-theme="dark"] [style^="color:#166534" i],
[data-theme="dark"] [style*=";color:#166534" i],
[data-theme="dark"] [style*=" color:#166534" i],
[data-theme="dark"] [style^="color:#059669" i],
[data-theme="dark"] [style*=";color:#059669" i],
[data-theme="dark"] [style*=" color:#059669" i],
[data-theme="dark"] [style^="color:#065f46" i],
[data-theme="dark"] [style*=";color:#065f46" i],
[data-theme="dark"] [style*=" color:#065f46" i] { color: #4ade80 !important; }
[data-theme="dark"] [style^="color:#dc2626" i],
[data-theme="dark"] [style*=";color:#dc2626" i],
[data-theme="dark"] [style*=" color:#dc2626" i],
[data-theme="dark"] [style^="color:#b91c1c" i],
[data-theme="dark"] [style*=";color:#b91c1c" i],
[data-theme="dark"] [style*=" color:#b91c1c" i],
[data-theme="dark"] [style^="color:#991b1b" i],
[data-theme="dark"] [style*=";color:#991b1b" i],
[data-theme="dark"] [style*=" color:#991b1b" i],
[data-theme="dark"] [style^="color:#8B1A1A" i],
[data-theme="dark"] [style*=";color:#8B1A1A" i],
[data-theme="dark"] [style*=" color:#8B1A1A" i],
[data-theme="dark"] [style^="color:#7f1d1d" i],
[data-theme="dark"] [style*=";color:#7f1d1d" i],
[data-theme="dark"] [style*=" color:#7f1d1d" i] { color: #fca5a5 !important; }
[data-theme="dark"] [style^="color:#d97706" i],
[data-theme="dark"] [style*=";color:#d97706" i],
[data-theme="dark"] [style*=" color:#d97706" i],
[data-theme="dark"] [style^="color:#f59e0b" i],
[data-theme="dark"] [style*=";color:#f59e0b" i],
[data-theme="dark"] [style*=" color:#f59e0b" i],
[data-theme="dark"] [style^="color:#b45309" i],
[data-theme="dark"] [style*=";color:#b45309" i],
[data-theme="dark"] [style*=" color:#b45309" i],
[data-theme="dark"] [style^="color:#92400e" i],
[data-theme="dark"] [style*=";color:#92400e" i],
[data-theme="dark"] [style*=" color:#92400e" i],
[data-theme="dark"] [style^="color:#78350f" i],
[data-theme="dark"] [style*=";color:#78350f" i],
[data-theme="dark"] [style*=" color:#78350f" i],
[data-theme="dark"] [style^="color:#ca8a04" i],
[data-theme="dark"] [style*=";color:#ca8a04" i],
[data-theme="dark"] [style*=" color:#ca8a04" i],
[data-theme="dark"] [style^="color:#854d0e" i],
[data-theme="dark"] [style*=";color:#854d0e" i],
[data-theme="dark"] [style*=" color:#854d0e" i] { color: #fbbf24 !important; }
[data-theme="dark"] [style^="color:#6366f1" i],
[data-theme="dark"] [style*=";color:#6366f1" i],
[data-theme="dark"] [style*=" color:#6366f1" i],
[data-theme="dark"] [style^="color:#4338ca" i],
[data-theme="dark"] [style*=";color:#4338ca" i],
[data-theme="dark"] [style*=" color:#4338ca" i],
[data-theme="dark"] [style^="color:#4f46e5" i],
[data-theme="dark"] [style*=";color:#4f46e5" i],
[data-theme="dark"] [style*=" color:#4f46e5" i] { color: #a5b4fc !important; }
[data-theme="dark"] [style^="color:#7c3aed" i],
[data-theme="dark"] [style*=";color:#7c3aed" i],
[data-theme="dark"] [style*=" color:#7c3aed" i],
[data-theme="dark"] [style^="color:#6d28d9" i],
[data-theme="dark"] [style*=";color:#6d28d9" i],
[data-theme="dark"] [style*=" color:#6d28d9" i] { color: #c4b5fd !important; }
[data-theme="dark"] [style^="color:#0891b2" i],
[data-theme="dark"] [style*=";color:#0891b2" i],
[data-theme="dark"] [style*=" color:#0891b2" i],
[data-theme="dark"] [style^="color:#0e7490" i],
[data-theme="dark"] [style*=";color:#0e7490" i],
[data-theme="dark"] [style*=" color:#0e7490" i],
[data-theme="dark"] [style^="color:#155e75" i],
[data-theme="dark"] [style*=";color:#155e75" i],
[data-theme="dark"] [style*=" color:#155e75" i] { color: #67e8f9 !important; }
[data-theme="dark"] [style^="color:#1d4ed8" i],
[data-theme="dark"] [style*=";color:#1d4ed8" i],
[data-theme="dark"] [style*=" color:#1d4ed8" i],
[data-theme="dark"] [style^="color:#1e40af" i],
[data-theme="dark"] [style*=";color:#1e40af" i],
[data-theme="dark"] [style*=" color:#1e40af" i],
[data-theme="dark"] [style^="color:#2563eb" i],
[data-theme="dark"] [style*=";color:#2563eb" i],
[data-theme="dark"] [style*=" color:#2563eb" i],
[data-theme="dark"] [style^="color:#1e3a8a" i],
[data-theme="dark"] [style*=";color:#1e3a8a" i],
[data-theme="dark"] [style*=" color:#1e3a8a" i] { color: #93c5fd !important; }
/* jasne panele inline → odcienie na ciemnym tle (kolejność ma znaczenie: #fff jest prefiksem #fff7ed itd.) */
[data-theme="dark"] .mzw-content [style*="background:#fff" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fff" i],
[data-theme="dark"] .mzw-content [style*="background: #fff" i],
[data-theme="dark"] .mzw-content [style*="background:#f8fafc" i],
[data-theme="dark"] .mzw-content [style*="background-color:#f8fafc" i],
[data-theme="dark"] .mzw-content [style*="background: #f8fafc" i],
[data-theme="dark"] .mzw-content [style*="background:#f1f5f9" i],
[data-theme="dark"] .mzw-content [style*="background-color:#f1f5f9" i],
[data-theme="dark"] .mzw-content [style*="background: #f1f5f9" i],
[data-theme="dark"] .mzw-content [style*="background:#e2e8f0" i],
[data-theme="dark"] .mzw-content [style*="background-color:#e2e8f0" i],
[data-theme="dark"] .mzw-content [style*="background: #e2e8f0" i],
[data-theme="dark"] .mzw-content [style*="background:#f5f0e8" i],
[data-theme="dark"] .mzw-content [style*="background-color:#f5f0e8" i],
[data-theme="dark"] .mzw-content [style*="background: #f5f0e8" i],
[data-theme="dark"] .mzw-content [style*="background:#fafafa" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fafafa" i],
[data-theme="dark"] .mzw-content [style*="background: #fafafa" i],
[data-theme="dark"] .mzw-content [style*="background:#f5f5f5" i],
[data-theme="dark"] .mzw-content [style*="background-color:#f5f5f5" i],
[data-theme="dark"] .mzw-content [style*="background: #f5f5f5" i],
[data-theme="dark"] .mzw-content [style*="background:#f9fafb" i],
[data-theme="dark"] .mzw-content [style*="background-color:#f9fafb" i],
[data-theme="dark"] .mzw-content [style*="background: #f9fafb" i],
[data-theme="dark"] .mzw-content [style*="background:#f3f4f6" i],
[data-theme="dark"] .mzw-content [style*="background-color:#f3f4f6" i],
[data-theme="dark"] .mzw-content [style*="background: #f3f4f6" i],
[data-theme="dark"] .mzw-content [style*="background:white" i],
[data-theme="dark"] .mzw-content [style*="background-color:white" i],
[data-theme="dark"] .mzw-content [style*="background: white" i] { background: var(--surface2) !important; }
[data-theme="dark"] .mzw-content [style*="background:#fef2f2" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fef2f2" i],
[data-theme="dark"] .mzw-content [style*="background: #fef2f2" i],
[data-theme="dark"] .mzw-content [style*="background:#fee2e2" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fee2e2" i],
[data-theme="dark"] .mzw-content [style*="background: #fee2e2" i],
[data-theme="dark"] .mzw-content [style*="background:#fff5f5" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fff5f5" i],
[data-theme="dark"] .mzw-content [style*="background: #fff5f5" i],
[data-theme="dark"] .mzw-content [style*="background:#fecaca" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fecaca" i],
[data-theme="dark"] .mzw-content [style*="background: #fecaca" i] { background: rgba(239,68,68,.16) !important; }
[data-theme="dark"] .mzw-content [style*="background:#fffbeb" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fffbeb" i],
[data-theme="dark"] .mzw-content [style*="background: #fffbeb" i],
[data-theme="dark"] .mzw-content [style*="background:#fef3c7" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fef3c7" i],
[data-theme="dark"] .mzw-content [style*="background: #fef3c7" i],
[data-theme="dark"] .mzw-content [style*="background:#fef9c3" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fef9c3" i],
[data-theme="dark"] .mzw-content [style*="background: #fef9c3" i],
[data-theme="dark"] .mzw-content [style*="background:#fff7ed" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fff7ed" i],
[data-theme="dark"] .mzw-content [style*="background: #fff7ed" i],
[data-theme="dark"] .mzw-content [style*="background:#fff3cd" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fff3cd" i],
[data-theme="dark"] .mzw-content [style*="background: #fff3cd" i],
[data-theme="dark"] .mzw-content [style*="background:#fffbf0" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fffbf0" i],
[data-theme="dark"] .mzw-content [style*="background: #fffbf0" i],
[data-theme="dark"] .mzw-content [style*="background:#fed7aa" i],
[data-theme="dark"] .mzw-content [style*="background-color:#fed7aa" i],
[data-theme="dark"] .mzw-content [style*="background: #fed7aa" i] { background: rgba(245,158,11,.16) !important; }
[data-theme="dark"] .mzw-content [style*="background:#f0fdf4" i],
[data-theme="dark"] .mzw-content [style*="background-color:#f0fdf4" i],
[data-theme="dark"] .mzw-content [style*="background: #f0fdf4" i],
[data-theme="dark"] .mzw-content [style*="background:#dcfce7" i],
[data-theme="dark"] .mzw-content [style*="background-color:#dcfce7" i],
[data-theme="dark"] .mzw-content [style*="background: #dcfce7" i],
[data-theme="dark"] .mzw-content [style*="background:#d1fae5" i],
[data-theme="dark"] .mzw-content [style*="background-color:#d1fae5" i],
[data-theme="dark"] .mzw-content [style*="background: #d1fae5" i] { background: rgba(34,197,94,.15) !important; }
[data-theme="dark"] .mzw-content [style*="background:#eff6ff" i],
[data-theme="dark"] .mzw-content [style*="background-color:#eff6ff" i],
[data-theme="dark"] .mzw-content [style*="background: #eff6ff" i],
[data-theme="dark"] .mzw-content [style*="background:#dbeafe" i],
[data-theme="dark"] .mzw-content [style*="background-color:#dbeafe" i],
[data-theme="dark"] .mzw-content [style*="background: #dbeafe" i],
[data-theme="dark"] .mzw-content [style*="background:#f0f9ff" i],
[data-theme="dark"] .mzw-content [style*="background-color:#f0f9ff" i],
[data-theme="dark"] .mzw-content [style*="background: #f0f9ff" i],
[data-theme="dark"] .mzw-content [style*="background:#eef2ff" i],
[data-theme="dark"] .mzw-content [style*="background-color:#eef2ff" i],
[data-theme="dark"] .mzw-content [style*="background: #eef2ff" i],
[data-theme="dark"] .mzw-content [style*="background:#ede9fe" i],
[data-theme="dark"] .mzw-content [style*="background-color:#ede9fe" i],
[data-theme="dark"] .mzw-content [style*="background: #ede9fe" i] { background: rgba(59,130,246,.18) !important; }
[data-theme="dark"] button.secondary { color: #e2e8f0; border-color: #64748b; }
[data-theme="dark"] body button.secondary.danger { color: #fca5a5; border-color: #fca5a5; }
[data-theme="dark"] .mf-btn.mf-btn-secondary { color: #cbd5e1; border-color: #64748b; }
[data-theme="dark"] .table td .clamp3-more { color: #e3c466; }
[data-theme="dark"] .kpill.k-high { background: #b91c1c; color: #fff; }
[data-theme="dark"] .dsh-alert-btn-warn { color: #fbbf24; }
}

/* ── 8. Tekst na złotym tle: zawsze granatowy (6,2:1), w obu motywach ───── */
@media screen {
html [style*="background:#b8962a" i], html [style*="background:var(--gold)"],
html [style*="background:var(--primary"],
html [style*="background:#b8962a" i][style*="color"], html [style*="background:var(--gold)"][style*="color"],
html [style*="background:var(--primary"][style*="color"],
html body .instr-nav-btn.active { color: #0D1B2A !important; }

/* motyw ciemny — uzupełnienia z pomiaru */
[data-theme="dark"] .mf-btn.mf-btn-secondary { color: #cbd5e1 !important; border-color: #64748b !important; }
[data-theme="dark"] .mf-btn.mf-btn-secondary:hover { background: var(--surface2) !important; color: #fff !important; }
[data-theme="dark"] [style^="color:#1a1a1a" i], [data-theme="dark"] [style*=";color:#1a1a1a" i],
[data-theme="dark"] [style*=" color:#1a1a1a" i] { color: #e2e8f0 !important; }
[data-theme="dark"] [style^="color:#14532d" i], [data-theme="dark"] [style*=";color:#14532d" i],
[data-theme="dark"] [style*=" color:#14532d" i] { color: #4ade80 !important; }
[data-theme="dark"] .mzw-content .insp-score { background: var(--surface2) !important; }
[data-theme="dark"] .mzw-content .insp-table th { background: var(--surface2); color: #e2e8f0; }
[data-theme="dark"] .kpill.k-med { color: #1c1917; }
[data-theme="dark"] body .ai-welcome-title, [data-theme="dark"] body .rn-title-h { color: #e2e8f0; }
[data-theme="dark"] body .ai-action-label { color: inherit; }
}

/* ── 9. Formularze w oknach modalnych ───────────────────────────────────── */
@media screen {
/* tytuł okna był granatowy na granatowym nagłówku (niewidoczny) */
.modal-content .mf-header .mf-title { color: #fff; }
[data-theme="dark"] .modal-content .mf-header .mf-title { color: #fff !important; }
.modal-content .mf-header .mf-subtitle { color: rgba(255,255,255,.8); }
/* etykiety pól: stara reguła „#modalBody label {flex-direction:column}” centrowała je
   i zrzucała gwiazdkę wymagalności do nowej linii */
#modalBody label.mf-label { flex-direction: row; justify-content: flex-start; align-items: center; }
body .mf-section-title, body .mf-hint, body .modal-content small { font-size: 12px; }
:root:not([data-theme="dark"]) body .mf-hint { color: #525d6e; }
:root:not([data-theme="dark"]) body .rcp-wz-lbl { color: #7a5f10; }
[data-theme="dark"] body .mf-label, [data-theme="dark"] #modalBody label, [data-theme="dark"] #modalBody .mf-label { color: #cbd5e1 !important; }
[data-theme="dark"] span.pill { color: #cbd5e1 !important; }
[data-theme="dark"] body .mf-btn.mf-btn-danger { background: rgba(239,68,68,.16) !important; color: #fca5a5 !important; }
}

/* motyw ciemny: wpisywany tekst w polach formularzy był granatowy na granatowym (1,2:1) */
@media screen {
[data-theme="dark"] #modalBody input, [data-theme="dark"] #modalBody select,
[data-theme="dark"] #modalBody textarea, [data-theme="dark"] .modal-content input,
[data-theme="dark"] .modal-content select, [data-theme="dark"] .modal-content textarea { color: #f5f0e8 !important; }
/* istniejąca reguła ustawia tu var(--cream2), które w motywie ciemnym jest ciemnogranatowe;
   potrzebna wyższa specyficzność niż (1,5,1) */
html[data-theme="dark"] body #modalBody input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(.pin-input):not([hidden]),
html[data-theme="dark"] body #modalBody textarea, html[data-theme="dark"] body #modalBody select { color: #f5f0e8 !important; -webkit-text-fill-color: #f5f0e8; }
[data-theme="dark"] #modalBody ::placeholder, [data-theme="dark"] .modal-content ::placeholder { color: #94a3b8 !important; opacity: 1; }
[data-theme="dark"] #modalBody select option, [data-theme="dark"] .modal-content select option { background: #162436; color: #f5f0e8; }
}

/* ── 10. Telefon (≤768 px) ──────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
  body .mbn-lbl { font-size: 11px; color: rgba(255,255,255,.78); }
  html body .kpill { font-size: 12px !important; }
  body .dsh-tile-lbl { font-size: 12px; }

  /* tabele rejestrów jako karty (komórki opisuje app-ui-refresh.js) */
  .mzw-content .hscroll.m-cards-wrap { overflow: visible !important; }
  .mzw-content table.m-cards {
    display: block; min-width: 0 !important; width: 100% !important;
    table-layout: auto !important; border: 0 !important; background: transparent !important; box-shadow: none !important;
  }
  .mzw-content table.m-cards thead { display: none !important; }
  .mzw-content table.m-cards tbody { display: block; }
  .mzw-content table.m-cards tbody tr {
    display: block; background: var(--surface, #fff); border: 1px solid var(--border, #e7e5e4);
    border-radius: 10px; padding: 10px 12px; margin: 0 0 10px;
  }
  .mzw-content table.m-cards tbody td {
    display: block; width: auto !important; min-width: 0 !important; max-width: none !important;
    position: static !important; border: 0 !important; padding: 3px 0 !important;
    white-space: normal !important; background: transparent !important;
    font-size: 14px !important; text-align: left !important; overflow: visible !important;
  }
  .mzw-content table.m-cards tbody td.m-first { font-weight: 600; font-size: 15px !important; padding-bottom: 6px !important; }
  .mzw-content table.m-cards tbody td.m-blank { display: none; }
  /* podpis kolumny po lewej (40%), wartość po prawej; komórka może mieć wiele węzłów,
     dlatego podpis jest pozycjonowany absolutnie, a nie siatką */
  .mzw-content table.m-cards tbody td[data-l] {
    position: relative !important; padding-left: calc(40% + 10px) !important; min-height: 24px;
  }
  .mzw-content table.m-cards tbody td[data-l].m-long { min-height: 40px; }
  .mzw-content table.m-cards tbody td[data-l]::before {
    content: attr(data-l); position: absolute; left: 0; top: 4px; width: 40%;
    font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    color: var(--text3, #5f5a55); line-height: 1.35; white-space: normal; overflow-wrap: break-word; hyphens: none;
  }
  /* długie opisy: podpis nad treścią */
  .mzw-content table.m-cards tbody td.clamp-multi[data-l] { padding-left: 0 !important; }
  .mzw-content table.m-cards tbody td.clamp-multi[data-l]::before { position: static; display: block; width: auto; margin-bottom: 2px; }
  .mzw-content table.m-cards tbody td.m-actions {
    display: flex !important; flex-wrap: wrap; gap: 8px; padding-top: 8px !important; margin-top: 4px;
    border-top: 1px solid var(--border, #e7e5e4) !important;
  }
  .mzw-content table.m-cards tbody td.m-actions button {
    min-width: 44px !important; min-height: 44px !important; width: auto !important; margin: 0 !important;
    font-size: 14px !important; padding: 8px 12px !important; white-space: nowrap;
  }
  /* rozwijane szczegóły wiersza i wiersz „brak danych” */
  .mzw-content table.m-cards tbody tr.xr-detail-row { display: none; }
  .mzw-content table.m-cards tbody tr.xr-detail-row.xr-visible {
    display: block; margin-top: -11px; border-top: 0; border-radius: 0 0 10px 10px; background: var(--cream, #f5f0e8);
  }
  .mzw-content table.m-cards tbody tr.m-note { border-style: dashed; text-align: center; }
  .mzw-content table.m-cards tbody tr.m-note td { text-align: center !important; }

}

/* telefon: terminarz („Panel terminów”) i Asystent IOD — elementy nachodziły na siebie */
@media screen and (max-width: 768px) {
  .cal-ev { flex-wrap: wrap; row-gap: 6px !important; }
  .cal-ev .cal-ev-main { flex: 1 1 calc(100% - 44px) !important; }
  .cal-ev .cal-ev-main > div { white-space: normal !important; }
  .cal-ev .cal-ev-when { flex: 1 1 auto !important; text-align: left !important; padding-left: 32px; }
  .cal-ev > button { min-height: 44px; padding: 8px 14px !important; font-size: 14px !important; margin-left: auto; }

  body .ai-wrap { flex-direction: column; height: auto; min-height: 0; }
  body .ai-sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--border, #e2e8f0); }
  body .ai-actions { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 4px 8px 10px; -webkit-overflow-scrolling: touch; }
  body .ai-action-btn { width: auto; flex: 0 0 auto; white-space: nowrap; min-height: 44px; border-color: var(--border, #e2e8f0); background: var(--white, #fff); }
  body .ai-sidebar-footer { padding: 8px 16px; }
  body .ai-main { min-height: 62vh; }
}

@media screen and (max-width: 768px) {
  html body .dsh-tile-lbl, html body .dsh-pill { font-size: 12px !important; }
}
/* wydruk: odnośnik „pokaż całość” nie trafia na papier, komórki drukują się w całości */
@media print { .clamp3-more { display: none !important; } }

/* telefon: kafle pulpitu nie mogą rozpychać siatki poza ekran (większe pismo podpisów) */
@media screen and (max-width: 768px) {
  .dsh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .dsh-grid > .dsh-tile { min-width: 0; }
  body .dsh-tile-lbl { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
}

/* telefon: wykresy trendów i przyciski działów instrukcji wychodziły poza ekran */
@media screen and (max-width: 768px) {
  body .dtrend-grid { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; gap: 10px !important; }
  body .dtrend-card { min-width: 0 !important; width: auto !important; }
  body .instr-nav-btn { max-width: 100%; white-space: normal; text-align: left; }
}
