/* Pulpit „Dziś” i „Dostosuj” (30.09): tylko to, czego nie ma w klockach z app.css. */

/* Nagłówek: „Dostosuj” po prawej, także na telefonie (nie spada pod tytuł) */
.pulpit-nag { align-items: flex-end; margin-bottom: 0; }
.pulpit-dostosuj { padding: 6px 12px; font-size: 13px; }
.pulpit-stany { margin: 18px 0 26px; }

/* Pigułki ponad cztery: schowane pod „jeszcze N” */
.pulpit-stany .stan-schowany { display: none; }
.pulpit-stany.rozwiniete .stan-schowany { display: list-item; }
.stan-wiecej { --k: #a1a1aa; gap: 6px; padding: 6px 14px; background: transparent; border-style: dashed; color: var(--muted); cursor: pointer; font: inherit; font-size: 14px; font-weight: 500; }
.stan-wiecej:hover { color: var(--text); background: var(--hover); }
.stan-wiecej .i { width: 15px; height: 15px; }

/* Kolumny (do czterech: L, S, T, P). Szerokości podaje --pulpit-kolumny (pulpit_uklad.szablon i pulpit.js), pusta kolumna
   jest schowana. Do 1100 px kolumny stoją jedna pod drugą; panele mają własny margines, więc bez odstępu rzędów.
   Przy trzech i czterech kolumnach pulpit bierze więcej szerokości ekranu (data-ile liczy pulpit.js i router). */
.pulpit-panele { position: relative; row-gap: 0; }
.pulpit-kol { min-width: 0; }
.pulpit-kol[hidden] { display: none; }
@media (min-width: 1101px) {
  .pulpit-panele { grid-template-columns: var(--pulpit-kolumny, minmax(0, 1fr) 340px); }
  .tresc:has(> .pulpit-panele[data-ile="3"]) { max-width: 1480px; }
  .tresc:has(> .pulpit-panele[data-ile="4"]) { max-width: 1720px; }
}

/* „W skrócie”: jednolinijkowe skróty, rozwijane w szczegóły */
.panel.skroty { padding: 4px 6px; }
.skrot + .skrot { border-top: 1px solid var(--line); }
.skrot > summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; min-height: 52px; padding: 8px 8px; border-radius: 10px; list-style: none; cursor: pointer; transition: background .12s; }
.skrot > summary::-webkit-details-marker { display: none; }
.skrot > summary:hover { background: var(--hover); }
.skrot > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.skrot-nazwa { display: grid; font-weight: 500; line-height: 1.3; min-width: 0; }
.skrot-nazwa small { font-size: 12.5px; font-weight: 400; color: var(--faint); }
.skrot-nazwa small.plus { color: var(--green); }
.skrot-nazwa small.czerwony, .skrot-nazwa small .czerwony { color: var(--red); }
.skrot-wartosc { font: 600 15px/1 var(--font-head); font-variant-numeric: tabular-nums; white-space: nowrap; }
.skrot-wartosc.czerwony { color: var(--red); }
.skrot-strzalka { color: var(--faint); transition: transform .18s var(--ease); }
.skrot[open] .skrot-strzalka { transform: rotate(90deg); }
.skrot-lista { list-style: none; margin: 0 8px 8px 46px; padding: 0; }
.skrot-lista li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; color: var(--muted); border-top: 1px solid var(--line); }
.skrot-lista li:first-child { border-top: 0; }
.skrot-lista a { color: var(--text); text-decoration: none; }
.skrot-lista a:hover { text-decoration: underline; }
.skrot-lista a.akcent { color: var(--accent-text); }
.skrot-lista b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.skrot-lista b .czerwony, .skrot-lista b.czerwony, .skrot-lista small.czerwony { color: var(--red); }
.skrot-lista small.plus { color: var(--green); font-weight: 500; }
.skrot-pl, .skrot-osoba { display: inline-flex; align-items: center; gap: 8px; }
/* Terminy współprac: najbliższy termin zamiast liczby, tytuły w liście przycięte do jednej linii */
.skrot-termin { font: 500 12.5px/1 var(--font); }
.skrot-termin .termin { color: var(--muted); }
.skrot-lista li > a:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skrot-lista li > :is(.tag, .termin) { flex: none; font-size: 12px; }
.skrot-pl .i.k { color: var(--k); }

