/* WYB Faktury – wygląd spójny z CRM (te same kolory i zaokrąglenia). Wszystkie klasy z przedrostkiem fk-. */
@font-face { font-family: "Plus Jakarta Sans"; src: url(/fonty/PlusJakartaSans-400.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url(/fonty/PlusJakartaSans-600.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url(/fonty/PlusJakartaSans-700.ttf); font-weight: 700; font-display: swap; }
:root {
  --fk-accent: #1a56ff; --fk-accent-soft: #eef3ff; --fk-accent-hover: #1447d6;
  --fk-text: #1f2937; --fk-text2: #374151; --fk-muted: #6b7280; --fk-line: #e8ebf0; --fk-line2: #d5dae2;
  --fk-bg: #f1f3f7; --fk-card: #fff; --fk-soft: #f6f7f9;
  --fk-green: #047857; --fk-green-bg: #e7f6ef; --fk-red: #b91c1c; --fk-red-bg: #fdecec; --fk-orange: #b45309; --fk-orange-bg: #fff4e0; --fk-violet: #6d28d9; --fk-violet-bg: #f1ebfe;
  --fk-shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --fk-r: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif; font-size: 14px; line-height: 1.45; color: var(--fk-text); background: var(--fk-bg); }
a { color: var(--fk-accent); }
:focus-visible { outline: 2px solid var(--fk-accent); outline-offset: 2px; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.8; flex: none; }

.fk-app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.fk-bok { background: var(--fk-card); border-right: 1px solid var(--fk-line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.fk-logo { display: flex; align-items: center; gap: 10px; margin: 0 8px 26px; text-decoration: none; color: var(--fk-text); font-weight: 700; font-size: 15px; }
.fk-logo img { height: 34px; width: auto; }
.fk-bok nav { display: flex; flex-direction: column; gap: 4px; }
.fk-nav { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid transparent; border-radius: 12px; color: var(--fk-text2); text-decoration: none; transition: background .15s; }
.fk-nav:hover { background: var(--fk-soft); }
.fk-nav.is-active { background: var(--fk-accent-soft); border-color: var(--fk-accent); color: var(--fk-text); font-weight: 600; }
.fk-nav.is-active svg { color: var(--fk-accent); }
.fk-bok__dol { margin-top: auto; padding: 0 6px; font-size: 12.5px; color: var(--fk-muted); }

.fk-main { padding: 28px 32px 60px; max-width: 1500px; width: 100%; outline: none; }
.fk-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.fk-top h1 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.fk-top .fk-rozp { flex: 1; }
.fk-wstecz { display: inline-flex; align-items: center; gap: 6px; color: var(--fk-muted); text-decoration: none; margin-bottom: 10px; font-size: 13px; }
.fk-wstecz:hover { color: var(--fk-accent); }

.fk-karta { background: var(--fk-card); border: 1px solid var(--fk-line); border-radius: var(--fk-r); box-shadow: var(--fk-shadow); padding: 20px; }
.fk-karta + .fk-karta { margin-top: 16px; }
.fk-karta h2 { font-size: 15px; margin: 0 0 14px; font-weight: 700; }
.fk-karta h2 small { font-weight: 400; color: var(--fk-muted); font-size: 12.5px; margin-left: 6px; }
.fk-pomoc { color: var(--fk-muted); font-size: 13px; margin: 0 0 12px; max-width: 78ch; }

.fk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 12px; border: 1px solid var(--fk-line2); background: var(--fk-card); color: var(--fk-text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; white-space: nowrap; }
.fk-btn:hover { background: var(--fk-soft); }
.fk-btn:disabled { opacity: .55; cursor: progress; }
.fk-btn--glowny { background: var(--fk-accent); border-color: var(--fk-accent); color: #fff; }
.fk-btn--glowny:hover { background: var(--fk-accent-hover); border-color: var(--fk-accent-hover); }
.fk-btn--zielony { background: var(--fk-green-bg); border-color: #b9e4d0; color: var(--fk-green); }
.fk-btn--zielony:hover { background: #d8f0e5; }
.fk-btn--grozny { color: var(--fk-red); }
.fk-btn--grozny:hover { background: var(--fk-red-bg); border-color: #f3c4c4; }
.fk-btn--maly { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.fk-btn--ikona { padding: 0; width: 36px; min-height: 36px; border-color: transparent; background: transparent; color: var(--fk-muted); }
.fk-btn--ikona:hover { color: var(--fk-red); background: var(--fk-red-bg); }

.fk-kafle { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.fk-kafel { background: var(--fk-card); border: 1px solid var(--fk-line); border-radius: var(--fk-r); box-shadow: var(--fk-shadow); padding: 16px 18px; }
.fk-kafel__etyk { color: var(--fk-muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.fk-kafel__liczba { font-size: 22px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.fk-kafel__pod { color: var(--fk-muted); font-size: 12.5px; }

.fk-pasek { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.fk-zakladki { display: inline-flex; background: var(--fk-soft); border: 1px solid var(--fk-line); border-radius: 12px; padding: 3px; }
.fk-zakladki button { border: 0; background: transparent; padding: 7px 14px; border-radius: 10px; font: inherit; color: var(--fk-text2); cursor: pointer; min-height: 34px; }
.fk-zakladki button.is-active { background: var(--fk-card); color: var(--fk-text); font-weight: 600; box-shadow: var(--fk-shadow); }
.fk-szukaj { flex: 1; min-width: 200px; max-width: 360px; }

.fk-pole { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fk-pole > span { font-size: 12.5px; color: var(--fk-muted); font-weight: 600; }
.fk-pole small { color: var(--fk-muted); font-size: 12px; }
input, select, textarea { font: inherit; color: var(--fk-text); background: var(--fk-card); border: 1px solid var(--fk-line2); border-radius: 10px; padding: 8px 11px; min-height: 40px; width: 100%; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--fk-accent); outline-offset: 0; border-color: var(--fk-accent); }
input[readonly] { background: var(--fk-soft); color: var(--fk-muted); }
.fk-siatka { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 14px; }
.fk-s2 { grid-column: span 2; } .fk-s3 { grid-column: span 3; } .fk-s4 { grid-column: span 4; } .fk-s6 { grid-column: span 6; } .fk-s8 { grid-column: span 8; } .fk-s12 { grid-column: span 12; }
.fk-rzad { display: flex; gap: 8px; align-items: flex-end; }
.fk-rzad > .fk-pole { flex: 1; }

.fk-tabela-wrap { overflow-x: auto; }
table.fk-tabela { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.fk-tabela th { text-align: left; font-size: 12px; color: var(--fk-muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--fk-line); white-space: nowrap; }
.fk-tabela td { padding: 11px 12px; border-bottom: 1px solid var(--fk-line); vertical-align: middle; }
.fk-tabela tr:last-child td { border-bottom: 0; }
.fk-tabela .fk-pr { text-align: right; }
.fk-tabela tbody tr.fk-klik { cursor: pointer; }
.fk-tabela tbody tr.fk-klik:hover { background: var(--fk-soft); }
.fk-tabela .fk-nr { font-weight: 600; }
.fk-pusto { text-align: center; color: var(--fk-muted); padding: 40px 12px; }

.fk-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--fk-soft); color: var(--fk-text2); }
.fk-chip svg.lucide { width: 13px; height: 13px; }
.fk-chip--ok { background: var(--fk-green-bg); color: var(--fk-green); }
.fk-chip--zle { background: var(--fk-red-bg); color: var(--fk-red); }
.fk-chip--uwaga { background: var(--fk-orange-bg); color: var(--fk-orange); }
.fk-chip--info { background: var(--fk-accent-soft); color: var(--fk-accent); }
.fk-chip--pro { background: var(--fk-violet-bg); color: var(--fk-violet); }

.fk-kopiuj { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 4px; border: 0; border-radius: 8px; background: transparent; color: var(--fk-muted); cursor: pointer; vertical-align: middle; flex: none; }
.fk-kopiuj:hover { background: var(--fk-accent-soft); color: var(--fk-accent); }
.fk-kopiuj svg.lucide { width: 15px; height: 15px; }
.fk-koszty td { white-space: nowrap; padding: 10px 8px; }
.fk-koszty th { padding: 8px; }
.fk-zkopia { display: flex; align-items: center; gap: 2px; }
.fk-koszty small { display: block; }
.fk-koszty td.fk-zawijaj { white-space: normal; min-width: 170px; }
.fk-koszty .fk-rach { font-variant-numeric: tabular-nums; font-size: 13px; }
.fk-przelew { display: grid; gap: 8px; margin: 0 0 16px; }
.fk-przelew__wiersz { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--fk-soft); border: 1px solid var(--fk-line); border-radius: 12px; }
.fk-przelew__wiersz span { color: var(--fk-muted); font-size: 12.5px; }
.fk-przelew__wiersz b { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.fk-przelew__wiersz .fk-btn { min-height: 34px; }
.fk-modal .fk-modal__okno--szerokie { width: min(860px, 100%); }
.fk-plik { display: flex; flex-direction: column; gap: 5px; }
.fk-plik input[type=file] { padding: 7px; }

/* edytor dokumentu */
.fk-edytor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.fk-edytor__bok { position: sticky; top: 20px; }
.fk-pozycje th, .fk-pozycje td { padding: 6px 5px; }
.fk-pozycje td { border-bottom: 0; }
.fk-pozycje input, .fk-pozycje select { min-height: 38px; padding: 6px 9px; }
.fk-pozycje .fk-p-lp { width: 28px; color: var(--fk-muted); text-align: center; }
.fk-pozycje td:nth-child(2) { min-width: 260px; }
.fk-pozycje .fk-p-il { width: 84px; } .fk-pozycje .fk-p-jm { width: 72px; } .fk-pozycje .fk-p-cena { width: 110px; } .fk-pozycje .fk-p-rab { width: 74px; } .fk-pozycje .fk-p-vat { width: 150px; }
.fk-pozycje .fk-p-wart { width: 118px; text-align: right; font-weight: 600; white-space: nowrap; }
.fk-pozycje input.fk-pr { text-align: right; }
.fk-sumy { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-variant-numeric: tabular-nums; }
.fk-sumy dt { color: var(--fk-muted); } .fk-sumy dd { margin: 0; text-align: right; }
.fk-sumy .fk-razem { font-size: 20px; font-weight: 700; padding-top: 10px; border-top: 1px solid var(--fk-line); margin-top: 4px; }
.fk-akcje { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.fk-akcje .fk-btn { width: 100%; }
.fk-podpowiedzi { position: relative; }
.fk-podpowiedzi__lista { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--fk-card); border: 1px solid var(--fk-line2); border-radius: 12px; box-shadow: 0 10px 30px rgba(16,24,40,.12); max-height: 280px; overflow: auto; padding: 4px; }
.fk-podpowiedzi__lista button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: 8px; font: inherit; cursor: pointer; }
.fk-podpowiedzi__lista button:hover, .fk-podpowiedzi__lista button:focus-visible { background: var(--fk-accent-soft); }
.fk-podpowiedzi__lista small { color: var(--fk-muted); display: block; }

.fk-podglad { width: 100%; height: 78vh; min-height: 520px; border: 1px solid var(--fk-line); border-radius: var(--fk-r); background: #fff; }
.fk-info { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.fk-info dt { color: var(--fk-muted); } .fk-info dd { margin: 0; overflow-wrap: anywhere; }
.fk-historia { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.fk-historia li { padding: 6px 0; border-bottom: 1px solid var(--fk-line); } .fk-historia li:last-child { border-bottom: 0; }
.fk-historia time { color: var(--fk-muted); display: block; font-size: 12px; }
.fk-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--fk-orange-bg); color: #7c3d06; margin-bottom: 16px; }
.fk-alert--info { background: var(--fk-accent-soft); color: #173a9e; }
.fk-alert--zle { background: var(--fk-red-bg); color: var(--fk-red); }
.fk-alert p { margin: 0; white-space: pre-line; }
.fk-kroki { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.fk-kroki li { display: flex; gap: 10px; align-items: flex-start; }
.fk-kroki .ok { color: var(--fk-green); } .fk-kroki .zle { color: var(--fk-red); }
.fk-kroki small { color: var(--fk-muted); display: block; overflow-wrap: anywhere; }

.fk-toasty { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; max-width: min(440px, calc(100vw - 40px)); }
.fk-toast { background: #173a9e; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(16,24,40,.2); white-space: pre-line; animation: fk-wjazd .2s ease-out; }
.fk-toast--zle { background: var(--fk-red); }
.fk-toast--ok { background: var(--fk-green); }
@keyframes fk-wjazd { from { opacity: 0; transform: translateY(8px); } }
.fk-modal { position: fixed; inset: 0; background: rgba(16,24,40,.35); display: grid; place-items: center; z-index: 40; padding: 20px; }
.fk-modal__okno { background: var(--fk-card); border-radius: 18px; padding: 24px; width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 20px 60px rgba(16,24,40,.25); }
.fk-modal__okno h2 { margin: 0 0 16px; font-size: 18px; }
.fk-modal__stopka { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 1560px) { .fk-edytor--form { grid-template-columns: minmax(0, 1fr); } .fk-edytor--form .fk-edytor__bok { position: static; } .fk-edytor--form .fk-akcje { flex-direction: row; flex-wrap: wrap; } .fk-edytor--form .fk-akcje .fk-btn { width: auto; flex: 1; } .fk-edytor--form .fk-sumy { max-width: 420px; margin-left: auto; } }
@media (max-width: 1100px) { .fk-edytor { grid-template-columns: minmax(0, 1fr); } .fk-edytor__bok { position: static; } .fk-kafle { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .fk-app { grid-template-columns: minmax(0, 1fr); }
  .fk-bok { position: static; height: auto; padding: 12px; border-right: 0; border-bottom: 1px solid var(--fk-line); }
  .fk-logo { margin-bottom: 10px; }
  .fk-bok nav { flex-direction: row; overflow-x: auto; }
  .fk-nav { white-space: nowrap; padding: 10px 12px; }
  .fk-bok__dol { display: none; }
  .fk-main { padding: 18px 14px 50px; }
  .fk-siatka > * { grid-column: span 12; }
  .fk-kafle { grid-template-columns: minmax(0, 1fr); }
}

.fk-bok__konto { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding: 10px 6px 0; border-top: 1px solid var(--fk-line); font-size: 12.5px; color: var(--fk-muted); }
.fk-pozycje textarea.fk-p-opis { margin-top: 6px; min-height: 56px; font-size: 12.5px; color: var(--fk-text2); }
.fk-p-dodaj-opis { margin-top: 4px; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12px; color: var(--fk-muted); cursor: pointer; }
.fk-p-dodaj-opis:hover { color: var(--fk-accent); }
.fk-p-opis-tekst { font-size: 12px; color: var(--fk-muted); white-space: pre-line; margin-top: 2px; }
