/* Składniki tylko bk. Wyłącznie zmienne motywu; wszystko wspólne jest w components.css paczki stylu. */
[hidden] { display: none !important; }
/* Miejsce na suwak jest zawsze, więc krótka lista (np. po filtrze) nie przeskakuje w prawo. */
.main, .peek-body { scrollbar-gutter: stable; }
.page-header > .filters { flex: none; }
.page-title { max-width: 60ch; overflow-wrap: anywhere; }
.key-facts { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); margin: var(--space-2) 0 0; color: var(--color-text-muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.key-facts strong { color: var(--color-text-strong); }

/* ---- Pasek stanu odczytu ---- */
.banner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid; border-radius: var(--radius-md); background: var(--color-surface); }
.banner.bad { border-color: var(--color-danger); background: var(--color-danger-soft); }
.banner.bad strong { color: var(--color-danger); }
.banner.warn { border-color: var(--color-warning); }
.banner.warn strong { color: var(--color-warning); }

/* ---- Lista ---- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.toolbar.end { justify-content: flex-end; }
.search { width: 260px; }
/* Szybkie filtrowanie po ocenie: dawna legenda. */
.quick-filter { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.quick { gap: var(--space-2); padding-left: var(--space-1); }
.quick:hover { background: var(--color-surface-hover); }
.quick .rate-button { width: 20px; height: 20px; }
.quick .rate-button svg { width: 12px; height: 12px; }
/* Stałe szerokości: kolumny wszystkich kart stoją w jednej linii, długie nazwy się zawijają. */
.notices { --pill-width: 184px; table-layout: fixed; }
.notices td { padding-top: var(--space-2); padding-bottom: var(--space-2); overflow-wrap: anywhere; }
.notices .cell-buyer { width: 24%; }
.notices .cell-deadline { width: 160px; font-variant-numeric: tabular-nums; }
.notices .cell-rate { width: 224px; }
.notices .cell-main { padding-right: var(--space-5); }
.notices td.cell-buyer { color: var(--color-text-muted); }
.notices .day td { padding-top: 0; padding-bottom: 0; }
.results { display: flex; flex-direction: column; gap: var(--space-4); }
.found { margin: 0; color: var(--color-text-muted); }
.found .button { margin-left: var(--space-2); }
.runs th:first-child { width: 170px; }
.run-date { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 600; text-decoration: none; }
.run-date:hover { text-decoration: underline; }
.run-date svg { width: 12px; height: 12px; color: var(--color-text-faint); }
.runs { --pill-width: 104px; }
.accounts { --pill-width: 120px; }
.row-change { margin-top: var(--space-1); color: var(--color-text-muted); font-size: var(--text-sm); }
.row-change del, .facts del { color: var(--color-text-faint); }
.row-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.fold > summary { cursor: pointer; border-bottom-color: transparent; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .card-title::before { display: inline-block; margin-right: var(--space-2); color: var(--color-text-faint); content: '›'; transition: transform var(--transition-fast); }
.fold[open] > summary .card-title::before { transform: rotate(90deg); }
.fold[open] > summary { border-bottom-color: var(--color-border); }

/* ---- Ocena jednym kliknięciem: kolor i znak, nigdy sam kolor. W spoczynku neutralna, kolor w wierszu pod kursorem. ---- */
.rate { display: inline-flex; gap: var(--space-2); }
.rate-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid color-mix(in srgb, currentColor 45%, transparent); border-radius: var(--button-radius); background: transparent; transition: color var(--transition-fast), border-color var(--transition-fast); }
button.rate-button:hover { background: color-mix(in srgb, currentColor 18%, transparent); }
.rate-button.green { color: var(--color-status-open); }
.rate-button.blue { color: var(--color-status-planned); }
.rate-button.grey { color: var(--color-status-closed); }
.rate-button.orange { color: var(--color-status-on-hold); }
@media (hover: hover) {
  tr:not(:hover) .rate:not(:has(:focus-visible)) .rate-button { border-color: var(--color-border-strong); color: var(--color-text-faint); }
}

/* „Do rozważenia”: bieżąca ocena zostaje w kolorze także w spoczynku. */
.notices tr .rate .rate-button.blue[aria-pressed='true'] { border-color: currentColor; background: color-mix(in srgb, currentColor 18%, transparent); color: var(--color-status-planned); }
.rate + .row-sub { margin-top: var(--space-1); }

/* ---- Dni: sama przerwa na tle karty i mocniejszy tekst nagłówka, bez pasa i linii ---- */
.table.notices tbody tr.gap, .table.notices tbody tr.gap:hover { background: transparent; }
.table.notices tbody tr.gap td { height: 28px; padding: 0; border-top: 0; }
.table.notices tbody tr.day td { height: 38px; border-top: 0; color: var(--color-text); font-size: var(--text-md); font-weight: 700; }
.table.notices tbody tr.day.waiting td { color: var(--color-text-strong); }
.day-label { display: inline-flex; align-items: center; gap: var(--space-2); }
.day-label svg { color: var(--color-text-muted); }
.day-age { color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 600; }

/* ---- Zaznaczanie wielu (D62): pola zawsze w tabeli, bez trybu. Słabe w spoczynku, wyraźne przy wierszu pod myszą i gdy coś zaznaczono ---- */
.notices .cell-check { width: 46px; padding-right: 0; }
.check { display: block; width: 18px; height: 18px; margin: 0; opacity: 0.35; accent-color: var(--color-accent); cursor: pointer; transition: opacity var(--transition-fast); }
thead .check, .notices tr:hover .check, .check:checked, .check:indeterminate, .check:focus-visible, body[data-picking] .check { opacity: 1; }
@media (hover: none) {
  .check { opacity: 1; }
}
/* Gdy coś jest zaznaczone, kliknięcie w wiersz też zaznacza. */
body[data-picking] .notices tbody tr:has([data-pick]) { cursor: pointer; }
.pick-hint { color: var(--color-text-faint); font-size: var(--text-sm); }
.pick-bar { position: fixed; z-index: 25; bottom: var(--space-5); left: 50%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); width: max-content; max-width: calc(100vw - 2 * var(--space-4)); margin: 0; padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4); transform: translateX(-50%); border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); background: var(--popover-bg); box-shadow: var(--popover-shadow); animation: rise-in var(--motion-expand) var(--motion-ease); }
.pick-bar strong { color: var(--color-text-strong); font-variant-numeric: tabular-nums; }
.pick-bar .rate-button, .peek-foot .rate-button { width: 18px; height: 18px; border: 0; }
.pick-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
body:has(.pick-bar:not([hidden])) .toast { bottom: 88px; }
@keyframes rise-in { from { opacity: 0; translate: 0 10px; } }

