:root {
  --ink: #14202e;
  --ink-soft: #55637a;
  --ink-faint: #636d7b;
  --line: #dfe5ee;
  --line-soft: #edf1f7;
  --surface: #ffffff;
  --surface-alt: #f6f8fc;
  --page: #eef1f7;
  --brand: #1f4e78;
  --accent: #2f6fb5;
  --ok: #1d7a4c;
  --ok-bg: #e6f4ec;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 32, 46, .06), 0 8px 24px rgba(20, 32, 46, .06);
  --gutter: 20px;
  --shell-max: 1340px;
}

@media (min-width: 1440px) {
  :root { --gutter: 32px; --shell-max: 1420px; }
  /* Wider desktop: the same budget, less chrome between columns, so the extra
     width lands in the cell text instead of in padding. */
  table.op th, table.op td { padding-left: 12px; padding-right: 12px; }
}
@media (min-width: 1600px) {
  :root { --gutter: 40px; --shell-max: 1560px; }
  table.op th, table.op td { padding-left: 10px; padding-right: 10px; }
}
@media (min-width: 1920px) {
  :root { --gutter: 40px; --shell-max: 1840px; }
  table.op th, table.op td { padding-left: 8px; padding-right: 8px; }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "Noto Sans", sans-serif;
}

a { color: var(--accent); }
a:hover { color: var(--brand); }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 40;
  transition: top .15s ease;
}
.skip-link:focus { top: 8px; }

/* ---------- top bar ---------- */

.topbar {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(10, 25, 45, .18);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand__mark {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f4c14c;
}

.brand__mark svg { display: block; }

.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text strong { font-size: 1.02rem; letter-spacing: .01em; }
.brand__text span { font-size: .78rem; color: rgba(255, 255, 255, .78); }

.nav { display: flex; flex-wrap: wrap; gap: 6px; }

.nav__item {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .88);
  text-decoration: none;
  font-weight: 600;
  font-size: .86rem;
  letter-spacing: .04em;
  border: 1px solid rgba(255, 255, 255, .28);
  white-space: nowrap;
}

.nav__item:hover { background: rgba(255, 255, 255, .14); color: #fff; }

.nav__item[aria-current="page"] {
  background: #fff;
  color: var(--brand);
  border-color: #fff;
}

.topbar__aside {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.datestamp { margin: 0; font-size: .82rem; color: rgba(255, 255, 255, .82); }

@media (max-width: 900px) {
  .topbar { position: static; }
}

/* ---------- stale banner ---------- */

.notice--stale {
  background: var(--warn-bg);
  color: var(--warn);
  border-bottom: 1px solid #f0dfb8;
  padding: 10px var(--gutter);
  text-align: center;
}
.notice--stale p { margin: 0; max-width: var(--shell-max); margin-inline: auto; font-size: .88rem; }

/* ---------- buttons ---------- */

.button {
  display: inline-block;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button--primary { background: #fff; color: var(--brand); border-color: #fff; }
.button--primary:hover { background: #eaf1f8; color: var(--brand); }

.topbar .button--primary { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bg); }
.topbar .button--primary:hover { background: #fff; color: var(--warn); }

.button--ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}
.button--ghost:hover { background: var(--surface-alt); color: var(--ink); }

/* ---------- layout ---------- */

.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 26px var(--gutter) 40px;
}

.view:focus { outline: none; }
.view:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.view__head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.view__title {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: .01em;
}

.view__lead { margin: 4px 0 0; color: var(--ink-soft); font-size: .95rem; }

/* Honest composition of today's list, shown above the DZISIAJ table so the
   headline count and the rows below it can never contradict each other. */
.view__split {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: .9rem;
}

.view__actions { display: flex; align-items: center; gap: 12px; }

.counter {
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}

/* ---------- PULPIT ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.metric {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
}

.metric--static { cursor: default; }

.metric__label {
  margin: 0 0 10px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.metric__value {
  margin: 0;
  font-size: 2.5rem;
  line-height: 1;
  font-weight: 700;
  color: var(--brand);
}

.metric__hint { margin: 10px 0 0; font-size: .8rem; color: var(--ink-faint); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}

.panel__title { margin: 0 0 12px; font-size: 1.05rem; }
.panel__text { margin: 0 0 14px; color: var(--ink-soft); font-size: .93rem; }
.panel__note { margin: 10px 0 0; font-size: .82rem; color: var(--ink-faint); }
.panel__note a { color: var(--accent); }

.changes { margin: 0; padding-left: 20px; }
.changes li { margin-bottom: 6px; }
.changes li:last-child { margin-bottom: 0; }

/* ---------- help / legend disclosure ---------- */

.pomoc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 18px;
}
.pomoc summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand);
}
.pomoc__table { border-collapse: collapse; margin: 14px 0; width: 100%; max-width: 520px; }
.pomoc__table th, .pomoc__table td {
  text-align: left;
  padding: 6px 12px 6px 0;
  font-size: .9rem;
  border-bottom: 1px solid var(--line-soft);
}
.pomoc__table th { color: var(--ink); font-weight: 600; white-space: nowrap; }
.pomoc p { margin: 10px 0 0; color: var(--ink-soft); font-size: .88rem; }

