/* Event Knowledge Base — styl (marka EVERITUM). Self-contained, bez CDN. */

:root {
    --brand: #ED008C;
    --brand-600: #c8007a;
    --brand-050: #fff0f8;
    --brand-100: #ffe1f2;

    --ink: #1c1c21;
    --ink-2: #55555f;
    --ink-3: #8a8a95;

    --bg: #f5f6f8;
    --surface: #ffffff;
    --line: #e7e8ee;
    --line-2: #d6d7df;

    --dark: #141417;
    --dark-2: #212127;

    --ok-bg: #e8f7ee; --ok-fg: #0a7d3c;
    --err-bg: #fdeaec; --err-fg: #c8102e;
    --warn-bg: #fff4e0; --warn-fg: #9a6600;

    --radius: 16px;
    --radius-sm: 11px;
    --shadow: 0 1px 2px rgba(20,20,23,.05), 0 6px 20px rgba(20,20,23,.05);
    --maxw: 1120px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Bezpiecznik: żaden obraz nie rozpycha layoutu ponad swój kontener. */
img { max-width: 100%; height: auto; }

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }

a { color: var(--brand); }

/* ── Przyciski ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-weight: 600; line-height: 1;
    padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 11px; font-size: .85rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); border-color: var(--ink-3); }
.btn-danger { color: var(--err-fg); }
.btn-danger:hover:not(:disabled) { background: var(--err-bg); border-color: var(--err-bg); color: var(--err-fg); }

/* ── Pola formularzy ── */
input[type=text], input[type=password] {
    width: 100%; padding: 11px 12px; font: inherit; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px;
}
input[type=text]:focus, input[type=password]:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-100);
}

/* ── Logo ── */
.logo { font-weight: 800; letter-spacing: -0.03em; }
.logo-dot { color: var(--brand); }

