:root {
  --bg: #f2f6f6;
  --panel: #ffffff;
  --panel-2: #edf3f3;
  --panel-3: #e2ebeb;
  --border: #dae4e4;
  --text: #0b1a1d;
  --text-dim: #5f7377;
  --accent: #f67608;
  --accent-2: #fc931f;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #c97a12;
  --chart-1: #053a41;
  --chart-2: #0b5c66;
  --chart-3: #1c7c84;
  --chart-4: #2a9da6;
  --chart-5: #8fcdd2;

  --sidebar-bg: #053a41;
  --sidebar-text: #9fb3b6;
  --sidebar-text-active: #ffffff;
  --sidebar-hover-bg: rgba(255, 255, 255, .06);
  --sidebar-active-bg: var(--accent);
  --sidebar-border: rgba(255, 255, 255, .09);
  font-size: 14px;
}

:root[data-theme="dark"] {
  --bg: #0b1214;
  --panel: #101a1c;
  --panel-2: #162224;
  --panel-3: #1e2b2e;
  --border: #263537;
  --text: #eaf1f1;
  --text-dim: #8ba3a6;
  --accent: #fc931f;
  --accent-2: #f67608;
  --green: #22c55e;
  --red: #f05252;
  --amber: #e0a23a;
  --chart-1: #2a9da6;
  --chart-2: #1c7c84;
  --chart-3: #6fc2c9;
  --chart-4: #044f58;
  --chart-5: #a6dade;
}

:root[data-theme="dark"] .role-badge.admin { background: rgba(139, 92, 246, .18); color: #c4b5fd; }
:root[data-theme="dark"] .role-badge.manager { background: rgba(79, 139, 255, .18); color: #93c5fd; }
:root[data-theme="dark"] .role-badge.pracownik { background: rgba(34, 197, 94, .16); color: #86efac; }
:root[data-theme="dark"] .login-box,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] table,
:root[data-theme="dark"] .modal-box,
:root[data-theme="dark"] .rev-modal-box,
:root[data-theme="dark"] .dish-detail,
:root[data-theme="dark"] .settings-card,
:root[data-theme="dark"] .user-dropdown,
:root[data-theme="dark"] .import-dropdown-menu {
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body { transition: background-color .2s ease, color .2s ease; }

/* ---------- Animacje: bazowe przejscia + wejscia elementow ---------- */
button, input, select, textarea, a {
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

/* Pola tekstowe wielowierszowe domyslnie sa w czcionce monospace - ujednolicamy z reszta UI. */
input, select, textarea, button { font-family: inherit; }
textarea { font-size: 14px; line-height: 1.4; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes viewFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

#app.view-enter { animation: viewFadeIn .22s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

.trend-bar {
  height: 8px;
  min-width: 2px;
  background: var(--accent);
  border-radius: 4px;
}

.hidden { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- App shell / sidebar ---------- */
html, body { height: 100%; }
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 246px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: transform .2s ease;
}

.sidebar-brand { padding: 20px 20px 16px; white-space: nowrap; }
.brand-logo { height: 20px; display: block; filter: invert(1) brightness(1.8); }

#nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
}

#nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  transition: color .12s, background-color .12s;
}
.nav-icon { flex-shrink: 0; opacity: .85; }
.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sidebar-text);
  opacity: .55;
  padding: 16px 12px 6px;
}
.nav-section-label:first-child { padding-top: 4px; }
#nav button:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover-bg); }
#nav button.active { color: var(--sidebar-text-active); background: var(--sidebar-active-bg); }
#nav button.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Powiadomienia i Ustawienia - przeniesione z gornego paska nad wybor lokalu
   (klient 2026-10-12: "wszystko w jednym miejscu", gorny rog pusty). */
.sidebar-actions { display: flex; flex-direction: column; gap: 2px; }
.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  transition: color .12s, background-color .12s;
}
.sidebar-action-btn:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover-bg); }
.sidebar-action-btn.active { color: var(--sidebar-text-active); background: var(--sidebar-active-bg); }
.sidebar-action-btn .notif-badge { position: static; margin-left: auto; box-shadow: none; }
/* Dropdown otwiera sie w prawo, obok menu, wyrownany do dolu dzwonka */
.sidebar-actions .notif-dropdown { top: auto; bottom: 0; left: calc(100% + 20px); right: auto; }

/* Naglowek strony z akcjami po prawej (Importuj, przelacznik daty) */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head h1 { margin: 0; }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Oczko "pokaz haslo" w polach hasla w modalach */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { width: 100%; padding-right: 44px; }
.pw-wrap .auth-eye { width: 32px; height: 32px; right: 4px; }

#importDropdown { position: relative; }

.content-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-toggle-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 39;
}

.ghost-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 13px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--panel-2); }
.ghost-btn:disabled { opacity: .5; cursor: default; }
/* Domyslny wyglad zaznaczenia dla kazdego .ghost-btn ktory dostaje klase
   .active (zakladki/filtry budowane ad-hoc w wielu widokach) - bez tego
   przycisk "wybrany" wygladal identycznie jak reszta. Bardziej specyficzne
   selektory (np. #entriesTabBar button.active) nadal wygrywaja tam gdzie
   maja wlasny, inny wyglad. */
.ghost-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  font-weight: 600;
}

/* ---------- Filtry-chipy: lzejszy, mniejszy poziom nawigacji niz zakladki
   (np. filtr kategorii POD zakladkami podstrony na Fakturach) ---------- */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-chips-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-right: 2px; }
.filter-chip {
  background: var(--panel); border: 1px solid var(--border); color: var(--text-dim);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
main { padding: 26px 30px 60px; max-width: 1400px; margin: 0 auto; width: 100%; }

h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; color: var(--text); }

.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 150px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card .num { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.card .label { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head .label { margin-top: 0; }

.kpi-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.card-link { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.card-link:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -6px rgba(0,0,0,.14); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card-attn-amber { border-left: 4px solid var(--amber); }
.card-attn-red { border-left: 4px solid var(--red); }
.card-attn-red .num { color: var(--red); }
.card-attn-ok { border-left: 4px solid var(--green); }
.card-attn-ok .num { color: var(--green); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=text], .page-head-actions input[type=text], .toolbar input[type=number], .toolbar select, .toolbar input[type=date] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.toolbar input[type=text] { min-width: 300px; }

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  min-width: 280px;
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.search-dropdown:empty { display: none; }
.search-dropdown-item {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
}
.search-dropdown-item:last-child { border-bottom: none; }
.search-dropdown-item:hover { background: var(--panel-2); }

main { position: relative; }
/* main scrolluje w poziomie tylko na waskich oknach (gdzie tabela 920px
   min-width nie miesci sie obok sidebara) - powyzej tego progu main NIE MA
   ustawionego overflow, bo overflow-x:auto (nawet gdy tresc nigdy realnie
   nie przewija sie w pionie) po cichu wylacza position:sticky wszystkim
   naglowkom tabel wewnatrz (main staje sie "kotwica" sticky zamiast okna
   przegladarki) - stad kolumny naglowka znikaly przy scrollowaniu Kolejki. */
@media (max-width: 1240px) {
  main { overflow-x: auto; }
}
table { width: 100%; min-width: 920px; border-collapse: collapse; background: var(--panel); border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); border: 1px solid var(--border); }
.compact-table { min-width: 0 !important; width: 100%; }
/* Male, zagniezdzone tabele (historia zakupow itp.) nie maja wlasnego scrolla
   pionowego, wiec globalny sticky-header (thead th { position:sticky; top:57px })
   tylko psuje uklad - header odrywa sie od swojej tabeli i "wchodzi" miedzy
   wiersze strony (klient, zrzut 2026-09-16). */
.compact-table thead th { position: static; top: auto; }
/* Kolejka faktur to glowna tabela strony (nie zagniezdzona), wiec sticky
   naglowka dziala tu poprawnie - przywracamy to co compact-table wylaczyl.
   border-radius: 0 bo zaokraglone rogi na sticky headerze wyglądaja dziwnie
   po zjechaniu (header odrywa sie od krawedzi tabeli). */
.queue-table thead th { position: sticky; top: 0; border-radius: 0; }
.alerts-table thead th { border-radius: 0; }
/* Zaokraglenie rogow bez overflow:hidden na <table> (ten tez blokowal
   sticky u dzieci, z tego samego powodu co main wyzej) - domalowujemy
   promien na tle rogowych komorek zamiast przycinac cala tabele. */
thead tr:first-child th:first-child { border-top-left-radius: 12px; }
thead tr:first-child th:last-child { border-top-right-radius: 12px; }
tbody tr:last-child td:first-child { border-bottom-left-radius: 12px; }
tbody tr:last-child td:last-child { border-bottom-right-radius: 12px; }
thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  position: sticky;
  top: 0;
  z-index: 5;
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border); }
/* Data wystawienia w Kolejce ma DWIE linie (data + mniejsze "sprzedaz: ..."),
   wiec domyslne vertical-align:middle centruje CALY dwuliniowy blok - jego
   PIERWSZA linia wtedy wypada NAD srodkiem wiersza, nie NA srodku (tam gdzie
   ladują pozostale, jednoliniowe komorki - Termin platnosci, dropdown
   miesiaca). Klient: obie daty maja stac scentrowane jak reszta wiersza, a
   "sprzedaz" ma zwisac PONIZEJ tego, nie byc czescia symetrycznego
   centrowania. Przesuniecie bloku w dol o polowe wysokosci drugiej linii
   ustawia pierwsza linie dokladnie tam, gdzie stalaby sama (jednoliniowa,
   scentrowana) - wyliczone i zweryfikowane empirycznie w przegladarce.
   (Wczesniejsza proba - wyrownanie obu komorek do gory - byla odrzucona
   przez klienta: "to nie ma byc wszystko na gorze".) */
.queue-issue-date-wrap { transform: translateY(15px); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; transition: background-color .1s ease; }
tbody tr.clickable:hover { background: var(--panel-2); }
.num-col { text-align: right; font-variant-numeric: tabular-nums; }
/* changeBadge() renderuje "strzalka spacja +/-cyfry%" jako jeden ciag tekstu -
   w kolumnie wyrownanej do prawej (num-col) dluzsze/krotsze liczby przesuwaja
   strzalke w lewo/prawo (klient: "zeby te ptaszki i cyfry % byly rowno") -
   wyrownanie do lewej trzyma strzalke w stalym miejscu niezaleznie od dlugosci
   liczby obok niej. */
.change-col { text-align: left; }

/* ---------- Kolejka faktur ---------- */
.queue-cat-sel, .queue-subcat-sel {
  display: block;
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
}
.queue-subcat-sel { margin-top: 6px; }

.queue-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
  white-space: nowrap;
}
.queue-actions button { width: 100%; }

.queue-bulk-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; font-size: 13px; }
.queue-bulk-row select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px;
}
.queue-item-section-sel {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
}
/* szersze, bo opcje pokazuja pelna sciezke "Kategoria / podkategoria / ..." */
.queue-item-section-sel { width: 100%; max-width: 420px; }
/* Pozycja przeniesiona do innej kategorii niz cala faktura - od razu widac,
   ktore pozycje beda liczone gdzie indziej. */
.queue-item-section-sel.is-overridden {
  border-color: var(--accent); color: var(--text); font-weight: 600;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}
