:root {
  /* Kolorystyka zgrana ze stroną główną projektu bur.lfr.lublin.pl (granat + turkusowy akcent). */
  --primary: #123a73;
  --primary-dark: #0a2159;
  --primary-light: #e8eefc;
  --accent-teal: #3f8fae;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --border: #dde2e7;
  --border-light: #eceff2;
  --text: #22292f;
  --text-muted: #667085;
  --ok: #1a7a3c;
  --ok-bg: #e6f6ec;
  --err: #b3261e;
  --err-bg: #fdecea;
  --warn: #b06b00;
  --warn-bg: #fdf0d9;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 32, 0.05);
  --shadow-md: 0 2px 10px rgba(16, 24, 32, 0.07);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
}

a { color: var(--primary); }

/* --- Nawigacja --- */
nav.topnav {
  background: var(--primary-dark);
  color: #fff;
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-md);
}

nav.topnav > div { display: flex; align-items: center; flex-wrap: wrap; gap: 0.15rem; }

nav.topnav a {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}
nav.topnav a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; text-decoration: none; }

nav.topnav .brand {
  font-weight: 700;
  font-size: 1.02rem;
  color: #fff;
  padding: 0.4rem 0.7rem 0.4rem 0;
  margin-right: 0.3rem;
}

nav.topnav .navuser { font-size: 0.88rem; color: rgba(255, 255, 255, 0.85); margin-right: 0.5rem; }

/* --- Layout --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}
/* Strony z gęstymi tabelami (lista zgłoszeń w naborze) - więcej miejsca, żeby wszystkie
   kolumny zmieściły się bez przewijania w poziomie na typowym ekranie. */
.container.wide { max-width: 1480px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.subtitle { color: var(--text-muted); margin: 0.15rem 0 0; font-size: 0.92rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

h1, h2, h3 { color: var(--primary-dark); font-weight: 700; }
h1 { font-size: 1.55rem; margin: 0 0 0.55rem; padding-bottom: 0.5rem; position: relative; }
h1::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  background: var(--accent-teal);
  margin-top: 0.5rem;
  border-radius: 2px;
}
h2 { font-size: 1.1rem; margin-top: 0; margin-bottom: 0.85rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border-light); }
.card > h2:first-child, .card > h2:only-child { margin-top: 0; }

/* --- Tabele --- */
.table-wrap { overflow-x: auto; margin: 0.75rem 0; border-radius: var(--radius-sm); }
.table-wrap table { margin: 0; }

table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.87rem; }
th, td { border-bottom: 1px solid var(--border-light); padding: 0.55rem 0.6rem; text-align: left; vertical-align: middle; }
th {
  background: #f7f9fb;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* Tabele z wieloma kolumnami (np. lista naboru) - kolumny nie "rozjeżdżają się" poniżej rozsądnej
   szerokości; jeśli suma szerokości nie mieści się w kontenerze, .table-wrap włącza scroll poziomy
   zamiast ściskać przyciski/pola aż zaczną na siebie nachodzić. */
.table-fixed { table-layout: auto; }
.table-fixed td, .table-fixed th { overflow-wrap: break-word; word-break: break-word; }
.table-fixed td select { width: auto; min-width: 150px; max-width: 100%; }
.table-fixed td form { margin: 0; }
.col-nowrap { white-space: nowrap; }
.col-actions { white-space: nowrap; text-align: right; }

/* Wariant gęstszy dla bardzo szerokich tabel (lista zgłoszeń w naborze) - mniejsze odstępy,
   żeby zmieściła się jak najwięcej treści bez przewijania w poziomie. */
.table-compact th, .table-compact td { padding: 0.45rem 0.5rem; }
.table-compact { font-size: 0.85rem; }

tr.status-nowa td.status-cell { color: var(--text-muted); }
tr.status-w_trakcie td.status-cell { color: var(--warn); font-weight: 600; }
tr.status-zakonczona td.status-cell { color: var(--ok); font-weight: 600; }

/* --- Przyciski --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.3;
  white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary-dark); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f2f4f7; border-color: #c7ced5; }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

.actions-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

input[type=text], input[type=password], input[type=date], input[type=number], input[type=file], select, textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 91, 140, 0.15);
}

label { font-weight: 600; display: block; margin: 0.7rem 0 0.3rem; font-size: 0.87rem; color: var(--text); }
label[style*="font-weight:400"], label[style*="font-weight: 400"] { color: var(--text); }

.error-box {
  background: var(--err-bg);
  border: 1px solid var(--err);
  color: var(--err);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.info-box {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  color: var(--primary-dark);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

/* --- Bloki pytań karty oceny --- */
.pytanie-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.75rem;
  background: #fafbfc;
}
.pytanie-block.auto { border-left: 4px solid var(--primary); }
.pytanie-block.manual { border-left: 4px solid var(--warn); }

.pytanie-tresc { font-weight: 600; margin-bottom: 0.4rem; }
.pytanie-badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 10px;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.pytanie-badge.auto { background: var(--primary-light); color: var(--primary-dark); }
.pytanie-badge.manual { background: var(--warn-bg); color: var(--warn); }

.radio-group { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0.4rem 0; }
.radio-group label { font-weight: 400; display: flex; align-items: center; gap: 0.35rem; margin: 0; }

.uzasadnienie { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.35rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

.badge-status {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-status.nowa { background: #eef0f2; color: var(--text-muted); }
.badge-status.w_trakcie { background: var(--warn-bg); color: var(--warn); }
.badge-status.zakonczona { background: var(--ok-bg); color: var(--ok); }

.badge-wynik {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-wynik.tak { background: var(--ok-bg); color: var(--ok); }
.badge-wynik.nie { background: var(--err-bg); color: var(--err); }
.badge-wynik.brak { background: #eef0f2; color: var(--text-muted); }

/* Czerwone oznaczenia pól wymagających uwagi (PESEL niepełnoletni, terminy poza zakresem) */
.danger-box {
  background: var(--err-bg);
  border: 1px solid var(--err);
  color: var(--err);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}
.pytanie-block.danger {
  border-left: 4px solid var(--err);
  background: var(--err-bg);
}
tr.row-danger td, tr.row-danger th { background: var(--err-bg); }
.badge-danger {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 10px;
  margin-left: 0.5rem;
  vertical-align: middle;
  background: var(--err);
  color: #fff;
  white-space: nowrap;
}

/* Kolorowanie wierszy na liście naboru wg wyniku oceny karty */
tr.wynik-tak { background: #f2faf5; }
tr.wynik-nie { background: #fdf4f3; }
tr.wynik-tak:hover { background: #e9f7ee; }
tr.wynik-nie:hover { background: #fdecea; }
tr.wynik-tak td.status-cell, tr.wynik-nie td.status-cell { font-weight: 600; }

/* --- Panel naborów: karty naboru --- */
.nabor-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.nabor-card h2 { margin: 0 0 0.4rem; padding-bottom: 0; border-bottom: none; }
.nabor-card .nabor-meta { color: var(--text-muted); margin: 0 0 0.75rem; font-size: 0.9rem; }
.nabor-card .nabor-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }

.progress-bar {
  width: 100%;
  max-width: 260px;
  height: 8px;
  border-radius: 5px;
  background: var(--border-light);
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-bar > span { display: block; height: 100%; background: var(--ok); border-radius: 5px; }

.stat-line { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; align-items: center; color: var(--text); font-size: 0.92rem; }
.stat-line strong { color: var(--primary-dark); }

/* --- Login --- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-wrap .card { width: 100%; max-width: 380px; box-shadow: var(--shadow-md); }
