*, *::before, *::after { box-sizing: border-box; }

/* atrybut hidden ma zawsze wygrywać z display ustawionym w klasach (np. .btn-secondary) */
[hidden] { display: none !important; }

:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --text: #1d1f23;
  --muted: #6b7079;
  --border: #d5d8de;
  --accent: #ab2b3c;        /* czerwień zespołu (wutracing.pl) */
  --accent-dark: #8e2231;
  --error-bg: #fdecee;
  --error-text: #8a0b1f;
  --topbar-bg: #16161a;     /* czerń ze strony zespołu */
  --green-bg: #dcfce7;
  --green-border: #bbf7d0;
  --green-text: #14532d;
  --red-bg: #fee2e2;
  --red-border: #fecaca;
  --red-text: #991b1b;
  /* pasek budżetu – sprawdzone validate_palette.js (CVD zieleń↔bursztyn 6.5 → zawsze z legendą i przerwami) */
  --bar-expense: #b91c1c;
  --bar-topay: #d97706;
  --bar-free: #15803d;
}

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

/* --- logowanie: zdjęcie bolidu w tle, karta z logo --- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(rgba(16, 16, 20, 0.72), rgba(16, 16, 20, 0.86)), url("/assets/brand/login-bg.jpg") center / cover no-repeat, var(--topbar-bg);
}

.login-box {
  width: 100%;
  max-width: 380px;
  overflow: hidden;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.login-brand {
  padding: 1.75rem 2rem 1.4rem;
  background: var(--topbar-bg);
  border-bottom: 4px solid var(--accent);
  text-align: center;
}
.login-brand img { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto; }
.login-brand p { margin: 0.75rem 0 0; color: #c9c9ce; font-size: 0.9rem; letter-spacing: 0.04em; }

.login-form { padding: 1.5rem 2rem 2rem; }

label { display: block; margin: 1rem 0 0.25rem; font-weight: 600; font-size: 0.9rem; }

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

button {
  font: inherit;
  cursor: pointer;
}

.login-box button[type="submit"] {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.7rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.login-box button[type="submit"]:hover { background: var(--accent-dark); }

.alert { padding: 0.6rem 0.75rem; border-radius: 6px; font-size: 0.9rem; }
.alert-error { background: var(--error-bg); color: var(--error-text); }

.hint { margin: 1.25rem 0 0; font-size: 0.85rem; color: var(--muted); text-align: center; }

/* --- układ po zalogowaniu --- */

/* górny pasek: logo, profil, wyloguj */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* logo | sezon (na środku) | język, profil, wyloguj */
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  background: var(--topbar-bg);
  color: #fff;
}

.brand { justify-self: start; display: inline-flex; align-items: center; padding: 0.15rem 0; }
.brand img { display: block; height: 35px; width: auto; }
.brand:hover img { opacity: 0.85; }

.topbar-center { justify-self: center; }
.topbar-user { display: flex; justify-self: end; align-items: center; gap: 1rem; font-size: 0.9rem; }

.profile { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0.6rem 0.2rem 0.2rem; border-radius: 999px; color: #fff; text-decoration: none; }
.profile:hover, .profile.active { background: rgba(255, 255, 255, 0.12); }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
}

form.inline { display: inline; margin: 0; }

