/* Opinie Rady PUO – editorial skin (tokens.css + fonts.css), mobile first. */
* { box-sizing: border-box; }
html { color-scheme: light dark; -webkit-text-size-adjust: 100%; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.55 var(--body); font-feature-settings: "kern", "liga", "onum", "pnum";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-wrap: anywhere; min-height: 100vh;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
body.noscroll, body.noscroll-sheet { overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--garnet); outline-offset: 2px; }
mark { background: var(--hl); color: var(--ink); padding: 0 .12em; border-radius: 1px; box-shadow: inset 0 -1px 0 var(--hl-edge); }
::selection { background: var(--hl); color: var(--ink); }
code { font-family: var(--mono); font-size: .86em; background: var(--paper-3); padding: 0 .3em; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
* { scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }

/* ---------- controls ---------- */
.link, .linkish { background: none; border: 0; padding: 0; color: var(--garnet); text-align: left; font: inherit; text-decoration: underline; text-decoration-color: var(--garnet-edge); text-underline-offset: 3px; }
.link:hover, .linkish:hover { text-decoration-color: currentColor; }
.link.tiny { font-size: 12.5px; }
.btn { font-family: var(--body); font-size: 15px; padding: 8px 16px; min-height: 40px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); letter-spacing: .01em; border-radius: 0; transition: background .12s, color .12s, border-color .12s; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--garnet); border-color: var(--garnet); color: var(--paper); }
.btn.primary:hover { background: var(--garnet-2); border-color: var(--garnet-2); }
.btn.block { display: block; width: 100%; }
.icon-btn { background: none; border: 1px solid transparent; font-size: 26px; line-height: 1; width: 44px; height: 44px; color: var(--ink-3); border-radius: 0; flex: none; }
.icon-btn:hover { border-color: var(--rule); color: var(--ink); }
.icon-btn.small { font-size: 18px; width: 28px; height: 28px; }
.seg { display: inline-flex; border: 1px solid var(--ink); background: var(--paper); }
.seg button { border: 0; background: none; padding: 8px 16px; min-height: 40px; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.only-narrow { display: none; }

/* ---------- masthead ---------- */
.top { background: var(--paper); border-bottom: 3px double var(--rule); padding: 14px 16px 10px; padding-top: calc(14px + env(safe-area-inset-top)); }
.top-row { display: grid; grid-template-columns: 1fr; gap: 10px; max-width: 1400px; margin: 0 auto; }
.brand { margin: 0; font: 600 21px/1.15 var(--display); letter-spacing: -.005em; }
.brand-k { display: none; font: 500 10px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.searchbox { display: flex; gap: 8px; min-width: 0; }
.searchbox input { flex: 1; min-width: 0; font: 16px var(--body); padding: 10px 12px; min-height: 44px; border: 1px solid var(--ink-3); border-radius: 0; background: var(--paper-2); color: var(--ink); -webkit-appearance: none; appearance: none; }
.searchbox input::placeholder { color: var(--ink-4); }
.searchbox input:focus { outline: 2px solid var(--garnet); outline-offset: -1px; border-color: var(--garnet); background: var(--paper); }
.searchbox .btn { min-height: 44px; flex: none; }
.ctl-row { display: flex; gap: 8px; align-items: stretch; }
.ctl-row .seg { flex: 1; }
.ctl-row .seg button { flex: 1; min-height: 44px; }
.filters-btn { min-height: 44px; font-size: 15px; white-space: nowrap; }
.top-sub { display: flex; gap: 4px 16px; justify-content: space-between; flex-wrap: wrap; max-width: 1400px; margin: 8px auto 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.top-sub .stats { display: none; font-family: var(--mono); font-size: 11px; letter-spacing: .02em; }

/* ---------- layout ---------- */
.layout { display: block; max-width: 1400px; margin: 0 auto; padding: 8px 16px 32px; }
.results-wrap { min-width: 0; }
.sidebar-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.sidebar-title { font: 600 18px/1 var(--display); }
.sidebar-head .link { margin-left: auto; font-size: 14px; }
#clearBtn[hidden] + #sidebarClose { margin-left: auto; }
.facets { }
.facet { border-top: 1px solid var(--rule); padding: 8px 0; }
.facet summary { cursor: pointer; font: 500 11px/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 6px 0; list-style-position: outside; }
.facet summary:hover { color: var(--ink); }
.facet-list { list-style: none; margin: 2px 0 0; padding: 0; }
.facet-item { display: flex; width: 100%; gap: 10px; justify-content: space-between; align-items: baseline; text-align: left; background: none; border: 0; border-left: 2px solid transparent; padding: 7px 8px; min-height: 44px; font-size: 15.5px; line-height: 1.3; color: var(--ink-2); }
.facet-item:hover { background: var(--paper-2); color: var(--ink); }
.facet-item.on { background: var(--garnet-soft); color: var(--garnet); border-left-color: var(--garnet); font-weight: 600; }
.facet-item .fc { font: 11.5px var(--mono); color: var(--ink-4); flex: none; }
.facet-item.on .fc { color: inherit; }
.backdrop-lite { position: fixed; inset: 0; background: var(--scrim); z-index: 49; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; text-align: left; background: var(--garnet-soft); border: 1px solid var(--garnet-edge); color: var(--garnet); padding: 5px 10px; font: 12px/1.3 var(--mono); letter-spacing: .02em; min-height: 32px; }
.chip:hover { border-color: var(--garnet); }
.chip-k { color: var(--ink-3); }
.summary { font: 12px/1.5 var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); margin: 10px 0 4px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); }
.notice { background: var(--status-warn-soft); color: var(--status-warn); border-left: 3px solid var(--status-warn-edge); padding: 8px 12px; margin: 8px 0; font-size: 14.5px; }
.empty { color: var(--ink-3); padding: 20px 0; font-style: italic; }
.more-wrap { text-align: center; margin: 22px 0 40px; }
.more-wrap .btn { min-width: 220px; min-height: 44px; }

/* ---------- result rows ---------- */
.results { }
.card { padding: 18px 0 16px; border-bottom: 1px solid var(--rule-soft); }
.card-head { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.card-title { background: none; border: 0; padding: 0; font: 600 19px/1.25 var(--display); color: var(--ink); text-align: left; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.card-title:hover { color: var(--garnet); text-decoration-color: currentColor; }
.card-sum { margin: 8px 0 4px; color: var(--ink-3); font-size: 15px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; overflow: hidden; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; }
.badge { display: inline-block; max-width: 100%; font: 500 10.5px/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border: 1px solid var(--rule); border-radius: 1px; color: var(--ink-2); background: var(--paper-2); overflow-wrap: anywhere; }
.badge.o-no { color: var(--status-good); background: var(--status-good-soft); border-color: currentColor; font-weight: 600; }   /* niezasadne: no GAAR against the taxpayer */
.badge.o-ok { color: var(--status-bad); background: var(--status-bad-soft); border-color: currentColor; font-weight: 600; }    /* zasadne: GAAR applied */
.badge.o-part { color: var(--status-warn); background: var(--status-warn-soft); border-color: var(--status-warn-edge); font-weight: 600; }
.badge.o-res { color: var(--status-neutral); background: var(--status-neutral-soft); border-color: var(--status-neutral-edge); font-weight: 600; }
.badge.scheme { color: var(--garnet); background: var(--garnet-soft); border-color: var(--garnet-edge); font-weight: 600; }
.badge.dissent { border-style: dashed; border-color: var(--status-neutral-edge); color: var(--status-neutral); background: none; }
.badge.chipw { background: var(--paper-3); }
.series { margin: 8px 0 4px; }
.series-btn { background: none; border: 1px dashed var(--rule); font: 11.5px var(--mono); letter-spacing: .04em; text-transform: uppercase; padding: 5px 10px; min-height: 32px; color: var(--ink-3); }
.series-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.series-list { list-style: none; margin: 8px 0 0; padding-left: 14px; border-left: 2px solid var(--rule-soft); }
.series-list li { padding: 4px 0; }
.snips { margin-top: 10px; }
.snip { margin: 6px 0; position: relative; }
.snippet { display: block; width: 100%; text-align: left; background: none; border: 0; border-left: 2px solid var(--rule); padding: 6px 10px; }
.snippet:hover { background: var(--paper-2); border-left-color: var(--garnet); }
.sn-lab { display: block; font: 500 10.5px/1.5 var(--mono); color: var(--garnet); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 2px; }
.sn-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.snip.open .sn-text { display: block; -webkit-line-clamp: unset; line-clamp: unset; overflow: visible; }
.snip-more { background: none; border: 0; padding: 6px 10px 6px 12px; min-height: 36px; font: 500 11.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--garnet); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--garnet-edge); }
.more-toggle { font-size: 14.5px; margin: 4px 0 0 12px; padding: 8px 0; min-height: 36px; }
.also { margin-top: 8px; font-size: 14px; color: var(--ink-3); }
.linkish { cursor: pointer; }

/* ---------- reader drawer (full screen on mobile) ---------- */
.backdrop { position: fixed; inset: 0; background: transparent; z-index: 50; transition: background .2s; }
.backdrop.open { background: var(--scrim); }
.drawer { position: fixed; inset: 0; z-index: 51; background: var(--paper); display: flex; flex-direction: column; transform: translateY(16px); opacity: 0; transition: transform .2s, opacity .2s; }
.drawer.open { transform: none; opacity: 1; }
.drawer-head { background: var(--paper); border-bottom: 1px solid var(--ink); padding: 8px 8px 8px 16px; padding-top: calc(8px + env(safe-area-inset-top)); padding-left: calc(16px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right)); max-height: 55vh; max-height: 55dvh; overflow: auto; flex: none; }
.dh-top { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.dtitle { margin: 0; font: 600 19px/1.2 var(--display); flex: 1 1 0; min-width: 0; order: 1; }
.dh-top .icon-btn { order: 2; }
.dh-top .badges { order: 3; flex-basis: 100%; padding-right: 8px; }
.dh-bar { display: flex; gap: 10px; align-items: center; margin: 8px 8px 4px 0; flex-wrap: wrap; }
.dh-bar .seg { flex: 0 1 150px; }
.dh-bar .seg button { flex: 1; min-height: 44px; }
.rec-info { font-size: 13.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 2px; }
.page-ind { margin-left: auto; font: 11.5px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dmeta-wrap { margin: 2px 8px 0 0; }
.dmeta-wrap > summary, .toc > summary { cursor: pointer; font: 500 11px/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 12px 0; min-height: 44px; }
.dmeta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; padding-bottom: 8px; }
.meta-i { min-width: 0; }
.meta-k { font: 500 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.dmeta a { color: var(--garnet); text-underline-offset: 3px; }
.scheme-sum { flex-basis: 100%; font-size: 14.5px; }
.scheme-sum summary { cursor: pointer; color: var(--garnet); padding: 6px 0; }
.scheme-sum p { margin: 4px 0; max-width: 70ch; }
.drawer-body { flex: 1; overflow: auto; position: relative; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.doc-body { display: block; padding: 4px 16px calc(60px + env(safe-area-inset-bottom)); padding-left: calc(16px + env(safe-area-inset-left)); padding-right: calc(16px + env(safe-area-inset-right)); }
.toc { border-bottom: 1px solid var(--rule); margin-bottom: 12px; font-size: 14.5px; }
.toc-list { padding: 0 0 12px; }
.toc-i { display: block; padding: 9px 0; color: var(--ink); text-decoration: none; line-height: 1.3; border-top: 1px solid var(--rule-soft); }
.toc-i:hover { color: var(--garnet); }
.toc-i.l2, .toc-i.l3 { padding-left: 12px; color: var(--ink-3); }
.flow { max-width: 70ch; font-family: var(--body); font-size: 17px; line-height: 1.65; }
.ocr-note { font: 13.5px var(--body); background: var(--status-warn-soft); color: var(--status-warn); border-left: 3px solid var(--status-warn-edge); padding: 6px 10px; margin-bottom: 12px; }
.rec-text { white-space: pre-line; overflow-wrap: anywhere; }
.rec { position: relative; margin: 0 0 14px; transition: background .4s; scroll-margin-top: 12px; }
.rec.reasoning, .rec.note, .rec.signature { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); gap: 0 4px; padding: 2px 6px 2px 0; }
.rec .num { text-align: right; padding-right: 6px; color: var(--ink-4); font: 12.5px var(--mono); padding-top: .35em; font-variant-numeric: tabular-nums; }
.rec.preamble { color: var(--ink-3); font-size: 15.5px; }
.rec.signature, .rec.note { color: var(--ink-3); font-style: italic; }
.rec.operative { background: var(--paper-2); border-left: 3px solid var(--garnet); padding: 12px 14px; }
.part-lab { font: 500 10.5px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--garnet); margin-bottom: 4px; }
.rec.sel { background: var(--hl); }
.rec.sel mark { background: var(--hl-edge); }
.rec.flash, .footnotes li.flash { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 40% { background: var(--hl); } 100% { background: transparent; } }
.rec.sel.flash { animation: none; }
.rec-meta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font: 500 10px/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--rule); padding: 0 6px; }
.tag.w { color: var(--garnet); border-color: var(--garnet-edge); }
.rec-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-family: var(--body); }
.mini { background: var(--paper); border: 1px solid var(--rule); padding: 8px 14px; min-height: 44px; font: 500 12px/1.2 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.mini:hover { border-color: var(--ink); color: var(--ink); }
.sec { font-family: var(--display); line-height: 1.25; scroll-margin-top: 8px; }
h2.sec { font-size: 22px; font-weight: 600; margin: 32px 0 12px; border-bottom: 1px solid var(--ink); padding-bottom: 5px; }
h3.sec { font-size: 18px; font-weight: 600; margin: 24px 0 8px; }
h4.sec { font: italic 400 16.5px/1.3 var(--display); margin: 16px 0 6px; color: var(--ink-3); }
.fnref { text-decoration: none; color: var(--garnet); font-size: .78em; vertical-align: super; padding: 0 1px; }
.footnotes { font-size: 15px; padding-left: 28px; color: var(--ink-2); }
.footnotes li { padding: 3px 0; }
.relations { font-size: 15px; margin-top: 32px; border-top: 3px double var(--rule); padding-top: 4px; }
.relations h3 { font: 600 17px var(--display); margin: 18px 0 6px; }
.relations h4 { font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; margin: 12px 0 2px; color: var(--ink-3); }
.relations ul { margin: 0; padding-left: 18px; }
.relations li { padding: 3px 0; }

/* ---------- PDF ---------- */
.pdf-wrap { padding: 8px 0 calc(40px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; align-items: center; background: var(--paper-3); min-height: 100%; touch-action: pan-y pinch-zoom; }
.pdf-wrap > .muted { padding: 16px; }
.pdf-page { position: relative; width: 100%; max-width: 980px; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .25); }
.pdf-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pdf-ph { position: absolute; inset: 0; display: grid; place-items: center; color: #8a8a8a; font: 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.pdf-hl { position: absolute; background: var(--hl-pdf); mix-blend-mode: multiply; border-radius: 1px; pointer-events: none; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--footbar-h, 0px) + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--ink); color: var(--paper); padding: 10px 18px; z-index: 70; font-size: 14.5px; }

/* ---------- filters: bottom sheet below 900px ---------- */
@media (max-width: 899.98px) {
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column; background: var(--paper); border-top: 2px solid var(--ink); box-shadow: var(--shadow); padding: 0 16px; transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; }
  .sidebar.open { transform: none; visibility: visible; transition: transform .22s ease; }
  .sidebar-head { flex: none; padding: 6px 0 6px; margin: 0; border-bottom: 1px solid var(--rule); }
  .sidebar-head .link { padding: 12px 8px; }
  .facets { flex: 1; overflow: auto; overscroll-behavior: contain; min-height: 0; }
  .sidebar-foot { flex: none; padding: 12px 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--rule); }
  .sidebar-foot .btn { min-height: 48px; }
  .only-narrow { display: block; }
  .sidebar-head .only-narrow { display: block; }
  .btn, .more-wrap .btn { min-height: 44px; }
}
@media (max-width: 479.98px) {
  .ri-k { display: none; }
  .dh-top .badge.scheme { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top .searchbox .btn { padding-left: 14px; padding-right: 14px; }
  .top-sub .hint { font-size: 12px; }
}

/* ---------- tablet+ ---------- */
@media (min-width: 640px) {
  .brand-k { display: block; }
  .top-sub .stats { display: inline; }
}
@media (min-width: 900px) {
  .top { position: sticky; top: 0; z-index: 20; padding: 16px 28px 8px; }
  .top-row { grid-template-columns: auto minmax(280px, 1fr) auto; gap: 8px 24px; align-items: end; }
  .brand { font-size: 24px; }
  .ctl-row .seg { flex: none; }
  .ctl-row .seg button { flex: none; min-height: 44px; }
  .filters-btn { display: none; }
  .layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; padding: 18px 28px 40px; align-items: start; }
  .sidebar { position: sticky; top: 132px; max-height: calc(100vh - 148px); overflow: auto; padding: 0 12px 0 0; }
  .sidebar-head { padding-bottom: 6px; }
  .facet-item { min-height: 0; padding: 4px 8px; font-size: 15px; }
  .facet summary { padding: 4px 0; }
  .btn, .seg button { min-height: 40px; }
  .searchbox .btn { min-height: 44px; }
  .card { padding: 22px 8px 18px; }
  .card:hover { background: var(--paper-2); }
  .card-head { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
  .card-title { font-size: 20px; }
  .mini { padding: 3px 10px; min-height: 0; font-size: 11px; }
  .rec-actions { opacity: 0; transition: opacity .15s; margin-top: 4px; }
  .rec:hover .rec-actions, .rec:focus-within .rec-actions, .rec.sel .rec-actions { opacity: 1; }
  .snip-more, .more-toggle { min-height: 0; }

  .backdrop { z-index: 40; }
  .drawer { inset: 0 0 0 auto; width: 62vw; min-width: 600px; max-width: 1100px; z-index: 41; border-left: 1px solid var(--ink); box-shadow: var(--shadow); transform: translateX(30px); }
  .drawer-head { padding: 14px 20px 8px 24px; max-height: none; overflow: visible; }
  .dtitle { font-size: 23px; }
  .dh-bar .seg button { min-height: 36px; }
  .dmeta-wrap { margin: 4px 0 0; }
  .dmeta-wrap > summary { display: none; }
  .doc-body { padding: 18px 28px 60px; }
}
@media (min-width: 1100px) {
  .doc-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 32px; padding: 20px 32px 60px; }
  .toc { position: sticky; top: 0; align-self: start; max-height: calc(100vh - 240px); overflow: auto; border-bottom: 0; margin: 0; font-size: 13px; padding-right: 6px; }
  .toc > summary { pointer-events: none; list-style: none; padding: 0 0 6px; min-height: 0; }
  .toc > summary::-webkit-details-marker { display: none; }
  .toc-list { padding: 0; }
  .toc-i { padding: 4px 0; border-top: 0; }
  .flow { font-size: 17.5px; }
}
@media (min-width: 1500px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr); gap: 40px; }
}
@media (max-height: 500px) and (max-width: 899.98px) { .drawer-head { max-height: 38dvh; } .sidebar { max-height: 94dvh; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- search tools: help, sort, histogram, facets, recent, tools menu, modal ---------- */
.searchbox { position: relative; }
.help-btn { flex: none; min-width: 44px; padding: 8px 0; font: 600 16px var(--display); }
.recent { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 30; background: var(--paper); border: 1px solid var(--ink); box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
.recent-h { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; font: 500 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--rule-soft); }
.recent-h .link { text-transform: none; letter-spacing: 0; font-size: 12.5px; padding: 6px 0; }
.recent-i { padding: 10px 12px; min-height: 44px; cursor: pointer; border-bottom: 1px solid var(--rule-soft); }
.recent-i:hover, .recent-i.on { background: var(--garnet-soft); color: var(--garnet); }
.top-sub .hint .link { font-size: inherit; display: inline; }

.resbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; justify-content: space-between; margin: 10px 0 4px; border-bottom: 1px solid var(--ink); padding-bottom: 8px; }
.resbar .summary { margin: 0; padding: 0; border: 0; flex: 1 1 260px; min-width: 0; }
.seg.sort button { min-height: 34px; padding: 6px 10px; font-size: 11px; }
.seg button:disabled { color: var(--ink-4); cursor: not-allowed; text-decoration: line-through; }
.seg.mini { border-color: var(--ink-3); }
.seg.mini button { min-height: 30px; padding: 5px 9px; font-size: 10.5px; }
.seg.mini button + button { border-left-color: var(--ink-3); }

.try { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.try-k { color: var(--ink-3); font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; margin-right: 2px; }
.ex { background: var(--paper-2); border: 1px solid var(--rule); color: var(--garnet); font: 12.5px/1.3 var(--mono); padding: 6px 10px; min-height: 36px; text-align: left; overflow-wrap: anywhere; }
.ex:hover { border-color: var(--garnet); background: var(--garnet-soft); }
.chips-clear { align-self: center; margin-left: 4px; font-size: 13.5px; padding: 6px 4px; }
.notice .link { margin-left: 4px; }

.histo { margin: 8px 0 4px; max-width: 560px; }
.histo-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font: 500 11px/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.histo-h .link { text-transform: none; letter-spacing: 0; padding: 4px 0; }
.hbars { display: flex; gap: 2px; height: 84px; margin-top: 2px; }
.hbar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: stretch; background: none; border: 1px solid transparent; padding: 2px 0 0; text-align: center; }
.hbar:hover { background: var(--paper-2); border-color: var(--rule); }
.hb-n { font: 10.5px/1.3 var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.hb-track { flex: 1; display: flex; align-items: flex-end; padding: 0 20%; border-bottom: 1px solid var(--ink-4); min-height: 0; }
.hb-fill { display: block; width: 100%; background: var(--ink-4); min-height: 0; }
.hbar.zero .hb-n { color: var(--ink-4); opacity: .7; }
.hbar[aria-pressed="true"] { background: var(--garnet-soft); border-color: var(--garnet-edge); }
.hbar[aria-pressed="true"] .hb-fill { background: var(--garnet); }
.hbar[aria-pressed="true"] .hb-n, .hbar[aria-pressed="true"] .hb-y { color: var(--garnet); font-weight: 600; }
.hb-y { font: 10px/1.6 var(--mono); color: var(--ink-3); white-space: nowrap; }
.hb-n { font-size: 10px; }
.histo-tip { font: 11px/1.4 var(--mono); color: var(--ink-4); margin-top: 2px; }
.histo-h { flex-wrap: wrap; }
.histo-side .hb-track { padding: 0 14%; }
.histo-side { padding: 4px 0 8px; }
.histo-side .histo { max-width: none; }

.facet summary .sel-n { color: var(--garnet); }
.facet-tools { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin: 4px 0 6px; }
.facet-find { width: 100%; font: 14px var(--body); padding: 6px 8px; min-height: 36px; border: 1px solid var(--rule); background: var(--paper-2); color: var(--ink); border-radius: 0; -webkit-appearance: none; appearance: none; }
.facet-find:focus { outline: 2px solid var(--garnet); outline-offset: -1px; background: var(--paper); }
label.facet-item { cursor: pointer; align-items: baseline; justify-content: flex-start; }
label.facet-item input { flex: none; accent-color: var(--garnet); margin: 0; width: 16px; height: 16px; align-self: center; }
label.facet-item .fl { flex: 1; min-width: 0; }
label.facet-item:has(input:focus-visible) { outline: 2px solid var(--garnet); outline-offset: -2px; }

/* tools: inline on desktop, "⋯" menu below 900px */
.tools-btn { display: none; min-height: 44px; min-width: 44px; padding: 0; font-size: 22px; line-height: 1; }
.ctl-row { position: relative; }
.tools { display: none; }
.tool { background: var(--paper); border: 1px solid var(--rule); color: var(--ink-2); font: 500 11px/1.2 var(--mono); letter-spacing: .05em; text-transform: uppercase; padding: 8px 10px; min-height: 36px; text-align: left; }
.tool:hover { border-color: var(--ink); color: var(--ink); }
.tl-long { display: inline; } .tl-short { display: none; }
@media (max-width: 899.98px) {
  .tools-btn { display: block; }
  .tools.open { display: flex; flex-direction: column; position: absolute; right: 0; top: calc(100% + 4px); z-index: 35; width: min(300px, calc(100vw - 32px)); background: var(--paper); border: 1px solid var(--ink); box-shadow: var(--shadow); }
  .tools .tool { border: 0; border-bottom: 1px solid var(--rule-soft); min-height: 48px; font-size: 12px; padding: 12px 14px; }
  .tools .tool:last-child { border-bottom: 0; }
  .histo-side { border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
  .facet-item { min-height: 44px; }
}
@media (min-width: 900px) {
  .tools { display: flex; gap: 4px; align-items: center; }
  .tool.only-narrow { display: none; }
  .tl-long { display: none; } .tl-short { display: inline; }
  .tool { min-height: 40px; padding: 6px 9px; }
  .resbar { margin-top: 8px; }
  label.facet-item { padding: 4px 8px; }
}

/* drawer resize handle (>= 1100px) */
.drawer-resize { display: none; }
body.resizing { user-select: none; cursor: col-resize; }
body.resizing .drawer { transition: none; }
@media (min-width: 1100px) {
  .drawer-resize { display: block; position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; cursor: col-resize; z-index: 5; touch-action: none; }
  .drawer-resize::after { content: ""; position: absolute; left: 4px; top: 50%; width: 2px; height: 44px; margin-top: -22px; background: var(--rule); opacity: 0; transition: opacity .15s; }
  .drawer-resize:hover::after, .drawer-resize:focus-visible::after, body.resizing .drawer-resize::after { opacity: 1; background: var(--garnet); }
  .drawer.custom { width: clamp(40vw, var(--dw), 85vw); min-width: 0; max-width: none; }
}

/* modal */
.modal-back { z-index: 80; background: var(--scrim); }
.modal { position: fixed; z-index: 81; left: 8px; right: 8px; top: 8px; bottom: 8px; margin: auto; max-width: 760px; max-height: calc(100dvh - 16px); height: fit-content; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--ink); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 18px; border-bottom: 1px solid var(--ink); flex: none; }
.modal-head h2 { margin: 0; font: 600 20px/1.2 var(--display); }
.modal-body { overflow: auto; padding: 4px 18px 20px; overscroll-behavior: contain; }
.modal-body h3 { font: 600 17px var(--display); margin: 22px 0 6px; border-top: 3px double var(--rule); padding-top: 14px; }
.tbl-wrap { overflow-x: auto; }
table.ref { border-collapse: collapse; width: 100%; font-size: 15px; }
table.ref th { text-align: left; font: 500 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--ink); }
table.ref td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
table.ref td.exs { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; border-bottom: 0; }
table.ref tr { border-bottom: 1px solid var(--rule-soft); }
kbd { font: 12px var(--mono); border: 1px solid var(--ink-4); border-bottom-width: 2px; padding: 1px 6px; background: var(--paper-2); }
.help-notes { padding-left: 20px; font-size: 15px; }
.help-notes li { margin: 6px 0; }
@media (max-width: 599.98px) {
  table.ref, table.ref tbody, table.ref tr, table.ref td { display: block; }
  table.ref thead { display: none; }
  table.ref td { border: 0; padding: 2px 0; }
  table.ref tr { padding: 8px 0; }
}

/* ---------- search mode toggle ("Słowa | Znaczenie"), narrower filters ---------- */
.ctl-row { flex-wrap: wrap; }
.ctl-row .seg button { padding-left: 10px; padding-right: 10px; }
.top-sub .rerank { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; margin-left: 4px; }
.top-sub .rerank input { accent-color: var(--garnet); margin: 0; }
.facet-item .fl, label.facet-item .fl { overflow-wrap: anywhere; hyphens: auto; line-height: 1.3; }
.facet-item { line-height: 1.3; font-size: 14.5px; }
label.facet-item { gap: 8px; }
.facet-item .fc { padding-left: 2px; }
.sem-down { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.sem-down p { margin: 8px 0; }
@media (min-width: 900px) { .facet-item { font-size: 14px; } }
/* 900–1399px: tools in the "⋯" menu too, so the search box keeps its width next to the mode toggle */
@media (min-width: 900px) and (max-width: 1399.98px) {
  .tools-btn { display: block; }
  .tools { display: none; }
  .tools.open { display: flex; flex-direction: column; position: absolute; right: 0; top: calc(100% + 4px); z-index: 35; width: 300px; background: var(--paper); border: 1px solid var(--ink); box-shadow: var(--shadow); }
  .tools .tool { border: 0; border-bottom: 1px solid var(--rule-soft); min-height: 44px; font-size: 12px; padding: 10px 14px; }
  .tools .tool:last-child { border-bottom: 0; }
  .tl-long { display: inline; } .tl-short { display: none; }
}
.ctl-row .seg button { white-space: nowrap; }
@media (max-width: 899.98px) {
  .ctl-row .seg { flex: 1 1 40%; }
  .ctl-row .seg button { padding-left: 6px; padding-right: 6px; }
  .ctl-row .filters-btn { flex: 1 1 auto; }
}

/* ---------- przewodnik (tour.js) ---------- */
.tour-link { margin-left: auto; font-size: 12.5px; padding: 6px 0; min-height: 32px; white-space: nowrap; }
.tour-root { position: fixed; inset: 0; z-index: 1000; }
.tour-block { position: absolute; inset: 0; }
.tour-block.dim { background: var(--scrim); }
.tour-spot { position: fixed; display: none; pointer-events: none; box-shadow: 0 0 0 2px var(--garnet), 0 0 0 9999px var(--scrim); }
.tour-pop { position: fixed; width: min(380px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); overflow: auto; padding: 16px 18px 12px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: var(--shadow); outline: none; }
.tour-k { font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--garnet); margin-bottom: 8px; }
.tour-t { margin: 0 0 6px; font: 600 20px/1.2 var(--display); }
.tour-x { margin: 0 0 12px; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.tour-nav { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--rule); padding-top: 10px; }
.tour-sp { flex: 1; }
.tour-b { font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; min-height: 40px; padding: 8px 14px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); border-radius: 0; }
.tour-b:hover { background: var(--ink); color: var(--paper); }
.tour-b.primary { background: var(--garnet); border-color: var(--garnet); color: var(--paper); }
.tour-b.primary:hover { background: var(--garnet-2); border-color: var(--garnet-2); }
.tour-b.ghost { border-color: transparent; color: var(--ink-3); padding-left: 0; }
.tour-b.ghost:hover { background: none; color: var(--garnet); }
.tour-b[hidden] { display: none; }
.tour-b:focus-visible { outline: 2px solid var(--garnet); outline-offset: 2px; }
.tour-offer { position: fixed; z-index: 900; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: min(340px, calc(100vw - 32px)); padding: 12px 14px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: var(--shadow); }
.tour-offer p { margin: 0 0 10px; font-size: 15px; line-height: 1.4; }
.tour-offer-b { display: flex; gap: 8px; }
@media (max-width: 640px) {
  .tour-pop { left: 8px; right: 8px; width: auto; max-height: calc(100dvh - 16px); padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .tour-pop[data-dock="bottom"] { bottom: 8px; top: auto; }
  .tour-pop[data-dock="top"] { top: calc(8px + env(safe-area-inset-top)); bottom: auto; }
  .tour-b { min-height: 44px; }
  .tour-offer { left: 8px; right: 8px; width: auto; bottom: calc(8px + env(safe-area-inset-bottom)); }
  .tour-offer-b .tour-b { flex: 1; }
}

/* stopka: wąski pasek przyklejony do dołu + okno „O narzędziu” */
:root { --footbar-h: 30px; }
body { padding-bottom: calc(var(--footbar-h) + env(safe-area-inset-bottom)); }
.footbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; gap: .9rem;
  min-height: var(--footbar-h); padding: 0 1rem env(safe-area-inset-bottom); background: var(--paper-2); border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .03em; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.footbar a { color: var(--ink-2); }
.fb-item + .fb-item::before { content: "·"; margin-right: .9rem; color: var(--rule); }
.fb-about { margin-left: auto; background: none; border: 0; padding: .35rem 0; font: inherit; color: var(--garnet); text-decoration: underline; cursor: pointer; }
.fb-about:focus-visible { outline: 2px solid var(--garnet); outline-offset: 2px; }
@media (max-width: 700px) { .fb-wide, .footbar .fb-item:first-child { display: none; } .footbar .fb-item:nth-child(4)::before { content: none; } .footbar { gap: .6rem; padding-left: .75rem; padding-right: .75rem; } .fb-item + .fb-item::before { margin-right: .6rem; } }
.about { max-width: min(720px, calc(100vw - 2rem)); max-height: calc(100dvh - 3rem); width: 100%; padding: 1.4rem 1.6rem 1.2rem; border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink); font-family: var(--body); line-height: 1.55; overflow-y: auto; }
.about::backdrop { background: rgb(0 0 0 / .35); }
.about h2 { font-family: var(--display); margin: 0 0 .8rem; font-size: 1.5rem; }
.about h3 { font-family: var(--display); margin: 1.1rem 0 .4rem; font-size: 1.1rem; }
.about a { color: var(--garnet); }
.about ol, .about ul { padding-left: 1.3rem; } .about li { margin: .25rem 0; }
.about-close { position: absolute; top: .4rem; right: .6rem; }
.about-close button { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink-3); padding: .3rem .5rem; }
.about-note { font-size: .88rem; color: var(--ink-4); }

.footbar .fb-mcp { margin-left: auto; } .footbar .fb-mcp + .fb-about { margin-left: .9rem; }
.about code { overflow-wrap: anywhere; }