/* ---- Podgląd ogłoszenia po najechaniu ---- */
/* Wiersze długiej nazwy stykają się, więc mysz nie gubi jej między liniami. */
.notices .row-title { padding: 3px 0; }
.table.notices tbody tr.peeked { background: var(--color-surface-active); }
.peek { position: fixed; z-index: 20; overflow: clip; border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-surface-raised); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-text-strong) 16%, transparent), 0 2px 6px color-mix(in srgb, var(--overlay-bg) 50%, transparent), -14px 12px 34px color-mix(in srgb, var(--overlay-bg) 55%, transparent), -36px 34px 100px color-mix(in srgb, var(--overlay-bg) 80%, transparent); transform-origin: 100% 40%; animation: peek-in 320ms var(--motion-ease); }
.peek.leaving { transform: translateX(14px); opacity: 0; transition: transform 150ms ease, opacity 150ms ease; pointer-events: none; }
@keyframes peek-in { from { transform: perspective(1400px) translateX(44px) rotateY(-7deg) scale(0.97); opacity: 0; } }
.peek > [data-peek] { display: flex; flex-direction: column; height: 100%; }
.peek-head { padding: var(--space-5) var(--space-5) var(--space-4); border-bottom: 1px solid var(--color-border); }
.peek-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.peek-title { display: block; margin: var(--space-2) 0 0; color: var(--color-text-strong); font-family: var(--font-heading); font-size: var(--text-lg); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); line-height: 1.3; overflow-wrap: anywhere; }
.peek-title:hover { text-decoration: underline; }
.peek-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--space-5) var(--space-5); animation: peek-content 200ms ease; }
@keyframes peek-content { from { opacity: 0; translate: 0 6px; } }
.peek-section { --pill-width: 184px; padding: var(--space-4) 0; }
.peek-section + .peek-section { border-top: 1px solid var(--color-border); }
.peek-section > h3:first-child { margin: 0 0 var(--space-3); color: var(--color-text-strong); font-size: var(--text-md); font-weight: 700; }
.peek-section .section-title { font-size: var(--text-sm); }
.peek-section .text:last-child { margin-bottom: 0; }
.peek-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border); background: var(--color-surface); }

