:root {
  --bg: #0f0f10;
  --bg2: #18181b;
  --bg3: #27272a;
  --line: #2e2e33;
  --fg: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #ef4444;
  --accent2: #dc2626;
  --ok: #22c55e;
  --warn: #f59e0b;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 10px 24px; background: rgba(15,15,16,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; letter-spacing: -.3px; }
.logo-mark { width: 30px; height: 22px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; }
.logo-mark svg { width: 14px; height: 14px; fill: #fff; }
.search-wrap { flex: 1; max-width: 560px; margin: 0 auto; }
.search-wrap input { width: 100%; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg2); outline: none; }
.search-wrap input:focus { border-color: #52525b; }
.actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg2); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: #fca5a5; }
.btn.danger:hover { background: #3f1d1d; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { color: var(--fg); background: var(--bg3); }

main { padding: 24px; max-width: 1800px; margin: 0 auto; }

/* grid */
.grid { display: grid; gap: 28px 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card { display: block; cursor: pointer; }
.thumb { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: var(--bg2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.03); }
.badge { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.82); padding: 1px 6px;
  border-radius: 5px; font-size: 12.5px; font-weight: 600; }
.badge.new { left: 8px; right: auto; background: var(--accent); }
.thumb .state { position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: var(--muted); font-size: 14px; padding: 12px; }
.thumb .bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); transition: width .5s; }
.card h3 { margin: 10px 0 2px; font-size: 15.5px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { color: var(--muted); font-size: 13.5px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 14px; }
.empty { text-align: center; color: var(--muted); padding: 80px 20px; }
.empty .big { font-size: 22px; color: var(--fg); margin-bottom: 8px; font-weight: 600; }

/* watch */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; }
.player { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); display: block; }
.watch h1 { font-size: 21px; margin: 14px 0 6px; line-height: 1.3; }
.watch-bar .row { flex-wrap: wrap; }
.watch-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.desc { background: var(--bg2); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; white-space: pre-wrap; }
.desc .meta { margin-bottom: 4px; font-weight: 600; color: var(--fg); }
.side { display: flex; flex-direction: column; gap: 10px; }
.side .card { display: grid; grid-template-columns: 168px 1fr; gap: 10px; }
.side .thumb { border-radius: 8px; }
.side .card h3 { margin: 0 0 2px; font-size: 14px; }
.side .meta { font-size: 12.5px; }

/* uploads panel */
.uploads { position: fixed; right: 20px; bottom: 20px; width: 360px; max-height: 60vh; overflow: auto;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); z-index: 30;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.uploads-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px;
  border-bottom: 1px solid var(--line); font-weight: 600; position: sticky; top: 0; background: var(--bg2); }
