/* ---------- Design tokens ---------- */
:root {
  /* Brand (ARES green) */
  --brand-700: #065f46;
  --brand-600: #047857;
  --brand-500: #059669;
  --brand-400: #10b981;
  --brand-300: #34d399;
  --brand-100: #d1fae5;
  --brand-50: #ecfdf5;

  /* Archiwum (pomarańczowy akcent) */
  --archive-700: #c2410c;
  --archive-600: #ea580c;
  --archive-50: #fff7ed;

  /* Neutrals */
  --ink-900: #111827;
  --ink-700: #374151;
  --ink-500: #6b7280;
  --ink-300: #d1d5db;
  --ink-200: #e5e7eb;
  --ink-100: #f3f4f6;
  --ink-50: #f9fafb;
  --surface: #ffffff;
  --page-bg: #fffef5;

  /* Semantic */
  --info-700: #0369a1;
  --info-600: #0284c7;
  --info-500: #0ea5e9;
  --info-50: #f0f9ff;
  --warn-600: #d97706;
  --warn-500: #f59e0b;
  --warn-50: #fef3c7;
  --danger-700: #991b1b;
  --danger-600: #b91c1c;
  --danger-500: #dc2626;
  --danger-50: #fef2f2;

  /* System */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.08);
  --container: 960px;
  --container-wide: 1200px;
  --font-sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
}

form {
  margin: 0;
}

a {
  text-decoration: none;
  color: #2563eb;
}
a:hover {
  text-decoration: underline;
  color: #dc2626;
}

.sub_n {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #f8fafc;
  text-decoration: none;
}
.sub {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #374151;
  text-decoration: none;
  font-weight: normal;
}

.nagl_black {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #111827;
  text-decoration: none;
}

.nagl_blue {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 600;
}
.nagl_blue_s {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 16px;
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 600;
}
.nagl_blue_d {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 20px;
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 700;
}

.nagl_red {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #dc2626;
  text-decoration: none;
  font-weight: 600;
}
.nagl_red_s {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 16px;
  color: #dc2626;
  text-decoration: none;
  font-weight: 600;
}
.nagl_red_d {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 20px;
  color: #dc2626;
  text-decoration: none;
  font-weight: 700;
}

.nagl_zolty {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #f59e0b;
  text-decoration: none;
  font-weight: 600;
}

.nagl_green_s {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 16px;
  color: #059669;
  text-decoration: none;
  font-weight: 600;
}

.nagl_braz_s {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 16px;
  color: #92400e;
  text-decoration: none;
  font-weight: 600;
}

.links {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #dc2626;
  text-decoration: none;
  font-weight: normal;
}

.tekst_druk {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 15px;
  color: #374151;
  text-decoration: none;
  font-weight: 600;
}
.tekst {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #374151;
  text-decoration: none;
  font-weight: normal;
  line-height: 1.6;
  text-align: justify;
}
.tekst_szary {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #9ca3af;
  text-decoration: none;
  text-align: justify;
}
.tekst_c_szary {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #6b7280;
  text-decoration: none;
  text-align: justify;
}
.szary {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #9ca3af;
  text-decoration: none;
  font-weight: normal;
}
.c_szary {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #6b7280;
  text-decoration: none;
  font-weight: normal;
}
.c_szary_maly {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 12px;
  color: #6b7280;
  text-decoration: none;
  font-weight: normal;
}
.c_maly {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 12px;
  color: #374151;
  text-decoration: none;
  font-weight: normal;
}

.b_maly {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 12px;
  color: #9ca3af;
  text-decoration: none;
  font-weight: normal;
  letter-spacing: 0.1em;
}
.b_maly2 {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 12px;
  color: #374151;
  text-decoration: none;
  font-weight: normal;
}
a.b_maly:hover {
  color: #6b7280;
}

a.sub_n:hover,
a.nagl_blue:hover,
a.nagl_red_s:hover,
a.nagl_blue_s:hover,
a.nagl_green_s:hover,
a.nagl_red:hover,
a.links:hover,
a.szary:hover {
  color: #f59e0b;
  text-decoration: underline;
}
a.nagl_black:hover {
  color: #dc2626;
  text-decoration: underline;
}
a.sub:hover {
  color: #f59e0b;
  text-decoration: underline;
}

blockquote {
  margin-bottom: 0px;
  margin-top: 0px;
  margin-right: 0px;
}
ul {
  list-style-type: disc;
  list-style-position: outside;
  font-size: 14px;
  margin-right: 0px;
  margin-left: 10px;
  margin-bottom: 0px;
  margin-top: 0px;
}

table {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #374151;
  text-decoration: none;
  font-weight: normal;
  line-height: 1.6;
}
.komorka {
  background-color: #f5f5f0;
}

.form,
select {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  background-color: #fffef7;
  color: #333300;
  border: 1px #cccccc solid;
  transition: border-color 0.2s ease-in-out;
}
input,
textarea {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  background-color: #fffef7;
  color: #333300;
  border: 1px #cccccc solid;
  transition: border-color 0.2s ease-in-out;
}
input:focus,
textarea:focus,
select:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.in_r {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  background-color: #fffef0;
  color: #333300;
  border: 1px #cccccc solid;
  text-align: right;
  width: 100%;
  min-width: 45px;
}

.m_w {
  width: 100%;
  min-width: 200px;
}

/* Radio buttons i checkboxy */
input[type='radio'],
input[type='checkbox'] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid #cccccc;
  background-color: #fffef7;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  vertical-align: middle;
  margin-right: 6px;
}

input[type='radio'] {
  border-radius: 50%;
}

input[type='checkbox'] {
  border-radius: 3px;
}

input[type='radio']:checked {
  background-color: #93c5fd;
  border-color: #60a5fa;
  position: relative;
}

input[type='radio']:checked::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

input[type='checkbox']:checked {
  background-color: #93c5fd;
  border-color: #60a5fa;
  position: relative;
}

input[type='checkbox']:checked::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
}

input[type='radio']:focus,
input[type='checkbox']:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type='radio']:hover,
input[type='checkbox']:hover {
  border-color: #9ca3af;
}

.radio {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  vertical-align: middle;
  margin: 0 4px 0 0;
  position: relative;
  top: -1px;
}

/* Wrapper jednej opcji "radio + etykieta" — pozwala klikać w tekst, daje
   większy oddech między sąsiednimi opcjami niż między kropką a jej tekstem. */
.ui-radio {
  display: inline-flex;
  align-items: center;
  margin-right: 22px;
  cursor: pointer;
  font-size: 14px;
}
.ui-radio:last-child {
  margin-right: 0;
}
.ui-radio .radio {
  top: 0;
  margin-right: 6px;
}

input.submit,
input.button,
.butt {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #374151;
  background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
  border: 1px #d1d5db solid;
  border-radius: 4px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  min-width: 140px;
  height: 30px;
  white-space: nowrap;
}

input.submit:hover,
input.button:hover,
.butt:hover {
  background: linear-gradient(to bottom, #e9ecef, #dee2e6);
  border-color: #9ca3af;
}

.butt_neutral {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #6b7280;
  background: transparent;
  border: 1px #d1d5db solid;
  border-radius: 4px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  min-width: 140px;
  height: 30px;
  white-space: nowrap;
}

.butt_neutral:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #374151;
}