.btn-ghost {
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: transparent;
  color: #fff;
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

/* przełącznik języka (src/i18n.php → language_switch) – na ciemnym pasku i na ekranie logowania */
.lang-switch { display: inline-flex; margin: 0; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 6px; overflow: hidden; }
.lang-switch button { padding: 0.3rem 0.55rem; border: 0; background: transparent; color: rgba(255, 255, 255, 0.75); font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.lang-switch button + button { border-left: 1px solid rgba(255, 255, 255, 0.35); }
.lang-switch button:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.lang-switch button.active { background: var(--accent); color: #fff; cursor: default; }
/* przełącznik sezonu (src/season.php → season_switch) – wybrany sezon + strzałka, lista sezonów pod spodem */
.topbar-season { position: relative; }
.topbar-season summary { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.6rem; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 6px; color: #fff; font-size: 0.85rem; cursor: pointer; list-style: none; user-select: none; }
.topbar-season summary::-webkit-details-marker { display: none; }
.topbar-season summary::after { content: ""; width: 0.4rem; height: 0.4rem; margin-left: 0.15rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform 0.15s; }
.topbar-season[open] summary::after { transform: translateY(1px) rotate(225deg); }
.topbar-season summary:hover, .topbar-season[open] summary { background: rgba(255, 255, 255, 0.1); }
.topbar-season-label { color: rgba(255, 255, 255, 0.75); }
.topbar-season.season-other summary { border-color: var(--accent); background: var(--accent); }   /* oglądany inny niż bieżący */
.topbar-season-static { display: inline-flex; gap: 0.35rem; padding: 0.3rem 0.6rem; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; font-size: 0.85rem; }
.topbar-season-static.season-other { border-color: var(--accent); background: var(--accent); }
.season-notice { padding: 0.45rem 1.5rem; background: var(--red-bg); border-bottom: 1px solid var(--red-border); color: var(--red-text); font-size: 0.9rem; font-weight: 600; }
.season-menu { position: absolute; left: 50%; transform: translateX(-50%); top: calc(100% + 0.35rem); z-index: 50; display: flex; flex-direction: column; min-width: 11rem; margin: 0; padding: 0.3rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.season-menu button { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.45rem 0.6rem; border: 0; border-radius: 5px; background: transparent; color: var(--text, inherit); font-size: 0.9rem; text-align: left; cursor: pointer; }
.season-menu button:hover { background: rgba(0, 0, 0, 0.06); }
.season-menu button.active { font-weight: 700; color: var(--accent); }
.season-current { font-size: 0.75rem; font-weight: 400; color: var(--muted, #777); }
.login-page .lang-switch { position: fixed; top: 1rem; right: 1rem; background: rgba(16, 16, 20, 0.6); }

/* drugi pasek: zakładki aplikacji */
.tabs { background: var(--surface); border-bottom: 1px solid var(--border); }
.tabs-inner { display: flex; gap: 0.25rem; padding: 0 1.5rem; overflow-x: auto; }

.tabs a {
  padding: 0.8rem 0.9rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}

.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }

.content { max-width: 1680px; margin: 0 auto; padding: 2rem 1.5rem; }

.empty { color: var(--muted); }

.budget-season {
  display: inline-block;
  margin-bottom: 1.25rem;
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- strona główna: pulpit --- */

.dash-label { margin: 0; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.dash-hero  { margin-top: 0.2rem; font-size: clamp(2.5rem, 6vw, 3.5rem); font-weight: 800; line-height: 1.1; color: var(--text); }
.dash-sub   { font-size: 0.85rem; }
.value-minus { color: var(--red-text); }

.dash-budget { margin-bottom: 1.25rem; padding: 1.75rem 2rem; }

/* pasek: wydano | do zapłaty | wolne – 2 px przerwy między segmentami, bez obramowań */
.budget-track {
  position: relative;
  display: flex;
  gap: 2px;
  height: 18px;
  margin: 1.5rem 0 0.6rem;
  border-radius: 9px;
  background: var(--bg);
}
.seg { height: 100%; min-width: 4px; }
.seg:first-child { border-radius: 9px 0 0 9px; }
.seg:last-of-type { border-radius: 0 9px 9px 0; }
.seg:only-of-type { border-radius: 9px; }
.seg-expense, .dot-expense { background: var(--bar-expense); }
.seg-topay,   .dot-topay   { background: var(--bar-topay); }
.seg-free,    .dot-free    { background: var(--bar-free); }

/* gdzie kończą się zebrane pieniądze (gdy brakuje) */
.income-mark { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--text); }
.income-mark span { position: absolute; top: -1.3rem; left: 50%; transform: translateX(-50%); font-size: 0.7rem; color: var(--text); white-space: nowrap; }

.budget-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin: 0; padding: 0; list-style: none; font-size: 0.9rem; }
.budget-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.legend-alert { color: var(--red-text); font-weight: 600; }

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.kpi-value { margin-top: 0.2rem; font-size: 1.5rem; font-weight: 700; white-space: nowrap; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.dash-grid .card, .card + .card { position: relative; }
#statusy, #statusy + .card { margin-bottom: 1.25rem; }
.card-link { display: inline-block; margin-top: 0.75rem; color: var(--accent); font-size: 0.85rem; font-weight: 600; text-decoration: none; }

.pool-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.9rem; }
.pool-row { display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; }
.pool-track { height: 8px; margin: 0.35rem 0 0.25rem; border-radius: 4px; background: var(--bg); overflow: hidden; }
.pool-track span { display: block; height: 100%; border-radius: 4px; background: var(--bar-expense); }

.attention-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.attention-list a {
  display: flex; align-items: baseline; gap: 0.5rem;
  padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--bg);
  color: var(--text); text-decoration: none;
}
.attention-list a::before { content: "●"; color: var(--bar-topay); font-size: 0.8rem; }
.attention-list a:hover { background: #eceef1; }
.attention-list strong { font-size: 1.1rem; }

.table-plain { border: 0; border-radius: 0; }
.status-matrix th[scope="row"] a, .status-matrix td a { color: var(--text); text-decoration: none; font-weight: 600; }
.status-matrix td a:hover, .status-matrix th[scope="row"] a:hover { color: var(--accent); text-decoration: underline; }
.status-matrix td.muted { color: #c3c7ce; }

.recent-list { margin: 0; padding: 0; list-style: none; }
.recent-list li { display: grid; grid-template-columns: 3.2rem 1fr auto; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.recent-list li:last-child { border-bottom: 0; }
.recent-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.recent-amount { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --- wspólne --- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.page-head h1 { margin: 0; font-size: 1.5rem; }
.page-head .budget-season { margin: 0; }

.muted { color: var(--muted); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary { background: var(--accent); color: #fff; border: 0; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }

/* --- panel części: suma --- */

.summary-bar {
  margin-bottom: 1rem;
  padding: 1.1rem 1.5rem;
  background: var(--topbar-bg);
  color: #fff;
  border-radius: 12px;
}

.summary-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2.5rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}

.summary-static { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 2.5rem; }

.summary-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 6px; border-radius: 4px; }

.summary-item { display: flex; flex-direction: column; }
.summary-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; }
.summary-value { font-size: 1.6rem; font-weight: 800; white-space: nowrap; }
.summary-sub { font-size: 0.8rem; opacity: 0.7; }

.summary-chevron {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-left: auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.6rem;
  line-height: 1;
  transition: transform 0.15s, background 0.15s;
}
.summary-toggle:hover .summary-chevron { background: rgba(255, 255, 255, 0.2); }
.summary-toggle[aria-expanded="true"] .summary-chevron { transform: rotate(180deg); }

.summary-more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 3rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.summary-total .summary-value { color: #86efac; }
.summary-note { margin-top: 0.75rem; font-size: 0.8rem; opacity: 0.7; }

/* --- panel części: filtry --- */

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.field label { margin: 0 0 0.25rem; font-size: 0.8rem; color: var(--muted); }
.field-wide { grid-column: span 2; }

.filters input[type="search"],
.filters input[type="date"],
.filters input[type="number"],
.filters select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
  font-size: 0.9rem;
}

.filters-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.checkbox { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0 auto 0 0; font-weight: 400; font-size: 0.9rem; }
/* pasek filtrów: checkboxy razem po lewej, przyciski po prawej – odstęp „auto” tylko za ostatnim checkboxem
   (gdy każdy miał auto, wolne miejsce dzieliło się między nie i kolejny checkbox lądował na środku) */
.checkbox-inline { margin-right: auto; }
.filters-actions .checkbox { margin-right: 0; }
.filters-actions .checkbox:not(:has(~ .checkbox)) { margin-right: auto; }
.btn-right { margin-left: 0.5rem; }

/* --- tabele --- */

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th,
.data-table td { padding: 0.55rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-table thead th { background: var(--bg); color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--text); }
.sort-arrow { margin-left: 0.25rem; font-size: 0.7rem; }

.parts-table tbody tr.part-row:hover { background: #fafbfc; }
.parts-table td { white-space: nowrap; }
.parts-table td:nth-child(3) { white-space: normal; min-width: 12rem; }   /* nazwa może się łamać */

.col-toggle { width: 2rem; padding-right: 0 !important; }
.row-toggle { width: 1.75rem; height: 1.75rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--muted); line-height: 1; }
.row-toggle:hover { color: var(--text); }

/* elementy normalne: wąskie kolumny ilości per dział */
.standard-table th.col-dem,
.standard-table td.col-dem { width: 4.5rem; color: var(--muted); }
.standard-table td.col-dem:not(:empty) { color: var(--text); font-weight: 600; }
.standard-table td:nth-child(3) { min-width: 0; }

.row-cancelled td { color: var(--muted); }
.row-cancelled td:nth-child(3) { text-decoration: line-through; }

/* rekord oznaczony jako błędny (src/wrong.php) – czerwonawe tło + pasek po lewej */
.row-wrong td { background: var(--error-bg); }
.row-wrong td:first-child { box-shadow: inset 4px 0 0 var(--error-text); }
.wrong-box { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
.wrong-box input[type="text"] { flex: 1 1 18rem; max-width: 30rem; }
.wrong-box-on { padding: 0.5rem 0.75rem; border-left: 4px solid var(--error-text); background: var(--error-bg); border-radius: 4px; }
.wrong-flag { font-weight: 600; color: var(--error-text); }

.part-details td { background: #fafbfc; white-space: normal; }
.details-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem 1.5rem; margin: 0.25rem 0; }
.details-grid dt { font-size: 0.75rem; color: var(--muted); }
.details-grid dd { margin: 0; }

/* plakietki statusu – kolor zawsze z nazwą statusu */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.badge-draft     { background: #eceef1; color: #3f444c; }
.badge-todo      { background: #fef3c7; color: #78350f; }
.badge-progress  { background: #dbeafe; color: #1e3a8a; }
.badge-done      { background: var(--green-bg); color: var(--green-text); }
.badge-cancelled { background: #eceef1; color: #6b7079; text-decoration: line-through; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 1.25rem; margin-top: 1rem; font-size: 0.9rem; }
.pagination a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* --- akcje i komunikaty --- */

.actions-bar { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.btn-add { padding: 0.6rem 1.2rem; font-size: 0.95rem; }

.alert-success { margin-bottom: 1rem; background: var(--green-bg); color: var(--green-text); }

/* --- okno (dialog) --- */

.modal {
  width: min(960px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal::backdrop { background: rgba(15, 17, 21, 0.55); }

.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 { margin: 0; font-size: 1.15rem; }

.modal-close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
}

.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 1rem 1.5rem; overflow-y: auto; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 14px 14px;
}

.form-group { margin: 0 0 1rem; padding: 0; border: 0; }
.form-group legend { padding: 0; margin-bottom: 0.5rem; font-weight: 700; font-size: 0.9rem; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem 1rem; }
.form-field-wide { grid-column: 1 / -1; }

.form-field label { margin: 0 0 0.25rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
  font-size: 0.9rem;
}

.form-field textarea { resize: vertical; }

.has-error input,
.has-error select,
.has-error textarea { border-color: var(--error-text); background: var(--error-bg); }

.field-error { margin-top: 0.25rem; font-size: 0.8rem; color: var(--error-text); }
.req { color: var(--accent); }
.form-hint { margin: 0; font-size: 0.8rem; color: var(--muted); }

/* --- faktura w oknie części --- */

.invoice-box { padding: 1rem; border: 1px dashed var(--border); border-radius: 10px; }
.invoice-box legend { padding: 0 0.4rem; }
.has-error-box { border-color: var(--error-text); }
.invoice-box > .checkbox { margin: 0; font-weight: 600; }
.inv-open { display: block; margin-top: 0.75rem; }
#inv-panel { margin-top: 0.75rem; }
.inv-mode { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-bottom: 0.75rem; }
.inv-mode .checkbox { margin: 0; }
.inv-expense-toggle { margin: 1rem 0 0.5rem; }
.inv-position { margin-top: 0.75rem; }
.form-field input[type="file"] { padding: 0.3rem; }

.details-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.details-actions .btn-secondary,
.details-actions .btn-danger { padding: 0.35rem 0.8rem; font-size: 0.85rem; }

.btn-danger {
  border: 1px solid var(--red-border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--red-text);
  font-weight: 600;
}
.btn-danger:hover { background: var(--red-bg); }

.checkbox-field { margin-top: 1.55rem; font-weight: 600; font-size: 0.9rem; }
.alert-block { margin-bottom: 1rem; }
#inv-info { margin: 0; font-size: 0.9rem; }
input[readonly] { background: var(--bg); color: var(--muted); }

/* --- przygotówki --- */

.alert-info { background: #dbeafe; color: #1e3a8a; }
.modal-narrow { width: min(620px, calc(100vw - 2rem)); }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.85rem; }

/* --- słowniki --- */

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.subtabs a {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.subtabs a:hover { color: var(--text); }
.subtabs a.active { background: var(--topbar-bg); border-color: var(--topbar-bg); color: #fff; font-weight: 600; }
/* pasek pod paskiem (np. CCBOM: systemy wybranego działu) – wcięty, z kreską po lewej */
.subtabs:has(+ .subtabs-nested) { margin-bottom: 0.5rem; }
.subtabs-nested { margin-left: 0.75rem; padding-left: 0.75rem; border-left: 2px solid var(--border); }
.subtabs-nested a { font-size: 0.8rem; padding: 0.25rem 0.7rem; }
.subtabs-nested a.active { background: var(--surface); border-color: var(--topbar-bg); color: var(--text); }
/* pigułki z checkboxem (CCBOM: działy i systemy – kilka naraz); zaznaczona – pokolorowana */
fieldset.pick-pills { border: 0; padding: 0; min-width: 0; gap: 0.5rem; }
fieldset.subtabs-nested.pick-pills { padding: 0.15rem 0 0.15rem 0.85rem; border-left: 3px solid var(--border); }
.pick-pills:has(+ .subtabs-nested) { margin-bottom: 0.6rem; }
/* label i a w jednej wielkości: zerowane globalne „label” (margines 1rem, pogrubienie, 0.9rem) */
.pick-pills .pill { display: inline-flex; align-items: center; gap: 0.45rem; box-sizing: border-box; margin: 0; padding: 0.5rem 1.05rem; line-height: 1.2;
  font-weight: 400; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 0.92rem; text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none; }
.pick-pills .pill:hover { border-color: var(--muted); background: var(--bg); }
.pick-pills .pill input { width: 1rem; height: 1rem; margin: 0; accent-color: #fff; cursor: pointer; }
.pick-pills .pill input:focus { outline: none; }
.pick-pills .pill:has(input:checked), .pick-pills a.pill.active { background: var(--topbar-bg); border-color: var(--topbar-bg); color: #fff; font-weight: 600; }
.pick-pills .pill:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* wszystkie pigułki (też „Wszystkie…” i systemy w pasku pod spodem) – ta sama wielkość co działy */
.subtabs-nested.pick-pills .pill:has(input:checked) { background: var(--accent); border-color: var(--accent); }

.dict-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.dict-head h2 { margin: 0; }
.dict-head p { margin: 0; flex-basis: 100%; }
.filters-compact { grid-template-columns: minmax(200px, 420px) 1fr; }
.dict-table td { white-space: nowrap; }
/* td zostaje komórką tabeli (flex na td psuł obramowanie wierszy) – przyciski w linii, do prawej */
table td.row-actions { text-align: right; white-space: nowrap; }
.row-actions > * { vertical-align: middle; }
.row-actions > form.inline { display: inline-flex; } /* bez spacji z kodu HTML wokół przycisku */
table td.row-actions > * + * { margin-left: 0.4rem; } /* silniejsze niż form.inline { margin: 0 } */
/* przycisk niedostępny (np. Role → rola systemowa) – wyszarzony, bez reakcji */
button[disabled] { opacity: 0.45; cursor: not-allowed; filter: grayscale(1); }
button[disabled]:hover { filter: grayscale(1); }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.4rem 1rem; }
.checkbox-grid .checkbox { margin: 0; }

/* --- profil --- */

.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; }
.card { padding: 1.25rem 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

/* panel admina → Role: formularz z macierzą uprawnień */
.role-form { margin-top: 1.5rem; }
.role-form .form-field { max-width: 24rem; margin-bottom: 1rem; }
.perm-table { width: auto; }
.perm-table td, .perm-table th[scope="col"] { text-align: center; }
.perm-table th[scope="row"] { text-align: left; font-weight: 600; padding-right: 1.5rem; }
.perm-table .perm-all { border-right: 2px solid var(--border); }
.perm-table input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
.form-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

/* panel admina → Tłumaczenia */
.tr-table td { vertical-align: top; }
.tr-table textarea { width: 100%; min-width: 16rem; font: inherit; font-size: 0.85rem; resize: vertical; }
.tr-token code { font-size: 0.75rem; color: var(--muted); word-break: break-all; }
.tr-missing textarea { border-color: var(--error-text); background: var(--error-bg); }
.card h2 { margin: 0 0 1rem; font-size: 1.05rem; }
.card-submit { margin-top: 1rem; }

/* --- portfel --- */

.badge-cancelled-red { background: var(--red-bg); color: var(--red-text); }
.amount-plus  { color: var(--green-text); font-weight: 600; }
.amount-minus { color: var(--red-text); font-weight: 600; }
.unpaid-card { margin-bottom: 1.25rem; border-color: var(--red-border); }
.unpaid-card .table-wrap { border: 0; }


/* --- panel admina --- */


.season-add { max-width: 640px; margin-top: 1.5rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.inline-form label { margin: 0; }
.inline-form input[type="text"] { padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; }

.badge-dev { background: var(--topbar-bg); color: #fff; }

@media (max-width: 480px) {
  .topbar-user .profile span:last-child { display: none; }
  .field-wide { grid-column: 1 / -1; }
}

/* --- sekcje z własnym paskiem (C&M): przycisk po prawej stronie głównego paska, pasek zakładek pod nim --- */

.tabs a.tab-section { margin-left: auto; font-weight: 600; color: var(--text); }
.tabs-sub { background: var(--bg); }
.tabs-sub a { padding: 0.55rem 0.9rem; font-size: 0.9rem; }

/* --- Cost and Manufacturing --- */

.cm-problem { color: var(--error-text); font-size: 0.85rem; }
.cm-method { margin-bottom: 1.5rem; }
.cm-method h2 { margin-top: 0; }
.cm-gap { margin-top: 1rem; }
.cm-dept-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; margin: 1.75rem 0 0.6rem; }
.cm-dept-head .muted { font-size: 0.9rem; font-weight: 400; }
.cm-total th, .cm-total td { font-weight: 600; background: var(--bg); }

/* --- okno eksportu --- */
.export-formats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.export-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }

/* --- Faktury: pozycje dokumentu w rozwiniętym wierszu --- */
.invoice-items { margin-top: 0.75rem; background: var(--surface); }
.invoice-items th, .invoice-items td { font-size: 0.85rem; padding: 0.35rem 0.6rem; }

/* --- zwykłe linki w treści (tabele, szczegóły, komunikaty) – kolor zespołu zamiast domyślnego niebieskiego / fioletowego;
       :where – zerowa waga, więc style konkretnych miejsc (pulpit, przyciski, zakładki) wygrywają --- */
:where(.content a:not([class])) { color: var(--accent); font-weight: 600; text-decoration: none; }
:where(.content a:not([class])):hover { color: var(--accent-dark); text-decoration: underline; }
:where(.content a:not([class])):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
:where(.content .alert a:not([class])) { color: inherit; text-decoration: underline; }

/* --- okno „Ustaw własne hasło” (public/password.php) – obowiązkowe po haśle jednorazowym --- */
.password-box { max-width: 440px; }
.password-title { margin: 0 0 0.5rem; font-size: 1.25rem; }
.password-intro { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.password-hint { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.8rem; }
.password-box .field-error { margin: 0.25rem 0 0; }
.password-box input[aria-invalid="true"] { border-color: var(--error-text); }
.login-box .password-logout button[type="submit"] { width: auto; margin: 1rem auto 0; display: block; padding: 0.3rem 0.6rem; background: none; color: var(--muted); font-weight: 400; text-decoration: underline; }
.login-box .password-logout button[type="submit"]:hover { background: none; color: var(--text); }

/* --- Zobowiązania sponsorskie: pasek postępu, zadania do odhaczenia --- */
.ob-progress { display: inline-block; width: 4.5rem; height: 0.45rem; margin-right: 0.4rem; vertical-align: middle; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.ob-progress span { display: block; height: 100%; background: var(--green-text); }
.ob-tasks { list-style: none; margin: 0 0 1rem; padding: 0; }
.ob-task { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.ob-task:last-child { border-bottom: 0; }
.ob-task-form { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1.5fr) minmax(180px, 2fr) minmax(140px, 1.5fr) auto; gap: 0.4rem 0.75rem; align-items: center; }
.ob-task-form input[type="url"], .ob-task-form input[type="text"] { width: 100%; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 0.85rem; }
.ob-check { margin: 0; font-weight: 600; }
.ob-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--green-text); }
.ob-who { font-size: 0.85rem; }
.ob-task.is-done .ob-check { color: var(--muted); text-decoration: line-through; }
@media (max-width: 900px) { .ob-task-form { grid-template-columns: 1fr; } }
