.login-logo { max-width: 220px; max-height: 60px; margin-bottom: 20px; }
.admin-logo { max-width: 200px; max-height: 50px; display: block; margin-bottom: 16px; }
.topbar-logo { height: 24px; margin-right: 12px; filter: brightness(0) invert(1); }

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1f2430;
}

/* ---- Logowanie ---- */
.login-body {
    background: var(--brand-login-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.login-box h1 { margin-bottom: 6px; color: var(--brand-dark); }
.subtitle { color: #6b7280; font-size: 13px; margin-bottom: 20px; }
.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%; padding: 12px; font-size: 16px; text-align: center;
    border: 1px solid #c9ccd1; border-radius: 8px; margin-bottom: 14px;
    letter-spacing: 1px;
}
/* Szary napis-podpowiedz (placeholder) znika juz przy KLIKNIECIU w pole,
   nie dopiero przy pierwszym wpisanym znaku - kliknales, to wiadomo, ze
   zaraz piszesz, podpowiedz tylko przeszkadza. */
.login-box input:focus::placeholder { color: transparent; }
.login-box input:focus { border-color: var(--brand-color); outline: none; }
.login-box button, .admin-body button {
    width: 100%; padding: 12px; font-size: 15px; font-weight: 600;
    background: var(--brand-fill, var(--brand-color)); color: var(--brand-fill-text, #fff); border: none; border-radius: 8px;
    cursor: pointer;
}
.login-box button:hover { background: color-mix(in srgb, var(--brand-fill, var(--brand-color)) 86%, black); }
.error { color: #c0392b; font-size: 13px; margin-bottom: 10px; }

/* ---- Admin ---- */
.admin-body { background: #eef1f5; }
/* Szerszy kontener niz kiedys (1080px) - wieksze okna edycji (wnioski AI,
   formularze) na typowych monitorach; na weszych ekranach i tak zwija sie
   do szerokosci okna. */
.admin-wrap { max-width: 1320px; margin: 24px auto 40px; padding: 0 20px; }

/* Wspolny naglowek panelu (patrz templates/_admin_header.html): logo +
   tytul po lewej, zakladki po prawej, wszystko w jednej bialej "karcie". */
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px 24px; flex-wrap: wrap;
    background: white; border: 1px solid #e2e4e8; border-radius: 12px;
    padding: 12px 20px; margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}
.admin-header-brand { display: flex; align-items: center; gap: 14px; }
.admin-header-brand .admin-logo { margin-bottom: 0; max-height: 34px; }
/* logo SVG bez wlasnego rozmiaru (patrz admin._logo_unsized) - stala wysokosc, zeby tytul nie wchodzil pod menu */
.admin-header-brand .admin-logo-fit { height: 34px; width: auto; flex-shrink: 0; }
.admin-header-title {
    font-size: 13px; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: 0.05em;
    border-left: 1px solid #e2e4e8; padding-left: 14px; white-space: nowrap;
}

.card {
    background: white; border: 1px solid #e2e4e8; border-radius: 12px;
    padding: 24px; margin-bottom: 16px; font-size: 14px; line-height: 1.45;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}
.card h2 {
    font-size: 16px; font-weight: 600; line-height: 1.3; margin: 0 0 12px; color: var(--brand-dark);
    padding-bottom: 0; border-bottom: 0;
}
.card form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card input[type="text"], .card select {
    padding: 8px; border: 1px solid #c9ccd1; border-radius: 6px; font-size: 14px;
}
.card button {
    padding: 8px 14px; background: var(--btn-primary-bg, var(--brand-fill)); color: var(--btn-primary-fg, #fff); border: none;
    border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.card button:disabled { opacity: 0.4; cursor: not-allowed; }
.card textarea {
    padding: 8px; border: 1px solid #c9ccd1; border-radius: 6px; font-size: 14px;
    font-family: inherit; resize: vertical; width: 100%;
}
.ai-analysis-form { flex-direction: column; align-items: stretch; }
.conclusions-include {
    display: flex; align-items: center; gap: 8px; font-size: 13px;
    color: #495057; font-weight: 600; margin: 4px 0 8px;
}
.conclusions-include input { width: auto; }
.ai-analysis-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #495057; }

/* ---- Nawigacja panelu admina (zakladki-pigulki w naglowku) ---- */
.admin-nav { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.admin-nav a {
    padding: 8px 14px; text-decoration: none; color: #556070; font-size: 13.5px;
    font-weight: 600; border-radius: 8px;
}
.admin-nav a.active { color: white; background: var(--brand-dark); }
.admin-nav a:hover:not(.active) { color: var(--brand-dark); background: #eef1f5; }
/* Wyloguj odsuwamy na prawy skraj paska - to akcja innej kategorii niz
   nawigacja miedzy sekcjami, wiec nie powinno stac w jednym ciagu z nimi. */
.admin-nav-logout { margin-left: 14px; }
.admin-nav-logout:hover { color: #c0392b !important; background: #fdecea !important; }

/* ---- Podmenu (np. instrukcja: Mozaika / QGIS) ---- */
.sub-nav { display: flex; gap: 8px; margin-bottom: 20px; }
.sub-nav a {
    padding: 6px 14px; text-decoration: none; color: #495057; font-size: 13px;
    font-weight: 600; background: #eef0f3; border-radius: 20px;
}
.sub-nav a.active { background: var(--brand-dark); color: white; }
.sub-nav a:hover:not(.active) { background: #e2e4e8; }

/* ---- Formularz dodawania/edycji pojedynczej anomalii ---- */
.anomaly-form-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.anomaly-form-grid label {
    display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #495057;
}
.anomaly-form-grid input {
    padding: 8px; border: 1px solid #c9ccd1; border-radius: 6px; font-size: 14px;
}
.anomaly-form-wide { grid-column: 1 / -1; }

/* ---- Mapka w formularzu dodawania/edycji anomalii ---- */
.anomaly-map-wrap { position: relative; height: 420px; border-radius: 8px; overflow: hidden; }
.anomaly-map-wrap #anomaly-map { height: 100%; }
.anomaly-map-wrap .anomaly-map-controls {
    position: absolute; bottom: 10px; left: 10px; z-index: 1000;
    background: white; padding: 8px 10px; border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2); font-size: 12px; display: flex; gap: 10px; align-items: center;
}
.anomaly-map-wrap .anomaly-map-controls .control-row { margin-bottom: 0; }
.anomaly-map-wrap .anomaly-map-controls input[type="range"] { width: 90px; }
.anomaly-map-wrap .temp-toolbar { top: 10px; left: 10px; width: 116px; }
/* ---- Lupa na mapie formularza anomalii ---- */
.loupe-toggle-btn {
    padding: 4px 10px !important; font-size: 12px !important;
    background: #f8f9fa !important; color: var(--brand-dark) !important;
    border: 1px solid #c9ccd1 !important; border-radius: 6px !important;
    width: auto !important; cursor: pointer;
}

#anomaly-loupe {
    position: absolute; top: 10px; right: 10px; z-index: 1001;
    width: 220px; height: 220px; border-radius: 10px; overflow: hidden;
    border: 2px solid white; box-shadow: 0 2px 12px rgba(0,0,0,0.35);
    background: #1f2430;
}
#anomaly-loupe-map { width: 100%; height: 100%; }
/* Krzyzyk w srodku lupy = dokladnie miejsce pod kursorem glownej mapy. */
.loupe-crosshair {
    position: absolute; left: 50%; top: 50%; width: 18px; height: 18px;
    transform: translate(-50%, -50%); pointer-events: none; z-index: 1002;
}
.loupe-crosshair::before, .loupe-crosshair::after {
    content: ""; position: absolute; background: rgba(255,255,255,0.95);
    box-shadow: 0 0 2px rgba(0,0,0,0.8);
}
.loupe-crosshair::before { left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%); }
.loupe-crosshair::after { top: 50%; left: 0; right: 0; height: 2px; transform: translateY(-50%); }

/* ---- Znaczniki istniejacych anomalii na mapie formularza ---- */
/* Notatka robocza AI pod formularzem anomalii - wyraznie odrozniona od
   tresci raportowych (te laduja w edytowalnych polach formularza). */
.ai-note { color: #6b7280; font-style: italic; }

/* Lista projektow klienta: kod pojedynczego projektu (widoczny tylko dla
   posiadacza kodu master) i oznaczenie wygasnietego terminu dostepu. */

/* Wiersz "Obszar anomalii" na formularzu anomalii (anomalia obszarowa -
   prostokat rysowany narzedziem "Obszar", naniesiony potem w raporcie). */
.anomaly-area-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.anomaly-area-row .btn-secondary { padding: 4px 10px; font-size: 12.5px; }

/* Pasek postepu wgrywania plikow (upload_progress.js) - pod formularzem,
   ktory wlasnie wysyla plik. */
.upload-progress { margin-top: 8px; width: 100%; }
.upload-progress-track {
    height: 10px; background: #e9edf1; border-radius: 6px; overflow: hidden;
}
.upload-progress-fill {
    height: 100%; width: 0; background: var(--brand-dark);
    border-radius: 6px; transition: width 0.2s ease;
}
.upload-progress-label { font-size: 12px; color: #495057; margin-top: 4px; }
.upload-progress-error .upload-progress-fill { background: #c62828; }
.upload-progress-error .upload-progress-label { color: #c62828; font-weight: 600; }
/* Po przeslaniu calosci serwer jeszcze przetwarza (konwersja COG /
   pakowanie) - pasek dostaje delikatna animacje "oddychania". */
.upload-progress-busy .upload-progress-fill { animation: upload-breathe 1.2s ease-in-out infinite; }
@keyframes upload-breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* Legenda skali temperatur na mapie klienta - OPISUJE oryginalne kolory
   kafelkow IR (kalibracja empiryczna, patrz viewer.js i thermal_scale.py).
   Prawy dolny rog - z dala od okna przelacznika/przezroczystosci IR. */
.thermal-legend {
    position: absolute; bottom: 16px; right: 12px; z-index: 900;
    background: rgba(255, 255, 255, 0.92); padding: 8px 9px;
    border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.thermal-legend-bar {
    width: 14px; height: 110px;
    border: 1px solid #cfd6df; border-radius: 3px;
}
.thermal-legend-label { font-size: 11px; font-weight: 700; color: #374151; }

/* Panel propozycji AI (formularz anomalii): edytowalna propozycja
   Typ/Kategoria/CoA/Zalecenie, ktora inspektor akceptuje przyciskiem
   "Zastosuj do formularza" - nic nie wskakuje do pol automatycznie. */
.ai-proposal {
    margin-top: 10px; padding: 12px 14px; border: 1px solid #cfd6df;
    border-left: 3px solid var(--brand-dark); border-radius: 8px;
    background: #f8fafc; display: flex; flex-direction: column; gap: 8px;
}
.ai-proposal-title { font-weight: 700; font-size: 13px; color: #374151; }
.ai-proposal label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 12.5px; color: #495057; font-weight: 600;
}
.ai-proposal textarea, .ai-proposal input {
    font-weight: 400; padding: 8px; border: 1px solid #c9ccd1;
    border-radius: 6px; font-size: 13.5px; font-family: inherit;
}
.ai-proposal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ai-proposal-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.existing-anomaly-marker {
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 11px; font-weight: 700;
    border: 2px solid white; box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

.ai-describe-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.ai-describe-row input[type="text"] {
    flex: 1; min-width: 260px; padding: 8px; border: 1px solid #c9ccd1; border-radius: 6px; font-size: 13px;
}
.anomaly-form-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-secondary {
    background: var(--surface, #fff); color: var(--brand-dark); border: 1px solid var(--line-strong, #8f949c) !important;
}
.btn-secondary:hover { background: var(--surface-2, #f8f9fb); }
.success-banner { padding: 10px 14px; margin-bottom: 16px;
}
.admin-comment { padding: 10px 0; border-bottom: 1px solid #f1f2f4; }
.admin-comment-meta { font-size: 13px; margin-bottom: 4px; }
.admin-comment-text { font-size: 13px; color: #374151; white-space: pre-wrap; margin: 0 0 6px; }
.ai-suggestion-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; display: block; }
.inline-email-form { display: flex; gap: 6px; min-width: 220px; }
.inline-email-form input {
    padding: 5px 8px; border: 1px solid #c9ccd1; border-radius: 6px; font-size: 13px; flex: 1; min-width: 0;
}
.inline-email-form button { padding: 5px 10px; font-size: 12px; flex-shrink: 0; }

/* ---- Ramka z instrukcja (konwerter termiczny) ---- */
.callout { border: 1px solid #ffddb8; border-radius: 8px;
    padding: 14px 16px; margin: 14px 0; font-size: 13px;
}
.callout strong { display: block; margin-bottom: 6px; color: var(--brand-dark); }
.callout ol { margin: 8px 0; padding-left: 20px; }
.callout li { margin-bottom: 4px; }
.projects-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.projects-table th, .projects-table td {
    text-align: left; padding: 9px 10px; border-bottom: 1px solid #eef0f3; vertical-align: top;
}
.projects-table th { text-transform: uppercase; letter-spacing: 0.04em; background: #f8f9fb; border-bottom: 1px solid #e2e4e8;
}
.projects-table tbody tr:hover { background: #f8f9fb; }
.status { padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.status-ready { background: #d4edda; color: #155724; }
.status-processing { background: #fff3cd; color: #856404; }
.status-error { background: #f8d7da; color: #721c24; }
.status-empty { background: #e2e4e8; color: #555; }
.error-detail { color: #c0392b; font-size: 11px; margin-top: 4px; max-width: 300px; }

.upload-form { flex-direction: column; align-items: flex-start; gap: 6px; }
.upload-form label { font-size: 12px; }
.hint { font-size: 12px; color: #6b7280; }

/* ---- Viewer ---- */
.viewer-body { margin: 0; height: 100vh; overflow: hidden; }
#topbar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 1000;
    background: var(--brand-dark); color: white; padding: 10px 16px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 14px;
}
.logout-link { color: rgba(255,255,255,.85); text-decoration: none; font-size: 13px; }
#map { position: absolute; top: 42px; bottom: 0; left: 0; right: 0; }
.report-view-body { position: absolute; top: 42px; bottom: 0; left: 0; right: 0; background: #525659; }
/* Strona podgladu pliku (/preview) - licznik pozycji, wyszarzone strzalki
   na koncach listy i wysrodkowany podglad obrazow. */
.preview-counter { color: rgba(255,255,255,0.85); font-size: 13px; padding: 0 4px; white-space: nowrap; }
.preview-nav-disabled { opacity: 0.4; cursor: default; }
.preview-image-wrap {
    display: flex; align-items: center; justify-content: center;
    height: 100%; overflow: auto; padding: 20px; box-sizing: border-box;
}
.preview-image-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; }
.report-pdf-embed { width: 100%; height: 100%; border: none; }
.report-view-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: white; text-align: center; gap: 4px;
}
.report-view-empty .hint { color: #d0d0d0; }
.topbar-left { display: flex; align-items: center; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.project-date { font-weight: 400; color: rgba(255,255,255,.7); font-size: 12px; margin-left: 4px; }
.project-switcher {
    padding: 5px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.35);
    background: var(--brand-dark); color: white; font-size: 13px; margin-right: 10px; max-width: 220px;
}
#controls {
    position: absolute; bottom: 20px; left: 20px; z-index: 1000;
    background: white; padding: 12px 16px; border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2); font-size: 13px;
}
.control-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.control-row input[type="range"] { width: 140px; }
/* Dyskretna adnotacja pod przelacznikiem warstw - male, szare, waskie. */
.layers-note {
    margin: 6px 0 0; max-width: 230px; font-size: 10.5px; line-height: 1.45;
    color: #9ca3af; border-top: 1px solid #eef0f3; padding-top: 6px;
}
/* ---- Menu pobierania ortomozaiki (w naglowku mapy) ---- */
.download-menu { position: relative; display: inline-block; }
.download-menu summary {
    list-style: none; cursor: pointer; user-select: none;
}
.download-menu summary::-webkit-details-marker { display: none; }
.download-menu[open] summary { background: rgba(255,255,255,0.12); }
.download-menu-list {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 1002;
    background: white; border-radius: 8px; min-width: 260px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.25); padding: 6px 0;
    display: flex; flex-direction: column;
}
.download-menu-group {
    padding: 8px 14px 4px; font-size: 11px; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.download-menu-list a {
    padding: 8px 14px; color: #1f2430; text-decoration: none; font-size: 13px;
    white-space: nowrap;
}
.download-menu-list a:hover { background: #f1f2f4; color: var(--brand-color); }
.download-menu-size { color: #6b7280; font-size: 12px; }

/* ---- Panel boczny z lista anomalii ---- */
.anomaly-toggle-btn {
    position: absolute; top: 56px; right: 16px; z-index: 1000;
    background: var(--brand-dark); color: white; border: none; padding: 8px 14px;
    border-radius: 6px; font-size: 13px; cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.anomaly-toggle-btn:hover { background: color-mix(in srgb, var(--brand-dark) 88%, white); }

.temp-toolbar {
    position: absolute; top: 130px; left: 16px; z-index: 1000;
    background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    padding: 8px; display: flex; flex-direction: column; gap: 6px; width: 132px;
}
.temp-toolbar-title {
    font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase;
    letter-spacing: 0.03em; padding: 2px 4px 4px;
}
.temp-tool-btn {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: none;
    border-radius: 6px; background: #f8f9fa; cursor: pointer; font-size: 13px;
    color: var(--brand-dark); text-align: left; width: 100%;
}
.temp-tool-btn:hover { background: #eef0f3; }
.temp-tool-btn.active { background: var(--brand-accent); color: var(--brand-accent-text); }
.temp-tool-icon { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; }
.temp-tool-clear { color: #c0392b; }
.temp-tool-clear:hover { background: #fdecea; }

/* ---- Podpowiedz przy aktywnym narzedziu temperatury ----
   Pasek na dole ekranu, ktory mowi WPROST, co teraz zrobic - bez tego
   uzytkownik musi zgadywac, ze prostokat rysuje sie przeciaganiem. */
.temp-hint {
    position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
    z-index: 1000; background: rgba(31, 36, 48, 0.92); color: white;
    padding: 9px 16px; border-radius: 20px; font-size: 13px; font-weight: 500;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3); pointer-events: none;
    max-width: calc(100vw - 32px); text-align: center;
}

/* ==========================================================================
   Samouczek w trybie demonstracyjnym (patrz static/js/tour.js)
   ========================================================================== */
/* "Reflektor": przezroczysty prostokat nad omawianym elementem. Cala reszta
   ekranu jest przyciemniona OGROMNYM cieniem dookola niego, wiec element
   pozostaje widoczny, a my nie musimy w ogole ruszac jego stylow (dawna
   wersja nadawala celowi position/z-index i psula uklad - patrz tour.js). */
.tour-overlay {
    position: fixed; z-index: 2000; pointer-events: none;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(15, 20, 30, 0.55);
    transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease;
}
.tour-overlay-focused { outline: 3px solid var(--brand-color); }
.tour-bubble {
    position: fixed; z-index: 2001; width: 340px; max-width: calc(100vw - 24px);
    background: white; border-radius: 12px; padding: 18px 20px 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}
.tour-step-counter {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--brand-color); margin-bottom: 6px;
}
.tour-bubble h3 { margin: 0 0 8px; font-size: 16px; color: var(--brand-dark); }
.tour-bubble p { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: #374151; }
.tour-close {
    position: absolute; top: 8px; right: 10px; background: none; border: none;
    font-size: 22px; line-height: 1; color: #9ca3af; cursor: pointer; padding: 2px 6px;
}
.tour-close:hover { color: var(--brand-dark); }
.tour-buttons {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; flex-wrap: wrap;
}
.tour-buttons-right { display: flex; gap: 8px; margin-left: auto; }
.tour-btn {
    padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; border: none;
}
.tour-prev { background: #eef0f3; color: #374151; }
.tour-prev:hover { background: #e2e4e8; }
/* "Pomiń" celowo wyglada mniej wyraziscie niz "Dalej" - ma byc latwe do
   znalezienia, ale nie przyciagac wzroku bardziej niz sciezka glowna. */
.tour-skip {
    background: none; color: #6b7280; padding: 8px 4px; font-weight: 500;
    text-decoration: underline;
}
.tour-skip:hover { color: var(--brand-dark); }
.tour-next { background: var(--brand-color); color: white; }
.tour-next:hover { background: color-mix(in srgb, var(--brand-color) 82%, black); }

.tour-replay-btn { cursor: pointer; font-family: inherit; border: 1px solid rgba(255,255,255,0.35); }

@media (max-width: 640px) {
    .tour-bubble { width: calc(100vw - 24px); padding: 16px; }
}

/* ---- Znaczniki skrajnych temperatur w zaznaczonym obszarze ----
   Trojkat w gore = najcieplejszy piksel, w dol = najzimniejszy. Rysowane
   czystym CSS (bez plikow graficznych), kotwiczone srodkiem na pikselu. */
/* Kontener ma ZEROWY rozmiar i siedzi dokladnie na wskazanym pikselu
   (divIcon: iconSize [0,0], iconAnchor [0,0]). Trojkat i etykieta sa
   pozycjonowane wzgledem niego absolutnie.

   Wczesniej byl to flexbox z transform: translate(-50%,-50%), ktory centrowal
   CALY znacznik (trojkat + etykieta, ok. 70 px szerokosci) na punkcie - przez
   co sam trojkat wypadal ~26 px w lewo od faktycznego piksela. Przy duzym
   oddaleniu zaznaczony obszar ma na ekranie kilkadziesiat pikseli, wiec
   trojkat potrafil wyladowac poza nim. Teraz na pikselu stoi WIERZCHOLEK
   trojkata, a etykieta wisi obok i nie wplywa na jego pozycje. */
.extreme-marker { position: absolute; width: 0; height: 0; }
/* Trojkat jest SVG (patrz extremeArrowSvg w viewer.js) - czarny kontur
   rysuje sam SVG atrybutem stroke, tutaj tylko cien pod niego. */
/* SVG ma 18x16, wierzcholek w punkcie (9,1) dla trojkata w gore i (9,15) dla
   trojkata w dol - przesuwamy go tak, zeby ten wierzcholek wypadl w (0,0),
   czyli dokladnie na wskazanym pikselu. */
.extreme-arrow {
    position: absolute; left: -9px; display: block;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
}
.extreme-marker-max .extreme-arrow { top: -1px; }
.extreme-marker-min .extreme-arrow { top: -15px; }

.extreme-label {
    position: absolute; left: 13px; transform: translateY(-50%);
    white-space: nowrap;
    font-size: 11px; font-weight: 700; color: white; padding: 1px 6px;
    border-radius: 10px; border: 1px solid rgba(0,0,0,0.85);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
/* Etykieta na wysokosci srodka trojkata (ten rozciaga sie w dol dla "max"
   i w gore dla "min"), zeby nie zaslaniala samego wierzcholka. */
.extreme-marker-max .extreme-label { top: 7px; background: #c62828; }
.extreme-marker-min .extreme-label { top: -7px; background: #1565c0; }

.anomaly-panel {
    position: absolute; top: 42px; bottom: 0; right: 0; width: 320px;
    max-width: 90vw; background: white; z-index: 1001;
    box-shadow: -2px 0 10px rgba(0,0,0,0.15);
    transform: translateX(100%);
    display: flex; flex-direction: column;
}
.anomaly-panel.open { transform: translateX(0); }
.anomaly-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid #e2e4e8; font-weight: 600;
    color: var(--brand-dark); flex-shrink: 0;
}
.anomaly-panel-close-btn {
    background: none; border: none; font-size: 22px; line-height: 1;
    cursor: pointer; color: #6b7280;
}
.anomaly-panel-body { overflow-y: auto; flex: 1; padding: 8px 0; }
.anomaly-group-header {
    padding: 8px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.03em; color: #495057; border-left: 4px solid; margin-top: 6px;
    background: #f8f9fa;
}
.anomaly-item {
    display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px;
    cursor: pointer; border-bottom: 1px solid #f1f2f4; font-size: 13px;
}
.anomaly-item:hover { background: #f8f9fa; }

.anomaly-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }

.highlight-marker-pulse {
    width: 20px; height: 20px; border-radius: 50%;
    background: rgba(var(--brand-color-rgb), 0.5); border: 3px solid var(--brand-color);
    animation: highlight-pulse 1.6s ease-out infinite;
}
@keyframes highlight-pulse {
    0% { transform: scale(0.6); box-shadow: 0 0 0 0 rgba(var(--brand-color-rgb), 0.5); }
    70% { transform: scale(1); box-shadow: 0 0 0 14px rgba(var(--brand-color-rgb), 0); }
    100% { transform: scale(0.6); box-shadow: 0 0 0 0 rgba(var(--brand-color-rgb), 0); }
}
.anomaly-item-text strong { display: block; color: #1f2430; }
.anomaly-item-sub { color: #6b7280; font-size: 12px; margin-top: 2px; }
/* Znacznik rozpoznanego wzorca (patrz app/patterns.py + matchPattern() w
   viewer.js) - kropkowane podkreslenie sygnalizuje "najedz, zeby zobaczyc
   wyjasnienie", tresc dymka to natywny atrybut title przegladarki. */
.anomaly-pattern-tag { text-decoration: underline dotted; cursor: help; }

.anomaly-comments { margin-top: 8px; border-top: 1px solid #f1f2f4; padding-top: 8px; }
.anomaly-comment { margin-bottom: 8px; font-size: 12px; }
.anomaly-comment strong { color: #1f2430; }
.anomaly-comment-date { color: #9ca3af; font-size: 11px; margin-left: 6px; }
.anomaly-comment p { margin: 3px 0 0; color: #374151; white-space: pre-wrap; }
.anomaly-comment-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.anomaly-comment-form input, .anomaly-comment-form textarea {
    padding: 6px 8px; border: 1px solid #d7dae0; border-radius: 6px; font-size: 12px; font-family: inherit;
}
.anomaly-comment-form textarea { resize: vertical; min-height: 50px; }
.anomaly-comment-form button {
    align-self: flex-start; padding: 6px 12px; background: var(--brand-dark); color: white;
    border: none; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.anomaly-comment-form button:hover { background: var(--brand-color); }
.anomaly-comment-form button:disabled { opacity: 0.5; cursor: not-allowed; }
.comment-status { display: block; margin-top: 2px; }

/* ---- Pasek zajetosci dysku (zakladka Ustawienia) ---- */
.disk-bar {
    height: 14px; background: #eef0f3; border-radius: 7px; overflow: hidden;
    border: 1px solid #e2e4e8;
}
.disk-bar-fill { height: 100%; background: var(--brand-color); border-radius: 7px 0 0 7px; min-width: 2px; }
.disk-bar-warn { background: #c0392b; }

/* ---- Strona projektu: karty w siatce dwoch kolumn ----
   Dawniej wszystkie karty staly jedna pod druga - strona byla bardzo
   dluga. Male karty-ustawienia (samouczek, wygasniecie linku itd.) siedza
   teraz parami obok siebie (klasa card-half), a karty z tabelami/duzymi
   formularzami zajmuja domyslnie cala szerokosc. */
.project-cards {
    display: grid; gap: 18px; align-items: start;
}
.project-cards .card { margin-bottom: 0; grid-column: 1 / -1; }
.project-cards .card-half { grid-column: auto / span 1; }
/* Naglowek grupy kart ("Ustawienia projektu", "Dane inspekcji"...) -
   pelna szerokosc, maly kapitalikowy tytul z linia, oddziela sekcje. */
.cards-group-title {
    grid-column: 1 / -1; margin: 10px 0 -6px; padding-bottom: 6px;
    font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 2px solid #dfe3e9;
}
.cards-group-title:first-child { margin-top: 0; }
@media (max-width: 900px) {
    
    .project-cards .card-half { grid-column: 1 / -1; }
}

/* ---- Formularz danych inspekcji ---- */
.meta-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; align-items: end; }
.meta-form label {
    display: flex; flex-direction: column; gap: 4px; font-size: 12px;
    color: #495057; font-weight: 600;
}
.meta-form input[type="text"], .meta-form input[type="date"] {
    padding: 8px; border: 1px solid #c9ccd1; border-radius: 6px;
    font-size: 14px; font-weight: normal; color: #1f2430;
}
.meta-submit { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 720px) { .meta-form { grid-template-columns: 1fr; } }

/* ---- Przycisk raportu w widoku klienta ---- */
.report-link {
    color: white; text-decoration: none; font-size: 13px;
    background: var(--brand-color); padding: 6px 12px; border-radius: 6px; margin-right: 14px;
}
.report-link:hover { background: color-mix(in srgb, var(--brand-color) 80%, black); }

.projects-link {
    color: white; text-decoration: none; font-size: 13px;
    background: transparent; padding: 6px 12px; border-radius: 6px; margin-right: 10px;
    border: 1px solid rgba(255,255,255,0.35);
}
.projects-link:hover { background: rgba(255,255,255,0.12); }

/* ---- Wyszukiwanie i sortowanie tabeli projektow ---- */

.projects-table th.sortable {
    cursor: pointer; user-select: none; white-space: nowrap;
}
.projects-table th.sortable:hover { color: var(--brand-color); }
.projects-table th.sortable[data-sort-active="asc"]::after { content: " \25B2"; font-size: 10px; }
.projects-table th.sortable[data-sort-active="desc"]::after { content: " \25BC"; font-size: 10px; }
.delete-btn {
    background: var(--surface, #fff); color: var(--err-fg, #b71c1c); border: 1px solid var(--err-line, #f5c2c0); padding: 6px 12px; font-size: 13px; white-space: nowrap;
}
.delete-btn:hover { background: var(--err-bg, #fdecea); }

/* ---- Zaznaczanie wielu projektow (operacje zbiorcze) ---- */
.check-col { width: 34px; text-align: center; }
.check-col input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.bulk-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid #f5c6bd; border-radius: 8px;
    padding: 10px 14px; margin-bottom: 12px;
}
.bulk-bar #bulk-count { font-size: 13px; font-weight: 600; }

/* ---- Kody dostepu: wybor zasiegu ---- */

.grant-meta-row { display: flex; gap: 16px; flex-wrap: wrap; }
.grant-meta-row label { flex: 1; min-width: 240px; }
.scope-columns { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0 4px; }
.scope-box {
    flex: 1; min-width: 260px; background: #f8f9fa;
    border: 1px solid #e2e4e8; border-radius: 8px; padding: 12px 14px;
}
.scope-box h3 { font-size: 13px; margin: 0 0 4px; color: var(--brand-dark); }
.scope-list { max-height: 260px; overflow-y: auto; margin-top: 8px; }
.scope-item {
    display: flex; align-items: flex-start; gap: 8px; padding: 5px 2px;
    font-size: 13px; cursor: pointer; border-bottom: 1px solid #eef0f3;
}
.scope-item:last-child { border-bottom: none; }
.scope-item:hover { background: #eef0f3; }
.scope-item input { width: auto; margin-top: 2px; flex-shrink: 0; }
.scope-client { color: #6b7280; }

/* ---- Strona instrukcji ---- */
.steps-list { padding-left: 22px; line-height: 1.6; }
.steps-list li { margin-bottom: 10px; }
.steps-list pre {
    background: #1f2430; color: #e2e4e8; padding: 12px 14px; border-radius: 6px;
    overflow-x: auto; margin: 8px 0; font-size: 12px; line-height: 1.5;
}
.steps-list code, .card p code, .card h2 code {
    background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 0.92em;
}
.steps-list pre code { background: none; padding: 0; }

/* ---- Galeria zdjec termowizyjnych falownikow ---- */
.photo-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px; margin-top: 14px;
}
.photo-gallery-item {
    border: 1px solid #e2e4e8; border-radius: 8px; overflow: hidden;
    background: #fff; display: flex; flex-direction: column;
}
.photo-gallery-item img {
    width: 100%; height: 100px; object-fit: cover; display: block; background: #eef0f3;
}
.photo-gallery-name {
    font-size: 11px; padding: 6px 8px; color: #495057; word-break: break-all; flex: 1;
}
.photo-gallery-item form { padding: 0 8px 8px; }
.photo-gallery-item .delete-btn { width: 100%; padding: 4px; font-size: 11px; }
.photo-gallery-temp-form { display: flex; gap: 4px; }
.photo-gallery-temp-form input {
    width: 100%; padding: 4px 6px; font-size: 11px; border: 1px solid #c9ccd1;
    border-radius: 4px; min-width: 0;
}
.photo-gallery-temp-form button {
    padding: 4px 8px; font-size: 11px; flex-shrink: 0;
}

.actions-cell { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.action-link {
    display: inline-block; padding: 6px 12px; background: var(--brand-dark); color: white;
    text-decoration: none; border-radius: 6px; font-size: 13px; white-space: nowrap;
}
.action-link:hover { background: color-mix(in srgb, var(--brand-dark) 88%, white); }

/* ==========================================================================
   Responsywnosc mobilna (telefony, tablety w pionie)
   ==========================================================================
   Cala reszta pliku byla pisana z myslą o desktopie - ta sekcja dopasowuje
   WIDOK KLIENTA (mapa, panel anomalii, logowanie, galeria zdjec), bo to tam
   ktos realnie uzyje telefonu w terenie. Panel admina zostaje bez zmian -
   to gesty uklad formularzy/tabel, z ktorego korzysta sie z komputera. */
@media (max-width: 640px) {
    /* --- Topbar: zawijanie zamiast wychodzenia poza ekran/nakladania sie --- */
    #topbar { flex-wrap: wrap; padding: 8px 12px; row-gap: 6px; }
    .topbar-left { width: 100%; }
    .project-name { font-size: 13px; }
    .topbar-right {
        width: 100%; justify-content: flex-start; flex-wrap: nowrap;
        overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px;
    }
    .topbar-right > * { flex-shrink: 0; }
    .project-switcher { max-width: 140px; }

    /* Topbar zajmuje teraz ~2 linijki zamiast jednej (42px na desktopie) -
       mapa i plywajace przyciski musza zejsc nizej, zeby nic nie chowalo sie
       pod naglowkiem. Wartosci to bezpieczny margines - jesli na prawdziwym
       telefonie topbar wyjdzie odrobine wyzszy/nizszy niz zakladam, to latwe
       do doszlifowania o kilka px. */
    #map { top: 78px; }
    .report-view-body { top: 78px; }
    .anomaly-toggle-btn { top: 86px; right: 10px; }
    .temp-toolbar { top: 86px; left: 10px; }

    /* --- Wieksze cele dotykowe - łatwiej trafic palcem --- */
    
    .anomaly-toggle-btn { padding: 10px 14px; font-size: 14px; }
    
    .control-row { min-height: 28px; }
    .control-row input[type="range"] { width: 110px; }

    /* --- Panel anomalii na cala szerokosc ekranu zamiast waskiej wstazki --- */
    .anomaly-panel { width: 100%; max-width: 100%; }

    /* --- Menu pobierania: topbar-right przewija sie w poziomie (overflow-x),
       co przycieloby absolutnie pozycjonowana liste - na telefonie lista
       jest wiec przypieta do okna (fixed), pod dwuliniowym topbarem. --- */
    .download-menu-list { position: fixed; left: 10px; right: 10px; top: 84px; min-width: 0; }

    /* --- Podpowiedz narzedzia: na waskim ekranie panel #controls (lewy dolny
       rog) siegalby az pod srodek, wiec podnosimy podpowiedz ponad niego. --- */
    .temp-hint { bottom: 132px; font-size: 12px; padding: 8px 14px; }

    /* --- Pola formularzy min. 16px - ponizej tego iOS Safari automatycznie
       dozoomowuje przy kliknieciu w pole, co jest irytujace i myli. --- */
    .anomaly-comment-form input, .anomaly-comment-form textarea { font-size: 16px; }
    .ai-describe-row input[type="text"] { font-size: 16px; }

    /* --- Logowanie: bezpieczny margines na waskich ekranach (np. 320px) --- */
    

    /* --- Zabezpieczenie: jakakolwiek tabela (np. lista projektow klienta z
       kodem master) przewija sie w poziomie zamiast wychodzic poza ekran. --- */
    .projects-table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 400px) {
    /* Bardzo waskie telefony (np. iPhone SE) - jeszcze ciasniej */
    .topbar-right a, .topbar-right .logout-link { font-size: 12px; padding: 6px 8px; }
    .project-switcher { max-width: 100px; font-size: 12px; }
}

/* ============ Kalibracja RGB <-> IR (admin) ============ */
#calib-map { border-radius: 8px; margin-top: 12px; border: 1px solid #ddd; }
.calib-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.calib-view-group { display: flex; gap: 6px; align-items: center; margin-right: 10px; color: #555; }
.calib-view-btn { background: #f0f0f0; color: #333; border: 1px solid #ccc; }
.calib-view-btn.active { background: var(--brand-color); color: #fff; border-color: var(--brand-color); }
.calib-highlight { color: var(--brand-color); font-weight: 600; }
.calib-pt {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
    border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.calib-pt-ir { background: #d33; }
.calib-pt-rgb { background: #1565c0; }
.calib-pairs { margin-top: 12px; }
.calib-pairs-table { border-collapse: collapse; }
.calib-pairs-table th, .calib-pairs-table td { padding: 6px 12px; border-bottom: 1px solid #eee; text-align: left; font-size: 14px; }

/* ============ Inspekcja stacji falownikowych (admin) ============ */
.inv-progress { font-size: 15px; font-weight: 600; color: var(--brand-color); }
.inv-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; position: sticky; top: 0; z-index: 5; }
.inv-station-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 8px; }
.inv-station-name { font-size: 17px; font-weight: 700; }
.inv-inline { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.inv-desc { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 10px; }
.inv-desc input { flex: 1; }
.inv-photo { border-top: 1px solid #e5e7eb; padding-top: 12px; margin-top: 12px; }
.inv-photo-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 8px; }
.inv-photo-body { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.inv-ir-wrap { position: relative; width: 560px; max-width: 100%; user-select: none; }
.inv-ir-wrap img { width: 100%; display: block; }
.inv-rgb { width: 420px; max-width: 100%; }
.inv-draw-rect { position: absolute; border: 2px dashed #ffd600; background: rgba(255, 214, 0, 0.12); pointer-events: none; }
.inv-zone-row.inv-drawing { outline: 2px solid #ffd600; }
.inv-zones { border-collapse: collapse; width: 100%; margin-top: 8px; font-size: 13px; }
.inv-zones th, .inv-zones td { padding: 5px 6px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top; }

.inv-label { width: 100%; min-width: 200px; }
.inv-ai-comment { max-width: 260px; font-size: 11.5px; }
.inv-coa { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; color: #fff; }
.inv-coa-1 { background: #2e7d32; }
.inv-coa-2 { background: #e65100; }
.inv-coa-3 { background: #c62828; }
.inv-conclusions { width: 100%; font-family: inherit; font-size: 14px; }
.inv-actions button { width: auto; }
.inv-actions { padding-top: 10px; padding-bottom: 10px; }
.inv-zones-wrap { overflow-x: auto; }
.inv-box { white-space: nowrap; }
.inv-box input { width: 54px; padding: 3px 4px; }
.inv-box .inv-draw-btn { width: auto; padding: 3px 8px; margin-left: 4px; }
.inv-zones select, .inv-zones input[type=text] { padding: 3px 4px; }
.sg-ref-sel { min-width: 88px; }

/* ============ Termowizja rozdzielnic: przeglad (admin) ============ */
.sg-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 16px; }
.sg-meta label, .sg-wide { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sg-wide { grid-column: 1 / -1; margin-top: 8px; }
.sg-wide textarea, .sg-photo-comment textarea { width: 100%; font-family: inherit; font-size: 14px; }
.sg-photo-comment { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-top: 8px; }
.sg-group { width: 170px; }
.sg-comment-input { width: 240px; font-family: inherit; font-size: 12.5px; }
.inv-zones tr.sg-anom td { background: #fdecea; }
.sg-prio { display: inline-block; min-width: 22px; padding: 1px 8px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 12px; text-align: center; }
.sg-prio-1 { background: #c62828; }
.sg-prio-2 { background: #ef6c00; }
.sg-prio-3 { background: #f9a825; color: #3b2f00; }
.sg-prio-4 { background: #2e7d32; }
.sg-prio-obs { background: #546e7a; }

.sg-comment { border-left: 3px solid #cbd5e1; padding: 4px 10px; margin: 6px 0; }
.sg-comment p { margin: 3px 0; white-space: pre-wrap; }
.sg-comment-admin { border-left-color: var(--brand-color); background: rgba(var(--brand-color-rgb), 0.06); }
.sg-comment-author { font-weight: 700; }
.sg-reply { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.sg-reply textarea { flex: 1; font-family: inherit; }
.sg-mini, .card .sg-mini { padding: 3px 10px; font-size: 12px; width: auto; }

/* ============ Termowizja rozdzielnic: widok klienta ============ */
.sg-client-body { overflow-y: auto; height: auto; background: #f3f4f6; }
.sg-client { max-width: 1120px; margin: 0 auto; padding: 18px 16px 60px; }

.sg-hero h1 { margin: 4px 0; font-size: 26px; color: var(--brand-dark); }
.sg-kicker { text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; font-weight: 700; color: var(--brand-color); margin: 0; }
.sg-card { background: #fff; padding: 16px 18px; margin: 14px 0; }
.sg-card h2 { margin-top: 0; font-size: 18px; color: var(--brand-dark); }
.sg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 10px; }
.sg-stat { border-radius: 8px; padding: 10px 12px; background: #f6f7f9; border-top: 4px solid #cbd5e1; display: flex; flex-direction: column; gap: 2px; }
.sg-stat-n { font-size: 28px; font-weight: 800; line-height: 1; }
.sg-stat small { color: #6b7280; font-size: 11.5px; }
.sg-stat-1 { border-top-color: #c62828; } .sg-stat-2 { border-top-color: #ef6c00; }
.sg-stat-3 { border-top-color: #f9a825; } .sg-stat-4 { border-top-color: #2e7d32; } .sg-stat-obs { border-top-color: #546e7a; }
.sg-table-wrap { overflow-x: auto; }
.sg-table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.sg-table th { text-align: left; background: var(--brand-dark); color: #fff; padding: 6px 8px; font-weight: 600; }
.sg-table td { padding: 6px 8px; border-bottom: 1px solid #eee; vertical-align: top; }
.sg-table tr.sg-anom td { background: #fdecea; }
.sg-toc ol { columns: 2; margin: 0; padding-left: 20px; }
.sg-board-title { margin: 28px 4px 4px; font-size: 20px; color: var(--brand-dark); border-bottom: 2px solid var(--brand-color); padding-bottom: 4px; }
.sg-board-loc { font-size: 15px; font-weight: normal; color: #555; }
.sg-thermo-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.sg-thermo-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.sg-thermo-imgs img { width: 100%; display: block; border-radius: 4px; }
.sg-thermo-imgs .sg-vis { margin-top: 8px; }
.sg-thermo-comment { font-weight: 600; margin-top: 0; }
.sg-meas { font-size: 12.5px; }
.sg-thread { margin-top: 12px; border-top: 1px solid #eee; padding-top: 8px; }
.sg-thread-form summary { cursor: pointer; color: var(--brand-color); font-weight: 600; font-size: 13.5px; }
.sg-thread-form input, .sg-thread-form textarea { display: block; width: 100%; margin: 6px 0; padding: 7px; border: 1px solid #c9ccd1; border-radius: 6px; font-family: inherit; font-size: 16px; box-sizing: border-box; }
.sg-thread-form button { padding: 7px 14px; background: var(--brand-dark); color: #fff; border: none; border-radius: 6px; cursor: pointer; }
@media (max-width: 760px) {
    .sg-thermo-body { grid-template-columns: 1fr; }
    .sg-toc ol { columns: 1; }
    .sg-hero h1 { font-size: 21px; }
}
.sg-cost { margin: 4px 0 10px; font-size: 14px; }

/* ============ Termowizja rozdzielnic: edytor pojedynczego termogramu ============ */

.sg-board-input { width: 100%; min-width: 220px; }
.sg-ed-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; position: sticky; }
.sg-ed-nav { display: flex; gap: 8px; align-items: center; }
.sg-ed-nav select { max-width: 380px; }
.sg-nav-btn { display: inline-block; padding: 7px 14px; border-radius: 6px; background: var(--brand-dark); color: #fff; text-decoration: none; font-weight: 600; }
.sg-nav-btn.sg-disabled { opacity: 0.35; }
.sg-status { font-size: 13px; padding: 4px 10px; border-radius: 10px; background: #e5e7eb; }
.sg-status.sg-ok { background: #dcfce7; color: #166534; }
.sg-status.sg-busy { background: #fef9c3; color: #854d0e; }
.sg-status.sg-err { background: #fee2e2; color: #991b1b; }
.sg-status.sg-dirty { background: #ffedd5; color: #9a3412; font-weight: 600; }
.sg-save-bar { display: flex; align-items: center; gap: 8px; }
.sg-save-bar button { padding: 7px 14px; }
.sg-save-bar button:disabled { opacity: 0.4; cursor: default; }
.sg-ed-head { display: flex; flex-wrap: wrap; align-items: baseline; }
.sg-ed-head h1 { margin: 0; }
.sg-ed-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 8px 0 12px; }

.sg-ed-tools { display: flex; flex-wrap: wrap; align-items: center; }
.sg-editor { position: relative; user-select: none; touch-action: none; line-height: 0; }
.sg-editor img { width: 100%; display: block; }
.sg-editor.sg-new-mode { cursor: crosshair; }
.sg-box { position: absolute; border: 1px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.55); cursor: move; box-sizing: border-box; }
.sg-box-anom { border-color: #ff3b3b; }
.sg-box-obs { border-color: #7dd3fc; }
.sg-box-new { border-style: dashed; border-color: #ffd600; background: rgba(255, 214, 0, 0.15); }
.sg-box-label { position: absolute; left: -2px; top: -17px; background: #141414; color: #fff; font: 700 11px/15px sans-serif; padding: 0 4px; white-space: nowrap; pointer-events: none; }
.sg-box-del { position: absolute; right: -9px; top: -9px; width: 16px; height: 16px; border-radius: 50%; background: #141414; color: #fff; font: 700 12px/16px sans-serif; text-align: center; cursor: pointer; }
.sg-box-handle { position: absolute; right: -6px; bottom: -6px; width: 11px; height: 11px; background: #fff; border: 1px solid #333; cursor: nwse-resize; }
/* Punkt Tmax obszaru: czerwony trojkat w cienkiej bialej obwodce - ten sam
   znacznik co na obrazie termogramu w PDF i na liniach Lx. */
.sg-box-hot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; pointer-events: none; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><polygon points='7,1.5 12.8,11.6 1.2,11.6' fill='%23ff3030' stroke='%23ffffff' stroke-width='1.2' stroke-linejoin='round'/></svg>") center/contain no-repeat; }
.sg-ed-vis { width: 100%; border-radius: 4px; }
.sg-ai { margin-top: 12px; }
.sg-ai h2 { margin: 0 0 6px; }
.sg-ai textarea { width: 100%; font-family: inherit; font-size: 14px; box-sizing: border-box; }
.sg-ai button { margin-top: 6px; }

.sg-download { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between;
    border: 2px solid var(--brand-color); background: rgba(var(--brand-color-rgb), 0.05); }
.sg-download-text { flex: 1 1 420px; }
.sg-download-text h2 { margin-bottom: 6px; }
.sg-download-text p { margin: 4px 0; }
.sg-download-note { color: #374151; font-size: 14px; }
.sg-download-btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 28px; border-radius: 10px;
    background: var(--brand-color); color: #fff; font-size: 17px; font-weight: 800; text-decoration: none;
    box-shadow: 0 3px 10px rgba(var(--brand-color-rgb), 0.35); white-space: nowrap; }
.sg-download-btn:hover { filter: brightness(1.08); }
.sg-download-icon { font-size: 20px; }
@media (max-width: 760px) { .sg-download-btn { width: 100%; justify-content: center; } }

/* Kolejnosc zalacznikow (strzalki w tabeli na stronie projektu) */
.att-order { white-space: nowrap; width: 1%; }
.att-move { display: inline-flex; flex-wrap: nowrap; gap: 4px; margin: 0; }
.att-move .att-move-btn { width: auto; min-width: 0; margin: 0; padding: 2px 9px; font-size: 13px; line-height: 1.3; }
.att-move-btn:disabled { opacity: 0.3; cursor: default; }
.att-fixed td { background: #f8fafc; }

/* Tabele opisowe w instrukcjach - tekst ma sie zawijac */
.projects-table.instr-table { display: table; width: 100%; white-space: normal; }
.instr-table th, .instr-table td { white-space: normal; vertical-align: top; overflow-wrap: anywhere; }
.instr-table td:first-child { width: 28%; }

/* Badanie budynku (elewacje): klasy istotnosci anomalii i obszar odniesienia */
.bd-cls { display: inline-block; min-width: 22px; padding: 1px 8px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 12px; text-align: center; }
.bd-cls-3 { background: #c62828; }
.bd-cls-2 { background: #ef6c00; }
.bd-cls-1 { background: #f9a825; color: #3b2f00; }
.sg-box-ref { border-style: dashed; border-color: #00e676; }
.sg-box-cls3 { border-color: #ff3b3b; }
.sg-box-cls2 { border-color: #ff9628; }
.sg-box-cls1 { border-color: #ffe13c; }
tr.bd-ref td { background: #e8f5e9; }

/* Linie pomiarowe Lx w edytorze termogramu (rozdzielnice): warstwa SVG nad
   termogramem, konce przeciagalne, znaczniki Tmax (czerwony) i Tmin (niebieski). */
.sg-lines-svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.sg-lines-svg .sg-line-hit { stroke: transparent; stroke-width: 14; cursor: move; }
.sg-lines-svg .sg-line-shadow { stroke: rgba(0,0,0,0.65); pointer-events: none; }
.sg-lines-svg .sg-line { stroke: #fff; pointer-events: none; }   /* bialy, 2 px - jak ramka obszaru Bx */
/* UI linii = te same klasy co przy obszarach (etykieta, uchwyt, znacznik, x);
   pozycja wprost w punkcie linii, wiec kasujemy przesuniecia rogu obszaru. */
.sg-line-tag { right: auto; transform: translate(-2px, -17px); }
.sg-line-tag-v { transform: translate(8px, 2px); }    /* linia pionowa: obok gornego konca */
.sg-line-tag-vb { transform: translate(8px, -17px); } /* linia pionowa: obok dolnego konca */
.sg-line-end { right: auto; bottom: auto; transform: translate(-6px, -6px); cursor: crosshair; }
.sg-line-del { right: auto; transform: translate(6px, -8px); }
.sg-box-cold { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><polygon points='7,12.5 12.8,2.4 1.2,2.4' fill='%2340a0ff' stroke='%23ffffff' stroke-width='1.2' stroke-linejoin='round'/></svg>"); }
.sg-editor.sg-new-line-mode { cursor: crosshair; }
.sg-editor.sg-new-line-mode .sg-box, .sg-editor.sg-new-line-mode .sg-line-ui, .sg-editor.sg-new-mode .sg-line-ui { pointer-events: none; }
tr.sg-line-row td { background: #fff8e1; }

/* Lista badan (generator rozdzielnic, badanie budynku): "Otworz" + "Usun" w jednym wierszu. */

/* "Usun" w tym samym rozmiarze co "Otworz" (.action-link: 6px 12px, 13 px) - jak na liscie projektow */

/* Lista "co ma zrobic AI" przy wgrywaniu zdjec (generator rozdzielnic). */
.sg-ai-opts { border: 1px solid #c9ccd1; border-radius: 6px; padding: 8px 12px; margin: 10px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 4px 16px; }
.sg-ai-opts legend { font-weight: 600; padding: 0 4px; }
.sg-ai-opts label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.sg-ai-opts .hint { grid-column: 1 / -1; margin: 4px 0 0; }
.sg-final-missing { background: #fff8e1; border: 1px solid #f9a825; border-radius: 6px; padding: 8px 12px; margin: 6px 0; }

/* Dziennik pracy AI podczas analizy (strona zadania w stanie "processing"). */
.inv-log { max-height: 240px; overflow-y: auto; background: #141414; color: #d7f5dc; font: 12.5px/1.5 ui-monospace, Consolas, monospace; border-radius: 6px; padding: 8px 12px; margin: 8px 0; }
.inv-log:empty { display: none; }
.inv-log .inv-log-t { color: #8bb58f; margin-right: 6px; }
.sg-lines-svg .sg-line-anom { stroke: #ff3b3b; }   /* linia Lx z priorytetem (kabel cieplejszy od reszty grupy) */

/* Edytor termogramu (rozdzielnice, budynki): pelna szerokosc ekranu -
   po lewej tabele pomiarow (pola, linie, komentarz), po prawej obrazy IR
   i RGB przyklejone do gory, zeby byly widoczne podczas przewijania tabel. */
.admin-wrap-wide { max-width: none; padding: 0 24px; }
.sg-ed-layout { display: grid; grid-template-columns: minmax(420px, 46%) minmax(0, 1fr); gap: 22px; align-items: start; }
.sg-ed-side { min-width: 0; }
.sg-ed-side .inv-zones-wrap { overflow-x: auto; }
.sg-ed-side .inv-zones td, .sg-ed-side .inv-zones th { font-size: 13px; vertical-align: middle; }
.sg-ed-side .inv-zones input.sg-group { width: 100%; box-sizing: border-box; }
.sg-ed-side .inv-zones tr.sg-comment-row td { padding-top: 0; }
.sg-ed-side .inv-zones tr.sg-comment-row textarea.sg-comment-input { width: 100%; min-width: 0; box-sizing: border-box; }
.sg-ed-side .inv-zones textarea.sg-comment-input { width: 100%; min-width: 180px; box-sizing: border-box; }
.sg-ed-side .sg-row-tools { white-space: nowrap; }
.sg-ed-side .sg-row-tools .sg-mini { padding: 2px 7px; }

.sg-ed-h + .inv-zones-wrap { margin-top: 0; }
.sg-ed-side .hint { margin: 4px 0 14px; }
.sg-ed-main { position: sticky; top: 62px; min-width: 0; }
.sg-ed-main .sg-editor { border-radius: 4px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.sg-ed-help { margin: 6px 0 10px; }
.sg-ed-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr); gap: 16px; align-items: start; }
.sg-ed-bottom .sg-ed-vis { width: 100%; border-radius: 4px; }
.sg-ed-bottom .sg-ai { margin-top: 0; }
@media (max-width: 1100px) {
    .sg-ed-layout { grid-template-columns: 1fr; }
    .sg-ed-main { position: static; order: -1; }
    .sg-ed-bottom { grid-template-columns: 1fr; }
}
.sg-ed-side .sg-num-stats, .sg-ed-side .sg-line-stats, .sg-ed-side .sg-num-dt, .sg-ed-side .sg-line-dt { white-space: nowrap; }

/* Podsumowanie po publikacji raportu (termogramy, czas pracy, czas AI, tokeny). */
.sg-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 8px 0 4px; }
.sg-summary-grid > div { background: #f6f7f9; border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.sg-summary-n { font-size: 22px; font-weight: 700; color: var(--brand-dark); }
.sg-summary-grid small { color: #6b7280; font-size: 12px; margin-top: 4px; }

/* Linie Lx pogrupowane: jedna tabela na grupe kabli jednego obwodu. */
.sg-lgroup { border: 1px solid #dfe2e6; border-radius: 8px; padding: 8px 10px 4px; margin: 0 0 10px; background: #fafbfc; min-width: 0; overflow: hidden; }
.sg-line-groups { min-width: 0; }
.sg-ed-side .sg-lgroup input.sg-line-desc { min-width: 120px; width: 100%; }
.sg-ed-side .sg-lgroup .inv-zones td { white-space: nowrap; }
.sg-ed-side .sg-lgroup .inv-zones td:nth-child(2) { white-space: normal; min-width: 130px; }
.sg-lgroup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.sg-lgroup-title { font-weight: 600; font-size: 14px; padding: 4px 8px; border: 1px solid #c9ccd1; border-radius: 6px; background: #fff; }
.sg-lgroup .inv-zones { margin: 0; }
.sg-ed-side .sg-lgroup .inv-zones-wrap { overflow-x: auto; }

/* historia wyslanych maili (kafelek powiadomienia e-mail na stronie projektu) */
.mail-log-h { font-size: 14px; margin: 18px 0 6px; }
.mail-log td, .mail-log th { font-size: 13px; }
.mail-log-date { white-space: nowrap; }
.mail-ok { color: #2e7d32; font-weight: 600; }
.mail-err { color: #c62828; font-weight: 600; cursor: help; }

/* edytor rozdzielnic: pytanie "czy to ta sama anomalia" (kilka kadrow) */
.sg-dups { margin: 0 0 12px; }
.sg-dup { border-radius: 8px; padding: 10px 12px; margin: 0 0 8px; font-size: 13px; line-height: 1.45; }
.sg-dup-ask { background: #fff8e1; border: 1px solid #f3d27a; }
.sg-dup-linked { background: #eef6ee; border: 1px solid #b9dcb9; }
.sg-dup-q { margin-bottom: 8px; }
.sg-dup .sg-mini { margin: 2px 4px 2px 0; text-align: left; white-space: normal; }
.mail-send-form .mail-attach { display: block; font-size: 13px; margin: 8px 0 2px; }
.mail-send-form .mail-attach input[type=file] { display: block; margin-top: 4px; }

/* ---------------- kalendarz badan cyklicznych */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-head { display: flex; align-items: center; flex-wrap: wrap; }
.cal-title { margin: 0; text-align: center; text-transform: capitalize; border: 0 !important; padding: 0 !important; }

.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-grid th { font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; padding: 4px 6px; text-align: left; }
.cal-grid td { border: 1px solid #e5e7eb; vertical-align: top; padding: 4px 5px; background: #fff; overflow: hidden; }

.cal-grid td.cal-out .cal-day { color: #b0b5bc; }

.cal-day { font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 3px; }
.cal-ev { font-size: 11.5px; line-height: 1.3; padding: 2px 5px; margin: 0 0 3px; border-radius: 4px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev:hover { filter: brightness(0.95); }
.cal-ev-done { background: #e8f5e9; color: #1b5e20; }
.cal-ev-planned { background: #fff3e0; color: #8a4b00; }
.cal-ev-overdue { background: #fdecea; color: #b71c1c; font-weight: 600; }
.cal-ev-mark { display: inline-block; width: 12px; font-weight: 700; }
.cal-ev-type { opacity: .75; }
.cal-legend .cal-ev { display: inline-block; margin-right: 6px; }
.cal-side h2 { margin-top: 0; }

.cal-form label { display: block; font-size: 13px; margin: 0 0 8px; }
.cal-form input, .cal-form select { width: 100%; box-sizing: border-box; }

/* ==========================================================================
   UX panelu (tura 1): linki, lista projektow, kalendarz
   ========================================================================== */
/* Linki tekstowe w panelu: ciemne, bez domyslnego niebieskiego i podkreslenia;
   :where() = zerowa specyficznosc, wiec przyciski-linki (.action-link itd.)
   zachowuja swoje style. */
:where(.admin-body) a { color: var(--brand-dark); text-decoration: none; font-weight: 500; }
:where(.admin-body) a:hover { color: color-mix(in srgb, var(--brand-color) 82%, black); text-decoration: underline; text-underline-offset: 2px; }
:where(.admin-body) a:focus-visible, .admin-body button:focus-visible, .admin-body input:focus-visible,
.admin-body select:focus-visible { outline: 2px solid var(--brand-color); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- lista projektow */
.pl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #eef0f3; }
.pl-title { display: flex; align-items: center; gap: 10px; }
.pl-title h2 { margin: 0; padding: 0; border: 0; font-size: 18px; }
.pl-total { background: #eef0f3; color: #4b5563; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.card .pl-new-btn { background: var(--brand-color); color: #fff; font-weight: 600; padding: 9px 16px; border-radius: 8px; }
.card .pl-new-btn:hover { filter: brightness(0.95); }
.card .pl-new-btn[aria-expanded="true"] { border: 1px solid #c9ccd1; }
.pl-new { background: #f8f9fb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card .pl-new-form { display: block; }
.pl-new-fields { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(260px, 2fr); gap: 12px; margin-bottom: 12px; }
.pl-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: #4b5563; }
.card .pl-field select, .card .pl-field input { width: 100%; font-weight: 400; background: #fff; }
.pl-type-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pl-type { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 11px 12px 11px 34px; background: #fff; border: 1px solid #d7dae0; border-radius: 9px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.pl-type:hover { border-color: #aeb3bb; }
.pl-type input { position: absolute; left: 12px; top: 13px; margin: 0; accent-color: var(--brand-color); }
.card .pl-field .pl-type input { width: auto; }   /* ogolna regula .card .pl-field input (width:100%) stawiala kolko na srodku karty, na tekscie */
.pl-type:has(input:checked) { border-color: var(--brand-color); box-shadow: 0 0 0 3px rgba(var(--brand-color-rgb), .14); }
.pl-type-title { font-size: 13.5px; font-weight: 600; color: #1f2430; }
.pl-type-sub { font-size: 12px; color: #6b7280; }
.pl-new-actions { display: flex; gap: 8px; }

.pl-toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pl-search { flex: 1 1 280px; max-width: 420px; position: relative; }
.pl-search input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid #c9ccd1; border-radius: 8px; font-size: 14px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239ca3af' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; }
.pl-filters { display: flex; gap: 6px; }
.card .pl-chip { background: #fff; color: #374151; border: 1px solid #d7dae0; border-radius: 999px; font-size: 13px; font-weight: 500; }
.card .pl-chip span { color: #9ca3af; font-weight: 600; margin-left: 3px; }
.card .pl-chip:hover { border-color: #aeb3bb; }
.card .pl-chip.is-active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.card .pl-chip.is-active span { color: rgba(255,255,255,.7); }

.pl-table-wrap { overflow-x: auto; }
.pl-table td { vertical-align: middle; padding: 11px 10px; font-size: 13.5px; }
.pl-table th { white-space: nowrap; }
.pl-name { min-width: 220px; }
.pl-name-link { font-weight: 600; font-size: 14px; }
.pl-sub { display: block; font-size: 12px; color: #8a8f98; margin-top: 2px; }
.pl-hidden { color: #8a4b00; font-weight: 600; }
.pl-client { color: #374151; }
.pl-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pl-muted { color: #c0c4ca; }
.pl-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; white-space: nowrap; }
.pl-badge-sg { background: #fff1e8; color: #a33a10; }
.pl-badge-bd { background: #eaf1fb; color: #1e4f8f; }
.pl-badge-pv { background: #eaf6ec; color: #1f6b33; }
.pl-badge-files { background: #f1f2f4; color: #4b5563; }
.pl-badge-m3 { background: #f3eefc; color: #5b3596; }
.pl-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pl-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pl-status-ready { color: #1f7a3a; }
.pl-status-processing { color: #a15c00; }
.pl-status-error { color: #c0392b; }
.pl-status-empty { color: #8a8f98; }
.card .pl-code { background: #f6f7f9; color: #374151; border: 1px dashed #d1d5db; border-radius: 6px; padding: 3px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .03em; cursor: copy; }
.card .pl-code:hover { border-color: var(--brand-color); color: var(--brand-dark); background: #fff; }
.pl-actions { white-space: nowrap; text-align: right; }
.pl-actions .action-link { padding: 6px 12px; font-size: 13px; font-weight: 600; }
.pl-act { display: inline-block; padding: 6px 9px; font-size: 13px; color: #374151 !important; border-radius: 6px; }
.pl-act:hover { background: #eef0f3; text-decoration: none !important; }
.card .pl-del { background: transparent; color: #a8b0ba; padding: 6px 8px; font-size: 13px; }
.card .pl-del:hover { background: #fdecea; color: #c0392b; }
.pl-table tbody tr:hover { background: #fafbfc; }
.pl-empty { text-align: center; color: #6b7280; padding: 26px 10px; font-size: 14px; }
.pl-foot { margin-top: 4px; }
.pl-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #1f2430; color: #fff; padding: 9px 16px;
    border-radius: 8px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 50; }
.pl-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) {
    .pl-new-fields { grid-template-columns: 1fr; }
    .pl-head { flex-wrap: wrap; }
}
/* Jezyki (E1a, R2J-UX-03): "Nowy projekt" z polem "Jezyk raportu" - 3 kolumny w jednym wierszu (tylko firmy z >= 2 jezykami) */
.pl-new-fields.lg-3 { grid-template-columns: minmax(200px, 1fr) minmax(260px, 2fr) minmax(190px, 1fr); }
.pl-new-fields .hint.lg-hint { grid-column: 1 / -1; margin: -4px 0 0; line-height: 1.45; }
@media (max-width: 900px) { .pl-new-fields.lg-3 { grid-template-columns: 1fr 1fr; } .pl-new-fields.lg-3 .pl-field-wide { grid-column: 1 / -1; order: -1; } }
@media (max-width: 760px) { .pl-new-fields.lg-3 { grid-template-columns: 1fr; } .pl-new-fields.lg-3 .pl-field-wide { order: 0; } }
.pd-meta .pd-lang { font-size: 12px; font-weight: 600; color: #374151; background: #eef2f7; padding: 2px 8px; border-radius: 6px; }

/* ---------------- kalendarz (tura 1) */
.cal-head .sg-nav-btn { min-width: 34px; text-align: center; }
.cal-today-btn { display: inline-block; padding: 5px 12px; border: 1px solid #c9ccd1; border-radius: 7px; font-size: 13px; color: var(--brand-dark) !important; background: #fff; }
.cal-today-btn:hover { background: #f3f4f6; text-decoration: none !important; }
.cal-ev { border-left: 3px solid transparent; }
.cal-ev-done { border-left-color: #43a047; }
.cal-ev-planned { border-left-color: #f59e0b; }
.cal-ev-overdue { border-left-color: #e53935; }
.cal-ev, .cal-ev:hover { text-decoration: none !important; }
.cal-side-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 10px; margin-bottom: 6px; border-bottom: 1px solid #eef0f3; }
.cal-side-title h2 { margin: 0; padding: 0; border: 0; }
.cal-pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.cal-pill-overdue { background: #fdecea; color: #b71c1c; }
.cal-up-list { list-style: none; margin: 0; padding: 0; }
.cal-up-list + .cal-up-list { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #e5e7eb; }
.cal-up { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 8px; text-decoration: none !important; color: inherit !important; font-weight: 400 !important; }
.cal-up:hover { background: #f6f7f9; }
.cal-up-date { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 46px; border-radius: 8px; background: #fff3e0; color: #8a4b00; line-height: 1; }
.cal-up-date b { font-size: 17px; }
.cal-up-date i { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.cal-up-date i.cal-up-year { font-size: 9.5px; opacity: .8; }
.cal-up-overdue .cal-up-date { background: #fdecea; color: #b71c1c; }
.cal-up-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-up-client { font-weight: 600; font-size: 14px; color: #1f2430; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-up-meta { font-size: 12px; color: #6b7280; display: flex; align-items: center; gap: 5px; }
.cal-up-when { font-size: 12px; color: #6b7280; white-space: nowrap; text-align: right; }
.cal-up-overdue .cal-up-when { color: #b71c1c; font-weight: 600; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #9ca3af; flex: 0 0 auto; }
.cal-dot-rozdzielnice { background: #e8692e; }
.cal-dot-budynek { background: #3b78c2; }
.cal-dot-pv_dron { background: #2e8b47; }
.cal-dot-model3d { background: #7c4dbf; }
.cal-empty { color: #6b7280; font-size: 13px; padding: 10px 0; }
.card .cal-form { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.cal-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #4b5563; margin: 0 !important; }
.card .cal-f select, .card .cal-f input { width: 100%; font-weight: 400; font-size: 14px; padding: 8px; border: 1px solid #c9ccd1; border-radius: 7px; background: #fff; }
.cal-f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cal-opt { font-weight: 400; color: #9ca3af; font-size: 11px; }
.card .cal-submit { width: 100%; padding: 10px; font-weight: 600; background: var(--brand-color); }
.card .cal-submit:hover { filter: brightness(.95); }
/* stara globalna regula ".admin-body button { width: 100% }" - nowe kontrolki maja wlasna szerokosc */
.card .pl-chip, .card .pl-code, .card .pl-del, .card .pl-new-btn, .pl-new-actions button { width: auto; }
.pl-filters { flex-wrap: wrap; }
@media (max-width: 760px) {
    .pl-filters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; width: 100%; }
    .card .pl-chip { flex: 0 0 auto; }
    .pl-search { max-width: none; }
}
.card #bulk-form { display: block; }

/* ---------------- kalendarz (tura 2) */
.cal-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.cal-kpi { background: #fff; border: 1px solid #e2e4e8; border-radius: 12px; padding: 12px 16px; box-shadow: 0 1px 3px rgba(16,24,40,.05); display: flex; flex-direction: column; gap: 2px; }
.cal-kpi b { font-size: 24px; line-height: 1.1; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.cal-kpi span { font-size: 12.5px; color: #6b7280; }
.cal-kpi-alert { border-color: #f5c2c0; background: #fff7f6; }
.cal-kpi-alert b { color: #b71c1c; }
@media (max-width: 900px) { .cal-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cal-kpi:last-child { display: none; } }

.cal-head { gap: 12px; margin-bottom: 12px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-arrow { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid #d7dae0; font-size: 18px; color: var(--brand-dark) !important; background: #fff; text-decoration: none !important; }
.cal-arrow:hover { background: #f3f4f6; }
.cal-title { min-width: 180px; font-size: 18px !important; }
.cal-legend { margin-left: auto; display: flex; gap: 14px; font-size: 12.5px; color: #4b5563; flex-wrap: wrap; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cal-lg-done { background: #c8e6c9; box-shadow: inset 3px 0 0 #43a047; }
.cal-lg-planned { background: #ffe0b2; box-shadow: inset 3px 0 0 #f59e0b; }
.cal-lg-overdue { background: #ffcdd2; box-shadow: inset 3px 0 0 #e53935; }

.cal-grid th.cal-we-h { color: #a0a6ae; }
.cal-grid td { height: 104px; cursor: pointer; transition: background .1s; }
.cal-grid td:hover { background: #fbfbfc; }
.cal-grid td.cal-we { background: #fcfcfd; }
.cal-grid td.cal-out { background: #f6f7f8; }
.cal-grid td.cal-today { box-shadow: none; background: rgba(var(--brand-color-rgb), .045); }
.cal-grid td.cal-today .cal-day span { background: var(--brand-color); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.cal-grid td.is-picked { box-shadow: inset 0 0 0 2px var(--brand-color); }
.cal-day { display: flex; align-items: center; justify-content: space-between; height: 22px; }
.card .cal-add { width: 22px; height: 22px; padding: 0; border-radius: 6px; background: transparent; color: #9ca3af; font-size: 16px; line-height: 1; opacity: 0; transition: opacity .12s; }
.cal-grid td:hover .cal-add, .card .cal-add:focus-visible { opacity: 1; }
.card .cal-add:hover { background: var(--brand-dark); color: #fff; }
.cal-ev { display: flex; align-items: center; gap: 5px; font-weight: 500 !important; }
.cal-ev .cal-dot { width: 7px; height: 7px; }
.cal-ev-extra { display: none; }
.cal-grid td.is-open .cal-ev-extra { display: flex; }
.card .cal-more { width: auto; background: transparent; color: #4b5563; font-size: 11.5px; font-weight: 600; padding: 1px 4px; }
.card .cal-more:hover { color: var(--brand-dark); text-decoration: underline; background: transparent; }
.cal-note { font-size: 12px; color: #8a8f98; margin: 12px 0 0; line-height: 1.6; }
.cal-note .cal-dot { margin-left: 4px; }
.cal-flash { box-shadow: 0 0 0 3px rgba(var(--brand-color-rgb), .35); transition: box-shadow .3s; }
@media (max-width: 760px) {
    .cal-grid td { padding: 3px; }
    .cal-ev { font-size: 0; padding: 3px; justify-content: center; }
    .cal-ev .cal-dot { width: 8px; height: 8px; }
    .cal-legend { margin-left: 0; width: 100%; }
    .card .cal-add { display: none; }
}

/* ---------------- profil klienta w kalendarzu (tura 2) */
.cc-back { display: inline-block; margin: 0 0 10px; font-size: 13.5px; color: #4b5563 !important; }
.cc-hero { padding: 20px 22px; }
.cc-id { display: flex; align-items: center; gap: 14px; }
.cc-avatar { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-dark); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; letter-spacing: .02em; flex: 0 0 auto; }
.cc-name { margin: 0; font-size: 22px; }
.cc-meta { margin: 3px 0 0; font-size: 13.5px; color: #6b7280; }
.cc-add-btn { margin-left: auto; background: var(--brand-color); color: #fff !important; padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 14px; text-decoration: none !important; white-space: nowrap; }
.cc-add-btn:hover { filter: brightness(.95); }
.cc-stats { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.cc-stat { background: #f8f9fb; border: 1px solid #eceef1; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.cc-stat b { font-size: 20px; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.cc-stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 600; }
.cc-stat-sub { font-size: 12.5px; color: #6b7280; }
.cc-stat-next { background: #fff7ed; border-color: #fde3c4; }
.cc-stat-next b { color: #8a4b00; }
.cc-stat-overdue { background: #fff5f4; border-color: #f5c2c0; }
.cc-stat-overdue b { color: #b71c1c; }
.cc-count { display: inline-block; background: #eef0f3; color: #4b5563; font-size: 12px; padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.cc-list { list-style: none; margin: 0; padding: 0; }
.cc-item { border-bottom: 1px solid #eef0f3; }
.cc-item:last-child { border-bottom: 0; }
.cc-item-main { display: flex; align-items: flex-start; gap: 14px; padding: 12px 2px; }
.cc-date { flex: 0 0 auto; width: 58px; height: 54px; border-radius: 10px; background: #fff3e0; color: #8a4b00; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.cc-date b { font-size: 19px; }
.cc-date i { font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; margin-top: 3px; }
.cc-date-done { background: #e8f5e9; color: #1b5e20; }
.cc-item-overdue .cc-date { background: #fdecea; color: #b71c1c; }
.cc-item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 4px; }
.cc-item-title { font-weight: 600; font-size: 14.5px; color: #1f2430; }
.cc-item-meta { font-size: 12.5px; color: #6b7280; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.cc-notes { color: #4b5563; font-style: italic; }
.cc-overdue { color: #b71c1c; }
.cc-open { flex: 0 0 auto; align-self: center; font-size: 13px; padding: 6px 10px; border-radius: 7px; border: 1px solid #d7dae0; color: var(--brand-dark) !important; text-decoration: none !important; white-space: nowrap; }
.cc-open:hover { background: #f3f4f6; }
.cc-edit { flex: 0 0 auto; align-self: center; }
.cc-edit summary { list-style: none; cursor: pointer; font-size: 13px; padding: 6px 12px; border-radius: 7px; border: 1px solid #d7dae0; color: var(--brand-dark); user-select: none; }
.cc-edit summary::-webkit-details-marker { display: none; }
.cc-edit summary:hover { background: #f3f4f6; }
.cc-edit[open] summary { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.cc-item:has(.cc-edit[open]) .cc-item-main { flex-wrap: wrap; }
.cc-edit[open] { flex-basis: 100%; order: 3; }
.cc-edit[open] summary { display: inline-block; }
.cc-edit-panel { margin-top: 10px; background: #f8f9fb; border: 1px solid #eceef1; border-radius: 10px; padding: 14px; }
.card .cc-edit-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.card .cc-edit-form button { width: auto; justify-self: start; }
.cc-edit-more { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.card .cc-edit-more form { display: inline; }
.card .cc-link-btn { width: auto; background: transparent; color: #4b5563; padding: 2px 0; font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.card .cc-link-btn:hover { background: transparent; color: var(--brand-dark); }
.card .cc-link-btn.cc-danger { color: #b42318; }
.card .cc-item-main > form { display: block; align-self: center; }
.cc-help { font-size: 13px; color: #6b7280; margin: -4px 0 12px; }
.card .cc-add-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.cc-wide { grid-column: span 3; }
@media (min-width: 900px) { .cc-wide { grid-column: span 1; } .card .cc-add-form { grid-template-columns: 1fr 1fr 1fr 1.4fr 1.4fr auto; } }
.card .cc-submit { width: auto; padding: 9px 16px; font-weight: 600; background: var(--brand-color); }
.cc-projects { list-style: none; margin: 0; padding: 0; }
.cc-projects li { padding: 8px 0; border-bottom: 1px solid #eef0f3; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.cc-projects li:last-child { border-bottom: 0; }
@media (max-width: 760px) {
    .cc-id { flex-wrap: wrap; }
    .cc-add-btn { margin-left: 0; }
    .cc-stats { grid-template-columns: 1fr 1fr; }
    .cc-stat-next { grid-column: span 2; }
    .card .cc-add-form { grid-template-columns: 1fr; }
    .cc-wide { grid-column: span 1; }
}

/* ---------------- telefon (tura 2): naglowek panelu i lista projektow jako karty */
@media (max-width: 640px) {
    .admin-header-title { display: none; }
    .admin-header-brand .admin-logo { max-width: 170px; }
    .admin-nav { gap: 2px; }
    .admin-wrap { padding: 0 12px; }

    .pl-table-wrap { overflow: visible; }
    .pl-table, .pl-table tbody { display: block; white-space: normal; }
    .pl-table thead { display: none; }
    .pl-table tr { display: grid; grid-template-columns: 26px 1fr auto; gap: 4px 10px; align-items: center;
        padding: 12px 4px; border-bottom: 1px solid #eef0f3; }
    .pl-table td { display: block; padding: 0; border: 0; }
    .pl-table td.check-col { grid-row: 1 / span 2; align-self: start; padding-top: 2px; }
    .pl-table td.pl-name { grid-column: 2 / span 2; min-width: 0; }
    .pl-table td.pl-client { grid-column: 2; font-size: 13px; }
    .pl-table td:nth-child(4) { grid-column: 3; grid-row: 2; justify-self: end; }
    .pl-table td.pl-date { grid-column: 2; font-size: 13px; color: #4b5563; }
    .pl-table td.pl-date::before { content: "Badanie: "; color: #8a8f98; }
    .pl-table td:nth-child(6) { grid-column: 3; justify-self: end; }
    .pl-table td:nth-child(7) { grid-column: 2; }
    .pl-table td.pl-actions { grid-column: 2 / span 2; text-align: left; white-space: normal; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; }
    .pl-head .pl-new-btn { padding: 8px 12px; }
}

/* ==========================================================================
   Widok klienta (tura 1): lista projektow + pasek gorny stron klienta
   ========================================================================== */
.cl-body { background: #eef1f5; min-height: 100vh; }
/* pasek gorny na przewijanych stronach klienta: w przeplywie strony (nie
   absolute jak nad mapa), przyklejony do gory na desktopie */
.cl-body #topbar, .sg-client-body #topbar { position: sticky; top: 0; }
.cl-topbar { padding: 12px 20px; }
.cl-topbar .topbar-logo { height: 26px; }
:where(.cl-body) a { color: var(--brand-dark); }
.cl-body .logout-link, .sg-client-body .logout-link { color: #fff; border: 1px solid rgba(255,255,255,.35); padding: 6px 12px; border-radius: 6px; }
.cl-body .logout-link:hover, .sg-client-body .logout-link:hover { background: rgba(255,255,255,.12); }
.cl-wrap { max-width: 1040px; margin: 0 auto; padding: 26px 20px 60px; }
.cl-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 28px; margin-bottom: 22px; }
.cl-hero h1 { margin: 4px 0 4px; font-size: 28px; color: var(--brand-dark); line-height: 1.15; }
.cl-hero-sub { margin: 0; color: #6b7280; font-size: 14.5px; }
.cl-next { background: #fff; border: 1px solid #e2e4e8; border-radius: 12px; padding: 12px 16px; min-width: 300px; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
.cl-next-label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 600; margin-bottom: 6px; }
.cl-next ul { list-style: none; margin: 0; padding: 0; }
.cl-next li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; }
.cl-next-type { color: #374151; }
.cl-next li b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--brand-dark); }
.cl-next-when { font-size: 12.5px; color: #6b7280; min-width: 78px; text-align: right; }
.cl-next-overdue b, .cl-next-overdue .cl-next-when { color: #b71c1c; }
.cl-next-cta { display: inline-block; margin-top: 8px; font-size: 13.5px; font-weight: 600; color: var(--brand-color) !important; text-decoration: none; }
.cl-next-cta:hover { text-decoration: underline; }

.cl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.cl-card { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 4px 16px; align-items: center;
    background: #fff; border: 1px solid #e2e4e8; border-radius: 14px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(16,24,40,.05);
    transition: border-color .12s, box-shadow .12s; }
.cl-card:hover { border-color: #cfd3da; box-shadow: 0 4px 14px rgba(16,24,40,.07); }
.cl-card-off { background: #fafbfc; }

.cl-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; align-self: start; }
.cl-icon-sg { background: #fff1e8; color: #a33a10; }
.cl-icon-bd { background: #eaf1fb; color: #1e4f8f; }
.cl-icon-pv { background: #eaf6ec; color: #1f6b33; }
.cl-icon-files { background: #f1f2f4; color: #4b5563; }
.cl-icon-m3 { background: #f3eefc; color: #5b3596; }
.cl-main { min-width: 0; }
.cl-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 5px; }
.cl-date { font-size: 13px; color: #6b7280; font-variant-numeric: tabular-nums; }
.cl-flag { font-size: 12px; font-weight: 600; color: #8a4b00; background: #fff3e0; padding: 2px 8px; border-radius: 6px; }
.cl-flag-off { color: #b71c1c; background: #fdecea; }
.cl-title { margin: 0; font-size: 17px; line-height: 1.3; }
.cl-title a { color: #1f2430 !important; text-decoration: none; }
.cl-title a:hover { color: var(--brand-dark) !important; text-decoration: underline; text-underline-offset: 3px; }
.cl-results { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cl-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: #f3f4f6; color: #374151; white-space: nowrap; }
.cl-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cl-pill b { font-variant-numeric: tabular-nums; }
.cl-pill-p1, .cl-pill-c3 { background: #fdecea; color: #b71c1c; }
.cl-pill-p2 { background: #fff0e0; color: #a84d08; }
.cl-pill-p3, .cl-pill-c2 { background: #fff8e1; color: #8a6100; }
.cl-pill-p4, .cl-pill-c1 { background: #ecf6ee; color: #1f6b33; }
.cl-pill-obs { background: #eef2f5; color: #455a64; }
.cl-pill-ok { background: #ecf6ee; color: #1f6b33; font-weight: 600; }
.cl-meta { margin: 8px 0 0; font-size: 13px; color: #6b7280; }
.cl-meta:empty { display: none; }
.cl-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 150px; }
.cl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 9px;
    font-size: 14px; font-weight: 600; text-decoration: none !important; white-space: nowrap;
    border: 1px solid #d7dae0; background: #fff; color: var(--brand-dark) !important; }
.cl-btn:hover { background: #f3f4f6; }
.cl-btn-primary { background: var(--brand-color); border-color: var(--brand-color); color: var(--brand-fill-text, #fff) !important; }
.cl-btn-primary:hover { background: color-mix(in srgb, var(--brand-color) 86%, black); }
.cl-off-note { font-size: 13px; color: #6b7280; max-width: 220px; text-align: right; }
.cl-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    border-top: 1px dashed #e5e7eb; font-size: 13px; color: #4b5563; }
.cl-code { width: auto; background: #f6f7f9; color: #1f2430; border: 1px dashed #c9ccd1; border-radius: 6px; padding: 3px 9px; cursor: copy;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; letter-spacing: .04em; }
.cl-code:hover { border-color: var(--brand-color); background: #fff; }

.cl-empty { background: #fff; border: 1px dashed #d1d5db; border-radius: 14px; padding: 30px 22px; text-align: center; color: #4b5563; }
.cl-help { margin-top: 22px; text-align: center; font-size: 13.5px; color: #6b7280; }
@media (max-width: 640px) {
    .cl-body #topbar, .sg-client-body #topbar { position: relative; }
    .cl-topbar { flex-wrap: nowrap !important; }
    .cl-topbar .topbar-left { width: auto !important; }
    .cl-topbar .topbar-right { width: auto !important; overflow: visible !important; }
    .cl-wrap { padding: 18px 14px 40px; }
    .cl-hero h1 { font-size: 23px; }
    .cl-next { min-width: 0; width: 100%; }
    .cl-card { grid-template-columns: 40px minmax(0, 1fr); padding: 15px 14px; gap: 4px 12px; }
    .cl-icon { width: 40px; height: 40px; border-radius: 10px; }
    .cl-actions { grid-column: 1 / -1; flex-direction: row; margin-top: 12px; min-width: 0; }
    .cl-actions .cl-btn { flex: 1 1 0; padding: 10px 10px; }
    .cl-off-note { text-align: left; max-width: none; }
    
}

/* ---------------- widok raportu klienta (tura 1): naglowek, nawigacja, spis */

.sg-hero { padding: 22px 4px 4px; }
.sg-hero-addr { margin: 0 0 4px; color: #4b5563; font-size: 15px; }
.sg-facts { display: grid; gap: 10px; margin: 16px 0 0; }
.sg-facts > div { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; min-width: 0; }
.sg-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 600; }
.sg-facts dd { margin: 3px 0 0; font-size: 14.5px; font-weight: 600; color: #1f2430; overflow-wrap: anywhere; }
.sg-facts dd small { display: block; font-weight: 400; font-size: 12.5px; color: #6b7280; margin-top: 1px; }
.sg-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sg-jump a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; background: #fff; border: 1px solid #d7dae0;
    color: var(--brand-dark); font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.sg-jump a:hover { border-color: var(--brand-dark); }
.sg-jump a span { background: #eef0f3; color: #4b5563; border-radius: 999px; padding: 0 7px; font-size: 12px; }

.sg-stat-zero .sg-stat-n { color: #6b7280; }
.sg-h-count { display: inline-block; background: #eef0f3; color: #4b5563; font-size: 12px; padding: 1px 8px; border-radius: 999px; margin-left: 4px; vertical-align: 2px; font-weight: 600; }
.sg-toc ol.sg-units { columns: auto; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.sg-unit { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid #e5e7eb; border-radius: 9px; text-decoration: none; color: #1f2430; height: 100%; }
.sg-unit:hover { border-color: var(--brand-dark); background: #fafbfc; }
.sg-unit-name { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 14px; }
.sg-unit-name small { display: block; font-weight: 400; color: #6b7280; font-size: 12px; }
.sg-unit-n { font-size: 12px; color: #6b7280; white-space: nowrap; }
.sg-unit-ok { color: #2e7d32; font-weight: 700; width: 22px; text-align: center; }
.sg-totop { position: fixed; right: 18px; bottom: 18px; width: 44px; height: 44px; border-radius: 50%; background: var(--brand-dark); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 20px; text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.2);
    opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 900; }
.sg-totop.is-on { opacity: .9; pointer-events: auto; }

@media (max-width: 640px) {
    .sg-client { padding: 10px 12px 50px; }
    .sg-jump { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; margin-right: -12px; }
    .sg-card { padding: 14px 14px; }
    /* wykaz anomalii jako karty zamiast tabeli przewijanej w poziomie */
    .sg-table.sg-cards-m, .sg-cards-m tbody { display: block; }
    .sg-cards-m tr:first-child { display: none; }
    .sg-cards-m tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 2px; border-bottom: 1px solid #eef0f3; }
    .sg-cards-m td { display: block; padding: 0; border: 0; font-size: 13.5px; }
    .sg-cards-m td[data-label]::before { content: attr(data-label) " "; font-size: 12px; }
    .sg-cards-m td[data-label]:empty { display: none; }
    .sg-cards-m td.sg-c-loc { font-weight: 600; flex: 1 1 auto; }
    .sg-cards-m td.sg-c-com { flex-basis: 100%; color: #374151; }
}
/* miejsce na obrazy przed ich (leniwym) wczytaniem - inaczej skok do
   termogramu z wykazu anomalii laduje w zlym miejscu, bo obrazy nad nim
   doczytuja sie i przesuwaja tresc */
.sg-thermo-imgs img { aspect-ratio: auto 16 / 10; height: auto; background: #e5e7eb; }
.sg-thermo-imgs img.sg-vis { aspect-ratio: auto 4 / 3; }
:where(.sg-client) a { color: var(--brand-dark); text-underline-offset: 2px; }
@media (max-width: 640px) {
    .sg-cards-m td.sg-c-prio { order: 0; }
    .sg-cards-m td.sg-c-loc { order: 1; }
    .sg-cards-m td[data-label] { order: 2; }
    .sg-cards-m td.sg-c-com { order: 3; }
}

/* ---------------- widok raportu klienta (tura 2) */
.sg-facts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
/* pasek sekcji przyklejony pod paskiem gornym, z podswietleniem biezacej sekcji */
.sg-jump { position: sticky; top: var(--tb-h, 0px); z-index: 950; margin: 14px -16px 0; padding: 8px 16px;
    background: rgba(243, 244, 246, .94); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    scrollbar-width: none; }
.sg-jump::-webkit-scrollbar { display: none; }
.sg-jump a.is-active { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.sg-jump a.is-active span { background: rgba(255,255,255,.2); color: #fff; }
.sg-client [id] { scroll-margin-top: calc(var(--tb-h, 0px) + 62px); }
.sg-client-body .topbar-right { scrollbar-width: none; }
.sg-client-body .topbar-right::-webkit-scrollbar { display: none; }
@media (max-width: 900px) { .sg-facts > div:first-child { grid-column: auto; } }
@media (max-width: 640px) {
    /* fakty: jedna zwarta karta 2 x N zamiast pieciu osobnych kafelkow */
    .sg-facts { grid-template-columns: 1fr 1fr; gap: 10px 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
    .sg-facts > div { background: none; border: 0; padding: 0; border-radius: 0; }
    .sg-facts dd { font-size: 14px; }
    .sg-jump { margin: 10px -12px 0; padding: 8px 12px; }
    .sg-hero { padding-top: 12px; }
    .sg-hero h1 { margin-bottom: 2px; }
}
.bd-cls, .sg-prio { white-space: nowrap; }
.cl-toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.cl-toolbar input { flex: 1 1 260px; max-width: 380px; padding: 9px 12px 9px 34px; border: 1px solid #c9ccd1; border-radius: 9px; font-size: 15px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239ca3af' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; }
.cl-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cl-chip { background: #fff; color: #374151; border: 1px solid #d7dae0; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; }
.cl-chip:hover { border-color: #aeb3bb; }
.cl-chip.is-active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.cl-card[hidden] { display: none; }
.cl-none { text-align: center; color: #6b7280; padding: 20px 0; }
@media (max-width: 640px) {
    .cl-toolbar input { max-width: none; font-size: 16px; }
    .cl-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
    .cl-chip { flex: 0 0 auto; }
}
.cl-info { font-size: 13px; color: #4b5563; background: #fff; border: 1px solid #e5e7eb; border-left: 3px solid var(--brand-dark); border-radius: 8px; padding: 9px 12px; margin: 0 0 14px; }
.cl-foot { margin-top: 10px; padding-top: 10px; }

/* ==========================================================================
   Strona projektu w panelu (tura 1): naglowek, etapy, nawigacja, opisy
   ========================================================================== */
/* kolumny siatki nie rozpychaja sie szerokimi tabelami (telefon: poziomy scroll strony) */
.project-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.project-cards .card { min-width: 0; }
@media (max-width: 900px) {
    .project-cards { grid-template-columns: minmax(0, 1fr); }
    .project-cards .projects-table, .project-cards .inv-zones { display: block; overflow-x: auto; white-space: nowrap; }
}

.pd-hero { padding: 20px 22px 18px; }
.pd-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.pd-hero-id { min-width: 0; flex: 1 1 420px; }
.pd-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pd-flag { font-size: 12px; font-weight: 600; color: #8a4b00; background: #fff3e0; padding: 2px 8px; border-radius: 6px; }
.pd-title { margin: 8px 0 4px; font-size: 24px; line-height: 1.2; color: #1f2430; overflow-wrap: anywhere; }
.pd-meta { margin: 0; font-size: 14px; color: #4b5563; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.card .pd-meta .pl-code { width: auto; padding: 2px 8px; }
.pd-layers { display: flex; gap: 6px; margin: 10px 0 0; }
.pd-layers span { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #f1f2f4; text-decoration: line-through; }
.pd-layers span.is-on { background: #eaf6ec; color: #1f6b33; text-decoration: none; }
.pd-layers span.is-on::before { content: "✓ "; }
.pd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pd-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; gap: 6px; border-radius: 8px; border: 1px solid var(--line-strong, #8f949c); background: var(--surface, #fff);
    color: var(--brand-dark) !important; font-size: 14px; font-weight: 600 !important; text-decoration: none !important; white-space: nowrap; }
.pd-btn:hover { background: var(--surface-2, #f8f9fb); }
.pd-btn-primary { background: var(--btn-primary-bg, var(--brand-fill)); border-color: var(--btn-primary-bg, var(--brand-fill)); color: var(--btn-primary-fg, #fff) !important; }
.pd-btn-primary:hover { background: color-mix(in srgb, var(--btn-primary-bg, var(--brand-fill)) 90%, black); }

.pd-steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; counter-reset: none; }
.pd-steps a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid #e5e7eb; background: #f8f9fb;
    color: #4b5563 !important; text-decoration: none !important; font-weight: 400 !important; height: 100%; }
.pd-steps a:hover { border-color: #c9ccd1; }
.pd-steps b { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; background: #e5e7eb; color: #6b7280; }
.pd-steps span { display: flex; flex-direction: column; font-size: 13.5px; font-weight: 600; color: #374151; min-width: 0; }
.pd-steps small { font-size: 12px; font-weight: 400; color: #6b7280; }
.pd-steps li.is-done a { background: #f2f9f3; border-color: #cfe8d4; }
.pd-steps li.is-done b { background: #2e7d32; color: #fff; font-size: 0; }
.pd-steps li.is-done b::before { content: "✓"; font-size: 14px; }
.pd-steps li.is-current a { background: #fff; box-shadow: 0 0 0 3px rgba(var(--brand-color-rgb), .12); }
.pd-steps li.is-current b { background: var(--brand-color); color: #fff; }
.pd-steps li.is-error a { background: #fff5f4; border-color: #f5c2c0; }
.pd-steps li.is-error b { background: #c0392b; color: #fff; }
.pd-alert { margin: 12px 0 0; padding: 9px 12px; border-radius: 8px; background: #fff7ed; border: 1px solid #fde3c4; font-size: 13.5px; color: #5b3a12; }

.pd-jump { position: sticky; top: 0; z-index: 40; display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 14px; padding: 8px 0;
    background: rgba(238, 241, 245, .94); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); scrollbar-width: none; }
.pd-jump::-webkit-scrollbar { display: none; }
.pd-jump a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; background: #fff; border: 1px solid #d7dae0;
    font-size: 13.5px; font-weight: 600; color: var(--brand-dark); text-decoration: none !important; white-space: nowrap; }
.pd-jump a:hover { border-color: var(--brand-dark); }
.pd-jump a span { background: #eef0f3; color: #4b5563; border-radius: 999px; padding: 0 7px; font-size: 12px; }
.pd-jump a.is-active { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.pd-jump a.is-active span { background: rgba(255,255,255,.2); color: #fff; }
.project-cards .cards-group-title { scroll-margin-top: 64px; }

.pd-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 2px; }
.pd-clamp.is-open { display: block; }
.card .pd-more { width: auto; background: transparent; padding: 0; margin: 0 0 12px; font-size: 12.5px; font-weight: 600; text-underline-offset: 2px; }
.card .pd-more:hover { background: transparent; }
.pd-muted-card { background: #fafbfc; }
@media (max-width: 760px) {
    .pd-steps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .pd-title { font-size: 20px; }
    .pd-actions { width: 100%; }
    .pd-actions .pd-btn { flex: 1 1 auto; justify-content: center; }
    .pd-jump { flex-wrap: nowrap; overflow-x: auto; }
}
.pd-steps li.is-warn a { background: #fffaf0; border-color: #f5d9a8; }
.pd-steps li.is-warn b { background: #f59e0b; }

/* ==========================================================================
   Edytor termogramu - weryfikacja anomalii (tura 1)
   ========================================================================== */
.sg-ed-top { background: rgba(238, 241, 245, .95); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); margin: 0 -20px 10px; padding: 10px 20px;
    border-bottom: 1px solid #e2e4e8; top: 0; z-index: 60; }
.sg-ed-top .sg-nav-link { font-size: 14px; color: #4b5563; }
.admin-body .sg-save-bar button, .admin-body .sg-ed-nav button { width: auto; }
.sg-save-bar #sg-save:not(:disabled) { box-shadow: 0 0 0 3px rgba(var(--brand-color-rgb), .2); }
.sg-ed-nav select { padding: 7px 8px; border: 1px solid #c9ccd1; border-radius: 7px; font-size: 13.5px; background: #fff; }
.sg-ed-head { position: relative; padding-bottom: 12px; gap: 6px 14px; }
.sg-ed-head h1 { font-size: 22px; }
.sg-ed-of { color: #9ca3af; font-weight: 500; font-size: 17px; }
.sg-ed-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #eef0f3; border-radius: 4px; overflow: hidden; }
.sg-ed-progress i { display: block; height: 100%; background: var(--brand-color); border-radius: 4px; }
.sg-ed-op { margin: 12px 0 4px; padding: 9px 12px; background: #f6f7f9; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 14px; color: #1f2430; }
.sg-ed-op span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 600; margin-bottom: 2px; }
.sg-ed-row { padding: 10px 0 4px; }
.card .sg-ed-row select { min-width: 260px; }

/* narzedzia nad termogramem: kompaktowe przyciski zamiast pelnej szerokosci */
.sg-ed-tools { gap: 8px 12px; margin-bottom: 8px; }
.card .sg-ed-tools button { width: auto; padding: 7px 13px; font-size: 13.5px; font-weight: 600; border-radius: 8px; }
.card .sg-ed-tools #sg-new-box { background: var(--brand-dark); color: #fff; }
.card .sg-ed-tools #sg-new-line { background: #fff; color: var(--brand-dark); border: 1px solid #c9ccd1; }
.card .sg-ed-tools button.is-active { background: #fff7d6 !important; color: #5b4500 !important; border: 1px dashed #d4a20a !important; }
.sg-ed-tools label.hint { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* tabele Bx/Lx: temperatury w dwoch liniach, waskie usun */
.sg-ed-side .inv-zones th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; background: #f8f9fb; white-space: nowrap; }
.sg-ed-side .inv-zones th small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.sg-num-stats b, .sg-line-stats b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sg-num-stats small, .sg-line-stats small { display: block; font-size: 11px; color: #8a8f98; font-variant-numeric: tabular-nums; }
.sg-num-dt, .sg-line-dt { font-weight: 600; font-variant-numeric: tabular-nums; }

.card .sg-del-x { width: 26px; height: 26px; padding: 0; border-radius: 6px; background: transparent; color: #9ca3af; font-size: 17px; line-height: 1; border: 1px solid transparent; }
.card .sg-del-x:hover { background: #fdecea; color: #c0392b; border-color: #f5c2c0; }
.sg-ed-h { display: flex; align-items: center; gap: 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: #4b5563; margin: 6px 0 4px; }

/* objasnienia na zadanie */
.sg-help { margin: 4px 0 14px; }
.sg-help summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: #4b5563; list-style: none; display: inline-flex; align-items: center; gap: 6px; user-select: none; }
.sg-help summary::-webkit-details-marker { display: none; }
.sg-help summary::before { content: "?"; width: 17px; height: 17px; border-radius: 50%; border: 1px solid #c9ccd1; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: #6b7280; }
.sg-help summary:hover { color: var(--brand-dark); }
.sg-help[open] summary { color: var(--brand-dark); }
.sg-help p.hint { margin: 6px 0 0 !important; padding: 8px 10px; background: #f8f9fb; border-radius: 8px; line-height: 1.5; }
.sg-keys { margin: 6px 0 0; font-size: 12.5px; color: #4b5563; }
kbd { display: inline-block; min-width: 20px; padding: 1px 5px; border: 1px solid #c9ccd1; border-bottom-width: 2px; border-radius: 4px; background: #fff;
    font: 600 11.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: center; color: #374151; }
.sg-photo-comment { font-weight: 600; color: #4b5563; }
.sg-ai h2 { font-size: 14px; border: 0; padding: 0; }
.card .sg-ai button { width: auto; }
@media (max-width: 760px) {
    .sg-ed-top { margin: 0 -12px 10px; padding: 8px 12px; }
    .card .sg-ed-row select { max-width: 100%; }
    
}

/* ---------------- tura 2: strona projektu */
.project-cards .card button { width: auto; }
.pd-report-ok { margin: 0 0 10px; padding: 9px 12px; border-radius: 8px; background: #f2f9f3; border: 1px solid #cfe8d4; font-size: 13.5px; color: #1f4d2a; }
.pd-manual { margin-top: 12px; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 14px; background: #fafbfc; }
.pd-manual summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: #4b5563; }
.pd-manual[open] summary { margin-bottom: 8px; color: var(--brand-dark); }

/* ---------------- tura 2: edytor termogramu */
.sg-ed-side .inv-zones input.sg-group { min-width: 130px; }
.sg-ed-side .inv-zones select { max-width: 104px; }
.sg-ed-side .inv-zones td, .sg-ed-side .inv-zones th { padding: 5px 5px; }
.sg-verdict { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #eef0f3; color: #4b5563; white-space: nowrap; }
.sg-verdict:empty { display: none; }
.sg-verdict-p1, .sg-verdict-c3 { background: #fdecea; color: #b71c1c; }
.sg-verdict-p2 { background: #fff0e0; color: #a84d08; }
.sg-verdict-p3, .sg-verdict-c2 { background: #fff8e1; color: #8a6100; }
.sg-verdict-p4, .sg-verdict-c1 { background: #ecf6ee; color: #1f6b33; }
.sg-verdict-obs { background: #eef2f5; color: #455a64; }
.sg-verdict-ok { background: #ecf6ee; color: #1f6b33; }
.admin-body .sg-save-bar .sg-save-next { width: auto; background: var(--brand-color); color: #fff; font-weight: 700; }
.admin-body .sg-save-bar .sg-save-next:hover { background: color-mix(in srgb, var(--brand-color) 86%, black); }
.admin-body .sg-save-bar #sg-save { background: var(--brand-dark); }

/* ==========================================================================
   Przeglad raportu w generatorze (rozdzielnice, budynek) - tura 1
   ========================================================================== */
.jb-stats { display: grid; grid-template-columns: 1fr 1fr 2fr 1fr; gap: 10px; margin-top: 16px; }
.jb-stats > div { background: #f8f9fb; border: 1px solid #eceef1; border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jb-stats b { font-size: 22px; color: var(--brand-dark); font-variant-numeric: tabular-nums; line-height: 1.1; }
.jb-stats span { font-size: 12.5px; color: #6b7280; }
.jb-stats small { font-size: 12px; color: #8a8f98; }
.jb-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.jb-pills .cl-pill b { font-size: 12.5px; color: inherit; }
.jb-stat-alert { background: #fff7ed !important; border-color: #fde3c4 !important; }
.jb-check { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #eef0f3; font-size: 13.5px; }
.jb-check-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 600; margin-right: 4px; }
.jb-check .is-ok, .jb-check .is-bad { display: inline-flex; align-items: center; gap: 6px; color: #374151; }
.jb-check .is-ok::before { content: "✓"; width: 18px; height: 18px; border-radius: 50%; background: #2e7d32; color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.jb-check .is-bad::before { content: "!"; width: 18px; height: 18px; border-radius: 50%; background: #c0392b; color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.jb-check .is-bad { color: #9b1c1c; font-weight: 600; }
.jb-check .is-bad a { color: #9b1c1c !important; text-decoration: underline; }
.jb-jump { position: static; }

/* przyklejony pasek akcji formularza */
.card.jb-actions { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 16px;
    box-shadow: 0 4px 14px rgba(16, 24, 40, .08); }
.jb-actions-sp { flex: 1 1 auto; }
.card.jb-actions button { width: auto; padding: 9px 15px; font-size: 14px; font-weight: 600; border-radius: 8px; }
.card.jb-actions .jb-save { background: var(--brand-dark); }
.card.jb-actions .jb-publish { background: var(--brand-color); }
.card.jb-actions .jb-publish:hover { background: color-mix(in srgb, var(--brand-color) 86%, black); }
.jb-regen { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; }

/* siatka miniatur termogramow */
.jb-th-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #eef0f3; }
.jb-th-head h2 { margin: 0; padding: 0; border: 0; }
.card .jb-filter .cl-chip { width: auto; }
.cl-chip span { color: #9ca3af; font-weight: 600; margin-left: 2px; }
.cl-chip.is-active span { color: rgba(255,255,255,.7); }
.jb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.jb-unit { grid-column: 1 / -1; margin: 8px 0 -2px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #4b5563; }
.jb-unit:first-child { margin-top: 0; }
.jb-unit[hidden], .jb-tile[hidden] { display: none; }
.jb-tile { display: flex; flex-direction: column; gap: 5px; padding: 6px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff;
    color: #1f2430 !important; text-decoration: none !important; font-weight: 400 !important; transition: border-color .12s, box-shadow .12s; }
.jb-tile:hover { border-color: var(--brand-dark); box-shadow: 0 3px 10px rgba(16,24,40,.08); }
.jb-thumb { display: block; aspect-ratio: 4 / 3; background: #1b1b1f; border-radius: 6px; overflow: hidden; }
.jb-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.jb-tile-row { display: flex; align-items: center; gap: 6px; padding: 0 2px; }
.jb-tile-row b { font-size: 14px; font-variant-numeric: tabular-nums; margin-right: auto; }
.jb-tile small { font-size: 11.5px; color: #8a8f98; padding: 0 2px 2px; }
.jb-ok { font-size: 11.5px; font-weight: 700; color: #2e7d32; }
.jb-warn { font-size: 11px; font-weight: 600; color: #8a4b00; background: #fff3e0; padding: 0 5px; border-radius: 5px; }
.jb-com { font-size: 12px; font-weight: 700; color: #8a4b00; }
.jb-tile.is-out { background: #fafbfc; }
.jb-tile.is-out .jb-thumb { opacity: .45; }

/* koszty na dole, usuwanie raportu */
.jb-costs > summary { cursor: pointer; font-weight: 600; color: #4b5563; font-size: 14px; }
.jb-costs[open] > summary { margin-bottom: 12px; }
.jb-summary h2 { font-size: 14px; }
.jb-delete { margin-top: 8px; }
.admin-body .jb-delete button { width: auto; background: transparent; color: #b42318; border: 1px solid #f5c2c0; padding: 7px 14px; font-size: 13px; }
.admin-body .jb-delete button:hover { background: #fdecea; }
@media (max-width: 900px) { .jb-stats { grid-template-columns: 1fr 1fr; } .jb-stat-wide { grid-column: span 2; } }
@media (max-width: 640px) {
    .card.jb-actions { position: static; }
    .jb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .card .jb-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
    .card .jb-filter .cl-chip { flex: 0 0 auto; }
}
.card .cl-chip { width: auto; background: #fff; color: #374151; border: 1px solid #d7dae0; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 500; }
.card .cl-chip:hover { border-color: #aeb3bb; }
.card .cl-chip.is-active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
@media (max-width: 900px) {
    #inv-form .inv-zones, #historia .inv-zones { display: block; overflow-x: auto; }
}
@media (max-width: 640px) {
    .card.jb-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .card.jb-actions .jb-actions-sp, .card.jb-actions #inv-saving[hidden] { display: none; }
    .card.jb-actions .pd-btn, .card.jb-actions button { justify-content: center; width: 100%; }
    .card.jb-actions .jb-regen { grid-column: 1 / -1; order: 5; }
}
.jb-grid-sg .jb-thumb { aspect-ratio: 16 / 10; }
.jb-grid-bd .jb-thumb { aspect-ratio: 5 / 4; }

/* ---------------- logowanie klienta */
.login-box { width: 380px; text-align: left; padding: 36px 36px 28px; }
.login-box .login-logo { display: block; margin: 0 auto 22px; }
.login-box h1 { text-align: center; margin: 0 0 6px; font-size: 21px; }
.login-box .subtitle { text-align: center; font-size: 13.5px; line-height: 1.5; margin: 0 0 20px; }
.login-label { display: block; font-size: 12.5px; font-weight: 600; color: #4b5563; margin-bottom: 6px; }
.login-box input.login-code { margin-bottom: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 19px; letter-spacing: 2px; text-transform: uppercase; }
.login-box input.login-code::placeholder { letter-spacing: 2px; }
.login-box input.login-code.is-invalid { border-color: #c0392b; background: #fff8f7; }
.login-help { font-size: 12px; color: #8a8f98; margin: 0 0 14px; }
.login-box button:disabled { opacity: .7; cursor: progress; }
.login-error { background: #fdecea; border: 1px solid #f5c2c0; border-radius: 8px; padding: 9px 12px; font-size: 13px; line-height: 1.45; }
.login-active { background: #f2f9f3; border: 1px solid #cfe8d4; border-radius: 8px; padding: 9px 12px; font-size: 13.5px; color: #1f4d2a; margin: 0 0 14px; }
.login-active a { color: #1f4d2a; font-weight: 700; }
.login-foot { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid #eef0f3; font-size: 12.5px; color: #6b7280; text-align: center; line-height: 1.5; }
.login-foot a { color: var(--brand-dark); font-weight: 600; }
@media (max-width: 640px) { .login-box { width: 100%; max-width: 380px; padding: 28px 22px 22px; } }

/* ---------------- mapa PV klienta (tura 1) */
#topbar .topbar-right { scrollbar-width: none; }
#topbar .topbar-right::-webkit-scrollbar { display: none; }
details.layers-note { max-width: 240px; }
details.layers-note summary { cursor: pointer; list-style: none; font-size: 11.5px; font-weight: 600; color: #6b7280; }
details.layers-note summary::-webkit-details-marker { display: none; }
details.layers-note summary::before { content: "ⓘ "; }
details.layers-note[open] summary { margin-bottom: 4px; color: #374151; }
.anomaly-toggle-btn.is-empty { background: #fff; color: #4b5563; cursor: default; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.anomaly-toggle-btn.is-empty::before { content: "✓ "; color: #2e7d32; font-weight: 700; }
@media (max-width: 640px) {
    /* narzedzia temperatury jako jeden poziomy pasek ikon zamiast kolumny przyciskow */
    .temp-toolbar { flex-direction: row; width: auto; padding: 5px; gap: 4px; }
    .temp-toolbar-title { display: none; }
    .temp-tool-btn { flex-direction: column; gap: 2px; padding: 7px 9px; font-size: 11px; width: auto; text-align: center; }
    .temp-tool-icon { font-size: 16px; width: auto; }
    #controls { left: 10px; bottom: 14px; padding: 8px 12px; }
    .control-row { margin-bottom: 4px; font-size: 12.5px; }
}
@media (max-width: 640px) { #map .leaflet-top.leaflet-left { top: 64px; } }

/* ---------------- formularz anomalii PV (tura 1) */
.af-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 0 0 14px; }
.af-head h1 { margin: 0; font-size: 24px; }
.af-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.af-layout .card { margin-bottom: 0; }
@media (min-width: 1100px) {
    .af-layout { grid-template-columns: minmax(0, 1.35fr) minmax(380px, 1fr); }
    .af-map-card .anomaly-map-wrap { height: max(440px, calc(100vh - 330px)); }
    .af-form-card .anomaly-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.af-sub { margin: 6px 0 -4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.af-sub:first-child { margin-top: 0; }
.af-sub .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.af-help { margin: 0 0 10px; }
.af-coa-pick { display: inline-flex; gap: 4px; margin-top: 4px; }
.admin-body .af-coa { width: 34px; padding: 5px 0; font-size: 13px; font-weight: 700; border-radius: 6px; background: #fff; border: 1px solid #d7dae0; color: #374151; }
.admin-body .af-coa:hover { border-color: #9ca3af; }
.admin-body .af-coa-1.is-on { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.admin-body .af-coa-2.is-on { background: #e8622c; border-color: #e8622c; color: #fff; }
.admin-body .af-coa-3.is-on { background: #c0392b; border-color: #c0392b; color: #fff; }
.af-form-card .anomaly-form-buttons { position: sticky; bottom: 0; background: #fff; padding: 10px 0 2px; display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid #eef0f3; }
.af-form-card .anomaly-form-buttons button { width: auto; }
/* narzedzia temperatury w panelu: bez globalnego stylu przyciskow panelu */
.admin-body .temp-tool-btn { width: 100%; background: #f8f9fa; color: var(--brand-dark); font-weight: 500; padding: 8px 10px; font-size: 13px; border-radius: 6px; }
.admin-body .temp-tool-btn:hover { background: #eef0f3; }
.admin-body .temp-tool-btn.active { background: var(--brand-accent); color: var(--brand-accent-text); }
.admin-body .temp-tool-clear { color: #c0392b; }
@media (max-width: 640px) {
    .admin-body .temp-tool-btn { width: auto; padding: 7px 9px; font-size: 11px; }
    .anomaly-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.anomaly-map-wrap .leaflet-top.leaflet-left { left: 132px; }
@media (max-width: 640px) { .anomaly-map-wrap .leaflet-top.leaflet-left { left: 0; top: 60px; } }

/* ==========================================================================
   Priorytet 2 (tura 1): klienci, kody dostepu, listy zadan, pliki klienta
   ========================================================================== */
/* wspolne drobne kontrolki w tabelach panelu */
.c-inline { display: inline; margin: 0; }
.card .c-inline { display: inline-flex; }
.card .c-link { width: auto; background: transparent; color: #4b5563; padding: 2px 4px; font-size: 12.5px; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.card .c-link:hover { background: transparent; color: var(--brand-dark); }
.card .pl-del:disabled { opacity: .45; cursor: not-allowed; background: transparent; }
.c-overdue { color: #b71c1c; font-weight: 600; }
.c-th-hint { cursor: help; color: #9ca3af; text-transform: none; }

/* klienci */
.card .c-new-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.3fr) auto; gap: 12px; align-items: end; }
.c-table td { vertical-align: middle; padding: 10px 10px; font-size: 13.5px; }
.c-name { min-width: 200px; }
.card .c-email-form { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.card .c-email-form input { width: 230px; padding: 6px 8px; font-size: 13.5px; border: 1px solid transparent; border-radius: 6px; }
.card .c-email-form input:hover { border-color: #d7dae0; background: #fff; }
.card .c-email-form input:focus { border-color: var(--brand-color); background: #fff; outline: none; }
.card .c-email-form input::placeholder { color: #9ca3af; font-style: italic; }
.card .c-save { width: auto; padding: 5px 10px; font-size: 12.5px; }
.c-insp span { display: block; font-size: 12.5px; color: #6b7280; white-space: nowrap; }
.c-insp b { color: #1f2430; font-weight: 600; font-variant-numeric: tabular-nums; }
.c-insp .c-overdue b { color: #b71c1c; }
.c-code { white-space: nowrap; }
.c-actions { white-space: nowrap; }
@media (max-width: 760px) {
    .card .c-new-form { grid-template-columns: 1fr; }
    .c-table, .c-table tbody { display: block; white-space: normal; }
    .c-table thead { display: none; }
    .c-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 2px; border-bottom: 1px solid #eef0f3; }
    .c-table td { display: block; padding: 0; border: 0; }
    .c-table td.c-name { grid-column: 1 / -1; }
    .c-table td.c-email { grid-column: 1 / -1; }
    .card .c-email-form input { width: 100%; }
    .c-table td.c-actions { grid-column: 1 / -1; text-align: left; }
}

/* kody dostepu */
.ac-intro { margin: -4px 0 12px; }
.ac-new { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.card .ac-big, .ac-big { font-size: 16px; padding: 4px 12px; }
.ac-new-msg { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ac-new-msg textarea { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; width: 360px; max-width: 100%; border: 1px solid #cfe8d4; border-radius: 6px; padding: 6px 8px; background: #fff; resize: none; }
.success-banner .pl-new-btn { width: auto; padding: 8px 14px; font-size: 13px; }
.ac-form-card[hidden] { display: none; }
.ac-sel { font-size: 12px; font-weight: 500; color: #6b7280; text-transform: none; letter-spacing: 0; }
.ac-filter { width: 100%; padding: 6px 10px; border: 1px solid #d7dae0; border-radius: 7px; font-size: 13px; margin: 0 0 8px; }
.scope-item[hidden] { display: none; }
.ac-table td { vertical-align: middle; }
.ac-actions { white-space: nowrap; }
.ac-actions .action-link { padding: 5px 11px; font-size: 13px; }
.ac-form-card .anomaly-form-buttons { display: flex; gap: 8px; align-items: center; }
.ac-form-card .anomaly-form-buttons button { width: auto; }

/* listy zadan generatora */
.jl-list { list-style: none; margin: 0; padding: 0; }
.jl-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 18px; align-items: center; padding: 12px 4px; border-bottom: 1px solid #eef0f3; }
.jl-item:last-child { border-bottom: 0; }
.jl-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.jl-title { font-weight: 600; font-size: 15px; }
.jl-time { color: #9ca3af; font-weight: 400; font-size: 13px; }
.jl-meta { font-size: 12.5px; color: #6b7280; }
.jl-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.jl-live { font-size: 11.5px; font-weight: 700; color: #1f6b33; background: #ecf6ee; padding: 2px 8px; border-radius: 999px; }
.jl-actions { display: flex; align-items: center; gap: 6px; }
.jl-actions .action-link { padding: 6px 13px; font-size: 13px; font-weight: 600; }
.jl-new > summary { cursor: pointer; list-style: none; font-weight: 700; font-size: 15px; color: var(--brand-dark); display: flex; align-items: center; gap: 10px; }
.jl-new > summary::-webkit-details-marker { display: none; }
.jl-plus { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-color); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }
.jl-new[open] > summary { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #eef0f3; }

.card .jl-submit { width: auto; background: var(--brand-color); padding: 10px 18px; font-weight: 700; }
.jl-picked { margin: 4px 0; font-weight: 600; color: #374151; }
@media (max-width: 640px) {
    .jl-item { grid-template-columns: 1fr auto; }
    .jl-state { grid-column: 1 / -1; justify-content: flex-start; order: 3; }
}

/* pliki klienta */
.fv-hero { align-items: center; }
.fv-zip { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin: 0; }
.fv-zip .cl-btn { font-size: 15px; padding: 11px 20px; cursor: pointer; font-family: inherit; }
.fv-item { grid-template-columns: 46px minmax(0, 1fr) auto; }
.fv-icon { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; letter-spacing: .02em; background: #f1f2f4; color: #4b5563; align-self: center; }
.fv-icon-pdf { background: #fdecea; color: #b71c1c; }
.fv-icon-img { background: #eaf1fb; color: #1e4f8f; }
.fv-icon-zip { background: #fff3e0; color: #8a4b00; }
.fv-icon-doc { background: #e8f0fe; color: #1a56db; }
.fv-icon-xls { background: #ecf6ee; color: #1f6b33; }
.fv-item .cl-title { font-size: 15.5px; }
.fv-item .cl-meta { margin-top: 3px; }
.fv-fname { color: #9ca3af; overflow-wrap: anywhere; }
.fv-actions { flex-direction: row; min-width: 0; }
@media (max-width: 640px) {
    .fv-zip { align-items: stretch; width: 100%; }
    .fv-item { grid-template-columns: 40px minmax(0, 1fr); }
    .fv-icon { width: 40px; height: 40px; font-size: 10px; }
}

/* podglad pliku */
.fp-topbar .topbar-left { min-width: 0; gap: 12px; }
.fp-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; font-weight: 600; }
.fp-back { margin-right: 0; }
.fp-nav { display: inline-flex; align-items: center; gap: 2px; margin-right: 10px; }
.fp-arrow { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 7px; border: 1px solid rgba(255,255,255,.35); color: #fff; text-decoration: none; font-size: 19px; line-height: 1; }
.fp-arrow:hover { background: rgba(255,255,255,.12); }
.fp-size { opacity: .8; font-size: 12px; }
@media (max-width: 640px) { .fp-title { max-width: 60vw; } }
/* formularz kodu dostepu: siatka zamiast wysrodkowanego flexa */
.ac-form-card form.ai-analysis-form { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.ac-form-card .grant-meta-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: end; }
.ac-form-card .grant-meta-row label { min-width: 0; }
.ac-form-card label { text-align: left; font-weight: 600; font-size: 12.5px; color: #4b5563; }
.ac-form-card input[type="text"], .ac-form-card input[type="date"] { width: 100%; font-weight: 400; }
.ac-form-card label.demo-toggle { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; font-size: 13.5px; color: #374151; padding-bottom: 8px; }
.ac-form-card .scope-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.ac-form-card .scope-box { min-width: 0; }
.ac-form-card label.scope-item { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 13.5px; color: #1f2430; padding: 6px 2px; cursor: pointer; }
.ac-form-card label.scope-item input { flex: 0 0 auto; margin: 0; width: auto; }
.ac-form-card .scope-client { color: #6b7280; }
.ac-form-card .anomaly-form-buttons { justify-content: flex-start; }
@media (max-width: 760px) { .ac-form-card .grant-meta-row, .ac-form-card .scope-columns { grid-template-columns: 1fr; } }
/* formularze wgrywania: do lewej, pole pliku jako strefa upuszczania */
.card form.upload-form { align-items: flex-start; }
.jl-new .upload-form { align-items: stretch !important; gap: 10px; }
.jl-new .upload-form > label:first-child { font-weight: 600; font-size: 13px; color: #4b5563; display: flex; flex-direction: column; gap: 6px; }
.jl-new input[type="file"] { width: 100%; padding: 22px 16px; border: 2px dashed #c9ccd1; border-radius: 10px; background: #fafbfc; cursor: pointer; font-size: 13.5px; }
.jl-new input[type="file"]:hover { border-color: var(--brand-color); background: #fff; }
.jl-new .sg-ai-opts { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 14px; }
.jl-new .sg-ai-opts legend { font-size: 12.5px; font-weight: 600; color: #4b5563; padding: 0 4px; }
.jl-new .sg-ai-opts label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 3px 0; }
.jl-new .jl-submit { align-self: flex-start; }
.cl-btn.fv-ghost { border-color: transparent; background: transparent; }
.cl-btn.fv-ghost:hover { background: #eef0f3; }
.card .pl-del:not(:disabled) { color: #8a8f98; }

/* ==========================================================================
   Priorytet 3 (tura 1): logowanie admina, ustawienia, uzytkownicy,
   falowniki, konwerter, kalibracja, instrukcje
   ========================================================================== */
/* logowanie admina */
.login-box input.login-field { text-align: left; letter-spacing: 0; font-size: 16px; margin-bottom: 14px; }
.login-pass { position: relative; }
.login-pass input.login-field { padding-right: 74px; }
.login-box .login-eye { position: absolute; right: 6px; top: 6px; width: auto; padding: 6px 10px; font-size: 12.5px; font-weight: 600;
    background: #f3f4f6; color: #374151; border-radius: 6px; }
.login-box .login-eye:hover { background: #e5e7eb; }

/* ustawienia */
.st-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; color: #1f2430; margin-bottom: 8px; }
.st-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.st-switch-ui { width: 44px; height: 24px; border-radius: 999px; position: relative; transition: background .15s; flex: 0 0 auto; }
.st-switch-ui::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.st-switch input:checked + .st-switch-ui { background: #2e7d32; }
.st-switch input:checked + .st-switch-ui::after { transform: translateX(20px); }
.st-switch input:focus-visible + .st-switch-ui { outline: 2px solid var(--brand-color); outline-offset: 2px; }
.card .st-toggle-form { display: block; }
.st-warn { font-size: 12.5px; color: #8a4b00; background: #fff7ed; border: 1px solid #fde3c4; border-radius: 8px; padding: 8px 10px; }
.card .st-inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card .st-inline-form button { width: auto; }
.st-unit { display: inline-flex; align-items: center; border: 1px solid #c9ccd1; border-radius: 7px; background: #fff; overflow: hidden; }
.card .st-unit input { width: 120px; font-weight: 400; }
.st-unit i { font-style: normal; font-size: 13px; color: #6b7280; padding: 0 10px; background: #f6f7f9; align-self: stretch; display: flex; align-items: center; border-left: 1px solid #e5e7eb; }
.st-disk { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; font-size: 13.5px; color: #4b5563; }
.st-disk b { font-size: 26px; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.card .st-settings { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.st-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 6px 18px; align-items: center; padding: 12px 0; border-bottom: 1px solid #eef0f3; }
.st-row-text b { display: block; font-size: 14px; color: #1f2430; }
.st-row-text span { display: block; font-size: 12.5px; color: #6b7280; margin-top: 2px; }
.card .st-row select { width: 100%; }
.st-danger-opt { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; padding: 10px 12px; border: 1px solid #f5c2c0; background: #fff8f7; border-radius: 8px; font-size: 13px; color: #5b1d1d; cursor: pointer; }
.st-danger-opt input { margin-top: 3px; }
.card .st-settings button { width: auto; }
.card .st-del { width: auto; background: transparent; color: #b42318; border: 1px solid #f5c2c0; padding: 5px 11px; font-size: 12.5px; }
.card .st-del:hover { background: #fdecea; }
.st-ok { color: #1f6b33; font-size: 13.5px; }
.st-table td { vertical-align: middle; }
@media (max-width: 640px) { .st-row { grid-template-columns: 1fr; } }

/* uzytkownicy */
.card .u-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; align-items: end; }
.u-wide { grid-column: 1 / -1; }
.u-pass { display: flex; gap: 6px; align-items: center; }
.card .u-pass input { flex: 1 1 auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.u-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #374151; }
.u-table td { vertical-align: middle; }
.u-role { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: #f1f2f4; color: #4b5563; }
.u-role-full { background: #eaf1fb; color: #1e4f8f; }
.u-role-termowizja { background: #fff1e8; color: #a33a10; }
.u-role-pliki { background: #ecf6ee; color: #1f6b33; }
.u-actions { white-space: nowrap; }
.u-actions .cc-edit { display: inline-block; vertical-align: middle; }
.u-pw[open] { display: block; }
.card .u-pw-form { display: flex; gap: 6px; margin-top: 8px; }
.card .u-pw-form button { width: auto; }
@media (max-width: 640px) { .card .u-form { grid-template-columns: 1fr; } }

/* falowniki */
.ij-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2e7d32; margin-right: 2px; }
.ij-dot-2 { background: #e8622c; }
.ij-dot-3 { background: #c0392b; }
.pd-jump a.ij-off { opacity: .55; text-decoration: line-through; }
.jl-new .ij-title { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: #4b5563; }
.jl-new .ij-title input { width: 100%; font-weight: 400; }

/* zdjecia falownikow u klienta */
.ipc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.ipc-item { display: flex; flex-direction: column; background: #fff; border: 1px solid #e2e4e8; border-radius: 12px; overflow: hidden; text-decoration: none; color: #1f2430; transition: box-shadow .12s, border-color .12s; }
.ipc-item:hover { border-color: #cfd3da; box-shadow: 0 4px 14px rgba(16,24,40,.08); }
.ipc-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #1b1b1f; }
.ipc-cap { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; }
.ipc-name { font-size: 12px; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ipc-max { font-size: 13px; color: #b71c1c; white-space: nowrap; }

/* konwerter */
.cv-lead { font-size: 14px; color: #374151; margin: 0 0 12px; }
.card .cv-form { align-items: stretch; gap: 10px; }
.cv-form > label { font-weight: 600; font-size: 13px; color: #4b5563; display: flex; flex-direction: column; gap: 6px; }
.cv-form input[type="file"] { width: 100%; padding: 22px 16px; border: 2px dashed #c9ccd1; border-radius: 10px; background: #fafbfc; cursor: pointer; font-size: 13.5px; }
.cv-form input[type="file"]:hover { border-color: var(--brand-color); background: #fff; }
.cv-form .jl-submit { align-self: flex-start; }
.cv-guide > summary { cursor: pointer; list-style: none; }
.cv-guide > summary::-webkit-details-marker { display: none; }
.cv-guide > summary strong { display: inline; }
.cv-guide > summary::after { content: " ▾"; }

/* kalibracja */
.cb-steps { list-style: none; counter-reset: cb; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; padding: 0; }
.cb-steps li { counter-increment: cb; background: #f8f9fb; border: 1px solid #eceef1; border-radius: 10px; padding: 10px 12px 10px 44px; position: relative; }
.cb-steps li::before { content: counter(cb); position: absolute; left: 12px; top: 11px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-dark); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.cb-steps b { display: block; font-size: 13.5px; }
.cb-steps span { font-size: 12px; color: #6b7280; }
.cb-status { margin-top: 4px; }
.admin-body .calib-toolbar button { width: auto; }
#calib-map { height: max(480px, calc(100vh - 380px)); }
@media (max-width: 760px) { .cb-steps { grid-template-columns: 1fr 1fr; } }

/* instrukcje: spis tresci */
.in-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.in-main { min-width: 0; }
.in-toc details { background: #fff; border: 1px solid #e2e4e8; border-radius: 12px; padding: 12px 14px; }
.in-toc summary { cursor: pointer; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 700; }
.in-toc ol { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.in-toc a { display: block; padding: 6px 8px; border-radius: 7px; font-size: 13px; line-height: 1.35; color: #374151 !important; font-weight: 500 !important; text-decoration: none !important; }
.in-toc a:hover { background: #f3f4f6; }
.in-toc a.is-active { background: var(--brand-dark); color: #fff !important; }
.in-main .card { scroll-margin-top: 16px; }
@media (min-width: 1100px) {
    .in-layout { grid-template-columns: 250px minmax(0, 1fr); }
    .in-toc { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
}
@media (max-width: 640px) {
    .sub-nav { flex-wrap: wrap; row-gap: 6px; }
    .projects-table.instr-table { table-layout: fixed; width: 100%; }
    .instr-table code { word-break: break-all; }
    .u-table, .u-table tbody { display: block; white-space: normal; }
    .u-table thead { display: none; }
    .u-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 2px; border-bottom: 1px solid #eef0f3; }
    .u-table td { display: block; padding: 0; border: 0; }
    .u-table td:first-child { grid-column: 1 / -1; }
    .u-table td.u-actions { grid-column: 1 / -1; white-space: normal; text-align: left; }
}

/* ==========================================================================
   Tura ekspertow 1: tokeny, ujednolicenie, dostepnosc (WCAG 2.2 AA)
   ========================================================================== */
:root {
    --ink: #1f2430; --text-2: #4b5563; --text-3: #5f6672; --text-4: #6b7280;
    --line: #e2e4e8; --line-soft: #eef0f3; --line-strong: #8f949c;
    --surface: #fff; --surface-2: #f8f9fb; --page: #eef1f5;
    --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-pill: 999px;
    --shadow-1: 0 1px 3px rgba(16,24,40,.06); --shadow-2: 0 4px 14px rgba(16,24,40,.08);
    --ok-bg: #f2f9f3; --ok-line: #cfe8d4; --ok-fg: #1f6b33;
    --warn-bg: #fff7ed; --warn-line: #fde3c4; --warn-fg: #8a4b00;
    --err-bg: #fdecea; --err-line: #f5c2c0; --err-fg: #b71c1c;
    --brand-ink: color-mix(in srgb, var(--brand-color) 78%, black);
    --brand-tint: rgba(var(--brand-color-rgb), .07); --brand-tint-line: rgba(var(--brand-color-rgb), .28);
}
html { scroll-padding-top: 76px; scroll-padding-bottom: 64px; }

/* DS-1: kontrolki tym samym krojem co strona */
button, input, select, textarea { font-family: inherit; }

/* A11Y-1: przyciski i elementy w kolorze marki z bialym tekstem */
.cl-btn-primary, .pd-btn-primary { background: var(--brand-fill); border-color: var(--brand-fill); }
.report-link, .sg-download-btn, .cc-add-btn, .card .pl-new-btn, .card .jl-submit, .card .cal-submit, .card .cc-submit,
.card.jb-actions .jb-publish, .admin-body .sg-save-bar .sg-save-next, .pd-steps li.is-current b, .jl-plus,
.cal-grid td.cal-today .cal-day span, .admin-body .card .calib-view-btn.active, .tour-next { background: var(--brand-fill); }
.card .pl-new-btn[aria-expanded="true"] { background: #fff; color: var(--brand-dark); }
.temp-tool-btn.active, .admin-body .temp-tool-btn.active, .loupe-toggle-btn.active { background: var(--brand-fill); color: var(--brand-fill-text, #fff); }
.sg-kicker, .cl-next-cta, .inv-progress, .tour-step-counter, .calib-highlight, .sg-thread-form summary,
.download-menu-list a:hover { color: var(--brand-ink) !important; }

/* A11Y-2 / A11Y-23: szary tekst z kontrastem >= 4,5:1 */
.hint, .pl-sub, .login-help, .cal-note, .jb-tile small, .sg-num-stats small, .sg-line-stats small,
.pl-status-empty, .admin-nav-logout, .layers-note, details.layers-note summary, .anomaly-comment-date, .pl-chip span, .cal-opt,
.sg-ed-of, .jl-time, .fv-fname, .c-th-hint, .tour-close, .cl-hero-sub, .cl-help, .cl-none, .cl-meta, .jl-meta, .cl-date,
.c-insp span, .pd-meta, .cc-item-meta, .cal-up-meta, .cal-up-when, .cal-kpi span, .jb-stats span, .jb-stats small,
.sg-unit-n, .sg-facts dt, .cl-next-label, .sg-help summary  { color: var(--text-3); }
.pl-muted, .card .pl-del, .card .pl-del:not(:disabled), .card .sg-del-x { color: var(--text-4); }
.cal-out .cal-day, .cal-grid th.cal-we-h { color: #7b818b; }
.cards-group-title { color: var(--text-3); border-bottom-width: 1px; }
.sg-cards-m td[data-label]::before { color: var(--text-3); }
.sg-stat-zero { opacity: 1; }
.sg-stat-zero .sg-stat-n, .sg-stat-zero > span, .sg-stat-zero small { color: var(--text-3); }
.sg-stat-zero { border-top-color: #cfd3da !important; background: #f8f9fb; }
.cl-card-off .cl-title, .cl-card-off .cl-icon { opacity: 1; }
.cl-card-off .cl-title { color: var(--text-3); }
.pd-layers span { color: var(--text-3); }
input::placeholder, textarea::placeholder { color: var(--text-4); }
.login-box input.login-code::placeholder { color: #8f949c; }

/* A11Y-6 / DS-8: poziom 2 jednym, ciemniejszym pomaranczem (bialy tekst) */
.sg-prio-2, .inv-coa-2, .admin-body .af-coa-2.is-on, .ij-dot-2, .bd-cls-2 { background: var(--sev-2); border-color: var(--sev-2); }
.pd-steps li.is-warn b { color: #3b2f00; }
.jl-new[open] .jl-plus { background: var(--text-4); }

/* DS-5 + DS-7: pigulki stopni w kafelkach i spojna skala klas budynku */
.cl-pill-c2, .sg-verdict-c2 { background: #fff0e0; color: #a84d08; }
.cl-pill-c1, .sg-verdict-c1 { background: #fff8e1; color: #8a6100; }
.jb-stats span.cl-pill { color: #374151; }
.jb-stats span.cl-pill-p1, .jb-stats span.cl-pill-c3 { color: var(--err-fg); }
.jb-stats span.cl-pill-p2, .jb-stats span.cl-pill-c2 { color: #a84d08; }
.jb-stats span.cl-pill-p3, .jb-stats span.cl-pill-c1 { color: #8a6100; }
.jb-stats span.cl-pill-p4 { color: var(--ok-fg); }
.jb-stats span.cl-pill-obs { color: #455a64; }

/* A11Y-7 / DS-18: widoczny fokus na wszystkich stronach */
:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.login-box input:focus, .card .c-email-form input:focus { box-shadow: 0 0 0 3px rgba(var(--brand-color-rgb), .35); }
.card .c-email-form input { border-color: #d7dae0; background: #fff; }

/* A11Y-22: obramowania pol formularzy z kontrastem >= 3:1 */
:is(input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=hidden]), select, textarea):not(:focus):not(.is-invalid) { border-color: var(--line-strong); }
.card .st-unit input { border: 0 !important; }
.st-unit, .pl-search input, .cl-toolbar input, .ac-filter { border-color: var(--line-strong); }
.st-switch-ui { background: #8f949c; }

/* DS-2 / UX-3: przycisk drugorzedny wszedzie wyglada tak samo */
.admin-body button.btn-secondary, .card button.btn-secondary { width: auto; background: var(--surface); color: var(--brand-dark); border: 1px solid var(--line-strong) !important; }
.admin-body button.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
/* DS-3: przyciski usuwania - czerwony kontur */
.admin-body button.delete-btn, .admin-body .jb-delete button { width: auto; background: var(--surface); color: var(--err-fg); border: 1px solid var(--err-line) !important; }
.admin-body button.delete-btn:hover, .admin-body .jb-delete button:hover { background: var(--err-bg); color: #96281b; }
/* DS-4: brak przypadkowych przyciskow na cala szerokosc w kartach */
.admin-body .card button:where(:not(.cal-submit, .temp-tool-btn, .photo-gallery-item button, .login-eye)) { width: auto; }
.card .ai-analysis-form > button, .card .ai-analysis-form .anomaly-form-buttons button { align-self: flex-start; }
/* DS-15: kalibracja - przelacznik widoku jako segmenty */
.admin-body .card .calib-view-btn:not(.active) { background: var(--surface); color: var(--brand-dark); border: 1px solid #c9ccd1; }
#calib-map { border-color: var(--line); }

/* DS-10: pozostale pola formularzy jak pola tekstowe */
:where(.card) input:is([type=date], [type=number], [type=email], [type=password], [type=time]) { padding: 7px 8px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: 14px; background: #fff; color: var(--ink); }
:where(.card) input[type=file] { font-size: 13px; color: var(--text-2); }
:where(.card) input[type=file]::file-selector-button { font: inherit; font-weight: 600; padding: 6px 12px; margin-right: 10px; border: 1px solid #c9ccd1; border-radius: var(--r-sm); background: #fff; color: var(--brand-dark); cursor: pointer; }

/* DS-11: tabele stref/wykazow ze standardowym naglowkiem */
.inv-zones th { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.inv-zones td { border-bottom-color: var(--line-soft); }

/* DS-9: odcienie marki zamiast zakodowanego koloru jednej marki */
.callout { background: var(--brand-tint); border-color: var(--brand-tint-line); color: var(--ink); }
.cv-guide > summary::after { color: var(--brand-dark); }
.bulk-bar { background: var(--brand-tint); border-color: var(--brand-tint-line); }
.bulk-bar #bulk-count { color: var(--brand-dark); }
.anomaly-item.active { background: var(--brand-tint); }

/* DS-13: komunikaty */
.success-banner { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-fg); border-radius: var(--r-md); font-size: 13.5px; }
.admin-wrap p.error { background: var(--err-bg); border: 1px solid var(--err-line); color: #9b1c1c; border-radius: var(--r-md); padding: 9px 12px; }
.jb-pub-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }

/* DS-16 / DS-17: karty raportu klienta i wylogowanie na mapie */
.sg-card { border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.viewer-body #topbar .logout-link { color: #fff; border: 1px solid rgba(255,255,255,.35); padding: 6px 12px; border-radius: var(--r-sm); }
.viewer-body #topbar .logout-link:hover { background: rgba(255,255,255,.12); }
/* DS-19 / DS-25 */
.card .pl-chip { padding: 6px 13px; }
.card .pd-more { color: var(--text-3); text-decoration: none; }
.card .pd-more:hover { color: var(--brand-dark); text-decoration: underline; }

/* A11Y-5: zamkniety panel anomalii poza kolejnoscia tabulacji */
.anomaly-panel { visibility: hidden; transition: transform .2s, visibility 0s .2s; }
.anomaly-panel.open { visibility: visible; transition: transform .2s; }
.anomaly-item-go { all: unset; cursor: pointer; display: block; font-weight: 700; }
.anomaly-item-go:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
/* A11Y-19 */
.sg-totop:not(.is-on) { visibility: hidden; }
/* A11Y-12: sortowane kolumny */
.th-sort { all: unset; cursor: pointer; }
.th-sort:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
/* A11Y-13: link "Przejdz do tresci" */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 3000; background: var(--brand-dark); color: #fff !important; padding: 8px 14px; border-radius: var(--r-md); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 8px; }

/* A11Y-20: cele dotykowe */
.att-move-btn, .sg-mini, .card .c-link, .card .pl-code, .cl-code { min-height: 24px; display: inline-flex; align-items: center; justify-content: center; }
details.layers-note summary { min-height: 24px; display: flex; align-items: center; }
@media (max-width: 760px) {
    .cal-ev { min-height: 24px; margin-bottom: 4px; }
    .cl-code, details.layers-note summary { min-height: 32px; }
}
/* A11Y-21: zawijanie przy 320 px */
.ai-describe-row input { min-width: min(260px, 100%); }
.inv-station-name { min-width: min(280px, 100%); }
.sg-lgroup-title { min-width: min(220px, 100%); }
@media (max-width: 640px) { .anomaly-panel { top: 78px; } }

/* UX-10: edytor termogramu i naglowek panelu na telefonie */
@media (max-width: 760px) {
    .sg-ed-row .inv-inline { display: flex; flex-wrap: wrap; max-width: 100%; gap: 4px; }
    .card .sg-ed-row select { width: 100%; min-width: 0; }
    .sg-ed-top { position: static; }
    .sg-save-bar { flex-wrap: wrap; }
    .sg-ed-nav .sg-nav-btn { white-space: nowrap; }
    .admin-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .admin-nav a { flex: 0 0 auto; }
}
/* UX-22: przycisk raportu na telefonie zawsze widoczny w pasku */
@media (max-width: 640px) { .topbar-right .report-link { order: -1; } }

/* A11Y-17: ograniczony ruch */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Tura ekspertow 2: regresje i dalsze ujednolicenie
   ========================================================================== */
:root { --brand-fill: color-mix(in srgb, var(--brand-color) 85%, black); --sev-2: #ea7a0c; --sev-2-text: #2b1600; }
/* poziom 2: jasniejszy pomarancz z ciemnym tekstem (nie myli sie z przyciskiem glownym ani z poziomem 1) */
.sg-prio-2, .inv-coa-2, .bd-cls-2, .admin-body .af-coa-2.is-on { background: var(--sev-2); border-color: var(--sev-2); color: var(--sev-2-text); }
/* naglowki sortowania to tekst, nie przyciski */
.admin-body .card button.th-sort { all: unset; cursor: pointer; }
.admin-body .card button.th-sort:hover { color: var(--brand-ink); }
.admin-body .card button.th-sort:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; border-radius: 3px; }
/* przyciski o stalym rozmiarze */
.admin-body .card .af-coa { width: 34px; }
.admin-body .card .cal-add { width: 22px; }
.admin-body .card .sg-del-x { width: 26px; }
/* karta pobierania PDF w raporcie klienta zachowuje ramke */
.sg-card.sg-download { border: 2px solid var(--brand-fill); background: var(--surface); }
/* jeden, ciemniejszy hover dla przyciskow w kolorze marki */
:is(.cl-btn-primary, .pd-btn-primary, .report-link, .sg-download-btn, .card.jb-actions .jb-publish,
    .admin-body .sg-save-bar .sg-save-next, .tour-next, .admin-body button.btn-primary, .card .pl-new-btn:not([aria-expanded="true"]), .card .jl-submit, .card .cal-submit, .card .cc-submit, .cc-add-btn):hover {
    background: color-mix(in srgb, var(--brand-fill) 85%, black); border-color: color-mix(in srgb, var(--brand-fill) 85%, black); filter: none; }
/* fokus widoczny na ciemnym pasku gornym */
#topbar :focus-visible { outline-color: #fff; }
#tresc:focus { outline: none; }
/* resztki czystego koloru marki w komponentach z wypelnieniem */
.admin-body .card .calib-view-btn.active { border: 1px solid var(--brand-fill); }
.pd-steps li.is-current a { border-color: var(--brand-fill); }
/* jeden szary dla obramowan przyciskow obrysowanych i chipow */
.pd-btn:not(.pd-btn-primary), .cl-btn:not(.cl-btn-primary):not(.fv-ghost), .cc-open, .cc-edit summary,
.cal-arrow, .cal-today-btn, .card .pl-chip, .card .cl-chip, .cl-chip, .admin-body .af-coa, .sg-jump a, .pd-jump a { border-color: #c9ccd1; }
/* jawny przycisk glowny (utworz / zapisz i dalej) */
.admin-body button.btn-primary, .admin-body .card button.btn-primary { background: var(--brand-fill); color: var(--brand-fill-text, #fff); border: 0; }
/* geometria przyciskow */
.card .jl-submit, .card .cal-submit, .card .cc-submit, .cl-btn, .report-link, .projects-link,
.viewer-body #topbar .logout-link, .cl-body .logout-link { border-radius: var(--r-md); }
.report-link, .projects-link, .viewer-body #topbar .logout-link, .cl-body .logout-link { font-weight: 600; }
.sg-thread-form button { font-size: 13.5px; font-weight: 600; }
/* naglowki tabel i chipy kodow */
.projects-table th { font-size: 11.5px; color: var(--text-3); }
.card .pl-code, .cl-code { border: 1px dashed #c9ccd1; background: #f6f7f9; color: var(--ink); font-size: 12.5px; }

/* kontrast: reguly, ktore wczesniej przegraly specyficznoscia */
.admin-nav-logout { color: var(--text-3) !important; }
.card .pl-chip span, .card .cl-chip span, .cl-chip span { color: var(--text-3); }
.card .pl-chip.is-active span, .card .cl-chip.is-active span, .cl-chip.is-active span { color: rgba(255,255,255,.8); }
.cal-grid td.cal-out .cal-day, .cal-grid th.cal-we-h { color: var(--text-4); }
.loupe-toggle-btn.active { background: var(--brand-fill) !important; color: var(--brand-fill-text, #fff) !important; }
.card .c-email-form input::placeholder, .login-box input.login-code::placeholder { color: var(--text-4); }
.pl-table td.pl-date::before, .card .cal-add  { color: var(--text-3); }

/* kotwice: bez podwojnego odstepu od gory */
html:has(.sg-client-body) { scroll-padding-top: calc(var(--tb-h, 0px) + 62px); }
.sg-client [id], .project-cards .cards-group-title, .in-main .card { scroll-margin-top: 0; }
.inv-station { scroll-margin-top: 14px; }

/* kalendarz na telefonie: kilka wpisow w dniu nie jest ucinanych */
@media (max-width: 760px) {
    .cal-grid td { height: auto; min-height: 64px; }
    .cal-ev { display: inline-flex; min-width: 24px; margin: 0 2px 2px 0; }
}
/* komunikaty statusu: znikaja, gdy sa puste (bez przelaczania display w JS) */
.comment-status:empty { display: none; }

/* ---------------- tura 2 UX */
/* nastepny krok (weryfikacja) wyrazniejszy od zwyklych przyciskow, ale nie pomaranczowy (ten jest dla publikacji) */
.card.jb-actions .jb-verify { background: var(--brand-dark); color: #fff !important; border-color: var(--brand-dark); }
.card.jb-actions .jb-verify:hover { background: color-mix(in srgb, var(--brand-dark) 85%, black); }
.pl-com { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 700; color: var(--warn-fg); white-space: nowrap; }
/* galeria zdjec falownikow: przycisk usuwania na cala szerokosc karty; jeden styl usuwania w edytorze */
.admin-body .photo-gallery-item button.delete-btn { width: 100%; }

/* PDF na telefonach: pasek "Otworz / Pobierz" (wbudowany podglad PDF czesto nie dziala) */
.pdf-mobile-bar { display: none; }
@media (max-width: 640px) {
    .pdf-mobile-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; background: #fff; border-bottom: 1px solid var(--line); }
    .pdf-mobile-bar a { flex: 1 1 auto; text-align: center; }
    .pdf-mobile-bar + .report-pdf-embed { height: calc(100% - 64px); }
}
@media (max-width: 760px) {
    .sg-ed-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; width: 100%; }
    .sg-ed-nav select { max-width: none; width: 100%; min-width: 0; }
    .card.jb-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card.jb-actions .pd-btn { white-space: normal; text-align: center; }
}
@media (max-width: 640px) {
    .sg-thermo-body { grid-template-columns: minmax(0, 1fr); }
    .sg-thermo-imgs img { max-width: 100%; }
}
/* teksty tylko dla czytnikow nie poszerzaja strony (np. w przewijanej tabeli) */
.sr-only { left: 0; top: 0; margin: -1px; padding: 0; border: 0; clip-path: inset(50%); }
.pl-table-wrap, .inv-zones-wrap, .sg-table-wrap { position: relative; }

/* Ustawienia: podglad podpisu do raportow PDF (przezroczyste tlo na kratce) */
.sig-preview { margin: 4px 0 12px; padding: 10px; border: 1px solid var(--line, #d9dbe0); border-radius: 8px;
  background: #fff repeating-conic-gradient(#f1f2f4 0% 25%, #fff 0% 50%) 0 0 / 16px 16px; text-align: center; }
.sig-preview img { max-width: 100%; max-height: 90px; }

/* ---------------------------------------------------------------- powiadomienia (dzwonek) i akceptacje */
.notif { position: relative; display: inline-flex; margin-left: 8px; }
.admin-body .notif-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  padding: 0; border: 1px solid var(--line, #e2e4e8); border-radius: 50%; background: #fff; color: var(--brand-dark); cursor: pointer; }
.admin-body .notif-bell:hover { background: #eef1f5; }
.admin-body .notif-bell.has-unread { border-color: var(--brand-fill, var(--brand-color)); }
.notif-badge { position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #c62828; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 1000; width: min(380px, calc(100vw - 24px));
  max-height: min(70vh, 520px); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line, #e2e4e8);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); }
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft, #eef0f3); }
.admin-body .notif-allread { width: auto; font-weight: 500; border-radius: 4px; border: 0; background: none; color: var(--brand-dark); font-size: 12.5px; text-decoration: underline; cursor: pointer; padding: 2px; }
.notif-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.admin-body .notif-item { border-radius: 0; font-weight: 400; display: grid; grid-template-columns: 10px 1fr; column-gap: 8px; width: 100%; padding: 10px 12px; border: 0;
  border-bottom: 1px solid var(--line-soft, #eef0f3); background: #fff; text-align: left; font: inherit; cursor: pointer; color: inherit; }
.admin-body .notif-item:hover { background: #f6f7f9; }
.admin-body .notif-item.unread { background: #fff7e6; }
.admin-body .notif-item.unread:hover { background: #ffefcc; }
.notif-item > :not(.notif-dot) { grid-column: 2; }
.notif-dot { grid-column: 1; grid-row: 1; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: #c62828; }
.notif-title { font-weight: 600; font-size: 13.5px; }
.notif-body { font-size: 13px; color: #4b5563; margin-top: 2px; }
.notif-time { font-size: 12px; color: #6b7280; margin-top: 3px; }
.notif-empty { padding: 14px 12px; color: #6b7280; font-size: 13px; }
.notif-foot { padding: 9px 12px; border-top: 1px solid var(--line-soft, #eef0f3); font-size: 13px; }
@media (max-width: 760px) {
  .notif-panel { position: fixed; top: 64px; right: 12px; left: 12px; width: auto; }
}
.appr-status { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  vertical-align: middle; background: #e9edf1; color: #3f4a54; }
.appr-pending { background: #fff4c2; color: #6b5300; }
.appr-approved { background: #e3f3e6; color: #1f5f2c; }
.appr-rejected, .appr-outdated { background: #fbe3e1; color: #9b1c1c; }
.appr-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-top: 8px; }
.appr-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.appr-form .appr-note { flex: 1 1 260px; }
.appr-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.appr-table th, .appr-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft, #eef0f3); text-align: left; vertical-align: top; }
.appr-row-pending td { background: #fffbea; }
.appr-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 6px 0 12px; font-size: 14px; }
.appr-dl dt { color: #5f6672; }
.appr-dl dd { margin: 0; }
.appr-text { white-space: pre-wrap; }
.appr-links { display: flex; flex-wrap: wrap; gap: 8px; }
.prof-form label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13.5px; }
.prof-form input[type=text], .prof-form textarea { width: 100%; box-sizing: border-box; }
@media (max-width: 600px) { .appr-table thead { display: none; } .appr-table td { display: block; border: 0; padding: 4px 0; }
  .appr-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line-soft, #eef0f3); }
  .appr-table td[data-label]::before { content: attr(data-label) ": "; color: #6b7280; } }
.prof-form .prof-check { flex-direction: row; align-items: flex-start; gap: 8px; }
.prof-form .prof-check input { margin-top: 3px; }

/* ================= Porownanie z poprzednim badaniem ================= */
/* Tokeny: neutralne (bez kolorow marki), poziomy jak report_theme.SEVERITY. */
:root {
    --chg-badge-bg: #1f2430; --chg-badge-fg: #fff; --chg-halo: #fff; --chg-ghost: #1f2430;
    --sev-critical-fg: #9b1c1c; --sev-critical-bg: #fbe3e1;
    --sev-major-fg: #8a3c00; --sev-major-bg: #ffe8d1;
    --sev-minor-fg: #6b5300; --sev-minor-bg: #fff4c2;
    --sev-low-fg: #2b4a6f; --sev-low-bg: #e5edf6;
    --sev-ok-fg: #1f5f2c; --sev-ok-bg: #e3f3e6;
    --sev-info-fg: #3f4a54; --sev-info-bg: #e9edf1;
}
/* CoA 1 (zielone tlo): ciemna cyfra - kontrast >= 4,5:1 */
.existing-anomaly-marker.coa-1 { color: #1f2430; }
.sev-chip-critical { color: var(--sev-critical-fg); background: var(--sev-critical-bg); }
.sev-chip-major { color: var(--sev-major-fg); background: var(--sev-major-bg); }
.sev-chip-minor { color: var(--sev-minor-fg); background: var(--sev-minor-bg); }
.sev-chip-low { color: var(--sev-low-fg); background: var(--sev-low-bg); }
.sev-chip-ok { color: var(--sev-ok-fg); background: var(--sev-ok-bg); }
.sev-chip-info { color: var(--sev-info-fg); background: var(--sev-info-bg); }
.cmp-st { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 4px; border-radius: 10px;
          font-size: 12.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.cmp-st-nie_zweryfikowano { border: 1px dashed currentColor; }
/* ksztalty statusu (aria-hidden; slowo zawsze obok) */
.cmp-shape { display: inline-block; width: 12px; height: 12px; flex: none; position: relative; }
.cmp-shape-plus::before, .cmp-shape-plus-hollow::before { content: "+"; position: absolute; inset: -3px 0 0 0; font-weight: 800; font-size: 14px; line-height: 14px; text-align: center; }
.cmp-shape-up { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid currentColor; }
.cmp-shape-down { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 11px solid currentColor; }
.cmp-shape-eq::before { content: "="; position: absolute; inset: -3px 0 0 0; font-weight: 800; font-size: 14px; line-height: 14px; text-align: center; }
.cmp-shape-q::before { content: "?"; position: absolute; inset: -2px 0 0 0; font-weight: 800; font-size: 12px; line-height: 14px; text-align: center; }
.cmp-shape-warn::before { content: "!"; position: absolute; inset: -2px 0 0 0; font-weight: 800; font-size: 12px; line-height: 14px; text-align: center; }
.cmp-shape-check::before { content: "✓"; position: absolute; inset: -2px 0 0 0; font-weight: 800; font-size: 12px; line-height: 14px; text-align: center; }
.cmp-shape-none { width: 10px; height: 10px; border: 2px dashed currentColor; border-radius: 50%; box-sizing: border-box; }
.cmp-st-nie_zweryfikowano .cmp-shape-q { border: 1.5px solid currentColor; border-radius: 50%; box-sizing: border-box; }

/* znaczniki mapy: odznaka w prawym gornym rogu, wlasne halo (2 px bialy + 1 px ciemny) */
/* .leaflet-marker-icon jest position:absolute - nie nadpisywac (odznaka pozycjonuje sie wzgledem niego) */
.cmp-marker-wrap .existing-anomaly-marker { width: 24px; height: 24px; }
.cmp-badge { position: absolute; top: -7px; right: -8px; width: 14px; height: 14px; border-radius: 50%;
             background: var(--chg-badge-bg); color: var(--chg-badge-fg);
             box-shadow: 0 0 0 2px var(--chg-halo), 0 0 0 3px #1f2430; display: block; }
.cmp-badge::before { position: absolute; inset: 0; text-align: center; font: 800 11px/14px system-ui, sans-serif; }
.cmp-badge-plus::before { content: "+"; }
.cmp-badge-plus-hollow { background: #fff; color: #1f2430; box-shadow: 0 0 0 1.5px #1f2430, 0 0 0 3px #fff; }
.cmp-badge-plus-hollow::before { content: "+"; }
.cmp-badge-eq::before { content: "="; }
.cmp-badge-q::before { content: "?"; }
.cmp-badge-warn { background: var(--sev-minor-bg); color: var(--sev-minor-fg); }
.cmp-badge-warn::before { content: "!"; }
.cmp-badge-check::before { content: "✓"; }
.cmp-badge-up::before { content: ""; inset: 3px auto auto 3px; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid currentColor; }
.cmp-badge-down::before { content: ""; inset: 4px auto auto 3px; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 7px solid currentColor; }
.cmp-ghost { position: relative; width: 24px; height: 24px; border-radius: 50%; box-sizing: border-box; background: rgba(255,255,255,0.15);
             display: flex; align-items: center; justify-content: center; font: 700 11px/1 system-ui, sans-serif; color: #1f2430;
             text-shadow: 0 0 2px #fff, 0 0 2px #fff; box-shadow: 0 0 0 2px var(--chg-halo); }
.cmp-ghost-dashed { border: 2px dashed var(--chg-ghost); }
.cmp-ghost-solid { border: 1.5px solid var(--chg-ghost); }
.leaflet-marker-icon.cmp-marker-wrap:focus-visible { outline: 2px solid #1f2430; outline-offset: 3px; }
.cmp-map { height: 460px; border-radius: 8px; margin: 10px 0; }
.cmp-legend-list { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); font-size: 13px; }
.cmp-legend-list li { display: flex; align-items: center; gap: 10px; }
.cmp-lg-marker { position: relative; display: inline-block; width: 22px; height: 22px; border-radius: 50%; background: #9ca3af; border: 2px solid #fff; box-shadow: 0 0 0 1px #9ca3af; }
.cmp-legend-list .cmp-ghost { display: inline-flex; }

/* panel */
.cmp-inline { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 8px 4px 0; }
.cmp-dec-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 2px 0 6px; }
.cmp-dec-form select { max-width: 340px; }
.cmp-table-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table caption { text-align: left; font-weight: 600; padding: 4px 0 8px; }
.cmp-table th, .cmp-table td { padding: 6px 8px; border-bottom: 1px solid #e5e7eb; vertical-align: top; text-align: left; }
.cmp-table thead th { background: #f6f7f9; font-size: 12px; }
.cmp-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp-table th.cmp-loc { font-weight: 500; }
.cmp-table tr.cmp-row-open { background: #fffbea; }
.cmp-table tr:focus { outline: 2px solid #1f2430; outline-offset: -2px; }
.cmp-table tbody th.cmp-grp { background: #f1f3f6; font-weight: 700; }
.cmp-thumbs { display: flex; gap: 4px; margin-top: 4px; }
.cmp-thumbs img { width: 120px; height: auto; border-radius: 4px; border: 1px solid #d1d5db; }
.cmp-urgent { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 6px; color: var(--sev-critical-fg); background: var(--sev-critical-bg); }
.cmp-pill { display: inline-block; font-weight: 600; padding: 3px 10px; border-radius: 12px; font-size: 13px; margin: 4px 0; }
.cmp-pill-minor { color: var(--sev-minor-fg); background: var(--sev-minor-bg); }
.cmp-pill-ok { color: var(--sev-ok-fg); background: var(--sev-ok-bg); }
.cmp-pill-info { color: var(--sev-info-fg); background: var(--sev-info-bg); }
.cmp-pill-critical { color: var(--sev-critical-fg); background: var(--sev-critical-bg); }
.cmp-alert-critical { background: var(--sev-critical-bg); border-color: #f3b4ae; color: var(--sev-critical-fg); }
.cmp-warn-list { margin: 8px 0; padding-left: 18px; font-size: 13px; }
.cmp-filters { border: 0; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-filters legend { font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 4px; width: 100%; }
.cmp-chip { border: 1px solid #c9ccd1; background: #fff; border-radius: 14px; padding: 4px 12px; font-size: 13px; cursor: pointer; min-height: 28px; }
.cmp-chip[aria-pressed="true"] { background: #1f2430; color: #fff; border-color: #1f2430; }
.cmp-chip:focus-visible { outline: 2px solid #1f2430; outline-offset: 2px; }
.cmp-details { margin-top: 4px; font-size: 12.5px; }
.cmp-details summary { cursor: pointer; color: #1f4e8c; }
.cmp-repair { display: grid; gap: 4px; margin-top: 4px; max-width: 360px; }
.cmp-bulk { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 8px 0; }
.cmp-danger { color: var(--sev-critical-fg); }
/* klient */
.cmp-stats .sg-stat-nie_zweryfikowano { border-top-style: dashed; }
.cmp-stats .sg-stat { border-top-color: #cbd5e1; }
.cmp-stats .cmp-tile-pogorszenie { border-top-color: var(--sev-critical-fg); }
.cmp-stats .cmp-tile-nowa { border-top-color: var(--sev-major-fg); }
.cmp-stats .cmp-tile-poprawa, .cmp-stats .cmp-tile-nie_stwierdzono { border-top-color: var(--sev-low-fg); }
.cmp-stats .cmp-tile-nie_zweryfikowano { border-top: 4px dashed var(--sev-info-fg); }
.cmp-notes { font-size: 13px; color: #374151; }
.cmp-notes p { margin: 4px 0; }
.cmp-figs { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; }
.cmp-figs figure { margin: 0; max-width: 320px; }
.cmp-figs img { width: 100%; border-radius: 6px; border: 1px solid #d1d5db; }
.cmp-figs figcaption { font-size: 12px; color: #4b5563; }
.cl-cmp-line { margin: 6px 0 0; font-size: 13px; }
@media (max-width: 720px) {
    .cmp-items thead { display: none; }
    .cmp-items tr { display: block; border-bottom: 1px solid #e5e7eb; padding: 6px 0; }
    .cmp-items td, .cmp-items th { display: block; border: 0; padding: 2px 4px; text-align: left !important; }
    .cmp-items td[data-label]::before, .cmp-items th[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: #4b5563; }
    .cmp-map { height: 50vh; }
}
@media (prefers-reduced-motion: reduce) { .cmp-table tr { scroll-behavior: auto; } }
.cmp-tabs { display: inline-flex; gap: 4px; }
.cmp-tabs [role="tab"] { border: 1px solid #c9ccd1; background: #fff; border-radius: 6px; padding: 3px 10px; font-weight: 600; cursor: pointer; }
.cmp-tabs [role="tab"][aria-selected="true"] { background: #1f2430; color: #fff; border-color: #1f2430; }
.cmp-tabs [role="tab"]:focus-visible { outline: 2px solid #1f2430; outline-offset: 2px; }
.cmp-list { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; }
.cmp-go { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; }
.cmp-st-word { font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.cmp-controls { border-top: 1px solid #e5e7eb; margin-top: 6px; padding-top: 6px; }
.cmp-controls .cmp-legend { font-size: 12.5px; }
.cmp-popup-line { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid #e5e7eb; }
.cmp-lead { font-size: 13px; margin: 4px 0 8px; }
.report-view-cmp { max-width: 1100px; margin: 12px auto; padding: 0 12px; }
.cmp-rv-details > summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.cmp-skip { position: absolute; }
/* przyciski <button class="pd-btn"> w panelu porownania (domyslny styl przyciskow panelu jest ciemny) */
.admin-body button.pd-btn { width: auto; background: #fff; color: #1f2430; border: 1px solid #c9ccd1; padding: 7px 13px; font-weight: 600; }
.admin-body button.pd-btn:hover:not(:disabled) { background: #f3f4f6; }
.admin-body button.pd-btn-primary { background: var(--btn-primary-bg, var(--brand-fill)); border-color: var(--btn-primary-bg, var(--brand-fill)); color: var(--btn-primary-fg, #fff); }
.admin-body button.pd-btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--btn-primary-bg, var(--brand-fill)) 90%, black); }
.admin-body button.pd-btn:disabled { opacity: .55; cursor: not-allowed; }
.admin-body button.pd-btn-small { padding: 4px 9px; font-size: 12.5px; }
.admin-body button.pd-btn-link { border-color: transparent; background: transparent; color: #1f4e8c; text-decoration: underline; }
.admin-body button.cmp-chip { width: auto; }
.admin-body button.cmp-chip:not([aria-pressed="true"]) { background: #fff; color: #1f2430; }
/* --- porownanie: poprawki po przegladzie (r3) --- */
.cmp-items tr[hidden], .cmp-items tbody[hidden] { display: none; }
.admin-body button.pd-btn-primary { background: var(--btn-primary-bg, var(--brand-fill)); border-color: var(--btn-primary-bg, var(--brand-fill)); color: var(--btn-primary-fg, #fff); }
.admin-body button.pd-btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--btn-primary-bg, var(--brand-fill)) 90%, black); }
.existing-anomaly-marker.coa-2, .existing-anomaly-marker.coa-x { color: #1f2430; }
.cmp-marker-wrap .existing-anomaly-marker.coa-3 { background: #c0392b; }
.cmp-marker-wrap .existing-anomaly-marker.coa-2 { background: #e8622c; }
.cmp-marker-wrap .existing-anomaly-marker.coa-1 { background: #2ecc71; }
.cmp-marker-wrap .existing-anomaly-marker.coa-x { background: #9ca3af; }
#map .existing-anomaly-marker { width: 24px; height: 24px; }
.cmp-ghost { background: rgba(255, 255, 255, .8); }
.cmp-dec-form select { max-width: 100%; }
@media (max-width: 720px) { .cmp-st { white-space: normal; } }
.cmp-client { position: relative; }
.cmp-thumbs { flex-wrap: wrap; }
.cmp-thumbs figure { margin: 0; }
.cmp-thumbs img { width: 200px; }
.cmp-thumbs figcaption { font-size: 11.5px; color: #4b5563; }
.cmp-index ul { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.cmp-grp-form { margin-left: 10px; }
.cmp-repair-d summary { font-size: 12px; }
.cmp-list-notes { font-size: 12.5px; color: #374151; margin: 8px 0; }
.cmp-list-notes p { margin: 4px 0; }
/* okresy przechowywania per kategoria */
.st-subhead { font-size: 14.5px; margin: 18px 0 2px; color: #1f2430; }
.st-row-text .st-rec { color: #1d6b3a; font-weight: 600; }
.st-ret-row .st-ret-warn { grid-column: 1 / -1; margin: 0; }
/* strona weryfikacji wydanego raportu */
.vf-box { max-width: 520px; text-align: left; }
.vf-box h1 { text-align: left; }
.vf-status { padding: 10px 12px; border-radius: 8px; font-weight: 600; margin: 10px 0 14px; }
.vf-ok { background: #ecfdf3; color: #146c3b; border: 1px solid #b7ebcb; }
.vf-old { background: #fff7ed; color: #8a4b00; border: 1px solid #fde3c4; }
.vf-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
.vf-list dt { color: #6b7280; }
.vf-list dd { margin: 0; color: #1f2430; font-weight: 600; }
@media (max-width: 480px) {     /* /w/<kod> na telefonie: etykieta nad wartoscia, dlugie odciski lamane */
    .vf-list { grid-template-columns: 1fr; gap: 2px 0; }
    .vf-list dd { overflow-wrap: anywhere; margin-bottom: 8px; }
}
.vf-hash { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; word-break: break-all; font-weight: 400 !important; }
/* strona pod kodem QR (wydania raportu): odpowiedz w ramce (tekst + ikona), przycisk pobrania */
.vf-box .qr-status { border-radius: 10px; padding: 12px 13px; margin: 0 0 14px; }
.vf-box .qr-status h1 { font-size: 21px; line-height: 1.25; margin: 0 0 4px; color: inherit; text-align: left; }
.vf-box .qr-status p { margin: 0; font-size: 15px; line-height: 1.45; }
.qr-ok { background: #ecfdf3; color: #146c3b; border: 2px solid #3f9a67; }
.qr-old { background: #fff7ed; color: #8a4b00; border: 2px solid #9a3412; }
.qr-gone { background: #f3f4f6; color: #1f2430; border: 2px solid #6b7280; }
.qr-ico { font-size: 21px; margin-right: 6px; }
.qr-id { font-size: 14px; color: #374151; margin: 0 0 14px; }
.qr-btn { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; width: 100%; min-height: 48px;
    padding: 12px; background: var(--brand-fill, var(--brand-color)); color: #fff; border-radius: 10px; font-weight: 700; font-size: 16px;
    text-decoration: none; text-align: center; margin: 0 0 6px; }
.qr-btn:hover, .qr-btn:focus-visible { background: color-mix(in srgb, var(--brand-fill, var(--brand-color)) 86%, black); }
.qr-btn small { font-weight: 400; font-size: 13px; }
.qr-sec { margin: 18px 0 0; }
.qr-sec h2 { font-size: 16px; margin: 0 0 6px; color: var(--brand-dark); }
.qr-chg { list-style: none; padding: 0; margin: 0; font-size: 14.5px; }
.qr-chg li { padding: 8px 0; border-top: 1px solid #eef0f3; }
.qr-chg b { display: block; }
.qr-chg .you { background: #fff7ed; margin: 0 -6px; padding: 8px 6px; border-radius: 6px; }
.qr-dl { display: grid; grid-template-columns: 1fr; gap: 0; font-size: 14.5px; margin: 0; }
.qr-dl dt { color: #4b5563; font-size: 13px; margin-top: 8px; }
.qr-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
details.qr-tech { margin-top: 14px; border-top: 1px solid #e5e7eb; padding-top: 2px; }
details.qr-tech summary { cursor: pointer; font-size: 14px; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: #374151; list-style: none; }
details.qr-tech summary::-webkit-details-marker { display: none; }
details.qr-tech summary::before { content: "▸"; content: "▸" / ""; display: inline-block; width: 1.1em; flex: none; color: #4b5563; }   /* drugi zapis (pusty tekst zastepczy): znacznik niewymawiany przez czytnik ekranu (C3-06); pierwszy - zapas dla starszych przegladarek */
details.qr-tech[open] summary::before { content: "▾"; content: "▾" / ""; }
/* potwierdzenie blokady QR - cel kotwicy #qr-zapis, z zapasem pod przyklejonym paskiem projektu (C3-06) */
.ed-saved { scroll-margin-top: 2.5em; }
.qr-hash { font: 12px/1.4 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; font-weight: 400 !important; }
.qr-foot { font-size: 12.5px; color: #4b5563; margin-top: 16px; }
.qr-form .hint { margin: 2px 0 10px; }
/* karta "Wydania raportu" w panelu */
.ed-now { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: 0 0 6px; }
.ed-no { font-size: 20px; font-weight: 800; color: var(--brand-dark); }
.ed-badge { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.ed-badge-ok { background: #ecfdf3; color: #146c3b; border: 1px solid #b7ebcb; }
.ed-badge-last { background: #eef4ff; color: #1e3a8a; border: 1px solid #c7d7fe; }
.report-ed { font-weight: 500; font-size: .85em; margin-left: 4px; }
.ed-meta { font-size: 13.5px; color: #374151; margin: 0 0 6px; }
.ed-pending { background: #eef4ff; color: #1e3a8a; border: 1px solid #c7d7fe; border-radius: 8px; padding: 8px 11px; font-size: 13.5px; margin: 8px 0 12px; }
.ed-actions { margin: 8px 0 4px; }
.ed-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13.5px; }
.ed-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 7px 0; border-top: 1px solid #eef0f3; }
.ed-list .ed-l-no { font-weight: 700; min-width: 86px; }
.ed-list .ed-l-why { flex: 1 1 220px; color: #374151; }
details.ed-more { margin: 8px 0; }
details.ed-more > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--brand-dark); padding: 6px 0; min-height: 24px; }
.sg-thread-note, .comment-note { font-size: 12.5px; margin: 4px 0; }
/* rejestr kwalifikacji (Moj profil) */
.q-edit summary, .q-add summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; }
.q-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 14px; margin-top: 8px; }
.q-add { margin-top: 10px; }
/* zagrozenia */
.hz-item { border-top: 1px solid #eef0f3; padding: 8px 0; }
.a11y-decl { max-width: 680px; }
.a11y-decl h2 { font-size: 16px; margin: 16px 0 6px; text-align: left; }
.a11y-decl ul { margin: 0 0 10px 18px; }
.a11y-decl li { margin-bottom: 6px; }
.login-a11y { text-align: center; font-size: 12.5px; margin-top: 14px; }
.vf-arch { background: #f4f5f7; color: #2b2f36; border: 1px solid #d9dce1; }
.st-ready { list-style: none; margin: 6px 0 10px; padding: 0; font-size: 13.5px; }
.st-ready li { padding: 2px 0; }
.st-ready li.ok span[aria-hidden] { color: #146c3b; }
.st-ready li.bad span[aria-hidden] { color: #b42318; }
.st-ready li.warn span[aria-hidden] { color: #8a4b00; }
.jb-reason { display: block; margin-top: 6px; font-size: 13px; }
.jb-pub-bl { color: #8a4b00; }
/* panel platformy */
.pf-kv { margin: 6px 0 10px 18px; font-size: 13.5px; }
.pf-spark { display: flex; align-items: flex-end; gap: 2px; height: 40px; margin: 6px 0; }
.pf-spark span { flex: 1; background: #8a9bb0; min-height: 1px; }
.pf-sort thead button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; }
.pf-trial { margin: 6px 0; }
.cal-up-sheet { display: block; font-size: 12px; margin: 2px 0 6px 52px; }

/* A2-2: mapa przy <= 360 px - pasek gorny ma 3 linie; mapa i plywajace elementy od jego faktycznej wysokosci */
@media (max-width: 360px) {
    #map, .report-view-body { top: var(--topbar-h, 78px); }
    .anomaly-toggle-btn, .temp-toolbar { top: calc(var(--topbar-h, 78px) + 8px); }
    .download-menu-list { top: calc(var(--topbar-h, 78px) + 6px); }
}
/* strona bledu (templates/error.html, main.py: _error_page) */
.login-box.err-box { width: 440px; max-width: calc(100% - 32px); text-align: center; }
.err-box .err-msg { color: #374151; font-size: 15px; line-height: 1.55; margin: 12px 0 22px; }
.err-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.err-btn { display: block; width: 100%; padding: 12px; border-radius: 8px; font-size: 15px; font-weight: 600; text-decoration: none;
    background: var(--brand-fill, var(--brand-color)); color: #fff; }
.err-btn:hover { background: color-mix(in srgb, var(--brand-fill, var(--brand-color)) 86%, black); }
.err-btn:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.err-link { color: var(--brand-dark); font-size: 14px; }
.err-foot { font-size: 13px; color: #6b7280; margin: 20px 0 0; }
.err-box .err-code { font-size: 12px; color: var(--text-4); margin: 14px 0 0; }
@media (max-width: 480px) { .login-box.err-box { padding: 28px 20px 22px; } }
/* wybor koloru (static/js/color_picker.js) - pola #RRGGBB z kwadracikiem podgladu i paleta */
.cp-field { display: inline-flex; align-items: center; gap: 6px; }
.admin-body button.cp-swatch { width: 30px; height: 30px; flex: none; padding: 0; border-radius: 6px; border: 1px solid #8f949c;
    background: var(--cp-c, transparent); cursor: pointer; box-shadow: inset 0 0 0 2px #fff; }
.admin-body button.cp-swatch:hover { background: var(--cp-c, transparent); border-color: var(--brand-dark); }
.admin-body button.cp-swatch:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.admin-body button.cp-swatch.cp-derived { background: repeating-linear-gradient(135deg, var(--cp-c) 0 6px, #fff 6px 8px); }
.admin-body button.cp-swatch.cp-none,
.admin-body button.cp-swatch.cp-bad { background: linear-gradient(135deg, #fff 45%, #c0392b 45% 55%, #fff 55%); }
.cp-pop { position: absolute; z-index: 1000; width: 272px; padding: 12px; background: #fff; border: 1px solid #d5d8de; border-radius: 10px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, .18); font-size: 13px; }
.cp-pop[hidden] { display: none; }
.cp-sv { position: relative; height: 150px; border-radius: 6px; cursor: crosshair; touch-action: none; }
.cp-sv:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.cp-sv-knob { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid #fff; border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.cp-hue-l { display: block; margin: 10px 0 8px; }
.cp-hue { width: 100%; height: 12px; margin: 0; border-radius: 6px; appearance: none; -webkit-appearance: none;
    background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.cp-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 1px solid #666; cursor: pointer; }
.cp-hue::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1px solid #666; cursor: pointer; }
.cp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.cp-now { width: 34px; height: 34px; border-radius: 6px; border: 1px solid #8f949c; flex: none; }
.cp-f { display: inline-flex; align-items: center; gap: 4px; color: #4b5563; font-weight: 600; }
.cp-pop .cp-hex { width: 92px; padding: 6px 8px; font-family: ui-monospace, Consolas, monospace; border: 1px solid #c9ccd1; border-radius: 6px; }
.cp-rgb .cp-f input { width: 58px; padding: 5px 6px; border: 1px solid #c9ccd1; border-radius: 6px; }
.admin-body .cp-pop button { width: auto; padding: 6px 10px; font-size: 12.5px; }
.cp-sub { font-size: 12px; color: #6b7280; margin: 4px 0 4px; }
.cp-shades, .cp-set { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.cp-set[hidden], .cp-sub[hidden] { display: none; }
.admin-body .cp-pop button.cp-chip { width: 24px; height: 24px; padding: 0; border-radius: 4px; border: 1px solid rgba(0,0,0,.25); }
.admin-body .cp-pop button.cp-chip:hover { transform: scale(1.12); }
.cp-contrast { margin: 2px 0 10px; color: #374151; line-height: 1.5; }
.cp-hint { display: block; font-size: 11.5px; color: #6b7280; }
.cp-actions { margin: 0; }

/* ---------------- pulpit (strona startowa panelu) */
.db-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.db-title { margin-right: auto; }
.db-head h1 { margin: 0; font-size: 24px; line-height: 1.2; color: var(--ink); }
.db-date { margin: 3px 0 0; font-size: 13.5px; color: var(--text-3); }
.db-search { display: flex; align-items: stretch; margin: 0; }
.db-search input { width: 300px; padding: 8px 12px 8px 34px; font-size: 14px; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; }
.admin-body .db-search button { width: auto; padding: 8px 14px; font-size: 14px; font-weight: 600; background: var(--surface); color: var(--brand-dark); border: 1px solid var(--line-strong); border-radius: 0 var(--r-md) var(--r-md) 0; cursor: pointer; }
.admin-body .db-search button:hover { background: var(--surface-2); }
.db-new { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--r-md); background: var(--brand-fill); color: #fff !important; font-weight: 600; font-size: 14px; text-decoration: none !important; white-space: nowrap; }
.db-new:hover { background: color-mix(in srgb, var(--brand-fill) 85%, black); }

.db-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.db-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.db-grid .card { margin: 0; }
.db-grid [hidden] { display: none !important; }
.db-grid.db-grid-new, .db-grid.db-grid-noup { grid-template-columns: minmax(0, 920px); }

.db-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; margin-bottom: 2px; border-bottom: 1px solid var(--line-soft); }
.card .db-card-head h2 { margin: 0; padding: 0; border: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.db-count { background: #eef0f3; color: var(--text-2); font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-pill); font-variant-numeric: tabular-nums; }
.db-count-alert { background: var(--err-bg); color: var(--err-fg); }
.db-head-link { font-size: 13px; white-space: nowrap; }

.db-tasks { list-style: none; margin: 0; padding: 0; }
.db-task { display: grid; grid-template-columns: 136px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line-soft); }
.db-tasks > .db-task:last-child, .db-more .db-task:last-child { border-bottom: 0; }
.db-tag { justify-self: start; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-sm); white-space: nowrap; }
.db-tag-err { background: var(--err-bg); color: var(--err-fg); }
.db-tag-warn { background: var(--warn-bg); color: var(--warn-fg); }
.db-tag-info { background: #f1f2f4; color: #374151; }
.db-task-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.db-task-title { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-task-title .db-client { font-weight: 400; color: var(--text-3); }
.db-task-meta { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-act { display: inline-block; padding: 6px 12px; font-size: 13px; font-weight: 600; border: 1px solid #c9ccd1; border-radius: 7px; background: #fff; color: var(--brand-dark) !important; white-space: nowrap; text-decoration: none !important; }
.db-act:hover { background: #f3f4f6; }
.db-more { border-top: 1px solid var(--line-soft); }
.db-more > summary { list-style: none; cursor: pointer; padding: 9px 4px 2px; font-size: 13px; font-weight: 600; color: var(--brand-dark); }
.db-more > summary::-webkit-details-marker { display: none; }
.db-more > summary::after { content: " ▾"; font-size: 11px; }
.db-more > summary .db-hide, .db-more[open] > summary .db-show { display: none; }
.db-more[open] > summary .db-hide { display: inline; }
.db-more[open] > summary::after { content: " ▴"; }
.db-short { grid-column: 1 / -1; }
.db-short-list { list-style: none; margin: 0; padding: 0; }
.db-short-list li { padding: 9px 2px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.db-short-list li:last-child { border-bottom: 0; }
.db-short-list a { font-weight: 600; }
.db-short-desc { display: block; font-size: 12.5px; color: var(--text-3); }
.admin-body summary:focus-visible { outline: 2px solid var(--brand-color); outline-offset: 2px; }
.db-note { margin: 8px 0 0; padding: 8px 4px 0; border-top: 1px dashed #e5e7eb; font-size: 12.5px; color: var(--text-3); }
.db-note b { color: var(--text-2); font-weight: 600; }
.db-unread { margin: 6px 0 0; padding: 0 4px; font-size: 12.5px; color: var(--text-3); }
.admin-body .db-linkbtn { width: auto; padding: 0; background: none; border: 0; color: var(--brand-dark); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.db-done { display: flex; align-items: center; gap: 12px; padding: 18px 4px 6px; }
.db-done-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--ok-bg); color: var(--ok-fg); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.db-done strong { display: block; font-size: 14.5px; color: var(--ink); }
.db-done span { font-size: 13px; color: var(--text-3); }

.db-sub { margin: 12px 0 2px; padding: 0 4px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.db-sub:first-of-type { margin-top: 8px; }
.db-up-list { list-style: none; margin: 0; padding: 0; }
.db-up-item { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line-soft); }
.db-up-list:last-of-type .db-up-item:last-child { border-bottom: 0; }
.db-date-box { grid-row: span 2; align-self: start; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 46px; border-radius: var(--r-md); background: var(--warn-bg); color: var(--warn-fg); line-height: 1; }
.db-date-box b { font-size: 17px; font-variant-numeric: tabular-nums; }
.db-date-box i { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.db-up-overdue .db-date-box { background: var(--err-bg); color: var(--err-fg); }
.db-up-today .db-date-box { background: var(--brand-dark); color: #fff; }
.db-up-client { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-up-meta { grid-column: 2; font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.db-when { grid-column: 3; grid-row: 1; font-size: 12.5px; color: var(--text-3); white-space: nowrap; text-align: right; }
.db-up-overdue .db-when { color: var(--err-fg); font-weight: 600; }
.db-up-today .db-when { color: var(--ink); font-weight: 700; }
.db-up-links { grid-column: 2 / -1; display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 12.5px; margin-top: 3px; }
.db-up-later { margin: 10px 0 0; padding: 8px 4px 0; border-top: 1px dashed #e5e7eb; font-size: 12.5px; color: var(--text-3); }

.db-table-wrap { overflow-x: auto; }
.db-table td { padding: 10px; font-size: 13.5px; }
.db-table tbody tr:hover { background: #fafbfc; }
.db-table tr:last-child td { border-bottom: 0; }
.db-table .db-col-name { min-width: 240px; }
.db-table td.pl-actions { text-align: right; white-space: nowrap; }

.db-steps { list-style: none; margin: 6px 0 0; padding: 0; counter-reset: dbs; }
.db-step { counter-increment: dbs; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 2px 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); }
.db-step:last-child { border-bottom: 0; }
.db-step::before { content: counter(dbs); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid #c9ccd1; color: var(--text-2); font-weight: 700; font-size: 13.5px; display: flex; align-items: center; justify-content: center; }
.db-step b { grid-column: 2; grid-row: 1; font-size: 14px; color: var(--ink); }
.db-step-desc { grid-column: 2; grid-row: 2; font-size: 12.5px; color: var(--text-3); }
.db-step .db-act { grid-column: 3; grid-row: 1 / span 2; }
.db-step-done::before { content: "✓"; background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.db-step-done b { color: var(--text-3); font-weight: 600; text-decoration: line-through; text-decoration-color: #c9ccd1; }
.db-step-ok { grid-column: 3; grid-row: 1 / span 2; font-size: 12.5px; font-weight: 600; color: var(--ok-fg); }
.db-steps-foot { margin: 10px 0 0; font-size: 13px; color: var(--text-3); }

@media (max-width: 1099px) {
    .db-grid, .db-grid.db-grid-new, .db-grid.db-grid-noup { grid-template-columns: minmax(0, 1fr); }
    .db-col { display: contents; }
    .db-todo { order: 1; } .db-up { order: 2; } .db-recent { order: 3; }
}
@media (max-width: 760px) {
    .db-grid-today .db-up { order: 0; }
    .db-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title new" "search search"; align-items: center; }
    .db-title { grid-area: title; } .db-new { grid-area: new; padding: 10px 14px; } .db-search { grid-area: search; }
    .db-search input { width: 100%; min-width: 0; flex: 1; padding-top: 10px; padding-bottom: 10px; }
    .db-head h1 { font-size: 22px; }
    .db-task { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 2px; }
    .db-tag { grid-column: 1 / -1; }
    .db-task-title, .db-task-meta { white-space: normal; }
    .db-act { padding: 10px 14px; min-height: 44px; display: inline-flex; align-items: center; }
    .db-up-links a { padding: 6px 0; }
    .db-table thead { display: none; }
    .db-table, .db-table tbody, .db-table td { display: block; width: 100%; }
    .db-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line-soft); }
    .db-table td { width: auto; padding: 0; border: 0; }
    .db-table .db-col-date, .db-table td.pl-actions { display: none; }
    .db-table .db-col-name { flex: 1 1 100%; min-width: 0; }
    .db-table .pl-name-link { display: inline-block; padding: 4px 0; }
    .db-step { grid-template-columns: 32px minmax(0, 1fr); }
    .db-step .db-act, .db-step-ok { grid-column: 2; grid-row: auto; justify-self: start; margin-top: 6px; }
}
/* pulpit: wiersz zbiorczy (> 3 zadania jednego rodzaju) - <details> bez JS */
.db-search input::placeholder { color: var(--text-4); }
.db-task-group { border-bottom: 1px solid var(--line-soft); }
.db-tasks > .db-task-group:last-child { border-bottom: 0; }
.db-group > summary.db-task { list-style: none; cursor: pointer; border-bottom: 0; }
.db-group > summary::-webkit-details-marker { display: none; }
.db-group > summary:hover .db-act { background: #f3f4f6; }
.db-group .db-hide, .db-group[open] .db-show { display: none; }
.db-group[open] .db-hide { display: inline; }
.db-group-list { margin: 0 0 8px 14px; padding-left: 12px; border-left: 2px solid var(--line-soft); }
.db-group-list > .db-task:last-child { border-bottom: 0; }
@media (max-width: 760px) {
    .db-group-list { margin-left: 4px; padding-left: 8px; }
}

/* =====================================================================
   UŻYTKOWNICY I UPRAWNIENIA (us-*) (uprawnienia r1)
   Tylko istniejące zmienne; zero kolorów marki poza var(--brand-*).
   UWAGA: globalne ".admin-body button { width:100% }" – każdy przycisk us-* ma width:auto.
   ===================================================================== */
/* nagłówek strony (lista i formularz) */
.us-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.us-head h1 { margin: 0; font-size: 24px; line-height: 1.2; color: var(--ink); }
.us-lead { margin: 4px 0 0; font-size: 13.5px; color: var(--text-3); }
.us-crumb { margin: 0 0 8px; font-size: 13px; }
.us-new { display: inline-flex; align-items: center; padding: 9px 16px; border-radius: var(--r-md); background: var(--brand-fill); color: #fff !important; font-weight: 600; font-size: 14px; text-decoration: none !important; white-space: nowrap; }
.us-new:hover { background: color-mix(in srgb, var(--brand-fill) 85%, black); }
.us-ok { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--r-md); background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-fg); font-size: 13.5px; }
.us-ok b { color: var(--ink); }

/* lista użytkowników */
.us-table td { padding: 11px 10px; font-size: 13.5px; vertical-align: top; }
.us-table tbody tr:hover { background: #fafbfc; }
.us-table tr:last-child td { border-bottom: 0; }
.us-login { font-weight: 600; font-size: 14px; color: var(--ink); }
.us-sub { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.us-role { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-sm); white-space: nowrap; background: #f1f2f4; color: #374151; }
.us-role-admin { background: #eaf1fb; color: #1e4f8f; }
.us-role-oper { background: #f1f2f4; color: #374151; }
.us-role-platform { background: #1f2430; color: #fff; }
.us-custom { display: inline-block; margin-left: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); border: 1px dashed var(--line-strong); color: var(--text-2); background: #fff; white-space: nowrap; }
.us-diff { display: block; margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.us-flag { display: inline-block; margin-left: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); background: var(--ok-bg); color: var(--ok-fg); white-space: nowrap; }
.us-log > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.us-log > summary::-webkit-details-marker { display: none; }
.us-log > summary h2 { display: inline; margin: 0; padding: 0; border: 0; font-size: 15px; }
.us-log > summary::after { content: "▾"; font-size: 11px; color: var(--brand-dark); }
.us-log[open] > summary::after { content: "▴"; }
.us-log-list { margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.us-log-list li { padding: 7px 0; border-top: 1px solid var(--line-soft); }
.us-log-list time { font-variant-numeric: tabular-nums; color: var(--text-3); }
.us-you { display: inline-block; margin-left: 6px; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: var(--r-pill); background: var(--ok-bg); color: var(--ok-fg); vertical-align: 1px; }
.us-env { display: inline-block; margin-left: 6px; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: var(--r-pill); background: #f1f2f4; color: #4b5563; vertical-align: 1px; }
.us-act { display: inline-block; padding: 6px 12px; font-size: 13px; font-weight: 600; border: 1px solid #c9ccd1; border-radius: 7px; background: #fff; color: var(--brand-dark) !important; white-space: nowrap; text-decoration: none !important; }
.us-act:hover { background: #f3f4f6; }
.us-muted { font-size: 12.5px; color: var(--text-3); }
.us-help { margin-top: 12px; font-size: 13px; color: var(--text-2); }
.us-help > summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); }
.us-help dl { margin: 10px 0 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; }
.us-help dt { font-weight: 600; color: var(--ink); }
.us-help dd { margin: 0; }

/* formularz: kolumna główna + podgląd po prawej */
.us-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
/* kolejność w DOM (= czytnik i telefon): formularz → podgląd → pasek zapisu → hasło/usunięcie */
.us-main { grid-column: 1; grid-row: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.us-aside { grid-column: 2; grid-row: 1 / span 3; align-self: start; position: sticky; top: 16px; min-width: 0; }
.us-savebar { grid-column: 1; grid-row: 2; }
.us-extra { grid-column: 1; grid-row: 3; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.us-main .card, .us-aside .card, .us-extra .card { margin: 0; }
.us-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.us-fields .us-wide { grid-column: 1 / -1; }
.us-pass { display: flex; gap: 6px; }
.us-pass input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.admin-body .us-pass button { width: auto; padding: 8px 12px; font-size: 13px; background: #fff; color: var(--brand-dark); border: 1px solid #c9ccd1; border-radius: 6px; }

/* fieldset = karta (rola, rodzaje, grupy uprawnień); legend pełni rolę nagłówka */
.us-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.us-fs > legend { padding: 0; margin: 0 0 4px; font-size: 15px; font-weight: 700; color: var(--brand-dark); }
.us-legend-h { margin: 0; font: inherit; color: inherit; }
.us-fs-desc { margin: 0 0 12px; font-size: 12.5px; color: var(--text-3); }
.us-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.us-rcard { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 12px 12px 12px 36px; background: #fff; border: 1px solid #d7dae0; border-radius: 9px; cursor: pointer; }
.us-rcard:hover { border-color: #aeb3bb; }
.us-rcard input { position: absolute; left: 12px; top: 14px; margin: 0; accent-color: var(--brand-color); }
.us-rcard:has(input:checked) { border-color: var(--brand-color); box-shadow: 0 0 0 3px rgba(var(--brand-color-rgb), .14); }
.us-rcard:has(input:focus-visible) { outline: 2px solid var(--brand-color); outline-offset: 2px; }
.us-rcard:has(input:disabled) { cursor: not-allowed; background: var(--surface-2); }
.us-rcard-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.us-rcard-sub { font-size: 12.5px; color: var(--text-3); line-height: 1.4; }

.us-types { display: flex; flex-wrap: wrap; gap: 8px; }
.us-type { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #d7dae0; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; background: #fff; }
.us-type input { margin: 0; accent-color: var(--brand-color); width: 16px; height: 16px; }
.us-type:has(input:checked) { border-color: var(--brand-color); background: rgba(var(--brand-color-rgb), .06); }
.us-type:has(input:focus-visible) { outline: 2px solid var(--brand-color); outline-offset: 2px; }

.us-group + .us-group { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.us-group > legend { float: left; width: 100%; padding: 0; margin: 0 0 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }   /* float: legenda w treści, nie na linii obramowania */
.us-group > .us-perm { clear: both; }
.us-layout [hidden], .us-main [hidden] { display: none !important; }   /* display:flex/grid nadpisywał atrybut hidden */
.us-perm { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 8px; padding: 8px 4px; border-radius: var(--r-md); cursor: pointer; }
.us-perm:hover { background: #fafbfc; }
.us-perm input { grid-row: span 3; margin: 2px 0 0; width: 17px; height: 17px; accent-color: var(--brand-color); }
.us-perm:has(input:focus-visible) { outline: 2px solid var(--brand-color); outline-offset: 1px; }
.us-perm-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.us-perm-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.us-perm-key { font-size: 11px; font-weight: 700; padding: 1px 6px; margin-left: 6px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn-fg); vertical-align: 1px; }
.us-perm-why { font-size: 12.5px; color: var(--warn-fg); display: flex; gap: 5px; align-items: flex-start; }
.us-perm-why svg { flex: 0 0 auto; margin-top: 2px; }
.us-perm:has(input:disabled) { cursor: not-allowed; }
.us-perm:has(input:disabled) .us-perm-title { color: var(--text-2); }
.us-perm[hidden], .us-perm-why[hidden] { display: none !important; }

/* komunikaty blokad (konto z .env, własne konto, szersze uprawnienia, ostatni administrator) */
.us-lock { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r-md); background: #f1f2f4; border: 1px solid var(--line); color: #374151; font-size: 13.5px; line-height: 1.5; }
.us-lock svg { flex: 0 0 auto; margin-top: 2px; color: var(--text-2); }
.us-lock b { color: var(--ink); }
.us-lock-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #5b3a12; }
.us-lock-warn svg { color: var(--warn-fg); }
.us-status { min-height: 0; margin: 10px 0 0; font-size: 12.5px; color: var(--warn-fg); }
.us-status:empty { margin: 0; }

/* podgląd "Co zobaczy ta osoba" */
.us-pv h2 { margin: 0 0 4px; padding: 0; border: 0; font-size: 15px; color: var(--brand-dark); }
.us-pv-sum { margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: var(--text-3); }
.us-pv h3 { margin: 12px 0 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.us-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.us-tabs li { font-size: 12.5px; font-weight: 600; padding: 4px 9px; border-radius: var(--r-sm); background: #eef1f5; color: var(--ink); }
.us-see { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.us-see[hidden], .us-pv h3[hidden] { display: none; }
.us-see li { position: relative; padding: 3px 0 3px 20px; line-height: 1.45; }
.us-see li::before { content: "✓"; position: absolute; left: 2px; color: var(--ok-fg); font-weight: 700; }
.us-see.us-nosee li::before { content: "–"; color: var(--text-3); }
.us-pv-foot { margin: 12px 0 0; font-size: 12px; color: var(--text-3); }

/* pasek zapisu (przyklejony u dołu na długim formularzu) */
.us-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 -2px 12px rgba(16,24,40,.08); }
.admin-body .us-save { width: auto; padding: 10px 18px; font-size: 14px; font-weight: 600; background: var(--brand-fill); color: #fff; border: 0; border-radius: var(--r-md); cursor: pointer; }
.us-dirty { font-size: 12.5px; color: var(--warn-fg); font-weight: 600; }
.us-dirty[hidden] { display: none; }
.us-cancel { font-size: 13.5px; }

/* hasło / usunięcie na stronie edycji */
.us-pwform { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.us-pwform .pl-field { flex: 1 1 240px; }
.admin-body .us-btn2 { width: auto; padding: 8px 14px; font-size: 13.5px; font-weight: 600; background: #fff; color: var(--brand-dark); border: 1px solid #c9ccd1; border-radius: 6px; cursor: pointer; }
.admin-body .us-del { width: auto; padding: 8px 14px; font-size: 13.5px; font-weight: 600; background: #fff; color: #b42318; border: 1px solid var(--err-line); border-radius: 6px; cursor: pointer; }
.admin-body .us-del:hover:not(:disabled) { background: var(--err-bg); }
.admin-body .us-del:disabled { opacity: .5; cursor: not-allowed; }
.us-danger h2 { color: #b42318; }

/* Panel platformy – karta firmy: "Użytkownicy firmy" (ta sama tabela .us-table) */
.us-pf-note { margin: 0 0 10px; font-size: 12.5px; color: var(--text-3); }

@media (max-width: 1099px) {
  .us-layout { grid-template-columns: minmax(0, 1fr); }
  .us-main, .us-aside, .us-savebar, .us-extra { grid-column: 1; grid-row: auto; }
  .us-aside { position: static; }
}
@media (max-width: 760px) {
  .us-head { align-items: center; }
  .us-head h1 { font-size: 22px; }
  .us-roles { grid-template-columns: minmax(0, 1fr); }
  .us-fields { grid-template-columns: minmax(0, 1fr); }
  .us-perm { padding: 10px 2px; }
  .us-table thead { display: none; }
  .us-table, .us-table tbody, .us-table tr, .us-table td { display: block; width: 100%; }
  .us-table tr { padding: 12px 2px; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .us-table td { padding: 0; border: 0; width: auto; }
  .us-table td.us-c-user { grid-column: 1; }
  .us-table td.us-c-act { grid-column: 2; grid-row: 1; align-self: start; }
  .us-table td.us-c-role, .us-table td.us-c-scope { grid-column: 1 / -1; }
  .us-table td.us-c-date { display: none; }
  .us-table td, .us-sub, .us-diff { white-space: normal; overflow-wrap: anywhere; }
  .us-role, .us-custom, .us-flag { white-space: normal; }
  .us-act { padding: 10px 14px; }
  .us-savebar { border-radius: 0; margin: 0 -12px; }
  .admin-body .us-save { flex: 1 1 auto; padding: 12px 18px; }
  .us-help dl { grid-template-columns: minmax(0, 1fr); }
}

/* =====================================================================
   PULPIT – FINANSE I ROZLICZENIA (db-fin-*) (uprawnienia r1)
   ===================================================================== */
.db-fin { grid-column: 1 / -1; }                 /* pełna szerokość pod obiema kolumnami pulpitu */
.db-fin [hidden] { display: none !important; }
.db-fin-grid { display: grid; grid-template-columns: minmax(210px, .85fr) minmax(240px, 1fr) minmax(0, 1.55fr); }
.db-fin-block { min-width: 0; padding: 12px 20px 4px; border-left: 1px solid var(--line-soft); }
.db-fin-block:first-child { padding-left: 4px; border-left: 0; }
.db-fin h3 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.db-fin-amount { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.db-fin-amount-neg { color: var(--err-fg); }
.db-fin-state { display: inline-block; margin: 8px 0 0; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-sm); }
.db-fin-state-warn { background: var(--warn-bg); color: var(--warn-fg); }
.db-fin-state-err { background: var(--err-bg); color: var(--err-fg); }
.db-fin-note { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-3); }
.db-fin-note b { color: var(--text-2); }
.db-fin-kv { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; font-size: 13.5px; }
.db-fin-kv dt { padding: 6px 0; color: var(--text-2); border-bottom: 1px solid var(--line-soft); }
.db-fin-kv dd { margin: 0; padding: 6px 0; text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.db-fin-kv dt:nth-last-of-type(1), .db-fin-kv dd:last-of-type { border-bottom: 0; }
.db-fin-kv small { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); }
.db-fin-list { list-style: none; margin: 0; padding: 0; }
.db-fin-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 0 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.db-fin-row:last-child { border-bottom: 0; }
.db-fin-date { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.db-fin-what { min-width: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-fin-what span { color: var(--text-3); }
.db-fin-sum { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.db-fin-plus { color: var(--ok-fg); }

.db-fin-grid.db-fin-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); max-width: 640px; }
@media (max-width: 1099px) {
  .db-fin { order: 4; }
  .db-fin-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .db-fin-block:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line-soft); margin-top: 10px; padding-left: 4px; }
}
@media (max-width: 760px) {
  .db-fin-grid { grid-template-columns: minmax(0, 1fr); }
  .db-fin-grid.db-fin-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .db-fin-block { padding: 12px 2px 4px; border-left: 0; }
  .db-fin-block + .db-fin-block { border-top: 1px solid var(--line-soft); margin-top: 8px; }
  .db-fin-block:nth-child(3) { padding-left: 2px; }
  .db-fin-what { white-space: normal; }
}

/* Rozliczenia (/admin/rozliczenia) – ta sama siatka db-fin-grid + tabela projects-table */
.rz-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 12px; }
.admin-body .rz-filter button { width: auto; padding: 8px 14px; font-size: 13.5px; background: var(--brand-dark); color: #fff; border: 0; border-radius: 6px; }
.rz-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Konto z samym podgladem cudzego projektu (A2-02): pasek "Tylko podglad", bez formularzy zapisu */
.pv-ro-note { margin: 0 0 12px; background: #eef2f7; border-color: #d5dde8; color: #1f2937; }
body:has(.pv-ro-note) form[method="post" i]:not(.ro-ok) { display: none; }
/* A3-01/A3-03: tresc raportu zostaje widoczna (form.ro-ok), pola w fieldset disabled, przyciski zapisu ukryte */
.ro-fs { display: contents; border: 0; margin: 0; padding: 0; min-width: 0; }
.ro-fs :is(input, select, textarea):disabled { opacity: 1; color: #1f2937; -webkit-text-fill-color: #1f2937; background: #f5f6f8; }
.ro-fs button[type="submit"], .ro-fs p:has(> button[type="submit"]), .ro-hide { display: none !important; }
body:has(.pv-ro-note) :is(.sg-box-del, .sg-box-handle, .sg-del-x) { display: none; }
body:has(.pv-ro-note) .sg-editor .sg-box { cursor: default; }
.projects-table .rz-num { text-align: right; }
.st-wide-link a { white-space: normal; }

/* ===== Zuzycie AI (prefiks za-): kafelek na pulpicie, raport firmy i Panelu platformy - tylko tokeny z tego pliku ===== */
/* ---------- Pulpit: blok „Zużycie AI” w sekcji Finanse i rozliczenia ---------- */
/* Kafelek = KPI miesiąca + 5 ostatnich raportów; JEDEN link („Szczegółowy raport”) rozciągnięty na cały kafelek */
.za-tile { position: relative; display: grid; grid-template-columns: minmax(200px, .8fr) minmax(0, 1.6fr); border-radius: var(--r-md); transition: background .12s; }
.za-tile > .db-fin-block:first-child { padding-left: 4px; }
.za-tile:hover { background: var(--surface-2); }
.za-tile-link { font-size: 13px; font-weight: 600; display: inline-block; margin: 10px 0 4px; }
.za-tile-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }
.za-tile:hover .za-tile-link { text-decoration: underline; }
.za-tile-link:focus-visible { outline: none; }
.za-tile-link:focus-visible::after { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.za-facts { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-3); }
.za-facts b { color: var(--text-2); font-variant-numeric: tabular-nums; }
.za-prev { margin: 4px 0 0; font-size: 12.5px; color: var(--text-3); }
.za-row-sub { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-fin-grid.za-grid { grid-template-columns: minmax(0, 2.4fr) minmax(180px, .7fr); }   /* [kafelek AI] [opłata] */
.db-fin-grid.za-grid-1 { grid-template-columns: minmax(0, 1fr); max-width: 980px; }        /* sam kafelek AI */
.za-sep { border-top: 1px solid var(--line-soft); margin-top: 12px; padding-top: 4px; } /* saldo włączone: rząd AI pod rzędem salda */

/* ---------- Raport: nagłówek, okres ---------- */
.za-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin: 0 0 4px; }
.za-period { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.card .za-period .pl-chip, .za-period .pl-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; text-decoration: none; }
.za-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin: 0; border: 0; padding: 0; }
.za-range legend { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 0; margin: 0 0 5px; float: left; width: 100%; }
.za-range .pl-field { flex: 0 0 auto; }
.card .za-range .pl-field input { width: 158px; min-height: 36px; }
.admin-body .za-range button { width: auto; min-height: 36px; padding: 0 14px; font-size: 13.5px; background: var(--brand-dark); color: #fff; border: 0; border-radius: var(--r-sm); }
.za-range-label { margin: 14px 0 0; font-size: 13.5px; color: var(--text-2); }
.za-range-label b { color: var(--ink); }
.za-err { margin: 10px 0 0; }
.za-xlsx { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-md);
           background: var(--brand-fill); color: #fff !important; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.za-xlsx:hover { background: color-mix(in srgb, var(--brand-fill) 86%, black); }
.za-xlsx:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.za-xlsx svg { flex: 0 0 auto; }

/* ---------- Raport: podsumowanie (KPI) ---------- */
.za-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.za-kpis.za-kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.za-kpi { min-width: 0; padding: 12px 18px 6px; border-left: 1px solid var(--line-soft); }
.za-kpi:first-child { border-left: 0; padding-left: 4px; }
.za-kpi dt { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.za-kpi dd { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.za-kpi dd.za-kpi-main { font-size: 28px; }
.za-kpi small { display: block; margin-top: 4px; font-size: 12.5px; font-weight: 400; color: var(--text-3); white-space: normal; }

/* ---------- Raport: rozbicie wg rodzaju analizy / miesięcy (pasek = ozdoba, liczby w tekście) ---------- */
.za-break { width: 100%; }
.za-break td.za-bar-cell { width: 34%; min-width: 90px; }
.za-bar { display: block; height: 8px; border-radius: var(--r-pill); background: var(--line-soft); overflow: hidden; }
.za-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--brand-fill); }

/* ---------- Tabele (sortowanie serwerowe: linki w nagłówkach + aria-sort) ---------- */
.projects-table th.sortable a { color: inherit; text-decoration: none; display: inline-block; padding: 4px 0; }
.projects-table th.sortable a:hover { color: var(--brand-ink); text-decoration: underline; }
.projects-table th.sortable a:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; border-radius: 3px; }
.za-table tfoot td, .za-table tfoot th { font-weight: 700; color: var(--ink); border-top: 2px solid var(--line); background: var(--surface-2); }
.za-table td.za-name { min-width: 220px; }
.projects-table.za-table tbody th, .projects-table.za-table tfoot th { text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); text-align: left; }
.za-table .pl-sub { display: block; }
.za-muted { color: var(--text-3); }
.za-sum-note { margin: 10px 0 0; }

/* ---------- Panel platformy: przełącznik kwot i widoczności ---------- */
.za-basis { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; }
.za-basis > span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.za-vis, .card form.za-vis { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; align-items: start; padding: 14px 16px; margin: 0 0 16px;
          border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.za-vis fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.za-vis legend { font-weight: 700; font-size: 14px; color: var(--ink); padding: 0; margin: 0 0 8px; }
.za-vis .st-switch { margin: 0; }
.za-vis .hint { margin: 6px 0 0; line-height: 1.5; }
.admin-body .za-vis button { width: auto; min-height: 36px; padding: 0 16px; font-size: 13.5px; background: var(--brand-dark); color: #fff; border: 0; border-radius: var(--r-sm); }
.za-badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-line); }
.za-badge-off { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }

/* ---------- Szczegóły projektu ---------- */
.za-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.za-meta b { color: var(--ink); font-weight: 600; }

/* ---------- Tablet ---------- */
@media (max-width: 1099px) {
  .za-kpis, .za-kpis.za-kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .za-kpi:nth-child(3n+1) { border-left: 0; padding-left: 4px; }
  .db-fin-grid.za-grid { grid-template-columns: minmax(0, 1fr); }
  .db-fin-grid.za-grid > .db-fin-block:not(.za-tile) { border-left: 0; border-top: 1px solid var(--line-soft); margin-top: 8px; padding-left: 4px; }
}
/* ---------- Telefon (375 px): tabele jako karty, KPI 2 × n, linki dotykowe ≥ 44 px ---------- */
@media (max-width: 760px) {
  .za-tile { grid-template-columns: minmax(0, 1fr); }
  .za-tile > .db-fin-block + .db-fin-block { border-left: 0; border-top: 1px solid var(--line-soft); }
  .za-tile:hover { background: transparent; }
  .za-kpis, .za-kpis.za-kpis-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .za-kpi { padding: 10px 10px 6px; border-left: 0; border-top: 1px solid var(--line-soft); }
  .za-kpi:nth-child(odd) { padding-left: 2px; }
  .za-kpi:nth-child(-n+2) { border-top: 0; }
  .za-kpi:first-child { grid-column: 1 / -1; }
  .za-kpi:first-child + .za-kpi { border-top: 1px solid var(--line-soft); }
  .za-kpi dd { font-size: 20px; } .za-kpi dd.za-kpi-main { font-size: 28px; }
  .za-toolbar { flex-direction: column; align-items: stretch; }
  .za-xlsx { justify-content: center; min-height: 44px; }
  .card .za-period .pl-chip, .za-period .pl-chip { min-height: 44px; }
  .za-range .pl-field { flex: 1 1 130px; }
  .za-range button { flex: 1 1 100%; min-height: 44px !important; }
  .card .za-range .pl-field input { width: 100%; min-height: 44px; }
  /* tabela -> karty: etykieta z data-label */
  .za-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .za-cards, .za-cards tbody, .za-cards tfoot, .za-cards tr, .za-cards td, .za-cards th[scope="row"] { display: block; width: 100%; }
  .za-cards tr { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
  .za-cards td, .za-cards th[scope="row"] { border: 0 !important; padding: 2px 0 !important; text-align: left !important; }
  .za-cards td[data-label] { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
  .za-cards td[data-label]::before { content: attr(data-label); color: var(--text-3); font-weight: 400; }
  .za-cards td[data-label]:empty { display: none; }
  .za-cards td.za-name { min-width: 0; padding-bottom: 6px !important; }
  .za-cards tfoot tr { background: var(--surface-2); padding: 10px 8px; border-radius: var(--r-md); margin-top: 8px; }
  .za-cards td.za-bar-cell { width: 100%; }
  .za-vis, .card form.za-vis { grid-template-columns: minmax(0, 1fr); }
  .admin-body .za-vis button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .za-bar > i { transition: none; } }
@media print {
  .admin-header, .za-toolbar, .za-basis, .us-crumb, .skip-link { display: none !important; }
  .za-bar > i { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

.za-tile.za-tile-1 { grid-template-columns: minmax(0, 1fr); }
.za-head-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
.za-range-form { margin-top: 12px; }
.za-badge-row { margin-left: 6px; }
.za-card-month { margin: 18px 0 8px; font-size: 14px; }
.za-card-link { margin: 10px 0 0; }
/* ===== Poczta wychodzaca (Ustawienia) ===== */
.card form.smtp-form { display: block; }
.smtp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; max-width: 760px; margin-top: 10px; }
.smtp-grid .smtp-wide { grid-column: 1 / -1; margin: -4px 0 0; }
.smtp-grid input[type=text], .smtp-grid input[type=email], .smtp-grid input[type=password] { width: 100%; box-sizing: border-box; min-height: 38px; font-weight: 400; }
.smtp-radio { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.smtp-radio legend { font-size: 12px; font-weight: 600; color: #4b5563; padding: 0; margin: 0 0 6px; }
.smtp-radio label, .smtp-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; min-height: 32px; }
.smtp-actions { margin: 14px 0 4px; }
.smtp-state { margin: 6px 0 4px; font-size: 13.5px; }
.smtp-sub { margin: 20px 0 6px; font-size: 14px; }
.card form.smtp-test { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.smtp-test .pl-field input { min-width: 260px; min-height: 38px; }
.smtp-hist { margin-top: 12px; font-size: 13px; }
.smtp-hist ul { margin: 6px 0 0 18px; padding: 0; }
@media (max-width: 760px) {
  .smtp-grid { grid-template-columns: minmax(0, 1fr); }
  .smtp-test .pl-field, .smtp-test .pl-field input { width: 100%; min-width: 0; }
  .smtp-form button { width: 100%; min-height: 44px; }
}

/* =====================================================================
   Rozliczenia: pakiety, opłata wdrożeniowa, saldo, integracje (prefiks rl-)
   (rozliczenia r1)
   Tylko nowe klasy; wyłącznie tokeny z style.css (--ink, --text-*, --line*, --surface*, --ok-*, --warn-*,
   --err-*, --brand-*, --r-*) – wygląd marek instalacji bez zmian.

   ===================================================================== */

/* ---------- Panel platformy: „Na tej stronie” (strona ma 8+ kart) ---------- */
.rl-toc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: -4px 0 16px; padding: 0; list-style: none; font-size: 13px; }
.rl-toc > li:first-child { font-weight: 600; color: var(--text-2); margin-right: 2px; }
.rl-toc a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-pill);
            background: var(--surface); color: var(--ink); text-decoration: none; }
.rl-toc a:hover { border-color: var(--line-strong); background: var(--surface-2); }

/* ---------- Grupa kart pod wspólnym nagłówkiem (Rozliczenia / Integracje) ---------- */
.rl-group-h { grid-column: 1 / -1; margin: 10px 0 -4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }

/* ---------- Znaczniki stanu (tekst zawsze obecny – nie sam kolor) ---------- */
.rl-badge { display: inline-block; font-size: 11.5px; font-weight: 700; line-height: 1.4; padding: 2px 8px; border-radius: var(--r-pill);
            border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); white-space: nowrap; vertical-align: 1px; }
.rl-badge-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-line); }
.rl-badge-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.rl-badge-err { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-line); }
.card h2 .rl-badge { margin-left: 8px; font-size: 11.5px; }

/* ---------- Nagłówek karty z akcją po prawej ---------- */
.rl-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px;
           margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.card .rl-head h2 { margin: 0; padding: 0; border: 0; }
.rl-head .hint { margin: 0; }

/* ---------- Tabele (cennik, historia salda) ---------- */
.rl-table td, .rl-table th { vertical-align: top; }
.projects-table.rl-table tbody th { text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); background: transparent; text-align: left; }
.rl-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rl-plus { color: var(--ok-fg); }
.rl-sub { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); }
.rl-row-off th, .rl-row-off td { color: var(--text-3); }
.rl-actions { white-space: nowrap; text-align: right; }
.rl-actions details { display: inline-block; text-align: left; }
.rl-actions summary { list-style: none; cursor: pointer; }
.rl-actions summary::-webkit-details-marker { display: none; }
.rl-edit { margin: 8px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.rl-edit-row td { padding-top: 0 !important; background: var(--surface-2); }

/* ---------- Formularze rozliczeń (siatka etykiet nad polami) ---------- */
.card form.rl-form, .rl-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; align-items: end; margin: 8px 0 0; }
.rl-form label, .rl-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0; }
.rl-form .rl-wide { grid-column: 1 / -1; }
.rl-form .rl-span2 { grid-column: span 2; }
.rl-form .hint { font-weight: 400; margin: 0; }
.rl-form input[type=text], .rl-form input[type=password], .rl-form input[type=date], .rl-form input[type=url], .rl-form select { width: 100%; box-sizing: border-box; min-height: 38px; }
.rl-form .rl-buttons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 2px 0 0; }
.rl-form .rl-buttons .hint { flex: 1 1 220px; }
.rl-form fieldset { grid-column: 1 / -1; margin: 0; padding: 0; border: 0; min-width: 0; }
.rl-form legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0; margin: 0 0 6px; }
.rl-checks { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.rl-checks label, .rl-radios label { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; font-size: 13.5px; color: var(--ink); min-height: 24px; }
.rl-checks input, .rl-radios input { margin: 3px 0 0; width: 16px; height: 16px; flex: 0 0 auto; }
.rl-radios { display: grid; gap: 6px; }
.rl-radios small { display: block; color: var(--text-3); font-size: 12.5px; }
.rl-err-field input, .rl-err-field select { border-color: var(--err-fg) !important; }
.rl-err-msg { color: var(--err-fg); font-size: 12.5px; font-weight: 600; margin: 0; }
.card .rl-unit { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; overflow: hidden; }
.card .rl-unit input { border: 0 !important; border-radius: 0; min-width: 0; flex: 1 1 auto; }
.rl-unit i { font-style: normal; font-size: 13px; font-weight: 400; color: var(--text-3); padding: 0 10px; background: var(--surface-2); display: flex; align-items: center; white-space: nowrap; }
.rl-unit i:first-child { border-right: 1px solid var(--line); }
.rl-unit i:last-child { border-left: 1px solid var(--line); }
.rl-unit:focus-within { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.card .rl-unit input:focus-visible { outline: none; }

/* ---------- Sekrety (klucze API): tylko do zapisu ---------- */
.rl-secret { display: grid; gap: 4px; }
.rl-secret-state { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 2px; font-size: 13px; font-weight: 400; color: var(--text-2); }
.rl-secret-state b { color: var(--ink); }
.rl-secret .rl-unit button { border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--surface-2); color: var(--brand-dark);
                            font-size: 13px; font-weight: 600; padding: 0 12px; min-width: 64px; }
.rl-secret .rl-unit button:hover { background: var(--line-soft); }
.rl-secret .rl-unit input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .02em; }

/* ---------- Integracje: dwie kolumny (Fakturownia | SumUp) ---------- */
.rl-int { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.rl-int > section { min-width: 0; padding: 4px 22px 6px; border-left: 1px solid var(--line-soft); }
.rl-int > section:first-child { padding-left: 0; border-left: 0; }
.rl-int > section:last-child { padding-right: 0; }
.rl-int h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 4px; font-size: 15px; color: var(--ink); }
.rl-int .rl-lead { margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.rl-off { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 10px 12px; margin: 4px 0 0;
          border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); }
.rl-off .st-switch, .rl-form .rl-off .st-switch { flex-direction: row; align-items: center; margin: 0; cursor: not-allowed; color: var(--ink); font-size: 14px; }
.rl-off .st-switch input:disabled + .st-switch-ui { opacity: .55; }
.rl-off p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.rl-log { margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line-soft); list-style: none; font-size: 12.5px; color: var(--text-3); }
.rl-log li { padding: 2px 0; }
.rl-copy { display: flex; align-items: stretch; gap: 0; }
.rl-copy code { flex: 1 1 auto; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 8px 10px; font-size: 12.5px; background: var(--surface-2);
                border: 1px solid var(--line); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); color: var(--ink); }
.card .rl-copy button { border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--surface); color: var(--brand-dark); border: 1px solid #c9ccd1; font-size: 13px; font-weight: 600; }

/* ---------- Karta firmy: rozliczenia (pakiet | opłata wdrożeniowa | saldo) ---------- */
.rl-facts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 14px; margin: 0 0 4px; font-size: 13.5px; }
.rl-facts dt { padding: 7px 0; color: var(--text-2); border-bottom: 1px solid var(--line-soft); }
.rl-facts dd { margin: 0; padding: 7px 0; text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line-soft); }
.rl-facts dt:last-of-type, .rl-facts dd:last-of-type { border-bottom: 0; }
.rl-facts small { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); }
.rl-big { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rl-big-neg { color: var(--err-fg); }
.rl-big small { font-size: 14px; font-weight: 600; color: var(--text-3); }
.rl-usage { margin: 10px 0 2px; font-size: 13px; color: var(--text-2); }
.rl-usage .disk-bar { display: block; margin-top: 6px; }
.rl-plan { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); margin: 0 0 12px; }
.rl-plan-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.rl-plan-meta { font-size: 13px; color: var(--text-2); }
.rl-next { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--brand-tint-line); background: var(--brand-tint); font-size: 13px; color: var(--ink); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.rl-done { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13.5px; color: var(--ink); }
.rl-done::before { content: "✓"; color: var(--ok-fg); font-weight: 700; }
.rl-confirm h3 { margin: 0 0 6px; font-size: 14.5px; color: var(--ink); }
.rl-confirm dl { margin: 6px 0 10px; }
.rl-confirm > .rl-facts { max-width: 560px; }
.rl-confirm .rl-warn-line { color: var(--err-fg); font-weight: 600; }
.card .rl-confirm form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.rl-buttons > a, .rl-confirm form > a { display: inline-flex; align-items: center; min-height: 28px; padding: 0 4px; }
.rl-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 0 28px; }
.rl-split > * { min-width: 0; }
.rl-more { margin: 12px 0 0; }
.rl-more > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--brand-dark); padding: 4px 0; display: list-item; }
.rl-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0 0 12px; }
.rl-filter label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }

/* ---------- Widok firmy (/admin/rozliczenia): pakiet + jak doładować ---------- */
.db-fin-grid.rl-fin-3 { grid-template-columns: minmax(200px, .9fr) minmax(220px, 1fr) minmax(0, 1.1fr); }
.db-fin-grid.rl-fin-2 { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); max-width: 820px; }
.rl-how { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; align-items: center; }
.rl-how p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.rl-amounts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.rl-amounts label { position: relative; }
.rl-amounts input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rl-amounts span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--r-pill);
                   background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.rl-amounts input:checked + span { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.rl-amounts input:focus-visible + span { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.rl-pay-sum { margin: 12px 0 0; }
.admin-body .rl-pay { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 0; border-radius: var(--r-md);
                      background: var(--brand-fill, var(--brand-color)); color: #fff; font-weight: 600; font-size: 14.5px; text-decoration: none; cursor: pointer; }
.admin-body .rl-pay:hover { background: color-mix(in srgb, var(--brand-fill, var(--brand-color)) 86%, black); }

/* ---------- Tablet ---------- */
@media (max-width: 1099px) {
  .db-fin-grid.rl-fin-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .db-fin-grid.rl-fin-3 > .db-fin-block:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line-soft); padding-left: 4px; margin-top: 8px; }
  .rl-split { grid-template-columns: minmax(0, 1fr); }
  .rl-split > * + * { border-top: 1px solid var(--line-soft); margin-top: 14px; padding-top: 14px; }
}
/* ---------- Telefon (375 px): jedna kolumna, tabele jako karty, cele dotyku ≥ 44 px ---------- */
@media (max-width: 760px) {
  .rl-int { grid-template-columns: minmax(0, 1fr); }
  .rl-int > section { padding: 14px 0 6px; border-left: 0; border-top: 1px solid var(--line-soft); }
  .rl-int > section:first-child { padding-top: 0; border-top: 0; }
  .rl-form, .card form.rl-form { grid-template-columns: minmax(0, 1fr); }
  .rl-form .rl-span2 { grid-column: auto; }
  .rl-form input[type=text], .rl-form input[type=password], .rl-form input[type=date], .rl-form input[type=url], .rl-form select { min-height: 44px; font-size: 16px; }
  .rl-form .rl-buttons button, .rl-confirm button, .rl-filter button { min-height: 44px; }
  .rl-form .rl-buttons button:first-child { flex: 1 1 100%; }
  .rl-buttons > a, .rl-confirm form > a { min-height: 44px; padding: 0 10px; }
  .rl-toc a { min-height: 40px; }
  .rl-head .db-head-link { display: inline-flex; align-items: center; min-height: 44px; }
  .rl-more > summary { padding: 12px 0; }
  .rl-checks label, .rl-radios label { min-height: 32px; }
  .db-fin-grid.rl-fin-3, .db-fin-grid.rl-fin-2 { grid-template-columns: minmax(0, 1fr); }
  .db-fin-grid.rl-fin-3 > .db-fin-block + .db-fin-block, .db-fin-grid.rl-fin-2 > .db-fin-block + .db-fin-block { border-left: 0; border-top: 1px solid var(--line-soft); padding-left: 4px; margin-top: 8px; }
  .rl-how { grid-template-columns: minmax(0, 1fr); }
  .rl-big { font-size: 26px; }
  /* tabela -> karty (etykieta z data-label) */
  .rl-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .rl-cards, .rl-cards tbody, .rl-cards tr, .rl-cards td, .rl-cards th[scope="row"] { display: block; width: 100%; box-sizing: border-box; }
  .rl-cards tr { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
  .rl-cards td, .rl-cards th[scope="row"] { border: 0 !important; padding: 2px 0 !important; text-align: left !important; }
  .rl-cards td[data-label] { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
  .rl-cards td[data-label]::before { content: attr(data-label); color: var(--text-3); font-weight: 400; text-align: left; }
  .rl-cards td[data-label]:empty { display: none; }
  .rl-cards td.rl-actions { padding-top: 8px !important; text-align: left !important; white-space: normal; }
  .rl-cards .rl-actions details, .rl-cards .rl-actions .us-act { display: block; }
  .rl-cards .us-act { min-height: 44px; display: inline-flex !important; align-items: center; }
  .rl-cards tr.rl-edit-row { padding-top: 0; }
}
@media print { .rl-toc, .rl-form, .rl-more, .rl-filter { display: none !important; } }
/* dodatki wdrozenia */
.rl-sep { margin-top: 14px !important; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.rl-sub-h { margin: 0 0 2px; font-size: 14.5px; color: var(--ink); }
.db-fin-amount.rl-plan-amount { font-size: 22px; }
.rl-log form { display: inline; margin-left: 6px; }
.rl-copy .rl-copy-btn { flex: 0 0 auto; }

/* =====================================================================
   Powiadomienia e-mail o zdarzeniach (prefiks pw-): karta firmy w Ustawieniach, Moj profil -> Powiadomienia,
   strona "Wylacz to powiadomienie", karta w Panelu platformy. Tylko tokeny z tego arkusza (kolor marki przez
   var(--brand-*)) - wyglad istniejacych stron bez zmian.
   ===================================================================== */
/* ---------- Główny przełącznik firmy (Ustawienia) / platformy ---------- */
.pw-master, .card form.pw-master { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; align-items: start;
    padding: 14px 16px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.pw-master fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pw-master legend { font-weight: 700; font-size: 14px; color: var(--ink); padding: 0; margin: 0 0 8px; }
.pw-master .st-switch { margin: 0; }
.pw-master .hint { margin: 6px 0 0; line-height: 1.5; }

/* ---------- Przyciski (jawny „Zapisz” – bez wysyłania przy samej zmianie, WCAG 3.2.2) ---------- */
.pw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 16px 0 0; }
.admin-body .pw-actions button, .admin-body .pw-master button { width: auto; min-height: 38px; padding: 0 18px; font-size: 14px; border-radius: var(--r-sm); }
.admin-body .pw-actions button.btn-secondary { font-weight: 600; }
.pw-actions .hint { margin: 0; }

/* formularze kart powiadomień: zwykły blok (nie flex z .card form – tabela i harmonogram mieszczą się w 375 px) */
.card form.pw-form { display: block; }
.card form.pw-form > * { min-width: 0; }

/* ---------- Tabela zdarzeń (administrator firmy) ---------- */
.pw-adm { width: 100%; }
.project-cards .projects-table.pw-adm, .projects-table.pw-adm { white-space: normal; }
.projects-table.pw-adm th, .projects-table.pw-adm td { vertical-align: top; }
.projects-table.pw-adm tbody th[scope="row"] { text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); background: transparent; text-align: left; min-width: 240px; }
.pw-adm .pw-desc { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 400; color: var(--text-3); line-height: 1.45; }
.pw-adm tr.pw-grp th { background: var(--surface-2); color: var(--text-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding-top: 14px; }
.pw-adm tbody tr.pw-grp:hover { background: var(--surface-2); }
.pw-adm .pw-who { font-size: 12.5px; color: var(--text-2); line-height: 1.45; min-width: 170px; }
.pw-adm .pw-who b { font-weight: 600; color: var(--ink); }
.pw-adm td.pw-on { width: 1%; white-space: nowrap; }
.pw-adm td.pw-on .st-switch { margin: 0; font-weight: 400; font-size: 13px; color: var(--text-2); }
.pw-adm td.pw-def { width: 210px; }
.card .pw-adm td.pw-def select { width: 100%; }
.pw-adm .pw-fixed { font-size: 12.5px; color: var(--text-2); }
/* słowo przy przełączniku z CSS – aktualne bez JS i bez zapisu (input:checked); czytniki ekranu i tak podają stan pola */
.pw-yn::before { content: "nie"; }
.st-switch input:checked ~ .pw-yn::before { content: "tak"; color: var(--ink); font-weight: 600; }
.pw-adm tr.pw-off th[scope="row"], .pw-adm tr.pw-off .pw-who { color: var(--text-3); }

/* ---------- Harmonogram i próg salda ---------- */
.pw-sched { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; margin: 6px 0 0; }
.pw-sched fieldset { margin: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.pw-sched legend { padding: 0 4px; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.pw-sched .pw-row2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.card .pw-sched select, .card .pw-sched input[type="text"] { width: 100%; min-height: 36px; box-sizing: border-box; }
.pw-sched .pl-field { margin: 0; }
.pw-sched .hint { margin: 8px 0 0; line-height: 1.45; }
.pw-sched .st-unit { width: 100%; }
.card .pw-sched .st-unit input[type="text"] { border: 0; border-radius: 0; min-width: 0; }
.pw-tz { margin: 10px 0 0; }

/* ---------- Mój profil: zdarzenie = fieldset z przełącznikiem segmentowym ---------- */
.pw-group { margin: 18px 0 0; padding: 0; border: 0; min-width: 0; }
.pw-group > legend { padding: 0; margin: 0 0 2px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
/* zdarzenie: nazwa + opis | grupa radio (role="radiogroup", aria-labelledby = nazwa, aria-describedby = opis) */
.pw-ev { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.pw-ev-text { min-width: 0; }
.pw-ev-name { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.pw-ev-text p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.pw-ev .pw-when { display: block; margin-top: 3px; font-size: 12.5px; color: var(--text-2); }
.pw-ev .pw-when b { font-weight: 600; }

/* przełącznik segmentowy: zwykłe radio (klawiatura: strzałki), wygląd pigułek */
.pw-seg { display: inline-flex; flex-wrap: nowrap; border: 1px solid #c9ccd1; border-radius: var(--r-pill); background: var(--surface); padding: 2px; gap: 2px; }
.pw-seg label { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.pw-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pw-seg span { display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.pw-seg label:hover span { background: var(--surface-2); color: var(--ink); }
.pw-seg input:checked + span { background: var(--brand-dark); color: #fff; font-weight: 600; }
.pw-seg input:focus-visible + span { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.pw-seg input:disabled + span { opacity: .45; cursor: not-allowed; }
/* stan „wyłączone”: zaznaczona pigułka z obrysem zamiast wypełnienia (nie tylko kolorem – słowo i tak jest widoczne) */
.pw-seg input[value="off"]:checked + span { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* zdarzenie zawsze włączone (bezpieczeństwo) */
.pw-lock { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.pw-lock svg { flex: 0 0 auto; }

/* adres e-mail i stan wysyłki */
.pw-addr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; max-width: 640px; }
.pw-addr .pl-field input { width: 100%; min-height: 38px; box-sizing: border-box; padding: 8px; border: 1px solid #c9ccd1; border-radius: 6px; font-size: 14px; }
.pw-addr .pl-field input[aria-invalid="true"] { border-color: var(--err-fg); box-shadow: 0 0 0 1px var(--err-fg); }
.pw-field-err { display: block; margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--err-fg); }
.admin-body input[aria-invalid="true"], .admin-body select[aria-invalid="true"], .admin-body textarea[aria-invalid="true"] { border-color: var(--err-fg); }   /* R3U-08: pole z bledem wyroznione (jeden styl) */
.admin-body .pw-addr button { width: auto; min-height: 38px; padding: 0 14px; font-size: 13.5px; }

/* krótkie podsumowanie nad listą (ile włączonych) */
.pw-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.pw-sum b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Dziennik wysyłek ---------- */
.pw-log td, .pw-log th { white-space: nowrap; }
.projects-table.pw-log tbody th[scope="row"] { text-transform: none; letter-spacing: 0; background: transparent; font-size: 13px; font-weight: 600; color: var(--ink); text-align: left; }
.pw-log td.pw-log-subj { white-space: normal; min-width: 220px; }
.pw-st { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pw-st-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-line); }
.pw-st-err { background: var(--err-bg); color: #9b1c1c; border-color: var(--err-line); }
.pw-st-join { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
.pw-log-err { display: block; margin-top: 2px; font-size: 12px; color: #9b1c1c; white-space: normal; }
details.pw-more { margin: 16px 0 0; border-top: 1px solid var(--line-soft); padding-top: 10px; }
details.pw-more > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink); padding: 6px 0; }
details.pw-more > summary .us-muted, details.pw-more > summary .pw-muted { font-weight: 400; font-size: 12.5px; color: var(--text-3); margin-left: 6px; }
.pw-muted { color: var(--text-3); }

/* ---------- Strona potwierdzenia „Wyłącz to powiadomienie” ---------- */
.pw-confirm { max-width: 620px; margin: 8px auto 0; }
.pw-confirm h1 { font-size: 22px; line-height: 1.25; margin: 0 0 10px; color: var(--ink); }
.pw-confirm p { font-size: 14px; line-height: 1.55; color: var(--text-2); margin: 0 0 10px; }
.pw-confirm .pw-actions form { display: inline; }

/* ---------- Tablet / telefon (375 px): tabele jako karty, cele dotykowe ≥ 44 px ---------- */
@media (max-width: 900px) {
  .pw-ev { grid-template-columns: minmax(0, 1fr); }
  .pw-ev .pw-seg, .pw-ev .pw-lock { justify-self: start; }
}
@media (max-width: 760px) {
  .pw-master, .card form.pw-master { grid-template-columns: minmax(0, 1fr); }
  .admin-body .pw-actions button, .admin-body .pw-master button, .admin-body .pw-addr button { min-height: 44px; }
  .pw-actions { flex-direction: column; align-items: stretch; }
  .admin-body .pw-actions button { width: 100%; }
  .pw-seg { display: flex; width: 100%; box-sizing: border-box; }
  .pw-seg label { flex: 1 1 0; }
  .pw-seg span { flex: 1 1 auto; justify-content: center; min-height: 40px; padding: 0 6px; font-size: 13px; white-space: normal; text-align: center; line-height: 1.2; }
  .pw-addr { grid-template-columns: minmax(0, 1fr); }
  .pw-addr .pl-field input { min-height: 44px; }
  .card .pw-sched select, .card .pw-sched input[type="text"] { min-height: 44px; }
  /* tabela zdarzeń -> karty */
  .pw-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .pw-cards, .pw-cards tbody, .pw-cards tr, .pw-cards td, .pw-cards th[scope="row"] { display: block; width: 100%; box-sizing: border-box; }
  .pw-cards tr { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
  .pw-cards tr.pw-grp { padding: 0; border: 0; }
  .pw-cards tr.pw-grp th { display: block; padding: 14px 8px 6px !important; border-radius: var(--r-sm); }
  .pw-cards td, .pw-cards th[scope="row"] { border: 0 !important; padding: 3px 0 !important; text-align: left !important; min-width: 0 !important; }
  .pw-cards td[data-label] { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
  .pw-cards td[data-label]::before { content: attr(data-label); color: var(--text-3); font-size: 12.5px; }
  .project-cards .projects-table.pw-cards, .projects-table.pw-cards { white-space: normal; overflow-x: visible; }
  .pw-cards td.pw-who { display: block; }
  .pw-cards td.pw-who::before { display: block; margin-bottom: 1px; }
  .pw-cards td.pw-def, .pw-cards td.pw-on { width: 100%; }
  .card .pw-cards td.pw-def select { min-height: 44px; }
  .pw-cards td.pw-on .st-switch { min-height: 44px; }
  .pw-log.pw-cards td { white-space: normal; }
  .pw-cards td[data-label]:empty { display: none; }          /* pusta wartość = bez wiersza (bez „–”) */
  .pw-cards td .pw-st { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { .pw-seg span { transition: none; } }
@media print { .pw-actions, .pw-master button { display: none !important; } }

/* dodatki wdrozenia */
.pw-lead { font-size: 13px; line-height: 1.55; margin: 0 0 12px; }
.pw-copy { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: 12.5px; }
.pw-copy input { margin-top: 2px; }
.st-switch.pw-master-sw { margin: 12px 0 0; }
.card form.pw-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 0; }
.admin-body .pw-inline button { width: auto; min-height: 38px; padding: 0 14px; font-size: 13.5px; }
.pw-code { margin: 0 0 6px; }
.pw-code input[name="kod"] { letter-spacing: 4px; max-width: 180px; }
@media (max-width: 760px) { .admin-body .pw-inline button { min-height: 44px; width: 100%; } }

/* ---------------- formalnosci: dokumenty uslugi, stopka, akceptacja, eksport ---------------- */
.lg-doc { width: 100%; max-width: 860px; box-sizing: border-box; text-align: left; }   /* R2-A11Y-04: nie 380 px z .login-box */
.lg-doc .login-logo { display: block; margin: 0 auto 12px; }
.lg-body { font-size: 14.5px; line-height: 1.6; color: var(--text, #1f2329); overflow-wrap: anywhere; }
.lg-body h1 { font-size: 24px; line-height: 1.25; margin: 6px 0 4px; text-align: left; }
.lg-body h2 { font-size: 18px; margin: 26px 0 8px; text-align: left; }
.lg-body h3 { font-size: 15.5px; margin: 18px 0 6px; }
.lg-body p { margin: 0 0 10px; }
.lg-body ol, .lg-body ul { margin: 0 0 10px 22px; padding: 0; }
.lg-body li { margin-bottom: 5px; }
.lg-body hr { border: 0; border-top: 1px solid #e2e4e8; margin: 22px 0; }
.lg-body code { font-size: 13px; background: #f4f5f7; padding: 1px 4px; border-radius: 3px; }
.lg-table { overflow-x: auto; margin: 0 0 14px; }
.lg-body table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.45; }
.lg-body th, .lg-body td { border: 1px solid #d9dce1; padding: 6px 8px; text-align: left; vertical-align: top; }
.lg-body thead th { background: #f4f5f7; }
.lg-body table, .lg-body th, .lg-body td { overflow-wrap: normal; word-break: normal; hyphens: auto; }   /* R2-UX-01: bez łamania słów w środku */
.lg-note { border-left: 4px solid #b54708; background: #fff6ed; padding: 8px 12px; margin: 0 0 12px; border-radius: 4px; }
.lg-note p { margin: 0; }
.lg-alert { background: #f4f5f7; border: 1px solid #d9dce1; border-radius: 6px; padding: 8px 12px; font-size: 13.5px; }
.lg-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 18px 0 6px; }
.lg-actions .lg-print { width: auto; min-height: 36px; padding: 0 14px; }
.lg-versions { font-size: 13px; margin: 6px 0; }
.lg-versions ul { margin: 6px 0 0 18px; }
.lg-foot-map { font-size: 12px; margin: 8px 0 0; text-align: left; }
.lg-banner a { font-weight: 600; }
.lg-list { margin: 0 0 10px 18px; padding: 0; }
.lg-list li { margin-bottom: 6px; }
.lg-h3 { font-size: 15px; margin: 14px 0 6px; }
.lg-terms { display: grid; gap: 4px; margin: 0 0 8px; }
.lg-terms div { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 10px; }
.lg-terms dt { color: var(--text-3, #5f6672); }
.lg-terms dd { margin: 0; font-weight: 600; }
.lg-accept { margin-top: 12px; }
.lg-fs { border: 1px solid #e2e4e8; border-radius: 8px; padding: 10px 14px 4px; margin: 0 0 14px; }
.lg-fs legend { font-weight: 600; padding: 0 6px; }
.lg-crumb { margin: 0 0 6px; }
@media (max-width: 760px) {
  .lg-doc { padding-left: 16px; padding-right: 16px; }
  .lg-terms div { grid-template-columns: 1fr; gap: 0; }
  .lg-body table { font-size: 12.5px; }
}
@media print {
  .lg-actions, .lg-versions, .lg-foot, .lg-doc .login-logo { display: none !important; }
  .login-body { background: #fff !important; }
  .lg-doc { box-shadow: none !important; max-width: none; }
}
.lg-form .lg-fs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 18px; }
.lg-form .lg-fs legend { grid-column: 1 / -1; }
.lg-form .lg-fs .prof-check { grid-column: 1 / -1; }
.lg-docs th[scope="row"], .lg-firms th[scope="row"] { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; }
@media (max-width: 760px) { .lg-form .lg-fs { grid-template-columns: 1fr; } }
.pk-own[hidden] { display: none !important; }   /* R2-UX-06: pola „własne warunki” tylko przy tej opcji */
.q-form select { max-width: 100%; }   /* R2-A11Y-10: dluga nazwa modelu AI nie poszerza strony przy 375 px */
#pf-ai .q-form > label { min-width: 0; }   /* R3U-04: etykieta (element siatki) nie rozpycha strony dluga nazwa modelu */
#pf-ai .q-form select { width: 100%; }
@media (max-width: 760px) {   /* R3U-04: dluga nazwa firmy w kartach powiadomien zawija sie (bez poszerzania strony przy 375 px) */
  .projects-table.pw-cards th[scope="row"], .projects-table.pw-cards td { white-space: normal; overflow-wrap: anywhere; }
}

/* ===================== Stawki i doladowania (stawki\r1 ux-stawki-firma.css, czesc 1) - nowe elementy panelu firmy ===================== */
/* ---------- 1. Informacja o koszcie przy przycisku przetwarzania ---------- */
.fr-cost { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--brand-fill); border-radius: var(--r-md);
           background: var(--surface-2); font-size: 13.5px; line-height: 1.45; max-width: 640px; }
.fr-cost p { margin: 0; }
.fr-cost p + p { margin-top: 4px; }
.fr-cost b { font-variant-numeric: tabular-nums; }
.fr-cost .fr-live { font-weight: 600; }
.fr-cost.is-block { border-left-color: var(--err-fg); background: var(--err-bg); }
.fr-cost.is-warn { border-left-color: #c26a00; background: var(--warn-bg); }
/* stawki: pola plikow IR wylaczone (farma bez mocy) - widocznie nieaktywne (R2S-UX-13) */
.upload-form input[type="file"]:disabled { opacity: .5; cursor: not-allowed; }
.upload-form label:has(input[type="file"]:disabled) { color: var(--text-3); }

/* ---------- 2. Okno potwierdzenia (natywny <dialog> + showModal(): pułapka fokusu, Esc, tło nieaktywne) ---------- */
.fr-dlg { background: #fff; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: var(--r-lg);
          box-shadow: 0 18px 50px rgba(16, 24, 40, .28); color: var(--ink); overflow: auto; }
.fr-dlg::backdrop { background: rgba(15, 23, 42, .55); }
.fr-dlg-h { padding: 18px 20px 4px; }
.fr-dlg-h h1, .fr-dlg-h h2 { margin: 0; font-size: 18px; line-height: 1.3; color: var(--ink); }
.fr-dlg-b { padding: 6px 20px 4px; font-size: 14px; line-height: 1.5; }
.fr-dlg-b > p { margin: 0 0 10px; }
.fr-sum { margin: 4px 0 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--brand-tint); border: 1px solid var(--brand-tint-line);
          font-size: 15px; font-variant-numeric: tabular-nums; }
.fr-sum b { font-size: 20px; white-space: nowrap; }
.fr-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0; margin: 0 0 10px; font-size: 13.5px; }
.fr-dl dt { padding: 5px 0; color: var(--text-3); border-bottom: 1px solid var(--line-soft); }
.fr-dl dd { margin: 0; padding: 5px 0 5px 14px; text-align: right; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line-soft); }
.fr-dl > :nth-last-child(-n+2) { border-bottom: 0; }
.fr-dlg-b ul { margin: 0 0 10px; padding-left: 20px; font-size: 13.5px; color: var(--text-2); }
.fr-dlg-b ul li { margin: 3px 0; }
.fr-dlg-f { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 20px 18px; border-top: 1px solid var(--line-soft); }
.fr-dlg-f button, .fr-dlg-f .pd-btn { min-height: 40px; padding: 0 16px; border-radius: var(--r-md); font: 600 14px/1 inherit; font-family: inherit; cursor: pointer; }
.fr-btn-pri { background: var(--brand-fill); color: #fff; border: 1px solid var(--brand-fill); }
.fr-btn-pri:hover { background: color-mix(in srgb, var(--brand-fill) 86%, black); }
.fr-btn-pri:disabled { opacity: .45; cursor: not-allowed; }
.fr-btn-sec { background: #fff; color: var(--ink); border: 1px solid #c9ccd1; }
.fr-btn-sec:hover { background: var(--surface-2); }
.fr-dlg :focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.fr-dlg-note { margin: 0 0 10px; padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px; }
.fr-dlg-note.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-fg); }
.fr-dlg-note.err { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err-fg); }

/* strona potwierdzenia bez JS (ten sam tekst co w oknie) */
.fr-confirm { max-width: 640px; border: 2px solid var(--brand-fill); }

/* ---------- 3. Rozliczenia firmy – stawki, historia ---------- */
.fr-rates { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0; font-size: 13.5px; }
.fr-rates dt { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.fr-rates dt small { display: block; color: var(--text-3); font-size: 12px; }
.fr-rates dd { margin: 0; padding: 7px 0 7px 16px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line-soft); }
.fr-rates dd small { display: block; font-weight: 400; color: var(--text-3); font-size: 12px; }
.fr-rates > :nth-last-child(-n+2) { border-bottom: 0; }
.fr-plan { margin: 10px 0 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--brand-tint); border: 1px solid var(--brand-tint-line); font-size: 13px; }
.projects-table td .det { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-3); }
.rz-plus { color: var(--ok-fg); }
.fr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.fr-chips a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-pill); background: #fff;
              color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; }
.fr-chips a[aria-current] { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

@media (max-width: 640px) {
    .fr-dlg { width: calc(100vw - 16px); margin: auto 8px 8px; border-radius: var(--r-lg); }
    .fr-dlg-f { flex-direction: column-reverse; }
    .fr-dlg-f button, .fr-dlg-f .pd-btn { min-height: 44px; width: 100%; }
    .fr-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
    .fr-chips a { min-height: 40px; flex: 0 0 auto; }
}

.admin-body .fr-dlg-f button, .admin-body .fr-dlg-f .pd-btn { width: auto; }
.admin-body .fr-dlg-f .fr-btn-pri { background: var(--brand-fill); color: #fff; border: 1px solid var(--brand-fill); }
.admin-body .fr-dlg-f .fr-btn-sec { background: #fff; color: var(--ink); border: 1px solid #c9ccd1; }
.admin-body .fr-dlg-f .fr-btn-sec:disabled, .admin-body .fr-dlg-f .fr-btn-pri:disabled { opacity: .45; }
@media (max-width: 640px) { .admin-body .fr-dlg-f button, .admin-body .fr-dlg-f .pd-btn { width: 100%; } }
.fr-dlg-f form { display: contents; }
.fr-wait { margin: 10px 0; }
.admin-body .fr-wait button { width: auto; min-height: 40px; padding: 0 16px; background: #fff; color: var(--ink); border: 1px solid #c9ccd1; border-radius: var(--r-md); font-weight: 600; }

/* =====================================================================
   Jezyki E1b - dlugie teksty (DE/FR/IT/ES/EN, pseudo-jezyk +40 %): reguly TYLKO gdy jezyk elementu != polski
   (:lang dziedziczy <html lang>), wiec polskie strony wygladaja jak dotad. Zrodlo: r1/ux-i18n.css i R2 do_E1b.
   ===================================================================== */
:is(.card h2, .pl-type-title, .pl-type-sub, .pd-steps span, .db-step b, .cards-group-title, .hint, .login-box h1,
    .qr-status h1, .us-rcard, .sg-kicker, .pd-title):not(:lang(pl)) { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
@media (max-width: 1360px) { .admin-header-title:not(:lang(pl)) { display: none; } }
.admin-nav a:not(:lang(pl)) { padding: 8px 11px; }
@media (max-width: 640px) {
    :is(.pd-btn, .db-new, .db-act, .us-act, .us-new, .cc-add-btn, .cc-open, .report-link, .projects-link):not(:lang(pl)) { white-space: normal; text-align: center; line-height: 1.3; }
    .pd-steps small:not(:lang(pl)) { overflow-wrap: anywhere; }
}
@media (max-width: 480px) {
    .pd-steps:not(:lang(pl)) { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .pd-steps:not(:lang(pl)) a { padding: 8px 12px; }
}
/* lista projektow 1280: naglowki tabeli i kolumna akcji zawijaja sie zamiast wymuszac przewijanie w poziomie */
.pl-table th:not(:lang(pl)) { white-space: normal; }
.pl-actions:not(:lang(pl)) { white-space: normal; }
.pl-actions:not(:lang(pl)) .action-link { white-space: normal; }
/* 375 px: link "Wszystkie raporty / nowy raport z FLIR" i pasek skokow projektu */
@media (max-width: 480px) { .action-link:not(:lang(pl)) { white-space: normal; text-align: center; } }
@media (max-width: 760px) { .pd-jump:not(:lang(pl)) { flex-wrap: nowrap; overflow-x: auto; } .pd-jump:not(:lang(pl)) a { white-space: nowrap; } }
/* Dodaj anomalie: lista typow nie rozpycha strony */
select#field-typ:not(:lang(pl)) { max-width: 100%; }
/* Ustawienia: plakietki w tabeli powiadomien; Wyglad: naglowki wierszy tabeli */
.pw-st-join:not(:lang(pl)) { white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
.admin-body table th:not(:lang(pl)) { overflow-wrap: anywhere; }
/* Przelacznik jezyka na stronach logowania (tylko firmy z >= 2 jezykami; kody bez flag) */
.lg-switch { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 2px; margin: -18px -16px 10px 0; font-size: 12.5px; }
.lg-switch a { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 28px; padding: 0 6px;
    border-radius: var(--r-sm); color: var(--text-3); font-weight: 600; letter-spacing: .03em; text-decoration: none; }
.lg-switch a:hover { color: var(--brand-dark); background: var(--line-soft); }
.lg-switch a[aria-current="true"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--brand-fill); }
.lg-switch a:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 1px; }
@media (max-width: 640px) { .lg-switch { margin: -12px -8px 8px 0; } .lg-switch a { min-width: 36px; min-height: 36px; } }
/* Platnosci online (panel firmy): doladowanie salda, stan platnosci, platnosci w toku */
.pay-card { max-width: 640px; }
.card form.pay-form { display: block; }
.pay-form .hint { margin: 6px 0; }
.pay-amounts { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; }
.pay-amounts legend { padding: 0; margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--ink); }
.pay-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0 0 12px; }
.pay-opt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 10px 12px; min-height: 44px; border: 1px solid #c9ccd1; border-radius: var(--r-md); background: var(--surface); cursor: pointer; font-size: 14px; }
.pay-opt:has(input:checked) { border-color: var(--brand-fill); box-shadow: inset 0 0 0 1px var(--brand-fill); }
.pay-opt:focus-within { outline: 2px solid var(--brand-ink); outline-offset: 1px; }
.admin-body .pay-opt input { width: auto; margin: 0; }
.pay-opt-net { font-weight: 700; white-space: nowrap; }
.pay-opt small { flex-basis: 100%; color: var(--text-3); font-size: 12px; }
.pay-other { max-width: 260px; }
.pay-sum { font-size: 14px; }
.pay-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.pay-btns form { margin: 0; }
.admin-body .pay-btns button, .pay-link { width: auto; min-height: 40px; padding: 9px 16px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
a.pay-link { display: inline-flex; align-items: center; text-decoration: none; }
a.pay-link.fr-btn-pri, a.pay-link.fr-btn-pri:visited { color: #fff; }
a.pay-link.fr-btn-sec, a.pay-link.fr-btn-sec:visited { color: var(--ink); }
.admin-body .pay-btns .fr-btn-pri { background: var(--brand-fill); color: #fff; border: 1px solid var(--brand-fill); }
.admin-body .pay-btns .fr-btn-sec { background: #fff; color: var(--ink); border: 1px solid #c9ccd1; }
.pay-topup { margin: 10px 0 0; }
.pay-state { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; line-height: 1.5; border: 1px solid var(--line-soft); background: var(--surface-2); }
.pay-state-ok { background: var(--brand-tint); border-color: var(--brand-tint-line); }
.pay-state-warn, .pay-state-wait { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.pay-state-err { background: var(--err-bg); border-color: var(--err-line); color: var(--err-fg); }
.pay-dl { max-width: 420px; }
.pay-st { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pay-st-oczekuje, .pay-st-wyjasnienie { background: var(--warn-bg); color: var(--warn-fg); }
.pay-st-nieudana { background: var(--err-bg); color: var(--err-fg); }
.pay-open { list-style: none; margin: 0; padding: 0; }
.pay-open li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.pay-open li:last-child { border-bottom: 0; }
.pay-open-a { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 480px) { .pay-opts { grid-template-columns: 1fr 1fr; } .pay-btns > * { flex: 1 1 100%; } .pay-btns .pay-link { justify-content: center; } .admin-body .pay-btns button { width: 100%; } }

/* ---- Model 3D (templates/model3d.html, _model3d_card.html) ---- */
.m3d-body #m3d-scene { position: absolute; top: 42px; left: 0; right: 0; bottom: 0; background: #1b1d21; }
.m3d-body #m3d-scene canvas { display: block; width: 100%; height: 100%; }
.m3d-body #m3d-scene canvas.m3d-nakladka { position: absolute; inset: 0; pointer-events: none; }
.m3d-panel { position: absolute; top: 54px; left: 12px; width: 260px; padding: 12px;
    background: rgba(20, 22, 26, .92); color: #e8e8e8; border: 1px solid #333; border-radius: 8px; font-size: 13px; z-index: 5; }
.m3d-switch { display: flex; gap: 6px; }
.m3d-switch button { flex: 1; padding: 7px; background: #2a2d33; color: #ddd; border: 1px solid #444; border-radius: 4px; cursor: pointer; }
.m3d-switch button.on { background: var(--brand-accent, #c0392b); border-color: var(--brand-accent, #c0392b); color: var(--brand-accent-text, #fff); }
.m3d-switch button:disabled { opacity: .45; cursor: default; }
.m3d-switch button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.m3d-ir label, .m3d-label { display: block; margin: 10px 0 3px; color: #aaa; font-size: 12px; }
.m3d-ir select, .m3d-ir input { background: #111; color: #eee; border: 1px solid #444; border-radius: 4px; padding: 3px 5px; }
.m3d-ir input[type=number] { width: 64px; }
.m3d-body .link-button { background: none; border: 0; cursor: pointer; font: inherit; }
.m3d-row { display: flex; gap: 6px; align-items: center; }
.m3d-row[hidden] { display: none; }
.m3d-row .link-button { color: #ccc; }
.m3d-legend { margin-top: 10px; }
.m3d-legend-bar { height: 12px; border-radius: 3px; }
.m3d-legend-labels { display: flex; justify-content: space-between; font-size: 11px; color: #aaa; margin-top: 2px; }
.m3d-hint { font-size: 11px; color: #999; margin: 8px 0 0; }
.m3d-status { margin: 8px 0 0; font-size: 12px; color: #9a9; min-height: 1em; }
.m3d-status:empty { display: none; }
.m3d-readout { position: fixed; pointer-events: none; background: rgba(0, 0, 0, .82); color: #fff; padding: 3px 7px;
    border-radius: 4px; font-weight: 600; transform: translate(12px, -50%); z-index: 6; }
@media (max-width: 640px) { .m3d-panel { width: auto; right: 12px; } }
.m3-list { list-style: none; padding: 0; margin: 0 0 10px; }
.m3-list li { padding: 6px 0; border-bottom: 1px solid var(--line-soft, #eee); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.m3-list .inline-form { display: inline; margin-left: auto; }
.m3-range input { width: 70px; }
@media (max-width: 720px) { .m3d-body #m3d-scene { top: 78px; } .m3d-panel { top: 90px; } .m3d-tools { top: 100px; } }

/* model 3D: anomalie z raportu (znaczniki + karta) */
.m3d-anom { border: 1px solid rgba(255,255,255,.15); border-radius: 6px; padding: 6px 8px; margin: 8px 0; }
.m3d-anom legend { font-size: .8rem; padding: 0 4px; }
.m3d-anom-cls { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; font-size: .82rem; }
.m3d-anom-cls label::before { content: ""; display: inline-block; width: .7em; height: .7em; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.m3d-k3::before { background: #d64545; } .m3d-k2::before { background: #f08a24; } .m3d-k1::before { background: #e8c547; }
.m3d-card { position: absolute; right: 12px; top: 64px; width: 300px; max-width: calc(100vw - 24px); background: #fff; color: #1b1d21;
  border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.35); padding: 12px 14px; z-index: 20; font-size: .88rem; }
.m3d-card img { width: 100%; border-radius: 4px; margin: 6px 0; }
.m3d-card-h { font-weight: 600; margin: 0 22px 4px 0; }
.m3d-card-dt { font-weight: 600; margin: 2px 0; }
.m3d-card-txt { margin: 4px 0 8px; }
.m3d-card-x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 1.3rem; cursor: pointer; line-height: 1; }
.m3d-pin-link { font-size: .75rem; font-weight: 600; padding: 0 4px; border: 1px solid currentColor; border-radius: 3px; text-decoration: none; margin-left: 4px; }

/* model 3D: edytor pol pomiarowych (panel, badanie budynku) */
.m3d-panel:has(.m3d-ed:not([hidden])) { width: 330px; max-height: calc(100vh - 70px); overflow-y: auto; }
.m3d-ed { border: 1px solid rgba(255,255,255,.15); border-radius: 6px; padding: 6px 8px; margin: 8px 0; }
.m3d-ed legend { font-size: .8rem; padding: 0 4px; }
.m3d-ed-tools { display: grid; gap: 3px; margin: 2px 0 6px; }
.m3d-ed-tools label, .m3d-ed > label { font-size: .85rem; }
.m3d-ed select { background: #111; color: #eee; border: 1px solid #444; border-radius: 4px; padding: 3px 5px; max-width: 220px; }
.m3d-ed-ref::before, .m3d-ed-bx::before { content: ""; display: inline-block; width: .7em; height: .7em; margin-right: 4px; vertical-align: middle; border-radius: 2px; }
.m3d-ed-tools .m3d-ed-ref::before { background: #3b82f6; } .m3d-ed-tools .m3d-ed-bx::before { background: #e11d48; }
.m3d-ed-tools label::before { display: none; }
.m3d-ed-tools label.m3d-ed-ref::before, .m3d-ed-tools label.m3d-ed-bx::before { display: inline-block; }
.m3d-ed-list { margin: 8px 0; padding-left: 20px; font-size: .82rem; }
.m3d-ed-list li.m3d-ed-ref { color: #93c5fd; } .m3d-ed-list li.m3d-ed-bx, .m3d-ed-list li.m3d-ed-pkt { color: #fda4af; }
.m3d-ed-list .link-button { color: #ccc; font-size: 1rem; padding: 0 4px; }
.m3d-ed-msg { margin: 8px 0; font-size: .82rem; color: #cfe; }
.m3d-ed-msg:empty { margin: 0; padding: 0; border: 0; min-height: 0; }   /* region statusu zostaje w drzewie dostepnosci */
.m3d-ed-msg.m3d-ed-err { color: #fca5a5; }
.m3d-ed-msg ul { margin: 4px 0; padding-left: 18px; }
.m3d-ed-msg .action-link { color: #93c5fd; }
.m3d-ed-cand { margin: 8px 0; padding: 6px; background: #22252b; border-radius: 6px; font-size: .78rem; }
.m3d-ed-img { position: relative; line-height: 0; }
.m3d-ed-img img { width: 100%; border-radius: 3px; }
.m3d-ed-box { position: absolute; border: 2px solid #e11d48; box-sizing: border-box; }
.m3d-ed-box.m3d-ed-ref { border-color: #3b82f6; }
.m3d-ed-cand figcaption { margin-top: 4px; line-height: 1.35; }
.m3d-ed-cand button { margin-top: 4px; }

/* model 3D: pasek narzedzi widoku (widok poczatkowy, pomiar, pelny ekran, panel), jakosc, pomiar */
.m3d-tools { position: absolute; top: 54px; right: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 6; }
.m3d-tools button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; background: rgba(20,22,26,.92);
    color: #e8e8e8; border: 1px solid #3a3d44; border-radius: 8px; cursor: pointer; }
.m3d-tools button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m3d-tools button:hover { border-color: #777; }
.m3d-tools button.on { background: var(--brand-accent, #c0392b); border-color: var(--brand-accent, #c0392b); color: var(--brand-accent-text, #fff); }
.m3d-tools button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.m3d-tools button[hidden] { display: none; }
.m3d-panel.m3d-panel-zwiniety { display: none; }
.m3d-jakosc { display: block; margin: 8px 0 0; font-size: 12px; color: #bbb; }
.m3d-pm { border: 1px solid #ffd400; border-radius: 6px; padding: 6px 8px; margin: 8px 0; }
.m3d-pm[hidden] { display: none; }
.m3d-pm-h { margin: 0 0 4px; font-weight: 600; color: #ffd400; font-size: .85rem; }
.m3d-pm p { margin: 2px 0; }
.m3d-body #m3d-card { right: 60px; }
@media (max-width: 640px) { .m3d-panel { right: 60px; max-height: calc(100vh - 110px); overflow-y: auto; } .m3d-body #m3d-card { right: 12px; top: 54px; } }
@media (max-width: 720px) { .m3d-tools { top: 100px; } }
.m3d-pm .link-button, .m3d-row .link-button { color: #e8eaed; background: #2c3036; border: 1px solid #4a4f57; border-radius: 4px; padding: 3px 9px; font: inherit; font-size: .8rem; cursor: pointer; text-decoration: none; }
.m3d-pm .link-button:hover, .m3d-row .link-button:hover { background: #3a3f46; border-color: #ffd400; }
.m3d-pm .link-button:focus-visible, .m3d-row .link-button:focus-visible { outline: 2px solid #ffd400; outline-offset: 1px; }
.m3d-pm-t { font-size: 15px; font-weight: 600; margin: 2px 0; }
.m3d-pm-t.m3d-pm-max { color: #ff6b6b; } .m3d-pm-t.m3d-pm-min { color: #6fb1ff; }
.m3d-rap textarea { width: 100%; box-sizing: border-box; background: #111; color: #eee; border: 1px solid #444; border-radius: 4px; padding: 4px 6px; font: inherit; font-size: 12px; margin-bottom: 6px; }
.m3d-rap-lista { list-style: none; margin: 8px 0; padding: 0; font-size: 12px; }
.m3d-rap-lista li { display: grid; grid-template-columns: 64px 1fr auto auto auto; gap: 4px 6px; align-items: center; padding: 4px 0; border-bottom: 1px solid #2c2f36; }
.m3d-rap-lista img { width: 64px; height: 40px; object-fit: cover; border-radius: 3px; }
.m3d-rap-lista .link-button { color: #ccc; font-size: 14px; padding: 0 3px; }
#m3d-rap-pdf[hidden] { display: none; }
.m3d-pm-t.m3d-pm-sr { color: #e3e6eb; }

/* Wykaz anomalii raportu z modelu 3D (templates/model3d_anomalie.html) */
.m3a-stat { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.m3a-akcje { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.m3a-akcje .btn-primary, .m3a-akcje .btn-secondary { text-decoration: none; }
.m3a-lista { list-style: none; margin: 12px 0 0; padding: 0; }
.m3a-u { display: grid; grid-template-columns: minmax(180px, 320px) 1fr; gap: 14px; padding: 14px 0 14px 10px; border-top: 1px solid #e5e7eb; border-left: 4px solid transparent; }
.m3a-u.m3a-k3 { border-left-color: #d64545; }
.m3a-u.m3a-k2 { border-left-color: #f08a24; }
.m3a-u.m3a-k1 { border-left-color: #e8c547; }
.m3a-img img { width: 100%; height: auto; border-radius: 6px; display: block; background: #111; }
.m3a-nag { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.m3a-temp { margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.m3a-pola { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.m3a-pola label, .m3a-kom { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #4b5563; }
.m3a-pola input, .m3a-pola select, .m3a-kom textarea, #m3a-wnioski { font: inherit; font-size: 14px; padding: 5px 7px; border: 1px solid #d1d5db; border-radius: 4px; color: #111827; background: #fff; }
.m3a-kom { margin-top: 8px; }
#m3a-wnioski { width: 100%; box-sizing: border-box; }
.m3a-ai { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: #ede9fe; color: #5b21b6; vertical-align: middle; }
.m3a-przyciski { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.m3a-przyciski .link-button { font-size: 13px; }
.m3a-usun { color: #b71c1c; }
.m3a-progi { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.m3a-progi label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.m3a-msg:empty, .m3a-umsg:empty { margin: 0; padding: 0; border: 0; }
.m3a-umsg { font-size: 13px; color: var(--text-3, #4b5563); }
.m3a-umsg.error, .m3a-msg.error { color: #b71c1c; }
.m3a-brak { font-size: 13px; padding: 2px 8px; border-radius: 999px; background: #fff7e6; color: #8a4b00; }
.m3a-det { margin: 0 0 10px; }
.m3a-det > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.m3a-war { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 12px; margin: 8px 0; }
.m3a-war label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; min-width: 0; }
.m3a-war input { font: inherit; font-size: 14px; padding: 5px 7px; border: 1px solid #d1d5db; border-radius: 4px; }
.m3a-u.m3a-err { outline: 2px solid #d64545; outline-offset: 2px; }
.m3a-u[aria-busy="true"] { opacity: .75; }
.m3a-pola > label { min-width: 0; }
.m3a-pola select { max-width: 100%; }
.m3a-nag .cl-pill { white-space: normal; }
[aria-invalid="true"] { border-color: #d64545 !important; }
@media (max-width: 760px) { .m3a-u { grid-template-columns: 1fr; } .m3a-pola { grid-template-columns: 1fr; } }

/* panel ujec w przegladarce modelu: rodzaj elementu, odniesienie, import anomalii elewacji */
.m3d-rap select { width: 100%; box-sizing: border-box; background: #111; color: #eee; border: 1px solid #444; border-radius: 4px; padding: 4px 6px; font: inherit; font-size: 12px; margin-bottom: 6px; }
.m3d-ref { font-size: 12px; color: #c9ccd1; margin: 4px 0; }
/* ===== R1: fundament ===== */
/* ==========================================================================
   SYSTEM KOMPONENTÓW PANELU (tura R1, pakiet A)
   Jedno źródło prawdy dla panelu firmy (body.admin-body). Kolejne pakiety dopisują
   WYŁĄCZNIE pod własnym nagłówkiem na końcu pliku (R1-B, R1-C, R1-D) i korzystają z klas stąd.
   Spis treści:
     1. Tokeny (odstępy, pismo, wysokości kontrolek, karta, fokus, przycisk główny, widok 3D)
     2. Przyciski: .btn-primary / .btn-secondary / .btn-danger / .btn-link + .btn-sm / .btn-lg
        (stare klasy działają jako aliasy – lista przy każdym wariancie)
     3. Tekst na kolorze marki (zawsze para --brand-fill + --brand-fill-text)
     4. Karta / kafelek: .card, .card-head, .card-lead, .card-foot, .tile-row, details.pd-opt
     5. Pola: pola tekstowe i listy, .field, .field-hint, fieldset/legend, pola wyboru, wiersz opcji
     6. Wiersz pliku: .file-row
     7. Fokus
     8. Przełącznik: .st-switch
     9. Plakietki: typ / stan / licznik
    10. Nagłówek panelu i tytuł strony
    11. Formularz anomalii
    12. Tabele i komórka akcji
    13. Cele dotykowe
   Zasady: tylko zmienne (bez kolorów na sztywno), bez !important (wyjątek: nadpisanie starej
   reguły, która sama ma !important), resety przez :where(), żeby wyspecjalizowane stare reguły wygrywały.
   Bazowe reguły .card, .card h2, .card button, .btn-secondary, .delete-btn, .pd-btn są zmienione
   w miejscu (góra pliku) – tu jest wszystko ponad nie.
   ========================================================================== */

/* ---- 1. Tokeny ---- */
:root {
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
    --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px;
    --ctl-h: 36px; --ctl-h-sm: 28px; --ctl-h-lg: 40px; --ctl-h-touch: 44px;
    --card-pad: 24px; --card-gap: 16px; --group-gap: 32px;
    --focus: var(--ink);
    --brand-fill-text: #fff;                       /* wartość domyślna; szablon nadpisuje ją z motywu firmy */
    --btn-primary-bg: var(--brand-fill); --btn-primary-fg: var(--brand-fill-text, #fff);
    --line-on-page: #7d838c;                       /* obrys kontrolek stojących na tle strony */
    --m3d-surface: rgba(20,22,26,.92); --m3d-line: #7a7f88; --m3d-line-soft: #3a3d44; --m3d-text: #e6e8ec; --m3d-text-2: #b8bcc4;
}
@media (max-width: 760px) { :root { --card-pad: 16px; } }

/* ---- 2. Przyciski ----
   Rozmiary: domyślny 36 px, .btn-sm 28 px (sam z siebie w tabelach i listach akcji), .btn-lg 40 px (nagłówek strony/projektu).
   Telefon (<= 760 px): przyciski domyślne 44 px. Jeden główny na kartę/formularz, po lewej; niszczący odsunięty w prawo. */

/* 2a. geometria „zwykłego” przycisku: w karcie bez klasy (= główny) oraz .btn-primary, .btn-secondary, .btn-danger, .delete-btn, .meta-submit, .st-del, .us-btn2, .us-save */
.admin-body .card button:where(:not([class]), [class=""], .btn-primary, .btn-secondary, .btn-danger, .delete-btn, .meta-submit, .st-del, .us-btn2, .us-save):where(:not(.btn-sm, .btn-lg, .btn-link, .link-button, .sg-mini, .att-move-btn, .inv-draw-btn)),
.admin-body :is(a, button):is(.btn-primary, .btn-secondary, .btn-danger):where(:not(.btn-sm, .btn-lg, .btn-link, .link-button, .sg-mini, .att-move-btn, .inv-draw-btn)) {
    width: auto; min-height: var(--ctl-h); padding: 4px 14px; font-size: var(--fs-md); font-weight: 600; line-height: 1.2;
    border-radius: var(--r-md); cursor: pointer;
}
.admin-body a:is(.btn-primary, .btn-secondary, .btn-danger, .btn-link), .admin-body .action-link {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap;
}
.admin-body :is(.card button, .btn-primary, .btn-secondary, .btn-danger, .pd-btn):disabled { opacity: .4; cursor: not-allowed; }

/* 2b. główny: .btn-primary, przycisk bez klasy w karcie, .pd-btn-primary, .card .pl-new-btn, .cc-add-btn, .card .cc-submit,
       .card .cal-submit, .card .jl-submit, .meta-submit, .db-new, .us-new, .us-save. Kolor zmienia się jedną zmienną --btn-primary-bg. */
.admin-body :is(a, button).btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border: 0; }
.admin-body .card button:where(:not([class]), [class=""], .btn-primary, .meta-submit):hover:not(:disabled),
.admin-body a.btn-primary:hover { background: color-mix(in srgb, var(--btn-primary-bg) 90%, black); color: var(--btn-primary-fg); text-decoration: none; }
:where(.admin-body) :is(.card .pl-new-btn, .card .cc-submit, .card .jl-submit, .card .cal-submit) { min-height: var(--ctl-h); padding: 4px 14px; font-size: var(--fs-md); font-weight: 600; border-radius: var(--r-md); }
:where(.admin-body) :is(.cc-add-btn, .db-new, .us-new) { display: inline-flex; align-items: center; min-height: var(--ctl-h); padding: 0 14px; font-size: var(--fs-md); font-weight: 600; border-radius: var(--r-md); }
.admin-body .us-save { background: var(--btn-primary-bg); }

/* 2c. drugorzędny: .btn-secondary, .pd-btn, .us-btn2, .db-act, .action-link (tylko w panelu; strony klienta zostają) */
.admin-body .action-link {
    min-height: var(--ctl-h); padding: 0 14px; background: var(--surface); color: var(--brand-dark); border: 1px solid var(--line-strong);
    border-radius: var(--r-md); font-size: var(--fs-md); font-weight: 600;
}
.admin-body .action-link:hover, .admin-body a.btn-secondary:hover { background: var(--surface-2); color: var(--brand-dark); text-decoration: none; }
.admin-body a.btn-secondary { background: var(--surface); color: var(--brand-dark); }
.admin-body .pd-btn:not(.pd-btn-primary, .pd-btn-link, .fv-ghost), .admin-body .us-btn2, .admin-body .db-act { border-color: var(--line-strong); }
.admin-body .us-btn2 { background: var(--surface); }
.admin-body .us-btn2:hover:not(:disabled), .admin-body .db-act:hover { background: var(--surface-2); }

/* 2d. niszczący: .btn-danger, .delete-btn, .st-del */
.admin-body :is(a, button).btn-danger, .admin-body .card .st-del { background: var(--surface); color: var(--err-fg); border: 1px solid var(--err-line); }
.admin-body :is(a, button).btn-danger:hover:not(:disabled), .admin-body .card .st-del:hover:not(:disabled) { background: var(--err-bg); color: var(--err-fg); text-decoration: none; }
.admin-body button.delete-btn:hover { color: var(--err-fg); }

/* 2e. linkowy: .btn-link, .link-button, .pd-btn-link, .pd-more, .c-link, .db-linkbtn */
.link-button { background: none; border: 0; padding: 0 4px; min-height: 24px; font: inherit; font-weight: 500; color: inherit; cursor: pointer; }
.link-button:hover { text-decoration: underline; text-underline-offset: 2px; }
.admin-body :is(a, button):is(.btn-link, .link-button), .admin-body button.pd-btn-link {
    width: auto; min-height: 24px; padding: 0 4px; background: none; border: 0; border-radius: var(--r-sm);
    color: var(--brand-dark); font-size: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
}
.admin-body :is(a, button):is(.btn-link, .link-button):hover:not(:disabled), .admin-body button.pd-btn-link:hover:not(:disabled) { background: none; color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
.admin-body :is(a, button):is(.btn-link, .link-button).btn-danger { border: 0; background: none; color: var(--err-fg); }
.admin-body :is(a, button):is(.btn-link, .link-button).btn-danger:hover:not(:disabled) { background: none; }

/* 2f. rozmiary */
.admin-body :is(a, button).btn-sm, .admin-body .pd-btn.pd-btn-small,
.admin-body :is(.actions-cell, .pl-actions, .ac-actions, .jl-actions, .m3-list) .action-link,
.admin-body .card :is(.actions-cell, .pl-actions, .m3-list, .projects-table td, .inline-email-form, .photo-gallery-temp-form, .anomaly-area-row) button:where(:not([class]), [class=""], .btn-primary, .btn-secondary, .btn-danger, .delete-btn):where(:not(.btn-lg, .btn-link, .link-button)) {
    min-height: var(--ctl-h-sm); padding: 2px 10px; font-size: var(--fs-sm); font-weight: 600; border-radius: var(--r-sm);
}
.admin-body :is(a, button):is(.btn-link, .link-button).btn-sm { padding: 0 4px; }
.admin-body :is(a, button).btn-lg, .admin-body .pd-actions .pd-btn { min-height: var(--ctl-h-lg); padding: 4px 18px; font-size: var(--fs-md); font-weight: 600; border-radius: var(--r-md); }
.admin-body .pd-btn.pd-btn-small.pd-btn-link { min-height: 24px; padding: 0 4px; }
@media (max-width: 760px) {
    .admin-body .card button:where(:not([class]), [class=""], .btn-primary, .btn-secondary, .btn-danger, .meta-submit, .us-btn2, .us-save):where(:not(.btn-sm, .btn-link, .link-button, .sg-mini, .att-move-btn, .inv-draw-btn)):where(:not(:is(.actions-cell, .pl-actions, .m3-list, .projects-table td, .inline-email-form, .photo-gallery-temp-form, .anomaly-area-row) *)),
    .admin-body .card-foot :is(.btn-primary, .btn-secondary, .btn-danger, .action-link, .pd-btn):where(:not(.btn-link, .link-button)),
    .admin-body .pd-actions .pd-btn { min-height: var(--ctl-h-touch); }
}

/* ---- 3. Tekst na kolorze marki: zawsze para --brand-fill + --brand-fill-text ---- */
.report-link, .sg-download-btn, .card .pl-new-btn:not([aria-expanded="true"]), .card .jl-submit, .card .cal-submit, .card .cc-submit,
.card.jb-actions .jb-publish, .admin-body .sg-save-bar .sg-save-next, .pd-steps li.is-current b,
.cal-grid td.cal-today .cal-day span, .admin-body .card .calib-view-btn.active, .tour-next, .admin-body .us-save,
.admin-body .rl-pay, .fr-btn-pri, .admin-body .fr-dlg-f .fr-btn-pri, .qr-btn, .err-btn { color: var(--brand-fill-text, #fff); }
.cc-add-btn, .db-new, .us-new, .za-xlsx { color: var(--brand-fill-text, #fff) !important; }   /* stare reguły mają !important */
/* stany „włączone” narzędzi: wypełnienie marki zamiast koloru akcentu */
.temp-tool-btn.active, .admin-body .temp-tool-btn.active, .m3d-switch button.on, .m3d-tools button.on {
    background: var(--brand-fill); border-color: var(--brand-fill); color: var(--brand-fill-text, #fff);
}

/* ---- 4. Karta / kafelek ----
   .card (bazowa reguła na górze pliku): padding 24 px (telefon 16), promień 12 px, pismo 14 px.
   Budowa: .card-head (h2 + plakietka/licznik/link po prawej) -> p.card-lead (jedno zdanie) -> [details.sg-help] -> treść -> .card-foot. */
@media (max-width: 760px) { :where(.admin-body) .card { padding: var(--card-pad); } }
.card > h3:first-child, .card-head > h3 { font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; margin: 0 0 12px; color: var(--brand-dark); }
.card-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 4px; }
.card-head > :is(h2, h3) { margin: 0; }
.card-head > :is(h2, h3) + * { margin-left: auto; }
.card-head + :not(.card-lead) { margin-top: 12px; }
.card-lead { margin: 0 0 16px; max-width: 72ch; width: 100%; font-size: var(--fs-sm); color: var(--text-3); }
.card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.card-foot > :is(.btn-danger, .delete-btn, .st-del, .card-foot-end) { margin-left: auto; }
.card-foot > :is(.btn-danger, .delete-btn, .st-del, .card-foot-end) ~ :is(.btn-danger, .delete-btn, .st-del, .card-foot-end) { margin-left: 0; }
.card-foot :is(p, .hint, .st-ok) { margin: 0; }
.card :is(h3, h4).st-subhead { font-size: var(--fs-md); font-weight: 600; margin: 20px 0 8px; color: var(--ink); }
:where(.admin-body) .hint { font-size: var(--fs-sm); color: var(--text-3); }
:where(.admin-body) .card p.hint { max-width: 72ch; }
/* para kafelków połówkowych: samotny kafelek sam rozciąga się na całą szerokość; stopki pary na jednej wysokości */
.tile-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--card-gap); align-items: stretch; }
.tile-row > .card { flex: 1 1 calc(50% - 8px); min-width: min(100%, 360px); margin: 0; display: flex; flex-direction: column; }
.tile-row > .card > form:last-child { flex: 1; display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.tile-row > .card > form:last-child > button { align-self: flex-start; }
.tile-row > .card > .card-foot, .tile-row > .card > form:last-child > .card-foot { margin-top: auto; }
.tile-row > .card > form:last-child > .card-foot::before, .tile-row > .card > .card-foot::before { content: none; }
.project-cards { gap: var(--card-gap); align-items: stretch; }
:where(.admin-body) .cards-group-title { margin: var(--group-gap) 0 0; padding-bottom: 6px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--line); }
:where(.admin-body) .cards-group-title:first-child { margin-top: 0; }
.admin-body .project-cards .cards-group-title { scroll-margin-top: 64px; }
/* karta opcjonalna zwijana: <details class="card pd-opt">; summary = tytuł + jedno zdanie + (po prawej) znaczek „Dodaj”/licznik */
details.pd-opt { padding: 0; }
details.pd-opt > summary { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; min-height: 56px; padding: 8px var(--card-pad); cursor: pointer; list-style: none; }
details.pd-opt > summary::-webkit-details-marker { display: none; }
details.pd-opt > summary::before { content: "▸" / ""; color: var(--text-3); font-size: var(--fs-md); }
details.pd-opt[open] > summary::before { content: "▾" / ""; }
details.pd-opt > summary :is(h2, h3) { margin: 0; padding: 0; border: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--brand-dark); }
details.pd-opt > summary .card-lead { margin: 0; width: auto; flex: 1 1 240px; }
details.pd-opt > summary > :last-child:not(:first-child, .card-lead) { margin-left: auto; }
details.pd-opt[open] > summary { border-bottom: 1px solid var(--line-soft); }
details.pd-opt > .pd-opt-body { padding: var(--sp-4) var(--card-pad) var(--card-pad); }

/* ---- 5. Pola ---- */
.card :is(input[type=text], input[type=url], input[type=email], input[type=number], input[type=password], input[type=date], input[type=tel], input[type=search], input[type=time]), .card select {
    min-height: var(--ctl-h); padding: 0 10px; font-size: var(--fs-md); border: 1px solid var(--line-strong); border-radius: var(--r-sm); max-width: 100%;
    background-color: var(--surface); color: var(--ink);
}
:where(.card) :where(input, select, textarea) { min-width: 0; }
.card textarea { min-height: 72px; padding: 8px 10px; font-size: var(--fs-md); line-height: 1.45; border: 1px solid var(--line-strong); border-radius: var(--r-sm); max-width: 100%; }
/* etykieta nad polem: nowa .field + stare układy */
.field, .prof-form label:not(.prof-check), .pl-field, .meta-form label, .anomaly-form-grid label, .cal-f {
    display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); min-width: 0;
}
.field > :is(input, select, textarea) { width: 100%; font-weight: 400; }
.field-hint { display: block; margin: 0; font-size: var(--fs-xs); font-weight: 400; color: var(--text-3); }
.form-narrow { max-width: 720px; }                                  /* formularze ustawień */
:where(.card) fieldset { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
:where(.card) legend { padding: 0; margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
/* pola wyboru i wiersz opcji (.opt-row + stare klasy) */
:where(.admin-body) input:is([type=checkbox], [type=radio]) { accent-color: var(--brand-fill); }
.admin-body :is(.prof-check, .smtp-radio label, .smtp-check, .u-check, .project-check, .conclusions-include, .st-danger-opt, .opt-row) > input:is([type=checkbox], [type=radio]),
.admin-body .card .control-row > input:is([type=checkbox], [type=radio]) { width: 18px; height: 18px; flex: 0 0 auto; margin: 1px 0 0; }
.admin-body :is(.prof-check, .smtp-radio label, .smtp-check, .u-check, .project-check, .conclusions-include, .opt-row) {
    display: flex; flex-direction: row; align-items: flex-start; gap: 8px; min-height: var(--ctl-h-sm); padding-block: 4px; line-height: 20px;
    font-size: var(--fs-md); font-weight: 400; color: var(--ink); cursor: pointer;
}
@media (max-width: 760px) {
    .admin-body :is(.prof-check, .smtp-radio label, .smtp-check, .u-check, .project-check, .conclusions-include, .opt-row) { min-height: var(--ctl-h-touch); padding-block: 12px; }
}

/* ---- 6. Wiersz pliku (.file-row): nazwa + uwaga po lewej, natywne pole pliku po prawej ---- */
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 4px 16px; align-items: center; width: 100%; min-height: 44px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.file-row > label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.file-row > label small { flex: 1 1 100%; font-size: var(--fs-xs); font-weight: 400; color: var(--text-3); }
.file-row input[type=file] { font-size: var(--fs-sm); max-width: 100%; min-width: 0; color: var(--text-2); }
.admin-body .card input[type=file]::file-selector-button {
    min-height: var(--ctl-h-sm); padding: 2px 10px; margin-right: 10px; font: inherit; font-size: var(--fs-sm); font-weight: 600;
    background: var(--surface); color: var(--brand-dark); border: 1px solid var(--line-strong); border-radius: var(--r-sm); cursor: pointer;
}
.admin-body .card input[type=file]::file-selector-button:hover { background: var(--surface-2); }
@media (max-width: 640px) { .file-row { grid-template-columns: minmax(0, 1fr); } }
/* formularz wgrywania zbudowany z .file-row: wiersze na całą szerokość, bez dodatkowych odstępów */
.card form.upload-form:has(.file-row) { align-items: stretch; gap: 0; }
.card form.upload-form:has(.file-row) > button { align-self: flex-start; margin-top: 12px; }

/* ---- 7. Fokus: jeden obrys 2 px w kolorze --focus (na ciemnych powierzchniach biały) ---- */
.admin-body :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.admin-body .st-switch input:focus-visible + .st-switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }
#topbar, .m3d-panel, .m3d-tools, .m3d-card { --focus: #fff; }
.login-box input:focus-visible, .c-email-form input:focus-visible { outline: 2px solid var(--focus); }
.admin-body #tresc:focus-visible { outline: none; }

/* ---- 8. Przełącznik (.st-switch; pole ma role="switch") ---- */
.admin-body .st-switch-ui { background: var(--line-strong); }
.admin-body .st-switch input:checked + .st-switch-ui { background: var(--ok-fg); }

/* ---- 9. Plakietki ---- */
/* typ / etykieta: 22 px */
.admin-body :is(.pl-badge, .pd-flag, .appr-status, .pd-layers span) {
    display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; font-size: var(--fs-xs); font-weight: 600; line-height: 1.2;
    border-radius: var(--r-sm); white-space: nowrap;
}
.admin-body .pd-layers span:not(.is-on) { background: var(--surface-2); color: var(--text-3); text-decoration: none; box-shadow: inset 0 0 0 1px var(--line); }
.admin-body .pd-layers span:not(.is-on)::before { content: "– " / ""; }
/* stan: kropka 8 px + tekst, bez tła */
.admin-body .pl-status { font-size: var(--fs-sm); font-weight: 600; background: none; }
/* licznik: pastylka 20 px */
.admin-body :is(.cc-count, .pl-total, .pd-jump a span) {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px; padding: 0 7px;
    font-size: var(--fs-xs); font-weight: 600; line-height: 1; border-radius: var(--r-pill);
}
.admin-body .cc-count { vertical-align: middle; }

/* ---- 10. Nagłówek panelu i tytuł strony ---- */
.admin-header-brand .admin-logo { max-height: 32px; }
.admin-header-brand .admin-logo-fit { height: 32px; }
.admin-header-title { font-size: var(--fs-xs); }
.admin-body .admin-nav a { display: inline-flex; align-items: center; min-height: var(--ctl-h); padding: 0 12px; font-size: var(--fs-md); font-weight: 500; border-radius: var(--r-md); }
.admin-body .admin-nav a:not(:lang(pl)) { padding: 0 10px; }
.admin-body .notif { margin: 0 8px; }
.admin-body .notif-bell { width: var(--ctl-h); height: var(--ctl-h); }
.admin-body .admin-nav .admin-nav-logout { margin-left: auto; padding: 0 8px; }
.admin-header > .pd-alert { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; min-height: var(--ctl-h); margin: 0; padding: 6px 12px; font-size: var(--fs-sm); }
@media (max-width: 760px) {
    .admin-body .admin-nav { flex-wrap: wrap; overflow: visible; width: 100%; }   /* bez przewijania w bok: dzwonek i „Wyloguj” zawsze na ekranie */
    .admin-body .admin-nav a { min-height: var(--ctl-h-touch); padding: 0 10px; }
    .admin-body .notif-bell { width: 40px; height: 40px; }
    .admin-header > .pd-alert { width: 100%; }
}
.af-head { margin: 0 0 16px; }
.af-head h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; }
.page-head h1 { margin: 0 0 16px; font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; }

/* ---- 11. Formularz anomalii (stara reguła .card form {display:flex} wyłączała siatkę) ---- */
.card form.anomaly-form-grid { display: grid; align-items: start; gap: 12px 14px; }
.anomaly-form-grid > .anomaly-form-wide, .anomaly-form-grid > h3 { grid-column: 1 / -1; }
.anomaly-form-grid label { min-width: 0; }
.anomaly-form-grid :is(input, select, textarea) { width: 100%; min-width: 0; max-width: 100%; font-weight: 400; }
.anomaly-form-grid > h3.af-sub { margin: 8px 0 -4px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); }
.anomaly-form-grid > h3.af-sub:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.anomaly-form-grid > h3.af-sub .hint { font-size: var(--fs-xs); }
select#field-typ { width: 100%; max-width: 100%; text-overflow: ellipsis; }
.admin-body .card .af-coa { min-height: var(--ctl-h-sm); padding: 0; }
.anomaly-form-grid .anomaly-area-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.af-form-card .anomaly-form-buttons {
    grid-column: 1 / -1; z-index: 2; position: static; margin: 8px calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)); padding: 12px var(--card-pad);
    background: var(--surface); border-top: 1px solid var(--line-soft); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
@media (min-width: 1100px) { .af-form-card .anomaly-form-buttons { position: sticky; bottom: 0; } }

/* ---- 12. Tabele i komórka akcji ---- */
:where(.admin-body) .projects-table th { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); background: var(--surface-2); }
:where(.admin-body) .projects-table td { font-variant-numeric: tabular-nums; }
@media (min-width: 761px) {   /* na telefonie tabele układają się w karty – tam odstępy zostają po staremu */
    :where(.admin-body) .projects-table :is(th, td) { padding: 8px 12px; vertical-align: middle; }
}
.admin-body .actions-cell { flex-direction: row; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.admin-body .actions-cell form { margin: 0; }
.admin-body .card .actions-cell button.delete-btn { border-color: transparent !important; background: none; color: var(--err-fg); }   /* stara reguła obrysu ma !important */
.admin-body .card .actions-cell button.delete-btn:hover { background: var(--err-bg); }

/* ---- 13. Cele dotykowe ---- */
:is(.cc-back, .pd-more, .db-head-link, .pl-name-link, .cal-up-sheet, .jl-title, .us-crumb a) { display: inline-flex; align-items: center; min-height: 24px; }
:where(.admin-body) summary { min-height: 24px; padding-block: 4px; cursor: pointer; }
@media (max-width: 760px) {
    .admin-body :is(.cc-back, .pd-more, .pl-act), .admin-body .card summary { min-height: var(--ctl-h-touch); }
    .admin-body .pl-act { display: inline-flex; align-items: center; }
}
.admin-body .cal-up-sheet { display: flex; margin: 0 0 2px 52px; }   /* cel 24 px bez wydłużania listy */
@media (max-width: 760px) {
    .admin-body .cal-up-sheet { min-height: 32px; }
}

/* ---- 14. Poprawki zgodności po ujednoliceniu pól i tabel ---- */
.admin-body .card .pl-search input { padding-left: 34px; border-radius: var(--r-md); }          /* miejsce na ikonę lupy */
.admin-body .card .cl-toolbar input { padding-left: 34px; }
.admin-body .card .pl-code { white-space: nowrap; }
.af-layout { margin-bottom: var(--card-gap); }
@media (min-width: 1100px) { .af-form-card .anomaly-form-buttons { box-shadow: 0 -8px 12px -10px rgba(16, 24, 40, .18); } }
/* dane badania: siatka zamiast zawijanego wiersza (ta sama przyczyna co w formularzu anomalii) */
.card form.meta-form { display: grid; align-items: end; }
.meta-form :is(input, select) { width: 100%; min-width: 0; font-weight: 400; }
/* harmonogram powiadomień: grupy bez ramek (ramkę ma karta) */
.admin-body .pw-sched fieldset { border: 0; padding: 0; }
.admin-body .pw-sched legend { padding: 0; margin-bottom: 8px; }
/* telefon: długie przyciski-linki i listy wyboru nie rozpychają strony */
:where(.card form) > label { max-width: 100%; }
.admin-body .st-wide-link .action-link { white-space: normal; }
@media (max-width: 760px) {
    .admin-body .action-link { white-space: normal; padding-block: 6px; text-align: left; justify-content: flex-start; }
}
/* drobne odstępy wzorca karty */
.card > :is(h2, h3) + .card-lead { margin-top: -8px; }
.file-row + .card-foot { border-top: 0; margin-top: 4px; }
/* ===== R1: fundament – koniec ===== */

/* ===== R1-B: Ustawienia ===== */
/* ==========================================================================
   STRONA USTAWIEŃ (retention.html) – tura R1, pakiet B. Korzysta z komponentów bloku R1 (karta, stopka, .tile-row).
   Zakres: .st-page (na .project-cards) i pasek skoków .st-jump. Nowe, ogólne klocki (można użyć na innych stronach):
     B1. .st-jump        – pasek skoków pod tytułem strony (wariant .pd-jump)
     B2. .st-navrow / .st-navcard – kafelek-link do innej strony (tytuł, jedno zdanie, strzałka)
     B3. .st-tiles-3     – trzy kafelki w jednym rzędzie (.tile-row.st-tiles-3)
     B4. .st-switch-row  – wiersz „nazwa ustawienia + przełącznik”; przełącznik w .card-head
     B5. .st-meter       – duża wartość + opis + pasek (miejsce na dysku)
     B6. .st-kv          – lista „nazwa – wartość” (dl)
     B7. .st-badge-ok / -warn / -err – plakietka stanu (z .pl-badge)
     B8. .st-fold        – zwijany blok w karcie; .st-ghost-form – pusty formularz dla przycisku z atrybutem form=
   Reszta to dopasowania istniejących części strony (poczta, harmonogram, kamery, przechowywanie, listy do usunięcia).
   ========================================================================== */

/* ---- B1. Pasek skoków ---- */
.admin-body .st-jump { margin: 0 0 var(--sp-2); padding: var(--sp-2) 0; gap: var(--sp-2); }
.admin-body .st-jump a { min-height: 32px; padding: 0 14px; font-size: var(--fs-sm); background: var(--surface); border-color: var(--line-strong); }
.admin-body .st-jump a.is-active { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--surface); }
.admin-body .st-page .cards-group-title { scroll-margin-top: 60px; }
.admin-body .st-page .card, .admin-body .st-page .st-navcard { scroll-margin-top: 60px; }
@media (max-width: 760px) {
    .admin-body .st-jump { flex-wrap: nowrap; overflow-x: auto; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); padding-right: 40px; }
    .admin-body .st-jump a { min-height: 36px; flex: 0 0 auto; }
}

/* ---- B2. Kafelek-link ---- */
.st-navrow { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--card-gap); }
.admin-body .st-navcard {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; align-content: center; gap: 2px var(--sp-3);
    min-height: 72px; padding: var(--sp-4) var(--card-pad); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06); color: var(--ink); text-decoration: none; transition: border-color .12s, box-shadow .12s;
}
.st-navcard-t { grid-column: 1; font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; color: var(--brand-dark); }
.st-navcard-d { grid-column: 1; font-size: var(--fs-sm); color: var(--text-3); }
.st-navcard > i { grid-column: 2; grid-row: 1 / 3; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-pill);
    background: var(--surface-2); color: var(--text-2); font-style: normal; font-size: var(--fs-lg); transition: transform .12s, background-color .12s, color .12s; }
.admin-body .st-navcard:hover { border-color: var(--line-strong); box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08); text-decoration: none; }
.admin-body .st-navcard:hover > i { background: var(--brand-fill); color: var(--brand-fill-text, #fff); transform: translateX(2px); }
.tile-row > .st-navcard { flex: 1 1 calc(50% - 8px); min-width: min(100%, 360px); }
@media (prefers-reduced-motion: reduce) { .st-navcard, .st-navcard > i { transition: none; } }

/* ---- B3. Trzy kafelki w rzędzie ---- */
@media (min-width: 1100px) { .tile-row.st-tiles-3 > .card { flex: 1 1 calc(33.333% - 11px); min-width: 0; } }

/* ---- B4. Przełącznik w nagłówku karty i wiersz z przełącznikiem ---- */
.st-page .card-head + :not(.card-lead) { margin-top: var(--sp-2); }
.st-page .card-head .st-toggle-form { margin: 0 0 0 auto; }
.st-page .st-switch { margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.card form.st-switch-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); min-height: var(--ctl-h-touch); margin: 0 0 var(--sp-2); padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border-radius: var(--r-md); }
.st-switch-row-t { font-size: var(--fs-md); font-weight: 600; color: var(--ink); }

/* ---- B5. Wartość z paskiem ---- */
.st-meter { margin: 0 0 var(--sp-4); }
.st-meter + .st-meter { padding-top: var(--sp-4); border-top: 1px solid var(--line-soft); }
.st-meter-label { display: block; margin-bottom: 2px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.st-meter-val { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--sp-2); margin: 0 0 var(--sp-2); font-size: var(--fs-sm); color: var(--text-3); }
.st-meter-val b { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.st-meter-val b.c-overdue { color: var(--err-fg); }
.st-page .disk-bar { height: 8px; border: 0; border-radius: var(--r-pill); background: var(--line-soft); }
.st-page .disk-bar-fill { border-radius: var(--r-pill); background: var(--brand-fill); }
.st-page .disk-bar-fill.disk-bar-warn { background: var(--err-fg); }
.st-more-link { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); font-weight: 600; }
.st-more-link a { display: inline-flex; align-items: center; min-height: 24px; }
@media (max-width: 760px) { .st-more-link a { min-height: var(--ctl-h-touch); } }

/* ---- B6. Lista „nazwa – wartość” ---- */
.st-kv { margin: 0 0 var(--sp-3); }
.st-kv > div { display: grid; grid-template-columns: minmax(110px, 42%) minmax(0, 1fr); gap: var(--sp-3); align-items: baseline; padding: var(--sp-2) 0; border-bottom: 1px solid var(--line-soft); }
.st-kv > div:last-child { border-bottom: 0; }
.st-kv dt { font-size: var(--fs-sm); color: var(--text-3); }
.st-kv dd { margin: 0; font-size: var(--fs-md); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---- B7. Plakietki stanu ---- */
.admin-body .st-badge-ok { background: var(--ok-bg); color: var(--ok-fg); box-shadow: inset 0 0 0 1px var(--ok-line); }
.admin-body .st-badge-warn { background: var(--warn-bg); color: var(--warn-fg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.admin-body .st-badge-err { background: var(--err-bg); color: var(--err-fg); box-shadow: inset 0 0 0 1px var(--err-line); }

/* ---- B8. Zwijany blok, pusty formularz ---- */
.card form.st-ghost-form { display: none; }
details.st-fold > summary { font-size: var(--fs-md); font-weight: 600; color: var(--brand-dark); }
details.st-fold[open] > summary { margin-bottom: var(--sp-3); }

/* ---- Wzorzec kafelka na stronie Ustawień ---- */
.st-page > .card > .card-lead { max-width: 96ch; }                      /* kafelek na całą szerokość: zdanie w jednej linii */
.admin-body .st-page .smtp-grid p.hint { max-width: none; }
.st-page .card > .card-lead:has(+ .sg-help) { margin-bottom: var(--sp-2); }
.st-page .sg-help { margin: 0 0 var(--sp-4); }
.st-page .sg-help summary { font-size: var(--fs-sm); }
.st-page .sg-help p.hint { background: var(--surface-2); border-radius: var(--r-md); }
.st-help-box { display: grid; gap: var(--sp-2); margin-top: 6px; padding: var(--sp-2) 10px; background: var(--surface-2); border-radius: var(--r-md); }
.admin-body .st-page .sg-help .st-help-box p.hint { margin: 0 !important; padding: 0; background: none; }   /* stara reguła odstępu ma !important */
.st-page .card form.prof-form:not(.q-form) { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; }
.st-page .prof-form fieldset { margin-bottom: var(--sp-2); }
.st-page .prof-form .prof-check { margin-bottom: 0; }
/* w parze kafelków stopka dosuwa się do dołu (margin-top: auto) – odstęp nad linią trzyma element przed nią */
.st-page .tile-row > .card > form:last-child > :nth-last-child(2) { margin-bottom: var(--sp-4); }
.st-page .prof-form p.hint { margin: var(--sp-1) 0 0; }
.st-page .prof-form .st-unit { align-self: flex-start; }
.st-page .card :is(.st-warn, .error) { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); }
.st-page .card > .st-warn:last-child, .st-page .card > .error:last-child { margin-bottom: 0; }
.st-page .card > .st-ok { margin: 0 0 var(--sp-3); }
.st-page .st-note { margin: var(--sp-1) 0 0; }
.st-page .card-foot .st-ok { font-size: var(--fs-sm); font-weight: 600; }
.st-page .st-foot-hint { margin: var(--sp-2) 0 0; }
.st-page .st-subhead-sep { margin-top: var(--sp-5); padding-top: 20px; border-top: 1px solid var(--line-soft); }
.st-page .st-subhead-count { display: flex; align-items: center; gap: var(--sp-2); }
.st-page .st-subhead + p.hint { margin: 0 0 var(--sp-3); }
.st-page .st-lead-last { margin-bottom: 0; }
.st-page .st-doc-form > label { margin-bottom: var(--sp-1); }
.st-page .st-doc-form > input[type=url] { width: 100%; max-width: 420px; }
.st-page .st-doc-line { margin: var(--sp-2) 0 0; }

/* ---- Kamery ---- */
.st-page .q-form { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3) var(--sp-4); align-items: end; margin-top: var(--sp-3); }
.st-page .q-form label { margin: 0; }
.st-page .q-form .card-foot { grid-column: 1 / -1; margin-top: var(--sp-1); }
.st-page .q-add { margin-top: var(--sp-3); }
.st-page .q-form :is(input[type=text], input[type=file]) { width: 100%; }
.st-page .q-form input[type=file] { min-height: var(--ctl-h); padding-top: 4px; }
.st-page .st-cams + .q-add, .st-page .pl-table-wrap + .q-add { margin-top: var(--sp-4); }
.admin-body .st-page tr.st-cam-edit > td { padding: var(--sp-1) var(--sp-4) var(--sp-4); background: var(--surface-2); white-space: normal; }
.st-page tr.st-cam-edit .q-form { margin-top: var(--sp-2); }
.admin-body .st-page .projects-table td.pl-actions { text-align: right; }

/* ---- Poczta wychodząca: ustawienia po lewej, wiadomość testowa i historia po prawej ---- */
.st-page .smtp-state { margin: 0 0 var(--sp-3); padding: 10px var(--sp-3); background: var(--surface-2); border-radius: var(--r-md); font-size: var(--fs-md); }
.st-mail { display: grid; grid-template-columns: minmax(0, 720px) minmax(260px, 1fr); gap: 0 var(--sp-6); align-items: start; margin-top: var(--sp-4); }
.st-mail-side { padding-left: var(--sp-6); border-left: 1px solid var(--line-soft); align-self: stretch; }
.st-page .smtp-grid { max-width: none; margin-top: 0; gap: var(--sp-3) var(--sp-4); }
.st-page .smtp-grid .smtp-wide { margin: -6px 0 0; }
.st-page .smtp-grid fieldset.smtp-wide, .st-page .smtp-grid .smtp-check { margin: 0; }
.st-page .st-mail-mode { margin: 0 0 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.st-page .st-mail-mode .hint { margin: var(--sp-1) 0 var(--sp-3); }
.st-page .smtp-sub { margin: 0 0 var(--sp-2); font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.st-page .card form.smtp-test { gap: var(--sp-2); }
.st-page .smtp-test .pl-field { flex: 1 1 200px; }
.st-page .smtp-test .pl-field input { width: 100%; min-width: 0; }
.st-page .st-mail-side > .hint { margin: var(--sp-2) 0 0; }
.st-page .smtp-hist { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line-soft); }
.st-page .smtp-hist > summary { font-weight: 600; color: var(--ink); }
.st-page .smtp-hist ul { color: var(--text-2); }
@media (max-width: 1100px) {
    .st-mail { grid-template-columns: minmax(0, 1fr); }
    .st-mail-side { margin-top: 20px; padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line-soft); }
}
@media (max-width: 760px) { .st-page .card-foot :is(button, .btn-danger) { flex: 1 1 auto; } }

/* ---- Powiadomienia dla zespołu: harmonogram jako wiersze „nazwa | opis” ---- */
.st-page .pw-lead { margin: -8px 0 var(--sp-4); }
.admin-body .st-page .pw-sched { display: block; margin: 0; border-top: 1px solid var(--line-soft); }
.admin-body .st-page .pw-sched fieldset { display: flow-root; margin: 0; padding: var(--sp-3) 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; }
.admin-body .st-page .pw-sched legend { margin: 0 0 var(--sp-1); font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.st-page .pw-sched .hint { margin: 0; }
.st-page .pw-sched .st-unit { width: auto; max-width: 200px; display: flex; margin: var(--sp-1) 0; }
@media (min-width: 761px) {
    .admin-body .st-page .pw-sched legend { float: left; width: 216px; margin: 0; padding-right: var(--sp-4); }
    .admin-body .st-page .pw-sched fieldset > :not(legend) { margin-left: 216px; }
}
.st-page .pw-tz { margin: var(--sp-3) 0 0; }

/* ---- Przechowywanie danych ---- */
.st-page .st-row { min-height: 56px; }
.st-page .st-row-text span { font-size: var(--fs-sm); color: var(--text-3); }
.st-page .st-row-text .st-rec { color: var(--ok-fg); }
.st-page .st-settings .st-subhead:first-of-type { margin-top: var(--sp-2); }
.st-page .st-settings .st-subhead + .sg-help { margin-bottom: 0; }
.st-page .st-settings .st-help-after { margin: var(--sp-3) 0 0; }
.st-page .st-danger-opt { margin: 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--err-line); background: var(--err-bg); border-radius: var(--r-md); font-size: var(--fs-sm); color: var(--ink); }
/* ===== R1-B: Ustawienia – koniec ===== */

/* ===== R1-C: Panel projektu ===== */
/* ==========================================================================
   PANEL PROJEKTU (project_detail.html, _model3d_card.html, karty _approval/_hazard/_issues/_comparison) i lista
   projektów (admin.html) – tura R1, pakiet C. Korzysta z komponentów bloku R1 i R1-B (karta, stopka, .tile-row,
   details.pd-opt, .file-row, .st-kv, .st-jump, plakietki .st-badge-*). Zakres: .pd-hero i .pd-page (klasa na .project-cards).
   Nowe, ogólne klocki:
     C1. .pd-hero, .pd-steps (+ .pd-steps-3)   – nagłówek projektu i pasek kroków (stany wyłącznie z tokenów)
     C2. .card-head-end, .pd-head-actions      – element/akcje nagłówka karty odsunięte w prawo (plakietka zostaje przy tytule)
     C3. .pd-badge-off, .pd-opt-add            – plakietka neutralna („do wgrania”, „nie wgrano”), znaczek „Dodaj” karty zwijanej
     C4. .pd-fs                                – grupa pól formularza: legenda kapitalikami + siatka 3 / 2 / 1 kolumna
     C5. .pd-manual, .pd-form-actions          – zwijany blok z formularzem w karcie; przyciski formularza poza stopką karty
     C6. .pd-empty                             – stan pusty listy/tabeli w karcie
     C7. .m3-list, .m3-actions, .m3-upload     – karta „Model 3D”: wgrane warstwy, akcje, zwijane wgrywanie z zakresem temperatur
     C8. lista projektów (.pl-table)
   ========================================================================== */

/* ---- C1. Nagłówek projektu i pasek kroków ---- */
.admin-body .pd-hero { padding: var(--card-pad); }
.pd-hero > .pd-tags { margin-bottom: var(--sp-2); }
.admin-body .pd-hero-top { align-items: center; gap: var(--sp-3) var(--sp-5); }
.admin-body .pd-hero-top .pd-title { flex: 1 1 320px; min-width: 0; margin: 0; font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; color: var(--ink); }
.admin-body .pd-hero .pd-actions { gap: var(--sp-2); }
.admin-body .pd-hero .pd-meta { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); color: var(--text-3); }
.pd-hero > p.hint { margin: var(--sp-1) 0 0; }
.admin-body .pd-hero .pd-layers { flex-wrap: wrap; margin: var(--sp-3) 0 0; }
.admin-body .pd-hero .pd-alert { margin-top: var(--sp-3); font-size: var(--fs-sm); }
.admin-body .pd-steps { margin: var(--sp-4) 0 0; gap: var(--sp-2); }
.admin-body .pd-steps-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admin-body .pd-steps a { min-height: 56px; padding: 6px var(--sp-3); gap: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); box-shadow: none; }
.admin-body .pd-steps a:hover { border-color: var(--line-strong); }
.admin-body .pd-steps b { width: 24px; height: 24px; font-size: var(--fs-xs); font-weight: 600; background: var(--surface); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.admin-body .pd-steps span:not(.sr-only) { font-size: var(--fs-md); font-weight: 600; line-height: 1.3; color: var(--ink); }
.admin-body .pd-steps small { font-size: var(--fs-xs); font-weight: 400; color: var(--text-3); overflow-wrap: anywhere; }
.admin-body .pd-steps li.is-done a { background: var(--ok-bg); border-color: var(--ok-line); }
.admin-body .pd-steps li.is-done b { background: var(--ok-fg); color: var(--surface); box-shadow: none; font-size: 0; }
.admin-body .pd-steps li.is-current a { padding: 5px 11px; background: var(--surface); border: 2px solid var(--brand-fill); box-shadow: none; }
.admin-body .pd-steps li.is-current b { background: var(--brand-fill); color: var(--brand-fill-text, #fff); box-shadow: none; }
.admin-body .pd-steps li.is-warn a { background: var(--warn-bg); border-color: var(--warn-line); }
.admin-body .pd-steps li.is-warn b { background: var(--warn-fg); color: var(--surface); box-shadow: none; }
.admin-body .pd-steps li.is-error a { background: var(--err-bg); border-color: var(--err-line); }
.admin-body .pd-steps li.is-error b { background: var(--err-fg); color: var(--surface); box-shadow: none; }
@media (max-width: 760px) {
    .admin-body .pd-steps-3 { grid-template-columns: minmax(0, 1fr); }
    .admin-body .pd-hero-top .pd-title { flex-basis: 100%; font-size: var(--fs-xl); }
}
.admin-body .pd-page .cards-group-title, .admin-body .pd-page :is(.card, .tile-row) { scroll-margin-top: 60px; }
.pd-alert.cmp-hero { margin-bottom: var(--sp-3); }

/* ---- C2. Wzorzec karty na stronie projektu ---- */
.card-head > :is(.card-head-end, .pd-head-actions) { margin-left: auto; }
.card-head > :is(h2, h3) + :is(.pl-badge, .pd-coa-sum):not(:last-child) { margin-left: 0; }
.pd-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.pd-anom-eksport { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); }
.card-head :is(h2, h3) .cc-count { margin-left: var(--sp-1); }
.pd-coa-sum { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.admin-body .pd-coa-sum .inv-coa { display: inline-flex; align-items: center; min-height: 22px; padding: 0 var(--sp-2); font-size: var(--fs-xs); font-weight: 600; border-radius: var(--r-sm); white-space: nowrap; }
.pd-page > .card > .card-lead { max-width: 120ch; }
.admin-body .pd-page > .card > p.hint { max-width: 110ch; }
.pd-page .card-lead:has(+ .sg-help) { margin-bottom: var(--sp-2); }
.pd-page .sg-help { margin: 0 0 var(--sp-4); }
.pd-page .sg-help summary { font-size: var(--fs-sm); }
.pd-page .sg-help p.hint { max-width: 96ch; background: var(--surface-2); border-radius: var(--r-md); }
.admin-body .pd-page .sg-help .st-help-box p.hint { margin: 0 !important; padding: 0; background: none; }   /* stara reguła odstępu ma !important */
.pd-page .card > :is(.error, .st-warn, .success-banner, p.success, p.warning) { margin: 0 0 var(--sp-3); }
.pd-page :is(p.success, p.warning) { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); border-radius: var(--r-md); }
.pd-page p.success { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-line); }
.pd-page p.warning { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-line); }
.pd-page .st-subhead .cc-count { margin-left: var(--sp-1); }
.pd-page .pd-subhead-sep { margin-top: var(--sp-5); padding-top: 20px; border-top: 1px solid var(--line-soft); }
.pd-page .card-foot .hint { font-size: var(--fs-sm); }
/* w parze kafelków stopka dosuwa się do dołu – odstęp nad jej linią trzyma element przed nią */
.pd-page .tile-row > .card > form:last-child > :nth-last-child(2):not(.file-row) { margin-bottom: var(--sp-4); }
.pd-page .tile-row > .card > form:last-child > .opt-row { align-self: flex-start; }

/* ---- C3. Plakietka neutralna, znaczek „Dodaj” ---- */
.admin-body .pd-badge-off { background: var(--surface-2); color: var(--text-3); box-shadow: inset 0 0 0 1px var(--line); }
.pd-opt-add { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-sm); font-weight: 600; color: var(--brand-dark); }
.pd-opt-add::before { content: "+" / ""; font-size: var(--fs-lg); line-height: 1; }
details.pd-opt[open] > summary .pd-opt-add { display: none; }
details.pd-opt > summary:hover :is(h2, h3) { text-decoration: underline; text-underline-offset: 3px; }
.pd-page details.pd-opt > .pd-opt-body > .card-foot:last-child { margin-top: var(--sp-3); }
.pd-page .pd-line { margin: 0 0 var(--sp-1); font-size: var(--fs-md); }

/* ---- C4. Grupy pól (dane badania) ---- */
.card form.pd-meta-form { display: block; }
.pd-meta-form .pd-fs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); align-items: start; margin: 0; padding: var(--sp-4) 0 20px; border-top: 1px solid var(--line-soft); }
.pd-meta-form .pd-fs:first-of-type { padding-top: var(--sp-1); border-top: 0; }
.pd-meta-form .pd-fs > legend { float: left; grid-column: 1 / -1; width: 100%; margin: 0; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.pd-meta-form .card-foot { margin-top: 0; }
@media (max-width: 1100px) { .pd-meta-form .pd-fs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .pd-meta-form .pd-fs { grid-template-columns: minmax(0, 1fr); } }
.card form.pd-cam-form { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin: 0; }
.pd-cam-form select { flex: 1 1 280px; max-width: 560px; }
.admin-body .pd-page .pd-cam-form + .st-warn { margin: var(--sp-3) 0 0; }
.pd-page .pd-field-date { align-self: flex-start; width: 220px; max-width: 100%; }
.pd-page .pd-field-date input { width: 100%; }

/* ---- C5. Karta raportu (rozdzielnice, budynek), zwijany blok z formularzem ---- */
.pd-page .pd-kv { margin: 0; }
.pd-page .pd-kv > div { grid-template-columns: minmax(120px, 220px) minmax(0, 1fr); }
.pd-page .pd-kv dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); }
.admin-body .pd-kv .pd-report-ok { margin: 0; padding: 0; border: 0; background: none; font-size: inherit; font-weight: 400; color: var(--ink); }
.pd-page .pd-kv dd a { text-decoration: underline; text-underline-offset: 2px; }
.pd-kv .pd-kv-plain, .pd-kv .pd-kv-note { font-weight: 400; color: var(--text-2); }
.pd-kv .pd-kv-note { font-size: var(--fs-sm); color: var(--text-3); }
@media (max-width: 640px) {
    .pd-page .pd-kv > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .admin-body .pd-page .card-foot > :is(button, .action-link, .btn-primary, .btn-secondary):not(.btn-sm, .btn-link, .link-button) { flex: 1 1 auto; justify-content: center; text-align: center; }
}
.admin-body .pd-page :is(.pd-manual, .q-edit) { margin: var(--sp-4) 0 0; padding: var(--sp-1) var(--sp-4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.admin-body .pd-page :is(.pd-manual, .q-edit, .m3-more) > summary { min-height: var(--ctl-h); display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); font-weight: 600; color: var(--brand-dark); list-style: none; }
.pd-page :is(.pd-manual, .q-edit, .m3-more) > summary::-webkit-details-marker { display: none; }
.pd-page :is(.pd-manual, .q-edit, .m3-more) > summary::before { content: "▸" / ""; color: var(--text-3); }
.pd-page :is(.pd-manual, .q-edit, .m3-more)[open] > summary::before { content: "▾" / ""; }
.admin-body .pd-page :is(.pd-manual, .q-edit)[open] { padding-bottom: var(--sp-4); }
.admin-body .pd-page :is(.pd-manual, .q-edit)[open] > summary { margin-bottom: var(--sp-1); }
.pd-page .pd-manual > p.hint { margin: 0 0 var(--sp-3); }
.pd-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); width: 100%; margin-top: var(--sp-3); }
.pd-page .pd-pdf-form .pd-field-date { margin-bottom: var(--sp-2); }

/* ---- C6. Tabele i stany puste w kartach projektu ---- */
.pd-empty { margin: var(--sp-2) 0 0; padding: 20px var(--sp-4); text-align: center; font-size: var(--fs-md); color: var(--text-3); background: var(--surface-2); border-radius: var(--r-md); }
.pd-page .pl-table-wrap { margin: var(--sp-2) 0 0; }
.pd-page .pl-table-wrap + :is(form, .st-subhead) { margin-top: var(--sp-4); }
.pd-page .projects-table { margin: 0; }
.pd-page .projects-table :is(th, td).rz-num { text-align: right; white-space: nowrap; }
.pd-page .projects-table .pl-badge { margin-left: var(--sp-1); }
.admin-body .pd-page .pd-anom th { text-transform: none; letter-spacing: 0; white-space: nowrap; }
.admin-body .pd-page .projects-table td.actions-cell { display: table-cell; text-align: right; }
.pd-page .projects-table td.actions-cell > * { display: inline-flex; vertical-align: middle; }
.pd-page .projects-table td.actions-cell > form { margin-left: var(--sp-1); }
.pd-page .pd-ai-table td:nth-child(7) { min-width: 260px; white-space: normal; }
.pd-page .pd-ai-table td.actions-cell > * { display: flex; margin: 0 0 var(--sp-1) auto; width: max-content; }
.pd-page .pd-ai-note:empty { display: none; }
.pd-page .pd-ai-note { margin: 0 0 var(--sp-2); }
.pd-page .callout { margin: 0 0 var(--sp-3); }
.card form.upload-form.pd-att-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); align-items: start; }
.pd-att-form .field :is(input, select) { width: 100%; }
@media (max-width: 760px) { .card form.upload-form.pd-att-form { grid-template-columns: minmax(0, 1fr); } }
.pd-att-form > :is(.file-row, .card-foot, .upload-progress) { grid-column: 1 / -1; }
.pd-att-form > .card-foot { margin-top: 0; }
.pd-page .photo-gallery { margin: 0 0 var(--sp-4); }
.pd-page .mail-send-form { margin-top: var(--sp-2); }
.pd-page .mail-send-form > :is(.error, .pd-alert) { margin: var(--sp-3) 0 0; }
.pd-page .mail-log { margin: 0; }
.admin-body .pd-page .pd-muted-card { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); padding: var(--sp-3) var(--sp-4); background: var(--surface-2); box-shadow: none; }
.pd-page .pd-muted-card > h2 { margin: 0; font-size: var(--fs-md); }
.pd-page .pd-muted-card > p { margin: 0; }
/* karty akceptacji / zagrożeń / wydań */
.pd-page .card input[type=datetime-local] { min-height: var(--ctl-h); padding: 0 10px; font: inherit; font-size: var(--fs-md); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
.pd-page .card form.q-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; align-items: end; gap: var(--sp-3) var(--sp-4); }
.pd-page .q-form :is(input, select) { width: 100%; }
.pd-page .q-form :is(.pd-form-actions, .sg-wide) { grid-column: 1 / -1; margin-top: 0; }
@media (max-width: 900px) { .pd-page .card form.q-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pd-page .card form.q-form { grid-template-columns: minmax(0, 1fr); } }
.pd-page .hz-list { list-style: none; margin: 0 0 var(--sp-3); padding: 0; border-top: 1px solid var(--line-soft); }
.pd-page .hz-list li { padding: var(--sp-2) 0; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-md); }
.pd-page .hz-list .pl-badge { margin-left: var(--sp-1); vertical-align: middle; }
.pd-page .appr-form { align-items: flex-end; gap: var(--sp-3) var(--sp-4); }
.pd-page .ed-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-3) 0; }
.pd-page .cmp-card .cmp-inline { gap: var(--sp-2); }

/* ---- C7. Karta „Model 3D” ---- */
.admin-body .m3-list { margin: 0 0 var(--sp-4); border-top: 1px solid var(--line-soft); }
.admin-body .m3-list li { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 2px var(--sp-4); min-height: var(--ctl-h-touch); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line-soft); }
.m3-list li > b { font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.m3-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m3-l1 { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.m3-l2 { font-size: var(--fs-xs); color: var(--text-3); }
.admin-body .m3-l2.error { margin: 0; color: var(--err-fg); font-size: var(--fs-xs); }
.admin-body .m3-list .inline-form { display: block; margin: 0; }
.m3-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-2); }
.pd-page .m3-hint { margin: 0; }
.pd-page .m3-list + .st-warn { margin: 0 0 var(--sp-4); }
.card form.m3-form { display: block; }
.m3-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-4) var(--sp-6); align-items: start; }
.m3-form fieldset { margin: 0; }
.m3-form legend { float: left; width: 100%; margin: 0 0 var(--sp-1); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.m3-form legend span { font-weight: 400; letter-spacing: 0; text-transform: none; }
.m3-form legend + * { clear: both; }
/* zakres temperatur: wyróżniona ramka; pasek czerń -> biel pokazuje, której barwie tekstury odpowiada każde pole */
.m3-form .m3-range-fs { padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand-fill); border-radius: var(--r-md); }
.m3-range { display: grid; grid-template-columns: minmax(0, 1fr) minmax(24px, 96px) minmax(0, 1fr); align-items: end; gap: var(--sp-3); padding: var(--sp-1) 0 var(--sp-2); }
.m3-range .field input { width: 100%; max-width: 160px; }
.m3-range .field:last-child { align-items: flex-end; text-align: right; }
.m3-ramp { height: 12px; margin-bottom: var(--sp-3); border-radius: var(--r-pill); background: linear-gradient(90deg, black, white); box-shadow: inset 0 0 0 1px var(--line-strong); }
.m3-range-fs .file-row { border-top: 1px solid var(--line-soft); border-bottom: 0; }
.m3-range-fs p.hint { margin: var(--sp-1) 0 0; }
.m3-more { margin-top: var(--sp-4); border-top: 1px solid var(--line-soft); }
.admin-body .pd-page .m3-more > summary { font-size: var(--fs-sm); color: var(--text-2); }
.m3-form > .card-foot { margin-top: var(--sp-3); }
@media (max-width: 900px) { .m3-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .admin-body .m3-list li { grid-template-columns: minmax(0, 1fr) auto; }
    .m3-list .m3-info { grid-column: 1 / -1; grid-row: 2; }
    .m3-range { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .m3-ramp { grid-column: 1 / -1; grid-row: 1; margin: 0; }
    .m3-actions > * { flex: 1 1 100%; }
}

/* ---- C8. Lista projektów ---- */
@media (min-width: 761px) {
    .admin-body .pl-table td { height: 56px; padding: 6px var(--sp-3); font-size: var(--fs-md); }
    .admin-body .pl-table td.pl-actions { white-space: nowrap; text-align: right; }
}
.admin-body .pl-table .pl-name-link { font-size: var(--fs-md); font-weight: 600; }
.admin-body .pl-table .pl-sub { font-size: var(--fs-xs); margin-top: 0; }
.admin-body .pl-table .pl-code { min-height: 24px; }
.admin-body .pl-act { min-height: 32px; padding: var(--sp-2) 10px; display: inline-flex; align-items: center; font-size: var(--fs-sm); font-weight: 500; }
.admin-body .card .pl-table .pl-del { margin-left: var(--sp-3); color: var(--err-fg); }
/* ===== R1-C: Panel projektu – koniec ===== */

/* ===== R1-D: Widok modelu 3D, formularz anomalii, telefon ===== */
/* ==========================================================================
   Tura R1, pakiet D. Korzysta z tokenów bloku R1 (--m3d-*, --sp-*, --fs-*, --ctl-h*, --r-*).
   Spis: D1 widok modelu 3D (pasek górny, panel z sekcjami, przyciski i pola na ciemnym tle,
         skala temperatur, pomiar, anomalie, raport z modelu, edytor pól, „Sterowanie”, karta anomalii),
         D2 narzędzia (40 px, dwie grupy, etykieta po najechaniu/fokusie), pasek podpowiedzi, fokus sceny,
         D1-tel. telefon, D4 formularz anomalii (grupy pól, CoA, pasek przycisków), D5/D6 drobne poprawki.
   Widok 3D nie ma klasy .admin-body – reguły zamknięte w .m3d-body / .m3d-panel.
   ========================================================================== */

/* ---- D1. Widok modelu 3D: zmienne i pasek górny ---- */
.m3d-body {
    --m3d-top: 52px;                                  /* wysokość paska górnego = początek sceny */
    --m3d-hover: rgba(255,255,255,.08); --m3d-field: #101215; --m3d-accent: #ffd400; --m3d-err: #fca5a5; --m3d-link: #93c5fd;
    --m3d-k3: #d64545; --m3d-k2: #f08a24; --m3d-k1: #e8c547; --m3d-ref: #3b82f6; --m3d-bx: #e11d48;
}
.m3d-body #topbar { height: var(--m3d-top); box-sizing: border-box; padding: 0 16px; gap: 16px; flex-wrap: nowrap; }
.m3d-body #topbar .topbar-left { flex: 1 1 auto; min-width: 0; }
.m3d-body #topbar .topbar-logo { flex: none; }
.m3d-body #topbar .project-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.m3d-body #topbar .topbar-right { flex: none; gap: 8px; }
.m3d-body #topbar :is(.projects-link, .logout-link) {
    display: inline-flex; align-items: center; box-sizing: border-box; min-height: 32px; margin: 0; padding: 0 12px;
    color: var(--m3d-text); background: transparent; border: 1px solid var(--m3d-line); border-radius: var(--r-md);
    font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; text-decoration: none;
}
.m3d-body #topbar :is(.projects-link, .logout-link):hover { background: var(--m3d-hover); border-color: var(--m3d-text-2); }
.m3d-body #m3d-scene { top: var(--m3d-top); }
.m3d-body #m3d-scene:focus-visible { outline: 2px solid var(--m3d-text); outline-offset: -4px; }
.m3d-body :is(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.m3d-body .m3d-card { --focus: var(--ink); }

/* ---- D1. Panel: sekcje z tytułami ---- */
.m3d-body .m3d-panel {
    top: calc(var(--m3d-top) + 12px); left: 12px; width: 300px; box-sizing: border-box; padding: 0 16px;
    max-height: calc(100% - var(--m3d-top) - 24px); overflow: auto; overscroll-behavior: contain;
    background: var(--m3d-surface); color: var(--m3d-text); border: 1px solid var(--m3d-line-soft); border-radius: var(--r-lg);
    font-size: var(--fs-sm); line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark; scrollbar-width: thin; scrollbar-color: var(--m3d-line) transparent;
}
.m3d-body .m3d-panel:has(.m3d-ed:not([hidden])) { width: 340px; max-height: calc(100% - var(--m3d-top) - 24px); }
.m3d-panel [hidden] { display: none; }
.m3d-panel .m3d-sec { margin: 0; padding: var(--sp-4) 0; border: 0; border-top: 1px solid var(--m3d-line-soft); border-radius: 0; min-width: 0; }
.m3d-panel .m3d-sec:first-child { border-top: 0; }
.m3d-panel .m3d-sec-h {
    margin: 0 0 10px; padding: 0; font-size: var(--fs-xs); font-weight: 700; line-height: 1.3; letter-spacing: .06em;
    text-transform: uppercase; color: var(--m3d-text-2);
}
.m3d-panel fieldset.m3d-sec > legend.m3d-sec-h { float: left; width: 100%; }      /* legenda w treści, nie na linii */
.m3d-panel fieldset.m3d-sec > legend.m3d-sec-h + * { clear: both; }
.m3d-panel .m3d-label { display: block; margin: 12px 0 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--m3d-text-2); }
.m3d-panel .m3d-hint { margin: 8px 0 0; font-size: var(--fs-xs); line-height: 1.45; color: var(--m3d-text-2); }
.m3d-panel .m3d-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.m3d-panel .m3d-status { margin: 0; padding: 0 0 12px; font-size: var(--fs-xs); color: var(--m3d-text-2); }
.m3d-panel .m3d-status:empty { display: none; }

/* pola na ciemnym tle */
.m3d-panel select, .m3d-panel input[type=number], .m3d-panel input[type=text], .m3d-panel textarea {
    box-sizing: border-box; min-height: var(--ctl-h); margin: 0; padding: 0 10px; background: var(--m3d-field); color: var(--m3d-text);
    border: 1px solid var(--m3d-line); border-radius: var(--r-sm); font: inherit; font-size: var(--fs-md);
}
.m3d-panel select { width: 100%; max-width: none; }
.m3d-panel input[type=number] { width: 88px; font-variant-numeric: tabular-nums; }
.m3d-panel textarea { width: 100%; min-height: 64px; padding: 8px 10px; line-height: 1.4; resize: vertical; }
.m3d-panel :is(select, input, textarea):hover { border-color: var(--m3d-text-2); }
.m3d-panel .m3d-check {
    display: flex; align-items: flex-start; gap: 8px; min-height: var(--ctl-h-sm); margin: 0; padding-block: 4px; box-sizing: border-box;
    font-size: var(--fs-sm); line-height: 20px; color: var(--m3d-text); cursor: pointer;
}
.m3d-panel .m3d-check > input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand-fill); }
.m3d-panel .m3d-switch + .m3d-check { margin-top: 8px; }

/* przyciski: główny (marka), .m3d-btn (obrys), linkowy, ikonowy 28 px */
.m3d-panel .btn-primary {
    display: flex; align-items: center; justify-content: center; width: 100%; box-sizing: border-box; min-height: var(--ctl-h);
    margin: 8px 0 0; padding: 0 14px; background: var(--brand-fill); color: var(--brand-fill-text, #fff); border: 0; border-radius: var(--r-md);
    font: inherit; font-size: var(--fs-md); font-weight: 600; cursor: pointer;
}
.m3d-panel .btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brand-fill) 88%, black); }
.m3d-body :is(.m3d-btn, .m3d-panel .btn-secondary) {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box; min-height: 32px; margin: 0;
    padding: 0 12px; background: transparent; color: var(--m3d-text); border: 1px solid var(--m3d-line); border-radius: var(--r-md);
    font: inherit; font-size: var(--fs-sm); font-weight: 600; line-height: 1.2; white-space: nowrap; text-decoration: none; cursor: pointer;
}
.m3d-body :is(.m3d-btn, .m3d-panel .btn-secondary):hover:not(:disabled) { background: var(--m3d-hover); border-color: var(--m3d-text-2); }
.m3d-panel :is(.btn-primary, .btn-secondary, .m3d-btn, .m3d-ico):disabled { opacity: .4; cursor: not-allowed; }
.m3d-panel .link-button { min-height: 28px; padding: 0 4px; color: var(--m3d-text); font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 2px; }
.m3d-body .m3d-ico {
    display: inline-grid; place-items: center; width: 28px; height: 28px; margin: 0; padding: 0; background: transparent; color: var(--m3d-text-2);
    border: 0; border-radius: var(--r-sm); font: inherit; font-size: var(--fs-lg); line-height: 1; cursor: pointer;
}
.m3d-body .m3d-ico:hover:not(:disabled) { background: var(--m3d-hover); color: var(--m3d-text); }
.m3d-body .m3d-ico-del:hover:not(:disabled) { color: var(--m3d-err); }

/* 1. Warstwa: przełącznik segmentowy 36 px */
.m3d-panel .m3d-switch { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--m3d-line); border-radius: var(--r-md); }
.m3d-panel .m3d-switch button {
    flex: 1 1 0; min-width: 0; min-height: 30px; padding: 0 8px; background: transparent; color: var(--m3d-text); border: 0;
    border-radius: var(--r-sm); font: inherit; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; cursor: pointer;
}
.m3d-panel .m3d-switch button:hover:not(.on, :disabled) { background: var(--m3d-hover); }
.m3d-panel .m3d-switch button.on { background: var(--brand-fill); color: var(--brand-fill-text, #fff); }

/* 2. Skala temperatur: zakres, legenda z 5 opisami */
.m3d-panel .m3d-zakres-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 6px; }
.m3d-panel .m3d-zakres-head .m3d-label { margin: 0; }
.m3d-panel .m3d-zakres-row label { display: inline; margin: 0; font-size: var(--fs-sm); color: var(--m3d-text-2); }
.m3d-panel .m3d-zakres-row label + input { margin-right: 4px; }
.m3d-panel .m3d-legend { margin: 14px 0 0; }
.m3d-panel .m3d-legend-bar { height: 14px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.m3d-panel .m3d-legend-labels { display: block; position: relative; height: 22px; margin: 0; font-size: var(--fs-xs); color: var(--m3d-text-2); font-variant-numeric: tabular-nums; }
.m3d-panel .m3d-legend-labels span { position: absolute; top: 0; padding-top: 6px; white-space: nowrap; transform: translateX(-50%); }
.m3d-panel .m3d-legend-labels span::before { content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 4px; background: var(--m3d-text-2); }
.m3d-panel .m3d-legend-labels span:nth-child(1) { left: 0; transform: none; color: var(--m3d-text); }
.m3d-panel .m3d-legend-labels span:nth-child(1)::before { left: 0; }
.m3d-panel .m3d-legend-labels span:nth-child(2) { left: 25%; }
.m3d-panel .m3d-legend-labels span:nth-child(3) { left: 50%; }
.m3d-panel .m3d-legend-labels span:nth-child(4) { left: 75%; }
.m3d-panel .m3d-legend-labels span:nth-child(5) { left: auto; right: 0; transform: none; color: var(--m3d-text); }
.m3d-panel .m3d-legend-labels span:nth-child(5)::before { left: auto; right: 0; }

/* 3. Pomiar: sekcja wyróżniona paskiem (kolor obrysu na modelu), wyniki nazwa | wartość */
.m3d-panel .m3d-pm {
    margin: 0 -16px; padding: var(--sp-4) 16px var(--sp-4) 13px; border: 0; border-top: 1px solid var(--m3d-line-soft);
    border-left: 3px solid var(--m3d-accent); border-radius: 0; background: rgba(255,212,0,.05);
}
.m3d-panel .m3d-pm-h { color: var(--m3d-accent); }
.m3d-panel .m3d-pm-wynik { display: grid; gap: 2px; font-size: var(--fs-sm); }
.m3d-panel .m3d-pm-wynik:empty { display: none; }
.m3d-panel .m3d-pm-t { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; font-size: var(--fs-md); font-weight: 600; }
.m3d-panel .m3d-pm-t > b { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.m3d-panel .m3d-pm-wynik > .m3d-hint { margin-top: 6px; }
.m3d-panel .m3d-pm-akcje { margin-top: 12px; }

/* 4. Anomalie z raportu: klasy z kropką koloru, lista przycisków */
.m3d-panel .m3d-anom-cls { display: grid; gap: 0; margin: 4px 0 0; font-size: var(--fs-sm); }
.m3d-panel .m3d-anom-cls label::before, .m3d-panel .m3d-ed-tools label::before { content: none; }
.m3d-panel :is(.m3d-k1, .m3d-k2, .m3d-k3, .m3d-ed-ref, .m3d-ed-bx) > span::before,
.m3d-panel .m3d-anom-btn::before {
    content: ""; display: inline-block; flex: none; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%;
    vertical-align: -1px; background: var(--m3d-k, var(--m3d-line));
}
.m3d-panel .m3d-k3 { --m3d-k: var(--m3d-k3); } .m3d-panel .m3d-k2 { --m3d-k: var(--m3d-k2); } .m3d-panel .m3d-k1 { --m3d-k: var(--m3d-k1); }
.m3d-panel .m3d-ed-ref { --m3d-k: var(--m3d-ref); } .m3d-panel .m3d-ed-bx { --m3d-k: var(--m3d-bx); }
.m3d-panel .m3d-ed-tools :is(.m3d-ed-ref, .m3d-ed-bx) > span::before { border-radius: 2px; }
.m3d-panel .m3d-anom-list { display: grid; gap: 4px; max-height: 232px; overflow: auto; margin: 10px 0 0; padding: 0; list-style: none; }
.m3d-panel .m3d-anom-list:empty { display: none; }
.m3d-panel .m3d-anom-btn {
    display: flex; align-items: center; width: 100%; min-height: 32px; margin: 0; padding: 4px 10px; box-sizing: border-box; text-align: left;
    background: transparent; color: var(--m3d-text); border: 1px solid var(--m3d-line-soft); border-radius: var(--r-sm);
    font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.m3d-panel .m3d-anom-btn:hover { background: var(--m3d-hover); border-color: var(--m3d-line); }

/* 5. Pola pomiarowe (edytor) */
.m3d-panel .m3d-ed-tools { display: grid; gap: 0; margin: 0 0 4px; }
.m3d-panel .m3d-kind-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; margin: 4px 0 8px; }
.m3d-panel .m3d-kind-row .m3d-label { margin: 0; }
.m3d-panel .m3d-ed select { max-width: none; }
.m3d-panel .m3d-ed-list { margin: 8px 0; padding-left: 20px; font-size: var(--fs-xs); }
.m3d-panel .m3d-ed-list li { position: relative; min-height: 28px; padding-right: 32px; line-height: 28px; }
.m3d-panel .m3d-ed-list li::before { content: none; }
.m3d-panel .m3d-ed-list li.m3d-ed-ref { color: var(--m3d-link); }
.m3d-panel .m3d-ed-list li :is(.m3d-ico, .link-button) { position: absolute; right: 0; top: 0; }
.m3d-panel .m3d-ed .m3d-row .btn-primary { flex: 1 1 auto; width: auto; margin: 0; }
.m3d-panel .m3d-ed .m3d-row { margin-top: 8px; }
.m3d-panel .m3d-ed-msg { margin: 8px 0 0; font-size: var(--fs-xs); line-height: 1.45; }
.m3d-panel .m3d-ed-msg .action-link { display: inline-flex; margin-top: 6px; color: var(--m3d-link); }
.m3d-panel .m3d-ed-cand { margin: 8px 0; padding: 8px; background: var(--m3d-hover); border-radius: var(--r-md); font-size: var(--fs-xs); }
.m3d-panel .m3d-ed-cand :is(.btn-primary, .btn-secondary) { width: 100%; margin-top: 8px; }

/* 6. Raport PDF z modelu: miniatura 64×40, opis do 2 linii, przyciski ↑ ↓ × 28 px */
.m3d-panel .m3d-kroki { margin: 0 0 4px; color: var(--m3d-text); }
.m3d-panel .m3d-rap textarea { margin: 0; font-size: var(--fs-sm); }
.m3d-panel .m3d-rap-lista { margin: 12px 0 0; padding: 0; list-style: none; font-size: var(--fs-xs); }
.m3d-panel .m3d-rap-lista:empty { display: none; }
.m3d-panel .m3d-rap-lista li {
    display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: auto auto; gap: 2px 10px; align-items: start;
    padding: 8px 0; border-top: 1px solid var(--m3d-line-soft); border-bottom: 0;
}
.m3d-panel .m3d-rap-lista li:last-child { border-bottom: 1px solid var(--m3d-line-soft); }
.m3d-panel .m3d-rap-lista img { grid-row: 1 / span 2; width: 64px; height: 40px; object-fit: cover; border-radius: var(--r-sm); }
.m3d-panel .m3d-rap-txt { display: grid; gap: 2px; min-width: 0; }
.m3d-panel .m3d-rap-opis { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--m3d-text); line-height: 1.35; }
.m3d-panel .m3d-rap-wyn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--m3d-text-2); font-variant-numeric: tabular-nums; }
.m3d-panel .m3d-rap-akcje { display: flex; justify-content: flex-end; gap: 2px; margin-right: -4px; }
.m3d-panel #m3d-rap-pdf { margin-top: 12px; }

/* 7. Sterowanie (zwinięte) */
.m3d-panel .m3d-help > summary {
    display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 0; list-style: none; cursor: pointer;
    font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--m3d-text-2);
}
.m3d-panel .m3d-help > summary::-webkit-details-marker { display: none; }
.m3d-panel .m3d-help > summary::before { content: "▸" / ""; font-size: var(--fs-sm); }
.m3d-panel .m3d-help[open] > summary::before { content: "▾" / ""; }
.m3d-panel .m3d-help > summary:hover { color: var(--m3d-text); }
.m3d-panel .m3d-help > .m3d-hint:first-of-type { margin-top: 4px; }
.m3d-panel .m3d-keys { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-xs); color: var(--m3d-text-2); }
.m3d-panel .m3d-keys li { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: center; gap: 8px; }
.m3d-panel .m3d-keys li > span { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.m3d-body kbd {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; box-sizing: border-box; padding: 0 4px;
    background: var(--m3d-field); color: var(--m3d-text); border: 1px solid var(--m3d-line); border-bottom-width: 2px; border-radius: 4px;
    font: 600 var(--fs-xs)/1 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---- D2. Narzędzia: 40 px, dwie grupy, etykieta po lewej po najechaniu / fokusie ---- */
.m3d-body .m3d-tools { top: calc(var(--m3d-top) + 12px); right: 12px; gap: 8px; align-items: center; }
.m3d-body .m3d-tools button {
    position: relative; width: 40px; height: 40px; background: var(--m3d-surface); color: var(--m3d-text);
    border: 1px solid var(--m3d-line); border-radius: var(--r-md); box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.m3d-body .m3d-tools button:hover:not(.on) { background: color-mix(in srgb, var(--m3d-surface) 82%, white); border-color: var(--m3d-text-2); }
.m3d-body .m3d-tools button.on { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--brand-fill-text, #fff); }
.m3d-body .m3d-tools button[hidden] { display: none; }
.m3d-body .m3d-tools-sep { display: block; width: 24px; height: 1px; background: var(--m3d-line); }
.m3d-body .m3d-tools button::after {
    content: attr(aria-label); position: absolute; top: 50%; right: calc(100% + 8px); transform: translateY(-50%);
    padding: 5px 10px; background: var(--m3d-surface); color: var(--m3d-text); border: 1px solid var(--m3d-line-soft); border-radius: var(--r-sm);
    font-size: var(--fs-xs); font-weight: 600; line-height: 1.3; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s;
}
.m3d-body .m3d-tools button:focus-visible::after { opacity: 1; }
@media (hover: hover) { .m3d-body .m3d-tools button:hover::after { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .m3d-body .m3d-tools button::after { transition: none; } }
/* pasek podpowiedzi aktywnego narzędzia u dołu sceny */
.m3d-body .m3d-toolhint {
    position: absolute; left: 50%; bottom: 20px; z-index: 6; transform: translateX(-50%); box-sizing: border-box; width: max-content; max-width: calc(100vw - 32px);
    margin: 0; padding: 8px 16px; background: var(--m3d-surface); color: var(--m3d-text); border: 1px solid var(--m3d-line-soft);
    border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600; text-align: center; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.m3d-body .m3d-toolhint:empty { display: none; }
.m3d-body .m3d-readout { padding: 4px 8px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }

/* ---- D1. Karta anomalii ---- */
.m3d-body #m3d-card { top: calc(var(--m3d-top) + 12px); right: 64px; box-sizing: border-box; padding: 14px 16px 16px; border-radius: var(--r-lg); font-size: var(--fs-sm); }
.m3d-body .m3d-card-h { margin: 0 36px 6px 0; font-size: var(--fs-md); font-weight: 600; line-height: 1.35; color: var(--ink); }
.m3d-body .m3d-card-x { display: grid; place-items: center; width: 32px; height: 32px; top: 8px; right: 8px; padding: 0; color: var(--text-2); border-radius: var(--r-sm); font-size: var(--fs-xl); }
.m3d-body .m3d-card-x:hover { background: var(--surface-2); color: var(--ink); }
.m3d-body .m3d-card .action-link { display: inline-flex; align-items: center; min-height: 32px; }

/* ---- D1. Telefon: pasek górny w jednej linii, panel obok kolumny narzędzi, cele 44 px ---- */
@media (max-width: 640px) {
    .m3d-body { --m3d-top: 48px; }
    .m3d-body #topbar { padding: 0 8px 0 12px; gap: 8px; row-gap: 0; }
    .m3d-body #topbar .topbar-left { width: auto; }
    .m3d-body #topbar .topbar-right { width: auto; overflow: visible; padding: 0; gap: 4px; }
    .m3d-body #topbar .topbar-logo { height: 20px; max-width: 18vw; margin-right: 8px; object-fit: contain; object-position: left center; }
    .m3d-body #topbar .project-name { font-size: var(--fs-sm); }
    .m3d-body #topbar .project-date { display: none; }
    .m3d-body #topbar :is(.projects-link, .logout-link) { min-height: 36px; padding: 0 8px; font-size: var(--fs-sm); }
    .m3d-body .m3d-panel, .m3d-body .m3d-panel:has(.m3d-ed:not([hidden])) {
        top: calc(var(--m3d-top) + 8px); left: 8px; right: 60px; width: auto; max-height: calc(100% - var(--m3d-top) - 16px);
    }
    .m3d-body .m3d-tools { top: calc(var(--m3d-top) + 8px); right: 8px; }
    .m3d-body .m3d-tools button { width: 44px; height: 44px; }
    .m3d-body #m3d-card { top: calc(var(--m3d-top) + 8px); left: 8px; right: 60px; width: auto; max-width: none; }
    .m3d-panel .m3d-check { min-height: var(--ctl-h-touch); align-items: center; padding-block: 0; }
    .m3d-panel .m3d-check > input { margin: 0; }
    .m3d-panel .m3d-switch button { min-height: 38px; }
    .m3d-panel .btn-primary { min-height: var(--ctl-h-touch); }
    .m3d-body :is(.m3d-btn, .m3d-panel .btn-secondary) { min-height: 36px; }
    .m3d-panel :is(select, input[type=number], input[type=text], textarea) { font-size: var(--fs-lg); }
    .m3d-panel .m3d-help > summary { min-height: var(--ctl-h-touch); }
    .m3d-panel .m3d-anom-btn { min-height: var(--ctl-h-touch); }
    .m3d-body .m3d-toolhint { bottom: 12px; font-size: var(--fs-xs); }
}

/* ---- D4. Formularz anomalii: kolumna grup (fieldset.af-group), każda grupa = własna siatka 2 kolumn ---- */
.admin-body .af-form-card form.anomaly-form-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
.af-form-card .af-group {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; align-items: start; min-width: 0;
    margin: 0; padding: var(--sp-4) 0; border: 0; border-top: 1px solid var(--line-soft);
}
.af-form-card .af-group:first-child { padding-top: 0; border-top: 0; }
.af-form-card .af-group > legend.af-sub {          /* legenda jako zwykły element siatki (nie na linii ramki) */
    float: left; grid-column: 1 / -1; width: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
    margin: 0 0 -4px; padding: 0; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3);
}
.af-form-card .af-group > legend.af-sub .hint { font-size: var(--fs-xs); font-weight: 400; letter-spacing: 0; text-transform: none; }
.af-form-card .af-g-opis { grid-template-columns: minmax(0, 110px) minmax(0, 1fr); }
.af-form-card .af-temps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.af-form-card .af-group .field-hint { font-weight: 400; line-height: 1.35; }
/* klasa CoA: trzy równe segmenty (cyfra + nazwa z normy); pole tekstowe zostaje ukryte w DOM */
.af-form-card .af-coa-field { display: grid; gap: 4px; min-width: 0; }
.af-form-card .af-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.af-form-card .af-coa-pick { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 0; }   /* wąska kolumna formularza: jedna pod drugą */
@media (min-width: 641px) and (max-width: 1099px) { .af-form-card .af-coa-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } }
.admin-body .card .af-coa-pick .af-coa {
    display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: auto; min-height: var(--ctl-h); height: auto;
    padding: 6px 10px; text-align: left; line-height: 1.25; background: var(--surface); color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: var(--r-md); cursor: pointer;
}
.admin-body .card .af-coa-pick .af-coa:hover { background: var(--surface-2); border-color: var(--text-4); }
.af-coa-pick .af-coa > b { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--fs-md); font-weight: 700; }
.af-coa-pick .af-coa > span { font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); }
.admin-body .card .af-coa-pick .af-coa.is-on > :is(b, span) { color: inherit; background: transparent; }
.admin-body .card .af-coa-pick .af-coa-1.is-on { background: var(--ok-fg); border-color: var(--ok-fg); color: var(--surface); }
.admin-body .card .af-coa-pick .af-coa-2.is-on { background: var(--sev-2); border-color: var(--sev-2); color: var(--sev-2-text); }
.admin-body .card .af-coa-pick .af-coa-3.is-on { background: var(--err-fg); border-color: var(--err-fg); color: var(--surface); }
/* pasek przycisków: pełne tło, cień od góry; formularz kończy się na pasku (ostatnie pole zawsze da się przewinąć nad niego) */
.af-form-card .anomaly-form-buttons { margin-top: 0; background: var(--surface); }
@media (min-width: 1100px) { .af-form-card .anomaly-form-buttons { box-shadow: 0 -10px 16px -12px rgba(16, 24, 40, .28); } }
/* mapa: suwak krycia z widocznym podpisem, opis AI jako pole z etykietą */
.anomaly-map-wrap .anomaly-map-controls .af-opacity { gap: 6px; white-space: nowrap; }
.af-ai { display: grid; gap: 8px; margin-top: var(--sp-4); }
.af-ai-act { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.af-ai-act .sg-help { margin: 0; }
.af-ai-corr { margin-top: var(--sp-3); }
@media (max-width: 640px) {
    .af-form-card .af-group, .af-form-card .af-g-opis { grid-template-columns: minmax(0, 1fr); }
    .af-form-card .af-g-wsp { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .af-form-card .af-temps { gap: 8px; }
    .admin-body .card .af-coa-pick .af-coa { min-height: var(--ctl-h-touch); }
    .af-map-card .anomaly-map-wrap { height: 320px; }
    .anomaly-map-wrap .temp-toolbar { width: auto; max-width: calc(100% - 20px); flex-wrap: wrap; }
    .admin-body .af-map-card .temp-tool-btn { flex-direction: row; gap: 4px; min-height: var(--ctl-h); padding: 0 8px; font-size: var(--fs-xs); border-radius: var(--r-md); }
    .admin-body .af-map-card .temp-tool-icon { font-size: var(--fs-md); }
    .af-map-card .anomaly-map-wrap .leaflet-top.leaflet-left { top: 62px; }
}

/* ---- D5. Telefon: menu pobierania nie wychodzi poza ekran ---- */
.download-menu-list { max-width: calc(100vw - 16px); }

/* ---- D6. Drobne poprawki ---- */
.cal-up-date i.cal-up-year { font-size: var(--fs-xs); opacity: 1; }
/* ===== R1-D – koniec ===== */

/* ===== R2-E: system ===== */
/* Spis (szczegóły w KOMPONENTY.md, sekcja „R2-E”):
     E1. <header class="admin-header"> – jeden wiersz (logo | linki | dzwonek, Wyloguj), banery pod spodem w jednej linii;
         telefon: logo, pod nim przewijany pasek linków z zanikiem + stały dzwonek i „Wyloguj”
     E2. <main class="admin-main"> – jedna treść strony (odstęp od nagłówka daje main)
     E3. .page-head (+ .page-head-main, .page-head-actions, .page-head-lead), .cc-back „‹ Cel”, zakładki .sub-nav
     E4. jeden znacznik rozwijania: szewron 8 px przed tekstem każdego summary (poza pomocą „?”)
     E5. pomoc „Jak to działa” jako ikona „?” w prawym górnym rogu karty
     E6. jedna rodzina plakietek klas: .inv-coa-1..3, .sg-prio-1..4 – tinty z tokenów
     E7. akcje w wierszach list: „Otwórz” (drugorzędny) + linki w stałych slotach
     E10/E14/E16/E18–E21 – panel projektu i Ustawienia */

/* ---- E1. Nagłówek panelu ---- */
.admin-body .admin-header {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: var(--sp-5); row-gap: 0;
    min-height: 64px; padding: 0 var(--sp-5); margin: 0;
}
.admin-body .admin-header-brand { min-height: 64px; }
.admin-body .admin-header-brand .admin-logo { max-height: 32px; }
.admin-body .admin-nav { display: flex; align-items: center; flex-wrap: nowrap; gap: var(--sp-1); min-width: 0; }
.admin-nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; }
.admin-body .admin-nav .notif { margin: 0 0 0 auto; }
.admin-body .admin-nav .admin-nav-logout { margin-left: 0; }
.admin-body .admin-header > .pd-alert {
    grid-column: 1 / -1; order: 3; display: block; min-height: 36px; margin: 0 0 var(--sp-3); padding: 0 var(--sp-3);
    line-height: 34px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-body .admin-header > .pd-alert + .pd-alert { margin-top: calc(-1 * var(--sp-2)); }
.admin-body .admin-main { display: block; outline: none; padding-top: var(--sp-5); }
@media (max-width: 760px) {
    .admin-body .admin-wrap { margin-top: var(--sp-2); }
    .admin-body .admin-header { grid-template-columns: minmax(0, 1fr); padding: 0 var(--sp-3); min-height: 0; }
    .admin-body .admin-header-brand { min-height: 48px; }
    .admin-body .admin-header-brand .admin-logo, .admin-body .admin-header-brand .admin-logo-fit { max-height: 28px; }
    .admin-body .admin-header-brand .admin-logo-fit { height: 28px; }
    .admin-body .admin-nav { order: 2; width: 100%; flex-wrap: nowrap; overflow: visible; gap: 0; margin: 0 calc(-1 * var(--sp-3)); padding: 0 var(--sp-1) 0 0; width: calc(100% + 2 * var(--sp-3)); border-top: 1px solid var(--line-soft); }
    .admin-nav-links {
        flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-left: var(--sp-1);
        -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
    }
    .admin-nav-links::-webkit-scrollbar { display: none; }
    .admin-body .admin-nav .admin-nav-links a { flex: 0 0 auto; min-height: var(--ctl-h-touch); white-space: nowrap; }
    .admin-body .admin-nav .notif { margin: 0; }
    .admin-body .admin-nav .notif-bell { width: var(--ctl-h-touch); height: var(--ctl-h-touch); }
    .admin-body .admin-nav .admin-nav-logout { min-height: var(--ctl-h-touch); padding: 0 var(--sp-2); }
    .admin-body .admin-header > .pd-alert { margin: var(--sp-2) 0; }
    .admin-body .admin-main { padding-top: var(--sp-4); }
}

/* ---- E3. Nagłówek strony, link powrotu, zakładki podstron ---- */
.admin-body :is(.page-head, .af-head) { margin: 0 0 var(--sp-4); }
.admin-body .db-head { margin-bottom: var(--sp-4); }
.page-head .cc-back { margin-bottom: var(--sp-2); }
.page-head-main { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3) var(--sp-4); min-height: 40px; }
.admin-body :is(.page-head, .af-head, .db-head) h1 { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; color: var(--ink); }
.page-head-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.page-head-lead { margin: 6px 0 0; max-width: 72ch; font-size: var(--fs-sm); color: var(--text-3); }
@media (max-width: 760px) {
    .page-head-actions { width: 100%; margin-left: 0; }
    .page-head-actions > :is(a, button) { flex: 1 1 auto; min-height: var(--ctl-h-touch); }
}
.admin-body :is(.cc-back, .us-crumb a) {
    display: inline-flex; align-items: center; min-height: 24px; padding: 0; border: 0; background: none;
    font-size: var(--fs-sm); font-weight: 500; line-height: 1.2; color: var(--text-2); text-decoration: none;
}
.admin-body :is(.cc-back, .us-crumb a):hover { text-decoration: underline; text-underline-offset: 2px; }
.admin-body .cc-back { margin: 0 0 var(--sp-2); }
.admin-body .sub-nav { display: flex; flex-wrap: nowrap; gap: var(--sp-1); margin: 0 0 var(--sp-4); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.admin-body .sub-nav a {
    display: inline-flex; align-items: center; flex: 0 0 auto; min-height: 40px; padding: 0 var(--sp-3); margin-bottom: -1px;
    font-size: var(--fs-md); font-weight: 600; color: var(--text-2); text-decoration: none; white-space: nowrap;
    background: none; border-radius: 0; border-bottom: 2px solid transparent;
}
.admin-body .sub-nav a:hover:not(.active) { background: none; color: var(--brand-dark); border-bottom-color: var(--line-strong); }
.admin-body .sub-nav :is(a.active, a[aria-current]) { color: var(--brand-dark); background: none; border-bottom-color: var(--brand-dark); }

/* ---- E4. Jeden znacznik rozwijania (szewron) ---- */
:is(.admin-body, .m3d-body) details > summary { list-style: none; }
:is(.admin-body, .m3d-body) details > summary::-webkit-details-marker { display: none; }
:is(.admin-body, .m3d-body) details:not(.sg-help, .jl-new, .db-group, .download-menu, .cc-edit, .rl-actions, .layers-note) > summary::before {
    content: "" / ""; display: inline-block; flex: none; box-sizing: border-box; width: 8px; height: 8px; margin: 0 var(--sp-2) 0 2px;
    border: solid var(--text-3); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(-45deg);
    font-size: 0; vertical-align: middle; background: none; transition: transform .15s ease;
}
:is(.admin-body, .m3d-body) details[open]:not(.sg-help, .jl-new, .db-group, .download-menu, .cc-edit, .rl-actions, .layers-note) > summary::before { transform: translateY(-3px) rotate(45deg); }
.m3d-body details:not(.sg-help) > summary::before { border-color: var(--m3d-text-2); }
/* stare znaczniki tekstowe (▸ ▾ ▴) na końcu summary – wyzerowane */
.admin-body :is(.cv-guide, .db-more, .us-log) > summary::after { content: none; }
@media (prefers-reduced-motion: reduce) { :is(.admin-body, .m3d-body) details > summary::before { transition: none; } }

/* ---- E5. Pomoc „Jak to działa” jako ikona „?” w rogu karty ---- */
.admin-body .card { position: relative; }
.admin-body .card > .card-lead:has(+ details.sg-help) { margin-bottom: var(--sp-4); }
.admin-body .card > .card-lead + details.sg-help { margin: 0; }
.admin-body .card > .card-lead + details.sg-help > summary {
    position: absolute; top: var(--card-pad); right: var(--card-pad); z-index: 1;
    display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; min-height: 24px; padding: 0;
    font-size: 0; color: transparent; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface);
}
.admin-body .card > .card-lead + details.sg-help > summary::before { content: none; }
.admin-body .card > .card-lead + details.sg-help > summary::after { content: "?" / ""; font-size: var(--fs-sm); font-weight: 600; line-height: 1; color: var(--text-2); }
.admin-body .card > .card-lead + details.sg-help > summary:hover { border-color: var(--text-3); background: var(--surface-2); }
.admin-body .card > .card-lead + details.sg-help[open] > summary { border-color: var(--brand-dark); background: var(--surface-2); }
.admin-body .card > .card-lead + details.sg-help[open] { margin: 0 0 var(--sp-4); }
.admin-body .card > .card-lead + details.sg-help[open] > :not(summary) { margin-top: 0; }
.admin-body .card:has(> .card-lead + details.sg-help) > :is(h2, h3, .card-head) { padding-right: 36px; }
/* pozostałe „?” (w środku formularzy, kilka w karcie) – zwarty wiersz 24 px */
.admin-body details.sg-help:not(.card > .card-lead + details.sg-help) { margin: 0 0 var(--sp-3); }
.admin-body details.sg-help:not(.card > .card-lead + details.sg-help) > summary { min-height: 24px; padding-block: 0; }
@media (max-width: 760px) {
    .admin-body .card > .card-lead + details.sg-help > summary { top: var(--sp-4); right: var(--sp-4); width: 32px; height: 32px; }
    .admin-body .card:has(> .card-lead + details.sg-help) > :is(h2, h3, .card-head) { padding-right: 44px; }
}

/* ---- E6. Plakietki klas CoA i priorytetów – tinty ---- */
.admin-body :is(.inv-coa, .sg-prio) {
    display: inline-flex; align-items: center; justify-content: center; min-width: 22px; min-height: 22px; padding: 0 var(--sp-2);
    font-size: var(--fs-xs); font-weight: 600; line-height: 1; border-radius: var(--r-sm); border: 0; white-space: nowrap;
}
.admin-body .inv-coa-3, .admin-body .sg-prio-1, .admin-body .sg-prio-2 { background: var(--err-bg); color: var(--err-fg); box-shadow: inset 0 0 0 1px var(--err-line); }
.admin-body .inv-coa-2, .admin-body .sg-prio-3 { background: var(--warn-bg); color: var(--warn-fg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.admin-body .inv-coa-1 { background: var(--ok-bg); color: var(--ok-fg); box-shadow: inset 0 0 0 1px var(--ok-line); }
.admin-body .sg-prio-4 { background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }

/* ---- E7. Akcje w wierszach list (projekty, pulpit): Otwórz · podgląd ↗ · PDF · Usuń w stałych slotach ---- */
.admin-body .pl-actions .pl-side, .admin-body .pl-actions .pl-del { font-size: var(--fs-sm); font-weight: 600; }
.admin-body .pl-actions a.pl-side { min-height: var(--ctl-h-sm); padding: 0 var(--sp-1); color: var(--brand-dark); }
.admin-body .card .pl-actions .pl-del { min-height: var(--ctl-h-sm); padding: 0 var(--sp-1); margin: 0; background: none; border: 0; color: var(--err-fg); }
.admin-body .card .pl-actions .pl-del:hover { background: none; text-decoration: underline; text-underline-offset: 2px; }
@media (min-width: 761px) {
    .admin-body :is(.pl-table, .db-table) td.pl-actions { white-space: nowrap; text-align: right; }
    .admin-body :is(.pl-table, .db-table) td.pl-actions > * { display: inline-flex; vertical-align: middle; justify-content: flex-start; box-sizing: border-box; }
    .admin-body :is(.pl-table, .db-table) td.pl-actions > :nth-child(2) { width: 104px; margin-left: var(--sp-2); }
    .admin-body :is(.pl-table, .db-table) td.pl-actions > :nth-child(3) { width: 48px; margin-left: var(--sp-2); }
    .admin-body :is(.pl-table, .db-table) td.pl-actions > :nth-child(4) { width: 56px; margin-left: var(--sp-2); }
    .admin-body .db-table td.pl-actions > :nth-child(n+3) { display: none; }
}

/* ---- E21. Karty list bez linii pod nagłówkiem; wyłączony przycisk główny (W4) ---- */
.admin-body :is(.pl-head, .db-card-head) { border-bottom: 0; padding-bottom: 0; margin-bottom: var(--sp-4); }
.admin-body .card button:where(:not([class]), [class=""], .btn-primary, .meta-submit):disabled,
.admin-body :is(a, button).btn-primary:disabled, .admin-body .card.jb-actions .jb-publish:disabled {
    opacity: 1; background: var(--surface-2); color: var(--text-4); box-shadow: inset 0 0 0 1px var(--line); border-color: var(--line);
}

/* ---- E10. Krok wyłączony w pasku projektu ---- */
.admin-body .pd-steps li.is-off a { background: var(--surface-2); border: 1px dashed var(--line-strong); }
.admin-body .pd-steps li.is-off b { background: var(--surface); color: var(--text-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.admin-body .pd-steps li.is-off span:not(.sr-only), .admin-body .pd-steps li.is-off small { color: var(--text-3); }

/* ---- E14. Karta zwijana: tytuł w summary bez nagłówka ---- */
details.pd-opt > summary .pd-opt-t { font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; color: var(--brand-dark); }
details.pd-opt > summary:hover .pd-opt-t { text-decoration: underline; text-underline-offset: 3px; }
details.pd-opt > summary > .card-lead { margin: 0; width: auto; flex: 1 1 240px; }

/* ---- E13. Tytuły kart jako h3 (grupy = h2, podtytuły = h4.st-subhead) ---- */
.admin-body .card > h3:not(.st-subhead, .smtp-sub, .af-sub) { font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; margin: 0 0 12px; color: var(--brand-dark); }
.admin-body .card h4.smtp-sub { margin: 0 0 var(--sp-2); font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.admin-body .pd-page .pd-muted-card > :is(h2, h3) { margin: 0; font-size: var(--fs-md); font-weight: 600; }

/* ---- E16. Karty jednowierszowe i bloki zagnieżdżone ---- */
.admin-body .pd-page .pd-muted-card { padding: var(--sp-4) var(--card-pad); }
.admin-body .pd-page :is(.pd-manual, .q-edit), .admin-body .card details.st-fold, .admin-body .pd-page .m3-more {
    padding: var(--sp-1) var(--sp-4); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md);
}
.admin-body .pd-page :is(.pd-manual, .q-edit)[open], .admin-body .card details.st-fold[open], .admin-body .pd-page .m3-more[open] { padding-bottom: var(--sp-4); }
.admin-body .pd-page .m3-more { margin-top: var(--sp-4); }
.admin-body .card details.st-fold > summary { min-height: var(--ctl-h); display: flex; align-items: center; }
.admin-body .m3-form .m3-range-fs { border-left: 1px solid var(--line); }
.admin-body .m3-grid .file-row { grid-template-columns: minmax(0, 1fr) minmax(0, 240px); }

/* ---- E18. Podsumowanie danych badania ---- */
.admin-body dl.st-kv.pd-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-5); margin: 0 0 var(--sp-4); }
.admin-body dl.pd-sum > div { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; }
.admin-body dl.pd-sum dt { font-size: var(--fs-xs); color: var(--text-3); }
.admin-body dl.pd-sum dd { font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.admin-body dl.pd-sum .pd-sum-sub { font-weight: 400; color: var(--text-3); }
@media (max-width: 1099px) { .admin-body dl.st-kv.pd-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .admin-body dl.st-kv.pd-sum { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); } }
.admin-body .pd-page .pd-meta-edit .pd-meta-form { margin-top: var(--sp-2); }

/* ---- E12. Przełącznik zapisujący od razu – wiersz z podpisem ---- */
.st-switch-row-t > .field-hint { display: block; margin-top: 2px; font-size: var(--fs-xs); font-weight: 400; color: var(--text-3); }
.admin-body .card form.st-switch-row { margin: 0; }
.admin-body .card form.st-switch-row .st-switch { margin: 0; }
.admin-body .tile-row > .card > form.st-switch-row:last-child { flex: 0 0 auto; margin-top: 0; }
.st-saves-now { white-space: nowrap; }
/* zwykłe pole wyboru w tabeli zdarzeń (zapis przyciskiem „Zapisz”) */
.pw-check { display: inline-flex; align-items: center; min-height: 28px; cursor: pointer; }
.pw-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand-dark); }
.pw-check .pw-yn { display: none; }

/* ---- E17. Ustawienia ---- */
.st-navrow.st-navrow-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.admin-body .st-page .card .st-note-line { margin: 0; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.admin-body .st-page .card-head + .card-lead + .st-note-line { margin-top: calc(-1 * var(--sp-2)); }
@media (min-width: 761px) {
    .admin-body .st-page .pw-adm :is(th, td) { padding: var(--sp-2) var(--sp-3); }
    .admin-body .st-page .pw-adm tr.pw-grp th { padding-top: var(--sp-3); }
    .admin-body .st-page .pw-adm .pw-desc { margin-top: 1px; font-size: var(--fs-xs); line-height: 1.35; }
    .admin-body .st-page .pw-adm .pw-who { font-size: var(--fs-xs); line-height: 1.35; }
    .admin-body .card .pw-adm td.pw-def select { min-height: var(--ctl-h-sm); }
}
.admin-body .st-page #kopie .card-lead { margin-top: var(--sp-2); }
.admin-body section.card[tabindex="-1"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: var(--r-lg); }
.admin-body section.card[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

/* ---- E19. Wydania raportu ---- */
.admin-body .pl-badge.ed-head-no { background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
.admin-body .card .st-note.ed-state { margin: 0; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.admin-body .pd-page .card-foot.ed-actions { margin-top: var(--sp-4); }
.admin-body .pd-page details.ed-more { margin: var(--sp-3) 0 0; }
.admin-body .pd-page details.ed-more > summary { display: flex; align-items: center; min-height: 32px; padding: 0; font-size: var(--fs-md); }
.admin-body .ed-list a { display: inline-flex; align-items: center; min-height: 24px; }

/* ---- E20. Ostrzeżenia w jednej ramce z listą ---- */
.admin-body .st-warn.st-warn-list { width: 100%; box-sizing: border-box; margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); color: var(--warn-fg); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--r-md); }
.st-warn-list p { margin: 0 0 var(--sp-1); }
.st-warn-list ul { margin: 0; padding-left: 18px; }
.st-warn-list li + li { margin-top: 2px; }

/* ---- Panel projektu: drobne dopasowania po zmianach E ---- */
.admin-body .pd-page .card > .card-foot:last-child { margin-top: var(--sp-4); }
/* ---- Panel projektu: krótsza strona (E18 – odbiór: wysokość strony PV i początek tabeli anomalii) ---- */
/* karty opcjonalne zwinięte stoją parami; rozwinięta zajmuje całą szerokość */
.project-cards > .pd-opt-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--card-gap); align-items: stretch; }
.pd-opt-grid > details.pd-opt { margin: 0; }
.pd-opt-grid > details.pd-opt[open] { grid-column: 1 / -1; }
@media (max-width: 1099px) { .project-cards > .pd-opt-grid { grid-template-columns: minmax(0, 1fr); } }
/* kamera z rejestru: podpis i wybór w jednym wierszu */
.admin-body .pd-page .pd-cam-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line-soft); }
.admin-body .pd-page .pd-cam-row > h4.st-subhead { margin: 0; flex: 0 1 auto; }
.admin-body .pd-page .pd-cam-row > .pd-cam-form { flex: 1 1 420px; }
.admin-body .pd-page .pd-cam-row + .st-warn { margin: var(--sp-3) 0 0; }
.admin-body .pd-head-links { gap: var(--sp-1) var(--sp-3); }
.admin-body .pd-head-links .btn-link { font-size: var(--fs-sm); font-weight: 600; }
/* tabela anomalii: wiersz 40 px */
@media (min-width: 761px) { .admin-body .pd-page table.pd-anom td { padding-top: var(--sp-1); padding-bottom: var(--sp-1); } }
/* przełącznik w wierszu: nazwa i przełącznik w jednej linii także w wąskim kafelku */
.admin-body .card form.st-switch-row, .admin-body .tile-row > .card > form.st-switch-row:last-child { flex-direction: row; flex-wrap: nowrap; align-items: center; }
.admin-body .card form.st-switch-row > .st-switch-row-t { flex: 1 1 auto; min-width: 0; }
.admin-body .card form.st-switch-row > .st-switch { flex: none; }
.project-cards .pd-opt-grid > details.pd-opt:not([open]) { grid-column: auto; }
/* Ustawienia – powiadomienia zespołu: harmonogram zwinięty, „Kto dostaje” i „Dziennik” obok siebie */
.admin-body .st-page details.pw-sched-fold { margin: var(--sp-4) 0 0; }
.admin-body .st-page details.pw-sched-fold[open] > summary { margin-bottom: var(--sp-2); }
.admin-body .st-page details.pw-sched-fold .pw-sched { border-top: 0; }
.admin-body .st-page details.pw-sched-fold .pw-sched fieldset:last-child { border-bottom: 0; }
.pw-more-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-5); margin-top: var(--sp-3); border-top: 1px solid var(--line-soft); }
.pw-more-row > details.pw-more { margin: 0; padding: var(--sp-2) 0 0; border: 0; }
.pw-more-row > details.pw-more[open] { grid-column: 1 / -1; }
@media (max-width: 760px) { .pw-more-row { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 761px) {
    .admin-body .st-page .pw-adm tr.pw-grp th { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
    .admin-body .card .pw-adm td.pw-def { width: 280px; }
    .admin-body .st-page .st-row { min-height: 48px; padding: var(--sp-2) 0; }
}
/* nagłówek projektu: typ i stan w jednym wierszu z klientem, datą i kodem */
.admin-body .pd-hero .pd-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-top: var(--sp-2); }
.admin-body .pd-hero .pd-sub > .pd-tags { margin: 0; gap: var(--sp-2) var(--sp-3); }
.admin-body .pd-hero .pd-sub > .pd-tags::after { content: ""; width: 1px; height: 16px; background: var(--line); }
.admin-body .pd-hero .pd-sub > .pd-meta { margin: 0; }
.pd-opt-grid > details.pd-opt > summary { min-height: 56px; }
.admin-body .pd-page .pd-cam-row { margin-top: var(--sp-3); padding-top: var(--sp-3); }
@media (min-width: 761px) {
    .admin-body :is(.pl-table, .db-table) td.pl-actions { font-size: 0; }   /* odstępy tylko z marginesów slotów – bez spacji między elementami */
    .admin-body :is(.pl-table, .db-table) td.pl-actions > * { font-size: var(--fs-sm); margin-top: 0; margin-bottom: 0; }
}
.admin-body .card:has(> .card-lead + details.sg-help) > .card-lead { padding-right: 36px; box-sizing: border-box; }
@media (max-width: 760px) {
    .admin-body .pd-hero .pd-sub > .pd-tags::after { content: none; }
    .admin-body .card:has(> .card-lead + details.sg-help) > .card-lead { padding-right: 44px; }
}
/* karty opcjonalne w siatce: tytuł i znaczek w pierwszym wierszu, opis pod tytułem */
.pd-opt-grid > details.pd-opt > summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--sp-3); row-gap: 2px; align-items: center; }
.pd-opt-grid > details.pd-opt > summary::before { grid-column: 1; grid-row: 1; }
.pd-opt-grid > details.pd-opt > summary > .pd-opt-t { grid-column: 2; grid-row: 1; }
.pd-opt-grid > details.pd-opt > summary > .card-lead { grid-column: 2 / 4; grid-row: 2; }
.pd-opt-grid > details.pd-opt > summary > :is(.pd-opt-add, .cc-count, .pl-badge) { grid-column: 3; grid-row: 1; margin-left: 0; justify-self: end; }
.admin-body .pd-hero .pd-layers span { display: inline-flex; align-items: center; gap: 2px; }
.admin-body .st-page #kamery .pd-empty { margin: 0 0 var(--sp-3); padding: var(--sp-3) var(--sp-4); text-align: left; font-size: var(--fs-sm); }
/* ===== R2-E – koniec ===== */

/* ===== R2-F: strony poboczne ===== */
/* Spis (szczegóły w KOMPONENTY.md, sekcja „R2-F”):
     F1. akcja strony w .page-head (np. „+ Nowy …” rozwijający formularz), licznik w h1
     F3/F4. listy: klienci, kody dostępu, użytkownicy – linki w wierszach, przełącznik przypomnień
     F5. listy wyboru i formularz użytkownika (wiersze opcji 18 px, stopka bez przyklejenia)
     F6. kalendarz i profil klienta w kalendarzu
     F7–F16 – kalibracja, porównanie, badania, Wygląd, profil, rozliczenia, dokumenty, e-maile, teren */

/* ---- F1. Akcja strony i licznik w nagłówku strony ---- */
.admin-body .page-head h1 :is(.pl-total, .cc-count) { margin: 0; background: var(--surface); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
.admin-body .page-head-actions .pl-new-btn[aria-expanded="true"] { background: var(--surface); color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--line-strong); }
.admin-body .page-head-actions .pl-new-btn[aria-expanded="true"]:hover { background: var(--surface-2); }
.admin-body .page-head .us-lead { margin: 6px 0 0; max-width: 72ch; font-size: var(--fs-sm); color: var(--text-3); }
.admin-body .page-head + .sub-nav { margin-top: calc(-1 * var(--sp-1)); }

/* ---- F3/F4. Klienci i kody dostępu ---- */
.admin-body .card .c-email-form input { min-height: 32px; padding: 0 var(--sp-2); font-size: var(--fs-sm); }
@media (min-width: 761px) { .admin-body .card .c-email-form input { width: 240px; } }
.admin-body .card .c-email-form input::placeholder { font-style: normal; }
.admin-body .c-rem-form { margin-top: var(--sp-2); }
.admin-body .c-rem-switch { margin: 0; gap: var(--sp-2); align-items: flex-start; font-weight: 400; }
.admin-body .c-rem-switch .st-switch-ui { width: 32px; height: 18px; margin-top: 1px; }
.admin-body .c-rem-switch .st-switch-ui::after { left: 2px; top: 2px; width: 14px; height: 14px; }
.admin-body .c-rem-switch input:checked + .st-switch-ui::after { transform: translateX(14px); }
.c-rem-t { display: flex; flex-direction: column; font-size: var(--fs-sm); line-height: 1.35; color: var(--text-2); }
.c-rem-t .field-hint { font-size: var(--fs-xs); }
.admin-body .card :is(.c-link, .c-del) { font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.admin-body .card .c-link { color: var(--brand-dark); }
.admin-body .c-code > * { vertical-align: middle; }
.admin-body .c-code .c-inline { margin-left: var(--sp-1); }
.admin-body .c-actions { text-align: right; }
.admin-body .c-actions .c-inline + .c-inline { margin-left: var(--sp-2); }
.admin-body .ac-actions { white-space: nowrap; }
.admin-body .ac-actions > * { vertical-align: middle; }
.admin-body .ac-actions .c-inline { margin-left: var(--sp-2); }

/* ---- F5. Listy wyboru (kody dostępu) i formularz użytkownika ---- */
.admin-body .ac-form-card .scope-box { padding: var(--sp-4); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.admin-body .ac-form-card .scope-box h3 { margin: 0 0 2px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.admin-body .ac-form-card .scope-box > .hint { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); }
.admin-body .ac-form-card .ac-filter { min-height: 32px; margin: 0 0 var(--sp-2); background: var(--surface); }
.admin-body .ac-form-card .scope-list { margin-top: 0; }
.admin-body .ac-form-card label.scope-item { min-height: var(--ctl-h-sm); padding: var(--sp-1) 0; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-md); border-bottom: 1px solid var(--line-soft); }
.admin-body .ac-form-card label.scope-item:hover { background: none; }
.admin-body .ac-form-card label.scope-item input { width: 18px; height: 18px; margin-top: 1px; }
.admin-body .ac-form-card label.demo-toggle { padding: var(--sp-1) 0; font-size: var(--fs-md); font-weight: 400; color: var(--ink); align-self: end; }
.admin-body .ac-form-card .card-foot { margin-top: var(--sp-2); }
@media (max-width: 760px) { .admin-body .ac-form-card label.scope-item { min-height: var(--ctl-h-touch); align-items: center; } }
/* formularz użytkownika: zapis w stopce ostatniej karty (bez przyklejonego paska) */
.admin-body .us-savebar.card-foot { position: static; z-index: auto; padding: var(--sp-3) 0 0; margin-top: var(--sp-5); background: none; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; box-shadow: none; gap: var(--sp-2); }
.admin-body .us-layout .us-extra { grid-row: 2; }
.admin-body .us-layout .us-aside { grid-row: 1 / span 2; }
.admin-body .us-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 var(--sp-4); }
.admin-body .us-type { min-height: var(--ctl-h-sm); padding: var(--sp-1) 0; gap: var(--sp-2); border: 0; border-radius: 0; background: none; font-size: var(--fs-md); font-weight: 400; }
.admin-body .us-type:has(input:checked) { background: none; }
.admin-body .us-type input, .admin-body .us-perm input { width: 18px; height: 18px; accent-color: var(--brand-fill); }
.admin-body .us-perm { padding: var(--sp-2) 0; gap: 2px var(--sp-2); grid-template-columns: 18px minmax(0, 1fr); }
.admin-body .us-perm:hover { background: none; }
.admin-body .us-fs:not(.us-group) > legend { font-size: var(--fs-lg); font-weight: 600; }
.admin-body .us-group > legend { font-size: var(--fs-xs); font-weight: 600; }
.admin-body .card.us-pv > h3 { margin: var(--sp-4) 0 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.admin-body .page-head .cc-meta a { color: var(--brand-dark); font-weight: 500; }
.admin-body .us-fs-desc { font-size: var(--fs-sm); }
.admin-body .us-act.action-link { padding: 2px 10px; }
.admin-body .us-role-platform { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 760px) {
    .admin-body .us-type { min-height: var(--ctl-h-touch); }
    .admin-body .us-savebar.card-foot { margin-left: 0; margin-right: 0; }
    .admin-body .us-savebar.card-foot .us-save { flex: 0 1 auto; }
}
.admin-body .lk-row { display: flex; align-items: flex-end; gap: var(--sp-2); margin: 0 0 var(--sp-3); }
.admin-body .lk-row .field { flex: 1 1 auto; }

/* ---- F6. Kalendarz ---- */
.admin-body .cal-kpi { padding: var(--sp-3) var(--sp-4); border-color: var(--line); border-radius: var(--r-lg); box-shadow: none; }
.admin-body .cal-kpi b { font-size: var(--fs-2xl); font-weight: 700; color: var(--ink); }
.admin-body .cal-kpi span { font-size: var(--fs-sm); color: var(--text-3); }
.admin-body .cal-kpi-alert { background: var(--err-bg); border-color: var(--err-line); }
.admin-body .cal-kpi-alert b { color: var(--err-fg); }
.admin-body .cal-month-empty { margin: 0 0 var(--sp-3); }
.cal-up-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-1); margin: -2px 0 var(--sp-2) 58px; font-size: var(--fs-xs); color: var(--text-4); }
.admin-body .cal-up-links .cal-up-link { min-height: 24px; padding: 0 2px; font-size: var(--fs-xs); font-weight: 600; }
.admin-body .cal-side-title { border-bottom: 0; padding-bottom: 0; margin-bottom: var(--sp-3); }
.admin-body .cal-form .card-foot { margin-top: var(--sp-2); }
.admin-body .cc-hero { padding: var(--card-pad); }
.admin-body .cc-stats { margin-top: 0; }
.admin-body .cc-stat-label { font-size: var(--fs-xs); }
.admin-body .cc-stat b { font-size: var(--fs-xl); font-weight: 700; }
.admin-body .page-head .cc-meta { margin-top: 6px; }
.admin-body .page-head .cc-add-btn { margin-left: 0; }
.admin-body .cc-add-form .card-foot { grid-column: 1 / -1; }
/* ---- F2/F13. Strony Ustawień: Wygląd, Treść e-maili, Rozliczenia, Dokumenty, Akceptacje ---- */
.admin-body .page-head + details.sg-help { margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); }
.admin-body .card form.bm-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); align-items: start; }
.admin-body .card form.bm-form > :is(.bm-wide, .card-foot) { grid-column: 1 / -1; }
.admin-body .card form.bm-form > .card-foot { margin-top: var(--sp-1); }
.admin-body .card form:is(.bm-form-col, .prof-form-col, .lg-export-form, .bm-apply) { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: var(--sp-3); }
.admin-body .card form:is(.bm-form-col, .prof-form-col) > .card-foot { margin-top: var(--sp-1); }
.admin-body .tile-row > .card > form:is(.bm-form, .bm-form-col, .prof-form-col):last-child > .card-foot { margin-top: auto; }
.admin-body .card .bm-kind { margin: 0; }
.admin-body .card .bm-kind legend { margin-bottom: 2px; }
.admin-body .card dl.st-kv.bm-kv { margin: 0 0 var(--sp-3); }
.admin-body .bm-kv dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); }
.admin-body .bm-kv .c-inline { display: inline-flex; }
.bm-muted { color: var(--text-3); }
.admin-body .bm-select { max-width: 320px; }
.admin-body .bm-preview { margin: var(--sp-4) 0 0; padding: var(--sp-4); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.admin-body .bm-preview > h3.st-subhead:first-child { margin-top: 0; }
.bm-prev-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-4); }
.bm-prev-row .bm-prev { flex: 1 1 320px; margin: 0; }
.bm-cover-img { width: 100%; max-width: 420px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.bm-why { margin: 0 0 var(--sp-3); padding-left: 18px; font-size: var(--fs-sm); }
.admin-body .card details.bm-fold { margin: var(--sp-3) 0 0; padding: var(--sp-1) var(--sp-4); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.admin-body .card details.bm-fold[open] { padding-bottom: var(--sp-4); }
.admin-body .card details.bm-fold > summary { display: flex; align-items: center; min-height: var(--ctl-h); font-size: var(--fs-md); }
.bm-contrast { list-style: none; margin: var(--sp-2) 0 0; padding: 0; font-size: var(--fs-sm); }
.bm-contrast li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--sp-3); align-items: center; padding: var(--sp-1) 0; border-top: 1px solid var(--line-soft); }
.bm-contrast li:first-child { border-top: 0; }
.bm-hist { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.bm-hist li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-1) var(--sp-3); padding: var(--sp-2) 0; border-top: 1px solid var(--line-soft); }
.bm-hist li:first-child { border-top: 0; padding-top: 0; }
.bm-hist time { font-variant-numeric: tabular-nums; color: var(--text-3); }
.admin-body .tile-row.st-tiles-3 > .st-navcard { min-width: min(100%, 260px); }
.admin-body .em-list li { align-items: center; min-height: 44px; padding: var(--sp-2) 0; }
.admin-body .em-list .em-link { display: inline-flex; align-items: center; min-height: 24px; font-weight: 600; color: var(--brand-dark); text-decoration: none; }
.admin-body .em-list .em-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.em-state { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.admin-body .card .em-btns.card-foot { margin-top: var(--sp-2); }
.admin-body .em-hist form { margin-left: var(--sp-1); }
.admin-body .rz-navrow { margin: 0 0 var(--card-gap); }
.admin-body .card .rz-filter { display: flex; align-items: flex-end; }
.admin-body .card .rz-filter button { min-height: var(--ctl-h); padding: 4px 14px; font-size: var(--fs-md); font-weight: 600; background: var(--surface); color: var(--brand-dark); border: 1px solid var(--line-strong); border-radius: var(--r-md); }
.admin-body .card .rz-filter button:hover { background: var(--surface-2); }
.admin-body .rz-filter .rz-xlsx { align-self: center; min-height: var(--ctl-h); font-weight: 600; }
.admin-body .card.db-fin + .card, .admin-body .rz-navrow + .card { margin-top: 0; }
.admin-body .lg-exports a { display: inline-flex; align-items: center; min-height: 24px; }
.admin-body .lg-list a { display: inline-flex; align-items: center; min-height: 24px; }
.admin-body .appr-table td.actions-cell { text-align: right; }
.admin-body .appr-table td { vertical-align: middle; }
.admin-body .card-foot.appr-links { margin-top: var(--sp-3); }

/* ---- F12. Mój profil ---- */
.admin-body .prof-page .tile-row > .card > .card-lead + .sig-preview { margin-top: 0; }
.admin-body .prof-page .sig-preview { margin: 0 0 var(--sp-3); }
.admin-body .prof-page .file-row small { line-height: 1.4; }
.admin-body .prof-empty { margin: 0 0 var(--sp-3); text-align: left; }
.admin-body .card .q-edit .pd-form-actions, .admin-body .card .q-add .pd-form-actions { width: 100%; display: flex; gap: var(--sp-2); margin-top: var(--sp-2); }
.admin-body .card .pw-actions.card-foot { margin-top: var(--sp-4); }
/* przełącznik segmentowy (częstotliwość powiadomień, widok kalibracji): tor szary, wybrany biały z cieniem – bez wypełnienia */
.admin-body .pw-seg { border: 0; background: var(--surface-2); border-radius: var(--r-md); padding: 2px; box-shadow: inset 0 0 0 1px var(--line); }
.admin-body .pw-seg span { min-height: 30px; border-radius: var(--r-sm); }
.admin-body .pw-seg input:checked + span, .admin-body .pw-seg input[value="off"]:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .12), inset 0 0 0 1px var(--line); }
.admin-body .pw-seg label:hover input:not(:checked) + span { background: transparent; color: var(--ink); }

/* ---- F6 (ciąg dalszy). Kalibracja – przełącznik widoku jako segment ---- */
.calib-seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-2); border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line); }
.admin-body .calib-view-group { margin-right: var(--sp-2); color: var(--text-2); font-size: var(--fs-sm); }
.admin-body .card .calib-seg .calib-view-btn, .admin-body .card .calib-seg .calib-view-btn:not(.active) { min-height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); background: transparent; border: 0; border-radius: var(--r-sm); box-shadow: none; }
.admin-body .card .calib-seg .calib-view-btn.active { background: var(--surface); color: var(--ink); font-weight: 600; border: 0; box-shadow: 0 1px 2px rgba(16, 24, 40, .12), inset 0 0 0 1px var(--line); }
.admin-body .card .calib-seg .calib-view-btn:hover:not(.active) { color: var(--ink); background: transparent; }
.admin-body .calib-toolbar { gap: var(--sp-2); }
.admin-body .card .calib-toolbar #calib-reset { margin-left: auto; }

/* ---- F8. Porównanie ---- */
.admin-body .cmp-base-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); width: 100%; margin: var(--sp-2) 0 0; }
.admin-body .cmp-base-form > .btn-danger { margin-left: auto; }
.admin-body .cmp-base-form .field { min-width: min(100%, 320px); }
.admin-body details.cmp-details > summary { display: inline-flex; align-items: center; min-height: var(--ctl-h); padding: 0 var(--sp-1); font-size: var(--fs-md); font-weight: 600; color: var(--brand-dark); }
.admin-body details.cmp-details > summary:hover { text-decoration: underline; text-underline-offset: 2px; }
.admin-body details.cmp-change { flex: 1 1 100%; }
.cmp-change-body, .admin-body details.cmp-details[open] > label { margin-top: var(--sp-2); }
.cmp-change-body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); }
.admin-body details.cmp-details[open] { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); width: 100%; }
.admin-body details.cmp-details[open] > summary { flex: 1 1 100%; }
@media (min-width: 761px) { .admin-body .cmp-kv.projects-table :is(th, td) { height: 44px; } }

/* ---- F9/F10. Instrukcje i konwerter ---- */
.admin-body .card .st-note.cv-note { margin: 0 0 var(--sp-4); padding: var(--sp-2) var(--sp-3); max-width: none; font-size: var(--fs-sm); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.admin-body .card details.cv-guide { margin: var(--sp-4) 0 0; padding: var(--sp-1) var(--sp-4); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.admin-body .card details.cv-guide[open] { padding-bottom: var(--sp-3); }
.admin-body .card details.cv-guide > summary { display: flex; align-items: center; min-height: var(--ctl-h); }
.admin-body .card form.cv-form { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 0; }
.admin-body .cv-off { margin: 0 0 var(--sp-4); }
.admin-body .callout { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); color: var(--ink); }

/* ---- F14. Badania rozdzielnic, budynku, stacji falownikowych ---- */
.admin-body details.jl-new > summary { display: flex; align-items: center; gap: 0; min-height: 32px; }
.admin-body details.jl-new > summary::before {
    content: "" / ""; display: inline-block; flex: none; box-sizing: border-box; width: 8px; height: 8px; margin: 0 var(--sp-2) 0 2px;
    border: solid var(--text-3); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(-45deg); transition: transform .15s ease;
}
.admin-body details.jl-new[open] > summary::before { transform: translateY(-3px) rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .admin-body details.jl-new > summary::before { transition: none; } }
.jl-new-t { font-size: var(--fs-lg); font-weight: 600; color: var(--brand-dark); }
.admin-body details.jl-new[open] > summary { margin-bottom: var(--sp-3); }
.admin-body .card.jl-new form.upload-form { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: var(--sp-2); }
.admin-body .card.jl-new .ij-title { max-width: 480px; }
.admin-body .card.jl-new .sg-ai-opts { margin: var(--sp-2) 0 0; }
.admin-body .card.jl-new .sg-ai-opts > .hint { margin: var(--sp-1) 0 0; }
.admin-body .jl-actions { gap: var(--sp-2); }
.admin-body .jl-actions .action-link { min-height: var(--ctl-h-sm); padding: 2px 10px; font-size: var(--fs-sm); }
.admin-body .jl-live.pl-badge { font-size: var(--fs-xs); padding: 0 var(--sp-2); border-radius: var(--r-sm); }
.admin-body .card.jb-actions { padding: var(--sp-3) var(--card-pad); gap: var(--sp-2); }
.admin-body .card.jb-actions button { min-height: var(--ctl-h); padding: 4px 14px; font-size: var(--fs-md); border-radius: var(--r-md); }
.admin-body .card.jb-actions .jb-save { background: var(--surface); color: var(--brand-dark); border: 1px solid var(--line-strong); }
.admin-body .card.jb-actions .jb-save:hover:not(:disabled) { background: var(--surface-2); }
.admin-body .card.jb-actions .jb-publish { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border: 0; }
.admin-body .card.jb-actions .jb-publish:hover:not(:disabled) { background: color-mix(in srgb, var(--btn-primary-bg) 90%, black); }
.admin-body .card.jb-actions .jb-regen { min-height: var(--ctl-h); font-size: var(--fs-sm); color: var(--text-2); }
.admin-body .card.jb-actions > .st-warn-list { flex: 1 1 100%; margin: var(--sp-1) 0 0; }
.admin-body .card.jb-actions > p.hint { flex: 1 1 100%; margin: 0; }
.admin-body .card.jb-actions > .jb-pub-bl { text-align: right; max-width: none; }
.admin-body .card .jb-prio-legend { max-width: none; }
.admin-body .pl-badge.jb-ok { min-height: 20px; padding: 0 6px; font-size: var(--fs-xs); font-weight: 600; }
.admin-body .sg-prio-obs { background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
.admin-body .inv-zones :is(th, td).rz-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin-body .inv-zones .jb-tlink { display: inline-flex; align-items: center; min-height: 24px; padding-block: 2px; }
.admin-body .card > h2 + .jb-prio-legend { margin: calc(-1 * var(--sp-2)) 0 var(--sp-3); }
.admin-body .sg-meta-groups { width: 100%; }
.admin-body .sg-meta-groups .pd-fs > .sg-wide { grid-column: 1 / -1; }
.admin-body .sg-meta-groups .field :is(input, select, textarea) { width: 100%; font-weight: 400; }
.admin-body .jb-hero .pd-meta a, .admin-body .jb-check a { display: inline-flex; align-items: center; min-height: 24px; }
.admin-body .jb-delete { margin: var(--sp-4) 0 0; }

/* ---- F15. Wyniki z terenu – na komputerze wygląd kart panelu (telefon bez zmian) ---- */
@media (min-width: 761px) {
    .admin-body .tr-wrap { padding-top: var(--sp-5); }
    .admin-body .tr-wrap > h1 { margin: var(--sp-2) 0 var(--sp-2); font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; color: var(--ink); }
    .admin-body .tr-wrap .tr-card { padding: var(--card-pad); margin: var(--card-gap) 0; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
    .admin-body .tr-wrap .tr-card :is(h2, h3) { color: var(--brand-dark); font-weight: 600; }
    .admin-body .tr-wrap .tr-grid label, .admin-body .tr-wrap .tr-wide { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
    .admin-body .tr-wrap :is(input, select, textarea) { min-height: var(--ctl-h); font-size: var(--fs-md); border-color: var(--line-strong); }
    .admin-body .tr-wrap .tr-nav a { min-height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-pill); }
    .admin-body .tr-wrap .tr-bar { border-bottom-color: var(--line); }
}

/* ---- F16. Cele ≥ 24 px ---- */
.admin-body a.db-up-client { display: inline-block; min-height: 24px; line-height: 24px; max-width: 100%; vertical-align: middle; }
.admin-body .bm-kv > div { grid-template-columns: minmax(110px, 220px) minmax(0, 1fr); align-items: center; }
.admin-body .bm-kv dd .bm-muted { font-weight: 400; }
@media (min-width: 1100px) { .admin-body .bm-page .tile-row.st-tiles-3 > * { flex: 1 1 calc(33.333% - 11px); min-width: 0; } }
.admin-body .card-foot > .btn-danger:only-child { margin-left: 0; }
.admin-body .card > .jl-list { margin: 0; padding: 0; }
.admin-body .card > .jl-list > .jl-item:first-child { padding-top: 0; }
.admin-body .card > .jl-list > .jl-item:last-child { padding-bottom: 0; }
.admin-body .jl-title .jl-time { margin-left: 6px; }
.admin-body .card form.lg-export-form > .card-foot { margin-top: 0; }.admin-body .cmp-kv.projects-table tbody th { text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); background: none; }
/* odnośnik „przejdź do …” w karcie (karta ma position:relative) – niewidoczny do czasu fokusu */
.admin-body .card .skip-link:not(:focus) { top: 0; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }.admin-body .card > :is(.steps-list, p.hint, ol, ul):last-child { margin-bottom: 0; }
@media (max-width: 760px) { .admin-body .card .c-email-form input { width: 100%; } }@media (max-width: 760px) {
    .admin-body .card.jb-actions > :is(p.hint, .st-warn-list) { grid-column: 1 / -1; order: 6; text-align: left; }
    .admin-body .card.jb-actions .jb-regen { order: 4; }
}/* pulpit: podtytuły „Zaległe” / „Najbliższe 60 dni” – kapitaliki 12 px (reguła tytułów kart h3 z R2-E ich nie dotyczy) */
.admin-body .card > h3.db-sub { margin: var(--sp-3) 0 2px; padding: 0 var(--sp-1); font-size: var(--fs-xs); font-weight: 700; line-height: 1.3; letter-spacing: .05em; color: var(--text-3); }
.admin-body .card > h3.db-sub:first-of-type { margin-top: var(--sp-2); }/* badanie stacji falownikowych: nagłówek strony z plakietkami i podsumowanie w osobnej karcie */
.admin-body .ij-head .ij-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-top: 6px; }
.admin-body .ij-head .ij-sub .pd-tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0; }
.admin-body .ij-head .ij-sub .pd-meta { margin: 0; font-size: var(--fs-sm); color: var(--text-3); }
.admin-body .card.ij-stats-card .jb-stats { margin: 0; }@media (max-width: 640px) {
    .admin-body .card form.bm-form { grid-template-columns: minmax(0, 1fr); }
    .admin-body .bm-kv > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}.admin-body .ins-downloads { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-4) 0 0; }
/* ===== R2-F – koniec ===== */
/* ===== R2-G: Model 3D i anomalie ===== */
/* Spis (szczegóły w KOMPONENTY.md, sekcja „R2-G”):
   G2 celownik pomiaru z klawiatury, G3 mini-legenda (telefon), G4 pomoc „O odczycie temperatur”, G5 wiersz różnicy
   Tmax − Tmin, G6 tryb raportu (sekcja raportu na górze panelu, przyklejona stopka „Pobierz raport PDF”, zanik listy ujęć),
   G1 przyciski ↑ ↓ × w pełnym kolorze, G10 segmenty CoA w rzędzie, G11 dopisek AI pod ΔT, G13 znacznik położenia
   i kontrolki Leaflet, G14 komunikat o kaflach, G15 komentarze klienta, G18 strona 10 na telefonie.
   Widok 3D nie ma .admin-body – reguły w .m3d-body / .m3d-panel. */

/* ---- G2. Celownik (scena z fokusem z klawiatury, narzędzie pomiaru albo warstwa IR) ---- */
.m3d-body .m3d-cel {
    display: none; position: absolute; left: 50%; top: 50%; z-index: 4; width: 24px; height: 24px; margin: -12px 0 0 -12px;
    pointer-events: none; filter: drop-shadow(0 0 1px rgba(0,0,0,.95));
}
.m3d-body .m3d-cel::before, .m3d-body .m3d-cel::after { content: ""; position: absolute; }
.m3d-body .m3d-cel::before { left: 11px; top: 0; width: 2px; height: 24px; background: linear-gradient(to bottom, var(--m3d-accent) 0 9px, transparent 9px 15px, var(--m3d-accent) 15px); }
.m3d-body .m3d-cel::after { top: 11px; left: 0; height: 2px; width: 24px; background: linear-gradient(to right, var(--m3d-accent) 0 9px, transparent 9px 15px, var(--m3d-accent) 15px); }
.m3d-body:is(.m3d-pm-on, .m3d-tryb-ir) #m3d-scene:focus-visible > .m3d-cel { display: block; }

/* ---- G3. Mini-legenda u dołu sceny: tylko telefon, warstwa IR, panel schowany ---- */
.m3d-body .m3d-minileg { display: none; }
@media (max-width: 760px) {
    .m3d-body.m3d-tryb-ir:has(.m3d-panel-zwiniety) .m3d-minileg {
        display: flex; align-items: center; gap: var(--sp-2); position: absolute; left: 50%; bottom: 12px; z-index: 5; transform: translateX(-50%);
        box-sizing: border-box; max-width: calc(100vw - 16px); padding: 6px var(--sp-3); background: var(--m3d-surface); color: var(--m3d-text);
        border: 1px solid var(--m3d-line-soft); border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; line-height: 1.2;
        font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.35);
    }
    .m3d-body .m3d-minileg-bar { flex: none; width: 160px; height: 8px; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
    .m3d-body .m3d-toolhint:not(:empty) ~ .m3d-minileg { bottom: 72px; }   /* nad paskiem podpowiedzi (do 2 linii) */
}

/* ---- G4/G5. Pomoc o odczycie, wiersz różnicy w wyniku obszaru ---- */
.m3d-panel .m3d-ir #m3d-najedz { margin-top: var(--sp-2); }
.m3d-panel .m3d-help-ir > .m3d-hint:first-of-type { margin-top: 4px; }
.m3d-panel .m3d-pm-t.m3d-pm-roz {
    align-items: baseline; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--m3d-line-soft);
    font-size: var(--fs-sm); font-weight: 500; color: var(--m3d-text-2);
}
.m3d-panel .m3d-pm-t.m3d-pm-roz > b { font-size: var(--fs-md); color: var(--m3d-text); }
.m3d-panel .m3d-pm-wynik > .m3d-hint:empty { display: none; }

/* ---- G6. Tryb raportu: sekcja raportu pierwsza (bez zmiany DOM), stopka z „Pobierz raport PDF” przyklejona ---- */
.m3d-body.m3d-raport .m3d-panel:not(.m3d-panel-zwiniety) { display: flex; flex-direction: column; }
.m3d-body.m3d-raport .m3d-panel > * { flex-shrink: 0; }
.m3d-body.m3d-raport .m3d-panel > #m3d-rap { order: -1; border-top: 0; }
.m3d-body.m3d-raport .m3d-panel > .m3d-sec:first-child { border-top: 1px solid var(--m3d-line-soft); }
.m3d-panel .m3d-btn-wide { display: flex; width: 100%; min-height: var(--ctl-h); margin: var(--sp-2) 0 0; }
.m3d-panel .m3d-rap-foot {
    position: sticky; bottom: 0; z-index: 1; margin: var(--sp-3) -16px calc(-1 * var(--sp-4)); padding: var(--sp-3) 16px;
    background: var(--m3d-surface); border-top: 1px solid var(--m3d-line-soft);
}
.m3d-panel .m3d-rap-foot:has(> [hidden]) { display: none; }
.m3d-panel .m3d-rap-foot #m3d-rap-pdf { margin: 0; text-decoration: none; }
.m3d-panel .m3d-rap-lista:has(> li:nth-child(4)) {
    max-height: 296px; overflow-y: auto; overscroll-behavior: contain; padding-bottom: var(--sp-5);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
}
/* G1. ↑ ↓ × czytelne (nie blade); wyłączony – jak wszystkie przyciski panelu */
.m3d-panel .m3d-rap-akcje .m3d-ico { color: var(--m3d-text); }
@media (max-width: 760px) { .m3d-panel .m3d-rap-akcje .m3d-ico { width: 36px; height: 36px; } }

/* ---- G10. Klasa CoA: od 641 px trzy w rzędzie (56 px, podpis do 2 linii), niżej jedna pod drugą (44 px) ---- */
@media (min-width: 641px) {
    .af-form-card .af-coa-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
    .admin-body .card .af-coa-pick .af-coa { min-height: 56px; padding: 6px var(--sp-2); gap: 6px; }
}
.af-coa-pick .af-coa > span:last-child { font-size: var(--fs-xs); line-height: 1.3; }
@media (min-width: 1100px) {
    .af-form-card :is(input, select, textarea, .af-coa) { scroll-margin-bottom: 80px; }
    .af-form-card .anomaly-form-buttons { padding-block: var(--sp-2); }
    .af-form-card .af-group { row-gap: var(--sp-2); }   /* okno 900 px: klasa CoA nad paskiem przycisków */
}

/* ---- G11. Dopisek pod ΔT wpisanym przez AI ---- */
.af-form-card .field-hint.af-ai-note { color: var(--warn-fg); font-weight: 600; }

/* ---- G13. Znacznik położenia anomalii (nowa i edycja), kontrolki mapy jak pasek narzędzi ---- */
.leaflet-marker-icon.af-loc-marker {
    display: grid; place-items: center; box-sizing: border-box; border: 3px solid var(--ink); border-radius: 50%;
    background: var(--surface); box-shadow: 0 0 0 2px var(--surface), 0 1px 6px rgba(0,0,0,.45);
}
.af-loc-marker > span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
/* znacznik przeciągany + etykieta temperatury w jego miejscu */
.leaflet-marker-icon.af-loc-marker.leaflet-marker-draggable { cursor: grab; }
.leaflet-marker-icon.af-loc-marker.leaflet-marker-draggable:active { cursor: grabbing; }
.leaflet-tooltip.af-loc-temp {
    padding: 2px 7px; border: 1px solid var(--ink); border-radius: var(--r-sm); background: var(--ink); color: #fff;
    font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: 0 1px 6px rgba(0,0,0,.35);
}
.leaflet-tooltip.af-loc-temp::before { border-top-color: var(--ink); }
.admin-body .card p.hint.af-drag-hint { margin: var(--sp-2) 0 0; }
.admin-body .leaflet-bar { border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: 0 1px 4px rgba(16,24,40,.12); }
.admin-body .leaflet-bar a { width: 36px; height: 36px; line-height: 36px; color: var(--ink); }
.admin-body .leaflet-bar a:first-child { border-top-left-radius: var(--r-md); border-top-right-radius: var(--r-md); }
.admin-body .leaflet-bar a:last-child { border-bottom-left-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.admin-body .leaflet-control-attribution { font-size: var(--fs-xs); color: var(--text-3); }
.admin-body .leaflet-control-attribution a { color: var(--text-2); }

/* ---- G14. Komunikat nad mapą, gdy żaden kafel ortomozaiki się nie wczytał ---- */
.admin-body p.af-tile-msg, .admin-body .card p.hint.af-tile-msg {
    max-width: none; margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3); background: var(--warn-bg); color: var(--warn-fg);
    border-radius: var(--r-md); font-size: var(--fs-sm);
}

/* ---- G15. Komentarze klienta: autor, data i „Usuń” w jednej linii ---- */
.admin-body .af-comment-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }
.admin-body .card .af-comment-meta .af-comment-del { display: inline-flex; margin: 0 0 0 var(--sp-2); }

/* ---- G18. Strona 10 (podgląd mapy) na telefonie: zamknięty panel anomalii nie poszerza strony ---- */
@media (max-width: 760px) {
    .viewer-body .anomaly-panel:not(.open) { display: none; }
}
/* ===== R2-G – koniec ===== */

/* ===== R3: raport klienta =====
   Raport online klienta (budynek, rozdzielnice): wyglad dokumentu/protokolu pomiarowego, nie panelu.
   Wszystkie selektory z prefiksem .sg-client-body (panel administratora bez zmian). Karty r 4 px bez cieni,
   tabele "normowe" (linie 2 px / 1 px), cyfry tabelaryczne, proza justowana od 768 px (tylko .sg-prose). */
.sg-client-body { --sg-line: #d5d9df; --sg-r: 4px; font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; font-kerning: normal; color: var(--ink); }
@media (min-width: 700px) { .sg-client-body { font-size: 16px; line-height: 1.6; } }
.sg-client-body #topbar { line-height: normal; }

/* -- karty i naglowki */
.sg-client-body .sg-card { border: 1px solid var(--sg-line); border-radius: var(--sg-r); box-shadow: none; padding: 24px 28px; margin: 0 0 24px; background: #fff; }
.sg-client-body .sg-card h2 { font-size: 18px; line-height: 1.3; font-weight: 600; color: var(--ink); margin: 0 0 16px; }
.sg-client-body .sg-card h3 { font-size: 15px; line-height: 1.35; font-weight: 600; color: var(--ink); margin: 24px 0 8px; }
.sg-client-body .sg-card p { margin: 0 0 12px; }
.sg-client-body .sg-card > :last-child, .sg-client-body .sg-card > .sg-download-text > :last-child { margin-bottom: 0; }
.sg-client-body .sg-h-count { display: inline; background: none; padding: 0; margin-left: 6px; border-radius: 0; font-size: 13px; font-weight: 400; color: var(--text-3); vertical-align: baseline; }
.sg-client-body .hint { font-size: 13px; line-height: 1.5; color: var(--text-2); }
.sg-client-body .sg-table-wrap { margin: 0 0 12px; }
.sg-client-body .sg-table-wrap:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sg-client-body .sg-card > .sg-table-wrap:last-child { margin-bottom: 0; }

/* -- proza: justowanie tylko akapitow .sg-prose, od 768 px; ponizej do lewej */
.sg-client-body .sg-prose { max-width: 78ch; line-height: 1.6; text-align: left; overflow-wrap: break-word; text-wrap: pretty; hyphens: manual; }
@media (min-width: 768px) {
    .sg-client-body .sg-prose { text-align: justify; text-align-last: left; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3; }
    /* akapit bezposrednio w karcie ma szerokosc tabel (wspolna krawedz prawa - uklad dokumentu) */
    .sg-client-body .sg-card > .sg-prose { max-width: none; line-height: 1.65; }
}

/* -- naglowek strony i metryczka */
.sg-client-body .sg-hero { padding: 32px 0 0; }
.sg-client-body .sg-kicker { font-size: 12px; font-weight: 600; letter-spacing: .08em; line-height: 1.4; margin: 0 0 8px; }
.sg-client-body .sg-hero h1 { font-size: 28px; line-height: 1.2; font-weight: 700; color: var(--brand-dark); margin: 0; text-wrap: balance; }
.sg-client-body .sg-hero-addr { font-size: 16px; color: var(--text-2); margin: 4px 0 0; }
.sg-client-body .sg-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin: 20px 0 0; padding: 0;
    background: none; border: 0; border-radius: 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--sg-line); }
.sg-client-body .sg-facts > div { background: none; border: 0; border-radius: 0; padding: 10px 0; min-width: 0; }
.sg-client-body .sg-facts dt { font-size: 12px; line-height: 1.3; font-weight: 500; color: var(--text-3); text-transform: none; letter-spacing: 0; }
.sg-client-body .sg-facts dd { margin: 2px 0 0; font-size: 15px; line-height: 1.35; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sg-client-body .sg-facts dd small { display: block; margin-top: 1px; font-size: 13px; font-weight: 400; color: var(--text-2); }
@media (min-width: 900px) {
    .sg-client-body .sg-facts { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; }
    .sg-client-body .sg-facts > div { padding: 12px 16px; border-left: 1px solid var(--sg-line); }
    .sg-client-body .sg-facts > div:first-child { padding-left: 0; border-left: 0; }
}

/* -- pasek sekcji: zakladki z podkresleniem */
.sg-client-body .sg-jump { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 24px; margin: 24px 0; padding: 0 28px;
    background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; border: 1px solid var(--sg-line); border-radius: var(--sg-r); }
.sg-client-body .sg-jump a { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 44px; padding: 0; border: 0; border-bottom: 2px solid transparent;
    border-radius: 0; background: none; color: var(--text-2); font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; box-sizing: border-box; }
.sg-client-body .sg-jump a:hover { color: var(--ink); border-color: transparent; border-bottom-color: var(--line-strong); }
.sg-client-body .sg-jump a.is-active { color: var(--ink); background: none; border-color: transparent; border-bottom-color: var(--brand-dark); }
.sg-client-body .sg-jump a span, .sg-client-body .sg-jump a.is-active span { background: none; padding: 0; border-radius: 0; font-size: 13px; font-weight: 400; color: var(--text-3); }
.sg-client-body .sg-jump a:focus-visible { outline-offset: -2px; }

/* -- kafle klas (porownanie .cmp-stats ma wlasne) */
.sg-client-body .sg-stats:not(.cmp-stats) { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin: 0 0 16px; }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; row-gap: 2px; align-items: baseline;
    padding: 12px 16px; background: #fff; border: 1px solid var(--sg-line); border-left-width: 4px; border-radius: var(--sg-r); }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat-1 { border-left-color: #c62828; }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat-2 { border-left-color: #ea7a0c; }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat-3 { border-left-color: #f9a825; }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat-4 { border-left-color: #2e7d32; }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat-obs { border-left-color: #546e7a; }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat.sg-stat-zero { border-left-color: #cfd3da; background: #fff; }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat-n { grid-row: 1 / 3; min-width: 2ch; text-align: right; font-size: 32px; line-height: 1; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat > span:not(.sg-stat-n) { font-size: 14px; line-height: 1.35; font-weight: 600; color: var(--ink); }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat small { grid-column: 2; font-size: 13px; line-height: 1.4; color: var(--text-2); }
.sg-client-body .sg-stats:not(.cmp-stats) .sg-stat-zero :is(.sg-stat-n, span, small) { color: var(--text-3); }
.sg-client-body .sg-none { font-weight: 600; }
/* rozdzielnice: 5 kafli (P1-P4, obserwacje) - liczba nad podpisem, zeby waskie kafle nie lamaly tekstu w kolumnie */
@media (min-width: 700px) {
    .sg-client-body .sg-stats:not(.cmp-stats):has(> .sg-stat:nth-child(4)) .sg-stat { grid-template-columns: minmax(0, 1fr); align-content: start; }
    .sg-client-body .sg-stats:not(.cmp-stats):has(> .sg-stat:nth-child(4)) :is(.sg-stat-n, small) { grid-row: auto; grid-column: auto; text-align: left; }
    .sg-client-body .sg-stats:not(.cmp-stats):has(> .sg-stat:nth-child(4)) .sg-stat-n { margin-bottom: 6px; }
}

/* -- tabele: naglowek normowy, cyfry tabelaryczne, kolumny liczbowe do prawej */
.sg-client-body .sg-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.4; font-variant-numeric: tabular-nums; table-layout: auto; }
.sg-client-body .sg-table th { background: transparent; color: var(--text-2); font-size: 12px; line-height: 1.3; font-weight: 600; text-align: left; vertical-align: bottom;
    padding: 8px 10px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
.sg-client-body .sg-table td, .sg-client-body .sg-table th[scope="row"] { padding: 7px 10px; border-top: 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.sg-client-body .sg-table th[scope="row"] { color: var(--ink); font-size: inherit; font-weight: 600; text-align: left; white-space: nowrap; }
.sg-client-body .sg-table tbody tr:last-child > * { border-bottom: 2px solid var(--ink); }
.sg-client-body .sg-table :is(th, td).sg-num { text-align: right; white-space: nowrap; }
.sg-client-body .sg-table th.sg-num { white-space: normal; }
.sg-client-body .sg-unit-h { font-weight: 400; white-space: nowrap; }
.sg-client-body .sg-u { display: none; }
.sg-client-body .sg-sub { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.sg-client-body .sg-table :is(.sg-col-cls, .sg-c-prio) { width: 56px; text-align: center; }
.sg-client-body .sg-table .sg-c-term, .sg-client-body .sg-table td a[href^="#t-"] { white-space: nowrap; }
.sg-client-body .sg-table .sg-c-com { color: var(--ink); line-height: 1.5; }
.sg-client-body .sg-table .sg-col-dev { min-width: 96px; }
@media (min-width: 1024px) { .sg-client-body .sg-table td.sg-c-com { min-width: 280px; } }
.sg-client-body .sg-verdict-line { display: inline-flex; align-items: baseline; gap: 8px; }
.sg-client-body .sg-crit .sg-range { white-space: nowrap; }
.sg-client-body .sg-crit-notes { margin: 12px 0 0; font-size: 14px; color: var(--text-2); }
.sg-client-body .sg-crit-notes p { margin: 0 0 4px; }
/* wiersze anomalii, odniesienia i linii Lx */
.sg-client-body .sg-table tr.sg-anom > * { background: #fbf4f3; }
.sg-client-body .sg-table tr.sg-anom-3 > :first-child { box-shadow: inset 3px 0 0 #c62828; }
.sg-client-body .sg-table tr.sg-anom-2 > :first-child { box-shadow: inset 3px 0 0 var(--sev-2); }
.sg-client-body .sg-table tr.sg-anom-1 > :first-child { box-shadow: inset 3px 0 0 #f9a825; }
.sg-client-body .sg-table tr.sg-ref > * { color: var(--text-2); font-style: italic; }
.sg-client-body .sg-table tr.sg-line-row > * { background: #fbf8ec; }
/* tabela pomiarow termogramu */
.sg-client-body .sg-meas { font-size: 13px; line-height: 1.35; }
.sg-client-body .sg-meas :is(th, td), .sg-client-body .sg-meas th[scope="row"] { padding: 4px 8px; }
.sg-client-body .sg-meas th { font-size: 12px; }
.sg-client-body .sg-meas th[scope="row"], .sg-client-body .sg-meas .sg-col-bx { width: 44px; font-size: 13px; }
.sg-client-body .sg-meas :is(.sg-col-cls, .sg-c-prio) { width: 48px; }

/* -- plakietki klas: kwadrat 22 px, kolory stale */
.sg-client-body :is(.bd-cls, .sg-prio) { display: inline-flex; flex: none; align-items: center; justify-content: center; box-sizing: border-box; min-width: 22px; height: 22px;
    padding: 0 6px; border-radius: 3px; font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; vertical-align: middle; font-variant-numeric: tabular-nums; }
.sg-client-body :is(.sg-thermo-head, .sg-unit) :is(.bd-cls, .sg-prio) { padding: 0 8px; font-size: 12px; font-weight: 600; }

/* -- karta termogramu */
.sg-client-body .sg-card.sg-thermo { padding: 20px 24px; margin: 0 0 16px; }
.sg-client-body .sg-thermo-head:has(> .sg-thermo-title) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center;
    padding: 0 0 12px; margin: 0 0 16px; border-bottom: 1px solid var(--sg-line); }
.sg-client-body .sg-card .sg-thermo-title { margin: 0; font-size: 16px; line-height: 1.35; font-weight: 600; color: var(--ink); }
.sg-client-body .sg-thermo-head > .bd-cls { justify-self: end; }
.sg-client-body .sg-card .sg-shot { grid-column: 1 / -1; margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sg-client-body .sg-shot-time { white-space: nowrap; color: var(--ink); }
.sg-client-body .sg-thermo-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; }
.sg-client-body .sg-fig { margin: 0; }
.sg-client-body .sg-fig + .sg-fig { margin-top: 16px; }
.sg-client-body .sg-fig figcaption { margin: 0 0 4px; font-size: 12px; line-height: 1.3; font-weight: 600; color: var(--text-3); }
.sg-client-body .sg-thermo-imgs img { box-sizing: border-box; border: 1px solid var(--sg-line); border-radius: 2px; }
.sg-client-body .sg-fig .sg-vis { margin-top: 0; }
.sg-client-body .sg-thermo-imgs > img + img { margin-top: 16px; }
.sg-client-body .sg-card .sg-thermo-comment { margin: 0 0 16px; max-width: 62ch; font-size: 15px; line-height: 1.55; font-weight: 400; color: var(--ink);
    text-align: left; hyphens: auto; -webkit-hyphens: auto; text-wrap: pretty; overflow-wrap: break-word; }
.sg-client-body .sg-card .sg-meas-note { margin: 8px 0 0; }
.sg-client-body .sg-card .sg-meas-note:empty { display: none; }
.sg-client-body .sg-thermo-data > .sg-table-wrap { margin-bottom: 0; }
@media (max-width: 899px) {
    .sg-client-body .sg-thermo-body { grid-template-columns: minmax(0, 1fr); }
    .sg-client-body .sg-thermo-imgs:has(> .sg-fig + .sg-fig) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .sg-client-body .sg-thermo-imgs:has(> .sg-fig + .sg-fig) > .sg-fig + .sg-fig { margin-top: 0; }
}

/* -- komentarze i formularz */
.sg-client-body .sg-thread { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--sg-line); }
.sg-client-body .sg-comment { margin: 8px 0; padding: 2px 0 2px 12px; border-left: 2px solid var(--sg-line); background: none; }
.sg-client-body .sg-comment-admin { border-left-color: var(--brand-dark); background: none; }
.sg-client-body .sg-comment-author { font-size: 13px; font-weight: 600; }
.sg-client-body .sg-comment .hint { color: var(--text-3); }
.sg-client-body .sg-card .sg-comment p { margin: 2px 0 0; max-width: 62ch; font-size: 14px; line-height: 1.5; text-align: left; overflow-wrap: break-word; }
.sg-client-body .sg-thread-form > summary { display: flex; align-items: center; gap: 10px; min-height: 44px; list-style: none; font-size: 14px; font-weight: 600; cursor: pointer; }
.sg-client-body .sg-thread-form > summary::-webkit-details-marker { display: none; }
.sg-client-body .sg-thread-form > summary::before { content: ""; flex: none; width: 6px; height: 6px; margin: 0 2px; border: solid currentColor; border-width: 0 1.5px 1.5px 0;
    transform: rotate(-45deg); }
.sg-client-body .sg-thread-form[open] > summary::before { transform: translateY(-2px) rotate(45deg); }
.sg-client-body .sg-form { max-width: 62ch; padding: 0 0 4px; }
.sg-client-body .sg-lab { display: block; margin: 8px 0 4px; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.sg-client-body .sg-form .sg-lab:first-child { margin-top: 0; }
.sg-client-body .sg-thread-form :is(input, textarea) { display: block; box-sizing: border-box; width: 100%; margin: 0; padding: 7px 10px; border: 1px solid var(--line-strong);
    border-radius: var(--sg-r); font-size: 16px; line-height: 1.4; background: #fff; color: var(--ink); }
.sg-client-body .sg-thread-form input { height: 40px; }
.sg-client-body .sg-thread-form textarea { min-height: 88px; resize: vertical; }
.sg-client-body .sg-thread-form :is(input, textarea)[aria-invalid="true"] { border-color: #b71c1c; box-shadow: inset 0 0 0 1px #b71c1c; }
.sg-client-body .sg-card .sg-thread-note { margin: 6px 0 12px; font-size: 13px; }
.sg-client-body .sg-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sg-client-body .sg-thread-form button.sg-send { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border: 0; border-radius: var(--sg-r);
    background: var(--brand-dark); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.sg-client-body .sg-thread-form button.sg-send:disabled { opacity: .6; cursor: progress; }
.sg-client-body .sg-status { margin: 0; padding: 0; border-radius: 0; background: none; font-size: 13px; color: var(--text-2); }
.sg-client-body .sg-status.sg-err { background: none; color: #991b1b; font-weight: 600; }
@media (min-width: 700px) {
    .sg-client-body .sg-thread-form :is(input, textarea) { font-size: 14px; }
    .sg-client-body .sg-thread-form input { height: 36px; }
    .sg-client-body .sg-thread-form button.sg-send { height: 36px; }
}

/* -- naglowek elewacji / rozdzielnicy i spis */
.sg-client-body .sg-board-title { margin: 40px 0 16px; padding: 0 0 8px; font-size: 22px; line-height: 1.25; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--ink); }
.sg-client-body .sg-board-loc { font-size: 15px; font-weight: 400; color: var(--text-2); }
.sg-client-body .sg-toc ol.sg-units { display: block; columns: auto; list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.sg-client-body .sg-toc ol.sg-units li { border-bottom: 1px solid var(--line); }
.sg-client-body .sg-unit { display: grid; grid-template-columns: minmax(0, 1fr) auto 96px; gap: 4px 16px; align-items: center; height: auto; padding: 10px 4px;
    border: 0; border-radius: 0; background: none; color: var(--ink); text-decoration: none; }
.sg-client-body .sg-unit:hover { border: 0; background: var(--surface-2); }
.sg-client-body .sg-unit-name { font-size: 14px; font-weight: 600; }
.sg-client-body .sg-unit-name small { font-size: 13px; color: var(--text-2); }
.sg-client-body .sg-unit-n { font-size: 13px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sg-client-body .sg-unit > :last-child { justify-self: end; }
.sg-client-body .sg-unit-ok { width: auto; font-size: 13px; font-weight: 400; color: var(--text-2); white-space: nowrap; text-align: right; }
@media (max-width: 519px) {
    .sg-client-body .sg-unit { grid-template-columns: minmax(0, 1fr) auto; }
    .sg-client-body .sg-unit-n { grid-column: 1; grid-row: 2; }
    .sg-client-body .sg-unit > :last-child { grid-column: 2; grid-row: 1 / 3; }
}

/* -- blok "Raport PDF" (zwykla karta, przycisk konturowy) */
.sg-client-body .sg-card.sg-download { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 32px; align-items: start; border: 1px solid var(--sg-line); background: #fff; }
.sg-client-body .sg-download-text { min-width: 0; }
.sg-client-body .sg-card .sg-download-text h2 { margin: 0 0 4px; }
.sg-client-body .sg-card .sg-download-meta { margin: 0 0 12px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sg-client-body .sg-download-meta > span { white-space: nowrap; }
.sg-client-body .sg-card .sg-download-note { max-width: 78ch; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.sg-client-body .sg-card .sg-download-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; margin-top: 2px; box-sizing: border-box;
    border: 1px solid var(--brand-dark); border-radius: var(--sg-r); background: #fff; color: var(--brand-dark); font-size: 14px; font-weight: 600; line-height: 1;
    box-shadow: none; filter: none; text-decoration: none; white-space: nowrap; }
.sg-client-body .sg-download .sg-download-btn:hover { background: var(--surface-2); border-color: var(--brand-dark); color: var(--brand-dark); }
.sg-client-body .sg-download-btn svg { flex: none; }

/* -- przycisk "do gory" */
.sg-client-body .sg-totop { right: 16px; bottom: 16px; width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: var(--sg-r);
    background: #fff; color: var(--ink); box-shadow: none; }
.sg-client-body .sg-totop.is-on { opacity: 1; }
@media (pointer: coarse) { .sg-client-body .sg-totop { width: 44px; height: 44px; } }

/* -- telefon i waskie ekrany */
@media (max-width: 699px) {
    .sg-client-body .sg-hero { padding-top: 20px; }
    .sg-client-body .sg-hero h1 { font-size: 22px; }
    .sg-client-body .sg-card, .sg-client-body .sg-card.sg-thermo { padding: 16px; }
    .sg-client-body .sg-stats:not(.cmp-stats) { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .sg-client-body .sg-card.sg-download { grid-template-columns: minmax(0, 1fr); }
    .sg-client-body .sg-card .sg-download-btn { width: 100%; height: 44px; justify-content: center; }
    .sg-client-body .sg-board-title { margin-top: 32px; font-size: 20px; }
}
@media (max-width: 640px) {
    .sg-client-body .sg-jump { gap: 20px; margin: 16px -12px 16px; padding: 0 12px; border-width: 0 0 1px; border-radius: 0; }
    .sg-client-body .sg-thermo-imgs:has(> .sg-fig + .sg-fig) { display: block; }
    .sg-client-body .sg-thermo-imgs:has(> .sg-fig + .sg-fig) > .sg-fig + .sg-fig { margin-top: 16px; }
    /* wykaz anomalii jako bloki; naglowek tabeli ukryty metoda sr-only (zostaje dla czytnikow) */
    .sg-client-body .sg-cards-m thead, .sg-client-body .sg-cards-m thead tr:first-child { display: block; position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
        overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
    .sg-client-body .sg-cards-m tbody tr, .sg-client-body .sg-cards-m tbody tr:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 0;
        border-bottom: 1px solid var(--line); }
    .sg-client-body .sg-cards-m tbody tr::before { content: ""; order: 3; flex: 0 0 100%; height: 0; }
    .sg-client-body .sg-cards-m tbody tr:last-child > * { border-bottom: 0; }
    .sg-client-body .sg-cards-m tbody td { display: block; padding: 0; border: 0; background: none; box-shadow: none; width: auto; font-size: 13px; line-height: 1.45; text-align: left; }
    .sg-client-body .sg-cards-m td[data-label] { order: 4; }
    .sg-client-body .sg-cards-m td[data-label] a { white-space: nowrap; }
    .sg-client-body .sg-cards-m td.sg-c-prio { order: 0; width: auto; }
    .sg-client-body .sg-cards-m td.sg-c-loc { order: 1; flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 600; }
    .sg-client-body .sg-cards-m td.sg-c-term { order: 2; margin-left: auto; }
    .sg-client-body .sg-cards-m td.sg-num { order: 4; white-space: nowrap; }
    .sg-client-body .sg-cards-m td.sg-c-fac { order: 5; flex: 0 0 100%; color: var(--text-2); }
    .sg-client-body .sg-cards-m td.sg-c-com { order: 6; flex: 0 0 100%; margin-top: 4px; font-size: 14px; line-height: 1.5; color: var(--ink); min-width: 0; }
    .sg-client-body .sg-cards-m .sg-u { display: inline; }
    .sg-client-body .sg-cards-m .sg-sub { display: inline; margin-left: 4px; }
}
@media (max-width: 400px) {
    .sg-client-body .sg-card, .sg-client-body .sg-card.sg-thermo { padding: 16px 12px; }
    .sg-client-body .sg-meas :is(th, td), .sg-client-body .sg-meas th[scope="row"] { padding: 4px 5px; }
}
/* ================================================================ PT: wprowadzenie do panelu (panel_tour.js, przekazanie/samouczek/r2_grafik.md)
   Skorka na tokenach motywu firmy; dymek zawsze na --surface (czytelny na kazdym motywie), marka tylko w przycisku glownym,
   kropce postepu i pierscieniu wokol celu. Klasy .tour-* (samouczek klienta koncowego) bez zmian. */
.admin-body .notif-bell { background: var(--surface, #fff); }
.admin-body .notif-bell:hover { background: var(--surface-2, #eef1f5); }
.admin-body .admin-nav .pt-help { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 38px; height: 38px; padding: 0;
  margin: 0 8px 0 auto; border: 1px solid var(--line, #e2e4e8); border-radius: 50%; background: var(--surface, #fff); color: var(--brand-dark); cursor: pointer; }
.admin-body .admin-nav .pt-help:hover { background: var(--surface-2, #eef1f5); }
.admin-body .admin-nav .pt-help:focus-visible { outline: 2px solid var(--focus, #1d4ed8); outline-offset: 2px; }
.admin-body .admin-nav .pt-help + .notif { margin-left: 0; }
.admin-body .admin-nav .pt-help[hidden] { display: none; }
.pt-links { margin: var(--sp-2, 8px) 0 0; padding-left: 18px; line-height: 1.9; }
.pt-shield { position: fixed; inset: 0; z-index: 2000; background: transparent; }
.pt-scrim { position: fixed; inset: 0; z-index: 2000; background: rgba(10, 14, 22, .60); }
.pt-spot { position: fixed; z-index: 2001; pointer-events: none; border-radius: 10px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--brand-fill, var(--brand-color)), 0 0 0 9999px rgba(10, 14, 22, .60);
  transition: left 220ms ease-out, top 220ms ease-out, width 220ms ease-out, height 220ms ease-out; }
.pt-pop, .pt-modal { position: fixed; z-index: 2002; box-sizing: border-box; background: var(--surface, #fff); color: var(--ink, #1f2430);
  border: 1px solid var(--line, #e2e4e8); border-radius: var(--r-lg, 12px); box-shadow: 0 12px 32px rgba(0, 0, 0, .28); text-align: left; }
.pt-pop { width: 360px; max-width: calc(100vw - 32px); padding: 20px 24px; animation: pt-in 180ms cubic-bezier(.2, .8, .2, 1); }
.pt-pop:focus, .pt-modal:focus { outline: none; }
.pt-pop.pt-dark, .pt-modal.pt-dark { outline: 1px solid rgba(255, 255, 255, .14); }
.pt-pop-head { display: flex; gap: 8px; align-items: flex-start; }
.pt-title { flex: 1; margin: 0; font-size: var(--fs-lg, 16px); font-weight: 600; line-height: 1.3; color: var(--ink, #1f2430); }
.pt-text { margin: 8px 0 0; font-size: var(--fs-md, 14px); line-height: 1.5; color: var(--text-2, #4b5563); }
.pt-dots { display: flex; gap: 6px; margin: 16px 0 12px; }
.pt-dot { width: 6px; height: 6px; border-radius: var(--r-pill, 999px); background: var(--line-strong, #c9ccd1); }
.pt-dot.is-on { width: 18px; background: var(--brand-fill, var(--brand-color)); }
.pt-foot { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft, #eef0f3); }
.admin-body .pt-root button { width: auto; margin: 0; font: inherit; border-radius: var(--r-md, 8px); cursor: pointer; }
.admin-body .pt-root button:focus-visible, .admin-body .pt-root a:focus-visible { outline: 2px solid var(--focus, #1d4ed8); outline-offset: 2px; }
.admin-body .pt-root button.pt-x { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 28px; height: 28px; padding: 0;
  margin: -4px -8px 0 0; border: 0; background: transparent; color: var(--text-3, #6b7280); }
.admin-body .pt-root button.pt-x:hover { background: var(--surface-2, #f3f4f6); color: var(--ink, #1f2430); }
.admin-body .pt-root button.pt-skip { margin-right: auto; min-height: var(--ctl-h, 36px); padding: 0 4px; border: 0; background: transparent;
  color: var(--brand-ink, var(--brand-dark)); font-size: 13px; font-weight: 600; }
.admin-body .pt-root button.pt-skip:hover { text-decoration: underline; background: transparent; }
.admin-body .pt-root button.pt-prev { min-height: var(--ctl-h, 36px); padding: 0 14px; background: var(--surface, #fff); color: var(--brand-dark);
  border: 1px solid var(--line-strong, #c9ccd1); font-size: 14px; font-weight: 600; }
.admin-body .pt-root button.pt-prev:hover { background: var(--surface-2, #f3f4f6); }
.admin-body .pt-root button.pt-next, .admin-body .pt-root a.pt-cta { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ctl-h, 36px);
  padding: 0 16px; background: var(--brand-fill, var(--brand-color)); color: var(--brand-fill-text, #fff); border: 0; font-size: 14px; font-weight: 600;
  border-radius: var(--r-md, 8px); text-decoration: none; }
.admin-body .pt-root button.pt-next:hover, .admin-body .pt-root a.pt-cta:hover { background: color-mix(in srgb, var(--brand-fill, var(--brand-color)) 88%, black); }
.pt-arrow { position: absolute; width: 12px; height: 12px; background: var(--surface, #fff); transform: rotate(45deg); }
.pt-arrow--top { top: -7px; border-top: 1px solid var(--line, #e2e4e8); border-left: 1px solid var(--line, #e2e4e8); }
.pt-arrow--bottom { bottom: -7px; border-bottom: 1px solid var(--line, #e2e4e8); border-right: 1px solid var(--line, #e2e4e8); }
.pt-modal { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 32px; text-align: center; animation: pt-modal-in 180ms cubic-bezier(.2, .8, .2, 1); }
.admin-body .pt-root .pt-modal > button.pt-x { position: absolute; top: 12px; right: 12px; margin: 0; }
.pt-badge { display: inline-flex; align-items: center; justify-content: center; width: 88px; height: 88px; border-radius: 50%;
  background: var(--surface-2, #f3f4f6); border: 1px solid var(--line-soft, #eef0f3); color: var(--brand-ink, var(--brand-dark)); }
.pt-modal-logo { display: block; max-height: 40px; max-width: 200px; margin: 0 auto; object-fit: contain; }
.pt-modal h2 { margin: 16px 0 8px; font-size: var(--fs-xl, 20px); font-weight: 700; line-height: 1.3; color: var(--ink, #1f2430); overflow-wrap: anywhere; }
.pt-lead { margin: 0 auto; max-width: 40ch; font-size: var(--fs-md, 14px); line-height: 1.5; color: var(--text-2, #4b5563); }
.pt-modal-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 24px; }
.admin-body .pt-root .pt-modal-actions .pt-next, .admin-body .pt-root .pt-modal-actions a.pt-cta { min-height: 40px; min-width: 160px; padding: 0 20px; }
.admin-body .pt-root .pt-modal-actions button.pt-skip { margin: 0; }
.pt-hint { margin: 12px 0 0; font-size: 13px; color: var(--text-3, #6b7280); }
@keyframes pt-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pt-modal-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes pt-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@media (max-width: 760px) {
  .admin-body .admin-nav .pt-help { width: var(--ctl-h-touch, 44px); height: var(--ctl-h-touch, 44px); margin: 0 4px 0 0; }
}
@media (max-width: 640px) {
  .pt-pop, .pt-modal { left: 0 !important; right: 0; bottom: 0; top: auto !important; transform: none; width: 100%; max-width: none;
    border-radius: 16px 16px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); animation: pt-sheet-in 240ms cubic-bezier(.2, .8, .2, 1); }
  .pt-pop { max-height: 50vh; max-height: 50dvh; overflow: auto; }
  .pt-modal { max-height: 85vh; max-height: 85dvh; }
  .pt-pop::before, .pt-modal::before { content: ""; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
    border-radius: 2px; background: var(--line-strong, #c9ccd1); }
  .pt-arrow { display: none; }
  .pt-dots { justify-content: center; }
  .pt-foot { flex-wrap: wrap; }
  .admin-body .pt-root button.pt-next { order: 1; flex: 1 0 100%; min-height: var(--ctl-h-touch, 44px); }
  .admin-body .pt-root button.pt-prev { order: 2; min-height: var(--ctl-h-touch, 44px); }
  .admin-body .pt-root button.pt-skip { order: 3; margin: 0 0 0 auto; min-height: var(--ctl-h-touch, 44px); }
  .admin-body .pt-root button.pt-x { width: 44px; height: 44px; margin: -10px -10px 0 0; }
  .admin-body .pt-root .pt-modal-actions .pt-next, .admin-body .pt-root .pt-modal-actions a.pt-cta { width: 100%; min-height: var(--ctl-h-touch, 44px); }
}
@media (prefers-reduced-motion: reduce) {
  .pt-spot, .pt-pop, .pt-modal, .pt-scrim { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) { .pt-spot { outline: 3px solid Highlight; } }
/* ---- Ustawienia: treść wiadomości do klientów (karta „Powiadomienia e-mail dla klientów”) ---- */
.st-mailtpl { list-style: none; margin: 4px 0 0; padding: 0; }
.st-mailtpl li { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line, #e2e4e8); }
.st-mailtpl li:first-child { border-top: 0; }
.st-mailtpl-t { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.st-mailtpl-a { display: inline-flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
/* wykaz anomalii modelu 3D: cele dotyku (WCAG 2.5.8) */
.m3a-przyciski .link-button { min-height: 32px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; }
.sg-client-body .sg-nw { white-space: nowrap; }
/* Propozycje anomalii PV (pv_propozycje.html): lista pozycji z wycinkiem IR | RGB | zblizenie */
.pp-h { font-size: 16px; margin: 0; display: inline-block; }
.pp-kroki { margin: 10px 0 12px 20px; padding: 0; font-size: 14px; line-height: 1.55; }
.pp-pasek { height: 8px; background: #eef0f3; border-radius: 4px; overflow: hidden; margin: 14px 0 8px; }
.pp-pasek i { display: block; height: 100%; background: var(--brand-color); border-radius: 4px; transition: width .6s; }
.pp-etap { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
/* Zatrzymaj / wznow analize (pv_propozycje.html, switchgear_job.html) */
.pp-ocen { font-size: 14px; margin: 0 0 6px; }
.pp-zatrz-info { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.pp-stop { display: flex; flex-wrap: wrap; gap: var(--sp-2, 8px); align-items: center; }
.pp-stop .hint { margin: 0; }
.pp-wstrzymana p { font-size: 14px; }
.pp-fakty { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; }
.pp-fakty strong { font-size: 18px; margin-right: 4px; }
.pp-list { list-style: none; margin: 12px 0 0; padding: 0; }
.pp-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid #eef0f3; }
.pp-item:first-child { border-top: 0; }
.pp-check { width: 20px; height: 20px; margin: 4px 0 0; flex: none; accent-color: var(--brand-color); }
.pp-body { min-width: 0; flex: 1; }
.pp-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 14px; cursor: pointer; margin: 0 0 8px; }
.pp-nr { font-weight: 700; color: #4b5563; }
.pp-dt { font-weight: 700; font-size: 15px; }
.pp-liczby { color: #4b5563; }
.pp-obs { background: #eef0f3; color: #374151; }
.pp-jest { background: #fff7ed; color: #8a4b08; border: 1px solid #fde3c4; }
.pp-zab { background: #fefce8; color: #6b5300; border: 1px solid #f1e3a1; cursor: help; }
.pp-zbl { margin: 6px 0 0; font-size: 13px; }
.pp-zbl > summary { cursor: pointer; color: #374151; font-weight: 600; }
.pp-zbl img { display: block; width: 100%; max-width: 400px; height: auto; margin: 6px 0 4px; border-radius: 6px; background: #1f2430; }
.pp-wycinek { display: block; width: 100%; max-width: 904px; height: auto; border-radius: 6px; background: #1f2430; }
.pp-stopka { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; font-size: 13px; }
.pp-akcje { flex-wrap: wrap; }
.pp-koniec .card-foot { flex-wrap: wrap; }

/* Loty (kilka kompletow ortomozaik w projekcie): tabela lotow na karcie "Ortomozaiki" i wykaz na ekranie propozycji */
/* Kolor lotu (K14) - jedno zrodlo: zmienne --lot-1..6 (Okabe-Ito bez czerni i bez #0072B2) i klasy .lot-cN,
   N = (nr - 1) % 6 + 1 - zawsze z numeru lotu (Jinja: |lot_kolor, JS: window.pvLotKolor; mapa czyta kolor przez
   getComputedStyle(...).getPropertyValue("--lot-c")). --lot-halo: obwodka granic lotow na mapie. */
:root { --lot-1: #E69F00; --lot-2: #56B4E9; --lot-3: #009E73; --lot-4: #F0E442; --lot-5: #CC79A7; --lot-6: #D55E00; --lot-halo: #1f2430; }
.lot-c1 { --lot-c: var(--lot-1); }
.lot-c2 { --lot-c: var(--lot-2); }
.lot-c3 { --lot-c: var(--lot-3); }
.lot-c4 { --lot-c: var(--lot-4); }
.lot-c5 { --lot-c: var(--lot-5); }
.lot-c6 { --lot-c: var(--lot-6); }
.pp-loty { margin: var(--sp-1) 0 0; padding-left: 1.2em; }

/* Karta "Ortomozaiki" w trybie lotow (pakiet C: K15-K18) */
/* komunikat po akcji: fokus z tabindex=-1, widoczny obrys tylko z klawiatury / po przeniesieniu fokusu */
.admin-body .pd-page .card > .pd-lot-msg { margin: 0 0 var(--sp-4); }
.admin-body .pd-lot-msg:focus { outline: none; }
.admin-body .pd-lot-msg:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* tabela: kontener przewijany w poziomie (bez display:block na tabeli - semantyka w VoiceOver) */
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.table-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.project-cards .projects-table.pd-loty, .projects-table.pd-loty { display: table; width: 100%; white-space: normal; overflow: visible; table-layout: fixed; min-width: 620px; }
.projects-table.pd-loty :is(th, td) { padding: var(--sp-2) var(--sp-3); vertical-align: top; }
.projects-table.pd-loty thead th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.projects-table.pd-loty .pd-lot-k-w { width: max(112px, 19%); }
.projects-table.pd-loty .pd-lot-k-data { width: 100px; }
.projects-table.pd-loty .pd-lot-k-akcje { width: 60px; }
.projects-table.pd-loty tbody tr.pd-lot-row > :is(th, td) { border-bottom: 0; padding-top: var(--sp-3); }
.projects-table.pd-loty tbody tr.pd-lot-warunki > td { padding-top: 0; border-top: 0; border-bottom: 1px solid var(--line-soft); }
.projects-table.pd-loty tbody tr:last-child > td { border-bottom: 0; }
.projects-table.pd-loty tbody tr:hover { background: none; }
/* naglowek wiersza: odznaka lotu (biala, lewy pasek 4 px w kolorze lotu) + "Zmien nazwe" */
.projects-table.pd-loty tbody th[scope=row] { text-transform: none; letter-spacing: 0; background: transparent; font-size: var(--fs-md); font-weight: 600; color: var(--ink); text-align: left; overflow-wrap: anywhere; }
.projects-table.pd-loty tbody th[scope=row]:focus { outline: none; }
.projects-table.pd-loty tbody th[scope=row]:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.pd-lot-tag { display: inline-block; max-width: 100%; padding: 2px 8px 2px 8px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--lot-c, var(--line-strong)); border-radius: var(--r-sm); line-height: 1.35; overflow-wrap: anywhere; }
.pd-lot-ren { margin-top: 2px; font-weight: 400; }
.pd-lot-ren > summary { display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; padding: 0 2px; list-style: none; cursor: pointer; font-size: var(--fs-sm); font-weight: 500; color: var(--brand-dark); }
.pd-lot-ren > summary::-webkit-details-marker { display: none; }
.pd-lot-ren > summary:hover { text-decoration: underline; text-underline-offset: 2px; }
.pd-lot-ren[open] > summary { color: var(--text-2); }
.admin-body .pd-page .pd-loty form.pd-lot-nazwa { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); align-items: center; margin: var(--sp-1) 0 0; }
.admin-body .pd-page .pd-loty form.pd-lot-nazwa input[type=text] { flex: 1 1 100%; min-width: 0; min-height: var(--ctl-h-sm); }
.admin-body .pd-page .pd-loty td form { margin: 0; }
/* pola panelu: podpowiedz (placeholder) z kontrastem >= 4,5:1 (#5f6672 na bialym ok. 5,9:1) */
.admin-body .card input::placeholder { color: var(--text-3); opacity: 1; }
/* stany warstw: odznaki o stalej szerokosci minimalnej; przyczyna krotkim wierszem pod odznaka */
.pd-lot-st { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.admin-body .pd-loty .pd-lot-st .pl-badge { min-width: 76px; justify-content: center; margin: 0; white-space: normal; text-align: center; padding-block: 2px; }
.pd-lot-why { display: block; margin-top: var(--sp-1); font-size: var(--fs-xs); line-height: 1.35; color: var(--text-2); overflow-wrap: anywhere; }
.projects-table.pd-loty td.pd-lot-akcje { text-align: right; }
.admin-body .pd-loty .pd-lot-akcje .btn-link.btn-danger { color: var(--err-fg); font-weight: 600; }
.admin-body .pd-loty .pd-lot-akcje .btn-link.btn-danger:hover { text-decoration: underline; text-underline-offset: 2px; }
.pd-lot-odswiez { margin: var(--sp-2) 0 0; }
.pd-lot-kalib { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); color: var(--text-3); }
/* formularz lotu w ramce, 24 px od tabeli */
.pd-lot-box { margin-top: var(--sp-5); padding: var(--sp-4) var(--sp-5) var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.card .pd-lot-box > h4.st-subhead { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
.pd-lot-box .file-row { border-bottom-color: var(--line); }
.card form.pd-lot-form { display: block; }
.pd-lot-fs { margin: 0 0 var(--sp-4); }
.admin-body .card .pd-lot-fs > legend { margin-bottom: var(--sp-2); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.pd-lot-pola { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3) var(--sp-4); }
.pd-lot-pola .field[hidden], .pd-lot-form .field-hint[hidden], .pd-lot-form .pd-plik-blad[hidden] { display: none; }
.pd-plik { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.pd-plik-blad { margin: 0; font-size: var(--fs-xs); font-weight: 600; color: var(--err-fg); }
.pd-lot-odmowa:empty { display: none; }
.pd-lot-odmowa { margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); color: var(--err-fg); background: var(--err-bg); border: 1px solid var(--err-line); border-radius: var(--r-md); }
.pd-lot-form .card-foot { margin-top: 0; }
/* przejscie z jednego kompletu na loty (K15): sekcja w ramce, skutki nad polami plikow */
.card details.pd-lot-przejscie { margin-top: var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.card details.pd-lot-przejscie > summary { min-height: 48px; padding: var(--sp-2) var(--sp-4); }
.card details.pd-lot-przejscie > .pd-opt-body { padding: var(--sp-4); }
.pd-lot-przejscie .pd-opt-body > .hint { margin: 0 0 var(--sp-3); }
.pd-lot-przejscie .pd-lot-skutki { margin-bottom: var(--sp-4); }
.pd-lot-przejscie .pd-opt-body > .st-warn:not(.st-warn-list) { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); }
.pd-lot-przejscie .pd-lot-fs > .field-hint { margin-top: var(--sp-1); }
/* "Wgrano": godzina mniejszym szarym tekstem (#4b5563 na bialym - kontrast ok. 7,6:1) */
.pd-lot-godz { font-size: .85em; color: #4b5563; }
/* warunki lotu (K12): wiersz pod lotem, rozwijany; pola z etykietami nad polem */
.admin-body .pd-page .pd-loty tr.pd-lot-warunki > td { padding-top: 0; border-top: 0; }
.pd-lot-war > summary { cursor: pointer; font-size: var(--fs-sm, 13px); color: #374151; font-weight: 600; min-height: 24px; }
.pd-lot-skrot { font-weight: 400; color: #4b5563; margin-left: .4em; }
.admin-body .pd-page .pd-loty form.pd-lot-war-form { display: flex; flex-wrap: wrap; gap: var(--sp-2, 8px) var(--sp-3, 12px); align-items: flex-end; margin: var(--sp-2, 8px) 0 0; }
.pd-lot-war-form label { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm, 13px); color: #374151; }
.pd-lot-war-form input[type=number] { width: 8em; }
/* odznaka lotu na ekranie propozycji (K20): neutralne tlo, lewy pasek w kolorze lotu (z numeru lotu, .lot-cN - K14) */
.pp-lot { background: #eef0f3; color: #374151; border-left: 4px solid var(--lot-c, #9aa1ad); }
.pp-pas { background: #fff7ed; color: #8a4b08; border: 1px solid #fde3c4; }
.pp-nieakt { display: flex; flex-wrap: wrap; gap: var(--sp-2, 8px); align-items: center; }
.pp-nieakt form { margin: 0; }

/* Mapa klienta: granice lotow (K14). Etykieta numeru przypieta do lewego gornego naroznika zasiegu lotu, czytelna na RGB
   i na IR: biale tlo .92, tekst --ink, lewy pasek 4 px w kolorze lotu (.lot-cN) i obrys 1 px w kolorze obwodki linii. */
#controls [hidden] { display: none !important; }
.loty-ctrl { margin-bottom: 6px; }
.loty-ctrl .control-row { margin-bottom: 2px; }
.loty-opis { margin: 0 0 0 26px; max-width: 210px; font-size: 11.5px; line-height: 1.4; color: var(--text-3, #5f6672); }
.leaflet-tooltip.lot-etykieta {
    padding: 2px 8px; border: 0; border-left: 4px solid var(--lot-c, #9aa1ad); border-radius: 6px;
    background: rgba(255, 255, 255, .92); color: var(--ink, #1f2430);
    box-shadow: 0 0 0 1px var(--lot-halo, #1f2430); font-size: 13px; font-weight: 600; line-height: 1.35; white-space: nowrap;
}
.leaflet-tooltip.lot-etykieta::before { display: none; }
/* Kopia offline (pendrive) - templates/_offline_card.html w karcie „Model 3D” (app/offline.py) */
.m3-offline { margin-top: var(--sp-4, 16px); padding-top: var(--sp-4, 16px); border-top: 1px solid var(--line-soft, #e5e7eb); }
.m3-off-h { font-size: var(--fs-md, 1rem); font-weight: 600; margin: 0 0 4px; }
.m3-off-proj { border: 0; padding: 0; margin: 8px 0; display: grid; gap: 4px; width: 100%; min-width: 0; text-align: left; }
.m3-off-proj legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.m3-off-ok { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 8px 0; }
.card form.m3-off-form, .m3-off-form { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 8px; margin: 8px 0; }
.m3-off-lista { display: grid; gap: 4px; max-height: 320px; overflow: auto; padding-right: 4px; }
.m3-off-inni { margin: 8px 0 2px; }
.m3-off-wsz { justify-self: start; margin-bottom: 4px; }
.m3-off-tytul { display: grid; gap: 4px; width: min(100%, 520px); }

/* Rozpoznane kamery z naglowkow wgranych plikow (_kamery_podsumowanie.html; app/kamery_termo.py) */
.kam-pods > summary { cursor: pointer; list-style-position: inside; }
.kam-pods > summary h2 { display: inline; }
.kam-lista { margin: var(--sp-2, 8px) 0; padding-left: 1.2em; }
.kam-lista li { margin: 2px 0; }
.kam-poziom { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.kam-obslugiwana { background: #e8f5e9; color: #2e7d32; }
.kam-nowa { background: #fff7ed; color: #8a4b00; }
.kam-nieobslugiwana { background: #fdecea; color: #c62828; }

/* Granica mozaik (edytor templates/granica.html, static/js/granica.js; wiersz w karcie "Ortomozaiki") */
.gr-map { height: max(480px, calc(100vh - 360px)); border-radius: 8px; margin-top: 12px; border: 1px solid var(--line, #ddd); }
.gr-map.gr-rysowanie, .gr-map.gr-rysowanie .leaflet-interactive { cursor: crosshair; }
.gr-wierzch { background: #fff; border: 2px solid #1f2430; border-radius: 2px; box-sizing: border-box; cursor: move; }
.gr-wierzch.gr-pierwszy { background: #ff6a00; cursor: pointer; }
.gr-wierzch:focus-visible { outline: 3px solid #ff6a00; outline-offset: 2px; }
.gr-srodek { background: rgba(255, 255, 255, .85); border: 2px solid #007c8c; border-radius: 50%; box-sizing: border-box; cursor: copy; }
.gr-pomoc { margin: 6px 0 0 18px; padding: 0; }
.gr-pomoc li { margin: 2px 0; }
.pd-granica { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line, #e3e5e8); }
.pd-granica .st-subhead { margin: 0; }
.pd-granica .hint { flex-basis: 100%; margin: 0; }