/* ---------- filters ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.filters label {
  display: block;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.filters__search { flex: 1 1 260px; min-width: 200px; }

.filters input[type="search"],
.filters select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .92rem;
}

.filters input[type="search"]:focus,
.filters select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.filters__selects { display: flex; flex-wrap: wrap; gap: 12px; min-width: 0; }
/* A filter is a fixed slot, never a content-sized one. `min-width: 0` lets the
   item shrink below its longest <option>; without it the longest real city
   value ("23-413 Obsza Olchowiec" and similar) widened the whole phone layout
   by ~357px on the 2026-10-18 catalog, because a flex item's automatic minimum
   is its min-content width. The option text is still readable in the opened
   list, and the slot stays inside the viewport. */
.filters__selects > div { flex: 0 1 190px; min-width: 0; }
.filters__selects select { max-width: 100%; text-overflow: ellipsis; }
.filters__reset { margin-left: auto; }

/* ---------- tables ---------- */

.tablewrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-inline: calc(-1 * var(--gutter));
}

table.op {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

@media (min-width: 640px) {
  table.op { table-layout: fixed; }
}

table.op th,
table.op td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  /* No mid-word break for a name, a label or a date. A cell whose word is
     wider than its column would then overprint the neighbour instead, so the
     width budget in app.js -- not this property -- is what keeps the table
     sound, and the V1.1 DOM harness measures every rendered cell at 1366px,
     1440px, 1600px and 1920px to prove it. */
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  line-break: normal;
}

/* Prose and free-text descriptions wrap the way prose does: at a space, or
   inside a very long word when no space fits. These are the only cells allowed
   to break mid-word, and they are the only ones whose value is not a name, a
   label or a date. */
table.op td.cell-free,
table.op td.cell-prose,
table.op td.cell-reason,
table.op td.cell-prose p {
  overflow-wrap: break-word;
}

table.op thead th {
  position: sticky;
  top: 0;
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  /* `table-layout: fixed` sizes columns from <colgroup> only, so a header that
     cannot wrap is neither clipped nor shrunk -- it paints over its neighbour
     (the "CO ZROBIĆ cut off" defect). Wrapping is the safety net; the budget
     keeps every header to whole words at the tightest supported width. */
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.25;
  vertical-align: bottom;
  border-bottom: 1px solid var(--line);
}

table.op tbody tr:hover { background: #fbfcfe; }
table.op tbody tr:last-child td { border-bottom: 0; }

.col-company strong { color: var(--ink); font-weight: 600; }

/* BAZA stacks the contact channels under the name, so both need to read as
   separate facts rather than as one wrapped sentence. */
.cell-name { display: block; }
.cell-line { display: block; margin-top: 3px; font-size: .82rem; }

.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  /* Same reason as the header: a nowrap pill in a fixed-layout column spills
     into the neighbouring one ("Kolejny cykl" did). Wrapping is a safety net
     for fonts wider than the ones the budget was measured against. */
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
}

.chip--top { background: var(--ok-bg); color: var(--ok); border-color: #c9e5d6; }

.cell-source { font-weight: 600; }
/* An e-mail address, a phone number and a URL have no break opportunity of
   their own, so these are the one place where breaking inside the string is
   correct rather than a defect: the value stays clickable and intact. */
.cell-source a, .cell-contact a { overflow-wrap: anywhere; }
.cell-contact a { display: block; }
.cell-contact .sep { color: var(--ink-faint); }
.cell-muted { color: var(--ink-faint); }

/* The reason a row is on today's list stays always visible, never collapsed. */
.cell-reason { color: var(--ink); }

/* Collapsed-by-default long text (Co zrobić / Dlaczego warto) */
.cell-prose .op__more summary {
  cursor: pointer;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  list-style: none;
}
.cell-prose .op__more summary::-webkit-details-marker { display: none; }
.cell-prose .op__more summary::before { content: "▸ "; }
.cell-prose .op__more[open] summary::before { content: "▾ "; }
.cell-prose .op__more[open] p { margin: 6px 0 0; color: var(--ink-soft); }
.cell-prose .op__more[open] p + p { margin-top: 8px; }
.cell-prose .op__more p { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .cell-prose .op__more { transition: none; }
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: .98rem;
  text-align: center;
}

.empty--muted { color: var(--ink-faint); }

.notice {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: .9rem;
}

/* ---------- footer ---------- */

.footer {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--gutter) 34px;
  color: var(--ink-faint);
  font-size: .82rem;
}