.butt_red {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #b91c1c;
  background: linear-gradient(to bottom, #fef2f2, #fee2e2);
  border: 1px #f9a8a8 solid;
  border-radius: 4px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(185, 28, 28, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  min-width: 140px;
  height: 30px;
  white-space: nowrap;
}

.butt_red:hover {
  background: linear-gradient(to bottom, #fee2e2, #fecaca);
  border-color: #f87171;
}

.butt--ghost {
  background: transparent;
  color: var(--ink-600, #4b5563);
  border: 1px solid var(--ink-300, #d1d5db);
  box-shadow: none;
}

.butt--ghost:hover {
  background: var(--ink-50, #f9fafb);
  border-color: var(--ink-400, #9ca3af);
}

/* Grupa przycisków w kolumnie akcji */
.butt-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.butt--icon {
  min-width: 0;
  width: 30px;
  height: 30px;
  padding: 0;
}

/* Badge statusu sprawozdania.
   inline-flex (zamiast inline-block + text-align: center), bo ten sam .status-badge
   jest renderowany raz jako <span>, raz jako <button>. <button> w Chrome ma własne
   UA-style (appearance: button, align-items: flex-start w anonimowym boksie),
   przez co geometria jest minimalnie różna od <span> i sąsiednie badge'y w kolumnie
   wyglądają jak nierówne. inline-flex daje deterministyczne centrowanie w obu
   wariantach. */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  min-width: 155px;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge--draft {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.status-badge--pending {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.status-badge--approved {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.status-badge--error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  font-size: 12px;
  font-weight: 500;
}

.status-badge--ghost {
  background: transparent;
  color: var(--ink-500);
  border: 1px dashed var(--ink-300);
  font-weight: 500;
}

/* Brak prawidłowego adresu e-mail dla jednostki: dyskretna notka w kolumnie
   "Dane kontaktowe" (nie pełny badge statusu). Pomarańczowy tekst + mała ikona
   trójkąta (currentColor), spójny ze stylem kolumny kontaktów. */
.contact-no-mail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #b45309;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Data ostatniego znanego złożenia pod kartą "Ostatnio znane" - mała, wyciszona. */
.contact-last-date {
  color: var(--ink-400, #9ca3af);
  font-size: 11px;
}

/* Badge RA w przyciskach filtra — kompaktowy wariant (mniejsze paddingi L/R,
   bez min-width). Przyciski filtra i tak mają własny padding, więc badge
   wewnątrz nie potrzebuje dodatkowej szerokości. */
.ra-filter-form .status-badge {
  min-width: 0;
  padding: 1px 6px;
  font-size: 11px;
}

/* Badge RA może być <button> (klikalny, otwiera okno historii) albo <span>
   (dla użytkowników bez uprawnień admina). Reset button styles i hover.
   appearance: none — żeby Chrome nie nakładał własnego renderingu widgetu
   (m.in. wewnętrzny align-items: flex-start), który wizualnie odsuwa tekst
   "09" od środka i powoduje że sąsiednie badge'y wyglądają na nierówne. */
button.status-badge {
  font: inherit;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
button.status-badge:hover {
  filter: brightness(0.92);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
button.status-badge:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}

.status-badge--ra-auto {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  min-width: 32px;
  font-size: 12px;
  font-weight: 600;
}
/* '02' — najważniejszy stan otwarty "oczekujemy sprawozdania". Czerwony,
   żeby wyraźnie wyróżniał się w raporcie i przyciągał uwagę opiekuna. */
.status-badge--ra-urgent {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  min-width: 32px;
  font-size: 12px;
  font-weight: 600;
}
/* '08','09' — odmowa / brak kontaktu. Pomarańczowy (między żółtym a czerwonym):
   opiekun już zaraportował powód, ale sytuacja wymaga dalszych kroków. */
.status-badge--ra-warn {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
  min-width: 32px;
  font-size: 12px;
  font-weight: 600;
}
/* '03'–'07','10' — ustalone stany trwałe podmiotu. Bursztynowy. */
.status-badge--ra-override {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  min-width: 32px;
  font-size: 12px;
  font-weight: 600;
}
.ra-td {
  white-space: nowrap;
  text-align: center;
}
.ra-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.ra-modal__inner {
  background: #fff;
  max-width: 720px;
  width: 90%;
  max-height: 85vh;
  border-radius: 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ra-modal__inner--wide {
  max-width: 1100px;
  height: auto;        /* kurczy się do contentu, max 85vh z .ra-modal__inner */
  min-height: 50vh;    /* ale nie mniej niż połowa viewportu — pusta tabela nie wygląda jak "kiszka" */
}
.ra-modal__inner--wide .ra-modal__body {
  flex: 0 1 auto;  /* nie rośnij ponad content; shrink jeśli za duzo */
}
/* Formularz wypełniający modal w pionie: scrollowane body + stały footer.
   Dzięki temu pasek akcji (np. Wyślij/Anuluj) jest zawsze widoczny, a przewija
   się tylko zawartość środka — jeden obszar scrolla, bez zagnieżdżeń. */
.ra-modal__form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.ra-modal__header {
  flex-shrink: 0;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #e5e7eb;
}
.ra-modal__body {
  flex: 1 1 auto;
  overflow: auto;
  /* Scroll-chaining lock — gdy user dojedzie do końca scrolla wewnątrz modala,
     wheel/touch nie propaguje do strony pod spodem. Działa razem z JS-handlerem
     wheel/touchmove na backdropie (.ra-modal) — patrz log_zdarzen_view.inc.php. */
  overscroll-behavior: contain;
  padding: 16px 24px;
  min-height: 0; /* wymuszone dla flex child z overflow */
}
.ra-modal__footer {
  flex-shrink: 0;
  padding: 16px 24px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}
.ra-modal__footer-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
.ra-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}
.ra-timeline__row {
  display: grid;
  grid-template-columns: 120px 54px 1fr;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 13px;
}
.ra-timeline__date {
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
}
.ra-timeline__kod {
  display: flex;
  align-items: flex-start;
}
.ra-timeline__kod .status-badge {
  min-width: 28px;
  padding: 1px 6px;
  font-size: 11px;
}
.ra-timeline__row.is-cancelled .ra-timeline__kod .status-badge {
  text-decoration: line-through;
}
.ra-timeline__desc > div + div {
  margin-top: 2px;
}
.ra-timeline__cancel-form {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 8px 0 0 0;
}
.ra-timeline__cancel-form input[type="text"] {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}
.ra-timeline__row.is-cancelled {
  opacity: 0.55;
}

/* Tryb masowego nadawania kodów RA — kolumna checkboxów ukryta domyślnie,
   odsłaniana gdy kontener raportu ma klasę .ra-bulk-active. Toggle JS-em. */
.ra-bulk-th,
.ra-bulk-td {
  display: none;
  text-align: center;
  vertical-align: middle;
  padding: 4px 6px;
}
.ra-bulk-active .ra-bulk-th,
.ra-bulk-active .ra-bulk-td {
  display: table-cell;
}
.ra-bulk-active .ra-bulk-cb,
.ra-bulk-active #ra-bulk-select-all {
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
}
.ra-bulk-active .ui-table tr:hover .ra-bulk-td {
  background: #f3f4f6;
}

/* Tryb masowego zatwierdzania — kolumna checkboxów analogiczna do .ra-bulk-*.
   Tryby ma-bulk i ra-bulk są wzajemnie wykluczające na danym widoku. */
.ma-bulk-th,
.ma-bulk-td {
  display: none;
  text-align: center;
  vertical-align: middle;
  padding: 4px 6px;
}
.ma-bulk-active .ma-bulk-th,
.ma-bulk-active .ma-bulk-td {
  display: table-cell;
}
.ma-bulk-active .ma-bulk-cb,
.ma-bulk-active #ma-bulk-select-all {
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
}
.ma-bulk-active .ma-bulk-cb[disabled] {
  cursor: not-allowed;
  opacity: 0.4;
}
.ma-bulk-active .ui-table tr:hover .ma-bulk-td {
  background: #f3f4f6;
}

/* Modal masowego nadawania — lista zaznaczonych jednostek. */
.ra-modal__bulk-list {
  list-style: none;
  margin: 8px 0 16px 0;
  padding: 8px 12px;
  max-height: 240px;
  overflow-y: auto;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  line-height: 1.6;
}
.ra-modal__bulk-list li {
  margin: 0;
  padding: 1px 0;
}
.ra-modal__bulk-summary {
  color: #6b7280;
  font-style: italic;
  font-size: 12px;
}

.uid-badge {
  display: inline-block;
  min-width: 40px;
  text-align: center;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--brand-100);
  margin-right: 6px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
}
.status-row > .status-badge,
.status-row > .ra-badge {
  flex-shrink: 0;
}

/* Używane w raporcie przesłanych gdy kolumna RA jest wtopiona w Status
   — owija status + badge błędów weryfikacji jako jedną "lewą stronę"
   flex-between, a badge RA ląduje jako "prawa strona". Kolumna (nie wiersz),
   żeby przy zawijaniu w wąskiej komórce badge statusu i badge błędów
   weryfikacji stały jeden pod drugim z wyraźnym odstępem. */
.status-row__main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Mini-tabelka danych kontaktowych w raporcie spływu */
.contact-table {
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.3;
  max-width: 600px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.contact-table td {
  padding: 0 0 0 0;
  border: none !important;
  vertical-align: baseline;
}

.contact-label {
  color: var(--ink-400, #9ca3af);
  font-size: 12px;
  white-space: nowrap;
  padding-right: 8px !important;
  width: 90px;
}

.contact-table tr.contact-section-start td {
  padding-top: 4px;
}

.contact-ico {
  vertical-align: -1px;
  color: var(--ink-400, #9ca3af);
}

.unit-td {
  vertical-align: middle;
}

.unit-meta {
  margin-bottom: 2px;
}

.unit-regon {
  display: inline-block;
  background: var(--ink-100, #f3f4f6);
  color: var(--ink-700);
  border: 1px solid var(--ink-200, #e5e7eb);
  font-size: 12px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

.unit-name {
  font-weight: 600;
  max-width: 420px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-td {
  vertical-align: middle;
}

.status-date {
  font-size: 12px;
  color: var(--ink-400, #9ca3af);
  margin-top: auto;
  padding-top: 6px;
}

.status-notes {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  line-height: 1.3;
}

/* Linki z klasami przycisków */
a.butt,
a.butt_red,
a.butt_neutral,
a.butt--ghost {
  text-decoration: none !important;
  color: inherit;
}

a.butt:hover,
a.butt_red:hover,
a.butt_neutral:hover,
a.butt--ghost:hover {
  text-decoration: none !important;
  color: inherit;
}

.border {
  border: 1px #cccccc solid;
}

BODY {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  background-color: #fffef5;
  color: #374151;
  line-height: 1.6;
}

/* input type number no arrows */
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.summary {
  cursor: pointer;
  font-weight: 600;
  color: #dc2626;
  font-size: 16px;
}

/* container */
.container {
  height: 100vh;
  display: flex;
  justify-content: center;
  padding-top: 10px;
  box-sizing: border-box;
}

.content {
  width: auto;
  max-width: 100%;
  min-width: 100%;
}

@media (min-width: 1024px) {
  .content {
    min-width: 1024px;
  }
}

/* Dodatkowe style dla lepszej dostępności */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Delikatne ramki dla tabel formularzowych */
.form-table {
  border: 1px solid #e5e7eb;
  border-collapse: collapse;
}

.form-table td {
  border: 1px solid #f3f4f6;
}

/* Elastyczny kontener główny */
.main-container {
  transition: max-width 0.3s ease;
}

/* Responsywność formularza logowania */
@media (max-width: 900px) {
  /* Na małych ekranach panele po prawej stronie chowamy */
  .login-panels {
    display: none !important;
  }

  /* Upewniamy się, że kontener formularza nie powoduje poziomego przewijania */
  .login-container > div {
    flex-direction: column !important;
    align-items: center !important;
  }

  /* Wyśrodkowanie zawartości w module raportów */
  .content-area {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
  }

  /* Responsywny nagłówek - zapobieganie poziomemu przewijaniu */
  body > table {
    width: 100% !important;
  }

  body > table td table {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Ukrywamy tło z obrazkiem na małych ekranach dla lepszej czytelności */
  body {
    background-image: none !important;
  }
}

@media (max-width: 400px) {
  /* Na bardzo małych ekranach zapobiegamy uciekaniu formularza w lewo */
  .login-container {
    justify-content: flex-start !important;
    padding: 10px !important;
  }

  .login-container > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  .login-container > div > div {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (max-height: 700px) {
  /* Przy niskim oknie zmniejszamy odstępy */
  .login-container {
    padding: 10px 0 !important;
  }
}

@media (max-height: 500px) {
  /* Przy bardzo niskim oknie dalej zmniejszamy odstępy */
  .login-container {
    padding: 5px 0 !important;
  }
}

/* Style dla input file - custom file upload button */
.file-input-wrapper {
  position: relative;
  display: inline-block;
}

.file-input-wrapper input[type='file'] {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.file-input-label {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-size: 14px;
  color: #374151;
  background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
  border: 1px #d1d5db solid;
  border-radius: 4px;
  /* padding: 4px 8px; */
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  min-width: 100px;
  height: 30px;
  white-space: nowrap;
  text-decoration: none;
}

.file-input-label:hover {
  background: linear-gradient(to bottom, #e9ecef, #dee2e6);
  border-color: #9ca3af;
  text-decoration: none;
}

.file-input-label:focus-within {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.file-selected {
  margin-left: 8px;
  font-size: 12px;
  color: #059669;
  font-weight: 500;
}

/* Slim Select styles for dictionary fields */
.ss-main {
  border: 1px #cccccc solid !important;
  border-radius: 0 !important; /* Usuń zaokrąglenia - jak zwykłe inputy */
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif !important;
  font-size: 14px !important;
  background-color: #fffef7 !important;
  color: #333300 !important;
  box-shadow: none !important;
  transition: border-color 0.2s ease-in-out !important;
  padding: 0 !important; /* Usuń domyślny padding */
  min-height: 23px !important;
}

/* Style dla głównego tekstu w Slim Select - upodobnienie do zwykłego selecta */
.ss-single {
  padding: 2px 6px !important; /* Minimalny padding jak w zwykłym select */
  line-height: 1.2 !important;
  font-size: 14px !important;
  color: #333300 !important;
}

.ss-single-selected {
  padding: 2px 6px !important;
  line-height: 1.2 !important;
  font-size: 14px !important;
  color: #333300 !important;
}

.ss-main:focus {
  border-color: #059669 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1) !important;
}

/* Selecty budowane leniwie działają najpierw jako natywny <select>, a dopiero
   przy pierwszym dotknięciu zamieniają się w rozwijaną kontrolkę. Żeby ta zamiana
   nie powodowała skoku szerokości ani wyglądu, natywny stan upodabniamy do
   zamkniętej kontrolki: pełna szerokość rodzica + ta sama ramka, tło, font i
   wysokość. Różni je tylko strzałka rozwijania. */
select.dict_select_lazy,
select.dict_select_obiekty {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cccccc;
  border-radius: 0;
  color: #333300;
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  height: 23px;
  /* Lewe 9px: napis startuje 10px od krawędzi kontrolki rozwijanej, minus 1px
     ramki natywnego selecta daje 9px paddingu. Prawe 22px robi miejsce na
     strzałkę. */
  padding: 0 22px 0 9px;
  /* Własna strzałka identyczna jak w kontrolce rozwijanej (chevron #4d4d4d),
     spójna na każdym systemie zamiast strzałki systemowej. */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fffef7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M10,30 L50,70 L90,30' fill='none' stroke='%234d4d4d' stroke-width='18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 12px 12px;
}

/* Style dla elementów błędnych - czerwona ramka i wykrzyknik */
.dict-error .ss-main {
  border-color: #dc2626 !important;
  background-color: #fff3cd !important;
}

.dict-error .ss-main .ss-single,
.dict-error .ss-main .ss-single-selected,
.dict-error .ss-main .ss-placeholder,
.dict-error .ss-main .ss-values .ss-single {
  color: #dc2626 !important;
  font-weight: bold !important;
}

/* Specjalnie dla wykrzyknika w opcjach */
.ss-option[data-id*='popraw'] {
  color: #dc2626 !important;
  font-weight: bold !important;
}

/* Wykrzyknik w wybranej opcji */
option[style*='#fff3cd'] {
  color: #dc2626 !important;
}

/* Wykrzyknik w ss-single (główny wyświetlany tekst) */
.ss-single.has-error {
  color: #dc2626 !important;
  font-weight: bold !important;
}

/* Dropdown lista opcji */
.ss-content {
  border: 1px #cccccc solid !important;
  border-radius: 0 !important; /* Usuń zaokrąglenia - jak zwykłe inputy */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
  background-color: #fffef7 !important;
  min-width: max-content !important; /* Co najmniej szerokość najszerszej opcji */
  max-width: 1024px !important; /* Maksymalna szerokość dropdown */
}

/* Wyjątek: select Jednostki sprawozdawczej — dropdown nie szerszy
   niż stan zamknięty, długie nazwy zawijają się */
.ss-content.ss-obiekty-content {
  min-width: 0 !important;
  max-width: none !important;
}
.ss-content.ss-obiekty-content .ss-option {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.ss-option {
  padding: 8px 12px !important;
  font-size: 14px !important;
  color: #333300 !important;
  background-color: #fffef7 !important;
}

.ss-option:hover {
  background-color: #f3f4f6 !important;
}

.ss-option.ss-highlighted {
  background-color: #059669 !important;
  color: white !important;
}

/* Zaznaczona opcja - wyróżnienie */
.ss-option.ss-selected {
  background-color: #e0f2e7 !important; /* Jasny zielony tło */
  color: #065f46 !important; /* Ciemny zielony tekst */
  font-weight: bold !important;
}

/* Style dla wyszukiwania */
.ss-search input {
  border: 1px #cccccc solid !important;
  border-radius: 0 !important; /* Usuń zaokrąglenia - jak zwykłe inputy */
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont,
    sans-serif !important;
  font-size: 14px !important;
  background-color: #fffef7 !important;
  color: #333300 !important;
  padding: 6px 8px !important;
}

.ss-search input:focus {
  border-color: #059669 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1) !important;
}

/* Style dla tooltipów weryfikacji */
.custom-tooltip {
  position: relative;
  display: inline-block;
}

.custom-tooltip .tooltip-text {
  visibility: hidden;
  background-color: #ffffff;
  color: #374151;
  text-align: center;
  border-radius: 6px;
  padding: 6px 10px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  margin-left: -65px;
  font-size: 12px;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #e5e7eb;
}

.custom-tooltip .tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
}

.custom-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Nowa funkcjonalność: Style dla read-only wartości [nn,nn,nn.d] */
/* .readonly-value i .readonly-empty są stylowane przez kontener nadrzędny */

/* ---------- UI Primitives ---------- */

/* ---------- Karta ---------- */
.ui-card {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  width: 100%;
  max-width: var(--container);
  margin: 16px auto;
  font-family: var(--font-sans);
  color: var(--ink-700);
  box-sizing: border-box;
}

.ui-card--wide {
  max-width: var(--container-wide);
}

.ui-card--flush {
  margin: 0;
}

.ui-card__header {
  background: linear-gradient(
    135deg,
    var(--brand-600) 0%,
    var(--brand-400) 100%
  );
  color: #ffffff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ui-card__title {
  font: 700 17px/1.3 var(--font-sans);
  margin: 0;
  letter-spacing: 0.3px;
  color: #ffffff;
}

.ui-card__subtitle {
  font: 500 15px/1.4 var(--font-sans);
  margin: 6px 0 0 0;
  color: var(--brand-100);
}

.ui-card__body {
  padding: 18px 20px;
  color: var(--ink-700);
  font-size: 14px;
  line-height: 1.6;
}

.ui-card__footer {
  padding: 12px 20px;
  background: var(--ink-50);
  border-top: 1px solid var(--ink-100);
}

/* Subtelny nagłówek sekcji wewnątrz .ui-card__body
   Używany dla kart drugorzędnych (pomoc, instrukcja), które nie
   potrzebują pełnego zielonego headera — tylko wyróżniony tytuł. */
.ui-section-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--ink-200);
}

.ui-section-header::before {
  content: '';
  display: block;
  width: 3px;
  align-self: stretch;
  background: var(--brand-500);
  border-radius: 2px;
  flex-shrink: 0;
}

.ui-section-header__text {
  flex: 1;
  min-width: 0;
}

.ui-section-header__title {
  font: 600 15px/1.3 var(--font-sans);
  margin: 0;
  color: var(--brand-700);
  letter-spacing: 0.2px;
}

.ui-section-header__subtitle {
  font: 400 12px/1.4 var(--font-sans);
  margin: 2px 0 0 0;
  color: var(--ink-500);
}

/* Wariant informacyjny (niebieski gradient) — dla sekcji pomocy */
.ui-card--info .ui-card__header {
  background: linear-gradient(
    135deg,
    var(--info-700) 0%,
    var(--info-600) 100%
  );
}
.ui-card--info .ui-card__subtitle {
  color: #e0f2fe;
}

/* Wariant archiwum (pomarańczowy gradient) */
.ui-card--archive .ui-card__header {
  background: linear-gradient(
    135deg,
    var(--archive-700) 0%,
    var(--archive-600) 100%
  );
}
.ui-card--archive .ui-card__subtitle {
  color: var(--archive-50);
}

/* ---------- Przyciski ---------- */
.ui-btn[hidden] { display: none; }
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  font: 500 14px/1 var(--font-sans);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  box-sizing: border-box;
}

.ui-btn:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.ui-btn--primary {
  background: var(--brand-600);
  color: #ffffff;
  border-color: var(--brand-600);
}
.ui-btn--primary:hover {
  background: var(--brand-700);
  border-color: var(--brand-700);
  color: #ffffff;
  text-decoration: none;
}

.ui-btn--secondary {
  background: #ffffff;
  color: var(--brand-700);
  border-color: var(--brand-600);
}
.ui-btn--secondary:hover {
  background: var(--brand-50);
  color: var(--brand-700);
  text-decoration: none;
}

.ui-btn--ghost {
  background: #ffffff;
  color: var(--ink-700);
  border-color: var(--ink-300);
}
.ui-btn--ghost:hover {
  background: var(--ink-50);
  border-color: var(--ink-500);
  color: var(--ink-900);
  text-decoration: none;
}

.ui-btn--danger {
  background: #ffffff;
  color: var(--danger-600);
  border-color: var(--danger-600);
}
.ui-btn--danger:hover {
  background: var(--danger-50);
  color: var(--danger-700);
  border-color: var(--danger-700);
  text-decoration: none;
}

/* Disabled state — wyszarzony, brak interakcji. Hover też nie powinien zmieniać
   tła (gradient z .ui-btn--primary:hover wygrywał z opacity, więc nadpisujemy). */
.ui-btn:disabled,
.ui-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.4);
}

.ui-btn--sm {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

.ui-btn--lg {
  height: 42px;
  padding: 0 20px;
  font-size: 15px;
}

/* Linki z klasami przycisków */
a.ui-btn,
a.ui-btn:hover {
  text-decoration: none !important;
}

/* ---------- Grupa akcji (stopka karty) ---------- */
.ui-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px 0 4px;
}

.ui-actions--end {
  justify-content: flex-end;
}

.ui-actions--split {
  justify-content: space-between;
}

/* ---------- Powiadomienia (alerty) ---------- */
.ui-notice {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: 400 13px/1.5 var(--font-sans);
  align-items: flex-start;
}

.ui-notice__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.ui-notice__title {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 4px 0;
}

.ui-notice--warn {
  background: var(--warn-50);
  border-color: var(--warn-500);
  color: #78350f;
}
.ui-notice--warn .ui-notice__icon {
  fill: var(--warn-600);
}

.ui-notice--info {
  background: var(--info-50);
  border-color: var(--info-500);
  color: #0c4a6e;
}
.ui-notice--info .ui-notice__icon {
  fill: var(--info-600);
}

.ui-notice--danger {
  background: var(--danger-50);
  border-color: var(--danger-500);
  color: #7f1d1d;
}
.ui-notice--danger .ui-notice__icon {
  fill: var(--danger-600);
}

.ui-notice--success {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: var(--brand-700);
}
.ui-notice--success .ui-notice__icon {
  fill: var(--brand-600);
}

/* ---------- Chipy / pill-linki (Wzór formularza, klauzule itp.) ---------- */
.ui-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
  font: 500 13px var(--font-sans);
  text-decoration: none;
  transition: all 0.15s ease;
}
.ui-chip:hover {
  background: var(--brand-100);
  color: var(--brand-700);
  text-decoration: none;
}

.ui-chip--info {
  background: var(--info-50);
  color: var(--info-700);
  border-color: #bae6fd;
}
.ui-chip--info:hover {
  background: #bae6fd;
  color: var(--info-700);
}

.ui-chip-rodo {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 5px;
  vertical-align: 1px;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* ---------- Siatka formularza etykieta : kontrolka ---------- */
.ui-form {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px 16px;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
}

/* Zapobiega overflow kontrolek szerszych niż kolumna */
.ui-form > * {
  min-width: 0;
}

.ui-form > label,
.ui-form .ui-form__label {
  font-weight: 600;
  color: var(--ink-700);
  font-size: 14px;
}

/* Kontrolki rozciągają się do szerokości kolumny */
.ui-form select,
.ui-form input[type='text'],
.ui-form input[type='number'],
.ui-form input[type='email'],
.ui-form input[type='password'] {
  max-width: 100%;
  box-sizing: border-box;
}

.ui-form__full {
  grid-column: 1 / -1;
}

/* ---------- Tabela danych ---------- */
.ui-table {
  width: 100%;
  border-collapse: collapse;
  font: 14px/1.5 var(--font-sans);
  background: transparent;
}

.ui-table th {
  background: var(--brand-50);
  color: var(--brand-700);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--brand-100);
  white-space: nowrap;
}

.ui-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--ink-300);
  color: var(--ink-700);
}

.ui-table tbody tr:hover td {
  background: var(--ink-50);
}

.ui-table tbody tr:last-child td {
  border-bottom: none;
}

/* Wariant z ramką zewnętrzną */
.ui-table--bordered {
  border: 1px solid var(--ink-300);
}

.ui-table--bordered th {
  border-bottom: 2px solid var(--brand-100);
  border-right: 1px solid var(--ink-200);
}

.ui-table--bordered th:last-child {
  border-right: none;
}

.ui-table--bordered td {
  border-right: 1px solid var(--ink-200);
}

.ui-table--bordered td:last-child {
  border-right: none;
}

/* Optymalizacja renderowania dużych tabel — przeglądarka pomija wiersze poza viewportem */
.ui-table--bordered tbody tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 60px;
}

/* Placeholder zajmujący miejsce tabeli na czas otwartej listy wyboru.
   W środku lekki skeleton: prawdziwy nagłówek plus kilkanaście wierszy z ghostami
   pól w tej samej siatce, oraz pojedynczy pseudo-element z przesuwającym się
   połyskiem. To kilkadziesiąt węzłów zamiast tysięcy. */
.report-table-placeholder {
  width: 100%;
  background-color: var(--surface);
  position: relative;
  overflow: hidden;
}

.report-skeleton tbody tr {
  height: 38px;
  content-visibility: visible;
}

.skel-bar {
  display: block;
  height: 12px;
  width: 65%;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.06);
}

/* Lekkie zróżnicowanie szerokości ghostów, niezależne od liczby kolumn. */
.report-skeleton td:nth-child(even) .skel-bar { width: 50%; }
.report-skeleton td:last-child .skel-bar { width: 40%; }

.report-table-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.65) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  animation: report-skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes report-skeleton-shimmer {
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .report-table-placeholder::after { animation: none; }
}

/* ---------- Topbar ---------- */
.topbar-card {
  max-width: var(--container-wide);
  margin: 12px auto;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  font-family: var(--font-sans);
  box-sizing: border-box;
}

.topbar-card__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 20px;
  align-items: center;
}

.topbar-card__firm-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-900);
  margin: 0 0 6px 0;
}

.topbar-card__firm-info {
  color: var(--ink-500);
  font-size: 13px;
  line-height: 1.5;
}

.topbar-card__contact-label {
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 4px;
  font-size: 13px;
}

.topbar-card__contact-data {
  font-size: 13px;
  color: var(--ink-700);
  line-height: 1.6;
}

.topbar-card__contact-data a {
  color: var(--brand-600);
  font-weight: 600;
}

.topbar-card__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-card__actions-separator {
  width: 1px;
  height: 28px;
  background: var(--ink-200);
  margin: 0 4px;
}

/* Responsywność topbaru */
@media (max-width: 900px) {
  .topbar-card__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .topbar-card__actions {
    justify-content: flex-start;
  }

  .ui-card {
    max-width: 100%;
    margin: 12px;
  }
}

/* ---------- Kod / code-block w instrukcjach ---------- */
.ui-code {
  background: var(--ink-100);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 13px;
  color: var(--ink-900);
}

.ui-code-block {
  display: block;
  background: var(--brand-50);
  color: var(--brand-700);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-100);
  font-family: 'Courier New', Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  white-space: pre-line;
  margin: 8px 0;
}

/* =============================================================================
   Przegląd sprawozdania
   ============================================================================= */

.dashboard-card {
  margin: 16px auto 24px auto;
}

/* Pastelowy szary header — override dla .ui-card__header wewnątrz .dashboard-card,
   żeby nie rysować domyślnego zielonego gradientu brand. */
.dashboard-card .ui-card__header {
  background: linear-gradient(
    135deg,
    #f3f4f6 0%,
    #e5e7eb 100%
  );
  color: var(--ink-900);
  border-bottom: 1px solid var(--ink-200);
}
.dashboard-card .ui-card__title {
  color: var(--ink-900);
}
.dashboard-card .ui-card__subtitle {
  color: var(--ink-700);
}

/* Alert (urgent) */
.dashboard-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  font: 500 15px/1.4 var(--font-sans);
}
.dashboard-alert__icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.dashboard-alert__text {
  flex: 1 1 auto;
}
.dashboard-alert__text strong {
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

/* Grid stat-cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.dashboard-stat {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0; /* pozwala grid column zmniejszać się poniżej content min */
}
.dashboard-stat__label {
  font: 500 11px/1.3 var(--font-sans);
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  /* Rezerwujemy miejsce na 2 linie — dłuższe etykiety (np. "CZEKA NA ZATW.")
     zawijają się, krótsze ("OPERAT") nadal zajmują 2 linie, dzięki czemu
     wartości liczbowe we wszystkich kafelkach są wyrównane wertykalnie. */
  min-height: calc(2 * 1.3em);
}
.dashboard-stat__value {
  font: 700 22px/1.1 var(--font-sans);
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.dashboard-stat__sub {
  font: 400 12px/1.3 var(--font-sans);
  color: var(--ink-500);
}
.dashboard-stat--neutral { border-left-color: var(--ink-300); }
.dashboard-stat--success { border-left-color: #059669; }
.dashboard-stat--warn    { border-left-color: #d97706; }
.dashboard-stat--info    { border-left-color: #0284c7; }
.dashboard-stat--danger  { border-left-color: #dc2626; }

/* Wariant agregatu (np. "Niezatwierdzone" = Czeka + Wersja robocza). Pasek
   lewy dzielony 50/50 — sygnał wizualny że kafelek pokrywa dwa sąsiednie.
   border-left zamieniony na pseudo-element, bo border nie obsługuje
   wielokolorowego gradientu w sposób stabilny we wszystkich silnikach. */
.dashboard-stat--mixed {
  border-left-color: transparent;
  position: relative;
}
.dashboard-stat--mixed::before {
  content: '';
  position: absolute;
  left: -1px;
  top: -1px;
  bottom: -1px;
  width: 4px;
  background: linear-gradient(to bottom,
    #0284c7 0%, #0284c7 50%,
    #d97706 50%, #d97706 100%);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* Aktywny kafelek = bieżący tryb raportu pokazany pod spodem. Subtelne
   wyróżnienie: lekko tinted tło, drop shadow dla "lift", grubszy pasek lewy.
   Bez krzykliwego accent color — operator widzi "jestem tutaj" peryferyjnie,
   nie odciąga uwagi od liczb. */
.dashboard-stat--active {
  background: var(--ink-50, #f9fafb);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  border-left-width: 5px;
}
.dashboard-stat--mixed.dashboard-stat--active::before {
  width: 5px;
}
.dashboard-stat--clickable.dashboard-stat--active:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.dashboard-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin-top: 6px;
  font: 500 13px/1.45 var(--font-sans);
  color: var(--ink-600);
}
.dashboard-meta__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.dashboard-meta__item b {
  color: var(--ink-900);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.dashboard-meta__item svg {
  flex-shrink: 0;
  opacity: 0.55;
}
.dashboard-meta__item--filter {
  color: #1e40af;
}
.dashboard-meta__item--filter b { color: #1e3a8a; }

/* Krzyżyk czyszczący filtr w chipie meta — submit button bez tła, kontur
   pojawia się na hover. Niewidoczny outline focus dostosowany do chipa. */
.dashboard-meta__clear {
  background: transparent;
  border: none;
  padding: 2px 4px;
  margin-left: 4px;
  cursor: pointer;
  color: #1e3a8a;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  line-height: 1;
}
.dashboard-meta__clear:hover {
  background: rgba(30, 58, 138, 0.1);
}
.dashboard-meta__clear:focus-visible {
  outline: 2px solid rgba(30, 58, 138, 0.4);
  outline-offset: 1px;
}

/* Inline select w meta-info — wygląda jak natywne pole, kompaktowo. */
.dashboard-meta__select {
  padding: 3px 6px;
  border: 1px solid var(--ink-300, #d1d5db);
  border-radius: 5px;
  font: 13px var(--font-sans);
  background: #fff;
  cursor: pointer;
  max-width: 240px;
}
.dashboard-meta__select:hover {
  border-color: var(--brand-500, #10b981);
}
.dashboard-meta__item--filter svg { opacity: 0.85; }

/* Progress bar (stacked horizontal) */
.dashboard-progress {
  margin: 18px 0;
  padding: 14px 16px;
  background: var(--ink-50);
  border-radius: var(--radius-sm);
}
.dashboard-progress__title {
  font: 500 14px/1.4 var(--font-sans);
  color: var(--ink-700);
  margin-bottom: 8px;
}
.dashboard-progress__title b {
  font-weight: 700;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.dashboard-progress__bar {
  display: block;
  width: 100%;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  background: #e5e7eb;
}
.dashboard-progress__legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font: 12px var(--font-sans);
  color: var(--ink-700);
}
.dashboard-progress__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dashboard-progress__swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}
.dashboard-progress__empty {
  font: 14px var(--font-sans);
  color: var(--ink-500);
  text-align: center;
  padding: 12px;
}

/* Donut chart + legenda */
.dashboard-ra-block {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: center;
  padding: 16px;
  background: var(--ink-50);
  border-radius: var(--radius-sm);
}
/* Wariant kompaktowy — gdy ra-block jedzie w jednym wierszu z progressem
   i logiem zdarzeń (slot środkowy w .dashboard-progress-row). */
.dashboard-ra-block--inline {
  width: 100%;
  margin: 18px 0;
  padding: 10px 14px;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  box-sizing: border-box;
}
.dashboard-donut__svg {
  width: 200px;
  height: 200px;
  display: block;
}
.dashboard-donut__center-label {
  font-size: 48px;
  letter-spacing: 1px;
}
.dashboard-ra-block--inline .dashboard-donut__svg {
  width: 96px;
  height: 96px;
}
.dashboard-donut__legend {
  list-style: none;
  padding: 0;
  margin: 0;
}
.dashboard-donut__legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 13px/1.5 var(--font-sans);
  color: var(--ink-700);
  padding: 3px 0;
}
.dashboard-donut__swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.dashboard-donut__legend-kod {
  font-weight: 700;
  min-width: 24px;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.dashboard-donut__legend-label {
  flex: 1 1 auto;
  color: var(--ink-700);
}
.dashboard-donut__legend-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-900);
}
.dashboard-donut__empty {
  font: 14px var(--font-sans);
  color: var(--ink-500);
  text-align: center;
  padding: 24px;
}

/* Legenda kompaktowa — mniejszy font/odstępy, gdy ra-block w slocie inline. */
.dashboard-ra-block--inline .dashboard-donut__legend li {
  font-size: 11.5px;
  line-height: 1.3;
  padding: 1px 0;
  gap: 6px;
}
.dashboard-ra-block--inline .dashboard-donut__legend-btn {
  font-size: 11.5px;
  line-height: 1.3;
  padding: 2px 4px;
  gap: 6px;
}
.dashboard-ra-block--inline .dashboard-donut__swatch {
  width: 10px;
  height: 10px;
}
.dashboard-ra-block--inline .dashboard-donut__legend-kod {
  min-width: 18px;
}

/* Wiersz: progress (left) + ra-block --inline (middle, opc.) + log-stats (right).
   Wszystkie trzy slot-y mają stretch height i wewnątrz identyczne tło/radius
   przez .dashboard-progress / .dashboard-ra-block / .dashboard-log-stats. */
.dashboard-progress-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-wrap: wrap;
}
.dashboard-progress-row__bar {
  flex: 2 1 320px;
  min-width: 0;
}
.dashboard-progress-row__ra {
  flex: 2 1 280px;
  min-width: 0;
  display: flex;
}
.dashboard-progress-row__stats {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  /* Na średnich ekranach RA spada do nowej linii — progress i log zostają
     obok siebie, RA na pełną szerokość pod nimi. */
  .dashboard-progress-row__ra {
    flex-basis: 100%;
    order: 3;
  }
  .dashboard-progress-row__stats {
    order: 2;
  }
}
@media (max-width: 720px) {
  .dashboard-ra-block {
    grid-template-columns: 1fr;
  }
  .dashboard-ra-block--inline {
    grid-template-columns: 96px 1fr;
  }
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-stat__value {
    font-size: 20px;
  }
}

/* ---------- Oznaczenie otwartych wierszy (in-memory mark) ---------- */
.ui-table tbody tr.row-opened td {
  background: var(--ink-50);
}
.ui-table tbody tr.row-opened td.unit-td {
  box-shadow: inset 3px 0 0 0 var(--info-600);
}
.ui-table tbody tr.row-opened:hover td {
  background: var(--ink-100);
}
.ui-table tbody tr.row-opened .butt--open::after {
  content: " \2713";
  color: var(--brand-500);
  font-weight: 700;
  margin-left: 4px;
}

/* ---------- Klikalne stat-cards dashboardu (button reset + hover/focus) ---------- */
.dashboard-goto-form { margin: 0; }

button.dashboard-stat {
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
button.dashboard-stat .dashboard-stat__label,
button.dashboard-stat .dashboard-stat__value,
button.dashboard-stat .dashboard-stat__sub {
  display: block;
}
.dashboard-stat--clickable:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  /* Hover NIE dotyka border-left-color — zachowuje kolor paska wariantu
     (success/warn/info/danger/mixed). Shorthand 'border-color' nadpisywał
     wszystkie 4 boki i zacierał akcent. */
  border-top-color: var(--ink-300);
  border-right-color: var(--ink-300);
  border-bottom-color: var(--ink-300);
}
.dashboard-stat--clickable:focus-visible {
  outline: 2px solid var(--info-500);
  outline-offset: 2px;
}
.dashboard-stat--clickable:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Legenda donuta jako buttony per-kod RA */
.dashboard-donut__legend-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 6px;
  margin: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: 13px/1.5 var(--font-sans);
  color: var(--ink-700);
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.dashboard-donut__legend-btn:hover {
  background: var(--ink-50);
  border-color: var(--ink-200);
}
.dashboard-donut__legend-btn:focus-visible {
  outline: 2px solid var(--info-500);
  outline-offset: 1px;
}
.dashboard-donut__legend-btn:active {
  background: var(--ink-100);
}
.dashboard-donut__legend li {
  padding: 0;
}

/* Blok stats logu zdarzeń obok progress bara (Stan spływu). Cały button
   jest klikalny i submituje POST otwierający modal. Wysokość = pełna
   wysokość progress bara obok (align-items:stretch w wrapperze). */
.dashboard-log-stats {
  display: flex;
  flex-direction: column;
  justify-content: space-between;  /* header u góry, CTA u dołu */
  width: 100%;
  /* Identyczne wymiary jak .dashboard-progress — outer box dokładnie ten sam,
     żeby stretch wewnątrz .dashboard-progress-row wyrównał chip do bara. */
  margin: 18px 0;
  padding: 14px 16px;
  background: var(--ink-50);
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--ink-700);
  transition: background 0.15s;
  overflow: hidden;
  box-sizing: border-box;
}
.dashboard-log-stats:hover {
  background: var(--ink-100, #f3f4f6);
}
.dashboard-log-stats__header {
  font-size: 12px;
  color: var(--ink-700);
  line-height: 1.3;
  flex-shrink: 0;
}
.dashboard-log-stats__header b {
  color: var(--ink-900, #111);
}
.dashboard-log-stats__rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 14px;
  row-gap: 1px;
  font-size: 11px;
  color: var(--ink-700);
  min-height: 0;
  overflow: hidden;
}
.dashboard-log-stats__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.3;
}
.dashboard-log-stats__line-label {
  color: var(--ink-600);
}
.dashboard-log-stats__line-count {
  font-weight: 700;
  color: var(--ink-900, #111);
  font-variant-numeric: tabular-nums;
}
.dashboard-log-stats__empty-line {
  color: var(--ink-500);
  font-style: italic;
  font-size: 11px;
}
.dashboard-log-stats__cta {
  font-size: 11px;
  color: #059669;
  font-weight: 600;
  text-align: right;
  line-height: 1.3;
  flex-shrink: 0;
}
.dashboard-log-stats--empty {
  align-items: center;
  justify-content: center;
  text-align: center;
}
.dashboard-log-stats--empty .dashboard-log-stats__icon {
  font-size: 22px;
  opacity: 0.5;
  margin-bottom: 2px;
}
.dashboard-log-stats--empty .dashboard-log-stats__main {
  font-size: 12px;
  color: var(--ink-500);
  margin-bottom: 4px;
}
.dashboard-log-stats--empty .dashboard-log-stats__cta {
  text-align: center;
}

/* Hidden submit button (log_otworz_modal=1). Klikany programowo z onclick
   na chipie (gdy klik nie trafił w chevron). Trzyma standardową semantykę
   form submit — keyboard activation via Enter/Space na chipie (role="button"). */
.dashboard-log-stats__open-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Chevrony nawigacji dniami — dyskretne, inline po bokach nagłówka.
   Małe, bez tła, hover ledwo widoczny. Chevron › niewidoczny gdy
   jest dzisiaj (zastąpiony spacerem o tej samej szerokości żeby tekst
   nagłówka nie skakał). */
.dashboard-log-stats__nav,
.dashboard-log-stats__nav-spacer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 16px;
  line-height: 1;
  color: var(--ink-400, #9ca3af);
  background: transparent;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
  vertical-align: baseline;
  flex: 0 0 auto;
}
.dashboard-log-stats__nav:hover {
  color: var(--ink-900, #111);
  background: rgba(0,0,0,0.06);
}
.dashboard-log-stats__nav:focus-visible {
  outline: 2px solid #059669;
  outline-offset: 1px;
}
.dashboard-log-stats__nav-spacer {
  visibility: hidden;
  cursor: default;
  pointer-events: none;
}

/* Header (filled) i main (empty) muszą zachować chevrony + tekst w jednej
   linii — flex inline z gap. Tekst rośnie (flex:1) żeby chevron-next
   przyległ do prawego krańca dostępnej szerokości nagłówka. */
.dashboard-log-stats--filled .dashboard-log-stats__header {
  display: flex;
  align-items: center;
  gap: 4px;
}
.dashboard-log-stats__header-text {
  flex: 1;
  min-width: 0;
}
.dashboard-log-stats--empty .dashboard-log-stats__main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Div ma role="button" — pokażmy focus ring zgodny z reszta UI. */
.dashboard-log-stats[role="button"]:focus-visible {
  outline: 2px solid #059669;
  outline-offset: 2px;
}

/* Sortowalne nagłówki kolumn w modalu logu — button reset + hover/active.
   Klik submituje lz-pagi-form z log_sort_click=<col>, main.php toggluje. */
.lz-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: none;
  font: inherit;
  font-weight: 600;
  color: #374151;
  text-align: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.1s;
}
.lz-sort-btn:hover {
  background: #e5e7eb;
}
.lz-sort-btn:focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: -2px;
}
.lz-sort-btn--active {
  color: #111827;
}
.lz-sort-arrow {
  font-size: 10px;
  color: #059669;
  line-height: 1;
}

/* Pills filtra akcji w modalu logu (button submit, single-select).
   Klik na pill submituje formę z tą jedną wartością. */
.lz-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #374151;
  user-select: none;
  white-space: nowrap;
  transition: filter 0.1s;
}
.lz-pill:hover {
  filter: brightness(0.95);
}
.lz-pill--active {
  background: #059669;
  border-color: #059669;
  color: #fff;
}
.lz-pill--info.lz-pill--active   { background: #0284c7; border-color: #0284c7; }
.lz-pill--warn.lz-pill--active   { background: #d97706; border-color: #d97706; }
.lz-pill--draft.lz-pill--active  { background: #6b7280; border-color: #6b7280; }

/* Badge akcji w wierszu tabeli (klikalny — submit z log_filtr_akcje[]).
   inline-flex + gap + nowrap = ikona i tekst zawsze w jednej linii,
   spójna wysokość niezależnie od długości etykiety. */
.lz-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}
.lz-action-badge--success { background: #d1fae5; color: #065f46; }
.lz-action-badge--info    { background: #dbeafe; color: #1e40af; }
.lz-action-badge--warn    { background: #fef3c7; color: #78350f; }
.lz-action-badge--draft   { background: #f3f4f6; color: #374151; }
.lz-action-badge:hover {
  filter: brightness(0.95);
}

/* Wiersze tabeli logu — hover */
.lz-row:hover {
  background: #f9fafb;
}

/* Link "Jednostka" w wierszu — wygląd jak link, działanie button (submit form
   otwierający sprawozdanie w nowym oknie). */
.lz-open-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
  line-height: 1.3;
}
.lz-open-link:hover {
  color: #059669;
  text-decoration: underline;
}

/* Paginacja */
.lz-pagi-btn {
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
}
.lz-pagi-btn:hover {
  background: #f3f4f6;
}
.lz-pagi-btn--active {
  background: #059669;
  border-color: #059669;
  color: #fff;
  font-weight: 600;
}

/* Kompaktowy nagłówek stanu — tytuł + meta + linia fazy + linia ostrzeżenia,
   zwarte w jednym bloku zamiast osobnych kart. */
.dash-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--ink-200);
}
.dash-head__row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.dash-head__title {
  font: 700 15px/1.2 var(--font-sans);
  color: var(--brand-700);
  white-space: nowrap;
}
.dash-head__row .dashboard-meta {
  margin-top: 0;
  flex: 1 1 auto;
}
.dash-head__phase {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  font: 13px/1.3 var(--font-sans);
}
.dash-head__phase svg { width: 15px; height: 15px; flex-shrink: 0; }
.dash-head__phase b { font-weight: 700; }
.dash-head__phase-daty { opacity: 0.85; font-weight: 500; }
.dash-head__phase--info    { background: #f0f9ff; color: #075985; border-color: #0ea5e9; }
.dash-head__phase--warn    { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.dash-head__phase--success { background: #ecfdf5; color: #065f46; border-color: #059669; }
.dash-head__phase--danger  { background: #fef2f2; color: #991b1b; border-color: #dc2626; }
.dash-head__phases {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
/* Pojedynczy chip rozciąga się na całą szerokość; przy kilku dzielą wiersz
   (a gdy się nie mieszczą — zawijają, każdy wiersz wypełniony). */
.dash-head__phases > .dash-head__phase { flex: 1 1 auto; }
.dash-head__ra {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid #f87171;
  background: #fee2e2;
  color: #991b1b;
  font: 13px/1.3 var(--font-sans);
}

/* ---------- Kopiowanie adresu e-mail (klik kopiuje, ikona na hover) ---------- */
.copy-mail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  line-height: inherit;
  vertical-align: baseline;
  cursor: pointer;
  border-radius: 4px;
}

.copy-mail:hover .copy-mail__addr {
  text-decoration: underline dotted;
}

.copy-mail:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 1px;
}

.copy-mail__ico {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  color: #6b7280;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.copy-mail:hover .copy-mail__ico,
.copy-mail:focus-visible .copy-mail__ico {
  opacity: 1;
}

.copy-mail.is-copied .copy-mail__ico {
  opacity: 1;
  color: var(--brand-500);
}

.copy-mail--trefny .copy-mail__addr {
  text-decoration: line-through;
  color: #b91c1c;
}

.copy-mail--trefny:hover .copy-mail__addr {
  text-decoration: underline line-through dotted;
}

/* Toast potwierdzenia kopiowania */
.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  z-index: 9999;
  padding: 8px 14px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font: 600 13px/1.3 var(--font-sans);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.copy-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

