/* =========================================================================
   LSP fast — design system
   Przekład tokenów z docs/Narzedziownik.html na klasy wielokrotnego użytku.
   Charakter: flat (radius 0, pigułki 999px), kompaktowy, granat + indygo.
   ========================================================================= */

:root {
    /* Typografia */
    --font: 'Roobert', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Kolory marki */
    --navy: #000623;
    --accent: #5768ff;
    --accent-h: #4554cc;
    --accent-50: #f0f1ff;

    /* Powierzchnie */
    --body: #f9f9f9;
    --surface: #ffffff;
    --surface-2: #f5f5f7;

    /* Tekst */
    --text: #000623;
    --text-2: #808291;
    --text-3: #666a7b;
    --text-4: #999aa8;

    /* Obramowania */
    --border: #e6e6e9;
    --border-2: #cccdd3;

    /* Stany */
    --err: #d90000;
    --err-bg: #fcd7d7;
    --ok: #1e783d;
    --ok-bg: #dcf7e5;
    --warn: #8a5a00;
    --warn-bg: #fff3d6;
    --orange: #d9730d;

    /* Promienie */
    --r: 0px;
    --r-sm: 4px;
    --r-md: 8px;
    --r-full: 999px;

    /* Cienie */
    --sh-1: 0 1px 2px rgba(0, 0, 0, 0.04);
    --sh-2: 0 2px 8px rgba(0, 0, 0, 0.08);
    --sh-3: 0 8px 24px rgba(0, 0, 0, 0.08);

    /* Metryki */
    --ctrl-h: 32px;
    --sidebar-w: 224px;
    --topbar-h: 52px;
    /* Maks. szerokość obszaru roboczego = realna szerokość treści na laptopie
       (1512 − sidebar 224 − padding 48 ≈ 1240). Na laptopie limit jest bezczynny
       (treść i tak jest węższa); na dużym monitorze ścina „rozlazłe” tabele i kotwiczy
       je do lewej (obok sidebara), zostawiając pustkę po prawej. Bez JS/media-query —
       pojedynczy max-width jest z natury responsywny. Narzędzia „planszowe”
       (szerokość = feature) omijają limit klasą `.content-wide`. */
    --content-max: 1240px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -0.2px;
    color: var(--text);
    background: var(--body);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.muted-2 { color: var(--text-4); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ============================ Szkielet aplikacji ======================== */

.app-shell {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.sidebar {
    flex: none;
    width: var(--sidebar-w);
    background: var(--navy);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 600;
    letter-spacing: -0.4px;
}

.sidebar-brand .logo {
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: var(--r-sm);
    background: var(--accent);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.sidebar-brand .brand-name {
    font-weight: 600;
}
.sidebar-brand .sub {
    display: block;
    font-size: 10.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0;
}

.sidebar-nav {
    flex: 1;
    overflow: auto;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.35);
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .ico { width: 16px; height: 16px; flex: none; }
.nav-item.disabled { color: rgba(255, 255, 255, 0.3); cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; }

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
}
.sidebar-footer .avatar {
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: var(--r-full);
    background: var(--accent);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.sidebar-footer .who { line-height: 1.25; min-width: 0; }
.sidebar-footer .who .name { color: #fff; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .who .mail { color: rgba(255, 255, 255, 0.45); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer form { margin: 0 0 0 auto; }

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-h);
    flex: none;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
}
.topbar .crumbs { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.topbar .crumbs .sep { color: var(--text-4); }
.topbar .crumbs a { color: var(--text-3); text-decoration: none; }
.topbar .crumbs a:hover { color: var(--accent); }
.topbar .crumbs .here { color: var(--text); font-weight: 500; }
.spacer { flex: 1; }

.content {
    flex: 1;
    overflow: auto;
    padding: 24px;
}
.content-narrow { max-width: 1100px; }
.page-head { margin-bottom: 20px; }
.page-head.row { justify-content: space-between; align-items: flex-start; }
.page-head h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.4px; }
.page-head p { margin: 0; color: var(--text-3); font-size: 13px; }

/* ================================ Karty ================================= */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--sh-1);
    padding: 18px;
}
.card-pad-0 { padding: 0; }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.card-body { padding: 18px; }
.card + .card { margin-top: 18px; }

/* ============================ Kafelki (start) =========================== */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.tile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--sh-1);
    padding: 18px;
    min-height: 132px;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.tile:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--sh-2); }
.tile:active { transform: translateY(1px); }
.tile .tile-ico {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: var(--r-sm);
    background: var(--accent-50);
    color: var(--accent);
    display: grid;
    place-items: center;
}
.tile .tile-title { font-size: 15px; font-weight: 600; letter-spacing: -0.3px; }
.tile .tile-desc { font-size: 12.5px; color: var(--text-3); flex: 1; }
.tile.soon { cursor: default; opacity: 0.62; }
.tile.soon:hover { border-color: var(--border); box-shadow: var(--sh-1); transform: none; }
.tile.soon .tile-ico { background: var(--surface-2); color: var(--text-4); }

/* Stan połączeń (nie narzędzia) — slot siatki na 2 kolumny (szersze paski, nazwy bez zawijania),
   w środku trzy spłaszczone paski; współdzielone krawędzie = elegancki „stos". */
.status-stack {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    min-height: 132px;            /* zachowuje się jak kafelek narzędzia w siatce */
    border: 1px solid var(--border);
    box-shadow: var(--sh-1);
    background: var(--surface);
}
/* Wąskie ekrany: gdy 2 kolumny się nie mieszczą, wróć do jednej (bez przepełnienia siatki). */
@media (max-width: 540px) {
    .status-stack { grid-column: span 1; }
}
.status-tile {
    flex: 1 1 0;                  /* trzy spłaszczone segmenty równo wypełniają wysokość kafelka */
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    color: var(--text);
    border-top: 1px solid var(--border);
    transition: background 0.12s;
}
.status-tile:first-child { border-top: none; }
.status-tile:hover { text-decoration: none; background: var(--surface-2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-4); }
.status-tile.is-ok .status-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.status-tile.is-off .status-dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }
.status-ico { display: grid; place-items: center; color: var(--text-4); flex: none; }
.status-name { font-size: 13px; font-weight: 500; white-space: nowrap; }
.status-state {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-3);
}
.status-tile.is-ok .status-state { background: var(--ok-bg); color: var(--ok); }
.status-tile.is-off .status-state { background: var(--err-bg); color: var(--err); }

/* =============================== Przyciski ============================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.2px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:hover { background: #ececef; text-decoration: none; }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }

.btn-secondary { background: var(--surface); border-color: var(--border-2); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }

.btn-danger { background: transparent; color: var(--err); border-color: transparent; }
.btn-danger:hover { background: var(--err-bg); }

.btn-sm { height: 28px; padding: 0 11px; font-size: 12px; }

.btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-3);
    border-radius: var(--r-sm);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-icon.danger:hover { background: var(--err-bg); color: var(--err); }
.btn-icon svg { width: 16px; height: 16px; }

/* ============================= Formularze =============================== */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.field .hint { font-size: 11.5px; color: var(--text-4); }

.input, .textarea, .select {
    width: 100%;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r);
    padding: 0 11px;
    height: var(--ctrl-h);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; padding: 9px 11px; min-height: 88px; line-height: 1.5; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input.is-invalid, .textarea.is-invalid { border-color: var(--err); }
.input:disabled, .textarea:disabled, .select:disabled { background: var(--surface-2); color: var(--text-4); cursor: not-allowed; opacity: 0.7; }

.field-error { color: var(--err); font-size: 11.5px; }

/* Pole kodu 2FA — jedno szerokie pole (nie sześć kratek): wklejanie i autouzupełnianie
   z maila działają bez kombinowania, a rozstrzelony monospace i tak czyta się jak kratki. */
.code-input {
    width: 100%;
    height: 52px;
    font-family: var(--mono);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: 10px;
    text-indent: 10px; /* kompensuje odstęp doklejony za ostatnią cyfrą */
    text-align: center;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.code-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.code-input.is-invalid { border-color: var(--err); }
.code-input::placeholder { color: var(--text-4); letter-spacing: 8px; }

.input-inline {
    border: none;
    background: transparent;
    padding: 4px 6px;
    height: 28px;
    width: 100%;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    border-radius: var(--r-sm);
    outline: none;
}
.input-inline:hover { background: var(--surface-2); }
.input-inline:focus { background: var(--surface); box-shadow: 0 0 0 1px var(--accent); }

.form-row { display: flex; gap: 10px; align-items: flex-end; }

/* ================================ Tabela =============================== */

/* Scroll wewnątrz tabeli (max-height) — pozwala przykleić nagłówek (sticky) i trzymać
   pasek postępu w polu widzenia podczas przewijania długiej listy. */
.table-wrap { width: 100%; overflow: auto; max-height: calc(100vh - 300px); }
/* table-layout: fixed -> szerokości kolumn wynikają z nagłówków (th[width]),
   NIE z zawartości. Dzięki temu nie skaczą przy stronicowaniu/filtrowaniu.
   Konwencja: każda tabela ustawia width na kolumnach poza jedną główną
   (bierze resztę). Patrz CLAUDE.md → Konwencje UI. */
table.lsp-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; }

/* Pasek postępu przeglądania — przyklejony nad nagłówkiem tabeli (Mail Sync).
   Rośnie L→P z każdym odhaczeniem; 100% = zielony shimmer (gotowe do „Wyczyść"). */
.review-bar { height: 4px; background: var(--surface-2); overflow: hidden; }
.review-bar-fill {
    height: 100%; width: 0;
    background: var(--accent);
    transition: width 0.45s cubic-bezier(0.2, 0.85, 0.25, 1), background-color 0.3s ease;
}
.review-bar-fill.is-complete {
    background: linear-gradient(90deg, var(--ok) 0%, #7fe3ad 50%, var(--ok) 100%);
    background-size: 200% 100%;
    animation: review-shimmer 1.6s linear infinite;
}
@keyframes review-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.lsp-table thead th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 10px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;       /* przyklejony nagłówek przy przewijaniu tabeli */
    top: 0;
    z-index: 3;
}
.lsp-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    overflow-wrap: break-word;  /* długa treść zawija się w kolumnie zamiast ją rozpychać */
}
/* Wiersz w trakcie akcji (np. odhaczenie z requestem do Gmaila) — instant feedback. */
.lsp-table tbody tr.row-busy { opacity: 0.4; pointer-events: none; transition: opacity 0.1s ease; }
.lsp-table tbody tr:last-child td { border-bottom: none; }
.lsp-table .col-actions { width: 88px; white-space: nowrap; text-align: right; }