/* ---------- Układanie „jak okna” (plan 61, pulpit.js) ----------
   Panel chwyta się za nagłówek. Leci kopia (.pulpit-leci), oryginał stoi w nowym miejscu jako zarys (.pulpit-miejsce). */
.pulpit-kol .panel-nag, .pulpit-kol .skrot > summary { -webkit-user-select: none; user-select: none; }
@media (hover: hover) and (pointer: fine) {
  .pulpit-kol [data-sekcja] > .panel-nag { cursor: grab; }
  .pulpit-kol [data-sekcja] > .panel-nag :is(a, button) { cursor: pointer; }
}
body.pulpit-ciagnie, body.pulpit-ciagnie * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
body.pulpit-szerokosc, body.pulpit-szerokosc * { cursor: col-resize !important; -webkit-user-select: none; user-select: none; }

.pulpit-leci { position: fixed; left: 0; top: 0; z-index: 40; margin: 0; max-height: 300px; overflow: hidden; pointer-events: none; border-color: var(--line-strong); box-shadow: var(--szklo-cien); will-change: transform; }
.pulpit-leci-uciety { -webkit-mask-image: linear-gradient(black calc(100% - 56px), transparent); mask-image: linear-gradient(black calc(100% - 56px), transparent); }
.skrot.pulpit-leci { padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); }
.pulpit-laduje { transition: transform var(--t-wej) var(--ease); }
.pulpit-miejsce { background: var(--accent-soft) !important; border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent) !important; transition: opacity .15s; }
.pulpit-miejsce > * { visibility: hidden; }
.skrot.pulpit-miejsce { border-radius: 10px; }
.pulpit-miejsce-ciche { opacity: .35; }

