:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --border: #e2e2e2;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --nav: #303030;          /* grafit z logo MBudownictwo */
  --nav-text: #cfcfcf;
  --accent: #1f1f1f;        /* czerń logo - przyciski, paski, wyróżnienia */
  --accent-dark: #000000;
  --link: #282058;          /* granat z wariantu logo - linki */
  --ok: #1f8a4c;
  --ok-bg: #e7f6ed;
  --err: #b42318;
  --err-bg: #fdecea;
  --warn-bg: #fff4e0;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* Układ */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--nav); color: var(--nav-text); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { padding: 6px 10px 20px; display: block; text-decoration: none; }
.brand img { display: block; width: 100%; max-width: 190px; height: auto; }
.brand .brand-sub { display: block; color: var(--nav-text); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; margin-top: 8px; }
.sidebar a { color: var(--nav-text); padding: 9px 12px; border-radius: 8px; display: flex; justify-content: space-between; }
.sidebar a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.sidebar a.brand { display: block; padding: 6px 10px 20px; border-radius: 0; }
.sidebar a.brand:hover { background: none; }
.sidebar a.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .count { background: #fff; color: #1f1f1f; border-radius: 99px; font-size: .75rem; font-weight: 700; padding: 1px 8px; align-self: center; }
.sidebar .count.err { background: var(--err); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; font-size: .8rem; margin-top: 4px; }
.steps span { padding: 2px 8px; border-radius: 6px; background: #eef1f4; color: var(--muted); }
.steps span.done { background: var(--ok-bg); color: var(--ok); }
.steps span.now { background: var(--warn-bg); color: #9a5b00; font-weight: 600; }
.alloc-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.reject-form { display: flex; gap: 6px; margin-top: 8px; }
.reject-form input { flex: 1; padding: 5px 8px; font-size: .9rem; }
.sidebar .who { font-size: .85rem; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar .who strong { color: #fff; display: block; }
.sidebar form button { background: none; border: 0; color: var(--nav-text); padding: 6px 12px; cursor: pointer; font: inherit; }
.sidebar form button:hover { color: #fff; }
.main { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* Karty i siatki */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.45rem; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.stat.warn { border-color: #f3c27a; background: var(--warn-bg); }

/* Projekty - kafelki */
.project-tile { display: block; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.project-tile:hover { border-color: var(--accent); text-decoration: none; }
.project-tile .name { font-weight: 600; }
.project-tile .amount { font-size: 1.3rem; font-weight: 650; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: #edf0f3; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar span { display: block; height: 100%; background: var(--accent); }
.bar.over span { background: var(--err); }

/* Tabele */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: #fafbfc; }
th .th-sub { font-size: .72rem; text-transform: none; letter-spacing: 0; font-weight: 500; margin-top: 2px; }
tr:hover td { background: #fcfcfd; }
tfoot td { font-weight: 650; border-top: 2px solid var(--border); }

/* Formularze */
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd5dc; border-radius: 8px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0,0,0,.18); border-color: var(--accent); }
textarea { width: 100%; min-height: 70px; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field input, .field select, .field textarea { width: 100%; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1; min-width: 160px; margin-bottom: 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; background: var(--accent); color: #fff; white-space: nowrap; }
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border-color: #cfd5dc; }
.btn.secondary:hover { background: #f3f4f6; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.danger { background: #fff; color: var(--err); border-color: #f1b8b2; }
.budget-table { max-width: 760px; }
.budget-table td { padding: 5px 10px; }
.budget-table input { padding: 5px 8px; }
.budget-parent td { font-weight: 600; background: #fafbfc; }
.budget-table tfoot td { font-size: 1.05rem; }
.section-table td.parent, .section-table tr.parent td { font-weight: 600; background: #fafbfc; }
.sync-buttons { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.sync-buttons .btn { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: progress; }
.inline { display: inline; }
.assign-form { display: flex; gap: 6px; align-items: center; }
.assign-form select { max-width: 230px; padding: 5px 8px; font-size: .9rem; }

/* Etykiety */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eef1f4; color: #3b4452; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: #9a5b00; }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.env-prod { background: var(--err-bg); color: var(--err); }
.badge.env-sample { background: #e8eefc; color: #2c4fa8; }

/* Komunikaty */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.notice { background: #e8eefc; color: #233f86; padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; }

/* Filtry */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 4px; background: #e9ecef; padding: 3px; border-radius: 9px; }
.tabs a { padding: 6px 12px; border-radius: 7px; color: var(--text); font-size: .9rem; }
.tabs a.active { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); text-decoration: none; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }

/* Strony logowania */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .brand { padding: 0 0 22px; }
.auth .brand img { max-width: 260px; }
.auth .brand .brand-sub { color: var(--muted); }

/* Szczegóły faktury */
dl.facts { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.alloc-row { display: flex; gap: 8px; margin-bottom: 8px; }
.alloc-row select { flex: 1; }
.alloc-row input { width: 110px; }
.history li { margin-bottom: 6px; }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .sidebar .spacer, .sidebar .who { display: none; }
  .main { padding: 16px; }
  dl.facts { grid-template-columns: 1fr; }
}

/* Pulpit: faktury do przypisania | czat projektu */
.dash-split { align-items: stretch; }
.dash-split > .card { min-width: 0; }
.sidebar .count.chat-unread { background: #0084ff; }
.chat { display: flex; flex-direction: column; height: 520px; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.chat-head select { max-width: 100%; min-width: 0; flex: 1 1 200px; }
.chat-others { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; max-height: 130px; overflow-y: auto; }
.chat-others[hidden] { display: none; }
.chat-other { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font: inherit; font-size: .85rem; padding: 6px 10px; border-radius: 8px; border: 1px solid #cfe3ff; background: #eef5ff; color: var(--text); cursor: pointer; }
.chat-other:hover { background: #e0edff; }
.chat-other .who { font-weight: 600; white-space: nowrap; }
.chat-other .preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.chat-other .unread { background: #0084ff; color: #fff; border-radius: 99px; padding: 1px 7px; font-size: .75rem; font-weight: 700; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; background: #f7f7f8; border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-day { align-self: center; font-size: .75rem; color: var(--muted); margin: 6px 0 2px; }
.msg { max-width: 80%; align-self: flex-start; }
.msg .meta { font-size: .72rem; color: var(--muted); margin: 0 6px 2px; }
.msg .bubble { background: #fff; border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: 7px 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg.mine .bubble { background: #0084ff; border-color: #0084ff; color: #fff; border-radius: 14px 14px 4px 14px; text-align: left; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.chat-form textarea { min-height: 40px; max-height: 120px; resize: none; }
@media (max-width: 600px) { .chat { height: 460px; } .msg { max-width: 92%; } }
.dash-split th, .dash-split td { padding: 7px 8px; font-size: .88rem; }

/* Menu boczne: rozwijana lista (np. Umowy) - po najechaniu, kliknięciu w klawiaturze lub gdy jesteś w tej części panelu */
.nav-group { display: flex; flex-direction: column; }
.nav-group .caret { font-size: .7rem; opacity: .7; margin-left: 6px; display: inline-block; transition: transform .15s; }
.nav-group > a { justify-content: flex-start; }
.nav-group .submenu { display: flex; flex-direction: column; max-height: 0; overflow: hidden; transition: max-height .2s ease; }
.nav-group:hover .submenu, .nav-group:focus-within .submenu, .nav-group.open .submenu { max-height: 200px; }
.nav-group:hover .caret, .nav-group:focus-within .caret, .nav-group.open .caret { transform: rotate(180deg); }
.sidebar .submenu a { padding: 7px 12px 7px 26px; font-size: .9rem; margin-top: 2px; }
.sidebar .submenu a.active { background: none; box-shadow: none; color: #fff; font-weight: 600; }

/* Cash Flow */
:root { --cf-in: #2a78d6; --cf-out: #eb6834; --cf-contracts: #9a6fd6; --cf-staff: #2ea58a; --cf-plan: #8cc0f5; --cf-cost-plan: #f5b98f; }
.cf-alerts { display: flex; flex-direction: column; gap: 6px; }
.cf-alert { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 8px; color: var(--text); border: 1px solid var(--border); background: #fafafa; font-size: .92rem; }
.cf-alert:hover { text-decoration: none; border-color: var(--accent); }
.cf-alert.err { background: var(--err-bg); border-color: #f1b8b2; }
.cf-alert.warn { background: var(--warn-bg); border-color: #f3c27a; }
.cf-alert strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cf-legend { display: flex; gap: 14px; font-size: .85rem; color: var(--muted); }
.cf-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.cf-chart { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; height: 220px; padding: 8px 4px 0; border-bottom: 1px solid var(--border); }
.cf-col { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; cursor: default; border-radius: 6px; }
.cf-col:hover { background: #f4f6f8; }
.cf-col.current { background: #f7f7f7; }
.cf-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.cf-bar { width: min(18px, 40%); border-radius: 4px 4px 0 0; min-height: 0; }
.cf-bar.in { background: var(--cf-in); }
.cf-bar.out { background: var(--cf-out); }
/* Wydatki: jeden słupek z części - faktury zakupowe (dół), pracownicy, umowy - pozostało (góra) */
.cf-stack { width: min(18px, 40%); display: flex; flex-direction: column; border-radius: 4px 4px 0 0; overflow: hidden; }
.cf-stack i { display: block; flex-basis: 0; min-height: 0; }
.cf-stack i.invoices { background: var(--cf-out); }
.cf-stack i.contracts { background: var(--cf-contracts); }
.cf-stack i.staff { background: var(--cf-staff); }
.cf-stack i.sales { background: var(--cf-in); }
.cf-stack i.plan { background: var(--cf-plan); }
.cf-stack i.cost-plan { background: var(--cf-cost-plan); }
.cf-col.future .cf-label { font-style: italic; }
.cf-legend { flex-wrap: wrap; }
.cf-label { font-size: .72rem; color: var(--muted); text-align: center; padding: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-tip { position: absolute; top: 4px; transform: translateX(-50%); background: #1f1f1f; color: #fff; padding: 8px 10px; border-radius: 8px; font-size: .8rem; pointer-events: none; white-space: nowrap; z-index: 2; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.cf-tip[hidden] { display: none; }
.nav-group > a > span:last-child { margin-left: auto; }

/* Plik kosztowy w formularzu projektu */
.cost-file { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.cost-file .cost-file-result { flex-basis: 100%; margin: 0; font-size: .88rem; }
.budget-table input.from-file { background: #eef5ff; border-color: #9cc3f5; }
select.locked { pointer-events: none; background: #f3f3f3; color: var(--muted); }
.field input[type="radio"], .field input[type="checkbox"] { width: auto; }

/* Wizualizacja faktury (z XML KSeF) */
.fa-doc { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; max-width: 1000px; color: #111; }
.fa-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: 14px; margin-bottom: 16px; }
.fa-kind { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fa-number { font-size: 1.5rem; font-weight: 700; }
.fa-dates { text-align: right; font-size: .92rem; }
.fa-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 18px; }
.fa-party { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; font-size: .92rem; }
.fa-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.fa-name { font-weight: 700; font-size: 1rem; margin-bottom: 2px; }
.fa-muted { color: var(--muted); }
.fa-lines th, .fa-lines td { font-size: .88rem; padding: 7px 8px; }
.fa-bottom { display: grid; grid-template-columns: 1fr minmax(280px, 380px); gap: 20px; margin-top: 18px; align-items: start; }
.fa-pay { font-size: .92rem; }
.fa-sum table td, .fa-sum table th { padding: 5px 8px; }
.fa-total { margin-top: 10px; padding: 10px 12px; background: #111; color: #fff; border-radius: 8px; display: flex; justify-content: space-between; font-weight: 700; }
.fa-total span { font-size: 1.15rem; }
.fa-box { border: 1px solid var(--border); background: #fafafa; border-radius: 8px; padding: 10px 12px; margin: 14px 0; }
.fa-footer { margin-top: 12px; font-size: .78rem; color: var(--muted); }
@media (max-width: 700px) { .fa-bottom { grid-template-columns: 1fr; } .fa-dates { text-align: left; } .fa-doc { padding: 16px; } }
@media print {
  .sidebar, .no-print, .notice, .flash { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .fa-doc { border: 0; padding: 0; max-width: none; }
  .fa-total { background: #fff; color: #111; border: 2px solid #111; }
}
.btn.accept { background: var(--ok); }
.btn.accept:hover { background: #166b3b; }

/* Lista projektów: status do zmiany z listy */
.status-select { width: auto; padding: 2px 6px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eef1f4; color: #3b4452; border: 1px solid transparent; cursor: pointer; }
.status-select.ok { background: var(--ok-bg); color: var(--ok); }
.status-select.err { background: var(--err-bg); color: var(--err); }
.tabs-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs-inline .badge { margin-left: 4px; }

/* Liczniki w rozwijanym podmenu (np. Faktury -> Do akceptacji) */
.sidebar .submenu a { display: flex; align-items: center; }
.sidebar .submenu a > span:last-child { margin-left: auto; display: flex; gap: 4px; }

/* Faktury: wiersz wyszukiwania nad zakładkami statusów */
.filters-break { flex-basis: 100%; height: 4px; }

/* Czat: oznaczanie osób (@) */
.mention-list { position: absolute; left: 0; bottom: calc(100% + 4px); z-index: 20; min-width: 240px; max-width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 4px; display: flex; flex-direction: column; }
.mention-list[hidden] { display: none; }
.mention-list button { font: inherit; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--text); }
.mention-list button.active, .mention-list button:hover { background: #eef5ff; }
.msg .mention { font-weight: 700; color: #0064d1; }
.msg.mine .mention { color: #fff; text-decoration: underline; }
.msg .mention.me { background: #fff3c4; color: #7a5200; border-radius: 4px; padding: 0 3px; }
.msg.mention-me .bubble { border-color: #f0c040; box-shadow: 0 0 0 2px #fff3c4; }
.chat-other .unread.at { background: #f0a000; }

/* Czat: symbol nieprzeczytanych z innych projektów + lista */
.chat-inbox { position: relative; margin-left: auto; order: 2; }
.chat-head select { order: 3; }
.chat-inbox-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: #9aa3ae; cursor: pointer; }
.chat-inbox-btn:hover { background: #f3f4f6; }
.chat-inbox-btn.has-unread { color: #0084ff; border-color: #cfe3ff; background: #eef5ff; }
.chat-inbox-btn.has-mention { color: #d98a00; border-color: #f0c040; background: #fff8e1; }
.chat-inbox-count { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--err); color: #fff; font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.chat-inbox-count[hidden] { display: none; }
.chat-inbox-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(380px, 86vw); max-height: 380px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px; }
.chat-inbox-list[hidden] { display: none; }
.chat-inbox-head { font-size: .8rem; font-weight: 700; color: var(--muted); padding: 6px 8px; }
.chat-inbox-list button { display: flex; width: 100%; gap: 8px; align-items: baseline; text-align: left; font: inherit; background: none; border: 0; border-radius: 8px; cursor: pointer; color: var(--text); }
.chat-inbox-list button:hover { background: #eef5ff; }
.chat-inbox-project { padding: 8px 8px 4px; margin-top: 4px; font-weight: 700; border-top: 1px solid #eef1f4 !important; border-radius: 0 !important; }
.chat-inbox-project .name { flex: 1; min-width: 0; }
.chat-inbox-project .unread { background: var(--err); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: .72rem; }
.chat-inbox-msg { padding: 5px 8px 5px 16px; font-size: .85rem; }
.chat-inbox-msg .who { font-weight: 600; white-space: nowrap; }
.chat-inbox-msg .body { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.chat-inbox-msg .when { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.chat-inbox-msg.mention-me { background: #fff8e1; }
.chat-inbox-more { font-size: .78rem; color: var(--muted); padding: 2px 8px 6px 16px; }

/* Koszty firmy (Operacyjne / Gwarancji) */
.company-card { border-color: #c9b8f0; background: #f7f3ff; }
.company-assign { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.company-assign > summary { cursor: pointer; font-weight: 600; color: #5b3fb0; }
.company-assign [hidden] { display: none; }
.company-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }

/* Karta pracownika: pola pod sobą (etykieta nad polem), jedna kolumna */
.emp-card { max-width: 720px; }
.emp-row { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid #eef1f4; }
.emp-row:first-child { padding-top: 0; }
.emp-row > label { font-weight: 600; color: var(--text); margin: 0; }
.emp-row.emp-sub { padding-top: 4px; }
.emp-row.emp-sub > label { font-weight: 500; color: var(--muted); }
.emp-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.emp-check { display: inline-flex; align-items: center; gap: 6px; color: var(--text); margin: 0; font-weight: 400; }
.emp-check input { width: auto; }
.emp-money { max-width: 160px; text-align: right; }
.ocr-filled { background: #fff8d6 !important; border-color: #e6c34a !important; }
.contract-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.contract-meta { margin-bottom: 10px; }
.contract-frame { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: 8px; background: #f6f6f6; }
.contract-img { display: block; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; }
.contract-page[hidden] { display: none; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--accent-dark); }
.link-btn.danger-text { color: var(--err); }

/* Plan przerobów */
.plan-banner a { font-weight: 600; }
.flash.warn-banner { background: var(--warn-bg); border: 1px solid #f3c27a; color: var(--text); }
.plan-table input { max-width: 150px; text-align: right; }
.plan-table td, .plan-table th { white-space: nowrap; }
.plan-table tr.past td { color: var(--muted); }
.plan-table tr.current td { font-weight: 600; background: #f7f7f7; }
.plan-sum { font-weight: 700; }
.plan-sum.bad { color: var(--err); }
.plan-sum.ok { color: var(--ok); }

/* Pliki umów: ładowanie od razu po wybraniu */
.upload-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.upload-row { display: flex; align-items: center; gap: 8px; font-size: .85rem; padding: 4px 8px; border-radius: 6px; background: #f6f7f9; }
.upload-row .upload-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row progress { width: 110px; height: 8px; }
.upload-row .upload-status { white-space: nowrap; color: var(--muted); }
.upload-row.done .upload-status { color: var(--ok); font-weight: 600; }
.upload-row.error { background: var(--err-bg); }
.upload-row.error .upload-status { color: var(--err); }
.upload-row .upload-remove { color: var(--muted); }

/* Karta pracownika: lista umów od - do */
.contracts-list tr.current-contract td { background: #f3faf5; }
.contract-edit summary { cursor: pointer; color: var(--accent-dark); }
.contract-edit-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; min-width: 220px; }
.contract-edit-form label { display: flex; flex-direction: column; gap: 2px; margin: 0; font-size: .8rem; }
.contract-edit-form label.emp-check { flex-direction: row; }