/* Kolumna „odhacz": klikalny cel = pełna wysokość wiersza × szerokość kolumny. */
.lsp-table .col-checkoff { width: 76px; text-align: center; }
.lsp-table td.col-checkoff { padding: 0; position: relative; }
.btn-checkoff {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
    border: none; background: transparent; cursor: pointer;
    color: var(--text-4);
    transition: background .12s ease, color .12s ease, transform .06s ease;
}
.btn-checkoff:hover { background: var(--ok-bg); color: var(--ok); }
.btn-checkoff:focus-visible { outline: 2px solid var(--ok); outline-offset: -2px; }
.btn-checkoff:active { background: var(--ok); color: #fff; transform: scale(0.92); }
.btn-checkoff svg { width: 20px; height: 20px; }

/* Linki wierszowe (Gmail / LSP) — lustrzane do „odhaczenia": pełna wysokość, hover. */
.lsp-table .col-links { width: 84px; }
.lsp-table td.col-links { padding: 0; position: relative; }
.col-links .rowlinks { position: absolute; inset: 0; display: flex; }
.btn-rowlink {
    flex: 1; display: flex; align-items: center; justify-content: center;
    color: var(--text-4);
    transition: background .12s ease, color .12s ease;
}
.btn-rowlink:hover { background: var(--surface-2); color: var(--accent); }
.btn-rowlink:active { background: var(--accent-50); }
.btn-rowlink svg { width: 16px; height: 16px; }

/* Pozycja odhaczona (zaznaczona „do sprzątnięcia") — ZOSTAJE na liście, wygaszona.
   Wygaszamy treść (komórki poza kolumną checka), a sam „check" trzymamy w pełnej
   mocy w kolorze zielonym (--ok) — tym samym co na hoverze. */
.lsp-table tr.row-checked td:not(.col-checkoff) { opacity: 0.5; }
.lsp-table tr.row-checked .ticket-title { text-decoration: line-through; }
.lsp-table tr.row-checked .btn-checkoff { color: var(--ok); }
.lsp-table tr.row-checked .btn-checkoff:hover { background: var(--ok-bg); }

/* Pozycje z datą „Update — Gmail" sprzed dziś — delikatnie wytłumione tłem (starsze). */
.lsp-table tbody tr.row-prevday td { background: var(--surface-2); }

.lsp-table .ticket-title { font-weight: 500; color: var(--text); }
.lsp-table .ticket-seq { font-family: var(--mono); font-size: 11px; color: var(--text-4); }
.cell-actions { display: inline-flex; gap: 4px; }
.form-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 16px; }

/* Edytor WYSIWYG (Scheduled Comment) — contenteditable + toolbar, sterowany public/js/comment-editor.js */
.editor-toolbar { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.editor-btn {
    min-width: 30px; height: 30px; padding: 0 9px;
    border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-sm);
    cursor: pointer; font-size: 13px; color: var(--text-3);
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.editor-btn:hover { border-color: var(--border-2); color: var(--text); background: var(--surface-2); }
.editor-area { min-height: 200px; max-height: 420px; overflow-y: auto; line-height: 1.5; cursor: text; }
.editor-area:focus { outline: none; }
.editor-area.is-empty::before { content: attr(data-placeholder); color: var(--text-4); pointer-events: none; }
.editor-area ul, .editor-area ol { padding-left: 22px; margin: 4px 0; }
.editor-area a { color: var(--accent); text-decoration: underline; }
.mention-chip { background: var(--accent-50); color: var(--accent); font-weight: 600; border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.dates { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.dates .d-row { display: flex; gap: 6px; font-size: 12px; }
.dates .d-label { color: var(--text-4); min-width: 56px; }
.dates .d-val { color: var(--text-2); }

/* ============================== Pigułki ================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 9px;
    border-radius: var(--r-full);
    background: var(--surface-2);
    color: var(--text-3);
    white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-accent { background: var(--accent-50); color: var(--accent); }
/* „Wywołano mnie" — bezpośrednia @wzmianka; pełny akcent (biały tekst), by wybijał się
   z rzędu subtelnych pigułek i wspierał priorytetyzację. */
.badge-mention { background: var(--accent); color: #fff; font-weight: 600; }
/* Ton „stonowany" — np. rekomendacja „Rozważ zamknięcie" w Rankingu zadań (cicha sugestia, nie krzyk). */
.badge-muted { background: rgba(0, 0, 0, .05); color: var(--text-3); }

/* Ranking zadań — numer pozycji (tabularny, wybijający się, zawsze w jednej linii). */
.rank-num { font-weight: 700; font-size: 15px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-num.is-muted { color: var(--text-3); font-weight: 500; }

/* Subtelny przycisk odświeżenia danych z LSP w wierszu wzbogaconym. */
.btn-refresh {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-4);
    cursor: pointer;
}
.btn-refresh:hover { color: var(--accent); border-color: var(--accent); }
.btn-refresh.is-stale { color: var(--warn); border-color: var(--warn-bg); background: var(--warn-bg); }
.btn-refresh:disabled { opacity: .5; cursor: default; }

/* ============================ Stany puste ============================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 56px 40px;
    text-align: center;
}
.empty-state .ico {
    width: 46px;
    height: 46px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text-4);
    display: grid;
    place-items: center;
}
.empty-state .title { font-size: 15px; font-weight: 600; }
.empty-state .desc { font-size: 13px; color: var(--text-3); max-width: 340px; }

/* ============================== Alerty ================================= */

.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 14px;
    border-radius: var(--r);
    font-size: 13px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    margin-bottom: 14px;
}
.alert-ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.alert-err { background: var(--err-bg); border-color: transparent; color: var(--err); }
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* =============================== Toasty ================================ */
/* Globalna konwencja: potwierdzenia akcji (zapis/odświeżenie/usunięcie)
   pokazujemy jako toast — NIE jako banner przesuwający układ. */

.toast-region {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 280px;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--text-3);
    box-shadow: var(--sh-2);
    padding: 12px 14px;
    font-size: 13px;
    animation: toast-in 0.18s ease-out;
}
.toast-ok { border-left-color: var(--ok); }
.toast-err { border-left-color: var(--err); }
.toast .toast-ico { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.toast-ok .toast-ico { color: var(--ok); }
.toast-err .toast-ico { color: var(--err); }
.toast .toast-msg { flex: 1; color: var(--text); line-height: 1.45; word-break: break-word; }
/* Cofnięcie akcji z poziomu toasta (np. „Cofnij" po odpięciu z obserwujących). */
.toast .toast-act {
    flex: none; background: none; border: none; cursor: pointer; padding: 2px 6px;
    font: inherit; font-weight: 600; color: var(--accent); text-decoration: underline;
}
.toast .toast-act:hover { color: var(--text); }
.toast .toast-x {
    flex: none;
    border: none;
    background: transparent;
    color: var(--text-4);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}
.toast .toast-x:hover { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Domyślny obszar roboczy narzędzia: pełna szerokość DO limitu, potem stop.
   Blokowy div → domyślny margines 0 = kotwica do lewej (pustka po prawej).
   Wysokość rośnie swobodnie (to feature). `.content-narrow` (1100) nadal wygrywa
   tam, gdzie jest ustawiony (dashboard/QQ hub/ustawienia). */
.content-full { width: 100%; max-width: var(--content-max); }
/* Narzędzia „planszowe” — szeroki ekran to zaleta, nie wada (plansza RBH, heatmapy
   miesiąc×wiersz, siatka działów). Świadomie BEZ limitu — biorą całą szerokość. */
.content-wide { width: 100%; }

/* Kolory dat (progi w ustawieniach modułu) */
.date-warn, .dates .d-val.date-warn { color: var(--orange); font-weight: 600; }
.date-danger, .dates .d-val.date-danger { color: var(--err); font-weight: 600; }

/* Pasek narzędziowy (filtry) */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

/* Pigułki filtra (segmentowy przełącznik — jeden klik, bez dropdowna). */
.filter-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pill {
    padding: 5px 12px; border-radius: var(--r-full);
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-3); font-size: 12.5px; font-weight: 500;
    cursor: pointer; white-space: nowrap;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.pill:hover { border-color: var(--border-2); color: var(--text); }
.pill.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.toolbar-search {
    display: flex; align-items: center; gap: 7px;
    height: var(--ctrl-h); padding: 0 10px;
    border: 1px solid var(--border-2); background: var(--surface);
    min-width: 320px; color: var(--text-3);
}
.toolbar-search input {
    border: none; outline: none; background: transparent;
    font: inherit; font-size: 13px; width: 100%; color: var(--text);
}

/* Sortowalne nagłówki */
.lsp-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.lsp-table th.sortable:hover { color: var(--text); }
.sort-arrow { color: var(--accent); margin-left: 3px; }

/* Pager */
.pager {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px; border-top: 1px solid var(--border);
}

/* Link-button */
.btn-link {
    border: none; background: none; color: var(--accent); cursor: pointer;
    font: inherit; font-size: 13px; padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.btn-link:disabled { color: var(--text-4); cursor: not-allowed; text-decoration: none; }

/* Tytuł ticketa jako przycisk podglądu */
.ticket-title-btn { border: none; background: none; padding: 0; cursor: pointer; font: inherit; text-align: left; }
.ticket-title-btn:hover { color: var(--accent); text-decoration: underline; }

/* =============================== Modal ================================ */

.modal-backdrop {
    position: fixed; inset: 0; z-index: 170;
    background: rgba(0, 6, 35, 0.42);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
    background: var(--surface); box-shadow: var(--sh-3);
    width: 560px; max-width: 100%; max-height: 85vh;
    display: flex; flex-direction: column;
}
.modal.modal-preview { width: 780px; } /* pełna treść komentarzy + stopka z odpięciem */
.modal-head {
    flex: none; display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-body { flex: 1; overflow: auto; padding: 4px 18px; }
.modal-foot {
    flex: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
    padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2);
}
/* Przyciski stopki = naturalna szerokość (treść), bez rozciągania i bez ścinania tekstu;
   gdy zabraknie miejsca, stopka zawija zamiast przepełniać modal. */
.modal-foot .btn { flex: 0 0 auto; }
/* Nagłówek zakresu podglądu — okno „do zapoznania" vs. pełna historia. */
.preview-scope { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
    padding: 2px 0 10px; margin-bottom: 4px; border-bottom: 1px dashed var(--border); }
.preview-scope .btn-link { margin-left: auto; }
.preview-msg { padding: 12px 0; border-bottom: 1px solid var(--border); }
.preview-msg:last-child { border-bottom: none; }
/* Zdarzenie systemowe w podglądzie — zwięzła jedna linia (łatwe do przeskanowania). */
.preview-system { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
.preview-system .preview-date { margin-left: auto; }

/* „Dlaczego to widzę" — pasek decyzyjny na górze podglądu (wołają mnie? mój ticket?
   tylko obserwuję?). To on rozstrzyga „wchodzę i zgłębiam" vs „to nie do mnie". */
.preview-why {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.preview-why .preview-date { margin-left: auto; }
/* LSP nie odpowiedział — podgląd działa dalej, ale na skrótach z Gmaila. */
.preview-degraded {
    margin: 10px 0 0; padding: 7px 10px;
    background: color-mix(in srgb, var(--warn) 10%, transparent);
    border-left: 2px solid var(--warn); color: var(--text-2);
}
/* Komentarz wołający mnie bezpośrednio — wyróżniony w feedzie. */
.preview-msg.is-mention { border-left: 2px solid var(--accent); padding-left: 10px; margin-left: -12px; }
.preview-blocks { display: flex; flex-direction: column; gap: 6px; margin-top: 5px; }
/* WŁASNA treść komentarza — pełna, nieucięta (to po nią się tu przychodzi). */
.preview-own { font-size: 13px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
/* CYTAT = zwinięty. W LSP komentarz nagminnie zaczyna się od przytoczenia poprzedniej
   wypowiedzi; pokazywany wprost, zjadał cały podgląd i udawał nową treść. */
.preview-quote { border-left: 2px solid var(--border); padding-left: 9px; }
.preview-quote > summary {
    cursor: pointer; list-style: none; font-size: 11px; letter-spacing: .02em;
    color: var(--text-4); user-select: none;
}
.preview-quote > summary::-webkit-details-marker { display: none; }
.preview-quote > summary::before { content: '▸ '; }
.preview-quote[open] > summary::before { content: '▾ '; }
.preview-quote > summary:hover { color: var(--text-2); }
.preview-quote-body {
    font-size: 12px; line-height: 1.45; color: var(--text-3);
    white-space: pre-line; overflow-wrap: anywhere; margin-top: 4px;
}
/* Skrót ostatniej wypowiedzi w wierszu listy (treść z LSP, bez cytatu). */
.row-excerpt {
    display: flex; gap: 5px; align-items: baseline;
    font-size: 12px; line-height: 1.4; color: var(--text-3);
    max-width: 100%; overflow: hidden;
}
.row-excerpt-who { font-weight: 600; color: var(--text-2); flex: none; }
.row-excerpt-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-4 { gap: 4px; }

/* =============================== Szuflada ============================== */

[x-cloak] { display: none !important; }

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(0, 6, 35, 0.42);
}
.drawer-fade { transition: opacity 0.2s ease; }
.drawer-fade-out { opacity: 0; }
.drawer-fade-in { opacity: 1; }

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 160;
    height: 100vh;
    width: 420px;
    max-width: 92vw;
    background: var(--surface);
    box-shadow: var(--sh-3);
    display: flex;
    flex-direction: column;
}
.drawer-trans { transition: transform 0.22s ease; }
.drawer-closed { transform: translateX(100%); }
.drawer-open { transform: translateX(0); }
.drawer-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
}
.drawer-title { font-size: 14px; font-weight: 600; }
.drawer-body { flex: 1; overflow: auto; padding: 18px; }

/* ============================= Drobiazgi =============================== */

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Guest (logowanie) */
.guest-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(87, 104, 255, 0.10), transparent 60%),
        var(--body);
}
.guest-card { width: 100%; max-width: 380px; }
.guest-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; }
.guest-brand .logo {
    width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--accent);
    display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.guest-brand .name { font-size: 18px; font-weight: 600; letter-spacing: -0.4px; }
.guest-brand .name .sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-4); letter-spacing: 0; }