.up { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.up:last-child { border-bottom: 0; }
.up-name { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.progress { height: 5px; background: var(--bg3); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.up.done .progress > div { background: var(--ok); }
.up.err .up-row { color: #fca5a5; }

/* drop overlay */
.drop { position: fixed; inset: 0; z-index: 50; background: rgba(239,68,68,.12); border: 3px dashed var(--accent);
  display: grid; place-items: center; font-size: 24px; font-weight: 600; pointer-events: none; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 88vh; overflow: auto; padding: 22px; }
.modal-box h2 { margin: 0 0 14px; font-size: 19px; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); outline: none; }
.input:focus { border-color: #52525b; }
textarea.input { min-height: 110px; resize: vertical; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.item-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.item .meta { font-size: 12.5px; }
.linkbox { display: flex; gap: 6px; margin-top: 8px; }
.linkbox input { flex: 1; font-size: 12.5px; padding: 6px 10px; }

/* login */
.login { max-width: 380px; margin: 10vh auto; text-align: center; }
.login .logo { justify-content: center; font-size: 28px; margin-bottom: 8px; }
.login p { color: var(--muted); }
.login form { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 60; }

@media (max-width: 1000px) {
  .watch { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .search-wrap { order: 3; flex-basis: 100%; }
  main { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .uploads { left: 12px; right: 12px; width: auto; bottom: 12px; }
  .side .card { grid-template-columns: 140px 1fr; }
  .btn .lbl { display: none; }
}

/* albums */
.grid.albums { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px 18px; }
.album { display: block; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.album-stack { position: relative; padding-top: 8px; }
.album-stack::before, .album-stack::after { content: ""; position: absolute; left: 8%; right: 8%; top: 4px; height: 20px;
  border-radius: 10px 10px 0 0; background: #3f3f46; }
.album-stack::after { left: 4%; right: 4%; top: 0; background: #2a2a2f; z-index: -1; }
.album-stack::before { z-index: 0; top: 4px; }
.album-stack .thumb { z-index: 1; }
.album:hover .thumb img { transform: scale(1.03); }
.album h3 { margin: 10px 0 0; font-size: 15px; font-weight: 600; }
.album .state { font-size: 28px; }
.album-new .state { font-size: 15px; line-height: 1.6; border: 2px dashed var(--line); border-radius: var(--radius); }
.album-new:hover .state { color: var(--fg); border-color: #52525b; }
.album-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.album-head h1 { margin: 0; font-size: 24px; }
.back { font-size: 22px; }
.tag { display: inline-block; background: var(--bg3); color: var(--fg); border-radius: 6px; padding: 0 7px; font-size: 12px; margin-right: 2px; }
a.tag:hover { background: #3f3f46; }
.scope { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.scope-albums { margin: 4px 0 0 24px; display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow: auto; }
.chk { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 14px; }
.chk input { accent-color: var(--accent); }
.lnk { color: #93c5fd; }
.lnk:hover { text-decoration: underline; }
select.input { appearance: auto; color: var(--fg); background: var(--bg); }
select.input option { background: var(--bg2); color: var(--fg); }

/* card menu + selection */
.card-menu { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.7); color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; z-index: 2;
  opacity: 0; transition: opacity .15s; }
.card:hover .card-menu, .card-menu:focus { opacity: 1; }
@media (hover: none) { .card-menu { opacity: 1; } }
.card-menu:hover { background: rgba(0,0,0,.9); }
.card-check { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%; display: none;
  place-items: center; border: 2px solid #fff; background: rgba(0,0,0,.4); color: transparent; font-weight: 700; z-index: 2; }
body:has(#selbar) .card-check { display: grid; }
body:has(#selbar) .card-menu { display: none; }
.card.sel .card-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.card.sel .thumb { outline: 3px solid var(--accent); outline-offset: -3px; }
.menu { position: absolute; z-index: 45; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px; min-width: 230px; box-shadow: 0 10px 30px rgba(0,0,0,.5); display: flex; flex-direction: column; }
.menu button, .menu a { text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.menu button:hover, .menu a:hover { background: var(--bg3); }
.menu .danger { color: #fca5a5; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-bottom: 12px; }
.selbar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 35; display: flex; gap: 8px;
  align-items: center; flex-wrap: wrap; justify-content: center; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 14px; box-shadow: 0 10px 40px rgba(0,0,0,.6); max-width: calc(100% - 24px); }
.btn:disabled { opacity: .4; cursor: default; }

/* ordering */
.sortsel { display: flex; align-items: center; gap: 6px; }
.sortsel select { width: auto; padding: 5px 8px; font-size: 13px; }
.grid.reorder .card { cursor: grab; position: relative; }
.grid.reorder .card.dragging { opacity: .35; }
.grid.reorder .card.drop-before::before, .grid.reorder .card.drop-after::after { content: ""; position: absolute; top: 0; bottom: 0;
  width: 4px; border-radius: 2px; background: var(--accent); }
.grid.reorder .card.drop-before::before { left: -11px; }
.grid.reorder .card.drop-after::after { right: -11px; }
.grid.reorder .thumb { outline: 2px dashed #52525b; outline-offset: -2px; }
.ord-num { position: absolute; top: 8px; left: 8px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px;
  background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.ord-arrows { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.ord-arrows button { width: 36px; height: 32px; border-radius: 8px; border: 0; background: rgba(0,0,0,.8); color: #fff; cursor: pointer; font-size: 14px; }
.ord-arrows button:hover:not(:disabled) { background: var(--accent); }
.ord-arrows button:disabled { opacity: .3; cursor: default; }
.toolbar { flex-wrap: wrap; }

/* documents */
.fileicon { flex-direction: column; gap: 4px; color: #fff; }
.fileicon span { font-size: 46px; line-height: 1; }
.fileicon b { font-size: 14px; letter-spacing: .08em; opacity: .85; }
.side .fileicon span { font-size: 28px; }
.side .fileicon b { font-size: 11px; }
.thumb .state.fileicon { display: flex; align-items: center; justify-content: center; }
.docview { width: 100%; height: 78vh; border: 0; border-radius: var(--radius); background: #fff; display: block; }
.docview.text { background: #fafafa; }
.docimg { max-width: 100%; max-height: 80vh; display: block; margin: 0 auto; border-radius: var(--radius); }
.docbox { aspect-ratio: 16/9; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; color: #fff; text-align: center; padding: 20px; }
.docbox > span:first-child { font-size: 72px; line-height: 1; }
.docbox audio { width: min(480px, 100%); }
.docbox .meta { color: rgba(255,255,255,.75); }
.chips { display: flex; gap: 6px; margin-right: auto; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; font-size: 13.5px; }
.chip:hover { background: var(--bg3); }
.chip.on { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 600; }
@media (max-width: 640px) { .docview { height: 65vh; } }
.thumb img.docthumb { object-position: top; background: #fff; }

/* fullscreen */
.docwrap { position: relative; }
.docwrap .docimg { cursor: zoom-in; }
.fs-only { display: none !important; }
body.noscroll { overflow: hidden; }
.docwrap.fs { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; align-items: center;
  justify-content: center; overflow: hidden; }
.docwrap.fs .fs-only { display: grid !important; }
.docwrap.fs .fs-only[hidden] { display: none !important; }
.docwrap.fs .docview { width: 100%; height: 100%; border-radius: 0; }
.docwrap.fs .docimg { max-width: 100vw; max-height: 100vh; max-height: 100dvh; border-radius: 0; margin: 0; object-fit: contain; }
.docwrap.fs.zoom { display: block; overflow: auto; }
.docwrap.fs.zoom .docimg { max-width: none; max-height: none; cursor: zoom-out; }
.fs-btn { position: fixed; z-index: 101; place-items: center; border: 0; cursor: pointer; color: #fff;
  background: rgba(0,0,0,.55); border-radius: 50%; backdrop-filter: blur(4px); }
.fs-btn:hover { background: rgba(239,68,68,.9); }
.fs-close { top: 14px; right: 14px; width: 44px; height: 44px; font-size: 20px; }
/* w PDF prawy górny róg zajmuje pasek narzędzi przeglądarki — zamknięcie na dole */
.docwrap.frame .fs-close { top: auto; bottom: 20px; right: 20px; width: 52px; height: 52px; box-shadow: 0 4px 20px rgba(0,0,0,.5); background: rgba(24,24,27,.9); }
.fs-prev, .fs-next { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 34px; line-height: 1; padding-bottom: 4px; }
.fs-prev { left: 14px; }
.fs-next { right: 14px; }
.fs-cap { position: fixed; z-index: 101; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: calc(100% - 32px);
  background: rgba(0,0,0,.6); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 14px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; display: block !important; }
.docwrap:not(.fs) .fs-cap { display: none !important; }
.docwrap.fs.zoom .fs-cap, .docwrap.fs.zoom .fs-prev, .docwrap.fs.zoom .fs-next { display: none !important; }
@media (max-width: 640px) {
  .fs-prev, .fs-next { width: 42px; height: 42px; font-size: 28px; }
  .fs-prev { left: 6px; } .fs-next { right: 6px; }
}

/* back button */
.backbtn { margin-bottom: 14px; font-size: 14px; padding: 8px 16px 8px 12px; background: var(--bg3); max-width: 100%; }
.backbtn b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backbtn:hover { background: #3f3f46; }
.album-head .backbtn { margin-bottom: 0; }
.album-head { row-gap: 10px; }
@media (max-width: 640px) { .album-head .backbtn { flex-basis: 100%; justify-content: center; } }

/* logo aplikacji */
.logo-img { height: 40px; width: auto; display: block; }
.logo-img.big { height: auto; width: min(340px, 90%); margin: 0 auto 8px; }
@media (max-width: 640px) { .logo-img { height: 32px; } }

/* pokaz albumu */
.playall { margin-left: 4px; }
.show { position: fixed; inset: 0; z-index: 200; background: #000; display: flex; flex-direction: column; }
.show-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.show-stage video, .show-stage img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; display: block; }
.show-stage img.page { background: #fff; width: auto; height: 96%; max-width: 96%; box-shadow: 0 0 40px rgba(0,0,0,.6); }
.show-audio { display: flex; flex-direction: column; align-items: center; gap: 16px; color: #fff; text-align: center; padding: 20px; }
.show-audio span { font-size: 96px; }
.show-audio audio { width: min(520px, 90vw); }
.show-end { color: #fff; display: flex; flex-direction: column; align-items: center; gap: 18px; font-size: 22px; }
.show-bar { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.85));
  padding: 24px 16px 14px; transition: opacity .3s; }
.show.idle .show-bar { opacity: 0; }
.show.idle { cursor: none; }
.show-prog { height: 3px; background: rgba(255,255,255,.2); border-radius: 2px; margin-bottom: 10px; overflow: hidden; }
.show-prog div { height: 100%; background: var(--accent); width: 0; }
.show-ctrl { display: flex; align-items: center; gap: 8px; color: #fff; }
.show-cap { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.show-ctrl button { width: 44px; height: 40px; border-radius: 10px; border: 0; background: rgba(255,255,255,.12); color: #fff;
  font-size: 17px; cursor: pointer; }
.show-ctrl button:hover { background: var(--accent); }
.show-secs { display: flex; align-items: center; gap: 4px; font-size: 15px; }
.show-secs select { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 8px; padding: 8px 6px; }
.show-secs option { background: #18181b; }
/* pasek wideo ma własne kontrolki — nasz pasek nie może ich zasłaniać */
.show-stage video { padding-bottom: 70px; box-sizing: border-box; }
@media (max-width: 640px) {
  .show-cap { flex-basis: 100%; order: -1; }
  .show-ctrl { flex-wrap: wrap; justify-content: center; }
}

/* odtwarzacz / podgląd mieści się w oknie razem z tytułem i paskiem akcji */
:root { --stage-h: max(220px, calc(100vh - 280px)); }
@supports (height: 100dvh) { :root { --stage-h: max(220px, calc(100dvh - 280px)); } }
.player, .docbox { max-height: var(--stage-h); }
.docview { height: var(--stage-h); }
.docimg { max-height: var(--stage-h); }
.watch h1 { font-size: 19px; margin: 10px 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.watch-bar { row-gap: 6px; }
.backbtn { margin-bottom: 10px; padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 640px) {
  :root { --stage-h: max(220px, calc(100vh - 380px)); }
  @supports (height: 100dvh) { :root { --stage-h: max(220px, calc(100dvh - 380px)); } }
  .docview { height: var(--stage-h); }
}
@media (max-width: 400px) {
  :root { --stage-h: max(200px, calc(100vh - 440px)); }
  @supports (height: 100dvh) { :root { --stage-h: max(200px, calc(100dvh - 440px)); } }
  .watch-bar .btn.sm { padding: 5px 9px; font-size: 12.5px; }
}

/* przełącznik widoku + widok listy */
.viewsw { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-left: auto; }
.chips + .viewsw, .toolbar > .viewsw:first-child { margin-left: auto; }
.toolbar .btn + .viewsw, .toolbar .sortsel ~ .viewsw { margin-left: 0; }
.viewsw button { background: var(--bg2); border: 0; color: var(--muted); padding: 5px 12px; font-size: 16px; cursor: pointer; line-height: 1.2; }
.viewsw button:hover { color: var(--fg); background: var(--bg3); }
.viewsw button.on { background: var(--fg); color: var(--bg); }
.list-info, .list-desc { display: none; }
.grid.list { grid-template-columns: 1fr; gap: 4px; }
.grid.list .card { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: center;
  padding: 8px; border-radius: 12px; }
.grid.list .card:hover { background: var(--bg2); }
.grid.list .card:hover .thumb img { transform: none; }
.grid.list .thumb { border-radius: 8px; }
.grid.list .card h3 { margin: 0 0 4px; font-size: 16.5px; -webkit-line-clamp: 1; }
.grid.list .list-info { display: flex; flex-wrap: wrap; gap: 2px 16px; color: var(--muted); font-size: 13px; margin-top: 6px; }
.grid.list .list-info .fname { font-family: ui-monospace, monospace; font-size: 12px; opacity: .8; }
.grid.list .list-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--muted); font-size: 13.5px; margin-top: 6px; white-space: pre-line; }
.grid.list .fileicon span { font-size: 30px; }
.grid.list .fileicon b { font-size: 11px; }
@media (max-width: 640px) {
  .grid.list .card { grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 6px 0; }
  .grid.list .card h3 { font-size: 14.5px; -webkit-line-clamp: 2; }
  .grid.list .list-info { font-size: 12px; gap: 0 10px; }
  .grid.list .list-info .fname, .grid.list .list-desc { display: none; }
  .grid.list .badge { font-size: 11px; }
  .grid.list .badge.new { display: none; }
}

.scope.role { margin-top: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.tag.role-ed { background: #713f12; color: #fde68a; }

/* komentarze */
.comments { margin-top: 22px; max-width: 900px; }
.comments h2 { font-size: 17px; margin: 0 0 14px; display: flex; gap: 8px; align-items: baseline; }
.avatar { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px; }
.c-form { display: flex; gap: 12px; margin-bottom: 18px; }
.c-input { flex: 1; min-width: 0; }
.c-input textarea { resize: none; min-height: 40px; overflow: hidden; line-height: 1.45; }
.c-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.c-list { display: flex; flex-direction: column; gap: 16px; }
.c-item { display: flex; gap: 12px; }
.c-body { flex: 1; min-width: 0; }
.c-head { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.c-head .tag { font-size: 11px; }
.c-del { margin-left: auto; opacity: .5; font-size: 13px; }
.c-item:hover .c-del { opacity: 1; }
.c-text { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.c-text a { color: #93c5fd; }
.c-text a:hover { text-decoration: underline; }
.c-text .c-time { background: #1e3a8a; color: #bfdbfe; padding: 0 6px; border-radius: 5px; font-weight: 600; font-size: 13px; }
.c-empty { padding: 4px 0 10px 48px; }

/* poprawki: status komentarza + klucze API */
.c-st { margin-left: 6px; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
  padding: 1px 9px; font-size: 12px; cursor: pointer; }
.c-st:hover { color: #86efac; border-color: #166534; }
.c-item.done .c-text { opacity: .55; text-decoration: line-through; text-decoration-color: rgba(255,255,255,.35); }
.c-item.done .avatar { opacity: .5; }
.c-resolved { margin-top: 4px; font-size: 13px; color: #86efac; }
.c-note { color: var(--muted); margin-top: 2px; white-space: pre-wrap; }
.newkey { background: #052e16; border: 1px solid #166534; border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 13.5px; }
code { font-family: ui-monospace, monospace; font-size: 12.5px; background: var(--bg3); padding: 1px 5px; border-radius: 4px; }
#kForm { margin-top: 10px; flex-wrap: wrap; }
#kForm .input:first-child { flex: 1; min-width: 180px; }

/* poprawki */
.pill { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  padding: 0 7px; margin-left: 4px; line-height: 18px; }
.st { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.st-new { background: #1e3a8a; color: #bfdbfe; }
.st-todo { background: #78350f; color: #fde68a; }
.st-done { background: #14532d; color: #bbf7d0; }
.st-verified { background: #3f3f46; color: #d4d4d8; }
.st-rejected { background: #3f1d1d; color: #fca5a5; }
.c-st.go { color: #86efac; border-color: #166534; }
.c-st.go:hover { background: #14532d; color: #fff; }
.c-fixlink { font-size: 13px; font-weight: 400; margin-left: auto; }
.fx-tools { justify-content: space-between; }
.fx-tools .chips { flex-wrap: wrap; }
.chip .cnt { opacity: .6; font-weight: 400; margin-left: 2px; }
.fx-album { width: auto; }
.fx-hint { margin: -4px 0 14px; }
.fx-list { display: flex; flex-direction: column; gap: 22px; max-width: 1100px; }
.fx-group { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.fx-ghead { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.fx-ghead a b { font-size: 16px; }
.fx-ghead a:hover b { text-decoration: underline; }
.fx-ghead .btn { margin-left: auto; }
.fx-item { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.fx-item:last-child { border-bottom: 0; }
.fx-frame img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; background: #000; }
.fx-frame.none { aspect-ratio: 16/9; border-radius: 8px; background: var(--bg3); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.fx-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fx-top .c-time { background: #1e3a8a; color: #bfdbfe; padding: 1px 7px; border-radius: 5px; font-weight: 700; font-family: ui-monospace, monospace; font-size: 13px; }
.fx-text { margin: 6px 0 4px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fx-text a { color: #93c5fd; }
.fx-by { font-size: 12px; }
.fx-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fx-actions .c-st { margin-left: 0; padding: 4px 12px; font-size: 13px; }
.st-row-rejected .fx-text, .st-row-verified .fx-text { opacity: .55; }
@media (max-width: 640px) {
  .fx-item { grid-template-columns: 1fr; }
  .fx-frame img, .fx-frame.none { max-width: 320px; }
  .fx-ghead .btn { margin-left: 0; }
}

/* archiwum zdjęć */
.c-opts { flex-wrap: wrap; gap: 10px; }
.c-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.c-photos .ph { position: relative; width: 180px; }
.c-photos .ph img { width: 180px; height: 120px; object-fit: cover; border-radius: 8px; display: block; background: var(--bg3);
  border: 2px solid transparent; }
.c-photos .ph a:hover img { border-color: var(--accent); }
.ph-cap { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ph-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.75);
  color: #fff; cursor: pointer; font-size: 11px; }
.ph-x:hover { background: var(--accent); }
.c-pick:empty { display: none; }
.fx-ph-label { margin-top: 6px; font-size: 12.5px; }
.fx-photos-edit { margin-top: 12px; }
.fx-photos-edit .row { justify-content: space-between; }
.picker { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 16px; }
.picker-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; width: min(1100px, 100%); height: min(860px, 100%);
  display: flex; flex-direction: column; overflow: hidden; }
.picker-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 6px; }
.picker-head h2 { margin: 0; font-size: 18px; }
.picker-head .icon-btn { margin-left: auto; font-size: 18px; }
.picker-search { display: flex; gap: 8px; padding: 8px 18px 12px; flex-wrap: wrap; }
.picker-search #pkQ { flex: 1; min-width: 220px; }
.picker-search select { width: auto; }
.picker-search #pkYear { width: 90px; }
.picker-grid { flex: 1; min-height: 0; overflow: auto; padding: 4px 18px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-auto-rows: max-content; gap: 10px; align-content: start; }
.pk-tile { position: relative; aspect-ratio: 4/3; min-height: 0; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--bg3);
  border: 3px solid transparent; }
.pk-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pk-tile.on { border-color: var(--accent); }
.pk-check { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.45); border: 2px solid #fff; color: transparent; font-weight: 700; font-size: 13px; }
.pk-tile.on .pk-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.pk-zoom { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.65); border: 0; border-radius: 8px; padding: 5px 8px;
  font-size: 16px; cursor: zoom-in; opacity: 0; transition: opacity .15s; }
.pk-zoom:hover { background: var(--accent); }
.pk-tile:hover .pk-zoom { opacity: 1; }
@media (hover: none) { .pk-zoom { opacity: 1; } }
.pk-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: 11px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-more { text-align: center; padding: 8px; }
.picker-more:has(button[hidden]) { display: none; }
.picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pk-chosen { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.pk-chosen img { width: 44px; height: 33px; object-fit: cover; border-radius: 4px; }
p.ok { color: #86efac; } p.err { color: #fca5a5; }
.picker-box { position: relative; width: min(1400px, 100%); height: min(940px, 100%); }
.pk-view { position: absolute; inset: 0; z-index: 5; background: rgba(0,0,0,.94); display: flex; align-items: center; justify-content: center; }
.pk-view > img { max-width: 100%; max-height: calc(100% - 70px); object-fit: contain; margin-bottom: 60px; }
.pk-view .fs-btn { position: absolute; display: grid; }
.pk-view .fs-btn[hidden] { display: none; }
.pk-v-close { top: 12px; right: 12px; width: 44px; height: 44px; font-size: 20px; }
.pk-view .fs-prev, .pk-view .fs-next { top: calc(50% - 30px); transform: translateY(-50%); }
.pk-v-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; background: rgba(0,0,0,.6); flex-wrap: wrap; }
.pk-v-info { display: flex; flex-direction: column; min-width: 0; color: #fff; }
.pk-v-info span { color: #a1a1aa; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .picker { padding: 0; } .picker-box { border-radius: 0; height: 100%; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); padding: 4px 10px; }
  .c-photos .ph, .c-photos .ph img { width: 140px; } .c-photos .ph img { height: 94px; }
}
