/* Origami Pulse — ciepłe jasne tło, krem, espresso, dyskretna miedź, mały akcent japońskiej czerwieni. */
:root {
  --bg: #f8f3ea;
  --panel: #fffdf8;
  --panel-2: #f3ece0;
  --ink: #2a1d15;
  --ink-2: #4a3a2f;
  --muted: #6e6056;
  --line: #e4d9c8;
  --copper: #9c5a2e;
  --copper-soft: #f3e4d6;
  --red: #b3372b;
  --ok: #2d6a4c;
  --ok-soft: #e3f0e8;
  --warn: #875600;
  --warn-soft: #fbefd6;
  --danger: #a1301f;
  --danger-soft: #f8e2dc;
  --info-soft: #ebe6f3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(42, 29, 21, .06), 0 6px 18px rgba(42, 29, 21, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
/* Atrybut hidden musi wygrywać z własnym display (grid, flex, table-row) — inaczej filtr listy nie chowa wierszy. */
[hidden] { display: none !important; }
.inline-form { display: inline-block; margin-left: 8px; vertical-align: middle; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--copper); text-underline-offset: 2px; }
a:hover { color: var(--red); }
h1, h2, h3 { line-height: 1.25; color: var(--ink); margin: 0 0 .6em; }
h1 { font-size: 1.55rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin-top: 1.2em; }
h3 { font-size: 1rem; }
p { margin: .4em 0 .8em; }
small, .muted { color: var(--muted); }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Układ */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; margin-bottom: 4px; }
.brand .dot { width: 12px; height: 12px; background: var(--red); border-radius: 50%; display: inline-block; }
/* Logo lokalu. Wysokość stała, szerokość z proporcji pliku — znak nigdy się nie rozciąga. */
.brand-logo { display: block; width: auto; max-width: 100%; height: 30px; }
.brand-logo--side { height: 34px; margin: 2px 0 2px; }
.brand-logo--top { height: 26px; }
.brand--auth { justify-content: center; margin-bottom: 10px; }
.brand-logo--auth { height: 56px; }
@media (max-width: 420px) { .brand-logo--auth { height: 44px; } }
.venue { font-size: .8rem; color: var(--muted); margin: 0 0 14px 22px; }
.nav h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 8px 4px; }
.nav a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--copper-soft); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--copper); }
.userbox { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .85rem; }
.userbox form { display: inline; }
main { padding: 22px 28px 60px; max-width: 1280px; width: 100%; min-width: 0; }
.topbar { display: none; }
.demo-banner { background: repeating-linear-gradient(-45deg, #fbefd6, #fbefd6 12px, #f6e3bb 12px, #f6e3bb 24px); color: #5b3a00; text-align: center; font-weight: 700; padding: 6px; letter-spacing: .04em; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.page-head p { margin: 0; }

/* Karty i siatki */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { font-size: .8rem; color: var(--muted); }
.kpi .value { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; margin: 2px 0; }
.kpi .value.na { font-size: 1rem; color: var(--muted); font-weight: 500; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
.kpi .formula { font-size: .75rem; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 6px; }

/* Plakietki statusu: zawsze symbol + tekst */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); white-space: nowrap; }
.b-ok { background: var(--ok-soft); border-color: #b9d8c6; color: var(--ok); }
.b-warn { background: var(--warn-soft); border-color: #ecd49e; color: var(--warn); }
.b-danger { background: var(--danger-soft); border-color: #eab8ac; color: var(--danger); }
.b-info { background: var(--info-soft); border-color: #d3cbe3; color: #4b3f66; }
.b-muted { color: var(--muted); }
.b-demo { background: #fbefd6; color: #5b3a00; border-color: #e8c98a; font-weight: 700; }

/* Komunikaty */
.flash { border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #b9d8c6; }
.flash.error { background: var(--danger-soft); border-color: #eab8ac; }
.flash.warn { background: var(--warn-soft); border-color: #ecd49e; }
.flash ul { margin: 6px 0 0 18px; padding: 0; }
.note { background: var(--panel-2); border-left: 3px solid var(--copper); padding: 8px 12px; border-radius: 6px; font-size: .9rem; margin: 8px 0; }
.note.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.note.red { border-left-color: var(--red); }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel); }

/* Tabele */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--panel); position: sticky; top: 0; }
tbody tr:hover { background: #fbf6ee; }
tfoot td { font-weight: 650; border-top: 2px solid var(--ink-2); }
tr.muted td { color: var(--muted); }
tr.void td { text-decoration: line-through; color: var(--muted); }

/* Formularze */
label { display: block; font-size: .85rem; color: var(--ink-2); margin-bottom: 3px; font-weight: 550; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #d6c9b5; border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 40px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--copper); }
input:focus, select:focus, textarea:focus { border-color: var(--copper); outline: 2px solid var(--copper-soft); }
input.num-in { text-align: right; font-variant-numeric: tabular-nums; }
textarea { min-height: 70px; }
.field { margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border-radius: 10px; padding: 9px 16px; min-height: 42px; border: 1px solid var(--ink); background: var(--ink); color: #fffaf2; cursor: pointer; text-decoration: none; }
.btn:hover { background: #3d2b1f; color: #fff; }
.btn.secondary { background: var(--panel); color: var(--ink); border-color: #cdbfa9; }
.btn.secondary:hover { background: var(--panel-2); }
.btn.copper { background: var(--copper); border-color: var(--copper); }
.btn.danger { background: var(--panel); color: var(--danger); border-color: #e0b1a6; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .82rem; border-radius: 8px; }
.btn.big { min-height: 52px; padding: 12px 22px; font-size: 1.05rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(248,243,234,0), var(--bg) 30%); padding: 18px 0 10px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
legend { font-weight: 650; padding: 0 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { margin: 0; flex: 0 1 150px; }
.wd { display: flex; gap: 4px; flex-wrap: wrap; }
.wd label { display: inline-flex; gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; font-weight: 500; }

/* Wpis dnia */
.entry-row { display: grid; grid-template-columns: minmax(150px, 2fr) repeat(4, minmax(78px, 1fr)); gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.entry-row .name { font-weight: 600; }
.entry-row .name small { display: block; font-weight: 400; }
.entry-head { font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.m-lbl { display: none; }
.cell { margin: 0; font-weight: 400; }
.suggest { font-size: .78rem; color: var(--copper); background: none; border: 1px dashed #d8b999; border-radius: 6px; padding: 2px 6px; cursor: pointer; margin-top: 3px; }
.cat-title { margin: 16px 0 2px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--copper); }
.totals-bar { display: flex; flex-wrap: wrap; gap: 18px; font-variant-numeric: tabular-nums; }

/* Pasek dni */
.strip { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; }
.strip a { display: block; text-align: center; text-decoration: none; color: var(--ink-2); border-radius: 8px; padding: 6px 2px; border: 1px solid var(--line); background: #fff; font-size: .75rem; }
.strip .sym { display: block; font-size: 1.05rem; line-height: 1.2; }
.d-closed { background: #efe9df !important; color: var(--muted) !important; }
.d-daily, .d-bills_complete { background: var(--ok-soft) !important; border-color: #b9d8c6 !important; }
.d-bills_partial, .d-daily_partial { background: var(--warn-soft) !important; border-color: #ecd49e !important; }
.d-zero { background: var(--info-soft) !important; }
.d-no_data.usual, .d-open_no_data { border: 1px dashed var(--red) !important; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: .78rem; }

/* Wykresy */
.chart { width: 100%; height: auto; max-height: 260px; }
.chart .bar { fill: var(--copper); }
.chart .bar.partial { fill: #d4a87f; }
.chart .bar-nodata { fill: none; stroke: var(--red); stroke-dasharray: 3 2; }
.chart .bar-closed { fill: #e4dccf; }
.chart .bar-zero { fill: none; stroke: #7d6fa0; }
.chart .bar-sym { font-size: 9px; fill: var(--muted); }
.chart .axis { stroke: #cdbfa9; }
.chart .lbl { font-size: 10px; fill: var(--muted); }
.chart.matrix { max-height: 380px; }
.chart .median { stroke: var(--copper); stroke-dasharray: 5 4; }
.chart .zero { stroke: var(--red); }
.chart .pt { fill: var(--ink); }
.chart .pt.star { fill: var(--ok); }
.chart .pt.workhorse { fill: var(--warn); }
.chart .pt.puzzle { fill: var(--copper); }
.chart .pt.dog { fill: var(--danger); }

/* Rekomendacje */
.rec { border-left: 4px solid var(--copper); }
.rec .n { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; margin-right: 8px; }
.rec dl { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 4px 14px; margin: 8px 0 0; }
.rec dt { color: var(--muted); font-size: .85rem; }
.rec dd { margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: .9rem; }

/* Logowanie */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; font-size: 1.3rem; margin-bottom: 14px; }

details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }

@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .js .side:not(.open) .nav, .js .side:not(.open) .userbox, .side .venue, .brand.desk { display: none; }
  .topbar { display: flex; justify-content: space-between; align-items: center; }
  main { padding: 16px 14px 60px; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .entry-row { grid-template-columns: 1fr 1fr; }
  .entry-row .name { grid-column: 1 / -1; }
  .entry-head { display: none; }
  .m-lbl { display: block; font-size: .72rem; color: var(--muted); margin-bottom: 2px; }
  .rec dl { grid-template-columns: 1fr; }
  .kpi .value { font-size: 1.3rem; }
}
@media print {
  .side, .topbar, .no-print, .actions, .filters, .demo-banner + .no-print { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  body { background: #fff; font-size: 11pt; }
  .card, .kpi { box-shadow: none; break-inside: avoid; border-color: #bbb; }
  a { color: inherit; text-decoration: none; }
  th { position: static; }
}

/* --- Trendy, satysfakcja, eksperymenty --- */
.chart-box { overflow-x: auto; margin: 10px 0 6px; }
.chart-box .chart { max-height: 300px; }
.small { font-size: .82rem; }

/* Werdykt kierunku: zawsze symbol + słowo, nigdy sam kolor. */
.verdict { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 1.05rem; }
.verdict-mark { font-size: 1.1rem; }
.verdict-up { color: var(--ok); }
.verdict-down { color: var(--red); }
.verdict-flat, .verdict-unknown { color: var(--muted); }

/* Okres, który jeszcze trwa — kreskowanie zamiast pełnego wypełnienia. */
.chart .wip-bg { fill: var(--copper-soft); }
.chart .wip-line { stroke: var(--copper); stroke-width: 3; }
.chart .trend-line { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linejoin: round; }
.chart .trend-dot { fill: var(--panel); stroke: var(--ink-2); stroke-width: 1.4; }
.chart-periods { max-height: 260px; }

.chart-ratings { max-height: 180px; }
.chart-ratings .rating-5, .chart-ratings .rating-4 { fill: var(--ok); }
.chart-ratings .rating-3 { fill: var(--warn); }
.chart-ratings .rating-2, .chart-ratings .rating-1 { fill: var(--red); }

.chart-exp { max-height: 420px; }
.chart-exp .exp-name { fill: var(--ink-2); }
.chart-exp .exp-link { stroke: #c3b39c; stroke-width: 2; }
.chart-exp .exp-before { fill: var(--panel); stroke: var(--muted); stroke-width: 1.4; }
.chart-exp .exp-after { stroke: none; }
.chart-exp .exp-after.exp-up { fill: var(--ok); }
.chart-exp .exp-after.exp-down { fill: var(--red); }
.chart-exp .exp-after.exp-flat { fill: var(--muted); }
.chart-exp .exp-link.exp-up { stroke: var(--ok); }
.chart-exp .exp-link.exp-down { stroke: var(--red); }
.chart .muted-txt { fill: var(--muted); }

/* Pasek danych testowych — ma być nie do przeoczenia. */
.test-banner { background: repeating-linear-gradient(-45deg, #ffe9e6, #ffe9e6 12px, #ffdad5 12px, #ffdad5 24px);
  color: #7a1d13; text-align: center; font-weight: 700; padding: 7px 10px; letter-spacing: .03em; }
.test-banner a { color: #7a1d13; }

/* --- Zespół: notatki zmianowe --- */
.notes { display: flex; flex-direction: column; gap: 14px; }
.note-thread { border: 1px solid var(--line); border-left: 4px solid var(--copper); border-radius: var(--radius); padding: 12px 14px; background: var(--panel); }
.note-thread.urgent { border-left-color: var(--red); }
.note-thread.done { border-left-color: var(--ok); background: var(--panel-2); }
.note-thread header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .88rem; margin-bottom: 6px; }
.note-thread .body { margin: 4px 0 8px; white-space: pre-wrap; }
.note-thread .reply { border-left: 2px solid var(--line); margin: 8px 0 8px 14px; padding-left: 12px; font-size: .93rem; }
.note-thread .reply p { margin: 2px 0 0; white-space: pre-wrap; }
.thread-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.thread-actions form { display: flex; gap: 6px; align-items: center; margin: 0; }
.reply-form { flex: 1 1 280px; }
.reply-form input[name="body"] { min-height: 34px; padding: 5px 9px; }

/* --- Grafik --- */
ul.shifts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
ul.shifts > li { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
ul.shifts .num { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* --- Kontekst dnia --- */
.day-ctx { display: flex; flex-direction: column; gap: 10px; }
.day-ctx-item { margin-bottom: 0; padding: 12px 14px; }
.day-ctx-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.day-ctx-item .row { margin: 0; }
.day-ctx-item .field { margin-bottom: 0; }

/* --- Profile importu --- */
.profile { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.profile header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.profile .kv { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 4px 12px; margin: 0 0 10px; font-size: .9rem; }
.profile .kv dt, .profile .kv dd { margin: 0; }
.profile .kv dd { display: flex; flex-wrap: wrap; gap: 5px; }

@media (max-width: 700px) {
  .profile .kv { grid-template-columns: 1fr; }
  .profile .kv dt { margin-top: 6px; }
}

/* --- Mapa ciepła --- */
.chart-heat { max-height: 240px; }
.chart-heat .heat { fill: var(--copper); }
.chart-heat .heat-empty { fill: none; stroke: var(--line); stroke-dasharray: 2 2; }

/* --- Wodospad --- */
.chart-water { max-height: 260px; }
.chart-water .wf-start { fill: var(--ink-2); }
.chart-water .wf-minus { fill: var(--red); }
.chart-water .wf-plus { fill: var(--copper); }
.chart-water .wf-end { fill: var(--ok); }

/* --- Mikrowykres w tabeli --- */
.spark { width: 84px; height: 22px; vertical-align: middle; }
.spark .spark-line { fill: none; stroke: var(--copper); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark .spark-dot { fill: var(--red); }
.spark-empty { color: var(--muted); }

/* --- Pareto --- */
.chart-pareto { max-height: 280px; }
.chart-pareto .bar-tail { fill: #d9c8b2; }

/* --- Kalendarz roku --- */
.chart-year { max-height: 320px; }
.chart-year .cal-ok { fill: var(--copper); }
.chart-year .cal-partial { fill: #d9b78f; }
.chart-year .cal-zero { fill: none; stroke: #7d6fa0; }
.chart-year .cal-closed { fill: #e4dccf; }
.chart-year .cal-nodata { fill: none; stroke: var(--red); stroke-dasharray: 2 2; }

/* --- Nakładka okresów --- */
.chart-overlay { max-height: 220px; }
.chart-overlay .ov-before { fill: none; stroke: #c3b39c; stroke-width: 1.4; }
.chart-overlay .ov-now { fill: var(--copper); }

/* --- Pasek pokrycia danych --- */
.cov { display: block; height: 4px; border-radius: 2px; background: var(--panel-2); margin-top: 6px; overflow: hidden; }
.cov > i { display: block; height: 100%; background: var(--copper); }
.cov.low > i { background: var(--warn); }
.cov.bad > i { background: var(--red); }
.kpi .value.dim { opacity: .55; }

/* --- Wartości pod wykresem (dotyk i czytnik ekranu) --- */
.chart-values { margin: 4px 0 10px; font-size: .88rem; }
.chart-values summary { cursor: pointer; color: var(--copper); }
.chart-values ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 3px 16px; }
.chart-values li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dotted var(--line); padding: 2px 0; }
.chart-values b { font-variant-numeric: tabular-nums; font-weight: 600; }

/* --- Raport miesięczny (ekran i druk) --- */
.report-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; border-bottom: 2px solid var(--ink-2); padding-bottom: 10px; margin-bottom: 14px; }
.report-head h2 { margin: 0; }
.report-verdict { font-weight: 700; font-size: 1.05rem; text-align: right; }
.report h3 { margin-top: 18px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.report .grid { margin-bottom: 8px; }
.quality { margin: 6px 0 0 18px; padding: 0; font-size: .9rem; }
.quality li { margin-bottom: 3px; }
.warn-txt { color: var(--warn); }
.report-foot { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
@media print {
  .report { border: none; box-shadow: none; padding: 0; }
  .report .chart-box { max-height: 150px; }
  .chart-values { display: none; }
}

/* --- Grafik: przełącznik zakresu --- */
.viewswitch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 14px; background: var(--panel); }
.viewswitch a { padding: 6px 16px; color: var(--ink-2); text-decoration: none; font-size: .9rem; border-right: 1px solid var(--line); }
.viewswitch a:last-child { border-right: none; }
.viewswitch a:hover { background: var(--panel-2); }
.viewswitch a.on { background: var(--copper); color: #fff; font-weight: 600; }

/* --- Grafik: pasek nieobecności w widoku tygodnia --- */
.abs-band { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 6px; margin: 0 6px 5px 0; font-size: .88rem; border: 1px solid transparent; }
.abs-leave { background: var(--info-soft); border-color: #cdc2e0; color: #43386b; }
.abs-sick { background: var(--danger-soft); border-color: #e6b0a4; color: var(--danger); }
.abs-other { background: var(--warn-soft); border-color: #e8cd96; color: var(--warn); }
.abs-band.pending { border-style: dashed; }
.today-row { background: var(--copper-soft); }

/* --- Grafik: siatka miesiąc/kwartał --- */
.gridcal { font-size: .8rem; border-collapse: collapse; }
.gridcal th, .gridcal td { border: 1px solid var(--line); padding: 2px; text-align: center; }
.gridcal th.who, .gridcal td.who { text-align: left; white-space: nowrap; padding: 4px 8px; min-width: 130px; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.gridcal thead th { position: static; font-size: .65rem; line-height: 1.15; padding: 3px 1px; text-transform: none; letter-spacing: 0; }
.gridcal thead th.who { position: sticky; left: 0; z-index: 2; }
.gridcal .dd { font-weight: 600; color: var(--ink-2); }
.gridcal .wd { color: var(--muted); }
.gridcal th.we { background: var(--panel-2); }
.gridcal .cell { width: 22px; height: 24px; }
.gridcal .cell.closed { background: repeating-linear-gradient(45deg, var(--panel-2), var(--panel-2) 3px, var(--panel) 3px, var(--panel) 6px); }
.gridcal .cell.today-col, .gridcal th.today-col { outline: 2px solid var(--copper); outline-offset: -2px; }
.gridcal .cell.abs-leave { background: var(--info-soft); }
.gridcal .cell.abs-sick { background: var(--danger-soft); }
.gridcal .cell.abs-other { background: var(--warn-soft); }
.gridcal .cell.pending { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.05), rgba(0,0,0,.05) 3px, transparent 3px, transparent 6px); }
.gridcal .sym { font-weight: 700; font-size: .78rem; color: var(--ink-2); text-transform: uppercase; }
.gridcal .sym.struck { text-decoration: line-through; color: var(--muted); }

.decide { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.decide input[name="reason"] { min-width: 150px; min-height: 32px; padding: 4px 8px; }
.inline-num { display: flex; gap: 5px; align-items: center; justify-content: flex-end; }
.inline-num input { width: 62px; min-height: 30px; padding: 3px 6px; }

/* --- Winyle: porównanie dwóch stron --- */
.cmp { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; margin: 14px 0; }
.cmp-side { background: var(--panel-2); border-radius: var(--radius); padding: 14px 16px; text-align: center; }
.cmp-lbl { display: block; font-size: .82rem; color: var(--muted); }
.cmp-val { display: block; font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.cmp-n { display: block; font-size: .8rem; color: var(--muted); }
.cmp-mid { text-align: center; font-size: .9rem; color: var(--muted); min-width: 120px; }
.cmp-mid strong { font-size: 1.15rem; }
.playlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.playlist > li { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.playlist .num { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 44px; }
@media (max-width: 640px) { .cmp { grid-template-columns: 1fr; } }

/* --- Pulpit: jeden ekran z podsumowaniem --- */
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash > .card { margin-bottom: 0; }
.dash .dash-wide { grid-column: 1 / -1; }
.dash .kv { grid-template-columns: 170px minmax(0, 1fr); gap: 6px 14px; }
.dash .kv dt { padding-top: 2px; }
.dash .kv dd { margin: 0; }
.dash h3 { margin: 16px 0 6px; font-size: .95rem; }
.dash table { font-size: .9rem; }
.dash .chart-box .chart { max-height: 190px; }

.dash-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.dash-alert { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); border-left: 4px solid var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 10px 14px; }
.dash-alert.error { border-left-color: var(--red); background: var(--danger-soft); }
.dash-prio { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.dash-prio strong { font-weight: 650; }
.dash-dq { margin: 4px 0 0 18px; padding: 0; font-size: .9rem; }
.dash-dq li { margin-bottom: 4px; }

@media (max-width: 980px) { .dash { grid-template-columns: 1fr; } }

/* --- Pulpit: stan „wszystko w porządku” i werdykt kierunku --- */
.dash-alert.allclear { border-left-color: var(--ok); background: var(--ok-soft); }
.dash-verdict { font: 650 1.15rem/1.4 var(--font); margin: 2px 0 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.dash-verdict .muted { font-weight: 400; font-size: .92rem; }
.dash-verdict.verdict-up { color: var(--ok); }
.dash-verdict.verdict-down { color: var(--red); }
.dash-verdict.verdict-flat, .dash-verdict.verdict-unknown { color: var(--muted); }
.dash .kv dd .small { display: block; margin-top: 2px; }

/* --- Pulpit: strefa akcji (jedyne miejsce, z którego się zapisuje) --- */
.dash-actions { border-left: 4px solid var(--copper); }
.act-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 10px; margin-top: 10px; }
/* Sześć przycisków pracownika w trzech kolumnach: dwa równe rzędy zamiast 5 + 1 sierotki. */
@media (min-width: 981px) { .act-six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.act { display: flex; flex-direction: column; gap: 3px; padding: 13px 15px; border: 1px dashed var(--copper);
  border-radius: var(--radius); background: var(--panel); color: var(--ink); text-decoration: none; min-height: 74px; }
.act:hover { background: var(--copper-soft); border-style: solid; color: var(--ink); }
.act b { font-size: 1rem; font-weight: 650; }
.act span { font-size: .82rem; color: var(--muted); }

/* --- Pulpit: kafle-drzwi (liczba + wejścia w głąb modułu) --- */
.dash-doors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.door { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; }
.door > b { font: 500 .72rem/1.4 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--copper); }
/* mniejsze niż liczba główna pulpitu — kafle są wejściem w moduł, nie odpowiedzią na pytanie */
.door-num { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 5px 0 1px; }
.door-sub { font-size: .8rem; color: var(--muted); min-height: 2.4em; }
.door nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.door nav a { font-size: .88rem; padding: 3px 0; text-decoration: none; }
.door nav a::before { content: "→ "; color: var(--muted); }
.door nav a:hover { text-decoration: underline; }

@media (max-width: 980px) {
  .dash-doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Na telefonie strefa akcji idzie zaraz pod alerty: przy ladzie liczy się dojście
     do „＋ Podsumowanie dnia”, a nie wykres. Na komputerze kolejność zostaje bez zmian. */
  .dash .dash-actions { order: -1; }
}
@media (max-width: 560px) {
  .dash-doors { grid-template-columns: 1fr; }
  .door-sub { min-height: 0; }
}

/* --- Pulpit: liczba główna (jedna na ekran) --- */
.dash-hero .hero-row { display: grid; grid-template-columns: minmax(230px, 1fr) 2fr; gap: 18px; align-items: center; }
.hero { display: flex; flex-direction: column; gap: 2px; }
.hero-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hero-num { font-size: 3rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hero-word { font-size: 1.9rem; font-weight: 650; }
.hero-sub { font-size: .85rem; color: var(--muted); }
.hero-side .kpi { box-shadow: none; }
@media (max-width: 820px) {
  .dash-hero .hero-row { grid-template-columns: 1fr; }
  .hero-num { font-size: 2.4rem; }
}
.plain-link { text-decoration: none; }
.plain-link:hover .badge { box-shadow: 0 0 0 2px var(--copper-soft); }

/* --- Podsumowanie miesiąca zespołu --- */
.leader-card { border-left: 4px solid var(--copper); }
.leader { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.leader-label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.leader-name { display: block; font-size: 2rem; font-weight: 700; line-height: 1.15; margin: 2px 0; }
.leader-sub { display: block; font-size: .85rem; color: var(--muted); }
.leader-num { font-size: 2.1rem; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.leader-num span { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); }
@media (max-width: 560px) { .leader-num { text-align: left; } }

/* --- Menu boczne: chowanie/odkrywanie na komputerze i zwijane grupy --- */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-hide, .side-show { border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: 8px; cursor: pointer; font: inherit; }
.side-hide { width: 30px; height: 30px; line-height: 1; font-size: 1.15rem; flex: 0 0 auto; }
.side-hide:hover, .side-show:hover { background: var(--panel-2); color: var(--ink); }
.side-show { display: none; padding: 6px 12px; margin: 0 0 12px; }
.nav details { margin: 0; }
.nav summary { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 8px 4px;
  cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.nav summary::-webkit-details-marker { display: none; }
.nav summary::after { content: "›"; font-size: 1rem; color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
.nav details[open] > summary::after { transform: rotate(-90deg); }
@media (min-width: 901px) {
  .shell.side-hidden { grid-template-columns: minmax(0, 1fr); }
  .shell.side-hidden .side { display: none; }
  .shell.side-hidden .side-show { display: inline-flex; }
}
@media (max-width: 900px) { .side-hide { display: none; } }

/* --- Pulpit: sekcje zwijane do nagłówka na telefonie (na komputerze zawsze otwarte) --- */
details.fold > summary { list-style: none; cursor: default; pointer-events: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary > h2, details.fold > summary > h3 { margin: 0 0 8px; display: inline-block; }
.fold-quiet > summary { display: none; }

@media (max-width: 560px) {
  .test-banner { font-size: .78rem; padding: 6px 10px; }
  .page-head { margin-bottom: 8px; }
  .page-head .no-mobile, .dash .no-mobile { display: none !important; }
  .page-head h1 { font-size: 1.35rem; margin: 0; }
  .dash { gap: 10px; }
  .dash > .card { padding: 12px 14px; }
  .dash-alerts { gap: 6px; margin-bottom: 10px; }
  .dash-alert { padding: 8px 12px; gap: 6px; }
  .dash-alert .muted { display: none; }
  .dash-alert .btn { padding: 4px 9px; }
  .hero-num { font-size: 2rem; }
  .hero-word { font-size: 1.5rem; }
  .hero-sub { font-size: .78rem; }
  .dash-hero .hero-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .dash-hero .hero-side .kpi { padding: 8px; }
  .dash-hero .hero-side .kpi .label { font-size: .66rem; line-height: 1.2; }
  .dash-hero .hero-side .kpi .value { font-size: .95rem; }
  .dash-hero .hero-side .kpi .value.na { font-size: .72rem; }
  .dash-hero .hero-side .kpi .sub, .dash-hero .hero-side .kpi .formula { display: none; }
  .act-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .act { min-height: 0; padding: 10px 12px; }
  .act b { font-size: .92rem; }
  .act span { display: none; }
  .dash .kv { grid-template-columns: 96px minmax(0, 1fr); gap: 4px 10px; font-size: .92rem; }
  .dash-doors { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .door { padding: 10px 12px; }
  .door-num { font-size: 1.3rem; }
  .door-sub { font-size: .72rem; }
  .dash .chart-box .chart { max-height: 160px; }
  details.fold > summary { cursor: pointer; pointer-events: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  details.fold > summary::after { content: "›"; font-size: 1.25rem; color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
  details.fold[open] > summary::after { transform: rotate(-90deg); }
  details.fold > summary > h2, details.fold > summary > h3 { margin: 0; }
  .fold-quiet > summary { display: flex; font-size: .85rem; color: var(--muted); margin-top: 6px; }
}

/* Użytkownicy: wiersz z rolą, e-mailem i uprawnieniami dodatkowymi (tylko administrator). */
.row-sub td { background: var(--panel-2); padding-top: 4px; padding-bottom: 10px; }
details.fold-inline > summary { cursor: pointer; font-size: .9rem; color: var(--muted); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 16px; margin: 6px 0 10px; }
/* Trwałe usunięcie konta — wydzielone ramką, żeby nie kliknąć go „po drodze” przy zmianie uprawnień. */
.danger-zone { margin-top: 12px; padding: 10px 12px; border: 1px solid #e0b1a6; border-radius: 10px; background: var(--panel); }
.danger-zone p { margin: 8px 0 0; max-width: 70ch; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