/* ── Globalny tooltip (zamiennik natywnego title; sterowany public/js/tooltip.js) ── */
.tooltip-pop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000; /* nad modalami/szufladami/toastami */
    max-width: 320px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-line; /* wsparcie wielolinijkowego tekstu (\n) */
    box-shadow: 0 8px 24px rgba(0, 6, 35, 0.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.08s ease;
}
.tooltip-pop.is-visible {
    opacity: 1;
    visibility: visible;
}
.tooltip-pop::after {
    content: "";
    position: absolute;
    left: var(--arrow, 50%);
    width: 8px;
    height: 8px;
    background: var(--navy);
    transform: translateX(-50%) rotate(45deg);
}
.tooltip-pop[data-placement="top"]::after { bottom: -4px; }
.tooltip-pop[data-placement="bottom"]::after { top: -4px; }

/* ── Wykres aktywności (server-side SVG; <x-activity-chart>) ── */
.activity-chart { width: 100%; height: 46px; display: block; margin-top: 10px; }
.activity-chart .bar { fill: var(--accent); }
.activity-chart .bar-empty { fill: var(--border-2); }
.activity-chart .hit { fill: transparent; }
.activity-chart .hit:hover { fill: rgba(87, 104, 255, 0.10); }

/* Sparkline w stopce kafelka (pełna szerokość, dosunięty do dolnej krawędzi). */
.tile-spark {
    margin: 8px -18px -18px;     /* anuluj padding kafelka (18px) — pełna szerokość + dół */
    border-top: 1px solid var(--border);
    line-height: 0;
}
/* Obszar klikalny sparkline = pop-up ze szczegółami dziennymi (nie nawiguje do narzędzia). */
.tile-spark-hit { display: block; padding: 6px 18px 0; cursor: pointer; }
.tile-spark-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile-spark svg { display: block; width: 100%; height: 30px; }
.tile-spark .bar { fill: var(--accent); }
.tile-spark .bar-empty { fill: var(--border-2); }

/* ── Pop-up szczegółów aktywności (dzienny wykres słupkowy w modalu) ── */
.modal.modal-chart { width: 720px; }
.daychart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 200px;
    padding: 22px 0 0;          /* miejsce na liczbę nad najwyższą kolumną */
}
.daychart-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    min-width: 0;
}
.daychart-track { width: 100%; flex: 1; display: flex; align-items: flex-end; }
.daychart-fill {
    width: 100%;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    transition: background 0.12s;
}
.daychart-col.is-empty .daychart-fill { background: var(--border-2); height: 2px; }
.daychart-col:hover .daychart-fill { background: var(--accent-h); }
.daychart-num {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-3);
    line-height: 1;
    margin-bottom: 4px;
    min-height: 11px;
}
.daychart-tick { font-size: 9.5px; color: var(--text-4); line-height: 1; margin-top: 5px; }
.daychart-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-4);
}

/* ===================== Ticket Atomizer — grupy + oś czasu ===================== */

/* Grupowanie tabeli po tickecie: nagłówek grupy wyróżniony, atomy lekko wcięte. */
.lsp-table tbody tr.atom-group td {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-2);
    padding-top: 9px;
    padding-bottom: 9px;
}
.lsp-table tbody tr.atom-row td:first-child { padding-left: 22px; }

/* btn-rowlink używane także jako <button> (akcja wierszowa) — reset domyślnych stylów. */
.btn-rowlink { border: none; background: transparent; cursor: pointer; }

/* Szersza szuflada (oś czasu). */
.drawer.drawer-wide { width: 600px; }

/* Oś czasu atomów (szuflada) — feed pogrupowany po dniach (atom-timeline.js).
   Tylko dni z aktywnością; pionowy rail z kropką per dzień; odstęp między dniami jako podpowiedź. */