.item-cat-badge { margin-top: 3px; font-size: 10.5px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.badge-auto {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.badge-auto--seen {
  background: var(--panel-2);
  border-color: var(--border);
  color: var(--text-dim);
  font-weight: 400;
  opacity: 0.7;
}

.change-up { color: var(--red); font-weight: 600; }
.change-down { color: var(--green); font-weight: 600; }
.change-flat { color: var(--text-dim); }
tr.sel-row > td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.direction-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.direction-badge.direction-up { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.direction-badge.direction-down { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.direction-badge.direction-flat { background: var(--panel-3); color: var(--text-dim); font-weight: 500; }

/* > (bezposrednie dziecko), nie potomek - selektor bez ">" lapal tez komorki
   ZAGNIEZDZONEJ tabeli historii (td w tbody wewnatrz .history-wrap), zerujac
   jej padding i sklejajac wszystkie kolumny w jedna linie (klient, zrzut
   2026-09-16). */
.history-row > td { background: var(--bg); padding: 0; }
.history-wrap { animation: history-wrap-in .18s ease-out; }
@keyframes history-wrap-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.group-header td {
  background: var(--panel-2);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 6px 14px;
}
.history-wrap { padding: 10px 14px 16px 30px; }
.history-wrap table { background: var(--panel-2); }
/* table-layout:fixed daje kazdej kolumnie STALA szerokosc (proporcje ponizej)
   zamiast domyslnego auto-layoutu, ktory w waskim boxie .history-wrap potrafil
   "wyssac" miejsce dla dlugiej nazwy dostawcy i zepchnac numer faktury tak, ze
   wizualnie nachodzil na kolumne "Wartosc brutto" (numery faktur czesto nie
   maja spacji, wiec przegladarka nie mogla ich zwyczajnie zlamac do nowej
   linii - klient, zrzut 2026-09-14). Dlugie wartosci (dostawca/numer) sa teraz
   ucinane wielokropkiem zamiast nachodzic - pelna tresc w title (tooltip). */
/* min-width w px (nie tylko %) - .compact-table ma min-width:0!important, wiec
   bez tego nested table (w kolapsowanym wierszu historii, ktory jest teraz WEZSZY
   odkad usunelismy kilka kolumn z tabeli Produktow) kurczy sie ponizej tresci
   kazdej kolumny i wszystko wizualnie zlewa sie w jedna linie (klient, zrzut
   2026-09-16) - .compact-table-wrap dodaje scroll zamiast dalszego kurczenia. */
.compact-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
.history-table { table-layout: fixed; min-width: 640px; }
.history-table th:nth-child(1), .history-table td:nth-child(1) { width: 11%; }
.history-table th:nth-child(2), .history-table td:nth-child(2) { width: 26%; }
.history-table th:nth-child(3), .history-table td:nth-child(3) { width: 12%; }
.history-table th:nth-child(4), .history-table td:nth-child(4) { width: 9%; }
.history-table th:nth-child(5), .history-table td:nth-child(5) { width: 7%; }
.history-table th:nth-child(6), .history-table td:nth-child(6) { width: 13%; }
.history-table th:nth-child(7), .history-table td:nth-child(7) { width: 22%; }
.history-table td.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Faktury pod rozwinieta kategoria/podkategoria w Finanse -> Wydatki -> Wg
   kategorii (toggleCategorySpendInvoices) - ten sam wzorzec table-layout:fixed
   + ucinanie co .history-table wyzej, ale 4 kolumny zamiast 7. */
.spend-invoices-table { table-layout: fixed; }
.spend-invoices-table th:nth-child(1), .spend-invoices-table td:nth-child(1) { width: 28%; }
.spend-invoices-table th:nth-child(2), .spend-invoices-table td:nth-child(2) { width: 38%; }
.spend-invoices-table th:nth-child(3), .spend-invoices-table td:nth-child(3) { width: 18%; }
.spend-invoices-table th:nth-child(4), .spend-invoices-table td:nth-child(4) { width: 16%; }
/* Wpisy kosztu pracy: notatka w calosci (zawijana), nie ucinana wielokropkiem. */
.spend-labor-table th:nth-child(1), .spend-labor-table td:nth-child(1) { width: 24%; }
.spend-labor-table th:nth-child(2), .spend-labor-table td:nth-child(2) { width: 12%; }
.spend-labor-table th:nth-child(3), .spend-labor-table td:nth-child(3) { width: 48%; }
.spend-labor-table th:nth-child(4), .spend-labor-table td:nth-child(4) { width: 16%; }
.spend-labor-table td.spend-note { white-space: normal; overflow-wrap: anywhere; }
.spend-invoices-table td.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.muted { color: var(--text-dim); }
.empty { color: var(--text-dim); padding: 30px; text-align: center; }

a.pdf-link { color: var(--accent); text-decoration: none; }
a.pdf-link:hover { text-decoration: underline; }

#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  padding: 12px 18px;
  border-radius: 10px;
  display: none;
  max-width: 420px;
  white-space: pre-line;
  font-size: 13px;
  z-index: 100;
}
#toast { cursor: pointer; }
#toast.show { display: block; animation: toastIn .22s cubic-bezier(.2,.8,.2,1); }

.expand-icon { display: inline-block; width: 14px; color: var(--text-dim); }

.dish-detail { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-top: 16px; box-shadow: 0 1px 4px rgba(60, 50, 30, 0.05); }

/* Kafelki statystyk dania */
.dish-detail .summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.dish-detail .summary div {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dish-detail .summary b {
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}
@media (max-width: 640px) {
  .dish-detail .summary { grid-template-columns: repeat(2, 1fr); }
}
.ing-search-panel {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 16px;
}
.ing-search-field label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 6px; }
.ing-search-field input[type=text] { width: 100%; box-sizing: border-box; }
.ing-search-results {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  margin-top: 6px;
}
.ing-search-results:empty { display: none; }
.ing-search-results .search-dropdown-item { font-size: 13px; }
.ing-add-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.ing-add-row .modal-field { margin-bottom: 0; }

.source-tag { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: var(--panel-2); color: var(--text-dim); margin-left: 6px; }
.source-tag.missing { color: var(--amber); border: 1px solid var(--amber); }

.import-dropdown { position: relative; }
.import-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  z-index: 200;
  min-width: 210px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  transform-origin: top right;
  transform: scaleY(0);
  opacity: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
  pointer-events: none;
}
.import-dropdown-menu.open {
  transform: scaleY(1);
  opacity: 1;
  pointer-events: auto;
}
.import-dropdown-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.import-dropdown-menu button:last-child { border-bottom: none; }
.import-dropdown-menu button:hover { background: var(--panel-3, var(--panel)); color: var(--accent); }

.restaurant-switcher { display: flex; align-items: center; gap: 6px; }
/* Przelacznik lokalu - wlasna lista (patrz renderRestaurantSwitcher w app.js).
   Menu otwiera sie W GORE, bo przelacznik siedzi na samym dole sidebara. */
.rs-wrap { position: relative; flex: 1; min-width: 0; }
.rs-trigger {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text-active);
  padding: 6px 10px 6px 6px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background-color .12s, border-color .12s;
}
.rs-trigger:hover, .rs-trigger[aria-expanded="true"] { background: rgba(255, 255, 255, .11); border-color: rgba(255, 255, 255, .18); }
.rs-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rs-trigger-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.rs-trigger-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-text); opacity: .75; }
.rs-trigger-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-chevron { flex-shrink: 0; color: var(--sidebar-text); }
.rs-badge {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  display: flex; align-items: center; justify-content: center;
}
.rs-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .28);
  z-index: 200;
  overflow: hidden;
  animation: popIn .15s cubic-bezier(.2,.8,.2,1);
}
.rs-menu[hidden] { display: none; }
.rs-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 6px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-dim);
}
.rs-count { background: var(--panel-2, var(--bg)); border-radius: 999px; padding: 1px 7px; font-size: 10.5px; letter-spacing: 0; }
.rs-search {
  display: block;
  width: calc(100% - 16px);
  margin: 2px 8px 6px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}
.rs-search:focus { outline: none; border-color: var(--accent); }
.rs-list { max-height: min(320px, 55vh); overflow-y: auto; padding: 2px 6px 6px; }
.rs-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border: none; border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px; font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.rs-item[hidden] { display: none; }
.rs-item .rs-badge { width: 26px; height: 26px; font-size: 10.5px; background: var(--panel-2, var(--bg)); color: var(--text-dim); border: 1px solid var(--border); }
.rs-item:hover, .rs-item:focus-visible { background: var(--panel-2, var(--bg)); outline: none; }
.rs-item.active { font-weight: 700; }
.rs-item.active .rs-badge { background: var(--accent); color: #fff; border-color: var(--accent); }
.rs-item-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-check { flex-shrink: 0; color: var(--accent); }
.rs-empty { padding: 10px 8px; font-size: 12.5px; color: var(--text-dim); }
.rs-empty[hidden] { display: none; }
.restaurant-name-label { color: var(--sidebar-text); font-size: 13px; font-weight: 600; padding: 0 4px; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Powiadomienia (dzwonek + dropdown) ---------- */
.date-field-btn {
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
  color: var(--text-dim);
}
.date-field-btn.active {
  background: #e0f0ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}
[data-theme="dark"] .date-field-btn.active {
  background: #1e3a5f;
  border-color: #60a5fa;
  color: #93c5fd;
}

.notif-wrap { position: relative; }

.notif-btn { position: relative; }

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--bg);
  animation: notif-pop .2s ease-out;
}
@keyframes notif-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.18);
  z-index: 900;
  overflow: hidden;
}
.notif-dropdown.hidden { display: none; }

.notif-dropdown-header {
  padding: 12px 16px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}

.notif-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--panel-2, #f5f5f5); }