/* Zwinięty panel = sam nagłówek (dwuklik w nagłówek albo strzałka) */
.panel.zwiniety > :not(.panel-nag) { display: none; }
.panel.zwiniety > .panel-nag { margin-bottom: 4px; }
.pulpit-ster { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.panel-nag .wiecej-link ~ .pulpit-ster { margin-left: 2px; }
.uklada .panel-nag .wiecej-link ~ .pulpit-ster { margin-left: auto; }
/* Wąska kolumna: tytuł panelu się przycina, zamiast łamać nagłówek na dwie linie */
.pulpit-kol .panel-nag h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pulpit-kol .panel-nag :is(.wiecej-link, .licznik, .pulpit-ster) { flex: none; white-space: nowrap; }
.pulpit-panele:not(.uklada) .panel:not(.zwiniety) > .panel-nag .pulpit-ster { display: none; }
.pulpit-ster .ikona-btn, .pulpit-chwyt { width: 28px; height: 28px; }
.pulpit-ster .i, .pulpit-chwyt .i { width: 16px; height: 16px; }
/* Wąska kolumna (< 300 px, liczy pulpit.js): nagłówki bez ikony i linku, żeby tytuł się mieścił */
.pulpit-kol.waska .panel-nag > .kolo, .pulpit-kol.waska .panel-nag .wiecej-link, .pulpit-kol.waska .skrot > summary > .kolo { display: none; }
.pulpit-kol.waska .skrot > summary { grid-template-columns: minmax(0, 1fr) auto auto; }
.uklada .pulpit-kol.waska .skrot > summary { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
.uklada .pulpit-kol.waska .pulpit-zwin { display: none; } /* zwija też dwuklik w nagłówek */

/* Rozmiar panelu (plan 61a): róg w prawym dolnym rogu, jak w oknie. Treść pod nagłówkiem siedzi w .pulpit-tresc,
   który bez własnej wysokości ma display: contents (układ bez zmian), a z nią przewija się w środku panelu. */
.pulpit-kol .panel[data-sekcja] { position: relative; }
.pulpit-tresc { display: contents; }
.panel.ma-wys:not(.zwiniety) { display: flex; flex-direction: column; height: var(--wys); overflow: hidden; }
.panel.ma-wys:not(.zwiniety) > .panel-nag { flex: none; }
.panel.ma-wys:not(.zwiniety) > .pulpit-tresc { display: block; flex: 1 1 auto; min-height: 0; margin: 0 -18px -10px; padding: 0 18px 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.pulpit-rog { position: absolute; right: 3px; bottom: 3px; z-index: 2; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 8px 8px 15px 8px; background: none; color: var(--faint); cursor: nwse-resize; touch-action: none; opacity: 0; transition: opacity .15s, color .15s, background .15s; }
.pulpit-rog .i { width: 17px; height: 17px; stroke-width: 2; }
.pulpit-kol .panel:hover > .pulpit-rog, .pulpit-rog:focus-visible, .pulpit-rog.aktywny, .uklada .pulpit-rog { opacity: 1; }
.pulpit-rog:hover, .pulpit-rog.aktywny { color: var(--accent-text); background: var(--accent-soft); }
.pulpit-rog:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.uklada .pulpit-kol .panel[data-sekcja]:not(.pulpit-duch):not(.zwiniety) { padding-bottom: 24px; }
.uklada .panel.ma-wys:not(.zwiniety) > .pulpit-tresc { margin-bottom: -24px; padding-bottom: 24px; }
body.pulpit-rozmiar, body.pulpit-rozmiar * { cursor: nwse-resize !important; -webkit-user-select: none; user-select: none; }
@media (hover: none) { .pulpit-panele:not(.uklada) .pulpit-rog { display: none; } }

.pulpit-zwin .i { transform: rotate(90deg); transition: transform .18s var(--ease); }
.panel.zwiniety .pulpit-zwin .i { transform: none; }

/* Granica kolumn: niewidoczna, dopóki się na nią nie najedzie */
.pulpit-granica { position: absolute; top: 0; bottom: 0; z-index: 2; cursor: col-resize; touch-action: none; outline: 0; }
.pulpit-granica::after { content: ""; position: absolute; top: 10px; bottom: 26px; left: 50%; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--accent); opacity: 0; transition: opacity .15s; }
.pulpit-granica:hover::after { opacity: .45; }
.pulpit-granica.aktywna::after, .pulpit-granica:focus-visible::after { opacity: 1; }
body.pulpit-ciagnie .pulpit-granica { display: none; }

/* Pas „Nowa kolumna”: pokazuje się tylko podczas przeciągania, przy krawędzi albo w odstępie między kolumnami */
.pulpit-pas { position: absolute; top: 0; bottom: 16px; z-index: 3; width: 40px; border-radius: 14px; pointer-events: none; transition: background .15s; }
.pulpit-pas::before { content: ""; position: absolute; top: 6px; bottom: 6px; left: 50%; margin-left: -1px; border-left: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
.pulpit-pas span { position: sticky; top: 96px; display: block; margin: 14px auto; width: max-content; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; font-weight: 600; letter-spacing: .01em; color: var(--accent-text); opacity: 0; transition: opacity .15s; }
.pulpit-pas.goracy { background: color-mix(in srgb, var(--accent) 22%, transparent); outline: 1.5px dashed var(--accent); outline-offset: -1px; }
.pulpit-pas.goracy::before { display: none; }
.pulpit-pas.goracy span { opacity: 1; }

/* Tryb układania (/?uklad=1): uchwyt i „Schowaj” w nagłówkach, duchy, szklany pasek na dole */
.pulpit-chwyt { margin: 0 -3px 0 -7px; color: var(--faint); cursor: grab; touch-action: none; }
.uklada .panel-nag .wiecej-link { display: none; }
.uklada .skrot > summary { grid-template-columns: auto auto minmax(0, 1fr) auto auto auto; }
.uklada .skrot > summary .pulpit-chwyt { margin-left: -4px; }
.panel.pulpit-duch { padding-bottom: 14px; border-style: dashed; border-color: var(--line-strong); background: none; }
.panel.pulpit-duch > .panel-nag { margin-bottom: 0; }
.pulpit-duch h2, .pulpit-duch .skrot-nazwa { color: var(--muted); }
.pulpit-duch-info { font-size: 12.5px; color: var(--faint); }
.skrot.pulpit-duch > summary { cursor: default; }
.skrot.pulpit-duch > summary:hover { background: none; }

/* Stopka kolumny w trybie układania: „Dodaj sekcję” tu; pusta kolumna to przerywana ramka z opisem i „Usuń kolumnę” */
.pulpit-kol-stopka { display: flex; justify-content: center; gap: 8px; margin: -4px 0 18px; }
.pulpit-kol-stopka .przycisk { padding: 6px 13px; font-size: 13px; background: none; border-style: dashed; color: var(--muted); }
.pulpit-kol-stopka .przycisk:hover { color: var(--text); background: var(--hover); }
.pulpit-kol-stopka .przycisk .i { width: 14px; height: 14px; }
.pulpit-kol-stopka .menu-akcji-lista { min-width: 230px; max-height: 360px; overflow-y: auto; text-align: left; }
.pulpit-kol-stopka .menu-akcji-lista p { margin: 8px 10px; font-size: 13px; color: var(--muted); }
.pulpit-kol-info, .pulpit-kol-usun { display: none !important; }
.pulpit-kol:not(:has([data-sekcja])) > .pulpit-kol-stopka { flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px; margin: 0 0 16px; padding: 24px 16px; border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 18px; background: color-mix(in srgb, var(--accent) 5%, transparent); text-align: center; }
.pulpit-kol:not(:has([data-sekcja])) .pulpit-kol-info { display: grid !important; gap: 2px; margin: 0; font-size: 13px; color: var(--muted); }
.pulpit-kol-info b { color: var(--text); font: 600 15px/1.3 var(--font-head); }
.pulpit-kol:not(:has([data-sekcja])) .pulpit-kol-usun { display: inline-flex !important; border: 0; }

.pulpit-dok { position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px); padding: 8px 8px 8px 20px; border-radius: 999px; }
.pulpit-dok-opis { display: grid; margin: 0 10px 0 0; line-height: 1.3; white-space: nowrap; }
.pulpit-dok-opis b { font-size: 13.5px; font-weight: 600; }
.pulpit-dok-opis small { font-size: 12px; color: var(--muted); }
.pulpit-dok .przycisk { padding: 7px 14px; font-size: 13.5px; white-space: nowrap; }
.pulpit-dok .przycisk .i { width: 15px; height: 15px; }
.pulpit-dok .menu-akcji-lista { top: auto; right: auto; bottom: calc(100% + 12px); left: 0; min-width: 230px; max-height: min(60dvh, 420px); overflow-y: auto; }
.pulpit-dok .menu-akcji-lista p { margin: 8px 10px; font-size: 13px; color: var(--muted); }
/* Pasek nie zasłania ostatniego panelu ani toastów */
body:has(.pulpit-dok) .tresc { padding-bottom: 132px; }
body:has(.pulpit-dok) .toasty { bottom: 92px; }
.pulpit-glos { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 1100px) {
  .pulpit-dok { padding-left: 16px; }
  .pulpit-dodaj-kol { display: none !important; } /* kolumny stoją tu jedna pod drugą */
  .pulpit-dok-opis small { display: none; }
}
@media (pointer: coarse) {
  .pulpit-ster .ikona-btn, .pulpit-chwyt { width: 36px; height: 36px; }
  .pulpit-ster .i, .pulpit-chwyt .i { width: 18px; height: 18px; }
}

/* ---------- Opcje pulpitu (lista sekcji, gęstość, pigułki) ---------- */
.dost-tytul { margin: 2px 0 4px; }
.dost-wstep { margin: 0 0 18px; }
.dost-pod { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.dost-lista { list-style: none; margin: 0 -8px; padding: 0; }
.dost-sekcja { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; border-top: 1px solid var(--line); }
.dost-sekcja:first-child { border-top: 0; }
.dost-wlacz { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.dost-opis { display: grid; min-width: 0; line-height: 1.35; }
.dost-opis b { font-weight: 600; }
.dost-opis small { color: var(--faint); font-size: 12.5px; }
.dost-rodzaj { margin-left: 4px; padding: 0 6px; border-radius: 5px; background: var(--raise); color: var(--muted); font-size: 11.5px; font-weight: 500; }
.dost-sekcja:has(.przelacz:not(:checked)) :is(.kolo, .dost-opis) { opacity: .5; }
.dost-sekcja:has(.przelacz:not(:checked)) .segment { visibility: hidden; }
.dost-ster { display: flex; align-items: center; gap: 2px; flex: none; }
.dost-ster .segment { margin-right: 6px; }
.dost-ster .ikona-btn:disabled { opacity: .25; cursor: default; background: none; }

.dost-wybor { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 8px; }
.dost-karta { position: relative; display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer; transition: border-color .15s, background .15s; }
.dost-karta input { position: absolute; opacity: 0; }
.dost-karta:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dost-karta:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.dost-karta-tytul { font-weight: 600; }
.dost-karta small { color: var(--faint); font-size: 12.5px; }
/* Próbka wiersza bez własnej ramki i tła (karta w karcie), tylko kreska jak między wierszami */
.dost-probka { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0; border-block: 1px solid var(--line); }
.dost-probka-tytul { width: 100%; font-size: 13.5px; font-weight: 500; }
.dost-probka .tag { font-size: 11.5px; line-height: 19px; }

.dost-pigulki { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.dost-wlacz-maly { padding: 7px 0; font-size: 13.5px; gap: 10px; }
.dost-oddziel { grid-column: 1 / -1; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.dost-reset { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.dost-reset .i { width: 15px; height: 15px; }

@media (max-width: 760px) {
  .pulpit-nag { position: relative; flex-direction: row; align-items: flex-end; justify-content: space-between; padding-right: 44px; }
  .pulpit-nag .naglowek-akcje { position: absolute; top: -4px; right: 0; width: auto; }
  .pulpit-dostosuj { width: 38px; height: 38px; padding: 0; border-radius: 10px; }
  .pulpit-dostosuj span { display: none; }
  .pulpit-dostosuj .i { width: 18px; height: 18px; }
  .pulpit-nag h1 { font-size: 26px; }
  .pulpit-stany { margin: 14px -16px 20px; }
  .stan-wiecej { font-size: 12.5px; padding: 5px 10px; border-radius: 14px; justify-content: center; }
  .pulpit-dok { bottom: calc(80px + env(safe-area-inset-bottom)); gap: 6px; padding: 6px; }
  .pulpit-dok-opis { display: none; }
  .pulpit-dok .przycisk { padding: 8px 12px; }
  .pulpit-dok a[data-peek] span { display: none; } /* „Opcje” jako sama ikona, żeby pasek zmieścił się w 375 px */
  body:has(.pulpit-dok) .tresc { padding-bottom: calc(168px + env(safe-area-inset-bottom)); }
  body:has(.pulpit-dok) .toasty { bottom: calc(142px + env(safe-area-inset-bottom)); }
  body:has(.pulpit-dok) .igo-dymek { display: none; }
  .dost-sekcja { flex-wrap: wrap; row-gap: 4px; }
  .dost-wlacz { flex: 1 1 100%; }
  .dost-ster { margin-left: 46px; }
  .dost-wybor, .dost-pigulki { grid-template-columns: 1fr; }
}