.atl-feed { position: relative; }
.atl-feed::before { content: ''; position: absolute; left: 6px; top: 5px; bottom: 5px; width: 2px; background: var(--border); }
.atl-group + .atl-group { margin-top: 12px; }
.atl-day { position: relative; padding-left: 26px; }
.atl-day-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.atl-dot { position: absolute; left: 0; top: 1px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-2); }
.atl-date { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.atl-count { font-size: 11px; color: var(--text-3); background: var(--surface-2); border-radius: var(--r-full); padding: 1px 8px; }
/* Przerwa między dniami: wysokość ∝ liczbie dni (inline), rail biegnie przez nią, etykieta wycentrowana. */
.atl-gap { display: flex; align-items: center; padding-left: 26px; font-size: 10.5px; color: var(--text-4); font-style: italic; }
.atl-atom { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; }
.atl-atom > .badge { flex: none; margin-top: 1px; }
.atl-atom-body { min-width: 0; }
.atl-what { font-size: 13px; color: var(--text); line-height: 1.4; overflow-wrap: anywhere; }

/* Quick Questions — macierz DZP (domena × miesiąc). Zero = wyciszone „·”,
   żeby wzrok od razu wyłapywał zaniedbane (puste) projekty. */
.dzp-cell { font-variant-numeric: tabular-nums; }
.cell-zero { color: var(--text-4); }
/* Komórka z interakcjami = klikalna (drill-down). */
.cell-hit { cursor: pointer; }
.cell-hit:hover { background: var(--accent-50); color: var(--accent); font-weight: 600; }

/* Sortowalne nagłówki tabel. */
.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sort:hover { color: var(--accent); }
.th-sort.is-sorted { color: var(--accent); }
.sort-ind { font-size: 9px; opacity: 1; margin-left: 1px; }
.sort-ind:empty { display: none; }              /* brak strzałki na nieaktywnej kolumnie = oszczędność miejsca */

/* Kompaktowa odmiana tabeli DZP: mniejszy padding + brak letter-spacingu w nagłówku,
   żeby pełne RRRR-MM i etykiety mieściły się bez ucinania (tabela i tak scrolluje w poziomie). */
.dzp-table thead th { padding-left: 8px; padding-right: 8px; letter-spacing: 0.2px; }
.dzp-table tbody td { padding-left: 8px; padding-right: 8px; }
/* Nazwa domeny: jedna linia, chowa się pod krawędzią (wielokropek) — pełna nazwa w tooltipie. */
.dzp-domain { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
/* Produkty: też jedna linia z wielokropkiem (pełna lista w tooltipie). */
.dzp-products { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pierwsze 3 kolumny (Domena/Produkty/Wolumen) PRZYKLEJONE do lewej (frozen) —
   identyfikacja zostaje, a miesiące przewijają się pod spodem. Stałe szerokości +
   skumulowane offsety `left`. Solidne tło, by zasłaniać przewijane komórki. */
.dzp-table .dzp-sticky { position: sticky; background: var(--surface); z-index: 2; }
.dzp-table thead th.dzp-sticky { background: var(--surface-2); z-index: 4; }
.dzp-table .dzp-c1 { left: 0; width: 200px; }
.dzp-table .dzp-c2 { left: 200px; width: 156px; }
.dzp-table .dzp-c3 { left: 356px; width: 108px; box-shadow: 6px 0 8px -6px rgba(0, 6, 35, 0.18); }
/* Kompaktowy wybór miesiąca (przedział od–do nad tabelą). */
.input-month { width: 140px; padding-top: 6px; padding-bottom: 6px; }

/* Heatmapa komórek interakcji (progi konfigurowalne w szufladzie). Delikatne tła. */
.heat-red    { background: #fdecec; color: #b42318; }
.heat-yellow { background: #fdf5e1; color: #8a5a00; }
.heat-green  { background: #e9f6ee; color: #1e783d; }
.cell-na     { color: var(--text-4); }            /* miesiąc niepoliczony = „–” neutralne */
/* Chipy legendy progów w szufladzie. */
.heat-chip { display: inline-block; min-width: 26px; text-align: center; padding: 2px 7px; border-radius: var(--r-full); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Pickery dat (miesiąc / data / godzina / datetime) ── public/js/datepicker.js ── */
.dp { display: inline-block; }
.dp-trigger {
    display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
    min-width: 132px; padding: 6px 10px; font-size: 13px; color: var(--text); cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
    font-variant-numeric: tabular-nums; line-height: 1.3;
}
.dp-trigger:hover { border-color: var(--accent); }
.dp-trigger:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.dp-trigger .dp-ico { flex: none; color: var(--text-4); }
.dp-trigger.is-open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }

.dp-pop {
    position: fixed; z-index: 1000; top: 0; left: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: var(--sh-3); padding: 10px; min-width: 234px;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-nav {
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; border-radius: var(--r-sm); background: transparent;
    color: var(--text-3); cursor: pointer; font-size: 16px; line-height: 1;
}
.dp-nav:hover { background: var(--surface-2); color: var(--accent); }
.dp-title { font-weight: 600; font-size: 13px; color: var(--text); }

.dp-grid-month { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.dp-grid-day { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { font-size: 10px; color: var(--text-4); text-align: center; padding: 2px 0; text-transform: uppercase; letter-spacing: .3px; }

.dp-cell {
    padding: 8px 0; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent;
    color: var(--text); cursor: pointer; font-size: 12.5px; text-align: center; font-variant-numeric: tabular-nums;
}
.dp-grid-day .dp-cell { padding: 6px 0; }
.dp-cell:hover { background: var(--accent-50); color: var(--accent); }
.dp-cell.is-sel { background: var(--accent); color: #fff; font-weight: 600; }
.dp-cell.is-sel:hover { background: var(--accent-h); color: #fff; }
.dp-cell.is-disabled, .dp-cell:disabled { color: var(--text-4); opacity: .45; cursor: default; }
.dp-cell.is-disabled:hover, .dp-cell:disabled:hover { background: transparent; color: var(--text-4); }
.dp-cell.is-empty { cursor: default; }
.dp-cell.is-empty:hover { background: transparent; }

.dp-time { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.dp-stepper { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dp-stepper .dp-val { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 30px; text-align: center; }
.dp-time .dp-colon { font-size: 17px; font-weight: 600; color: var(--text-3); padding-top: 2px; }
.dp-foot { margin-top: 10px; display: flex; justify-content: flex-end; gap: 8px; }

/* ── SLA zespołu CS ── */
.sla-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sla-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--sh-1); min-width: 120px; }
.sla-stat-val { font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.sla-stat-lbl { font-size: 11px; color: var(--text-4); }

/* KPI — porównanie rok do roku (delta pod wartością). */
.kpi-delta { font-size: 11px; font-weight: 600; color: var(--text-4); font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi-delta.good { color: var(--ok); }
.kpi-delta.bad { color: var(--err); }
.kpi-delta.flat { color: var(--text-4); }
/* Legenda linii osi czasu (mała kreska). */
.sla-leg { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }

/* Tabela SLA: pierwsza kolumna (specjalista) przyklejona do lewej. */
.sla-table .sla-sticky { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.sla-table thead th.sla-sticky { background: var(--surface-2); z-index: 4; box-shadow: 6px 0 8px -6px rgba(0, 6, 35, 0.12); }
.sla-table tbody td.sla-sticky { box-shadow: 6px 0 8px -6px rgba(0, 6, 35, 0.12); }

/* Komórka specjalista×miesiąc (śr. + mediana·n), klikalna (drill-down). */
.sla-cell { text-align: center; cursor: pointer; line-height: 1.25; }
.sla-cell:hover { background: var(--accent-50); }
.sla-cell-avg { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.sla-cell-sub { display: block; font-size: 10px; color: var(--text-4); font-variant-numeric: tabular-nums; }

/* Pasek postępu o nieznanym końcu (pull SLA — total nieznany). */
.progress-fill.is-indeterminate { width: 35%; background: var(--accent); animation: prog-indet 1.1s ease-in-out infinite; }
@keyframes prog-indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* Pasek postępu (modal chunkowego odświeżania). */
.progress-track { height: 10px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: var(--r-full); transition: width .35s ease; }
.progress-fill.is-done { background: var(--ok); }

/* =========================================================================
   Struktura firmy — struktura-first: zwijane kafle działów + wysuwany dock
   ========================================================================= */
.org-summary { font-size: 12.5px; color: var(--text-3); margin-bottom: 14px; }
.org-summary b { color: var(--text); font-weight: 600; }

/* Toggle trybu podgląd/edycja (jeden przycisk-przełącznik) */
.org-switch { display: inline-flex; align-items: center; gap: 7px; height: var(--ctrl-h); padding: 0 12px 0 6px; border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.org-switch:hover { border-color: var(--text-4); }
.org-switch.is-on { border-color: var(--accent); color: var(--accent); background: var(--accent-50); }
.org-switch-track { position: relative; width: 30px; height: 16px; border-radius: var(--r-full); background: var(--border-2); transition: background .15s; flex: none; }
.org-switch.is-on .org-switch-track { background: var(--accent); }
.org-switch-knob { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: var(--r-full); background: #fff; transition: transform .15s; }
.org-switch.is-on .org-switch-knob { transform: translateX(14px); }
.org-switch-label { line-height: 1; }

.org-count-pill { background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: var(--r-full); margin-left: 2px; }
.btn.is-toggled { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.is-toggled .org-count-pill { background: rgba(255,255,255,0.22); color: #fff; }

/* Układ: struktura (główna) + opcjonalny dock po prawej */
.org-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.org-layout.pool-open { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 820px) { .org-layout.pool-open { grid-template-columns: minmax(0, 1fr); } }
.org-structure-area { min-width: 0; }

/* Siatka 2D działów — jawne umiejscowienie w kolumnie/wierszu, luki dozwolone.
   Wiersze ROSNĄ treścią (minmax) → rozwinięty dział pokazuje skład, zwinięty jest niski;
   pusty wiersz = min-height (widoczna luka). align-items:start → kafel wysokości treści. */
.org-depts { display: grid; grid-template-columns: repeat(var(--org-cols, 5), minmax(0, 1fr)); grid-auto-rows: minmax(52px, auto); --org-rowunit: 62px; align-items: start; gap: 10px; margin-bottom: 12px; }
.org-dept { position: relative; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.org-dept.is-open { border-color: var(--border-2); box-shadow: var(--sh-1); }
.org-dept.resizing { z-index: 40; box-shadow: var(--sh-2); }
.org-dept.dragging-dept { opacity: 0.45; }
/* kafel rozciągnięty w pionie (row_span > 1) FIZYCZNIE wypełnia swoje wiersze — inaczej stretch byłby niewidoczny */
.org-dept.is-tall { align-self: stretch; }
/* wskaźnik „wstaw nowy wiersz przed tym kaflem" (drop działu na kafel) */
.org-dept.insert-target { box-shadow: inset 0 4px 0 0 var(--accent); }

/* Puste komórki siatki — cele upuszczenia działu (tylko w trybie edycji); pełna wysokość wiersza */
.org-cell { align-self: stretch; min-height: 52px; border: 1px dashed var(--border-2); background: repeating-linear-gradient(45deg, transparent, transparent 6px, var(--surface-2) 6px, var(--surface-2) 7px); }
.org-cell.cell-hover { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-50); }

/* Kolor przewodni działu (stonowany tint z --dept-accent) — KASKADUJE na zespoły w środku */
.org-dept.tinted { border-top: 3px solid var(--dept-accent); }
.org-dept.tinted .org-dept-head { background: color-mix(in srgb, var(--dept-accent) 8%, var(--surface)); }
.org-dept.tinted.is-open .org-dept-head { background: color-mix(in srgb, var(--dept-accent) 12%, var(--surface-2)); }
/* kaskada koloru na zespoły (dziedziczenie --dept-accent) */
.org-dept.tinted .org-team { border-color: color-mix(in srgb, var(--dept-accent) 22%, var(--border)); }
.org-dept.tinted .org-team-head { background: color-mix(in srgb, var(--dept-accent) 9%, var(--surface-2)); border-bottom-color: color-mix(in srgb, var(--dept-accent) 22%, var(--border)); }
.org-dept.tinted .org-leaders.team { border-bottom-color: color-mix(in srgb, var(--dept-accent) 18%, var(--border)); }
.org-dept.tinted .org-dept-loose { border-top-color: color-mix(in srgb, var(--dept-accent) 28%, var(--border-2)); }

/* Picker koloru działu */
.org-color { position: relative; flex: none; }
.org-swatches { position: absolute; top: 100%; right: 0; margin-top: 4px; z-index: 30; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-2); padding: 6px; display: grid; grid-template-columns: repeat(5, 18px); gap: 5px; }
.org-swatch { width: 18px; height: 18px; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: var(--r-full); cursor: pointer; padding: 0; }
.org-swatch:hover { transform: scale(1.12); }
.org-swatch.is-active { outline: 2px solid var(--text); outline-offset: 1px; }
.org-swatch-none { background: var(--surface); position: relative; }
.org-swatch-none::after { content: ''; position: absolute; left: 2px; right: 2px; top: 50%; border-top: 1.5px solid var(--err); transform: rotate(45deg); }

/* Pasek pustego wiersza (usuwalny; wciąż upuszczalny) */
.org-emptyrow { align-self: stretch; min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px dashed var(--border-2); background: repeating-linear-gradient(45deg, transparent, transparent 6px, var(--surface-2) 6px, var(--surface-2) 7px); }
.org-emptyrow.cell-hover { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-50); }
.org-emptyrow-label { font-size: 11px; color: var(--text-4); font-style: italic; }
.org-emptyrow-remove { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--err); background: var(--surface); border: 1px solid var(--border); cursor: pointer; padding: 2px 8px; }
.org-emptyrow-remove:hover { background: var(--err-bg); border-color: var(--err-bg); }

/* Reorder: wskaźniki wstawienia */
.org-team.dragging-team { opacity: 0.45; }
.org-team.team-insert { box-shadow: inset 3px 0 0 0 var(--accent); }
.org-chip.member-insert { box-shadow: inset 0 3px 0 0 var(--accent); }

.org-dept-head { flex: none; display: flex; align-items: flex-start; gap: 3px; padding: 6px 8px 5px 3px; }
.org-dept.is-open .org-dept-head { background: var(--surface-2); }
.org-grip { flex: none; width: 15px; height: 20px; margin-top: 1px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-4); cursor: move; opacity: 0.35; transition: opacity .12s; touch-action: none; }
.org-dept:hover .org-grip { opacity: 1; }
.org-caret { flex: none; width: 18px; height: 20px; margin-top: 1px; border: none; background: transparent; color: var(--text-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.org-caret svg { transition: transform .15s ease; }
.org-caret.is-open svg { transform: rotate(90deg); }
.org-dept-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; padding-right: 4px; }
.org-dept-name { font-weight: 600; font-size: 13.5px; line-height: 1.2; cursor: pointer; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.org-dept-name:hover { color: var(--accent); }
.org-dept-counts { font-size: 10.5px; color: var(--text-4); line-height: 1.1; }
.org-dept-actions { position: absolute; top: 3px; right: 3px; z-index: 5; display: flex; align-items: center; gap: 1px; opacity: 0; transition: opacity .12s; background: var(--surface); padding-left: 5px; }
.org-dept.is-open .org-dept-actions { background: var(--surface-2); }
.org-dept:hover .org-dept-actions, .org-dept.is-open .org-dept-actions, .org-dept-actions.is-pinned { opacity: 1; }

/* Slot lidera/Heada (drop target dla osoby). Zawsze JEDNA linia — długie nazwisko chowa się pod krawędzią. */
.org-leaders { flex: none; display: flex; align-items: center; flex-wrap: nowrap; overflow: hidden; gap: 5px; padding: 4px 8px; min-height: 25px; border-top: 1px solid var(--border); background: var(--surface-2); }
.org-leaders.team { border-top: none; border-bottom: 1px solid var(--border); background: transparent; padding: 4px 7px; }
.org-leaders-label { font-size: 9.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-4); flex: none; }
.org-leader { display: inline-flex; align-items: center; gap: 3px; min-width: 0; background: var(--accent-50); color: var(--accent-h); border: 1px solid #d5d9ff; padding: 0 3px 0 5px; font-size: 11px; font-weight: 500; max-width: 100%; }
.org-leader svg { color: var(--accent); flex: none; }
.org-leader-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-leader-x { flex: none; }
.org-leader-add { flex: none; width: 18px; height: 18px; border: 1px dashed var(--border-2); background: transparent; color: var(--text-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.org-leader-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-50); }
.org-leader-add svg { width: 11px; height: 11px; }
.org-leader-x { border: none; background: transparent; color: var(--accent-h); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 1px; }
.org-leader-x:hover { color: var(--err); }
.org-leader-hint { font-size: 10.5px; color: var(--text-4); font-style: italic; }
.org-leaders:has(.org-leader) .org-leader-hint { display: none; }
.org-leaders.lead-hover { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-50); }

.org-dept-body { padding: 10px; }
.org-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 205px), 1fr)); gap: 10px; }

/* Uchwyt rozmiaru — prawy-dolny róg (szerokość + wysokość; wysokość rośnie też treścią) */
.org-resize { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; opacity: 0; touch-action: none;
    background: linear-gradient(135deg, transparent 0 45%, var(--accent) 45% 55%, transparent 55% 68%, var(--accent) 68% 80%, transparent 80%); }
.org-dept:hover .org-resize { opacity: 0.6; }
.org-resize:hover { opacity: 1 !important; }
.org-team { border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; }
.org-team-head { display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.org-team-name { font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 1px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-team-name:hover { color: var(--accent); }
.org-team-body { padding: 7px; display: flex; flex-direction: column; gap: 4px; min-height: 52px; flex: 1; }
.org-team-add { align-self: start; }
.org-team-add .input { height: 34px; font-size: 12.5px; border-style: dashed; background: transparent; }

/* Kubełek „w dziale, bez zespołu" */
.org-dept-loose { margin-top: 12px; border-top: 1px dashed var(--border-2); padding-top: 10px; }
.org-loose-label { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.org-loose-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 6px; min-height: 40px; }

/* Formularze dodawania */
.org-dept-add { display: flex; gap: 8px; align-items: center; padding: 2px 0 4px; }
.org-dept-add .input { max-width: 240px; height: 32px; }
.org-empty-board { grid-column: 1 / -1; background: var(--surface); border: 1px dashed var(--border-2); padding: 24px; color: var(--text-3); font-size: 13px; }
.org-empty-board p { margin: 0; }

/* Dock „Nieprzypisani" */
.org-pool-dock { background: var(--surface); border: 1px solid var(--border); position: sticky; top: 0; display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.org-pool-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.org-col-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.org-pool-search { margin: 8px 10px 4px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); padding: 0 8px; color: var(--text-4); }
.org-pool-search svg { flex: none; }
.org-pool-search input { border: none; outline: none; height: 30px; width: 100%; min-width: 0; font-size: 12.5px; background: transparent; color: var(--text); box-sizing: border-box; }
.org-pool-body { overflow: auto; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 90px; }
.org-empty { color: var(--text-4); font-size: 12.5px; text-align: center; padding: 20px 8px; margin: 0; }

/* Chip osoby */
.org-chip { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border: 1px solid var(--border); background: var(--surface); cursor: grab; user-select: none; min-width: 0; }
.org-chip:hover { border-color: var(--border-2); box-shadow: var(--sh-1); }
.org-chip:active { cursor: grabbing; }
.org-chip.dragging { opacity: 0.4; }
.org-chip.is-lead { border-left: 3px solid var(--accent); }
.org-chip.is-inactive { opacity: 0.5; }
.org-chip-av { width: 26px; height: 26px; flex: none; border-radius: var(--r-full); background: var(--navy); color: #fff; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.org-chip-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.org-chip-name { font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-chip-role { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-lead-star { color: var(--accent); font-size: 11px; }
.org-ext { font-size: 9px; color: var(--warn); background: var(--warn-bg); padding: 0 3px; font-weight: 600; flex: none; }
.org-chip-lead { flex: none; width: 22px; height: 22px; border: none; background: transparent; color: var(--text-4); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.org-chip-lead:hover { color: var(--accent); }
.org-chip-lead svg { width: 13px; height: 13px; }
.org-chip.is-lead .org-chip-lead { color: var(--accent); }
.org-chip-x { flex: none; width: 20px; height: 20px; border: none; background: transparent; color: var(--text-4); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.org-chip-x:hover { color: var(--err); }
.org-chip-x svg { width: 12px; height: 12px; }
.org-chip.compact .org-chip-x { opacity: 0; }
.org-chip.compact:hover .org-chip-x { opacity: 1; }

/* Chip dodatkowego członkostwa (osoba, której główny zespół jest gdzie indziej) */
.org-chip.is-additional { border-style: dashed; background: var(--surface-2); }
.org-add-tag { flex: none; width: 13px; height: 13px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; line-height: 1; color: var(--accent); background: var(--accent-50); border: 1px solid #d5d9ff; border-radius: var(--r-full); }

/* Wariant kompaktowy (w strukturze): mniejszy, gwiazdka na hover */
.org-chip.compact { padding: 4px 6px; gap: 6px; }
.org-chip.compact .org-chip-av { width: 22px; height: 22px; font-size: 9px; }
.org-chip.compact .org-chip-lead { opacity: 0; }
.org-chip.compact:hover .org-chip-lead, .org-chip.compact.is-lead .org-chip-lead { opacity: 1; }

/* Strefy upuszczenia */
[data-drop-target].drop-hover { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-50); }
.org-pool-tip { font-size: 11px; color: var(--text-4); padding: 0 10px 4px; margin: 0; }
.org-drop-hint { font-size: 11px; color: var(--text-4); font-style: italic; margin: 2px 0 0; width: 100%; }
.org-team-body:has(.org-chip) .org-drop-hint,
.org-loose-body:has(.org-chip) .org-drop-hint { display: none; }

/* Inline edycja / potwierdzenie usunięcia */
.org-edit { font-size: 13px; min-width: 120px; }
.org-del { display: flex; align-items: center; }
.org-del-confirm { display: flex; align-items: center; gap: 2px; }
.org-del-q { font-size: 11px; color: var(--err); margin-right: 2px; }

/* Podgląd (read-only): chip bez chwytu */
.org-chip.not-editable { cursor: default; }
.org-chip.not-editable:hover { border-color: var(--border); box-shadow: none; }

@keyframes org-fade { from { opacity: 0; } to { opacity: 1; } }

/* Picker Heada/lidera (wybór osoby z listy) */
.org-picker-backdrop { position: fixed; inset: 0; background: rgba(0, 6, 35, 0.28); z-index: 62; animation: org-fade .15s ease; }
.org-picker { position: fixed; top: 12vh; left: 50%; transform: translateX(-50%); width: 460px; max-width: 92vw; max-height: 70vh; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-3); z-index: 63; display: flex; flex-direction: column; animation: org-fade .16s ease; }
.org-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.org-picker-search { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); padding: 0 12px; color: var(--text-4); }
.org-picker-search input { border: none; outline: none; height: 40px; width: 100%; min-width: 0; font-size: 13px; background: transparent; color: var(--text); }
.org-picker-list { overflow: auto; flex: 1; padding: 6px; display: flex; flex-direction: column; gap: 2px; min-height: 120px; }
.org-picker-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: none; background: transparent; cursor: pointer; padding: 6px 8px; font-size: 12.5px; color: var(--text); }
.org-picker-row:hover { background: var(--accent-50); }
.org-picker-name { font-weight: 500; display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-picker-role { margin-left: auto; color: var(--text-4); font-size: 11.5px; white-space: nowrap; flex: none; }
.org-picker-tip { margin: 0; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-4); }

/* =============================================================================
   Sprawy — mapa uwagi (siatka RBH, Diablo-inventory)
   ============================================================================= */

/* Semantyka koloru (pilność z terminu następnego kroku). Osobno od akcentu. */
.sev-crit { --sev: var(--err); }
.sev-warn { --sev: var(--orange); }
.sev-calm { --sev: var(--ok); }
.sev-idle { --sev: var(--text-4); }
.sev-dot { width: 7px; height: 7px; border-radius: var(--r-full); background: var(--sev, var(--text-4)); display: inline-block; margin-right: 5px; vertical-align: middle; }

/* Pasek narzędziowy */
.sprawy-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.sprawy-top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sprawy-count { font-family: var(--mono); font-size: 11px; background: var(--surface-2); border-radius: var(--r-full); padding: 0 6px; margin-left: 2px; }

/* Miernik pojemności (RBH) */
.sprawy-gauge { flex: 1 1 280px; min-width: 260px; max-width: 480px; border: 1px solid var(--border); background: var(--surface); padding: 11px 15px; }
.sprawy-gauge-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sprawy-gauge-lead { font-size: 13px; color: var(--text-3); font-weight: 500; }
.sprawy-gauge-num { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sprawy-gauge-num b { color: var(--text); font-weight: 600; }
.sprawy-free { color: var(--ok); }
.sprawy-bar { height: 8px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.sprawy-bar-fill { height: 100%; background: var(--accent); transition: width .35s cubic-bezier(.2,.7,.3,1), background .3s; }
.sprawy-bar-fill.is-hot { background: var(--orange); }

/* Plansza */
.sprawy-board-wrap { position: relative; border: 1px solid var(--border); background: var(--surface-2); padding: 8px; overflow: hidden; }
.sprawy-board {
    position: relative; display: grid;
    /* Szerokość dyktuje rozmiar komórki (--sprawy-boardw = komórka × kolumny). Gdy o rozmiarze
       decyduje WYSOKOŚĆ widoku, plansza jest węższa od ramki i staje na środku — komórki zostają
       kwadratowe, a mapa mieści się bez pionowego przewijania. */
    width: min(100%, var(--sprawy-boardw, 100%));
    margin-inline: auto;
    grid-template-columns: repeat(var(--cols, 20), 1fr);
    grid-template-rows: repeat(var(--rows, 10), var(--sprawy-rowh, 48px));
    background-color: var(--surface);
    background-image:
        linear-gradient(to right, var(--border) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border) 1px, transparent 1px);
    background-size: calc(100% / var(--cols, 20)) var(--sprawy-rowh, 48px);
    touch-action: none; user-select: none;
}

.sprawy-tile { position: relative; padding: 3px; min-width: 0; min-height: 0; z-index: 1; }
.sprawy-tile-in {
    position: relative; height: 100%; width: 100%; overflow: hidden;
    background: color-mix(in srgb, var(--sev, var(--text-4)) 7%, var(--surface));
    border: 1px solid var(--border-2);
    box-shadow: var(--sh-1); cursor: grab;
    display: flex; align-items: center;
    transition: box-shadow .16s ease, transform .1s ease;
}
.sprawy-tile-in::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--sev, var(--text-4)); }
/* Rozmiar fontu = --name-fs (liczony po stronie serwera z rozmiaru kafla — mały kafel = mniejszy
   font, żeby mieściło się więcej tekstu). Deterministyczny, bez kruchości container queries. */
.sprawy-name {
    padding: 4px 8px 4px 9px; font-weight: 600; font-size: var(--name-fs, 12px); line-height: 1.2; letter-spacing: -0.2px; color: var(--text);
    display: -webkit-box; -webkit-line-clamp: var(--lines, 2); -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; hyphens: auto;
}
.sprawy-tile:hover .sprawy-tile-in { border-color: var(--sev, var(--accent)); box-shadow: var(--sh-2); }
.sprawy-tile.lift { z-index: 60; }
.sprawy-tile.lift .sprawy-tile-in { cursor: grabbing; box-shadow: var(--sh-3); transform: scale(1.03); }
.sprawy-tile.resizing { z-index: 60; }
.sprawy-tile.resizing .sprawy-tile-in { box-shadow: var(--sh-3); }
.sprawy-tile.is-dim { opacity: 0.32; filter: saturate(0.5); }

/* Uchwyty rozmiaru — krawędzie i rogi */
.sprawy-tile .rz { position: absolute; z-index: 5; opacity: 0; }
.sprawy-tile:hover .rz, .sprawy-tile.resizing .rz { opacity: 1; }
.rz.e { top: 8px; bottom: 8px; right: -3px; width: 9px; cursor: ew-resize; }
.rz.w { top: 8px; bottom: 8px; left: -3px; width: 9px; cursor: ew-resize; }
.rz.s { left: 8px; right: 8px; bottom: -3px; height: 9px; cursor: ns-resize; }
.rz.n { left: 8px; right: 8px; top: -3px; height: 9px; cursor: ns-resize; }
.rz.se { right: -3px; bottom: -3px; width: 14px; height: 14px; cursor: nwse-resize; }
.rz.sw { left: -3px; bottom: -3px; width: 14px; height: 14px; cursor: nesw-resize; }
.rz.ne { right: -3px; top: -3px; width: 14px; height: 14px; cursor: nesw-resize; }
.rz.nw { left: -3px; top: -3px; width: 14px; height: 14px; cursor: nwse-resize; }
.rz.se::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 6px; height: 6px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); }

/* Ghost (podgląd upuszczenia) + żywy licznik RBH */
.sprawy-ghost { display: none; position: relative; margin: 3px; z-index: 40; pointer-events: none; box-sizing: border-box; }
.sprawy-ghost.is-on { display: block; }
.sprawy-ghost.is-ok { background: color-mix(in srgb, var(--ok) 16%, transparent); border: 1.5px dashed var(--ok); }
.sprawy-ghost.is-bad { background: color-mix(in srgb, var(--err) 14%, transparent); border: 1.5px dashed var(--err); }
.sprawy-rbh-live { position: absolute; z-index: 70; pointer-events: none; font-family: var(--mono); font-weight: 700; font-size: 12px; background: var(--accent); color: #fff; padding: 3px 8px; transform: translate(-50%, -150%); opacity: 0; transition: opacity .1s; white-space: nowrap; }
.sprawy-rbh-live.is-on { opacity: 1; }

/* Pusta plansza */
.sprawy-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); text-align: center; padding: 30px; }
.sprawy-empty p { margin: 0; }
.sprawy-empty-actions { display: flex; gap: 8px; margin-top: 8px; }
.sprawy-muted { color: var(--text-4); font-size: 12.5px; }


/* Burst przy zdjęciu z mapy */
.sprawy-burst { position: fixed; z-index: 200; pointer-events: none; }
.sprawy-burst span { position: absolute; width: 8px; height: 8px; }

/* ————————————————————— Szuflada szczegółów (folder) ————————————————————— */
/* Szuflada zawsze w DOM (Livewire steruje treścią) — chowana transformem + visibility,
   żeby zamknięta nie zostawiała smugi cienia przy krawędzi ekranu. */
.drawer.drawer-matter { width: 560px; visibility: hidden; transition: transform .24s cubic-bezier(.2,.75,.25,1), visibility 0s linear .24s; }
.drawer.drawer-matter.drawer-closed { transform: translateX(100%); }
.drawer.drawer-matter.drawer-open { transform: translateX(0); visibility: visible; transition: transform .24s cubic-bezier(.2,.75,.25,1), visibility 0s; }
.sprawy-scrim { z-index: 155; opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease; backdrop-filter: blur(2px); }
.sprawy-scrim.is-on { opacity: 1; visibility: visible; }

.sprawy-dr-head { position: relative; flex: none; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 7px; }
.sprawy-dr-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--sev, var(--text-4)); }
.sprawy-dr-close { position: absolute; top: 12px; right: 12px; }
.sprawy-dr-name { border: 1px solid transparent; background: transparent; font: inherit; font-size: 16px; font-weight: 650; letter-spacing: -0.3px; color: var(--text); padding: 3px 6px; margin: -3px -6px; width: calc(100% - 30px); }
.sprawy-dr-name:focus { outline: none; border-color: var(--border-2); background: var(--surface-2); }
.sprawy-dr-sub { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }

.sprawy-dr-body { display: flex; flex-direction: column; gap: 18px; }
.sprawy-field { display: flex; flex-direction: column; gap: 6px; }
.sprawy-field > label, .sprawy-sec-h h3, .sprawy-step-label, .sprawy-frame-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 650; margin: 0; }

/* Następny krok — bohater */
.sprawy-step { background: color-mix(in srgb, var(--sev, var(--text-4)) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--sev, var(--text-4)) 30%, var(--border)); padding: 12px 13px; display: flex; flex-direction: column; gap: 9px; position: relative; }
.sprawy-step::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; background: var(--sev, var(--text-4)); }
.sprawy-step-label { color: var(--sev); }
.sprawy-step-title { border: 1px solid transparent; background: transparent; font: inherit; font-size: 15px; font-weight: 600; letter-spacing: -0.2px; color: var(--text); padding: 2px 4px; margin: -2px -4px; }
.sprawy-step-title:focus { outline: none; background: var(--surface-2); border-color: var(--border-2); }
.sprawy-step-when { display: flex; align-items: baseline; gap: 9px; }
.sprawy-step-date { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--sev); }
.sprawy-step-rel { font-size: 11.5px; color: var(--text-3); }
.sprawy-step-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Ramy czasowe */
.sprawy-frame { display: flex; align-items: flex-end; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 10px 13px; }
.sprawy-frame-cell { display: flex; flex-direction: column; gap: 5px; }
.sprawy-frame-arrow { color: var(--text-4); padding-bottom: 6px; }

/* Sekcje list (tickety / linki) */
.sprawy-sect { display: flex; flex-direction: column; gap: 8px; }
.sprawy-sec-h { display: flex; align-items: center; gap: 8px; }
.sprawy-n { font-family: var(--mono); font-size: 11px; color: #fff; background: var(--accent); border-radius: var(--r-full); padding: 0 7px; min-width: 18px; text-align: center; font-weight: 700; line-height: 17px; }
.sprawy-list { display: flex; flex-direction: column; gap: 6px; }
.sprawy-row { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); padding: 6px 6px 6px 10px; }
.sprawy-lk { font-weight: 500; font-size: 13px; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.sprawy-lk:hover { color: var(--accent); text-decoration: underline; }
.sprawy-seq { font-family: var(--mono); font-size: 11px; color: var(--text-4); flex: none; }
.sprawy-row.is-empty { color: var(--text-4); justify-content: center; font-size: 12.5px; font-style: italic; background: transparent; border-style: dashed; padding: 8px; }
.sprawy-add { display: flex; gap: 6px; }
.sprawy-add .input { height: 32px; font-size: 12.5px; }

/* Pigułki linków — ikona typu (Google Docs/Sheets/Slides/Drive) lub favicon + tytuł/host */
.sprawy-linkrow { align-items: center; gap: 9px; }
.sprawy-link-ico { flex: none; width: 20px; height: 20px; display: grid; place-items: center; color: var(--text-4); }
.sprawy-link-ico svg { width: 16px; height: 16px; }
.sprawy-link-ico img { width: 16px; height: 16px; border-radius: 3px; display: block; }
.sprawy-link-ico.kind-gdoc { color: #4285f4; }
.sprawy-link-ico.kind-gsheet { color: #0f9d58; }
.sprawy-link-ico.kind-gslides { color: #e9a100; }
.sprawy-link-ico.kind-gdrive { color: #4285f4; }
.sprawy-link-a { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; text-decoration: none; }
.sprawy-link-title { font-weight: 500; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprawy-linkrow:hover .sprawy-link-title { color: var(--accent); }
.sprawy-link-host { font-size: 11px; color: var(--text-4); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sprawy-dr-foot { flex: none; display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.btn.sprawy-solve { flex: 1; justify-content: center; background: var(--ok); color: #fff; font-weight: 600; }
.btn.sprawy-solve:hover { background: #196b34; }

/* Archiwum */
.sprawy-arch-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.sprawy-arch-row:last-child { border-bottom: none; }
.sprawy-arch-name { font-weight: 500; font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprawy-arch-meta { font-family: var(--mono); font-size: 11px; color: var(--text-4); flex: none; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    .sprawy-tile.lift .sprawy-tile-in { transform: none; }
    .sprawy-bar-fill { transition: none; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Aktywność użytkownika — macierz osoba × okno + heatmapa (5 tierów indygo).
   Skala `.heat-t0..t4` jest ROZMYŚLNIE współdzielona (docelowo też DZP).
   ───────────────────────────────────────────────────────────────────────── */
.ua-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ua-seg { display: inline-flex; gap: 3px; background: var(--surface-2); border-radius: var(--r-full); padding: 3px; }
.ua-seg-btn { border: 0; background: transparent; cursor: pointer; padding: 5px 12px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 500; color: var(--text-3); white-space: nowrap; transition: background .12s, color .12s; }
.ua-seg-btn.is-on { background: var(--accent); color: #fff; }
.ua-seg-btn:hover:not(.is-on) { color: var(--navy); }
.ua-search { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); min-width: 190px; color: var(--text-4); }
.ua-search input { border: 0; outline: 0; background: transparent; font-size: 12px; width: 100%; color: var(--navy); }
.ua-range { display: flex; align-items: center; gap: 6px; }
.ua-legend { margin-left: auto; display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-4); }
.ua-swatch { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }

/* Dopasowanie do wysokości .content (bez zewnętrznego scrolla): root = flex-kolumna
   wypełniająca wysokość, tabela bierze resztę i scrolluje wewnętrznie. */
.ua-fit { display: flex; flex-direction: column; height: 100%; }
.ua-fit > .page-head, .ua-fit > .ua-bar { flex: none; }
.ua-scroll { flex: 1 1 auto; min-height: 0; max-height: none; }
.ua-matrix { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.ua-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--border); padding: 9px 0 5px; text-align: center; font-weight: 500; color: var(--text-4); font-size: 9.5px; }
.ua-matrix th.ua-c-name { width: 230px; text-align: left; padding: 9px 14px; color: var(--text-3); left: 0; z-index: 3; }
.ua-b-month { display: block; height: 11px; color: var(--accent); font-weight: 600; }
.ua-c-agg { width: 56px; padding: 9px 6px; font-weight: 600; color: var(--text-3); text-align: center; }
.ua-matrix tbody td.ua-c-agg { font-variant-numeric: tabular-nums; color: var(--text-3); text-align: center; font-weight: 500; }
.ua-matrix tbody td.ua-c-sum { font-weight: 600; color: var(--navy); }

/* Przypięty do prawej blok kolumn: Trend (sparkline) · Mediana · Σ (zostają w polu widzenia). */
.ua-c-spark { width: 92px; }
.ua-matrix .ua-c-spark, .ua-matrix .ua-c-agg { position: sticky; background: var(--surface); }
.ua-matrix thead .ua-c-spark, .ua-matrix thead .ua-c-agg { z-index: 4; }
.ua-matrix tbody .ua-c-spark, .ua-matrix tbody .ua-c-agg { z-index: 2; }
.ua-c-sum { right: 0; }
.ua-c-agg:not(.ua-c-sum) { right: 56px; }
.ua-c-spark { right: 112px; border-left: 2px solid var(--border); }
.ua-matrix td.ua-c-spark { padding: 3px 9px; }
.ua-spark { display: block; width: 100%; height: 22px; }
.ua-spark rect { fill: var(--accent); }
.ua-spark-empty { display: block; text-align: center; color: var(--text-4); }

/* Wiersz podsumowania (Razem) — Σ po kolumnach, przypięte kolumny na tle podsumowania. */
.ua-sumrow td { border-top: 2px solid var(--border); background: var(--surface-2); font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.ua-sumrow td.ua-c-name, .ua-sumrow td.ua-c-spark, .ua-sumrow td.ua-c-agg { background: var(--surface-2); }
.ua-sum-name { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3); }
.ua-sumcell { text-align: center; padding: 8px 2px; font-size: 11.5px; }
.ua-sumrow .ua-spark rect { fill: var(--navy); }
.ua-teamrow.is-unassigned td { color: var(--text-4); }

/* Statystyka globalna pod tabelą (świadome złamanie ATF) — DWIE grupy × 2 metryki:
   lewa = sumy całego okresu, prawa = ten sam okres w medianach miesięcznych. */
.ua-globals { flex: none; display: flex; gap: 14px; margin-top: 12px; }
.ua-ggroup { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 11px 16px 13px; }
.ua-gtitle { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.ua-grow { display: flex; gap: 22px; }
.ua-grow .ua-gstat { flex: 1; min-width: 0; }
.ua-grow .ua-gstat + .ua-gstat { border-left: 1px solid var(--border-2, #f1f1f3); padding-left: 22px; }
.ua-gstat-val { font-size: 22px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.1; }
.ua-gstat-unit { font-size: 12px; font-weight: 500; color: var(--text-4); }
.ua-gstat-label { font-size: 11px; color: var(--text-4); margin-top: 3px; }
.ua-gstat-hint { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); color: var(--text-4); font-size: 9px; font-weight: 700; cursor: help; }

.ua-teamrow td { padding: 8px 14px; background: var(--surface-2); font-size: 10px; font-weight: 600; color: var(--text-3); letter-spacing: .03em; text-transform: uppercase; }
.ua-matrix tbody td { border-top: 1px solid var(--border-2, #f1f1f3); }
.ua-matrix td.ua-c-name { position: sticky; left: 0; z-index: 1; background: var(--surface); padding: 6px 14px; }
.ua-person { display: flex; align-items: center; gap: 9px; }
.ua-avatar { width: 26px; height: 26px; flex: none; border-radius: var(--r-full); display: grid; place-items: center; font-size: 10px; font-weight: 600; }
.ua-name { font-weight: 500; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ua-badge { margin-left: 7px; font-size: 9px; font-weight: 600; color: var(--accent); background: var(--accent-50); padding: 1px 6px; border-radius: var(--r-full); }

.ua-cell { padding: 0; }
.ua-box { margin: 2px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 3px; font-size: 11px; font-variant-numeric: tabular-nums; }
.ua-box.cell-hit { cursor: pointer; }
.ua-box.cell-hit:hover { outline: 2px solid var(--navy); outline-offset: -2px; }
.heat-t0 { background: #eef0f4; color: #c2c4cf; }
.heat-t1 { background: #dfe3ff; color: #3a4470; }
.heat-t2 { background: #aeb9ff; color: #26305e; }
.heat-t3 { background: #7f8dff; color: #fff; }
.heat-t4 { background: #5768ff; color: #fff; }

/* Gradient RBH („światło drogowe"; RbhScale) — macierz (metryka „czas"), kalendarz karty osoby, legenda.
   Progi miesięczne edytowalne w szufladzie; skalowane do dni roboczych okna. */
.rbh-t0 { background: #a01a10; color: #fff; }   /* poniżej progu czerwonego — najczerwieńszy */
.rbh-t1 { background: #d8452e; color: #fff; }   /* czerwony */
.rbh-t2 { background: #e0a92a; color: #402e00; } /* żółty */
.rbh-t3 { background: #3fa85f; color: #fff; }   /* zielony */
.rbh-t4 { background: #0c5a30; color: #fff; }   /* butelkowa zieleń — nadgodziny */

.ua-foot { margin-top: 9px; font-size: 11px; }
.ua-tag { display: inline-block; padding: 2px 8px; border-radius: var(--r-full); font-size: 10px; font-weight: 500; background: var(--accent-50); color: var(--accent); white-space: nowrap; }
.ua-drill td, .ua-drill th { padding: 7px 10px; }
.ua-info { display: inline-flex; position: relative; color: var(--text-4); cursor: help; }
.ua-info:hover { color: var(--accent); }
.ua-info-pop { position: absolute; top: calc(100% + 8px); left: -8px; z-index: 3000; width: 480px; max-width: 72vw; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 14px 44px rgba(0, 6, 35, .18); padding: 14px 16px; cursor: default; }
.ua-info-title { font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 10px; }
.ua-info-cat { display: grid; grid-template-columns: 100px 1fr; gap: 12px; align-items: start; padding: 8px 0; border-top: 1px solid var(--border); }
.ua-info-cat:first-of-type { border-top: 0; padding-top: 0; }
.ua-info-catlabel { font-size: 11px; font-weight: 600; padding-top: 2px; }
.ua-info-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ua-info-pill { font-size: 10.5px; font-weight: 500; color: #fff; padding: 2px 9px; border-radius: var(--r-full); white-space: nowrap; }

/* Oś czasu w szufladzie drill-down (godziny/dni wg granularności) */
.ua-tl { padding: 4px 6px 24px; }
.ua-tl-daylabel { position: sticky; top: 0; z-index: 1; background: var(--surface); padding: 9px 2px 6px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.ua-tl-entry { display: grid; grid-template-columns: 42px 14px 1fr; gap: 8px; }
.ua-tl-time { font-size: 11px; color: var(--text-4); text-align: right; padding-top: 5px; font-variant-numeric: tabular-nums; }
.ua-tl-rail { position: relative; display: flex; justify-content: center; }
.ua-tl-rail::before { content: ''; position: absolute; top: 0; bottom: -4px; width: 2px; background: var(--border); }
.ua-tl-entry:last-child .ua-tl-rail::before { bottom: auto; height: 12px; }
.ua-tl-dot { position: relative; z-index: 1; width: 9px; height: 9px; border-radius: var(--r-full); margin-top: 5px; box-shadow: 0 0 0 3px var(--surface); }
.ua-tl-content { min-width: 0; padding: 3px 0 10px; }
.ua-tl-line1 { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ua-tl-type { font-size: 10px; font-weight: 600; color: #fff; padding: 1px 8px; border-radius: var(--r-full); white-space: nowrap; }
.ua-tl-seq { font-size: 11px; color: var(--accent); font-weight: 500; flex: none; }
.ua-tl-title { font-size: 12.5px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.ua-tl-detail { font-size: 12px; color: var(--text-2, #4a4d5c); margin-top: 3px; overflow-wrap: anywhere; }
.ua-tl-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.ua-tl-chip { font-size: 10px; color: var(--text-3); background: var(--surface-2); padding: 1px 7px; border-radius: var(--r-full); white-space: nowrap; }
.ua-tl-chip.is-muted { color: var(--text-4); font-style: italic; }

/* Postęp 3 etapów pull-a w modalu */
.ua-phases { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.ua-phase { display: grid; grid-template-columns: 150px 1fr 52px; gap: 10px; align-items: center; }
.ua-phase-name { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ua-phase-name .text-xs { color: var(--text-4); }
.ua-phase-n { font-size: 11px; color: var(--text-4); text-align: right; }
.ua-phase.is-now .ua-phase-name { color: var(--accent); font-weight: 600; }
.ua-phase-soft .ua-phase-name { color: var(--text-4); }
.ua-phase-soft .progress-fill { background: var(--text-4); }

/* Lista dni z błędem w modalu wyniku pull-a */
.ua-fail-list { max-height: 160px; overflow: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.ua-fail-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 10px; font-size: 12px; border-top: 1px solid var(--border-2); }
.ua-fail-row:first-child { border-top: 0; }

/* ── Karta osoby (1b) ──────────────────────────────────────────────────── */
.ua-person { text-decoration: none; }
.ua-person:hover .ua-name { color: var(--accent); text-decoration: underline; }

.uap-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.uap-avatar { width: 46px; height: 46px; flex: none; border-radius: var(--r-full); display: grid; place-items: center; font-size: 16px; font-weight: 600; }
.uap-name { font-size: 19px; font-weight: 600; letter-spacing: -0.4px; color: var(--navy); white-space: nowrap; }
.uap-team { font-size: 11px; color: var(--text-3); background: var(--surface-2); padding: 2px 9px; border-radius: var(--r-full); white-space: nowrap; }

.uap-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.uap-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; }
.uap-kpi-val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; color: var(--navy); }
.uap-kpi-unit { font-size: 12px; color: var(--text-4); font-weight: 500; margin-left: 3px; }
.uap-kpi-label { font-size: 11px; color: var(--text-4); margin-top: 2px; }
.uap-kpi-delta { font-size: 11px; color: var(--text-3); margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.uap-kpi-arrow { color: var(--text-4); }
/* Porównanie do mediany zespołu = obiektywna ocena: powyżej = zielony, poniżej = czerwony. */
.uap-kpi-delta.is-up { color: var(--ok); }
.uap-kpi-delta.is-up .uap-kpi-arrow { color: var(--ok); }
.uap-kpi-delta.is-down { color: var(--err); }
.uap-kpi-delta.is-down .uap-kpi-arrow { color: var(--err); }
.uap-kpi-vs { color: var(--text-4); font-weight: 400; }

/* Kalendarz i peers = 50/50. Wąski ekran → jedna kolumna. */
.uap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.uap-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; }
.uap-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.uap-cal-card, .uap-peers-card { min-width: 0; }

/* Komórka liczona w JS (mattersBoard-style): dokładnie 13 kolumn wypełnia szerokość karty ≈ 3 mies.
   (fallback --cal-cell zanim policzy JS). Szerszy okres → kolumny tej samej wielkości przewijają się w poziomie. */
.uap-cal-card { --cal-cell: 20px; --cal-gap: 3px; }
.uap-cal-wrap { overflow-x: auto; }
.uap-cal { display: flex; gap: var(--cal-gap); min-width: min-content; }
.uap-cal-week { display: flex; flex-direction: column; gap: var(--cal-gap); }
.uap-cal-mon { height: 12px; font-size: 8.5px; color: var(--text-4); white-space: nowrap; }
.uap-cal-day { width: var(--cal-cell); height: var(--cal-cell); border-radius: 2px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-variant-numeric: tabular-nums; line-height: 1; overflow: hidden; }
.uap-cal-day.is-zero { background: var(--surface-2); }        /* w zakresie, brak aktywności — jasny kafel */
.uap-cal-day.is-pad { background: repeating-linear-gradient(45deg, #eceef3, #eceef3 2px, #f6f7fa 2px, #f6f7fa 4px); } /* poza okresem — wyszarzony, odróżnialny od zera */

.uap-dist { display: flex; flex-direction: column; }
.uap-dist-row { display: grid; grid-template-columns: 130px 52px 1fr; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border-2); }
.uap-dist-row:first-child { border-top: 0; }
.uap-dist-name { grid-row: 1; grid-column: 1; font-size: 12px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uap-dist-rbh { grid-row: 1; grid-column: 2; text-align: right; font-size: 12px; font-weight: 500; }
.uap-dist-bar { grid-row: 1; grid-column: 3; position: relative; height: 8px; background: var(--surface-2); border-radius: var(--r-full); }
.uap-dist-fill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--accent); border-radius: var(--r-full); }
.uap-dist-team { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--navy); opacity: .45; }
.uap-dist-pct { grid-row: 2; grid-column: 3; }

.uap-peers { display: flex; flex-direction: column; gap: 2px; }
.uap-peer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 110px) 44px; gap: 12px; align-items: center; padding: 5px 8px; border-radius: var(--r-sm); cursor: pointer; }
.uap-peer:hover { background: var(--surface-2); }
.uap-peer.is-target { background: var(--accent-50); }
.uap-peer-name { font-size: 12px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uap-peer.is-target .uap-peer-name { font-weight: 600; color: var(--accent); }
.uap-peer-bar { height: 10px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.uap-peer-fill { height: 100%; background: var(--accent); border-radius: var(--r-full); }
.uap-peer.is-target .uap-peer-fill { background: var(--navy); }
.uap-peer-n { text-align: right; font-size: 12px; color: var(--text-3); }

/* Swatch w etykiecie szuflady progów RBH */
.field label .ua-swatch { vertical-align: -2px; margin-right: 5px; }

/* Wąski ekran: kalendarz i peers jeden pod drugim, KPI 2 kolumny */
@media (max-width: 900px) {
    .uap-grid { grid-template-columns: 1fr; }
    .uap-kpis { grid-template-columns: repeat(2, 1fr); }
}

/* ─────────────────────────────────────────────────────────────────────────
   Reużywalny multiselect (x-multi-select) — dropdown z typeahead + zaznaczone
   podkreślone na górze. Popover teleportowany do <body> (klasy globalne).
   ───────────────────────────────────────────────────────────────────────── */
.ms { display: inline-block; }
.ms-trigger { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; height: 32px; padding: 0 11px; min-width: 150px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 12px; color: var(--navy); cursor: pointer; transition: border-color .12s; }
.ms-trigger:hover { border-color: var(--text-4); }
.ms-trigger.is-open { border-color: var(--accent); }
.ms-trigger.is-active { border-color: var(--accent); color: var(--accent); font-weight: 500; }
.ms-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-caret { flex: none; color: var(--text-4); }
.ms-pop { position: fixed; z-index: 3000; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 12px 36px rgba(0, 6, 35, .18); min-width: 200px; max-width: 340px; padding: 6px; }
.ms-search { display: flex; align-items: center; gap: 7px; padding: 5px 9px; margin-bottom: 4px; background: var(--surface-2); border-radius: var(--r-sm); color: var(--text-4); }
.ms-search input { border: 0; outline: 0; background: transparent; font-size: 12px; width: 100%; color: var(--navy); }
.ms-list { max-height: 280px; overflow: auto; }
.ms-item { display: flex; align-items: center; gap: 9px; padding: 6px 9px; border-radius: var(--r-sm); font-size: 12.5px; color: var(--navy); cursor: pointer; }
.ms-item:hover { background: var(--surface-2); }
.ms-item.is-sel { color: var(--accent); font-weight: 500; }
.ms-item.is-sel span { text-decoration: underline; text-underline-offset: 2px; }
.ms-item input { accent-color: var(--accent); cursor: pointer; flex: none; }
.ms-empty { padding: 10px; text-align: center; color: var(--text-4); font-size: 12px; }
.ms-foot { display: flex; align-items: center; justify-content: space-between; padding: 6px 9px 2px; margin-top: 4px; border-top: 1px solid var(--border); }
.ms-clear { border: 0; background: transparent; color: var(--accent); font-size: 11.5px; font-weight: 500; cursor: pointer; }
.ms-clear:hover { text-decoration: underline; }

/* ── Masowe operacje: kreator tworzenia (kroki, rozdzielnik) ───────────────── */
.step-title { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; color: var(--navy); }
.step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; flex: none; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 600;
}
/* Rozkład planu na osoby — „ile ticketów do kogo" jednym rzutem oka. */
.dist-chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
    background: var(--accent-50); color: var(--accent);
    border-radius: 999px; font-size: 12px; white-space: nowrap;
}
.dist-chip.is-empty { background: var(--warn-bg); color: var(--warn); }
/* Proweniencja przypisania w wierszu (auto z roli / ręcznie / błąd nazwy). */
.src-tag {
    display: inline-block; margin-top: 3px; margin-right: 4px; padding: 1px 6px;
    background: var(--surface-2); color: var(--text-4);
    border-radius: var(--r-sm); font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px;
}
.src-tag.is-manual { background: var(--accent-50); color: var(--accent); }
.src-tag.is-warn { background: var(--warn-bg); color: var(--warn); }
.src-tag.is-err { background: #ffe9e9; color: var(--err); }
.input-sm { padding: 4px 8px; font-size: 12.5px; height: auto; }
.sep-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border); flex: none; }

/* Kreator tworzenia: na DUŻYM ekranie rozdzielnik idzie w drugą kolumnę.
   Świadome złamanie `--content-max` (tryb create ma `.content-wide`) — rozdzielnik to
   plansza domena × wykonawca, nie lista, więc szerokość jest tu funkcją, nie ozdobą.
   Próg 1700px: laptop 1512 zostaje JEDNOKOLUMNOWY (dwie kolumny by się tam zgniotły),
   monitor 2560 dostaje układ obok siebie. */
.bulk-create-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.bcg-col { min-width: 0; }
@media (min-width: 1700px) {
    .bulk-create-grid.is-split { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
    /* Kolumny startują równo — bez marginesu pierwszej karty w prawej kolumnie. */
    .bulk-create-grid.is-split .bcg-col > .card:first-child { margin-top: 0; }
    /* Plan i podgląd mają więcej pionu, skoro nie konkurują z formularzem o wysokość. */
    .bulk-create-grid.is-split .table-wrap { max-height: 64vh; }
}
/* Więcej miejsca na skonstruowanie treści ticketa (edytor bywa główną pracą w tym kroku). */
.editor-area-lg { min-height: 280px; max-height: 60vh; resize: vertical; }

/* ── Quick Question: Tempo realizacji ──────────────────────────────────────
   Tabela osi czasu ma NAGŁÓWEK DWUPOZIOMOWY (grupy: przepływ / tempo / stan / praca) —
   15 kolumn liczbowych bez grupowania czyta się jak ściana cyfr. Klikalne komórki
   (`.tempo-hit`) prowadzą do listy ticketów, więc muszą wyglądać na klikalne. */
.sla-leg, .tempo-leg { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.tempo-leg { height: 10px; width: 10px; border-radius: 2px; }

.tempo-table thead tr.tempo-groups th {
    text-align: center;
    font-size: 10px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-4);
    padding: 7px 0 3px;
    border-bottom: 1px solid var(--border);
}
.tempo-table thead tr.tempo-groups th + th { border-left: 1px solid var(--border); }
.tempo-table tbody td { font-size: 12.5px; }
/* 15 kolumn liczbowych na jednym ekranie: ciaśniejszy padding (nagłówek `uppercase` +
   `letter-spacing` jest szerszy, niż wygląda — przy 14px ucinało „DOMKNIĘTO"),
   a etykieta okresu nie może się łamać na dywizie daty („2026-|06-01"). */
.tempo-table thead th { padding: 10px 8px; }
.tempo-table tbody td, .tempo-table tfoot td { padding: 11px 8px; }
.tempo-table th:first-child, .tempo-table td:first-child { white-space: nowrap; }
.tempo-table td.tempo-hit {
    text-align: center;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background 0.12s ease;
}
.tempo-table td.tempo-hit:hover { background: var(--accent-50); color: var(--accent); font-weight: 600; }
.tempo-table tfoot tr.tempo-total td {
    border-top: 2px solid var(--border);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: var(--surface-2);
    padding: 9px 10px;
}
/* Wykresy „Tempa": przy dziennej granulacji plansza bywa szersza niż karta — przewijamy
   ją w poziomie (rozciągnięty SVG zgniatałby etykiety osi). Tytuł drugiego wykresu
   zostaje przyklejony do lewej, żeby nie uciekał przy przewijaniu. */
.tempo-plot { overflow-x: auto; overflow-y: hidden; }
.tempo-subhead { position: sticky; left: 0; }
/* Oś czasu „Tempa" ma 15 kolumn liczbowych — poniżej tej szerokości nagłówki zaczynają
   wchodzić pod sąsiednie komórki, więc zamiast ściskać kolumny pozwalamy `.table-wrap`
   przewinąć tabelę w poziomie. */
.tempo-table { min-width: 1100px; }
/* Kafelki KPI „Tempa" są klikalne (pula na dziś); `is-on` = ta pula zawęża oś czasu. */
.sla-stat.is-clickable { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.sla-stat.is-clickable:hover { border-color: var(--accent); box-shadow: var(--sh-2); }
.sla-stat.is-on { border-color: var(--accent); background: var(--accent-50); }

/* Pasek informujący, że oś czasu jest zawężona do puli spod kafelka. */
.tempo-focus {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px; padding: 9px 12px;
    background: var(--accent-50); border: 1px solid var(--accent); border-radius: var(--r-sm);
}
.tempo-focus-txt { font-size: 12.5px; color: var(--navy); flex: 1; min-width: 260px; }
.tempo-focus .filter-pills { flex: none; }

/* Rozkład wieku puli w modalu kafelka. */
.tempo-age { display: flex; gap: 10px; align-items: flex-end; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.tempo-age-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tempo-age-n { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--navy); }
.tempo-age-bar { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; }
.tempo-age-lbl { font-size: 10.5px; color: var(--text-4); }

/* Kolumny bez sensu przy aktywnym filtrze — widoczne, ale wyraźnie drugorzędne. */
.tempo-table .is-dimmed, .tempo-table td.is-dimmed { opacity: .38; }
/* Wiersz okresu, który jeszcze nie nastąpił: widoczny, ale wyraźnie „planowany". */
.tempo-table tr.is-future td { background: var(--surface-2); }
.tempo-table tr.is-future td:first-child { font-style: italic; }
/* Kafelki kolejki grupujemy wizualnie: trzy statusy obsługiwane przez zespół, potem
   separator i to, co stoi poza kolejką (weryfikacja, wstrzymania). */
.sla-stat.is-queue { border-left: 3px solid var(--accent-50); }
.sla-sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 4px; }
/* Druga, drobniejsza wartość w komórce (np. czas netto pod czasem kalendarzowym). */
.tempo-sub { display: block; font-size: 10.5px; color: var(--text-4); font-variant-numeric: tabular-nums; }
/* Pasek pod wartością w tabeli „Tempa" (jedna mechanika, różne skale — patrz partial
   `livewire/partials/tempo-bar`). Cienki, żeby nie konkurował z liczbą. */
.tempo-bar { display: block; height: 4px; margin: 3px auto 0; width: 82%; background: rgba(128, 128, 128, 0.16); border-radius: 2px; position: relative; overflow: hidden; }
.tempo-bar i { display: block; height: 100%; border-radius: 2px; }
.tempo-table tbody td { padding: 9px 8px; }

/* Heatmapa: natężenie tła = wielkość (napływ/zamknięte, wspólna skala). Kolor wchodzi
   zmienną `--heat`, a nie stylem inline, żeby hover klikalnej komórki mógł go przykryć
   (styl inline wygrywa z każdym selektorem). */
.tempo-table td.is-heat { background: var(--heat); }
.tempo-table tbody td.tempo-hit:hover { background: var(--accent-50); }

/* Nagłówek DWUPOZIOMOWY przykleja się piętrowo: grupy na samej górze, nazwy kolumn tuż
   pod nimi. Bez jawnego `top` obie linie lądowały na 0 i nachodziły na siebie. */
.tempo-table thead tr.tempo-groups th { top: 0; height: 26px; z-index: 4; }
.tempo-table thead tr:not(.tempo-groups) th { top: 26px; }