.footer p { margin: 0 0 8px; }
.footer__schedule { max-width: 70ch; }

/* ---------- narrow / mobile ---------- */

@media (max-width: 640px) {
  .shell { padding: 20px 16px 32px; }

  .view__head { flex-direction: column; align-items: flex-start; }
  .view__actions { width: 100%; margin-top: 12px; justify-content: flex-end; }

  table.op thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; margin: -1px;
  }

  table.op, table.op tbody, table.op tr, table.op td { display: block; width: 100%; }

  table.op tbody tr {
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
    margin-bottom: 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 3px rgba(20, 32, 46, .06);
  }

  table.op tbody tr td[data-label="Firma"] { order: -1; }

  table.op td {
    display: flex;
    gap: 10px;
    border: 0;
    padding: 6px 0;
    white-space: normal;
  }

  table.op td::before {
    content: attr(data-label);
    flex: 0 0 108px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }

  .cell-contact a { display: block; padding: 6px 0; min-height: 44px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .shell { max-width: 1200px; }
}

/* ---------- ATR #005: sortable columns, scope counters, sales signals ---------- */

/* The sort control is a real <button> inside the <th>: Tab focus and Enter/Space
   come from the platform. State is shown by an arrow AND a heavier header, never
   by colour alone. */
.sort-btn {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  max-width: 100%;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  text-align: left;
  border-radius: 4px;
  padding: 2px 3px;
  margin: -2px -3px;
}
.sort-btn::after {
  content: "\2195";               /* ↕ not sorted by this column */
  font-size: .95em;
  opacity: .45;
  flex: 0 0 auto;
}
th[data-sort="asc"] .sort-btn::after  { content: "\25B2"; opacity: 1; }   /* ▲ */
th[data-sort="desc"] .sort-btn::after { content: "\25BC"; opacity: 1; }   /* ▼ */
.sort-btn:hover { background: #e9eef7; }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
table.op thead th[data-sort="asc"],
table.op thead th[data-sort="desc"] {
  background: #e3ecf8;
  color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--brand);
}

.scope {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
}
.scope__item {
  flex: 1 1 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}
.scope__item--active { border-left: 4px solid var(--brand); }
.scope__item dt {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.scope__item dd { margin: 0; }
.scope__item dd:nth-of-type(1) { font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.scope__note { font-size: .82rem; color: var(--ink-faint); }

.sortbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 10px; }
.sortbar__mode { display: flex; align-items: center; gap: 8px; }
.sortbar__mode select { min-height: 38px; max-width: min(100%, 410px); }
.commercial-explanation { margin: 8px 0 0; padding-left: 20px; }
.commercial-explanation li { margin: 3px 0; }
.op__explanation summary { font-weight: 600; }
.sortbar__mobile { display: none; align-items: center; gap: 8px; }
.sortbar__status { margin: 0; font-size: .85rem; color: var(--ink-soft); }
@media (max-width: 640px) {
  .sortbar__mobile { display: flex; flex-wrap: wrap; width: 100%; }
  .sortbar__mobile select { flex: 1 1 140px; min-height: 44px; }
  .sortbar__mode { width: 100%; }
  .sortbar__mode select { flex: 1 1 140px; min-height: 44px; }
}

.signals { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.signal {
  font-size: .74rem;
  line-height: 1.3;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.signal--strong { background: var(--ok-bg); color: var(--ok); border-color: transparent; font-weight: 600; }
.signal--warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

.cell-role, .cell-sub { display: block; font-size: .76rem; font-weight: 400; color: var(--ink-faint); }
.cell-sub { overflow-wrap: anywhere; }
.cell-role--brak { color: var(--warn); }
.cell-role--organizator::before { content: "● "; color: var(--ok); }