.notif-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.notif-item-icon.invoices { background: #dbeafe; color: #1d4ed8; }
.notif-item-icon.alerts   { background: #fef9c3; color: #b45309; }
.notif-item-icon.dishes   { background: #dcfce7; color: #16a34a; }
.notif-item-icon.empty    { background: var(--panel-2, #f5f5f5); color: var(--text-dim); }

.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13.5px; font-weight: 600; }
.notif-item-sub   { font-size: 12px; color: var(--text-dim); margin-top: 1px; }

.notif-item-count {
  background: #e53e3e;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-item-count.zero { background: var(--panel-2, #eee); color: var(--text-dim); }

.notif-dropdown-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}
.notif-refresh-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.notif-refresh-btn:hover { background: var(--panel-2, #f0f0f0); color: var(--text); }

/* ---------- Responsywnosc ---------- */
@media (max-width: 900px) {
  /* Sidebar staje sie panelem "off-canvas": domyslnie schowany za lewa
     krawedzia (translateX), przycisk-hamburger (stale w rogu) go otwiera,
     ciemne tlo (.sidebar-scrim) zamyka po kliknieciu obok. */
  .sidebar-toggle-btn { display: flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 28px rgba(0,0,0,.35);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim.open { display: block; animation: fadeIn .18s ease; }
  /* Bez gornego paska hamburger (fixed, 14px + 36px) lezy na tresci - zostaw mu miejsce */
  main { padding: 64px 14px 50px; }
  /* Topbar: wyrownaj z hamburgerem (14px pozycja + 36px szerokosc + 12px odstep) */
  .sidebar-actions .notif-dropdown { left: 0; right: 0; width: auto; bottom: calc(100% + 8px); }
  /* Przyciski i inputy: minimalny cel dotykowy 44px */
  .ghost-btn { min-height: 38px; }
  .primary-btn { min-height: 38px; }
  .modal-field input, .modal-field select,
  .toolbar input[type=text], .toolbar input[type=date], .toolbar select { min-height: 38px; }
}

@media (max-width: 640px) {
  .brand { font-size: 14px; }
  #nav button { padding: 7px 10px; font-size: 13px; }
  .ghost-btn { padding: 7px 10px; font-size: 13px; }
  main { padding: 64px 10px 50px; }
  h1 { font-size: 17px; }
  h2 { font-size: 15px; }

  .cards { gap: 8px; }
  .card { min-width: 0; flex: 1 1 calc(50% - 8px); padding: 10px 12px; }
  .card .num { font-size: 21px; }

  .toolbar { gap: 8px; }
  .toolbar input[type=text] { min-width: 0; flex: 1 1 100%; }

  table { font-size: 13px; }
  thead th, tbody td { padding: 8px 10px; }
  .history-wrap { padding: 8px 10px 12px 18px; }

  .rs-trigger-name { font-size: 12px; }

  #toast { left: 14px; right: 14px; max-width: none; }

  /* Finance modal on mobile */
  .rev-modal-box { padding: 16px 14px; }
  .rev-form-grid { grid-template-columns: 1fr; gap: 10px; }

  /* Rev days scroll */
  .rev-day-breakdown { gap: 4px; }
  .rev-day-chip { font-size: 10px; padding: 2px 6px; }

  /* Labor form on mobile */
  #laborForm { flex-direction: column; }
  #laborForm input, #laborForm select { width: 100% !important; }

  .ing-add-row { flex-direction: column; align-items: stretch; }
  .ing-add-row .modal-field { width: 100% !important; min-width: 0 !important; }

  table:not(.compact-table):not(.sh-grid) { font-size: 12px; }
  .compact-table td, .compact-table th { padding: 8px 8px; font-size: 12px; }

  .rev-days-scroll { max-height: 50vh; }
}

@media (max-width: 420px) {
  .card { flex: 1 1 100%; }
}

@media (max-width: 480px) {
  .rev-modal-box { max-height: 90vh; overflow-y: auto; }
  .rev-day-total { font-size: 13px; }
  .card .num { font-size: 18px; }
  .card { padding: 10px; }
}

/* ---------- Arkusze kalkulacyjne ---------- */
.sh-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.sh-help-btn { margin-left: auto; border-radius: 50%; width: 30px; height: 30px; padding: 0; font-weight: 700; }
.sh-help-box { max-width: 520px; }
.sh-help-content p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; }
.sh-help-content code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.sh-toolbar input[type=text] {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; min-width: 200px;
}
.sh-toolbar .ghost-btn { padding: 7px 10px; }
.sh-sep { width: 1px; height: 22px; background: var(--border); }

.sh-formula-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sh-cell-ref { font-weight: 700; min-width: 40px; color: var(--accent); }
.sh-formula-bar input[type=text] {
  flex: 1; background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 14px; font-family: "Consolas", monospace;
}

.sh-grid-wrap {
  overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: 4px;
  background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
table.sh-grid { width: auto; min-width: 0; border-collapse: collapse; border-radius: 0; box-shadow: none; }
table.sh-grid th, table.sh-grid td { border: 1px solid var(--border); padding: 0; }
table.sh-grid thead th { position: sticky; top: 0; background: var(--panel-3); z-index: 2; }
.sh-corner { position: sticky; left: 0; z-index: 3; background: var(--panel-3); }
.sh-colhead {
  min-width: 96px; padding: 5px 6px; font-size: 11px; font-weight: 700;
  color: var(--text-dim); text-align: center; user-select: none;
}
.sh-rowhead {
  position: sticky; left: 0; background: var(--panel-3); z-index: 1; font-weight: 700;
  font-size: 11px; color: var(--text-dim); padding: 4px 8px; text-align: center; min-width: 34px; user-select: none;
}
td.sh-cell {
  min-width: 96px; height: 26px; padding: 0; font-size: 13px;
  max-width: 220px; cursor: cell; outline: none;
}
td.sh-cell.sh-selected {
  outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; position: relative;
  box-shadow: 0 0 0 1px var(--panel) inset;
}
td.sh-cell.sh-in-range { background: rgba(37, 99, 235, 0.12); }
.sh-hint { font-size: 12px; margin: -4px 0 10px; }
.sh-cell-display {
  width: 100%; height: 26px; padding: 4px 8px; box-sizing: border-box;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px;
}
td.sh-cell input.sh-cell-input {
  width: 100%; height: 26px; border: none; outline: 2px solid var(--accent); outline-offset: -2px;
  background: var(--panel); color: var(--text); font: inherit; padding: 4px 8px; box-sizing: border-box;
}
td.sh-cell.sh-bold .sh-cell-display, td.sh-cell.sh-bold input.sh-cell-input { font-weight: 700; }
td.sh-cell.sh-italic .sh-cell-display, td.sh-cell.sh-italic input.sh-cell-input { font-style: italic; }
td.sh-cell.sh-align-left .sh-cell-display, td.sh-cell.sh-align-left input.sh-cell-input { text-align: left; }
td.sh-cell.sh-align-center .sh-cell-display, td.sh-cell.sh-align-center input.sh-cell-input { text-align: center; }
td.sh-cell.sh-align-right .sh-cell-display, td.sh-cell.sh-align-right input.sh-cell-input { text-align: right; }

.sh-tabs {
  display: flex; align-items: flex-end; gap: 2px; margin-top: 0; padding: 0 4px;
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.sh-tab {
  background: var(--panel-2); border: 1px solid var(--border); border-bottom: none;
  border-radius: 6px 6px 0 0; padding: 6px 14px; font-size: 12px; color: var(--text-dim);
  cursor: pointer; white-space: nowrap; margin-bottom: -1px;
}
.sh-tab:hover { background: var(--panel-3); }
.sh-tab-active { background: var(--panel); color: var(--text); font-weight: 600; border-bottom: 1px solid var(--panel); }
.sh-tab-add { font-weight: 700; color: var(--accent); padding: 6px 10px; }

/* ---------- Login screen ---------- */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.login-screen.visible { display: flex; }
.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  animation: popIn .25s cubic-bezier(.2,.8,.2,1);
}
.login-brand { margin-bottom: 6px; }
.login-brand-logo { height: 28px; display: block; }
:root[data-theme="dark"] .login-brand-logo { filter: invert(1) brightness(1.6); }
.login-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 24px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-box input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.login-box input:focus { border-color: var(--accent); }
.login-box button[type=submit] {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}
.login-box button[type=submit]:hover { opacity: .9; }
.login-box button[type=submit]:disabled { opacity: .6; cursor: default; }
.login-error { color: var(--red); font-size: 13px; margin: 0; }
.login-link { display: block; text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-dim); text-decoration: none; }
.login-link:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Ekran logowania (auth-*) ----------
   Dwie kolumny: formularz + panel marki (teal z sidebaru, sygnet icon-mr.png).
   Logowanie, 2FA i reset hasla to widoki w tej samej karcie (bez modali),
   zeby uzytkownik nie tracil kontekstu. Stare .login-* zostaja dla
   reset-password/dolacz/pierwsza-konfiguracja. */
.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; }
.auth-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  background: var(--panel);
  overflow-y: auto;
}
.auth-screen.visible { display: grid; }
.auth-main {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  padding: 28px clamp(20px, 5vw, 64px);
}
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth-logo-link { display: block; border-radius: 6px; }
.auth-logo-link:focus-visible, .auth-home:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.auth-home {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px 7px 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--text-dim); text-decoration: none;
  transition: background .15s, color .15s;
}
.auth-home:hover { background: var(--panel-2); color: var(--text); }
.auth-home svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.auth-home:hover svg { transform: translateX(-2px); }
.auth-logo { height: 26px; width: auto; display: block; }
:root[data-theme="dark"] .auth-logo { filter: invert(1); }
.auth-card {
  width: 100%; max-width: 380px; margin: auto;
  padding: 40px 0;
}
.auth-view { animation: authIn .32s cubic-bezier(.2,.8,.2,1); }
@keyframes authIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.auth-title { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin: 0 0 8px; color: var(--text); }
.auth-sub { font-size: 14.5px; line-height: 1.55; color: var(--text-dim); margin: 0 0 28px; }
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-field { display: flex; flex-direction: column; gap: 7px; }
.auth-field label, .auth-label-row label { font-size: 13px; font-weight: 600; color: var(--text); }
.auth-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-input-icon {
  position: absolute; left: 13px; width: 18px; height: 18px; pointer-events: none;
  fill: none; stroke: var(--text-dim); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke .15s;
}
.auth-input-wrap input {
  width: 100%; height: 46px;
  padding: 0 14px 0 42px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; outline: none;
  box-shadow: 0 1px 2px rgba(11, 26, 29, .04);
  transition: border-color .15s, box-shadow .15s;
}
.auth-input-wrap input#loginPassword { padding-right: 46px; }
.auth-input-wrap input:hover { border-color: var(--text-dim); }
.auth-input-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.auth-input-wrap:focus-within .auth-input-icon { stroke: var(--accent); }
.auth-field.is-invalid input { border-color: var(--red); }
.auth-field.is-invalid input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 16%, transparent); }
.auth-eye {
  position: absolute; right: 6px; width: 36px; height: 36px;
  display: grid; place-items: center;
  background: none; border: none; border-radius: 8px; cursor: pointer; color: var(--text-dim);
}
.auth-eye:hover { background: var(--panel-2); color: var(--text); }
.auth-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-eye svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-eye .eye-closed, .auth-eye[aria-pressed="true"] .eye-open { display: none; }
.auth-eye[aria-pressed="true"] .eye-closed { display: block; }
.auth-hint { margin: 0; font-size: 12.5px; color: var(--amber); display: flex; align-items: center; gap: 6px; }
.auth-hint::before { content: "⇪"; font-weight: 700; }
.auth-check { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-dim); cursor: pointer; user-select: none; margin-top: -2px; }
.auth-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.auth-btn {
  position: relative; height: 48px; margin-top: 4px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform .12s, filter .15s, box-shadow .15s;
}
.auth-btn:hover { filter: brightness(1.05); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.auth-btn:disabled { cursor: default; filter: saturate(.7); opacity: .85; }
.auth-btn.is-loading::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
  animation: authSpin .7s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }
.auth-btn-ghost { background: var(--panel-2); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.auth-alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: 10px;
  font-size: 13.5px; line-height: 1.45;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 9%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--red) 28%, transparent);
}
.auth-alert::before { content: "!"; flex: 0 0 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; margin-top: 1px; }
.auth-shake { animation: authShake .4s cubic-bezier(.36,.07,.19,.97); }
@keyframes authShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth-link { color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.auth-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-link-muted { color: var(--text-dim); font-weight: 500; }
.auth-link-muted:hover { color: var(--text); }
.auth-back { display: inline-block; margin-top: 22px; }
.auth-alt { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.auth-note { font-size: 13px; color: var(--text-dim); line-height: 1.55; margin: -12px 0 24px; }
.auth-badge {
  width: 48px; height: 48px; border-radius: 12px; margin-bottom: 20px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent);
}
.auth-badge svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-code {
  height: 60px; width: 100%;
  text-align: center; font-size: 28px; font-weight: 600; letter-spacing: .5em; text-indent: .5em;
  font-variant-numeric: tabular-nums; font-family: "Consolas", ui-monospace, monospace;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-code::placeholder { color: var(--panel-3); }
.auth-code:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.auth-code.is-backup { letter-spacing: .25em; text-indent: .25em; font-size: 22px; }
.auth-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-dim);
}
.auth-copy { margin: 14px 0 0; font-size: 11px; color: var(--text-dim); opacity: .8; }
.auth-side {
  position: relative; overflow: hidden;
  background: #053a41; color: #fff;
  display: flex; align-items: center;
  padding: clamp(32px, 6vw, 80px);
}
.auth-side::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 30%, transparent 75%);
}
.auth-side::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(246,118,8,.28), transparent 65%);
}
.auth-side-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-side-mark { width: 56px; height: 56px; display: block; margin-bottom: 36px; border-radius: 14px; box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 10px 30px rgba(0,0,0,.25); }
.auth-side-title { font-size: clamp(28px, 2.8vw, 38px); line-height: 1.12; letter-spacing: -.025em; font-weight: 700; margin: 0 0 36px; color: #fff; }
.auth-side-title span { color: #fc931f; }
.auth-side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.auth-side-list li { display: flex; gap: 14px; align-items: flex-start; }
.auth-side-list b { display: block; font-size: 15px; font-weight: 600; color: #fff; }
.auth-side-list small { display: block; font-size: 13.5px; color: rgba(255,255,255,.62); margin-top: 3px; line-height: 1.45; }
.auth-side-ico { flex: 0 0 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); }
.auth-side-ico svg { width: 19px; height: 19px; fill: none; stroke: #fc931f; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .auth-side { background: #062c32; }
@media (max-width: 900px) {
  .auth-screen.visible { display: block; }
  .auth-side { display: none; }
  /* dol: miejsce na plywajacy przycisk motywu (.theme-toggle-btn, prawy dolny rog) */
  .auth-main { padding: 22px 20px 72px; }
  .auth-card { padding: 28px 0; }
  .auth-title { font-size: 24px; }
  /* 16px - mniejsza czcionka w polu = iOS przybliza strone przy dotknieciu */
  .auth-input-wrap input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-view, .auth-shake { animation: none; }
  .auth-btn.is-loading::before { animation-duration: 1.6s; }
}

/* ---------- User menu ---------- */
.user-menu { display: flex; align-items: center; }
.user-avatar {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  color: var(--sidebar-text-active);
  font-size: 12px;
}
.user-avatar:hover { background: var(--sidebar-hover-bg); }
.user-avatar-info { display: flex; flex-direction: column; min-width: 0; overflow: hidden; text-align: left; }
.user-avatar-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-avatar-role { font-size: 10.5px; color: var(--sidebar-text); opacity: .8; }
.user-avatar::before {
  content: attr(data-initials);
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
  display: none;
}
.user-dropdown.open { display: block; animation: popIn .15s cubic-bezier(.2,.8,.2,1); }
.user-dropdown-header { padding: 12px 14px 8px; border-bottom: 1px solid var(--border); }
.user-dropdown-header .ud-name { font-weight: 600; font-size: 13px; }
.user-dropdown-header .ud-role { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.user-dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 9px 14px; border: none; background: transparent;
  color: var(--text); font-size: 13px; cursor: pointer;
}
.user-dropdown button:hover { background: var(--panel-2); }
.user-dropdown button.danger { color: var(--red); }

/* ---------- Users management view ---------- */
/* overflow:hidden usuniete (byl tu tylko po to, zeby przyciac zaokraglone rogi
   tabeli) - ten sam bug co kiedys global table{overflow:hidden} (patrz sesja
   2026-09-13 w mapie): kazdy overflow!=visible na przodku psuje position:sticky
   naglowka wzgledem strony, wiec naglowek "Login/Rola/..." wjezdzal w glab listy
   i nachodzil na wiersze przy przewijaniu Ustawien -> Uzytkownicy. Zaokraglenie
   rogow i tak jest juz zapewnione globalnie przez naroznikowe komorki (thead
   tr:first-child th:first-child itd., patrz sekcja "table" wyzej). */
.users-table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.users-table-wrap table { min-width: 0; box-shadow: none; border: none; border-radius: 0; }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.role-badge.admin { background: #ede9fe; color: #6d28d9; }
.role-badge.manager { background: #dbeafe; color: #1d4ed8; }
.role-badge.pracownik { background: #f0fdf4; color: #15803d; }

/* ---------- Settings view ---------- */
.settings-menu {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  max-width: 480px; overflow: hidden;
}
.settings-menu-group-header {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 20px 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent);
  border-top: 1px solid var(--border);
}
.settings-menu-group-header:first-child { border-top: none; padding-top: 14px; }
.settings-menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 20px 9px 36px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background .1s ease;
}
.settings-menu-item:last-child { border-bottom: none; }
.settings-menu-item:hover { background: var(--panel-2); }
.settings-menu-item-label {
  display: flex; flex-direction: column; gap: 1px;
}
.settings-menu-item-name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.settings-menu-item-desc { font-size: 11px; color: var(--text-dim); }
.settings-menu-item-right { display: flex; align-items: center; gap: 6px; }
.settings-menu-item-count {
  font-size: 11px; color: var(--text-dim); background: var(--panel-2);
  padding: 2px 7px; border-radius: 10px;
}
.settings-menu-item-chevron { color: var(--border); font-size: 18px; }

.personalization-nested-row { cursor: pointer; }
.personalization-nested-row:hover td { background: var(--panel-2); }
.personalization-nested-chevron { text-align: right; color: var(--text-dim); font-size: 15px; }

.settings-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px 24px; max-width: 560px;
}
.settings-card h2 { margin: 0 0 8px; font-size: 15px; }
.settings-card .muted { font-size: 12px; line-height: 1.5; }
.settings-card form { margin-top: 16px; }

.settings-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.settings-tab-btn {
  background: none; border: none; padding: 10px 16px; font-size: 14px; cursor: pointer;
  color: var(--text-dim); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.settings-tab-btn:hover { color: var(--text); }
.settings-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center; z-index: 1500;
  animation: fadeIn .15s ease;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px 32px; width: 100%; max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  animation: popIn .18s cubic-bezier(.2,.8,.2,1);
}
.modal-box h2 { margin: 0 0 20px; font-size: 16px; }
/* .modal-box domyslnie jest waskie (420px) - dobre do potwierdzen/formularzy,
   ale za ciasne dla tabeli pozycji faktury (nazwy produktow + 3 kolumny
   liczbowe). Ten modyfikator daje wiecej miejsca + ogranicza wysokosc listy
   pozycji, zeby faktura z kilkudziesiecioma pozycjami nie rozciagala modala
   poza ekran (patrz showInvoiceDetailsModal w app.js). */
.modal-box-wide { max-width: 640px; }
.invoice-details-header {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px;
  font-size: 13px; margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.invoice-details-header .label { color: var(--text-dim); font-size: 11px; text-transform: uppercase; }
.invoice-details-items { max-height: 50vh; overflow-y: auto; }
/* thead th globalnie dokuje sie top:57px pod stronowym sticky topbarem
   (.content-topbar) - ale ten box to WLASNY, samodzielny scroll (modal
   szczegolow faktury KSeF / panel Platnosci), bez topbara nad soba. Bez tego
   override naglowek "wjezdzal" 57px w glab listy i nachodzil na wiersze przy
   przewijaniu (klient, zrzut z modala faktury KSeF, 2026-09-14). */
.invoice-details-items thead th { top: 0; }
/* Ten sam problem co invoice-details-items: modal historii logowan ma wlasny
   scroll (max-height 320px), wiec globalne top:57px wjeżdżalo naglowek w glab
   listy. */
.log-history-wrap thead th { top: 0; }

/* Platnosci - layout dwukolumnowy: lista z lewej (przewija sie normalnie ze
   strona), panel szczegolow dokowany z prawej. Klient: "zrob tak jak na
   przykladzie, szczegoly sa z prawej strony" (po tym jak modal okazal sie
   niewygodny - przewijanie strony pod nim wygladalo na zepsute). Sticky
   dziala identycznie jak .sidebar (patrz wyzej) - scrolluje sie window, nie
   jakis wewnetrzny kontener. */
.payments-layout { display: flex; gap: 20px; align-items: flex-start; }
.payments-main { flex: 1; min-width: 0; }
.payments-detail-panel {
  width: 440px; flex-shrink: 0;
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px;
  font-size: 12.5px;
}
.payments-detail-panel h2 { font-size: 16px; margin-bottom: 2px; }
.payments-detail-panel h3 { font-size: 12.5px; margin-bottom: 6px; }
.payments-detail-panel .invoice-details-header {
  gap: 3px 14px; font-size: 12px; margin-bottom: 10px; padding-bottom: 10px;
}
.payments-detail-panel table { min-width: 0; font-size: 11.5px; }
.payments-detail-panel thead th { padding: 6px 8px; font-size: 9.5px; }
.payments-detail-panel tbody td { padding: 5px 8px; }
.payments-detail-empty { text-align: center; padding: 30px 10px; font-size: 12.5px; }
tbody tr.payments-row-selected { background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Klient: "na tamtym zdjeciu wszystko jakby na monitorze, pomniejsz te
   rzeczy, a nie tak rozjechane" - gestsza siatka na CALEJ stronie Platnosci
   (karty KPI/tabela/naglowki), blizej referencyjnego mockupu. Scope tylko do
   .payments-main, zeby nie ruszac .card/table gdzie indziej w apce (Dashboard,
   Finanse tez ich uzywaja i klient ich gestosci nie kwestionowal). */
.payments-main .cards { gap: 10px; margin-bottom: 14px; }
.payments-main .card { padding: 8px 12px; min-width: 120px; }
.payments-main .card .num { font-size: 17px; }
.payments-main .card .label { font-size: 9.5px; }
.payments-main .card-head { margin-bottom: 4px; gap: 6px; }
.payments-main .kpi-icon { width: 20px; height: 20px; }
.payments-main table { min-width: 0; font-size: 12.5px; }
.payments-main thead th { padding: 7px 10px; font-size: 10px; }
.payments-main tbody td { padding: 6px 10px; }
.payments-main h2 { font-size: 14px; margin: 16px 0 8px; }
.payments-main .filter-chips { margin-bottom: 10px; }
.payments-main .toolbar { margin-bottom: 10px; }

@media (max-width: 1100px) {
  .payments-layout { flex-direction: column; }
  .payments-detail-panel { width: 100%; position: static; max-height: none; }
}
.modal-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.modal-field label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.modal-field input, .modal-field select,
.ct-person-row input, .ct-person-row select {
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: 14px;
}
.modal-field input:focus, .modal-field select:focus,
.ct-person-row input:focus, .ct-person-row select:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.primary-btn {
  background: var(--accent); color: #fff; border: none;
  padding: 8px 18px; border-radius: 8px; font-size: 14px;
  font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  transition: background-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.primary-btn:hover { background: var(--accent-2); box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--accent) 45%, transparent); }
.primary-btn:active { transform: translateY(1px); }
.ghost-btn.danger { color: var(--red); }
.ghost-btn.danger:hover { border-color: var(--red); }
/* "Oznacz jako oplacona" w Platnosciach - zielony = akceptacja/sukces, ten
   sam jezyk kolorow co status "Oplacona"/KPI "Oplacone w tym mies." */
.primary-btn.btn-success { background: var(--green); }
.primary-btn.btn-success:hover { background: var(--green); filter: brightness(1.1); box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--green) 45%, transparent); }

/* Revenue modal */
.finance-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rev-modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 500; display: flex; align-items: center; justify-content: center; animation: fadeIn .15s ease; }
.rev-modal.hidden { display: none; }
.rev-modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px 28px; width: 560px; max-width: calc(100vw - 32px); box-shadow: 0 12px 40px rgba(0,0,0,.25); animation: popIn .18s cubic-bezier(.2,.8,.2,1); }
.rev-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.rev-modal-title { font-size: 15px; font-weight: 600; }
.rev-modal-date-row { margin-bottom: 14px; }
.rev-modal-date-row label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }
.rev-modal-date-row input[type=date] { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 6px 10px; border-radius: 8px; font-size: 14px; }

/* Revenue 2-panel form */
.rev-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.rev-panel { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.rev-panel-title { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.rev-panel label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.rev-panel label input { width: 130px; text-align: right; background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 5px 8px; border-radius: 6px; font-size: 13px; }
.rev-panel label input:focus { outline: none; border-color: var(--accent); }
.rev-sum-row { font-size: 13px; color: var(--text-dim); margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.rev-form-footer { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.rev-balance-msg { font-size: 13px; flex: 1; }
.rev-balance-msg.balance-ok { color: #4ade80; }
.rev-balance-msg.balance-err { color: var(--red); }

/* Koszt pracy - karta formularza */
.labor-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.labor-card-title { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.labor-form-grid { display: grid; grid-template-columns: repeat(5, 1fr) auto; gap: 12px; align-items: end; }
.labor-form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); }
.labor-form-grid input, .labor-form-grid select { background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 7px 9px; border-radius: 6px; font-size: 13px; }
.labor-form-grid input:focus, .labor-form-grid select:focus { outline: none; border-color: var(--accent); }
.labor-form-grid button { height: 33px; padding: 0 16px; }
@media (max-width: 900px) {
  .labor-form-grid { grid-template-columns: 1fr 1fr; }
  .labor-form-grid button { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .labor-form-grid { grid-template-columns: 1fr; }
}
/* Formularze kosztu pracy/kosztu bez faktury zyja teraz w modalu "Dodaj wpis"
   (szerokosc stala ~560px, patrz .rev-modal-box) - 5 kolumn zaprojektowanych
   dla pelnej szerokosci strony jest tam zawsze za ciasne, niezaleznie od
   szerokosci okna przegladarki. Breakpointy @media wyzej reaguja na
   viewport, nie na kontener, wiec nigdy sie nie wlaczaly wewnatrz modala -
   wymuszamy tu ten sam waski uklad na stale. */
.rev-modal-box .labor-form-grid { grid-template-columns: 1fr 1fr; }
.rev-modal-box .labor-form-grid button { grid-column: 1 / -1; }
@media (max-width: 480px) {
  .rev-modal-box .labor-form-grid { grid-template-columns: 1fr; }
}

/* PnL section headers */
.pnl-section-header td { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; padding-top: 12px; padding-bottom: 2px; background: none; }

/* Revenue 15-day scroll */
.rev-days-scroll { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.rev-day { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); }
.rev-day--today { border-color: var(--accent); }
.rev-day--filled { flex-direction: column; align-items: stretch; }
.rev-day--empty { cursor: default; }
.rev-day-header { display: flex; align-items: center; gap: 10px; }
.rev-day-label { font-size: 13px; color: var(--text-dim); width: 52px; flex-shrink: 0; }
.rev-day-label--today { color: var(--accent); font-weight: 600; }
.rev-day-total { font-size: 15px; font-weight: 600; flex: 1; }
.rev-day-del { margin-left: auto; opacity: .45; }
.rev-day-del:hover { opacity: 1; }
.rev-day-breakdown { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.rev-day-chip { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--panel); border: 1px solid var(--border); color: var(--text-dim); }
.rev-day-chip--pay { border-color: transparent; background: rgba(99,102,241,.12); color: var(--accent); }
.rev-day-add-btn { font-size: 13px; color: var(--text-dim); background: none; border: 1px dashed var(--border); border-radius: 8px; padding: 4px 14px; cursor: pointer; margin-left: auto; display: block; width: 100%; box-sizing: border-box; margin-top: 6px; }
.rev-day-add-btn:hover { color: var(--accent); border-color: var(--accent); }
.rev-day-add-btn--inline { margin-top: 8px; }
.rev-entry { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 6px; }
.rev-entry:first-of-type { border-top: none; margin-top: 4px; padding-top: 0; }
.rev-entry-header { display: flex; align-items: center; gap: 8px; }
.rev-entry-gross { font-size: 14px; font-weight: 600; flex: 1; }
.rev-entry-notes { font-size: 11px; color: var(--text-dim); margin-top: 4px; font-style: italic; }

/* ---------- Theme toggle ---------- */
.theme-toggle-btn {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 1100;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}
.theme-toggle-btn:hover { border-color: var(--accent); transform: scale(1.06); }

/* Kafelki-menu do wyboru sekcji (kategorie Foodcost, sekcje Personalizacji) -
   klik wchodzi w widok szczegolowy, generyczne (nie tylko dla dan) */
.tile-grid { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; }
.tile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 36px;
  min-width: 180px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tile-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -6px rgba(0,0,0,.14); border-color: var(--accent); }
.tile-name { font-size: 20px; font-weight: 700; color: var(--text); }
.tile-count { color: var(--text-dim); font-size: 13px; margin-top: 6px; }

.checkbox-inline { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-dim); }
.archived-row { opacity: .55; }

/* ---------- Dashboard revenue slider ---------- */
.dash-rev-card { overflow: hidden; }
.dash-rev-body {
  position: relative;
  margin-top: 8px;
  min-height: 64px;
  display: flex;
  align-items: center;
}
.dash-rev-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, color .15s;
  padding: 0;
  z-index: 2;
}
.dash-rev-arrow:hover { border-color: var(--accent); color: var(--accent); }
.dash-rev-arrow-prev { left: 0; }
.dash-rev-arrow-next { right: 0; }
.dash-rev-slide {
  flex: 1;
  text-align: center;
  padding: 0 34px;
  overflow: hidden;
}
.dash-rev-filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.dash-rev-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.dash-rev-slide  { position: relative; overflow: hidden; }
.dash-rev-inner  { position: relative; }
.dash-rev-inner.is-exiting { position: absolute; top: 0; left: 0; right: 0; pointer-events: none; }


/* ---------- Toggle switch (slidebar) ---------- */
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background .2s ease;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s ease;
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(16px); }

.unit-review-row { background: color-mix(in srgb, var(--amber) 10%, transparent); }
.unit-review-row:hover { background: color-mix(in srgb, var(--amber) 18%, transparent); }

/* Wiersz produktu, ktorego historia zakupow jest wlasnie rozwinieta pod nim -
   bez tego, przy dlugiej liscie produktow u dostawcy, nie bylo widac KTORY
   wiersz odpowiada otwartej tabeli historii nizej (klient, 2026-09-16). Lewy
   pasek w kolorze akcentu appki + delikatny "flash" przy otwarciu, zeby oko
   samo zlapalo zmiane bez czekania na przeczytanie tresci. */
tbody tr.product-row-expanded {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
  animation: product-row-flash .5s ease-out;
}
tbody tr.product-row-expanded:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
@keyframes product-row-flash {
  from { background: color-mix(in srgb, var(--accent) 30%, transparent); }
  to { background: color-mix(in srgb, var(--accent) 10%, transparent); }
}
.unit-review-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: color-mix(in srgb, var(--amber) 18%, transparent);
  color: var(--amber);
  margin-left: 6px;
  cursor: help;
}
.stocktake-new-row { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.stocktake-new-row:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }

.unit-review-list { max-height: 320px; overflow-y: auto; margin: 10px 0; }
.unit-review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.unit-review-item:last-child { border-bottom: none; }

.price-sim {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
/* przyciski Zapisz/Uzyj zaraz przy wyniku, ok. 1/5 szerokosci zamiast calej reszty wiersza */
.price-sim-row { display: grid; grid-template-columns: 175px 140px minmax(170px, 22%); justify-content: start; align-items: end; gap: 16px; }
.psim-field { display: flex; flex-direction: column; gap: 5px; }
.psim-lbl { font-size: 12px; color: var(--text-dim); }
.psim-field b { font-size: 18px; font-weight: 600; color: var(--text); line-height: 1.1; }
.psim-unit-wrap { display: flex; align-items: center; gap: 6px; }
.psim-unit { font-size: 13px; color: var(--text-dim); }
.price-sim-row input[type=number] {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 7px 10px; border-radius: 8px; font-size: 14px; width: 110px;
}
.price-sim-basis { font-size: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); color: var(--text-dim); }
.price-sim-row-reverse { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.price-sim-row-reverse input[type=number] { width: 90px; }
.price-sim-row .ghost-btn { font-size: 12px; padding: 6px 9px; display: block; width: 100%; box-sizing: border-box; }
.price-sim-suggest { font-size: 12px; color: var(--text-dim); margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.price-sim-suggest-btn { font-size: 12px; padding: 4px 10px; }

/* Panel historii kosztu */
.cost-history-panel { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.cost-history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cost-history-title { font-size: 13px; font-weight: 600; color: var(--text); }
.cost-history-add-form { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.cost-history-add-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.cost-history-add-row .modal-field { margin-bottom: 0; }
.cost-history-add-row input[type=date],
.cost-history-add-row input[type=number] {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 7px 9px; border-radius: 7px; font-size: 13px; width: 100%;
}
.cost-history-table { width: 100%; }
.cost-history-archived td { opacity: 0.45; }
.cost-history-archived td:first-child::after { content: " (zarchiwizowany)"; font-size: 11px; color: var(--text-dim); }

.bulk-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; margin-bottom: 10px; font-size: 13px; color: var(--text-dim);
}
.bulk-bar.hidden { display: none; }

.confirm-modal-box { max-width: 420px; }
.confirm-modal-message { margin: 0 0 4px; font-size: 14px; line-height: 1.5; color: var(--text); }
.choice-modal-actions { flex-wrap: wrap; justify-content: flex-start; }

/* ---------- Finanse: dashboard ---------- */
.fin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }

.fin-kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.fin-kpi-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.fin-kpi-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.fin-kpi-label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.fin-kpi-head .fin-kpi-label { margin-bottom: 0; }
.fin-kpi-value { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.fin-kpi-delta { font-size: 11px; margin-top: 3px; color: var(--text-dim); }
/* Znaczenie zalezne od metryki (przychod w gore = dobrze, koszt w gore = zle),
   wiec kolor jest przekazywany jako klasa favorable/unfavorable, NIE
   zwiazany z kierunkiem strzalki - stad osobne od .change-up/.change-down
   (te maja odwrotna semantyke: uzywane przy alertach cenowych, gdzie wzrost
   ceny zakupu = zle/czerwone). */
.fin-favorable { color: var(--green); }
.fin-unfavorable { color: var(--red); }
.fin-kpi-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.fin-dashboard-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; align-items: stretch; }
.fin-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.fin-panel h3 { margin: 0 0 14px; font-size: 14px; }

.fin-linechart { width: 100%; height: auto; display: block; }
.fin-linechart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }

.fin-donut-wrap { display: flex; align-items: center; gap: 18px; }
.fin-donut { flex-shrink: 0; }
.fin-donut-legend { list-style: none; margin: 0; padding: 0; font-size: 12px; flex: 1; min-width: 0; }
.fin-donut-legend li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; }
.fin-legend-name { display: flex; align-items: center; gap: 6px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fin-legend-pct { color: var(--text-dim); font-variant-numeric: tabular-nums; flex-shrink: 0; }

.fin-alerts { display: flex; flex-direction: column; gap: 10px; }
.fin-alert { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.fin-alert-icon {
  font-size: 13px; line-height: 1;
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-3);
}
.fin-alert-title { font-weight: 600; font-size: 13px; }
.fin-alert-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.fin-alert--warn .fin-alert-icon { background: color-mix(in srgb, var(--amber) 20%, transparent); }
.fin-alert--bad .fin-alert-icon { background: color-mix(in srgb, var(--red) 16%, transparent); }
.fin-alert--ok .fin-alert-icon { background: color-mix(in srgb, var(--green) 16%, transparent); }

.fin-entries-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.entries-tab-panel.hidden { display: none; }
#entriesTabBar button.active { border-color: var(--accent); color: var(--accent); background: var(--panel-2); }

.entry-type-switch { display: flex; gap: 8px; margin: 4px 0 16px; flex-wrap: wrap; }
.entry-type-switch button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.entry-form-section.hidden { display: none; }

.purchase-items-list { margin: 0 0 14px; }
.purchase-items-list:empty::before { content: "Brak pozycji — dodaj produkt powyzej."; color: var(--text-dim); font-size: 12px; }
.purchase-item-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.purchase-item-row .pir-name { flex: 1; }
.purchase-item-row .pir-remove { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 15px; padding: 0 4px; line-height: 1; }
.purchase-item-row .pir-remove:hover { color: #d33; }

@media (max-width: 1100px) {
  .fin-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .fin-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .fin-dashboard-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .fin-kpi-grid { grid-template-columns: 1fr; }
  .fin-donut-wrap { flex-direction: column; align-items: flex-start; }
  .fin-entries-header { flex-direction: column; align-items: flex-start; }
}


/* -------- Rozliczenia (prime cost) -------- */
.pc-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.pc-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}
/* Kalendarz miesiecy - zakres Od/Do w Rozliczeniach (app.js::_pcBindRangePicker) */
.pc-range { position: relative; }
.pc-range-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s; }
.pc-range-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.pc-range-btn .pc-range-chev { width: 10px; height: 10px; transition: transform .2s; }
.pc-range-btn:hover, .pc-range-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.pc-range-btn[aria-expanded="true"] .pc-range-chev { transform: rotate(180deg); }
.pc-range-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 1000; width: 272px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px -8px rgba(0,0,0,.25); padding: 12px; }
.pc-range-pop[hidden] { display: none; }
.pc-range-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 14px; }
.pc-range-head button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: none; color: var(--text-dim); cursor: pointer; font-size: 17px; line-height: 1; padding: 0; }
.pc-range-head button:disabled { opacity: .35; cursor: default; }
.pc-range-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pc-range-grid button { padding: 9px 0; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 13px; cursor: pointer; }
.pc-range-grid button:hover:not(:disabled) { background: var(--panel-2); }
.pc-range-grid button.in { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.pc-range-grid button.edge { background: var(--accent); color: #fff; font-weight: 600; }
.pc-range-grid button:disabled { opacity: .3; cursor: default; }
.pc-range-hint { margin-top: 10px; font-size: 11.5px; color: var(--text-dim); text-align: center; }
@media (max-width: 700px) { .pc-range-pop { right: auto; left: 0; } }

/* KPI strip */
.pc-kpi-strip {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}
.pc-kpi-item {
  flex: 1;
  padding: 14px 20px;
  border-right: 1px solid var(--border);
}
.pc-kpi-item:last-child { border-right: none; }
.pc-kpi-sep { flex: 0; width: 1px; border-right: 2px solid var(--border); padding: 0; }
.pc-kpi-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.pc-kpi-big {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}
.pc-kpi-big.pc-foodcost { color: #2563eb; }
.pc-kpi-big.pc-labor    { color: #d97706; }
.pc-kpi-big.pc-prime    { color: #dc2626; }
.pc-kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Main prime cost table */
.pc-main-table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13px; }
.pc-main-table thead tr { background: rgba(42,157,166,.1); color: var(--text); border-bottom: 2px solid #1C7C84; }
.pc-main-table thead th {
  padding: 10px 12px;
  font-weight: 600;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
  border: none;
}
.pc-main-table thead th.num-col { text-align: right; }
.pc-main-table thead th { vertical-align: top; }
.pc-main-table thead th.pc-th-dim { color: var(--text-dim); }
.pc-th-title { display: block; }
.pc-th-sub { display: block; margin-top: 2px; font-size: 10px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-dim); opacity: .85; }
.pc-main-table thead th.pc-th-main { border-bottom: 2px solid #2A9DA6; }

/* Week rows */
.pc-wk-row { cursor: pointer; }
.pc-wk-row td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.pc-wk-row:hover td { background: rgba(42,157,166,.06); }
.pc-wk-name { font-weight: 600; white-space: nowrap; }
.pc-wk-range { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.pc-wk-toggle { color: var(--text-muted); font-size: 11px; text-align: center; }

/* Daily expanded rows */
.pc-day-row td { padding: 6px 12px 6px 28px; border-bottom: 1px solid var(--border); font-size: 12px; background: var(--bg-secondary, rgba(0,0,0,.015)); }
.pc-day-date { color: var(--text-muted); }
.pc-rev-mini { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* Manual cost item rows */
.pc-item-row td { padding: 4px 12px 4px 44px; font-size: 11px; color: var(--text-muted); background: var(--bg-secondary, rgba(0,0,0,.015)); border-bottom: 1px solid var(--border); }
.pc-item-label { }
.pc-item-del { text-align: right; }
.pc-item-del .ghost-btn { opacity: .45; font-size: 11px; padding: 0 4px; }
.pc-item-del .ghost-btn:hover { opacity: 1; color: var(--danger, #dc2626); }

/* % colored cells */
.pc-pct-food  { color: #1d6b3e; font-weight: 600; }
.pc-pct-labor { color: #7c4f00; font-weight: 600; }
.pc-pct-prime { color: #9b1c1c; font-weight: 600; }

/* Monthly summary row */
.pc-month-sum td {
  padding: 9px 12px;
  font-weight: 700;
  background: rgba(42,157,166,.1);
  border-top: 2px solid #1C7C84;
  border-bottom: 2px solid #1C7C84;
  font-size: 13px;
}
[data-theme="dark"] .pc-month-sum td { background: rgba(42,157,166,.18); border-color: #1C7C84; }

/* Labor entries table */
.pc-labor-section { margin-top: 28px; }
.pc-labor-header { font-size: 14px; font-weight: 600; margin-bottom: 4px; }

@media (max-width: 700px) {
  .pc-topbar { flex-direction: column; align-items: flex-start; }
  .pc-topbar-right { margin-left: 0; }
  .pc-kpi-strip { flex-direction: column; }
  .pc-kpi-item { border-right: none; border-bottom: 1px solid var(--border); }
  .pc-kpi-item:last-child { border-bottom: none; }
  .pc-week-kpis { gap: 12px; }
  .pc-day-kpis { gap: 12px; }
}

/* ── Revenue Calendar (Finanse → Wpisy → Widok Kalendarz) ── */
.rcal { margin-top: 4px; }
.rcal-header { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; margin-bottom: 2px; }
.rcal-hcell { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-dim); padding: 4px 0; text-transform: uppercase; letter-spacing: .04em; }
.rcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border-radius: 8px; overflow: hidden; }
.rcal-cell { background: var(--panel); padding: 8px; min-height: 90px; cursor: pointer; position: relative; transition: background .12s; }
.rcal-cell:hover { background: var(--panel-2); }
.rcal-cell--other { background: var(--panel-2); opacity: .45; cursor: default; pointer-events: none; }
.rcal-cell--today { outline: 2px solid var(--accent); outline-offset: -2px; }
.rcal-daynum { font-size: 13px; font-weight: 700; color: var(--text-dim); margin-bottom: 4px; }
.rcal-daynum--today { color: var(--accent); }
.rcal-total { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.rcal-entries { display: flex; flex-direction: column; gap: 3px; }
.rcal-entry { background: var(--accent); color: #fff; border-radius: 4px; padding: 3px 6px; font-size: 11px; cursor: pointer; }
.rcal-entry:hover { opacity: .85; }
.rcal-entry-amt { font-weight: 600; margin-right: 4px; }
.rcal-chip { display: inline-block; font-size: 10px; opacity: .85; margin-left: 2px; }
.rcal-add { position: absolute; bottom: 6px; right: 6px; font-size: 16px; color: var(--text-dim); opacity: 0; transition: opacity .12s; line-height: 1; }
.rcal-cell:hover .rcal-add { opacity: .6; }

/* ── Budżetowanie ── */
.budget-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 4px; }
.budget-tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.budget-tabs .tab-btn { background: none; border: none; border-radius: 6px; padding: 6px 16px; font-size: 13px; font-weight: 500; color: var(--text-dim); cursor: pointer; transition: background .12s, color .12s; }
.budget-tabs .tab-btn.active { background: var(--accent); color: #fff; }
.budget-tabs .tab-btn:not(.active):hover { background: var(--panel-2); color: var(--text); }

.budget-month-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.budget-month-label { font-size: 18px; font-weight: 700; min-width: 200px; text-align: center; }
.budget-closed-badge { display: inline-block; background: var(--panel-2); color: var(--text-dim); border-radius: 6px; padding: 6px 14px; font-size: 13px; margin-bottom: 16px; }
.budget-progress-info { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; font-size: 13px; margin-bottom: 20px; line-height: 1.6; }

.budget-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.budget-kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.budget-kpi--ok { border-left: 4px solid var(--color-success, #22c55e); }
.budget-kpi--warn { border-left: 4px solid var(--color-warning, #f59e0b); }
.budget-kpi--bad { border-left: 4px solid var(--color-danger, #ef4444); }
.budget-kpi-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 6px; }
.budget-kpi-actual { font-size: 22px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 8px; }
.budget-kpi-meta { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.budget-kpi-proj { font-size: 11px; color: var(--text-dim); margin-top: 6px; }

.budget-bar-bg { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.budget-bar-fill { height: 100%; border-radius: 3px; transition: width .3s ease; }

.budget-badge { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.budget-badge--ok { background: color-mix(in srgb, var(--color-success, #22c55e) 15%, transparent); color: var(--color-success, #22c55e); }
.budget-badge--warn { background: color-mix(in srgb, var(--color-warning, #f59e0b) 15%, transparent); color: var(--color-warning, #f59e0b); }
.budget-badge--bad { background: color-mix(in srgb, var(--color-danger, #ef4444) 15%, transparent); color: var(--color-danger, #ef4444); }

.budget-plan-form h3 { font-size: 15px; }
.budget-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.budget-form-grid label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-dim); gap: 5px; }
.budget-form-grid input { font-size: 14px; }

/* Symulacja */
.sim-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .sim-layout { grid-template-columns: 1fr; } }
.sim-slider-group { margin-bottom: 18px; }
.sim-slider-group label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.sim-slider-row { display: flex; align-items: center; gap: 10px; }
.sim-slider-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.sim-num-input { width: 105px; -moz-appearance: textfield; appearance: textfield; }
.sim-num-input::-webkit-inner-spin-button, .sim-num-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.sim-num-small { width: 70px; }
.sim-result-grid { display: flex; flex-direction: column; gap: 0; }
.sim-result-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.sim-result-row--sub { padding-left: 12px; font-size: 13px; }
.sim-result-divider { border-top: 2px solid var(--border); border-bottom: none; margin-top: 4px; padding-top: 14px; font-size: 16px; }
.sim-hint { margin-top: 16px; font-size: 12px; color: var(--text-dim); line-height: 1.8; }

/* Historia planów */
.budget-history-table th { white-space: nowrap; }
.budget-history-table td { white-space: nowrap; }

/* ---------- Responsywnosc: uzupelnienia mobilne ---------- */

/* Budzetowanie na malych ekranach */
@media (max-width: 640px) {
  .budget-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .budget-tabs { width: 100%; }
  .budget-tabs .tab-btn { flex: 1; padding: 7px 6px; font-size: 12px; text-align: center; }
  .budget-month-nav { gap: 6px; }
  .budget-month-label { font-size: 15px; min-width: 140px; }
  .budget-kpi-grid { gap: 10px; }
  .budget-kpi { padding: 12px; }
  .budget-kpi-actual { font-size: 18px; }
  .budget-form-grid { grid-template-columns: 1fr; }
  .sim-slider-group label { font-size: 11px; }
  .sim-num-input { width: 100px; }
  .sim-result-row { font-size: 13px; }
}

/* Rozliczenia (prime cost) na malych ekranach */
@media (max-width: 640px) {
  .pc-kpi-lbl { font-size: 10px; }
  .pc-kpi-big { font-size: 18px; }
  .pc-kpi-sub { font-size: 10px; }
  .pc-main-table { font-size: 11px; }
  .pc-wk-row td { padding: 7px 8px; }
  .pc-day-row td { padding: 5px 8px 5px 20px; }
  .pc-item-row td { padding: 4px 8px 4px 30px; }
}

/* Toolbar / filter-chips na malych ekranach: nie wychodz poza szerokosc */
@media (max-width: 640px) {
  .toolbar { flex-wrap: wrap; }
  .toolbar input[type=date], .toolbar select { flex: 1 1 auto; min-width: 0; }
  .filter-chips { gap: 4px; }
  .filter-chip { font-size: 11px; padding: 4px 10px; }
}

/* Cards row: wyrownaj siatke na telefonach 421-639px (2 kolumny, ostatnia pelna) */
@media (min-width: 421px) and (max-width: 639px) {
  .cards { display: grid; grid-template-columns: repeat(2, 1fr); }
  .card { min-width: 0; flex: none; }
}

/* Finanse: fin-toolbar na malych ekranach */
@media (max-width: 640px) {
  .fin-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .fin-toolbar > * { width: 100%; }
  .fin-linechart-legend { flex-wrap: wrap; gap: 8px; }
}

/* Dashboard: karty wskaźnikow bez ucietych wartosci */
@media (max-width: 900px) {
  .dash-rev-amount { font-size: 22px; }
}

/* ---- Supplier combobox (alerty cen) ---- */
.supplier-combo { position: relative; display: inline-flex; align-items: center; }
.supplier-combo input { width: 100%; }
.supplier-combo-list {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 200;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12); max-height: 220px; overflow-y: auto;
}
.supplier-combo-list.hidden { display: none; }
.supplier-combo-item {
  padding: 7px 12px; font-size: 13px; cursor: pointer;
  color: var(--text); border-radius: 0;
  transition: background .1s;
}
.supplier-combo-item:first-child { border-radius: 8px 8px 0 0; }
.supplier-combo-item:last-child { border-radius: 0 0 8px 8px; }
.supplier-combo-item:only-child { border-radius: 8px; }
.supplier-combo-item:hover { background: var(--hover); }

/* Okno "usun i przenies" (showReassignDialog) */
.reassign-modal { max-width: 460px; }
.reassign-usage { margin: 0 0 14px; padding: 10px 14px 10px 30px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; line-height: 1.7; }
.reassign-modal select { width: 100%; }

/* Okienko powiadomien do odhaczenia (maybeShowNotificationsPopup w app.js) */
.np-box { max-width: 560px; padding: 24px 26px; }
.np-box h2 { margin-bottom: 14px; }
.np-invoices { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; margin-bottom: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); font-size: 13.5px; }
.np-list { list-style: none; margin: 0; padding: 0; max-height: min(52vh, 440px); overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.np-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); transition: opacity .2s; }
.np-item:last-child { border-bottom: none; }
.np-item.done { opacity: .45; }
.np-item.done .np-ack { visibility: hidden; }
.np-item.done .np-title { text-decoration: line-through; }
.np-body { flex: 1; min-width: 0; }
.np-title { font-weight: 600; font-size: 14px; }
.np-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.np-pct { font-size: 12px; font-weight: 700; margin-left: 4px; }
.np-pct.up { color: var(--red); }
.np-pct.down { color: var(--green); }
.np-ack { flex: 0 0 auto; white-space: nowrap; }
.acked-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; color: var(--text-dim); background: var(--panel-2); border: 1px solid var(--border); }
@media (max-width: 560px) {
  .np-box { padding: 18px 16px; }
  .np-invoices { flex-direction: column; align-items: flex-start; }
}

/* ===== Podsumowanie - panel powitalny (VIEWS.dashboard) ===== */
.dash-hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 4px 0 22px; }
.dash-hello h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.02em; }
.dash-hello-sub { margin: 0; color: var(--text-dim); font-size: 13.5px; text-transform: none; }
.dash-hello-sub::first-letter { text-transform: uppercase; }
.dash-hello-status { margin: 8px 0 0; font-size: 14px; color: var(--text); }
.dash-status-line { display: block; }
.dash-status-line + .dash-status-line { margin-top: 3px; color: var(--text-dim); }
.dash-status-line + .dash-status-line b { color: var(--text); }
.dash-hello-status:empty { display: none; }
.dash-hello-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.dash-kpi .num, .dash-kpi .dash-rev-amount { white-space: nowrap; font-size: clamp(20px, 1.9vw, 26px); }
.dash-kpi { padding: 14px 16px; }
.dash-kpi { min-width: 0; display: flex; flex-direction: column; }
.dash-kpi .num { line-height: 1.15; }
.dash-kpi-cmp { margin-top: 6px; font-size: 12.5px; min-height: 18px; }
.dash-kpi-foot { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--text-dim); }
.dash-kpi-foot a { color: var(--accent); text-decoration: none; font-weight: 600; }
.dash-delta { font-weight: 700; white-space: nowrap; }
.dash-delta.good { color: var(--green); }
.dash-delta.bad { color: var(--red); }
.dash-delta.flat { color: var(--text-dim); }
.dash-delta-ref { color: var(--text-dim); }
.dash-ok { color: var(--green); font-weight: 600; }
.dash-bad { color: var(--red); font-weight: 600; }
.dash-progress { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; margin-top: 10px; }
.dash-progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.dash-two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 16px; margin-bottom: 24px; }
.dash-two-col-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.dash-panel-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; }
.dash-more { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; }

.dash-todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dash-todo-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); }
.dash-todo-item.tone-amber { border-left: 3px solid var(--amber); }
.dash-todo-item.tone-red { border-left: 3px solid var(--red); }
.dash-todo-item.tone-red .kpi-icon { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.dash-todo-text { flex: 1; min-width: 0; font-size: 13.5px; }
.dash-todo-item .ghost-btn { flex: 0 0 auto; white-space: nowrap; }
.dash-todo-ok { display: flex; gap: 12px; align-items: flex-start; padding: 6px 2px; }
.dash-todo-ok .kpi-icon { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }

.dash-daily-sum { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 6px; }
.dash-daily-sum > div { display: grid; gap: 1px; font-size: 12.5px; }
.dash-daily-sum b { font-size: 18px; letter-spacing: -.01em; }
.dash-daily-svg { width: 100%; height: auto; display: block; }
.dash-bar { fill: color-mix(in srgb, var(--accent) 70%, transparent); }
.dash-bar.wk-alt { fill: color-mix(in srgb, var(--accent) 45%, transparent); }
.dash-bar.today { fill: var(--accent); }
.dash-bar:hover { fill: var(--accent); }
.dash-bar-missing { fill: var(--red); opacity: .55; }
.dash-week-mark { stroke: var(--text); stroke-width: 2; opacity: .55; stroke-linecap: round; }
.dash-axis { stroke: var(--border); }
.dash-tick { font-size: 11px; fill: var(--text-dim); text-anchor: middle; }
.dash-tick.weekend { font-weight: 700; fill: var(--text); }
.dash-tick-wd { font-size: 10px; fill: var(--text-dim); text-anchor: middle; opacity: .8; }
.dash-tick-wd.weekend { font-weight: 700; fill: var(--text); opacity: 1; }
/* Dymek po najechaniu na kolumne dnia (app.js::_bindDashDailyTips) */
.dash-daily-wrap { position: relative; }
.dash-hit { fill: transparent; pointer-events: all; cursor: default; }
.dash-bar.hover, .dash-bar.wk-alt.hover { fill: var(--accent); }
.dash-tip { position: absolute; top: 0; z-index: 5; pointer-events: none; min-width: 170px; max-width: 240px; padding: 8px 11px; border-radius: 9px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 8px 22px -6px rgba(0,0,0,.25); font-size: 12px; line-height: 1.5; color: var(--text-dim); }
.dash-tip b { color: var(--text); }
.dash-tip-date { font-weight: 700; color: var(--text); text-transform: capitalize; margin-bottom: 2px; }
.dash-tip-wk .dash-delta { margin-left: 4px; }
.dash-legend { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 400; color: var(--text-dim); }
.dash-legend-bar { width: 10px; height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 70%, transparent); }
.dash-legend-mark { width: 12px; height: 2px; background: var(--text); opacity: .55; margin-left: 6px; }
.dash-acked { opacity: .6; }

@media (max-width: 1150px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .dash-two-col, .dash-two-col-even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .dash-kpis { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .dash-hello h1 { font-size: 22px; }
  .dash-hello-actions { width: 100%; }
  .dash-hello-actions button { flex: 1; }
  .dash-legend { margin-left: 0; width: 100%; }
}

/* Nowy uzytkownik: imie + nazwisko obok siebie, podglad loginu */
.modal-row-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.modal-row-2 .modal-field { min-width: 0; }
.modal-row-2 input { width: 100%; min-width: 0; box-sizing: border-box; }
.login-preview { font-size: 12.5px; margin: -4px 0 12px; }
@media (max-width: 480px) { .modal-row-2 { grid-template-columns: 1fr; } }

/* Podpis wybranego ukladu przychodu pod tytulem Finansow i Rozliczen (app.js::_renderFinLayoutNote, _pcRender) */
.rev-layout-note{margin:-4px 0 16px;font-size:12.5px;color:var(--text-dim)}
.rev-layout-note b{color:var(--text);font-weight:600}
/* Preferowane ustawienie obok wybranego ukladu przychodu */
.rev-layout-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.rev-layout-pref { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--border); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rev-layout-pref-btn { padding: 2px 10px !important; font-size: 12px !important; min-height: 0 !important; }
.rev-layout-pref-ok { color: var(--green, #16a34a); font-weight: 600; }
@media (max-width: 640px) { .rev-layout-pref { margin-left: 0; padding-left: 0; border-left: none; } }

/* Alerty cen: nowe (nieodhaczone) zmiany wyroznione, widziane przygaszone (app.js::renderAlertsTable) */
.alerts-new-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 12px; font-size: 13px; }
.alerts-new-bar:empty { display: none; }
.alerts-new-count { color: var(--text-dim); }
.alerts-new-count.has-new { color: var(--accent); }
.alerts-new-bar .ghost-btn { font-size: 12px; padding: 4px 12px; }
.alerts-table tr.alert-new > td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.alerts-table tr.alert-new > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.alerts-table tr.alert-new > td:nth-child(2) { font-weight: 600; }
.alerts-table tr.alert-seen > td { opacity: .62; }
.alerts-table tr.alert-seen:hover > td { opacity: 1; }
.new-tag { display: inline-block; margin-right: 4px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: #fff; background: var(--accent); vertical-align: 1px; }
.alert-ack-cell { white-space: nowrap; text-align: right; }
.alert-ack-btn { font-size: 12px; padding: 3px 10px; }

/* Planowanie: "Przenies do celow" z symulacji + krotkie podswietlenie wpisanych pol */
.sim-to-plan-btn { margin-top: 14px; font-size: 13px; padding: 7px 14px; border-color: var(--accent); color: var(--accent); }
.sim-to-plan-btn:hover { background: var(--accent); color: #fff; }
@keyframes bf-filled-flash { from { background: color-mix(in srgb, var(--accent) 22%, var(--panel)); border-color: var(--accent); } to { background: var(--panel); } }
.budget-plan-form input.bf-filled { animation: bf-filled-flash 1.6s ease-out; }

/* Kalkulator ceny na telefonie: pole + wynik obok siebie, przycisk pod nimi */
@media (max-width: 560px) {
  .price-sim-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .price-sim-row .ghost-btn { grid-column: 1 / -1; }
}
/* Znaczek NOWE i nazwa produktu zawsze w jednej linii (bez zawijania "PL" pod spod) */
.alerts-table td.alert-name-cell { white-space: nowrap; }
/* "zobacz liste" w statusie - kolor aplikacji zamiast domyslnego niebieskiego linku */
.dash-hello-status a { color: var(--accent); font-weight: 600; text-decoration: none; }
.dash-hello-status a:hover { text-decoration: underline; }

/* Naglowki sekcji w rozwinieciu kategorii kosztow (wpisy kosztu pracy / faktury) */
.spend-sub-h { font-size: 12px; font-weight: 700; margin: 4px 0 6px; color: var(--text); }
.spend-invoices-table + .spend-sub-h { margin-top: 14px; }

/* ---------- Kontrahenci (ksiazka adresowa) ---------- */
.ct-pending {
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 12px; padding: 12px 14px; margin: 12px 0 16px;
}
.ct-pending-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; font-size: 13px; }
.ct-pending-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ct-pending-name { font-size: 13px; font-weight: 600; min-width: 0; }
.ct-pending-name .muted { font-weight: 400; font-size: 12px; }
.ct-pending-actions { display: flex; gap: 6px; }
.ct-pending-more { margin-top: 6px; }

.ct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.ct-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ct-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ct-card-name { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.ct-card-sub { font-size: 12px; margin-top: 2px; }
.ct-days { display: flex; gap: 4px; flex-wrap: wrap; }
.ct-day {
  font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 6px;
  border: 1px solid var(--border); color: var(--text-dim); background: transparent;
}
.ct-day.on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); color: var(--accent); }
.ct-days-edit .ct-day { cursor: pointer; padding: 6px 10px; font-size: 12px; }
.ct-info { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 12.5px; }
.ct-info dt { color: var(--text-dim); }
.ct-info dd { margin: 0; overflow-wrap: anywhere; }
.ct-persons { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 8px; }
.ct-person { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; align-items: baseline; }
.ct-person a { color: var(--accent); text-decoration: none; }
.ct-person a:hover { text-decoration: underline; }
.ct-role { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--text-dim); min-width: 92px; }
.ct-person-name { font-weight: 600; }
.ct-no-persons { font-size: 12px; border-top: 1px solid var(--border); padding-top: 8px; }

.ct-modal { max-width: 720px; max-height: 92vh; overflow-y: auto; }
.ct-persons-head { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 8px; font-size: 13px; }
.ct-person-row { display: grid; grid-template-columns: 140px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 6px; margin-bottom: 6px; }
.ct-person-row input, .ct-person-row select { min-width: 0; }
@media (max-width: 640px) {
  .ct-person-row { grid-template-columns: 1fr 1fr; }
  .ct-modal { padding: 20px 16px; }
  #ctSearch { min-width: 0 !important; flex: 1; }
}

/* Finanse: uwagi do miesiecy rozliczeniowych, miedzy przychodem a wykresami */
.fin-remarks-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.fin-remarks-title { display: flex; gap: 10px; align-items: flex-start; }
.fin-remarks-title h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.fin-remarks-icon {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--sidebar-bg); color: #fff;
}
.fin-remarks-count:empty { display: none; }
.fin-remarks-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center; background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border);
}
.fin-remarks-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.fin-remarks-add {
  background: var(--sidebar-bg); color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.fin-remarks-add:hover { filter: brightness(1.15); }
.fin-remarks-empty { font-size: 13px; padding: 6px 0; }
.fin-remarks-table-wrap { border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
.fin-remarks-table { border: none; box-shadow: none; }
.fin-remarks-table th { font-size: 10px; }
.fin-remarks-table td { vertical-align: middle; font-size: 13px; padding-top: 10px; padding-bottom: 10px; }
.fin-remark-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.fin-remarks-table tr.is-read td { color: var(--text-dim); }
.fin-remarks-table tr.is-read td:not(:nth-last-child(-n+2)) { opacity: .65; }
.fin-remarks-table input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--text-dim); }
.fin-remark-menu-cell { text-align: center; }
.fin-remark-menu-btn {
  background: none; border: none; color: var(--text-dim); font-size: 18px; line-height: 1;
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
}
.fin-remark-menu-btn:hover { background: var(--panel-2); color: var(--text); }
.fin-remark-menu {
  position: fixed; z-index: 1000; min-width: 200px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 6px 20px -4px rgba(0,0,0,.18); overflow: hidden;
}
.fin-remark-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text);
  padding: 9px 14px; font-size: 13px; cursor: pointer;
}
.fin-remark-menu button:hover { background: var(--panel-2); }
.fin-remark-menu-info { padding: 8px 14px; font-size: 11.5px; color: var(--text-dim); border-top: 1px solid var(--border); }
.fr-year-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 2px 0 8px; }
.fr-year-nav #frYear { font-weight: 700; font-size: 15px; min-width: 48px; text-align: center; }
.fr-month-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; max-width: 420px; margin: 0 auto; box-sizing: border-box; }
.fr-month {
  padding: 9px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .12s, background-color .12s;
}
.fr-month:hover { border-color: var(--accent); }
.fr-month.current { box-shadow: inset 0 -2px 0 var(--accent); }
.fr-month.on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); color: var(--accent); }
.fr-picked { font-size: 12px; text-align: center; margin-top: 8px; }
.fin-remark-input {
  width: 100%; box-sizing: border-box; resize: vertical; font: inherit; font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 12px;
}
.fin-remark-input:focus { outline: none; border-color: var(--accent); }


/* Okno edycji wpisu (koszt pracy / koszt bez faktury) */
.ee-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 8px;
  background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-dim); line-height: 1;
}
.ee-close:hover { background: var(--panel-2); color: var(--text); }
.ee-form .modal-field input, .ee-form .modal-field select { width: 100%; box-sizing: border-box; }
.ee-hint { margin: -4px 0 12px; font-size: 12px; color: var(--text-dim); min-height: 16px; }
.ee-hint-err { color: var(--red); }

/* ---------- Porownywanie cen ---------- */
.cmp-sub { margin: 4px 0 0; font-size: 13px; max-width: 900px; }
.cmp-top { display: grid; grid-template-columns: minmax(300px, 360px) 1fr; gap: 14px; margin: 14px 0 18px; }
.cmp-import { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.cmp-import-head { display: flex; gap: 12px; align-items: flex-start; }
.cmp-import-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.cmp-import-icon svg { width: 22px; height: 22px; }
.cmp-import-title { font-weight: 800; font-size: 15px; }
.cmp-import-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; line-height: 1.4; }
.cmp-import-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cmp-import-row select { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 8px 10px; border-radius: 8px; }
.cmp-import-btns { display: grid; grid-template-columns: 1fr 1fr; }
.cmp-file-btn { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; }
.cmp-file-btn:hover { border-color: var(--accent); background: var(--panel-2); }
.cmp-file-ico { display: inline-grid; place-items: center; width: 26px; height: 30px; border-radius: 5px; font-size: 8.5px; font-weight: 800; color: #fff; letter-spacing: .02em; }
.cmp-file-pdf { background: #dc2626; }
.cmp-file-xlsx { background: #16a34a; }
.cmp-import-opts { justify-content: space-between; }
.cmp-import-busy { font-size: 12px; color: var(--accent); font-weight: 600; }
.cmp-date input { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 6px 8px; border-radius: 8px; margin-left: 4px; }
.cmp-date, .cmp-replace { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.cmp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.cmp-kpi-name { display: block; font-size: 17px; line-height: 1.25; }
.cmp-kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.04); min-width: 0; }
.cmp-kpi-head { display: flex; align-items: center; gap: 10px; }
.cmp-kpi-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); color: var(--accent); }
.cmp-kpi-icon svg { width: 18px; height: 18px; }
.cmp-kpi-title { font-size: 12px; color: var(--text-dim); font-weight: 600; line-height: 1.3; }
.cmp-kpi-value { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; margin-top: 4px; }
.cmp-kpi-sub { font-size: 12px; color: var(--text-dim); }
.cmp-pos { color: var(--green, #16a34a); font-weight: 600; }
.cmp-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 6px 18px 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.cmp-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 -18px 16px; padding: 0 12px; overflow-x: auto; scrollbar-width: thin; }
.cmp-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 12px 12px 10px; font-size: 13.5px; font-weight: 600; color: var(--text-dim); cursor: pointer; white-space: nowrap; }
.cmp-tab:hover { color: var(--text); }
.cmp-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.cmp-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "cheap chart" "common how" "side side"; gap: 16px; align-items: start; }
.cmp-area-cheap { grid-area: cheap; } .cmp-area-chart { grid-area: chart; } .cmp-area-side { grid-area: side; }
.cmp-area-common { grid-area: common; } .cmp-area-how { grid-area: how; }
.cmp-area-side { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 24px; }
.cmp-area-side h4:first-child, .cmp-area-side h3:first-child { margin-top: 0; }
@media (min-width: 1750px) {
  .cmp-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(280px, .8fr); grid-template-areas: "cheap chart side" "common how side"; }
  .cmp-area-side { display: block; }
  .cmp-area-side .cmp-side-part + .cmp-side-part h4 { margin-top: 18px; }
}
.cmp-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; background: var(--panel); }
.cmp-card h3 { font-size: 14.5px; margin: 0; display: flex; align-items: center; gap: 8px; }
.cmp-card h4 { font-size: 13px; margin: 18px 0 8px; }
.cmp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cmp-mini { width: 100%; min-width: 0; border: none; box-shadow: none; border-radius: 0; background: transparent; border-collapse: collapse; font-size: 12.5px; }
.cmp-mini thead th { position: static; background: transparent; }
.cmp-mini th { text-align: left; font-size: 10.5px; font-weight: 700; color: var(--text-dim); padding: 6px 6px; border-bottom: 1px solid var(--border); }
.cmp-mini th.num-col, .cmp-mini td.num-col { text-align: right; }
.cmp-mini td.num-col { white-space: nowrap; }
.cmp-mini td { padding: 7px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cmp-mini tbody tr { cursor: pointer; }
.cmp-mini tbody tr:hover td { background: var(--panel-2); }
.cmp-mini tr.is-selected td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.cmp-mini tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.cmp-prod { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cmp-prod b { display: block; font-size: 12.5px; overflow-wrap: anywhere; }
.cmp-prod span:not(.cmp-thumb):not(.cmp-badge) { display: block; font-size: 11px; color: var(--text-dim); }
.cmp-thumb { flex: none; width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--panel-2); font-size: 16px; line-height: 1; }
.cmp-card h3 .cmp-thumb { width: 26px; height: 26px; font-size: 14px; }
.cmp-link { background: none; border: none; padding: 0; margin-top: 10px; color: var(--accent); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.cmp-card-head .cmp-link { margin-top: 0; }
.cmp-link:hover { text-decoration: underline; }
.cmp-btn-dark, .cmp-btn-outline { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; border-radius: 10px; font-weight: 700; font-size: 13px; text-decoration: none; margin-top: 8px; }
.cmp-btn-dark svg, .cmp-btn-outline svg { width: 16px; height: 16px; }
.cmp-btn-dark { background: var(--sidebar-bg); color: #fff; border: 1px solid var(--sidebar-bg); }
.cmp-btn-dark:hover { filter: brightness(1.15); }
.cmp-btn-outline { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.cmp-btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.cmp-drop { border: 1.5px dashed color-mix(in srgb, var(--accent) 50%, var(--border)); border-radius: 12px; padding: 16px 12px; text-align: center; font-size: 13px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; background: color-mix(in srgb, var(--accent) 3%, transparent); transition: background .15s, border-color .15s; }
.cmp-drop svg { width: 28px; height: 28px; color: var(--accent); }
.cmp-drop:hover, .cmp-drop.is-over { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: var(--accent); }
.cmp-hist { display: flex; flex-direction: column; gap: 2px; }
.cmp-hist-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.cmp-hist-row:last-child { border-bottom: none; }
.cmp-hist-ico { flex: none; width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--panel-2); color: var(--text-dim); }
.cmp-hist-ico svg { width: 15px; height: 15px; }
.cmp-hist-main { flex: 1; min-width: 0; }
.cmp-hist-main .cmp-badge { margin-top: 3px; }
.cmp-hist-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-sup-dots { display: inline-flex; }
.cmp-sup-dots span { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; background: var(--sidebar-bg); border: 2px solid var(--panel); margin-left: -6px; }
.cmp-sup-dots span:first-child { margin-left: 0; }
.cmp-sup-dots span:nth-child(2) { background: var(--accent); }
.cmp-sup-dots span:nth-child(3) { background: #0d9488; }
.cmp-sup-dots span:nth-child(4) { background: #7c3aed; }
.cmp-steps { list-style: none; counter-reset: cmpstep; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 12px; }
.cmp-steps li { counter-increment: cmpstep; position: relative; padding-left: 38px; font-size: 13px; }
.cmp-steps li::before { content: counter(cmpstep); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 800; font-size: 12px; }
.cmp-steps b { display: block; }
.cmp-steps span { display: block; font-size: 12px; color: var(--text-dim); }
.cmp-tip { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; }
.cmp-chart { width: 100%; height: auto; display: block; margin: 6px 0 4px; }
.cmp-grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; }
.cmp-axis { fill: var(--text-dim); font-size: 9.5px; }
.cmp-bar { fill: color-mix(in srgb, var(--sidebar-bg) 55%, var(--panel-2)); }
.cmp-bar-best { fill: var(--green, #16a34a); }
.cmp-bar-val { fill: var(--text); font-size: 10px; font-weight: 700; }
.cmp-bar-val.is-best { fill: var(--green, #16a34a); }
.cmp-chart-note { display: flex; gap: 10px; align-items: flex-start; background: color-mix(in srgb, var(--green, #16a34a) 8%, transparent); border: 1px solid color-mix(in srgb, var(--green, #16a34a) 25%, transparent); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; }
.cmp-empty-hero { text-align: center; padding: 40px 16px; }
.cmp-empty-hero > svg { width: 48px; height: 48px; color: var(--accent); }
.cmp-empty-hero h3 { margin: 10px 0 6px; }
.cmp-filter-export { margin-left: auto; display: inline-flex; gap: 6px; }
.cmp-filter-export .ghost-btn { text-decoration: none; padding: 6px 12px; font-size: 12.5px; }
@media (max-width: 1100px) {
  .cmp-top { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .cmp-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chart" "cheap" "common" "how" "side"; }
  .cmp-area-side { grid-template-columns: 1fr; gap: 4px; }
  .cmp-area-side .cmp-side-part + .cmp-side-part h4 { margin-top: 18px; }
  .cmp-mini { display: block; overflow-x: auto; }
  .cmp-panel { padding: 6px 12px 14px; }
  .cmp-tabs { margin: 0 -12px 14px; }
  .cmp-mini td:first-child { min-width: 200px; }
}
@media (max-width: 640px) {
  .cmp-import-btns { grid-template-columns: 1fr; }
  .cmp-top { grid-template-columns: minmax(0, 1fr); }
  .cmp-kpi-value { font-size: 20px; }
}
.cmp-tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--amber); color: #fff; font-size: 11px; margin-left: 4px; }
#cmpTabs { align-items: center; }
.cmp-export { margin-left: auto; text-decoration: none; font-size: 13px; }
.cmp-filters { margin: 12px 0; }
.cmp-table { min-width: 760px; }
.cmp-table td { vertical-align: top; font-size: 13px; }
.cmp-row { cursor: pointer; }
.cmp-row:hover td { background: var(--panel-2); }
.cmp-small { font-size: 12px; }
.cmp-best { color: var(--green, #16a34a); font-weight: 700; }
.cmp-best-row td { background: color-mix(in srgb, var(--green, #16a34a) 7%, transparent); }
.cmp-save { color: var(--green, #16a34a); font-weight: 700; }
.cmp-up { color: var(--red); font-size: 11.5px; font-weight: 600; }
.cmp-down { color: var(--red); }
.cmp-actions { white-space: nowrap; text-align: right; }
.cmp-actions .primary-btn, .cmp-actions .ghost-btn { padding: 5px 10px; font-size: 12px; }
.cmp-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--panel-2); color: var(--text-dim); }
.cmp-badge-ok { background: color-mix(in srgb, var(--green, #16a34a) 15%, transparent); color: var(--green, #16a34a); }
.cmp-badge-auto { background: color-mix(in srgb, #0d9488 15%, transparent); color: #0f766e; }
.cmp-badge-new { background: var(--panel-2); color: var(--text-dim); }
.cmp-badge-warn { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.cmp-badge-bad { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.cmp-modal { max-width: 980px; max-height: 92vh; overflow-y: auto; }
.cmp-h3 { font-size: 13px; margin: 16px 0 8px; }
.cmp-preview-stats { font-size: 13px; margin-bottom: 10px; }
.cmp-preview-wrap { max-height: 55vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.cmp-preview-wrap thead th { top: 0; }
.cmp-assign-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; margin-bottom: 8px; }
.cmp-assign-opt { text-align: left; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--text); font-size: 13px; }
.cmp-assign-opt:hover { border-color: var(--accent); }
@media (max-width: 1100px) {
  .cmp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cmp-tab-count-red { background: var(--red); }
.cmp-buy { font-size: 11px; }
.cmp-alerts-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.cmp-alert-list { display: flex; flex-direction: column; gap: 8px; }
.cmp-alert { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.cmp-alert[data-cmp-product] { cursor: pointer; }
.cmp-alert[data-cmp-product]:hover { border-color: var(--accent); }
.cmp-alert-up { border-left-color: var(--red); }
.cmp-alert-down { border-left-color: var(--green, #16a34a); }
.cmp-alert-cheaper { border-left-color: var(--accent); }
.cmp-alert-stale { border-left-color: var(--amber); }
.cmp-alert-icon { font-size: 18px; line-height: 1.2; }
.cmp-alert-type { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); font-weight: 700; margin-bottom: 2px; }
.cmp-alert-settings { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.cmp-alert-settings .modal-field input { width: 100%; box-sizing: border-box; }
.cmp-alert-toggles { display: flex; flex-direction: column; gap: 6px; font-size: 13px; margin: 4px 0 8px; }
.cmp-terms-note { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; }
.cmp-links { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cmp-link-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 3px 4px 3px 10px; font-size: 12px; }
.cmp-link-chip button { background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 11px; padding: 2px 6px; border-radius: 10px; }
.cmp-link-chip button:hover { background: var(--panel); color: var(--red); }
.cmp-link-add input { width: 100%; box-sizing: border-box; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; }
@media (max-width: 900px) { .cmp-alerts-layout { grid-template-columns: 1fr; } }

/* Kontrahenci: przelacznik restauracja / cala grupa i dostawy per lokal */
.ct-scope { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.ct-scope button { background: none; border: none; padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-dim); cursor: pointer; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ct-scope button.active { background: var(--panel); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ct-locs { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 10px; }
.ct-loc { border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 0 8px 8px 0; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.ct-loc-name { font-weight: 700; font-size: 13px; }
.ct-loc .ct-days { margin: 0; }
.ct-loc-extra { font-size: 12px; }
.ct-local-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; }
.ct-local-head .muted { font-size: 12px; }

/* ---------- Raporty (2026-10-13) ---------- */
.rep-sub { margin: 4px 0 20px; }
.rep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 1100px; }
@media (max-width: 900px) { .rep-grid { grid-template-columns: 1fr; } }
.rep-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 22px 24px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
  display: flex; flex-direction: column;
}
.rep-card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.rep-card-head h2 { margin: 0 0 2px; font-size: 16px; }
.rep-card-head p { margin: 0; font-size: 13px; }
.rep-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.rep-list { margin: 0 0 18px; padding-left: 18px; color: var(--text-dim); font-size: 13px; line-height: 1.7; }
.rep-ranges { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.rep-ranges button {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.rep-ranges button:hover { color: var(--text); border-color: var(--accent); }
.rep-ranges button.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.rep-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.rep-fields .modal-field { margin-bottom: 12px; }
.rep-fields .modal-field input, .rep-fields .modal-field select { width: 100%; box-sizing: border-box; }
.rep-field-wide { grid-column: 1 / -1; }
.rep-btn { margin-top: auto; align-self: flex-start; padding: 10px 18px; }

/* Podsumowanie: duze wartosci kart KPI w jednej linii - przychod (ze strzalkami
   filtra) stoi gorą jak pozostale karty, a nie wysrodkowany w wysokim bloku. */
.dash-kpi .dash-rev-body { margin-top: 0; min-height: 0; align-items: flex-start; }
.dash-kpi .dash-rev-arrow { top: 2px; transform: none; }
.dash-kpi .dash-rev-amount { line-height: 1.15; }

/* ---------- Foodcost: wybor kategorii ---------- */
.fc-summary { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0 4px; }
.fc-summary > div { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; min-width: 150px; }
.fc-sum-label { display: block; font-size: 12px; color: var(--text-dim); }
.fc-sum-val { display: block; font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; max-width: 980px; }
.fc-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px;
  cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.fc-card:hover, .fc-card:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 24px -8px rgba(0,0,0,.16); border-color: var(--accent); outline: none; }
.fc-card-head { display: flex; align-items: center; gap: 12px; }
.fc-card-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.fc-card-name { font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.2; }
.fc-card-count { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.fc-card-go { margin-left: auto; font-size: 26px; color: var(--text-dim); line-height: 1; }
.fc-card:hover .fc-card-go { color: var(--accent); }
.fc-card-metric { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; }
.fc-card-metric-label { font-size: 13px; color: var(--text-dim); }
.fc-card-metric-val { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fc-bar { position: relative; height: 8px; border-radius: 99px; background: var(--border); margin-top: 8px; overflow: hidden; }
.fc-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.fc-bar i.fc-ok { background: var(--green, #22c55e); }
.fc-bar i.fc-warn { background: #f59e0b; }
.fc-bar i.fc-bad { background: var(--red, #ef4444); }
.fc-bar b { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text-dim); opacity: .55; }
.fc-card-lines { margin-top: 12px; font-size: 13px; display: grid; gap: 4px; color: var(--text-dim); }
.fc-card-lines b { color: var(--text); font-weight: 600; }
.fc-card-empty { margin-top: 16px; font-size: 13px; color: var(--text-dim); }
.fc-ok { color: var(--green, #16a34a); }
.fc-warn { color: #d97706; }
.fc-bad { color: var(--red, #dc2626); }
.fc-grid { max-width: none; }
.fc-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-top: 20px; }
.fc-panels h3 { margin: 0 0 12px; font-size: 15px; }
.fc-list { display: flex; flex-direction: column; gap: 8px; }
.fc-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.fc-row[data-open-dish] { cursor: pointer; transition: background-color .12s ease; }
.fc-row[data-open-dish]:hover, .fc-row[data-open-dish]:focus-visible { background: color-mix(in srgb, var(--accent) 10%, var(--panel-2)); outline: none; }
.fc-row-main { flex: 1; min-width: 0; }
.fc-row-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-row-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.fc-row-val { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Konto demo - plakietka i przycisk resetu (widoczne tylko gdy DEMO_MODE=1) */
.demo-pill {
  margin: 0 14px 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff1d6;
  color: #8a5300;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
}
[data-theme="dark"] .demo-pill { background: #4a3510; color: #ffd28a; }
.demo-reset-btn[hidden], .demo-pill[hidden] { display: none; }
.demo-reset-icon { font-size: 17px; line-height: 1; width: 17px; text-align: center; }
