:root {
  --bg: #f5f7fa; --card: #ffffff; --ink: #1c2733; --muted: #6b7a89;
  --line: #e3e8ee; --accent: #1a3d63; --accent2: #2471a3;
  --red: #c0392b; --green: #27ae60; --amber: #b7791f;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
       background: var(--bg); color: var(--ink); }
code { background: #eef1f5; padding: 1px 6px; border-radius: 4px; font-size: .92em; }
a { color: var(--accent2); }

/* topbar / brand */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px;
          padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar nav { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; flex-direction: column; }
.brand-mark { font-weight: 800; letter-spacing: .08em; color: var(--accent); font-size: 15px; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }

.container { max-width: 1160px; margin: 26px auto 60px; padding: 0 24px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 24px 30px; }

/* buttons */
.btn { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
       background: var(--card); color: var(--ink); text-decoration: none; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: var(--accent2); color: var(--accent2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #153352; color: #fff; }
.btn-ghost { border: none; background: none; color: var(--muted); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.link { color: var(--muted); font-size: 13px; }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
              padding: 34px 34px 26px; box-shadow: 0 8px 30px rgba(20,40,60,.07); }
.login-card h1 { font-size: 21px; margin: 18px 0 6px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 4px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.login-card .btn { margin-top: 20px; }
.hint { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; }

/* cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; margin: 18px 0; }
.card h1 { font-size: 20px; margin: 0 0 8px; }
.card h2 { font-size: 16px; margin: 0 0 12px; color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.muted { color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-size: 14px; }
.flash.ok { background: #e8f6ee; color: #1d7a43; border: 1px solid #bfe6cf; }
.flash.error { background: #fdeceb; color: var(--red); border: 1px solid #f5c6c1; }

/* upload */
.sample-links { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.upload-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.upload-form input[type=file] { border: 1px dashed var(--line); border-radius: 8px; padding: 9px 12px; background: #fbfcfe; }

/* cheat-sheets */
.cheats { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
.cheats summary { cursor: pointer; padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--accent2); list-style: none; }
.cheats summary::before { content: "▸ "; color: var(--muted); }
.cheats[open] summary::before { content: "▾ "; }
.cheat-body { padding: 4px 16px 16px; }
.cheat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
@media (max-width: 800px) { .cheat-grid { grid-template-columns: 1fr; } }
.cheat { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--card); }
.cheat h3 { margin: 0 0 6px; font-size: 13.5px; color: var(--accent); }
.cheat p { margin: 0 0 6px; font-size: 13px; color: var(--ink); }
.cheat a { font-weight: 600; }

/* tables */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl thead th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tbl-report td { white-space: nowrap; }
.row-flag { background: #fdf3f2; }
.gcell { color: var(--muted); font-weight: 700; }

/* stat cards */
.cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 18px 0; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat-num { font-size: 26px; font-weight: 800; }
.stat-sub { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat-red { border-color: #f2c4bf; background: #fdf3f2; }
.stat-red .stat-num { color: var(--red); }
.stat-green { border-color: #bfe6cf; background: #f2faf5; }
.stat-green .stat-num { color: var(--green); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-red { background: #fdeceb; color: var(--red); }
.badge-green { background: #e8f6ee; color: #1d7a43; }

.chart-wrap { position: relative; height: 340px; }

/* kalkulator naprawy */
.rem-toggle { display: flex; gap: 18px; margin: 10px 0 14px; font-size: 14px; }
.rem-toggle label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.tbl tfoot td, .tbl tr.totals td { font-weight: 700; border-top: 2px solid var(--ink); background: #f4f7fa; }
.small { font-size: 12.5px; }
.note { background: #eef4fb; border: 1px solid #cfe0f2; color: #1e4e79; padding: 10px 14px; border-radius: 8px; margin: 14px 0; font-size: 14px; }
.issues { margin: 0; padding-left: 18px; }
.issues li { margin: 6px 0; }
.i-error { color: var(--red); font-weight: 600; }
.i-warn { color: var(--amber); }
.i-info { color: var(--muted); }
.ok-msg { color: var(--green); font-weight: 600; }
.recs { margin: 0; padding-left: 20px; }
.recs li { margin: 7px 0; }
.report-head { margin: 6px 0 2px; }
.report-head h1 { margin: 0 0 4px; font-size: 22px; }

/* print */
@media print {
  .no-print, .topbar { display: none !important; }
  body { background: #fff; }
  .card, .stat { border-color: #d7dde3; box-shadow: none; break-inside: avoid; }
  .container { max-width: 100%; margin: 0; padding: 0 8mm; }
  .chart-wrap { height: 300px; }
}

/* --- Streszczenie zarządcze + status + trend (2026-09-27) --- */
.exec { border-left: 4px solid #1d7a43; }
.exec-bad { border-left-color: #c0392b; }
.exec-warn { border-left-color: #b7791f; }
.exec .exec-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.status-pill { display: inline-block; padding: 4px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; letter-spacing: .03em; }
.pill-ok { background: #e8f7ee; color: #1d7a43; border: 1px solid #1d7a43; }
.pill-bad { background: #fdf0ef; color: #c0392b; border: 1px solid #c0392b; }
.pill-warn { background: #fdf8ec; color: #b7791f; border: 1px solid #b7791f; }
.exec-list { margin: 6px 0 6px 18px; }
.exec-list li { margin: 4px 0; }
.print-only { display: none; }
@media print {
  .no-print { display: none !important; }
  .print-only { display: block; }
  .exec .exec-head { display: none; }
}
.trend td.imp { color: #1d7a43; font-weight: 600; }
.trend td.det { color: #c0392b; font-weight: 600; }
.trend-overall td { background: #f4f7fa; }

/* --- Generator ogłoszenia + panel benchmarku (2026-09-27, bonusy) --- */
.ad-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.ad-form select { padding: 7px 10px; border: 1px solid #d6dde6; border-radius: 6px; background: #fff; font: inherit; }
.ad-text { background: #f7f9fb; border: 1px solid #e3e8ee; border-radius: 6px; padding: 14px 16px;
  white-space: pre-wrap; font: 12.5px/1.55 "DejaVu Sans Mono", monospace; margin: 10px 0; }
.ad-approve { margin-top: 6px; }
.bench-note { border-bottom: 1px dashed #e3e8ee; padding: 0 0 10px; margin-bottom: 12px; }

/* --- Drill-down: osoby w kategorii (klik w słupek chRaw) --- */
#drill[hidden] { display: none; }
.drill-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drill-sub { margin: 12px 0 4px; font-size: 13px; color: #1a3d63; }
.drill-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 320px; overflow-y: auto;
  border: 1px solid #e3e8ee; border-radius: 6px; }
.drill-list li { display: flex; gap: 8px; align-items: center; padding: 6px 10px;
  border-bottom: 1px solid #eef1f5; margin: 0; font-size: 12.5px; }
.drill-list li:last-child { border-bottom: none; }
.dg { display: inline-block; min-width: 20px; text-align: center; border-radius: 4px;
  font-weight: 700; font-size: 11px; color: #fff; padding: 1px 4px; }
.dg-K { background: #8e44ad; } .dg-M { background: #2471a3; }
.drill-list code { background: #f0f3f7; border-radius: 4px; padding: 1px 6px; font-size: 11.5px; }

/* --- Kreator importu + status AI --- */
.ai-status { border-radius: 8px; padding: 8px 12px; margin: 10px 0; font-size: 0.9rem; }
.ai-status.ai-on { background: #e8f7ee; border: 1px solid #3f9d63; }
.ai-status.ai-off { background: #f4f5f7; border: 1px dashed #b9bfc9; }
.maptbl select { width: 100%; max-width: 320px; padding: 4px 6px; }
.maptbl td { vertical-align: middle; }
.req { color: #c0392b; font-weight: 700; }
.inline-form { margin-top: 8px; }
.pill { background: #2f6fed; color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 0.75rem; vertical-align: middle; }

/* Kalkulator naprawy: przełącznik trybu kosztu (brutto vs pracodawca) */
#remed .only-e { display: none; }
#remed.cost-emp .only-b { display: none; }
#remed.cost-emp .only-e { display: inline; }
#remed.cost-emp .hint-emp { display: block; }
#remed .hint-emp { display: none; }

/* --- Asystent wiedzy prawnej (RAG) --- */
.ask-form { display: flex; gap: 8px; margin: 12px 0; }
.ask-form input[type="text"] { flex: 1; padding: 8px 10px; border: 1px solid #c9d0da; border-radius: 8px; }
.ask-sources { font-size: 0.9rem; }
.ask-answer { white-space: pre-wrap; background: #f7f9fc; border: 1px solid #dbe2ec; border-radius: 8px; padding: 10px 12px; }

/* Pływający filtr kategorii — klik w słupek filtruje cały raport */
.cat-filter { position: fixed; right: 18px; top: 96px; z-index: 60; width: 252px;
              background: var(--card); border: 1px solid var(--line); border-radius: 12px;
              box-shadow: 0 12px 30px rgba(28,39,51,.18); padding: 12px 14px; }
.cat-filter .cf-head { display: flex; justify-content: space-between; align-items: center;
                       font-weight: 700; font-size: 13px; color: var(--accent); letter-spacing: .02em; }
.cf-x { border: none; background: none; font-size: 20px; line-height: 1; cursor: pointer;
        color: var(--muted); padding: 0 2px; }
.cf-x:hover { color: var(--red); }
.cat-filter select { width: 100%; margin-top: 9px; padding: 7px 9px; font: inherit;
                     font-size: 13px; border: 1px solid var(--line); border-radius: 7px;
                     background: #fff; color: var(--ink); }
.cf-info { margin: 9px 0 0; font-size: 12px; color: var(--muted); }
tr.cat-off, section.cat-off, .card.cat-off, div.cat-off { display: none !important; }
@media (max-width: 760px) {
  .cat-filter { right: 10px; left: 10px; width: auto; top: auto; bottom: 10px; }
}

/* Czat z asystentem prawnym — fab + panel po prawej */
.chat-fab { position: fixed; right: 18px; bottom: 18px; z-index: 70; width: 52px; height: 52px;
            border-radius: 50%; border: none; background: var(--accent); color: #fff; cursor: pointer;
            box-shadow: 0 10px 24px rgba(28,39,51,.28); display: flex; align-items: center; justify-content: center; }
.chat-fab:hover { background: #153352; }
.chat-panel { position: fixed; right: 18px; top: 84px; bottom: 84px; width: 380px; z-index: 90;
              background: var(--card); border: 1px solid var(--line); border-radius: 14px;
              box-shadow: 0 18px 44px rgba(28,39,51,.22); display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
             padding: 12px 14px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.chat-head strong { color: var(--accent); font-size: 14px; }
.chat-sub { font-size: 11.5px; line-height: 1.35; }
.chat-x { border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.chat-x:hover { color: var(--red); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; }
.chat-msg p { margin: 0 0 8px; } .chat-msg p:last-child { margin-bottom: 0; }
.chat-msg.me { align-self: flex-end; background: var(--accent2); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: #f1f5f9; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.muted-bot { color: var(--muted); font-style: italic; }
.chat-sources { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-src { font-size: 11px; font-weight: 700; color: var(--accent); background: #e8f0f7;
            border: 1px solid #cddcea; border-radius: 6px; padding: 2px 7px; cursor: help; }
.chat-warn { margin-top: 8px; font-size: 11.5px; color: var(--amber); }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: #f8fafc; }
.chat-form input { flex: 1; font: inherit; font-size: 13.5px; padding: 9px 11px;
                   border: 1px solid var(--line); border-radius: 9px; color: var(--ink); }
.chat-form input:focus { outline: 2px solid var(--accent2); outline-offset: 1px; }
@media (max-width: 760px) {
  .chat-panel { right: 10px; left: 10px; width: auto; top: 70px; bottom: 70px; }
}

/* Znak branda w topbarze */
.brand { flex-direction: row; align-items: center; gap: 10px; }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.brand-txt { display: flex; flex-direction: column; }