/* ---- Menu konta: wszystko działa od razu, bez „Zamknij” ---- */
.user[aria-expanded='true'] { background: var(--color-surface-active); }
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu { position: fixed; z-index: 30; top: calc(var(--topbar-height) + var(--space-2)); right: var(--space-4); display: flex; flex-direction: column; width: min(372px, calc(100vw - 2 * var(--space-3))); overflow: clip; border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); background: var(--popover-bg); box-shadow: var(--popover-shadow); animation: menu-in 180ms var(--motion-ease); }
@keyframes menu-in { from { opacity: 0; translate: 0 -6px; } }
.account-head { padding: var(--space-4); color: var(--color-text-muted); font-size: var(--text-sm); }
.account-head strong { display: block; color: var(--color-text-strong); font-size: var(--text-md); overflow-wrap: anywhere; }
.account-section { padding: var(--space-4); border-top: 1px solid var(--color-border); }
.account-section .setting-label { font-weight: 600; }
.style-choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.style-choice { display: flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: transparent; color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 600; }
.style-choice:hover { background: var(--color-surface-hover); color: var(--color-text); }
.style-choice[aria-pressed='true'] { border-color: var(--toggle-active-border); background: var(--toggle-active-bg); color: var(--toggle-active-color); }
.speed { display: grid; grid-template-columns: repeat(4, auto); gap: 2px; padding: 2px; border: 1px solid var(--color-border); border-radius: var(--button-radius); }
.speed .segment { justify-content: center; height: 28px; padding: 0 var(--space-2); }
.account-actions { padding: var(--space-2); border-top: 1px solid var(--color-border); }
.account-actions a { display: flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: 0 var(--space-2); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.account-actions a:hover { background: var(--color-surface-hover); }

@media (width <= 1360px) {
  .topbar { gap: var(--space-3); }
  .nav a { padding: 0 var(--space-3); }
}

@media (prefers-reduced-motion: reduce) {
  .peek, .peek.leaving { transform: none; }
}

/* ---- Ogłoszenie ---- */
.columns { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: var(--space-4); }
.columns.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.column { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.column.side { position: sticky; top: var(--space-4); }
.column .card-title { font-size: var(--text-md); }
.text { max-width: 75ch; margin: 0 0 var(--space-3); line-height: 1.6; overflow-wrap: anywhere; }
.card-body > .text:last-child { margin-bottom: 0; }
.section-title { margin: var(--space-4) 0 var(--space-2); font-size: var(--text-md); font-weight: 700; }
.card-body > .section-title:first-child { margin-top: 0; }
.plain { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
/* Trafione słowo: jaśniejsze tło i mocny tekst, bez zieleni. */
mark { padding: 0 3px; border-radius: var(--radius-sm); background: var(--color-surface-active); color: var(--color-text-strong); font-weight: 700; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4); margin: 0; font-variant-numeric: tabular-nums; }
.facts dt { color: var(--color-text-faint); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.file { display: flex; align-items: center; gap: var(--space-2); padding: 0; border: 0; background: transparent; color: var(--color-text); text-align: left; }
.file svg { flex: none; color: var(--color-text-faint); }
.file:hover span { text-decoration: underline; }
.files + .hint { margin: var(--space-3) 0 0; }
.choices { display: flex; flex-direction: column; gap: 2px; margin: 0 calc(-1 * var(--space-2)); }
.column.side { --pill-width: 184px; }

/* ---- Reguły ---- */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; gap: var(--space-2); padding: 2px var(--space-3); border: 1px solid var(--color-border-strong); border-radius: var(--button-radius); background: transparent; font-size: var(--text-sm); }
.chip.add { border-style: dashed; color: var(--color-text-muted); }
.chip.add:hover { background: var(--color-surface-hover); color: var(--color-text); }
.chip svg { width: 12px; height: 12px; }
.card-body > .hint { margin: 0 0 var(--space-2); }

/* ---- Pominięte, stan odczytu ---- */
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack > .text, .stack > .hint { margin: 0; }
.stack > * { max-width: 640px; }
.form.inline { flex-direction: row; align-items: flex-end; gap: var(--space-2); }
.form.inline .field { width: 240px; }
.form.inline .button { height: 36px; }
.checks { --pill-width: 120px; }
.checks li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.source { padding-top: var(--space-2); color: var(--color-text-faint); font-size: var(--text-xs); }
dialog > .text { margin: 0; }
.dialog .form .notice { margin: 0; }
.auth-screen { height: 100%; overflow-y: auto; }

@media (width <= 1000px) {
  .columns, .columns.even { grid-template-columns: minmax(0, 1fr); }
  .column.side { position: static; }
}

@media (width <= 760px) {
  .banner { flex-direction: column; align-items: flex-start; }
  .search { width: 100%; }
  .toolbar .filters { width: 100%; }
  .notices tr.day { padding-top: var(--space-2); padding-bottom: var(--space-2); }
  .notices .day td { grid-column: 1 / -1; }
  .runs th:first-child { width: auto; }
  .nav a { padding: 0 var(--space-2); letter-spacing: 0.02em; }
  .notices thead, .accounts thead { display: none; }
  .notices tr, .accounts tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
  .notices tr:last-child, .accounts tr:last-child { border-bottom: 0; }
  .notices tbody td:nth-child(n), .accounts tbody td:nth-child(n) { display: block; width: auto; height: auto; padding: 0; border-top: 0; }
  .accounts td:nth-child(2), .accounts td:nth-child(5) { justify-self: end; }
  .accounts tbody td.optional:nth-child(n), .notices tbody td.optional:nth-child(n) { display: none; }
  .table:not(.accounts, .notices) :is(th, td) { padding-right: var(--space-2); overflow-wrap: anywhere; }
  .table:not(.accounts, .notices) :is(th, td):not(:first-child) { padding-left: var(--space-2); }
  .notices .cell-main { grid-column: 1 / -1; min-width: 0; }
  .notices .cell-rate { justify-self: end; align-self: center; width: auto; }
  .notices tr:has(> .cell-check) { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .notices tr:has(> .cell-check) .cell-main { grid-column: 2 / -1; }
  .notices tr:has(> .cell-check) .cell-deadline { grid-column: 2; }
  .notices tbody tr.day:has(> .cell-check) td:nth-child(1) { grid-column: 1; }
  .notices tbody tr.day:has(> .cell-check) td:nth-child(2) { grid-column: 2 / -1; }
  .notices tr.gap { padding: 0; }
  .notices tr.gap, .notices tr:has(+ .gap) { border-bottom: 0; }
  .notices tbody tr.gap td:nth-child(n) { grid-column: 1 / -1; height: 24px; }
  .check { width: 20px; height: 20px; }
  .pick-hint { display: none; }
  .quick-filter { width: 100%; }
  .account-menu { top: 52px; right: var(--space-3); }
  .rate .rate-button { width: 40px; height: 40px; }
  .form.inline .field { flex: 1; width: auto; }
  .tiles { grid-template-columns: 1fr 1fr; }
}

/* ---- Tylko w aplikacji ---- */
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.wrap { overflow-wrap: anywhere; }
.row-form { margin-top: var(--space-2); }
.rate, .topbar-right form { margin: 0; }
.page-header > .filters:empty { display: none; }
.checks { --pill-width: 136px; }
.checks + .text { margin-top: var(--space-3); }
/* „Hasło jednorazowe” jest dłuższe niż stany z makiety. */
.accounts { --pill-width: 148px; }
/* Rola w spoczynku wygląda jak tekst, ale nadal można ją zmienić; szerokość stała, więc nic się nie przesuwa. */
@media (hover: hover) {
  .accounts .select { margin-left: calc(-1 * var(--space-4)); }
  .accounts tr:not(:hover) .select:not(:focus-visible) { border-color: transparent; background: transparent; }
}