/* ── Pasek górny ── */
.topbar { background: var(--dark); color: #fff; }
.topbar-inner {
    max-width: var(--maxw); margin: 0 auto; padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.brand .logo { color: #fff; font-size: 1.15rem; }
.brand-text { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid rgba(255,255,255,.18); padding-left: 12px; }
.brand-app { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,.55); font-weight: 600; }
.brand-event { font-size: .95rem; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-date { font-weight: 500; color: rgba(255,255,255,.7); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar .btn-ghost { background: transparent; border-color: rgba(255,255,255,.25); color: #fff; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.4); }
.logout-form { margin: 0; }

/* ── Znaczki roli ── */
.badge { font-size: .72rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.badge-admin { background: var(--brand); color: #fff; }
.badge-user { background: rgba(255,255,255,.15); color: #fff; }

/* ── Zakładki ── */
.tabs {
    position: sticky; top: 0; z-index: 15;
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.tabs-inner {
    max-width: var(--maxw); margin: 0 auto; padding: 8px 12px;
    display: flex; flex-wrap: wrap; gap: 5px; /* zakładki zawijają się do kolejnych linii */
}
.tab-add-wrap { position: relative; display: inline-flex; }
.tab-menu {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
    display: flex; flex-direction: column; min-width: 200px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
    box-shadow: 0 14px 40px rgba(20,20,23,.18);
}
.tab-menu[hidden] { display: none; } /* display:flex nie może nadpisywać atrybutu hidden */
.tab-menu-item {
    display: flex; align-items: center; gap: 8px; text-align: left;
    font: inherit; font-size: .9rem; font-weight: 600; color: var(--ink);
    background: none; border: none; border-radius: 8px; padding: 9px 11px; cursor: pointer;
}
.tab-menu-item:hover { background: var(--brand-050); color: var(--brand); }
.tab {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem;
    color: var(--ink-2); text-decoration: none; white-space: nowrap;
    border: 1px solid transparent; background: transparent; cursor: pointer;
    font-family: inherit;
}
.tab:hover { background: var(--bg); color: var(--ink); }
.tab-active, .tab-active:hover { background: var(--brand); color: #fff; }
.tab-add { border: 1px dashed var(--line-2); color: var(--ink-2); }
.tab-add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-050); }
.tab-ic { font-size: .95em; }
/* Admin: zakładki przeciągalne (zmiana kolejności) */
body[data-role="admin"] .tab[data-tab-id] { touch-action: none; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.tab-dragging { opacity: .65; box-shadow: 0 8px 22px rgba(20,20,23,.25); cursor: grabbing; }
/* Admin: dwuklik w tytuł sekcji = zmiana nazwy */
.section-title.renamable { cursor: default; }
.section-title.renamable:hover { text-decoration: underline dotted var(--line-2); text-underline-offset: 5px; }

/* ── Treść ── */
.content { max-width: var(--maxw); margin: 0 auto; padding: 22px 16px 72px; }
/* Ściąga dostępów dla admina (kto widzi/edytuje zakładkę) */
.sec-access { font-size: .72rem; color: var(--ink-3); margin: -8px 0 10px; }
.sec-access-sep { margin: 0 6px; opacity: .6; }
.sec-access-btn {
    margin-left: 8px; padding: 1px 9px; cursor: pointer;
    font: inherit; font-size: .68rem; color: var(--ink-3);
    background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
}
.sec-access-btn:hover { color: var(--ink); border-color: var(--ink-3); }
/* Stopka sekcji: przycisk „Usuń sekcję" na samym dole strony (admin) */
.sec-footer { margin-top: 34px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
/* Dwa pola nazwy (PL/EN) w modalu zakładek */
.modal-lbl { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-2); margin: 10px 0 4px; }
.modal-lbl:first-child { margin-top: 0; }
.modal-input2 { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.section-title { font-size: 1.5rem; font-weight: 800; }
.section-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { color: var(--ink-3); padding: 28px 0; text-align: center; }

/* ── Uploader (pod listą plików) ── */
.uploader { margin-top: 22px; }
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    text-align: center; padding: 26px 16px; cursor: pointer;
    border: 2px dashed var(--line-2); border-radius: var(--radius);
    background: var(--surface); color: var(--ink-2); transition: .15s;
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-050); }
.dropzone.drag { border-color: var(--brand); background: var(--brand-100); color: var(--ink); }
.dropzone-ic { font-size: 1.6rem; }
.dropzone-text strong { color: var(--brand); }
.dropzone-hint { font-size: .8rem; color: var(--ink-3); }
.upload-status { margin-top: 10px; font-size: .9rem; padding: 9px 12px; border-radius: 10px; background: var(--bg); color: var(--ink-2); }
.upload-status.pending { background: var(--warn-bg); color: var(--warn-fg); }
.upload-status.ok { background: var(--ok-bg); color: var(--ok-fg); }
.upload-status.error { background: var(--err-bg); color: var(--err-fg); }

/* ── Pasek sortowania ── */
.filebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filebar-label { font-size: .85rem; color: var(--ink-3); font-weight: 600; }
.sortbtn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600;
    color: var(--ink-2); text-decoration: none; border: 1px solid var(--line-2); background: var(--surface);
}
.sortbtn:hover { border-color: var(--ink-3); color: var(--ink); }
.sortbtn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── Lista plików (jeden plik = jeden wiersz) ── */
.files { display: flex; flex-direction: column; gap: 9px; }
.frow {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 10px 12px; box-shadow: var(--shadow);
}
.frow-thumb {
    flex: 0 0 auto; width: 60px; height: 60px; border-radius: 9px; overflow: hidden;
    background: #101014; display: flex; align-items: center; justify-content: center;
}
.frow-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frow-thumb-doc { background: var(--brand-050); }
.frow-ext { color: var(--brand); font-weight: 800; font-size: .72rem; letter-spacing: .02em; }
/* Miniatura PDF: canvas nakłada się na kafelek „PDF"; po wyrenderowaniu chowamy kafelek. */
.frow-thumb-pdf { position: relative; }
.frow-pdfcanvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.frow-thumb-pdf.pdf-rendered .frow-ext { display: none; }
.frow-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.frow-name {
    font-weight: 600; font-size: .95rem; color: var(--ink); text-decoration: none;
    line-height: 1.35; overflow-wrap: anywhere; word-break: break-word;
}
.frow-name:hover { color: var(--brand); text-decoration: underline; }
.frow-size { font-size: .78rem; color: var(--ink-3); }
.frow-comment {
    font-size: .85rem; color: var(--ink-2); margin-top: 3px; line-height: 1.4;
    background: var(--brand-050); border-left: 3px solid var(--brand); border-radius: 0 6px 6px 0;
    padding: 5px 9px; overflow-wrap: anywhere;
}
.frow-date { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; text-align: right; white-space: nowrap; }
.frow-date-d { font-size: .83rem; color: var(--ink-2); font-weight: 600; }
.frow-date-t { font-size: .78rem; color: var(--ink-3); }
.frow-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.frow-btn {
    font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 11px; border-radius: 8px;
    border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.frow-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.frow-btn-danger:hover { border-color: var(--err-fg); color: var(--err-fg); background: var(--err-bg); }
.frow-icon {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line-2);
    background: var(--surface); cursor: pointer; font-size: .9rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.frow-icon:hover { border-color: var(--brand); background: var(--brand-050); }
.frow-icon-danger { border-color: #f1c1c7; }
.frow-icon-danger:hover { background: var(--err-bg); border-color: var(--err-fg); }
@media (max-width: 620px) {
    .frow { gap: 10px; flex-wrap: wrap; }
    .frow-thumb { width: 48px; height: 48px; }
    .frow-date-d, .frow-date-t { font-size: .74rem; }
    /* Tylko wiersze plików (zawijane); wiersze list trzymają akcje w linii */
    .frow .frow-actions { width: 100%; justify-content: flex-end; order: 3; }
}

/* ── Archiwum (podkatalog na dole listy) ── */
.archive { margin-top: 18px; border-top: 1px dashed var(--line-2); padding-top: 14px; }
.archive-summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px; user-select: none; }
.archive-summary::-webkit-details-marker { display: none; }
.archive-summary::before { content: '▸'; color: var(--ink-3); font-size: .8rem; transition: transform .15s; }
.archive[open] .archive-summary::before { transform: rotate(90deg); }
.archive-badge { font-size: .78rem; font-weight: 800; letter-spacing: .08em; color: var(--ink-2); }
.archive-n { font-size: .78rem; font-weight: 700; color: #fff; background: var(--ink-3); border-radius: 999px; padding: 1px 8px; }

/* ── Edycja AI stron tekstowych (panel admina, nad treścią) ── */
.ai-panel {
    margin: 0 0 14px; background: var(--surface); border: 1px solid var(--brand-100);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.ai-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 10px; }
.ai-panel-title { font-weight: 800; font-size: .95rem; }
.ai-panel-hint { font-size: .8rem; color: var(--ink-3); }
.ai-panel textarea {
    width: 100%; resize: vertical; min-height: 68px;
    border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    padding: 10px 12px; font: inherit; font-size: .93rem; color: var(--ink); background: var(--bg);
}
.ai-panel textarea:focus { outline: 2px solid var(--brand-100); border-color: var(--brand); background: #fff; }
.ai-panel textarea:disabled { opacity: .6; }
.ai-panel-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.ai-panel-foot .btn { margin-left: auto; }
.ai-status { flex: 1; font-size: .88rem; padding: 8px 11px; border-radius: 10px; background: var(--bg); color: var(--ink-2); }
.ai-status.pending { background: var(--warn-bg); color: var(--warn-fg); }
.ai-status.ok { background: var(--ok-bg); color: var(--ok-fg); }
.ai-status.error { background: var(--err-bg); color: var(--err-fg); }
.ai-off { margin: 0 0 12px; font-size: .85rem; color: var(--ink-3); }

/* ── Archiwum wersji stron tekstowych ── */
.ver-banner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--warn-bg); color: var(--warn-fg); border: 1px solid #f0dfb2;
    padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: .92rem;
}
.ver-banner-actions { display: flex; gap: 8px; }
.vrows { margin-top: 12px; display: flex; flex-direction: column; }
.vrow {
    display: flex; align-items: center; gap: 14px;
    padding: 9px 4px; border-bottom: 1px solid var(--line);
}
.vrow:last-child { border-bottom: none; }
.vrow-date { font-size: .84rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vrow-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.vrow-by { flex: none; }
.vrow-desc { font-size: .88rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow-actions { display: flex; gap: 8px; flex: none; }
.vrow-actions .frow-btn { text-decoration: none; }
@media (max-width: 640px) {
    .vrow { flex-wrap: wrap; gap: 6px 14px; }
    .vrow-main { flex-basis: 100%; order: 3; }
}
.files-archive { margin-top: 12px; opacity: .85; }
.files-archive .frow { background: var(--bg); }

/* ── Notatnik: edytor RichText (contenteditable) ── */
.note-toolbar {
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
    padding: 8px 10px; background: var(--surface);
    border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0;
    position: sticky; top: 52px; z-index: 10; /* pod paskiem zakładek */
}
.ntb-btn {
    min-width: 34px; padding: 6px 9px; cursor: pointer;
    font: inherit; font-size: .85rem; color: var(--ink);
    background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px;
}
.ntb-btn:hover { border-color: var(--brand); color: var(--brand); }
.ntb-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--line); }
.note-area {
    border-radius: 0 0 14px 14px; min-height: 340px; outline: none;
    border: 1px solid var(--line);
}
.note-area:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(237,0,140,.12); }
.note-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.note-status { color: #c92a2a; font-size: .85rem; margin-right: auto; }

/* ── Karty „Linki" i „Zadania" (grupy pozycji) ── */
.lst-group {
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    padding: 14px 16px; margin-bottom: 14px;
}
.lst-group-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.lst-group-title { font-size: 1.05rem; font-weight: 800; }
/* Nazwa grupy przy lewej (za chevronem); akcje dobite do prawej */
.lst-group-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.lst-g-empty { color: var(--ink-3); font-size: .85rem; padding: 6px 0; }
/* Zwijanie grup: chevron przy tytule; zwinięta chowa zawartość */
.lst-collapse {
    width: 38px; height: 38px; padding: 0; cursor: pointer; flex: 0 0 auto;
    font: inherit; font-size: 1.1rem; line-height: 1; color: var(--ink-2);
    background: transparent; border: none; border-radius: 9px;
}
.lst-collapse:hover { color: var(--brand); background: var(--brand-050); }
.lst-group.collapsed .lst-items,
.lst-group.collapsed .lst-g-empty { display: none; }
/* Strzałki ręcznej kolejności — widoczne tylko w trybie „Zmień kolejność" */
.ord-btns { display: none; gap: 2px; }
body.lst-reorder-on .ord-btns { display: inline-flex; }
.ord-btn { padding: 4px 8px; line-height: 1; }
.lst-reorder-active { border-color: var(--brand); color: var(--brand); }
.lst-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 2px; border-top: 1px solid var(--line);
}
.lst-row:first-child { border-top: none; }
.lst-ic { flex: 0 0 auto; font-size: .9rem; }
.lst-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.lst-link { font-weight: 600; overflow-wrap: anywhere; }
.lst-host { color: var(--ink-3); font-size: .74rem; }
/* Pełny adres pod nazwą: klik = kopiowanie do schowka */
.lst-url {
    flex-basis: 100%; text-align: left; padding: 0; border: 0; background: none;
    font-family: inherit; font-size: .72rem; color: var(--ink-3);
    overflow-wrap: anywhere; cursor: copy;
}
.lst-url:hover { color: var(--ink); text-decoration: underline; }
.lst-url.copied { color: var(--brand); font-weight: 700; }
/* Komentarz do linku (jak przy plikach) */
.lst-comment {
    flex-basis: 100%; font-size: .8rem; color: var(--ink-2);
    background: var(--bg); border-radius: 8px; padding: 5px 9px; margin-top: 2px;
}
.lst-who { color: var(--ink-2); font-size: .8rem; white-space: nowrap; }
.lst-archive { padding-top: 6px; }
.lst-arch-row .lst-main { opacity: .8; }

/* Legenda stref nad kalendarzem (klik = ukryj/pokaż podkolumnę) */
.sched-zlegend { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; }
.zleg-chip {
    font: inherit; font-size: .7rem; font-weight: 600; padding: 3px 10px; cursor: pointer;
    color: var(--ink-2); background: var(--surface);
    border: 1px solid var(--line-2); border-radius: 999px;
}
.zleg-chip:hover { border-color: var(--ink-3); }
.zleg-chip.off {
    color: var(--ink-3); background: transparent; opacity: .7;
    border-style: dashed; text-decoration: line-through;
}
/* Legenda uczestników: obwódka w kolorze uczestnika (kolor nadaje JS) */
.sched-plegend { margin-top: -3px; }
.pleg-chip { border-width: 2px; }
.pleg-chip.off { opacity: .5; }

/* Konflikt czasowy: biały wykrzyknik w czerwonym trójkącie (podlista i plan) */
.conf-ic {
    display: inline-flex; align-items: flex-end; justify-content: center;
    width: 16px; height: 14px; margin-left: 5px; vertical-align: -1px; cursor: help;
    background: #e03131; clip-path: polygon(50% 0, 100% 100%, 0 100%);
    color: #fff; font-size: .62rem; font-weight: 800; line-height: 1.15;
}

/* Hover: pulsowanie blok ↔ nazwa czynności */
@keyframes ekb-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(237, 0, 140, .55); }
    55%      { box-shadow: 0 0 0 6px rgba(237, 0, 140, 0); }
}
/* Blok pulsuje CAŁY — rozjaśnienie wnętrza przez wewnętrzny cień.
   Celowo bez filter/transform/z-index: animowane właściwości kompozytowane
   potrafią wyjechać poza przycięcie kalendarza i ponad przyklejone nagłówki. */
@keyframes ekb-pulse-block {
    0%, 100% { box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0),   0 1px 2px rgba(0, 0, 0, .2); }
    50%      { box-shadow: inset 0 0 0 999px rgba(255, 255, 255, .45), 0 1px 2px rgba(0, 0, 0, .2); }
}
.sched-block.hl-pulse { animation: ekb-pulse-block .7s ease-in-out infinite; }
.slg-sub-row.hl-pulse {
    animation: ekb-pulse .9s ease-out infinite;
    background: rgba(237, 0, 140, .07); border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) {
    .sched-block.hl-pulse {
        animation: none;
        box-shadow: inset 0 0 0 999px rgba(255, 255, 255, .35), 0 1px 2px rgba(0, 0, 0, .2);
    }
    .slg-sub-row.hl-pulse {
        animation: none; box-shadow: 0 0 0 3px rgba(237, 0, 140, .45);
    }
}

/* Dziennik zmian harmonogramu (admin) */
.sched-log-wrap { margin-top: 18px; }
.slog-row {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline;
    padding: 5px 2px; border-top: 1px solid var(--line); font-size: .78rem;
}
.slog-when { color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.slog-role { font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.slog-text { flex: 1 1 240px; min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }

/* ── Obsada (type 'talent'): siatka kart osób/zespołów ── */
.tal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; padding-top: 6px; }
.lst-items.tal-grid .lst-row { border-top: none; } /* siatka zamiast wierszy */
.tal-card {
    display: flex; flex-direction: column; gap: 6px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
}
.tal-photo-wrap { position: relative; }
.tal-photo {
    display: block; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; padding: 0;
    border: 1px dashed var(--line-2); border-radius: 10px; background: var(--surface); cursor: pointer;
}
.tal-photo:disabled { cursor: default; }
.tal-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tal-init {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
    font-size: 2.2rem; font-weight: 800; color: var(--ink-3); letter-spacing: .04em;
}
.tal-photo-del {
    position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; cursor: pointer;
    border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: .7rem;
}
.tal-photo-del:hover { background: rgba(0,0,0,.75); }
.tal-name { font-weight: 800; overflow-wrap: anywhere; }
.tal-contact { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; }
.tal-contact a { color: var(--ink-2); overflow-wrap: anywhere; }
.tal-links { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; }
.tal-link { overflow-wrap: anywhere; }
.tal-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.tal-actions { display: flex; align-items: center; gap: 4px; }
.tal-status {
    font: inherit; font-size: .66rem; font-weight: 800; letter-spacing: .05em;
    padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.tal-status:disabled { cursor: default; }
.tal-st-pending   { background: #fff3bf; color: #7a5d00; border-color: #f0d879; }
.tal-st-confirmed { background: #d3f9d8; color: #1b6e2a; border-color: #9fdca9; }
.tal-st-rejected  { background: #ffe3e3; color: #b02525; border-color: #f5b5b5; }
.tal-stmenu {
    position: absolute; z-index: 60; display: flex; flex-direction: column; gap: 5px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px;
    padding: 7px; box-shadow: 0 10px 30px rgba(0,0,0,.16);
}
.tal-stmenu[hidden] { display: none; } /* display:flex wygrywa z [hidden] — jawnie chowamy */
/* Wiersze linków w modalu osoby */
.tal-linkrows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.tal-linkrow { display: flex; gap: 6px; }
.tal-linkrow input {
    padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 9px;
    font: inherit; font-size: .85rem; background: var(--surface); color: var(--ink);
}
.tal-lr-url { flex: 3; min-width: 0; }
.tal-lr-label { flex: 2; min-width: 0; }
.tal-lr-del { flex: 0 0 auto; }

/* Zadania: ptaszek i przekreślenie */
.lst-check { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--brand); cursor: pointer; }
.lst-check:disabled { cursor: default; }
.lst-todo.done .lst-todo-text { text-decoration: line-through; color: var(--ink-3); }
.lst-todo.done .lst-who { color: var(--ink-3); }

/* Termin zadania: jutro = żółte mruganie, dziś = czerwone,
   po terminie = czarne tło + biała data, mruga dalej */
.lst-due {
    font-size: .78rem; font-weight: 700; padding: 2px 9px; border-radius: 999px;
    background: var(--bg); color: var(--ink-2); white-space: nowrap;
}
@keyframes lst-blink { 50% { opacity: .25; } }
.lst-due-soon  { background: #ffe066; color: #6b5400; animation: lst-blink 1.1s step-end infinite; }
.lst-due-today { background: #e03131; color: #fff;    animation: lst-blink 1.1s step-end infinite; }
.lst-due-over  { background: #111;    color: #fff;    animation: lst-blink 1.1s step-end infinite; }
.lst-todo.done .lst-due { animation: none; background: var(--bg); color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) {
    .lst-due-soon, .lst-due-today, .lst-due-over { animation: none; }
}

/* ── Przełącznik języka (segmentowany, jak na landingu: aktywny segment
      to różowa pigułka z poświatą; bez animacji — zmiana języka przeładowuje stronę) ── */
.langsw {
    display: inline-flex; padding: 3px; border: 1px solid rgba(255,255,255,.25);
    border-radius: 999px; background: rgba(255,255,255,.04);
}
.langsw-opt {
    min-width: 40px; text-align: center; padding: 3px 11px; border-radius: 999px;
    font-size: .74rem; font-weight: 700; letter-spacing: .06em;
    text-decoration: none; color: rgba(255,255,255,.6); transition: color .15s;
}
.langsw-opt:not(.active):hover { color: #fff; }
.langsw-opt.active { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(237,0,140,.40); }
.login-langsw { position: absolute; top: 18px; right: 18px; }
.login-langsw .langsw { border-color: var(--line-2); background: var(--surface); }
.login-langsw .langsw-opt { color: var(--ink-3); }
.login-langsw .langsw-opt:not(.active):hover { color: var(--ink); }
.login-langsw .langsw-opt.active { color: #fff; }

/* ── Notka o tłumaczeniu ── */
.doc-pending {
    background: var(--warn-bg); color: var(--warn-fg); font-size: .88rem;
    padding: 9px 13px; border-radius: 10px; margin-bottom: 16px;
}

/* ── Strona tekstowa (doc) ── */
.doc {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 30px 34px; box-shadow: var(--shadow); color: var(--ink);
}
.doc > *:first-child { margin-top: 0; }
.doc h2 { font-size: 1.25rem; font-weight: 800; margin: 26px 0 10px; }
.doc h3 { font-size: 1.05rem; font-weight: 700; margin: 20px 0 8px; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc a { color: var(--brand); text-underline-offset: 2px; }
.doc hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }
.doc table { width: 100%; border-collapse: collapse; margin: 6px 0 18px; font-size: .93rem; }
.doc th, .doc td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { font-weight: 700; background: var(--bg); }
.doc .muted { color: var(--ink-3); }

/* Elementy treści zakładek tekstowych (content/*.html) */
.doc .table-wrap { overflow-x: auto; }
.doc .table-wrap table { min-width: 620px; }
.doc .tag {
    display: inline-block; font-size: .72rem; font-weight: 700;
    padding: 2px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle;
}
.doc .tag-ok  { background: var(--ok-bg); color: var(--ok-fg); }
.doc .tag-tbc { background: var(--warn-bg); color: var(--warn-fg); }
.doc .note {
    background: var(--brand-050); border: 1px solid var(--brand-100);
    padding: 10px 14px; border-radius: 10px; font-size: .9rem; margin: 0 0 14px;
}

/* Paleta dla edycji AI: kolorowe tagi i wyróżnienia (zamiast inline-styli — CSP) */
.doc .tag-pink   { background: var(--brand-100); color: var(--brand-600); }
.doc .tag-blue   { background: #e3effc; color: #1259a6; }
.doc .tag-green  { background: var(--ok-bg); color: var(--ok-fg); }
.doc .tag-yellow { background: var(--warn-bg); color: var(--warn-fg); }
.doc .tag-red    { background: var(--err-bg); color: var(--err-fg); }
.doc .tag-purple { background: #efe7fb; color: #5c2ea6; }
.doc .tag-gray   { background: #eceef2; color: #4a4a55; }
.doc .hl-pink    { background: var(--brand-050); }
.doc .hl-blue    { background: #eaf3fd; }
.doc .hl-green   { background: #eaf7f0; }
.doc .hl-yellow  { background: #fff7e6; }
.doc .hl-red     { background: #fdeef0; }
.doc .hl-gray    { background: #f1f2f5; }
.doc span[class*="hl-"] { padding: 1px 5px; border-radius: 5px; }

/* Checklisty (edycja AI): ☐ / ✔, pozycje odhaczone przekreślone */
.doc ul.checklist { list-style: none; padding-left: 6px; }
.doc ul.checklist li { position: relative; padding-left: 28px; margin: 7px 0; }
.doc ul.checklist li::before {
    content: '☐'; position: absolute; left: 2px; top: -1px;
    font-size: 1.05rem; color: var(--ink-3);
}
.doc ul.checklist li.done { color: var(--ink-3); text-decoration: line-through; }
.doc ul.checklist li.done::before { content: '✔'; color: var(--ok-fg); text-decoration: none; }
.doc-print-head { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid var(--brand); }
.doc-print-event { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.doc-print-title { font-size: 1.4rem; font-weight: 800; }
.print-only { display: none; }

/* ── Login ── */
.login-body {
    display: flex; align-items: center; justify-content: center; padding: 24px;
    min-height: 100dvh;
    background:
        radial-gradient(1200px 500px at 50% -10%, rgba(237,0,140,.28), transparent 60%),
        var(--dark);
}
.login-wrap { width: 100%; display: flex; justify-content: center; }
.login-card {
    background: var(--surface); border-radius: 20px; padding: 34px 28px 26px;
    width: min(92vw, 384px); box-shadow: 0 24px 70px rgba(0,0,0,.4);
}
.login-head { text-align: center; margin-bottom: 22px; }
.login-head .logo { font-size: 1.5rem; color: var(--ink); }
.login-head h1 { font-size: 1.05rem; font-weight: 700; margin-top: 8px; color: var(--ink); }
.login-event { margin: 6px 0 0; color: var(--brand); font-weight: 600; font-size: .92rem; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.pw-row { position: relative; display: flex; }
.pw-row input { padding-right: 44px; }
.pw-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 1.05rem; padding: 6px 8px; opacity: .55;
}
.pw-toggle.on, .pw-toggle:hover { opacity: 1; }
.login-foot { text-align: center; font-size: .78rem; color: var(--ink-3); margin: 18px 0 0; }
.alert { padding: 10px 13px; border-radius: 10px; font-size: .9rem; margin-bottom: 16px; }
.alert-error { background: var(--err-bg); color: var(--err-fg); }

/* ── Modal ── */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,20,23,.55); }
.modal-card { position: relative; background: var(--surface); border-radius: 16px; padding: 22px; width: min(92vw, 420px); box-shadow: 0 24px 70px rgba(0,0,0,.4); }
.modal-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }
.modal-card form { display: flex; flex-direction: column; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-error { font-size: .85rem; color: var(--err-fg); background: var(--err-bg); padding: 8px 11px; border-radius: 9px; }

/* ── Lightbox ── */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10,10,12,.93); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lightbox-close { position: absolute; top: 16px; right: 18px; width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(255,255,255,.14); color: #fff; font-size: 1.1rem; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,.28); }
.lightbox-caption { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.9); font-size: .9rem; padding: 0 20px; }

/* ── Harmonogram ── */
/* Sekcja-harmonogram używa pełnej szerokości okna (main.content-wide),
   a od 1200px dzieli się 40/60: lewa kolumna wykonawcy+strefy, prawa kalendarz
   z planem chronologicznym pod spodem. Kolejność w HTML (kalendarz, wykonawcy,
   strefy, plan) wyznacza układ jednokolumnowy na mobile. */
.content-wide { max-width: none; }
@media (min-width: 1200px) {
    .sched-cols {
        display: grid; grid-template-columns: 2fr 3fr; gap: 26px; align-items: start;
        grid-template-areas: 'side cal' 'side plan';
    }
    .sched-col-cal  { grid-area: cal; min-width: 0; }
    .sched-col-side { grid-area: side; min-width: 0; position: relative; padding-top: 4px; }
    .sched-cols > .sched-plan { grid-area: plan; min-width: 0; margin-top: 0; }
    .sched-col-side .sched-foot:first-child { margin-top: 0; }

    /* Zwinięta lewa kolumna: 20/80, tylko nazwy uczestników (z kolorem)
       i stref (z literą) — bez podlist czynności i bez przycisków. */
    .sched-side-toggle {
        position: absolute; top: 0; right: 0; z-index: 5;
        padding: 4px 11px; cursor: pointer; white-space: nowrap;
        font: inherit; font-size: .74rem; font-weight: 600; line-height: 1.3;
        color: var(--ink-3); background: var(--surface);
        border: 1px solid var(--line-2); border-radius: 999px;
    }
    .sched-side-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
    /* Ukryty kalendarz: znika cała zawartość prawej kolumny poza przyciskiem,
       a plan chronologiczny (obszar 'plan') wjeżdża na górę w jego miejsce. */
    .sched-cal-toggle { position: absolute; top: 0; right: 0; z-index: 5; }
    .sched-col-cal { position: relative; padding-top: 4px; }
    .sched-cols.cal-hidden .sched-col-cal > :not(.sched-cal-toggle) { display: none !important; }

    .sched-cols.side-collapsed { grid-template-columns: 1fr 4fr; }
    .sched-cols.side-collapsed .sched-col-side .slg-actions,
    .sched-cols.side-collapsed .sched-col-side .slg-sub,
    .sched-cols.side-collapsed .sched-col-side .btn { display: none; }
    .sched-cols.side-collapsed .sched-col-side .slg-row,
    .sched-cols.side-collapsed .sched-col-side .szn-row { padding: 4px 0; }
    .sched-cols.side-collapsed .sched-col-side .slg-name { overflow-wrap: anywhere; }
}
@media (max-width: 1199.98px) {
    .sched-side-toggle { display: none; } /* na mobile jedna kolumna — zwijanie bez sensu */
}
.sched { --sched-slot: 13px; }
.sa-time { width: 92px; }
.sched-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sched-toolbar input[type=date], .sched-toolbar select {
    padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 9px;
    font: inherit; font-size: .85rem; background: var(--surface); color: var(--ink);
}
.sched-range-l { font-size: .85rem; font-weight: 600; color: var(--ink-2); }

.sched-scroll {
    overflow: auto; max-height: 76dvh;
    /* Pion: po dobiciu do końca kalendarza scroll przechodzi na stronę
       (łańcuchowanie — bez tego na mobile nie dało się wrócić na górę strony).
       Poziom: zamknięty, żeby panning dni nie odpalał gestu wstecz/dalej. */
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.sched-grid { display: grid; } /* szablon kolumn/wierszy ustawia app.js (dni × strefy) */

.sched-corner { position: sticky; top: 0; left: 0; z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line); }
.sched-head {
    position: sticky; top: 0; z-index: 5; background: var(--surface); text-align: center;
    padding: 6px 4px 4px; border-bottom: 1px solid var(--line); border-left: 2px solid var(--line-2);
}
.sched-head-dow { display: block; font-size: .66rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.sched-head-date { font-size: .95rem; font-weight: 800; }
.sched-zhead {
    position: sticky; z-index: 5; background: var(--bg); text-align: center;
    font-size: .68rem; font-weight: 800; color: var(--ink-2); padding: 2px 2px 3px;
    border-bottom: 2px solid var(--line-2); border-left: 1px solid var(--line);
}
.sched-zhead.day-first { border-left: 2px solid var(--line-2); }
.sched-zhead.has-tip { cursor: help; }

.sched-gutter { position: sticky; left: 0; z-index: 4; background: var(--surface); border-right: 1px solid var(--line); }
.sched-hour {
    height: calc(var(--sched-slot) * 4); font-size: .66rem; color: var(--ink-3);
    text-align: right; padding: 1px 6px 0 0; font-variant-numeric: tabular-nums;
}
.sched-cell {
    position: relative; height: calc(var(--sched-slot) * 96); border-left: 1px solid var(--line);
    background:
        repeating-linear-gradient(to bottom,
            transparent 0, transparent calc(var(--sched-slot) * 4 - 1px),
            var(--line-2) calc(var(--sched-slot) * 4 - 1px), var(--line-2) calc(var(--sched-slot) * 4)),
        repeating-linear-gradient(to bottom,
            transparent 0, transparent calc(var(--sched-slot) - 1px),
            rgba(20,20,23,.045) calc(var(--sched-slot) - 1px), rgba(20,20,23,.045) var(--sched-slot));
}
.sched-cell.day-first { border-left: 2px solid var(--line-2); }

.sched-block {
    position: absolute; border-radius: 7px; border: 1px solid transparent; color: #fff;
    /* clip zamiast hidden: hidden łamie position sticky etykiety (tworzy scrollport) */
    overflow: hidden; overflow: clip; box-shadow: 0 1px 2px rgba(0,0,0,.2); user-select: none;
}
.sched-block.editable { cursor: grab; touch-action: manipulation; } /* dotyk: scroll przechodzi; drag po przytrzymaniu */
.sched-block { -webkit-touch-callout: none; } /* iOS: bez menu przy długim przytrzymaniu */
.sched-block.drag-lift { /* „podniesiony" blok po przytrzymaniu (bez transform — clipping) */
    box-shadow: 0 10px 26px rgba(0, 0, 0, .45),
        inset 0 0 0 999px rgba(255, 255, 255, .18);
}
.sched-block.drag-src { cursor: grabbing; z-index: 20; opacity: .9; box-shadow: 0 10px 26px rgba(0,0,0,.35); }
.sched-block.conflict { outline: 2px solid var(--err-fg); outline-offset: 1px; }
.sched-block.cont { border-top-style: dashed; border-top-left-radius: 0; border-top-right-radius: 0; }
.sched-block.cut { border-bottom-style: dashed; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sched-block-lbl {
    display: block; padding: 2px 6px 3px; font-size: .69rem; font-weight: 700; line-height: 1.25;
    text-shadow: 0 1px 1px rgba(0,0,0,.3); overflow: hidden;
    /* przy przewijaniu nazwa zsuwa się pod przyklejone nagłówki i zostaje
       widoczna na górze kalendarza, póki widać blok */
    position: sticky; top: calc(var(--sched-headh, 64px) + 3px);
}
/* Uchwyty zmiany długości bloku (górna/dolna krawędź) */
.sb-rs { position: absolute; left: 0; right: 0; height: 7px; cursor: ns-resize; touch-action: manipulation; }
.sb-rs-t { top: 0; }
.sb-rs-b { bottom: 0; }
.sched-block.editable:hover .sb-rs::after {
    content: ''; position: absolute; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.75);
}
.sb-rs-t::after { top: 2px; }
.sb-rs-b::after { bottom: 2px; }

.sched-tip {
    position: fixed; z-index: 60; max-width: 300px; pointer-events: none;
    background: var(--dark); color: #fff; padding: 10px 13px; border-radius: 11px;
    font-size: .8rem; line-height: 1.5; box-shadow: 0 14px 36px rgba(0,0,0,.4);
}
.sched-tip.pinned { pointer-events: auto; }
.sched-tip .tt-name { display: block; font-size: .87rem; font-weight: 800; }
.sched-tip .tt-sub { color: rgba(255,255,255,.72); }
.sched-tip .tt-line { display: block; }
.sched-tip .tt-conflict { display: block; margin-top: 5px; color: #ffb3c4; }
.sched-tip .tt-actions { display: flex; gap: 6px; margin-top: 9px; }
.tt-btn {
    font: inherit; font-size: .75rem; font-weight: 700; color: #fff; cursor: pointer;
    background: rgba(255,255,255,.16); border: none; border-radius: 7px; padding: 5px 11px;
}
.tt-btn:hover { background: rgba(255,255,255,.3); }
.tt-btn-danger { color: #ffb3c4; }

.sched-foot { margin-top: 20px; }
.sched-foot-title { font-size: 1.05rem; font-weight: 800; margin-bottom: 8px; }
.sched-legend, .sched-zones { display: flex; flex-direction: column; margin-bottom: 12px; }
.slg-item { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 6px; }
.slg-row, .szn-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; flex-wrap: wrap; }
.szn-row { border-bottom: 1px solid var(--line); }
.sched-zones .szn-row:last-child { border-bottom: none; }
.slg-dot { width: 14px; height: 14px; border-radius: 5px; flex: none; }
.slg-name { font-weight: 700; }
.slg-name.clickable, .slg-sub-row.clickable { cursor: pointer; }
.slg-name.clickable:hover { color: var(--brand); text-decoration: underline dotted; text-underline-offset: 3px; }
.slg-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.zl {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    min-width: 20px; height: 20px; padding: 0 4px; border-radius: 6px;
    background: var(--dark-2); color: #fff; font-size: .7rem; font-weight: 800;
}
.slg-sub { display: flex; flex-direction: column; margin: 2px 0 0 24px; }
.slg-sub-row {
    display: flex; align-items: center; gap: 8px; padding: 4px 6px;
    font-size: .85rem; border-radius: 8px;
}
.slg-sub-row.clickable:hover { background: var(--bg); }
.slg-sub-row.clickable:hover .slg-sub-name { color: var(--brand); }
.slg-sub-time { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; font-size: .8rem; }
.slg-sub-name { font-weight: 600; min-width: 0; }
.slg-sub-dur { color: var(--ink-3); font-size: .78rem; white-space: nowrap; }

/* Plan chronologiczny */
.sched-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sched-plan-head .sched-foot-title { margin-bottom: 0; }
.sched-plan-views { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-view-btn.active { border-color: var(--brand); color: var(--brand); background: var(--brand-050); }
.plan-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 4px 0 18px; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
.plan-table th, .plan-table td { text-align: left; padding: 8px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
.plan-table th { font-weight: 700; background: var(--bg); font-size: .8rem; }
.plan-table td:first-child, .plan-table td:nth-child(2), .plan-table td:nth-child(3) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.plan-company { display: flex; align-items: center; gap: 8px; font-size: .95rem; font-weight: 800; margin: 14px 0 6px; }

.f-label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.f-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.f-row .f-label { flex-direction: row; align-items: center; }
.f-row select, .f-row .sa-time, .f-row .sc-hex {
    padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 9px;
    font: inherit; font-size: .9rem; background: var(--surface); color: var(--ink);
}

/* Modal koloru wykonawcy */
.sc-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.sc-swatch {
    width: 30px; height: 30px; border-radius: 50%; padding: 0; cursor: pointer;
    border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2);
}
.sc-swatch:hover { transform: scale(1.12); }
.sc-swatch.sel { box-shadow: 0 0 0 2px var(--ink); }
.sc-wheel {
    width: 54px; height: 38px; padding: 2px; cursor: pointer;
    border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface);
}
.sc-hex { width: 120px; text-transform: lowercase; }
.slg-dot-btn { cursor: pointer; }
.slg-dot-btn:hover { outline: 2px solid var(--line-2); outline-offset: 2px; }
.modal-actions-split { justify-content: flex-start; }
.modal-actions-gap { flex: 1; }

/* ── Panel ról i uprawnień (admin) ── */
.modal-card-wide { width: min(94vw, 580px); max-height: 86dvh; overflow-y: auto; }
.rmodal-body { display: flex; flex-direction: column; gap: 4px; }
.rview-title { font-size: 1rem; font-weight: 800; margin: 4px 0 8px; }
.rview-msg { margin: 4px 0 8px; font-size: .92rem; }
.rrow {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 9px 4px; border-bottom: 1px solid var(--line);
}
.rrow-name { font-weight: 800; }
.rrow-tag {
    font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    background: var(--bg); border: 1px solid var(--line-2); color: var(--ink-3);
    padding: 2px 8px; border-radius: 999px;
}
.rrow-desc { font-size: .82rem; color: var(--ink-3); }
.rrow-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.rrow-empty { color: var(--ink-3); font-size: .88rem; padding: 10px 4px; margin: 0; }
.rrow-hint { display: block; font-size: .78rem; color: var(--ink-3); font-weight: 400; margin-top: 4px; }
.rmodal-body .f-label { margin: 8px 0 2px; }
.rmodal-body .f-row { width: 100%; }
.rmodal-body .f-row input { flex: 1; }
.r-pass-box {
    margin: 6px 0; padding: 14px 16px; text-align: center;
    background: var(--brand-050); border: 1px dashed var(--brand);
    border-radius: var(--radius-sm); color: var(--ink);
    font-size: 1.25rem; font-weight: 800; letter-spacing: .06em; user-select: all;
}
.rperm-table { display: flex; flex-direction: column; margin: 6px 0; }
.rperm-row {
    display: grid; grid-template-columns: 1fr 84px 84px; align-items: center;
    padding: 7px 4px; border-bottom: 1px solid var(--line);
}
.rperm-head { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); border-bottom: 2px solid var(--line-2); }
.rperm-name { font-weight: 600; font-size: .9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rperm-col { text-align: center; }
.rperm-col input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }

/* ── Telefon ── */
@media (max-width: 620px) {
    /* Pasek górny: chowamy nazwę appki i znaczek roli, zmniejszamy kontrolki —
       nazwa eventu zostaje widoczna (ucinana wielokropkiem). */
    .brand-app { display: none; }
    .brand { gap: 9px; }
    .brand .logo { font-size: 1rem; }
    .brand-text { padding-left: 9px; }
    .brand-event { font-size: .82rem; }
    .badge { display: none; }
    .topbar-right { gap: 6px; }
    .topbar-inner { padding: 10px 12px; }
    .logout-form .btn { padding: 6px 10px; font-size: .8rem; }
    .langsw-opt { min-width: 32px; padding: 3px 8px; font-size: .7rem; }

    /* Zakładki: ciaśniejsze pigułki = więcej mieści się na ekranie */
    .tabs-inner { padding: 7px 10px; gap: 4px; }
    .tab { padding: 7px 11px; font-size: .84rem; }

    /* Nagłówek sekcji i przyciski akcji */
    .content { padding: 16px 12px 64px; }
    .section-title { font-size: 1.25rem; }
    .section-head { margin-bottom: 12px; row-gap: 8px; }
    .section-actions { gap: 5px; }
    .section-actions .btn-sm { padding: 6px 9px; font-size: .79rem; }

    /* Strony tekstowe: mniejsze marginesy i gęstsze tabele = mniej przewijania */
    .doc { padding: 18px 14px; overflow-wrap: break-word; }
    .doc h2 { font-size: 1.13rem; margin: 20px 0 8px; }
    .doc h3 { font-size: .98rem; margin: 16px 0 7px; }
    .doc table { font-size: .86rem; }
    .doc th, .doc td { padding: 7px 9px; }
    .doc .table-wrap table { min-width: 560px; }

    /* Panel AI i archiwum wersji */
    .ai-panel { padding: 13px 13px; }
    .ai-panel-foot { flex-wrap: wrap; }
    .ver-banner { font-size: .85rem; }

    /* Galerie plików */
    .files { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 11px; }

    /* Harmonogram: mniejsze sloty (szerokości podkolumn wylicza app.js) */
    .sched { --sched-slot: 12px; }
    .sched-scroll { max-height: 70dvh; }
    .slg-actions { margin-left: 0; width: 100%; }
    .slg-sub { margin-left: 10px; }
    .plan-table { font-size: .8rem; }
    .plan-table th, .plan-table td { padding: 6px 8px; }
}

/* ── Druk / eksport PDF ── */
@media print {
    .topbar, .tabs, .section-actions, .uploader, .file-del,
    .logout-form, .modal, .lightbox, .tab-add, .sec-access, .sec-footer,
    .ai-panel, .ai-off, .archive-versions, .ver-banner,
    .lst-group-actions, .lst-row .frow-actions, .lst-check, .note-editor,
    .tal-actions, .tal-photo-del, .tal-stmenu, .ord-btns, .lst-collapse,
    .sched-toolbar, .sched, .sched-zones-wrap, .sched-contractors-wrap,
    .sched-plan-views, .sched-tip, .sched-log-wrap, .sched-zlegend, .sched-plegend { display: none !important; }
    /* Plan chronologiczny: drukuje się aktywny widok tabeli */
    .sched-cols { display: block; }
    .sched-plan .sched-foot-title { display: none; }
    .sched-plan { margin-top: 0; }
    .plan-table { box-shadow: none; font-size: 9.5pt; }
    .plan-table th, .plan-table td { padding: 4pt 6pt; border-bottom: 1px solid #ccc; }
    .plan-company { page-break-after: avoid; }
    .plan-table tr { page-break-inside: avoid; }
    body { background: #fff; }
    .content { max-width: none; padding: 0; }
    .section-head { margin: 0; }
    .doc { border: none; box-shadow: none; padding: 0; max-width: none; }
    .print-only { display: block !important; }
    a { color: var(--ink); text-decoration: none; }
    @page { margin: 18mm 16mm; }
}
