.sales-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
}

/* Hardware details rows */
.hw-detail-row td {
    background: rgba(15, 23, 42, .9);
    border-top: 1px dashed rgba(148, 163, 184, .45);
}

/* Lista szczegółów pozycji hardware – szary tekst jak deliverables w WBS */
.hw-detail-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: .75rem;
    color: var(--muted);
}

.hw-detail-list li {
    margin-bottom: 2px;
    color: inherit;
}

.hw-detail-row input[data-f="detail_desc"] {
    background: rgba(15, 23, 42, .95);
    border-color: #25345e;
}

/* WBS deliverables rows in public view (similar to hardware details) */
.details-row td {
    background: rgba(15, 23, 42, .9);
    border-top: 1px dashed rgba(148, 163, 184, .45);
}

/* Lista opisów zadań WBS – szary tekst jak w hardware */
.details-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: .75rem;
    color: var(--muted);
}

/* Gantt: ogranicz długość etykiet po lewej stronie */
.g-label,
.g-left-task {
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.details-list li {
    margin-bottom: 2px;
    color: inherit;
    text-transform: uppercase;
}

:root {
    --bg: #0b1220;
    --panel: #0b1224;
    --panel-2: #0d1530;
    --card: rgba(13, 22, 44, .7);
    --muted: #94a3b8;
    --text: #e5e7eb;
    --brand: #7aa2ff;
    --accent: #22c55e;
    --danger: #ef4444;
    --border: #1f2a44;
    --shadow: 0 10px 40px rgba(0, 0, 0, .45);
    --radius: 14px;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 10% -10%, #142042 0, transparent 60%), linear-gradient(180deg, #0a1022 0%, #0b1220 100%);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* === Global read-only state dla zamkniętych ofert === */
body.offer-readonly .form-control,
body.offer-readonly .form-select,
body.offer-readonly textarea {
    background-color: #020617;
    opacity: .8;
    cursor: default;
}

/* Read-only: przełączniki/checkboxy (w tym Moduły w ofercie) */
body.offer-readonly .form-check,
body.offer-readonly .form-switch,
body.offer-readonly .form-check-label,
body.offer-readonly #modulesGrid *,
body.offer-readonly input[type="checkbox"] {
    pointer-events: none !important;
}

body.offer-readonly input,
body.offer-readonly textarea,
body.offer-readonly select,
body.offer-readonly button.btn,
body.offer-readonly button.btn-primary,
body.offer-readonly button.btn-ghost,
body.offer-readonly button.btn-danger,
body.offer-readonly button.btn-outline-danger {
    pointer-events: none !important;
}

/* Read-only: nawigacja w headerze (język, Oferty, Firma, profil) ma zawsze działać */
body.offer-readonly .app-header,
body.offer-readonly .app-header * {
    pointer-events: auto !important;
}

body.offer-readonly .app-header .btn,
body.offer-readonly .app-header .user-chip {
    opacity: 1 !important;
    cursor: pointer !important;
}

/* Wyjątek: select statusu może pozostać aktywny przy wybranych statusach (np. Gotowe do wysłania) */
body.offer-readonly select.keep-enabled {
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Sidebar (katalogi & oferty) zawsze aktywna – nawet w trybie read-only ofert */
body.offer-readonly .sidebar,
body.offer-readonly .sidebar * {
    pointer-events: auto !important;
}

/* Ale same przyciski w sidebarze nie powinny być przygaszone */

body.offer-readonly .sidebar .btn {
    opacity: 1 !important;
}

/* W trybie read-only wyszukiwarka w sidebarze ma pozostać w pełni aktywna */
body.offer-readonly .sidebar input,
body.offer-readonly .sidebar textarea,
body.offer-readonly .sidebar select {
    pointer-events: auto !important;
    opacity: 1 !important;
    cursor: text !important;
}

body.offer-readonly .btn,
body.offer-readonly .btn-primary,
body.offer-readonly .btn-ghost,
body.offer-readonly .btn-danger,
body.offer-readonly .btn-outline-danger {
    opacity: .65;
}

/* Wyjątki: te przyciski są zawsze aktywne nawet w trybie read-only */
body.offer-readonly #btnMakeTemplate,
body.offer-readonly #btnReopenOffer {
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Wyjątki: przyciski w zakładce Udostępnianie powinny działać nawet w trybie read-only */
body.offer-readonly #btnShareCreate,
body.offer-readonly #btnShareDisable,
body.offer-readonly #btnShareCopy,
body.offer-readonly #btnShareReload,
body.offer-readonly #btnShareDecisionGen,
body.offer-readonly #btnShareDecisionCopy,
body.offer-readonly #btnShareDecisionReset,
body.offer-readonly #btnSendOffer {
    pointer-events: auto !important;
    opacity: 1 !important;
}


/* Umożliw zawsze kliknięcie przycisków w modalach (np. potwierdzenie, usuwanie) */
body.offer-readonly .modal button,
body.offer-readonly .modal .btn {
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Read-only: wszystkie pola w modalach (np. Dodaj katalog / ofertę) pozostają aktywne */
body.offer-readonly .modal input,
body.offer-readonly .modal textarea,
body.offer-readonly .modal select {
    pointer-events: auto !important;
    opacity: 1 !important;
    cursor: auto !important;
}

/* Read-only: pozwól przełączać moduł Finanse w konfiguracji projektu */
body.offer-readonly #modulesGrid [data-mod-key="finance"],
body.offer-readonly #modulesGrid [data-mod-key="finance"] *,
body.offer-readonly #modulesGrid .mod-finance,
body.offer-readonly #modulesGrid .mod-finance * {
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Read-only: selektory wariantów w zakładce Finanse pozostają aktywne */
body.offer-readonly #finVariantFilters select,
body.offer-readonly #finVariantFilters .form-select {
    pointer-events: auto !important;
    opacity: 1 !important;
    cursor: pointer !important;
}

/* Read-only: moduł "Post-project raport" pozostaje edytowalny */
body.offer-readonly #tab-post input,
body.offer-readonly #tab-post textarea,
body.offer-readonly #tab-post select,
body.offer-readonly #tab-post button,
body.offer-readonly #tab-post .btn {
    pointer-events: auto !important;
    opacity: 1 !important;
    cursor: auto !important;
}

a {
    color: inherit;
    text-decoration: none
}

.app-shell {
    min-height: calc(100vh - 64px)
}

/* Top header */
.app-header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: saturate(130%) blur(8px);
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0));
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, .03)
}

.user-chip.muted {
    opacity: .6
}

/* clickable login chip */
.user-chip[role=button] {
    cursor: pointer
}

.user-chip[role=button]:hover {
    border-color: #335493;
    background: rgba(255, 255, 255, .06)
}

/* decorative background */
.bg-decor:before,
.bg-decor:after {
    content: "";
    position: fixed;
    filter: blur(60px);
    opacity: .22;
    z-index: -1;
}

/* Sidebar */
.sidebar {
    width: 420px !important;
    min-width: 420px !important;
    max-width: 420px !important;
    flex: 0 0 320px !important;
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    box-shadow: var(--shadow);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 64px;
    /* header height */
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
}

.sidebar-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.list-group-flush .list-group-item {
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .05)
}

.dir-row:hover {
    background: rgba(255, 255, 255, .05)
}

.dir-row {
    position: relative;
    height: 100%;
}


/* Force white title/icon for directories */
.dir-row .title span {
    color: #fff;
}

.dir-row .title i {
    color: #fff;
}

.actions {
    opacity: 0;
    transition: opacity .15s;
}

.dir-row:hover .actions {
    opacity: 1 !important;
}

/* Akcje (3 kropki) w pakietach wariantów – zachowanie jak w listach ofert */
.share-pkg-row .actions {
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

.share-pkg-row:hover .actions {
    opacity: 1;
    pointer-events: auto;
}

.actions.has-toggle .action-list {
    position: absolute;
    right: 0;
    top: 100%;
    bottom: auto;
    margin-top: .4rem;
    background: rgba(255, 255, 255, .95);
    color: #000;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: 10px;
    box-shadow: 0 6px 26px rgba(0, 0, 0, .25);
    padding: .35rem 0;
    z-index: 2000;
    min-width: 180px;
    display: none !important;
}

.actions.has-toggle.show-actions .action-list {
    display: none !important;
}

.actions.has-toggle .action-list button {
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: .5rem .9rem;
    text-align: left;
    font-size: .85rem;
    color: #000;
}

.actions.has-toggle .action-list button:hover {
    background: rgba(0, 0, 0, .06);
}

.card-list .list-group-item {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--border);
    margin-bottom: .5rem;
    border-radius: 12px;
    transition: transform .12s ease, background .12s;
}

/* Licencje: warianty – karty układają się w kilka rzędów zamiast poziomego scrolla */
#srvVariantsList,
#hwVariantsList,
#variantsList,
.wbs-variants-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding-bottom: .25rem;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
}

#variantsList .list-group-item {
    margin-bottom: 0;
}

.card-list .list-group-item {
    align-items: flex-start;
}

.card-list .list-group-item:hover,
.wbs-variants-list .list-group-item:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, .06)
}

/* Offers list – richer visual row */
/* Offers rows: show actions on hover (parity with .dir-row) */
.card-list .list-group-item .actions,
.wbs-variants-list .list-group-item .actions {
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
    position: relative;
    z-index: 2;
}

.card-list .list-group-item:hover .actions,
.wbs-variants-list .list-group-item:hover .actions {
    opacity: 1;
    pointer-events: auto;
}

/* ensure actions are clickable on hover (safety override) */
#dirList .list-group-item:hover .actions {
    pointer-events: auto;
}

/* spacing: first offer separated from folder above */
.collapse .list-group-item:first-child {
    margin-top: 0.4rem;
}

.offer-title {
    font-weight: 600;
    color: var(--text);
    /* pozwól tytułowi zajmować pełną szerokość i zawijać się */
    display: block;
    width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}

.offer-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.offer-sub {
    font-size: .85rem;
    color: var(--muted);
}

/* Empty state */
.empty-state {
    padding: 36px;
    text-align: center;
    color: var(--muted)
}

.empty-state i {
    font-size: 32px;
    opacity: .55
}

.empty-state h6 {
    margin: .6rem 0 .25rem 0;
    color: #dbeafe
}

/* Slide + fade dla ofert */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.fade-in-up {
    animation: slideInUp .18s ease-out both;
}

/* Podczas otwierania collapse — ukryj overflow */
.dir-offers.collapsing {
    overflow: hidden;
}


/* --- Notifications / Toasts --- */
.toast-container {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    /* nie blokuj kliknięć w tło */
}

.toast-item {
    min-width: 260px;
    max-width: 360px;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.96);
    /* ciemny, lekko przezroczysty panel */
    color: #e5e7eb;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
    font-size: 0.875rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    pointer-events: auto;
    /* pozwól kliknąć toast jeśli kiedyś dodamy przycisk */
}

.toast-item.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-item .toast-body {
    flex: 1;
    margin: 0;
    padding: 0;
}

/* warianty kolorystyczne (pasek po lewej) */
.toast-success {
    border-left: 3px solid #22c55e;
}

.toast-error {
    border-left: 3px solid #ef4444;
}

.toast-warning {
    border-left: 3px solid #f59e0b;
}

.toast-info {
    border-left: 3px solid #3b82f6;
}

/* Admin Panel Styling */

/* === Global modal styling (matching Licencje modals) === */
.modal-content {
    background: var(--panel-2);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

.modal-header,
.modal-footer {
    background: rgba(255, 255, 255, .05);
    border-color: rgba(255, 255, 255, .08);
}

.modal-body input,
.modal-body textarea {
    background: rgba(12, 19, 40, .85);
    border: 1px solid #25345e;
    color: var(--text);
}

.modal-body input::placeholder,
.modal-body textarea::placeholder {
    color: var(--muted);
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(150%);
}


/* === GANTT: viewport & bottom scrollbar (scroll only the timeline) === */
.gantt-surface {
    position: relative;
    height: 420px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior: contain;
}

/* Bright scrollbar for main Gantt viewport */
#gantt.gantt-surface::-webkit-scrollbar {
    height: 12px;
}

#gantt.gantt-surface::-webkit-scrollbar-thumb {
    background: #5a78c9;
    border-radius: 8px;
}

#gantt.gantt-surface::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .08);
}

/* Firefox */
#gantt.gantt-surface {
    scrollbar-width: thin;
    scrollbar-color: #5a78c9 rgba(255, 255, 255, .08);
}

/* Cienki, zawsze widoczny pasek przewijania pod wykresem */
.gantt-x-scroll {
    height: 14px;
    margin-top: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior: contain;
}

.gantt-x-scroll::-webkit-scrollbar {
    height: 12px;
}

.gantt-x-scroll::-webkit-scrollbar-thumb {
    background: #243357;
    border-radius: 8px;
}

.gantt-x-scroll::-webkit-scrollbar-track {
    background: transparent;
}

/* wewnętrzny element ma szerokość równą szerokości SVG */
.gantt-x-inner {
    height: 1px;
}

.gantt-grid {
    grid-column: 1/-1;
    grid-row: 1;
    display: grid;
    height: 2px;
    background: transparent;
}

.gantt-bar {
    height: 18px;
    border-radius: 6px;
    background: rgba(122, 162, 255, .6);
    border: 1px solid rgba(122, 162, 255, .85);
}

/* ===================== WBS & Harmonogram – UI polish ===================== */
/* Sticky WBS header (toolbar with totals and "Dodaj fazę") */
.wbs-sticky {
    position: sticky;
    top: 78px;
    /* below main header + tabs; adjust if needed */
    z-index: 15;
    background: linear-gradient(180deg, rgba(11, 18, 32, .96), rgba(11, 18, 32, .88));
    border-radius: var(--radius);
    padding: .4rem .75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px) saturate(120%);
}

/* Grid baseline */
.wbs-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.wbs-grid thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03));
    backdrop-filter: blur(4px) saturate(120%);
    padding: .6rem .75rem;
    font-weight: 600;
    color: #dbeafe;
    border-bottom: 1px solid var(--border);
}

.wbs-grid tbody tr+tr td {
    border-top: 1px solid rgba(255, 255, 255, .05);
}

.wbs-grid td {
    padding: .5rem .6rem;
    vertical-align: middle;
}

/* Phase vs Task rows */
.wbs-row.phase td {
    background: rgba(122, 213, 255, 0.18);
}

.wbs-row.phase td:first-child {
    border-left: 4px solid var(--brand);
    border-top-left-radius: 12px;
}

.wbs-row.phase td:last-child {
    border-top-right-radius: 12px;
}

.wbs-row.task td {
    background: rgba(255, 255, 255, .02);
}

.wbs-row.task:hover td {
    background: rgba(255, 255, 255, .05);
}

/* WBS: deliverables / sub-tasks rows (editor view) */
.wbs-row.deliv td {
    padding: .3rem .6rem;
    background: rgba(12, 19, 40, .9);
    border-top: 1px solid rgba(255, 255, 255, .05);
}

.wbs-row.deliv i.bi-arrow-return-right {
    font-size: .9rem;
    color: var(--muted);
}

.wbs-row.deliv .deliv-label {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    white-space: nowrap;
}

.wbs-row.deliv textarea[data-f="detail_desc"] {
    background: rgba(12, 19, 40, .95);
    border-color: #25345e;
    color: var(--text);
    resize: vertical;
}

/* Drag handle */
.wbs-row .handle {
    opacity: .45;
    cursor: grab;
}

.wbs-row .handle:hover {
    opacity: .7;
}

/* Inline controls */
.wbs-grid .form-control,
.wbs-grid .form-select {
    height: 34px;
    padding: .25rem .5rem;
    border-radius: 10px;
    background: rgba(12, 19, 40, .7);
    border: 1px solid #25345e;
}

.wbs-grid .form-control:focus,
.wbs-grid .form-select:focus {
    border-color: #365fa3;
    box-shadow: 0 0 0 .2rem rgba(110, 168, 254, .15);
}

.wbs-grid .form-control.text-end {
    text-align: right;
}

.wbs-grid input[type="date"] {
    min-width: 135px;
}


.wbs-grid .btn-ghost i {
    font-size: 1rem;
}

/* Summary table under WBS */
.wbs-summary thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, .06);
}

.wbs-summary tfoot td {
    padding: .6rem .75rem;
}

/* Gantt */
.gantt-surface {
    position: relative;
    display: grid;
    gap: .4rem;
    padding: .75rem;
    min-height: 180px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .02));
}

.gantt-bar {
    height: 18px;
    border-radius: 8px;
    background: rgba(122, 162, 255, .7);
    border: 1px solid rgba(122, 162, 255, .9);
}

.gantt-bar:hover {
    filter: brightness(1.05);
}

/* ===================== WBS – layout & contrast tweaks ===================== */
.wbs-grid .row-title {
    display: grid;
    align-items: center;
    gap: .4rem;
}

/* Faza: toggle + handle + tytuł */
.wbs-row.phase .row-title {
    grid-template-columns: 18px 16px 1fr;
}

/* Zadanie: tylko handle + tytuł (pełna szerokość) */
.wbs-row.task .row-title {
    grid-template-columns: 16px 1fr;
}

.wbs-grid .row-title .collapse-toggle {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: .7;
}

.wbs-grid .row-title .collapse-toggle:hover {
    opacity: 1;
}

.wbs-grid .row-title .collapse-toggle i {
    font-size: 0.8rem;
    color: #ffffff;
    line-height: 1;
}

.wbs-grid .row-title .handle {
    opacity: .55;
    cursor: grab;
}

.wbs-grid .row-title .handle:hover {
    opacity: .85;
}

/* Czytelne pola na ciemnym tle */
.wbs-grid .form-control,
.wbs-grid .form-select,
.wbs-summary .form-control,
.wbs-summary .form-select {
    color: #fff;
    background: rgba(12, 19, 40, .85);
    border-color: #25345e;
}

.wbs-grid input[type="date"] {
    color: #fff;
}

.wbs-grid thead th {
    color: #f8fafc;
}

/* WBS: right-aligned actions in the same row */
.wbs-grid .row-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .35rem;
}

.wbs-grid .row-actions .btn {
    line-height: 1;
}

/* WBS: calculated read-only numbers (strong contrast) */
.wbs-grid [data-f="sum_estimate"],
.wbs-grid [data-f="sum_buffered"],
.wbs-grid [data-f="est_buf"] {
    color: #fff;
    font-weight: 600;
}

/* Normalize icon button size in WBS header */
.wbs-grid .btn.btn-sm i {
    font-size: 0.85rem;
}

#btnAddPhase i,
#btnReloadWbs i {
    font-size: 0.85rem;
}

/* Unify icon size in secondary tabs (WBS + Harmonogram / Podsumowanie) */
.sub-pills .nav-link i {
    font-size: 0.95rem;
    /* match config tabs */
    line-height: 1;
}

/* Fix: unify icon size in WBS/Harmonogram and Podsumowanie tabs */
.nav.nav-pills.sub-pills .nav-link i {
    font-size: 0.9rem !important;
    width: 1.1rem;
    min-width: 1.1rem;
}

/* WBS: wymuś biały tekst w kolumnie Daty */
.wbs-grid td[data-f="phase_dates"] {
    color: var(--text) !important;
}

/* ========== WBS Summary – polish & phase total ========== */
.wbs-summary thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03));
    color: #dbeafe;
    border-bottom: 1px solid var(--border);
}

.wbs-summary tbody tr td {
    background: rgba(255, 255, 255, .02);
}

.wbs-summary tbody tr+tr td {
    border-top: 1px solid rgba(255, 255, 255, .06);
}

.wbs-summary tbody tr:hover td {
    background: rgba(255, 255, 255, .04);
}

/* separator fazy + suma kwoty w ostatniej kolumnie */
.wbs-summary .phase-sep td {
    background: rgba(122, 162, 255, .10);
    color: #e5edff;
    border-top: 1px solid rgba(122, 162, 255, .25);
}

.wbs-summary tfoot td {
    background: rgba(255, 255, 255, .06);
}

/* WBS Summary: ensure white text for dark theme */
.wbs-summary thead th,
.wbs-summary tbody td,
.wbs-summary tfoot td {
    color: var(--text) !important;
}

/* WBS: drag & drop hints */
.wbs-grid tr.dragging td {
    opacity: .6;
}

.wbs-grid tr.drag-over td {
    outline: 2px dashed rgba(122, 162, 255, .6);
    outline-offset: -4px;
}

/* WBS: podpowiedź, że przenosi się cały blok fazy */
.wbs-grid tr.phase.dragging td {
    box-shadow: inset 0 0 0 2px rgba(122, 162, 255, .5);
}

/* Gantt: never shrink SVG inside the viewport; always use its intrinsic width */
.gantt-surface .gantt-svg {
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    display: block;
}

/* Day cells with small gutters so days don't visually merge */
.g-day-cell {
    fill: rgba(255, 255, 255, .035);
    /* subtle fill */
    stroke: rgba(255, 255, 255, .08);
    /* thin border to outline each day */
    stroke-width: 1;
    rx: 3;
    ry: 3;
}

/* Slightly dim grid so cell borders are dominant */
.g-grid {
    stroke: rgba(255, 255, 255, .08);
}

.g-task {
    fill: #69d084;
    opacity: .98;
    stroke: rgba(0, 0, 0, .25);
    stroke-width: 0.5;
}

/* --- Gantt refinements: table-like look & labels --- */
.gantt-surface {
    background: rgba(255, 255, 255, .02);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    overflow-y: hidden;
}

.gantt-svg {
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
}

.g-bg {
    fill: rgba(255, 255, 255, .04);
}

.g-grid {
    stroke: rgba(255, 255, 255, .10);
    stroke-width: 1;
}

.g-weekend {
    fill: rgba(255, 255, 255, .06);
}

.g-day {
    fill: var(--text);
    font-size: 12px;
    opacity: .9;
}

.g-day-minor {
    fill: rgba(229, 231, 235, .7);
    font-size: 11px;
}

.g-day-major {
    font-weight: 700;
}

.g-label {
    fill: var(--text);
    font-weight: 600;
    font-size: 13px;
}

.g-bar {
    shape-rendering: geometricPrecision;
}

.g-phase {
    fill: #77a7ff;
    opacity: .55;
    pointer-events: none;
    /* faza nigdy nie blokuje interakcji */
    stroke: rgba(122, 162, 255, .45);
    /* miękki obrys dla czytelnej krawędzi */
    stroke-width: 1;
}

.g-task {
    fill: #69d084;
    opacity: .95;
}

.g-task-text {
    fill: #0b1220;
    font-weight: 600;
    font-size: 12px;
}

.g-left-task {
    fill: var(--text);
    font-size: 12px;
    opacity: .95;
}

.g-row {
    stroke: rgba(255, 255, 255, .08);
    stroke-width: 1;
}

/* --- GANTT: shell + toolbar + viewport --- */
.gantt-surface {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .02);
    padding: 0;
    overflow: hidden;
}

/* pasek nad wykresem (z suwakiem zoom) */
.gantt-toolbar {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, .03);
    position: sticky;
    top: 0;
    z-index: 2;
}

.gantt-toolbar .zoom-wrap {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-left: auto;
}

.gantt-toolbar input[type="range"] {
    width: 220px;
}

/* tylko wykres przewijamy poziomo */
.gantt-viewport {
    position: relative;
    height: 420px;
    overflow-x: auto;
    overflow-y: hidden;
}

.gantt-viewport:hover {
    overscroll-behavior: contain;
}

/* wheel nie przewija całej strony */

.gantt-canvas {
    position: relative;
    min-width: 1200px;
    height: 100%;
}

/* sticky nagłówek z datami */
.gantt-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(13, 22, 44, .92);
    backdrop-filter: blur(4px) saturate(120%);
    border-bottom: 1px solid var(--border);
    padding: 6px 10px;
    color: var(--text);
    font-weight: 600;
    letter-spacing: .02em;
}

.gantt-header .tick {
    display: inline-block;
    opacity: .9;
    padding: 0 12px;
    white-space: nowrap;
}

/* lewa kolumna z nazwami */
.gantt-row-labels {
    position: absolute;
    left: 0;
    top: 36px;
    bottom: 0;
    width: 220px;
    border-right: 1px solid var(--border);
    padding: 12px 10px;
}

.gantt-row-label {
    color: var(--text);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* siatka + bary */
.gantt-grid {
    position: absolute;
    left: 220px;
    right: 0;
    top: 36px;
    bottom: 0;
}

.gantt-gridlines .v {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, .06);
}

.gantt-gridlines .v.major {
    background: rgba(255, 255, 255, .12);
}

.gantt-row {
    position: relative;
    height: 32px;
    display: flex;
    align-items: center;
}

.gantt-bar.phase {
    height: 10px;
    border-radius: 8px;
    background: #7aa2ff;
    opacity: .9;
}

.gantt-bar.task {
    height: 18px;
    border-radius: 6px;
    background: #45b36b;
}

.gantt-sticky-shadow {
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .06);
}

/* Gantt: tylko timeline się przewija i zostaje w boxie */
#gantt.gantt-surface {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    padding: 8px 0;
}

#gantt.gantt-surface svg {
    display: block;
}

/* Siatka/etykiety */
.gantt-grid text {
    font-size: 11px;
    fill: #cbd5e1;
    opacity: .9;
}

.gantt-grid .tick {
    stroke: rgba(255, 255, 255, .08);
}

.gantt-grid .tick-strong {
    stroke: rgba(255, 255, 255, .14);
}

/* Paski zadań (brak pasków faz) */
.gantt-bar {
    rx: 6px;
    ry: 6px;
}

/* === FIX: prevent page expansion on Gantt zoom; keep scroll only inside the chart === */
main.flex-grow-1,
.tab-content,
.tab-pane,
.card-surface {
    min-width: 0;
    /* allow flex children to shrink, avoid layout overflow */
}

/* Gantt viewport hard guarantees */
.gantt-surface {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

/* Make SVG not affect outer layout while still expanding internal scroll area */
.gantt-surface svg.gantt-svg {
    display: block;
}

/* Bottom scrollbar spans the card width but never expands the page */
.gantt-x-scroll {
    width: 100%;
    max-width: 100%;
}

#projectSummary .card-surface {
    padding: 0.75rem 1rem;
}

.text-muted {
    color: #4a7bb7 !important;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .75;
}

#projectSummary strong {
    font-size: 1.05rem;
    color: #fff;
}

.app-header .brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 600;
    letter-spacing: .2px
}

.app-header .brand i {
    font-size: 1.1rem;
    color: var(--brand)
}

.app-header .hdr-right {
    display: flex;
    align-items: center;
    gap: .5rem
}

.bg-decor:before {
    width: 420px;
    height: 420px;
    left: -120px;
    top: -80px;
    background: radial-gradient(circle at 30% 30%, #7aa2ff 0, transparent 60%)
}

.bg-decor:after {
    width: 520px;
    height: 520px;
    right: -160px;
    bottom: -140px;
    background: radial-gradient(circle at 70% 70%, #22c55e 0, transparent 60%)
}

.sidebar .hdr h2 {
    font-size: .8rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0
}

.toolbar {
    gap: .5rem
}

.input-with-icon {
    position: relative
}

.input-with-icon i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: .6
}

.input-with-icon .form-control {
    padding-left: 32px
}

.dir-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
    padding: .6rem .35rem;
    border-radius: 10px;
    transition: background .15s, transform .15s;
}

.dir-row .title {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    flex: 1 1 auto;
    min-width: 0;
}

.dir-row .meta {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex: 0 0 auto;
}

.badge-soft {
    background: rgba(110, 168, 254, .12);
    color: #b7d0ff;
    border: 1px solid rgba(110, 168, 254, .25);
    border-radius: 999px;
    padding: .15rem .5rem;
    font-weight: 600
}

/* === Admin stats (Statystyki) === */
.stats-kpi-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: .15rem;
}

.stats-kpi-value {
    font-size: 1.6rem;
    font-weight: 600;
    color: #e5edff;
}

.stats-kpi-sub {
    font-size: .8rem;
    color: var(--muted);
}

.stats-progress {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 23, 42, .9);
    border: 1px solid rgba(148, 163, 184, .45);
}

.stats-progress .progress-bar {
    background: linear-gradient(90deg, #4f46e5, #22c55e);
}
/* Main */
.main-top {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02))
}

.autosave-hint {
    opacity: .75;
    font-size: .9rem
}

.card-surface {
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius)
}

.glass {
    backdrop-filter: blur(4px) saturate(120%);
    border-radius: var(--radius)
}

/* Tabs */
.pretty-tabs .nav-link {
    display: flex;
    align-items: center;
    gap: .5rem
}

.nav-tabs {
    border-bottom: 1px solid var(--border)
}

.nav-tabs .nav-link {
    background: rgba(255, 255, 255, .03);
    color: var(--muted);
    border: 1px solid var(--border);
    border-bottom-color: transparent;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px
}

.nav-tabs .nav-link:hover {
    color: #dbeafe
}

.nav-tabs .nav-link.active {
    background: rgba(255, 255, 255, .08);
    color: var(--text)
}

.sub-pills .nav-link {
    border-radius: 999px
}

/* Forms */
.form-control,
.form-select {
    background: rgba(12, 19, 40, .75);
    border: 1px solid #1f2a44;
    color: var(--text);
    border-radius: 10px
}

.form-control:disabled,
.form-control[readonly] {
    background: rgba(12, 19, 40, .85);
    border-color: #1f2a44;
    color: var(--text);
    opacity: 1;
}

.form-control:focus,
.form-select:focus {
    border-color: #335493;
    box-shadow: 0 0 0 .25rem rgba(110, 168, 254, .14)
}

.card-list .list-group-item:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, .06)
}

.offer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: .75rem;
}

.offer-cell {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
}

.offer-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(122, 162, 255, .12);
    border: 1px solid rgba(122, 162, 255, .25);
}

.offer-meta {
    min-width: 0;
}

.card-list .list-group-item:hover .chevron {
    transform: translateX(3px);
    opacity: .85;
}

/* Status pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    border: 1px solid var(--border);
}

.status-pill.st-draft {
    background: rgba(148, 163, 184, .12);
    color: #cbd5e1;
}

.status-pill.st-in_review {
    background: rgba(245, 158, 11, .14);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, .35);
}

.status-pill.st-sent {
    background: rgba(59, 130, 246, .14);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, .35);
}

.status-pill.st-accepted {
    background: rgba(34, 197, 94, .14);
    color: #86efac;
    border-color: rgba(34, 197, 94, .35);
}

.status-pill.st-rejected {
    background: rgba(239, 68, 68, .14);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, .35);
}

.status-pill.st-archived {
    background: rgba(100, 116, 139, .12);
    color: #cbd5e1;
}

/* Active highlight for selected offer & directory */
.card-list .list-group-item.active,
.dir-row.active {
    background: rgba(122, 162, 255, .12);
    border-color: rgba(122, 162, 255, .35);
    box-shadow: inset 0 0 0 1px rgba(122, 162, 255, .2);
}

.dir-row.active:hover {
    background: rgba(122, 162, 255, .16);
}

/* Skeleton */
.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, .06);
    border-radius: 10px
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent);
    animation: shimmer 1.1s infinite
}

@keyframes shimmer {
    100% {
        transform: translateX(100%)
    }
}

/* Save indicator */
.save-indicator {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .9rem
}

.save-indicator .dot {
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    background: #64748b;
    box-shadow: 0 0 0 0 rgba(100, 116, 139, .4);
    animation: pulseOff 2s infinite
}

.save-indicator.saving .dot {
    background: #f59e0b;
    animation: pulse 1.2s infinite
}

.save-indicator.saved .dot {
    background: #22c55e
}

.save-indicator.error .dot {
    background: #ef4444
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, .6)
    }

    70% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0)
    }

    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0)
    }
}

@keyframes pulseOff {
    0% {
        box-shadow: 0 0 0 0 rgba(100, 116, 139, .3)
    }

    70% {
        box-shadow: 0 0 0 6px rgba(100, 116, 139, 0)
    }

    100% {
        box-shadow: 0 0 0 0 rgba(100, 116, 139, 0)
    }
}

/* Animations */
.fade-in {
    animation: fadeIn .22s ease-out both
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

/* Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #2c3a60 transparent
}

::-webkit-scrollbar {
    height: 8px;
    width: 8px
}

::-webkit-scrollbar-thumb {
    background: #243357;
    border-radius: 8px
}

::-webkit-scrollbar-track {
    background: transparent
}

/* Admin Panel Styling */
#modalAdminUsers .modal-content {
    background: var(--panel-2);
    backdrop-filter: blur(12px);
}

#adminUsersList .list-group-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: .35rem;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .6rem .9rem;
}

#adminUsersList .list-group-item:hover {
    background: rgba(255, 255, 255, .05);
    transform: translateY(-1px);
}

#adminUsersList .role-badge {
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .15rem .6rem;
    font-size: .75rem;
    opacity: .85;
}

#modalAdminUsers .card {
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}


#adminUsersList .btn.btn-sm.btn-ghost.text-danger i {
    color: var(--danger);
}

/* Ensure confirm modal always appears on top */
#modalConfirm {
    z-index: 99999 !important;
}

#modalConfirm .modal-dialog {
    z-index: 99999 !important;
}

/* Roles & Rates table */
.roles-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 .5rem;
}

.roles-grid thead th {
    font-weight: 600;
    color: #cbd5e1;
    font-size: .9rem;
    padding: .35rem .75rem;
}

/* Roles & Rates table totals row */
.roles-grid tfoot td {
    padding: .6rem .75rem;
}

.roles-grid tfoot td:first-child {
    color: #dbeafe;
}

.roles-row {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.roles-row td {
    padding: .6rem .75rem;
    vertical-align: middle;
}

.roles-row input {
    text-align: right;
}

.roles-row input[data-f="role_name"] {
    text-align: left;
}

.roles-actions {
    display: flex;
    gap: .35rem;
    justify-content: flex-end;
}

/* Profit pill visibility */
.profit-pill {
    display: inline-block;
    min-width: 88px;
    text-align: right;
    padding: .35rem .5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .05);
    font-weight: 600;
}

.profit-pos {
    color: #86efac;
    border-color: rgba(34, 197, 94, .35);
    background: rgba(34, 197, 94, .12);
}

.profit-neg {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, .35);
    background: rgba(239, 68, 68, .12);
}

.profit-zero {
    color: #cbd5e1;
    background: rgba(148, 163, 184, .1);
}

/* WBS grid */
.wbs-grid input,
.wbs-grid select {
    min-width: 0;
}

.wbs-sticky {
    position: sticky;
    top: 70px;
    /* dopasuj do wysokości navbara */
    z-index: 50;
    border-radius: 0.75rem;
    border-color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    padding: 0.5rem 1rem;
    backdrop-filter: blur(6px);
}

.wbs-row.phase {
    background: rgba(122, 162, 255, .08);
}

.wbs-row.task {
    background: rgba(255, 255, 255, .04);
}

.wbs-row .handle {
    cursor: grab;
    opacity: .6;
}

/* === GANTT: viewport & bottom scrollbar (scroll only the timeline) === */
.gantt-surface {
    position: relative;
    height: 420px;
    /* stała wysokość: przewija się tylko wykres */
    max-width: 100%;
    overflow-x: auto;
}


/* --- Clauses: dark table/look --- */
.clauses-grid {
    background: transparent;
    border-color: var(--border);
}

.clauses-grid thead th {
    background: rgba(255, 255, 255, .06);
    color: #cbd5e1;
    border-color: var(--border) !important;
}

.clauses-grid td,
.clauses-grid th {
    border-color: var(--border) !important;
}

.clauses-grid tbody tr td {
    background: rgba(255, 255, 255, .02);
}

.clauses-grid .new-row td {
    background: rgba(255, 255, 255, .05);
}

.clauses-grid .form-control,
.clauses-grid .form-select,
.clauses-grid textarea {
    background: rgba(12, 19, 40, .9) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

/* Read-only clause bubble */
.clauses-grid .clause-text {
    display: block;
    padding: .55rem .75rem;
    color: var(--text);
    white-space: pre-wrap;
    font-size: .92rem;
    font-weight: 500;
    background: transparent !important;
    border: none !important;
}

/* Nowe założenie/wykluczenie – większe pole, rośnie z tekstem */
.clauses-grid textarea.clause-input {
    min-height: 60px;
    resize: none;
    overflow: hidden;
}

/* suggestions dropdown already defined; ensure sits above cards below */
.clauses-wrap {
    position: relative;
    z-index: 1;
}

/* === Clauses: suggestions dropdown === */
.clauses-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: rgba(13, 22, 44, .98);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 220px;
    overflow: auto;
    z-index: 9999;
    /* <- mocny stacking */
    pointer-events: auto;
    color: #fff;
    /* pewny kolor */
}

.clauses-suggest .item {
    padding: .45rem .6rem;
    font-size: .92rem;
    line-height: 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
    color: #fff;
}

.clauses-suggest .item:last-child {
    border-bottom: 0;
}

/* === Icons: normalize size, color and alignment (dark mode friendly) === */
.bi {
    vertical-align: -0.125em;
    /* lepsze wyrównanie z tekstem */
}

/* ikony w przyciskach dziedziczą kolor tekstu (primary/ghost/danger itd.) */
.btn i,
.row-actions .btn i {
    color: currentColor;
    opacity: .9;
    transition: opacity .15s;
    line-height: 1;
    pointer-events: none;
    /* nie łap klików wyłącznie na <i> */
}

/* hover/focus — pełna widoczność */
.btn:hover i,
.btn:focus i,
.row-actions .btn:hover i,
.row-actions .btn:focus i {
    opacity: 1;
}

/* mniejsze ikonki w .btn-sm, żeby były idealnie na środku */
.btn-sm i {
    font-size: .95rem;
}

/* kosz w ghost + text-danger zachowuje kontrast */
.btn-ghost.text-danger,
.btn-ghost .text-danger {
    color: var(--danger) !important;
}

.clauses-suggest .item:hover {
    background: rgba(122, 162, 255, .14);
}

/* żeby dropdown nie był obcinany przez wrapper tabeli */
.clauses-wrap .table-responsive {
    overflow: visible !important;
}


/* === Clauses: kompaktowe ikonki === */
.clauses-grid .row-actions .btn.btn-sm {
    padding: .15rem .4rem !important;
}

.clauses-grid .row-actions .btn i {
    font-size: .9rem !important;
}

.clauses-grid .handle {
    font-size: 1rem;
    opacity: .85;
}

.clauses-grid .handle:hover {
    opacity: 1;
}

.clauses-grid .bi-plus-lg {
    font-size: .9rem !important;
}

/* Ensure inputs inside clauses use white placeholders for consistency */
#assumNewText::placeholder,
#exclNewText::placeholder {
    color: rgba(255, 255, 255, .75) !important;
}

/* --- Clauses: drag & drop + visuals --- */
.clauses-grid .handle {
    color: #fff !important;
    cursor: grab;
    opacity: .9;
}

.clauses-grid tr.dragging {
    opacity: .6;
}

.clauses-grid tr.clause-row {
    user-select: none;
}

/* Suggestions hover highlight (ensure visible on dark) */
.clauses-suggest .item {
    color: #fff !important;
}

.clauses-suggest .item:hover {
    background: rgba(255, 255, 255, .10) !important;
}


/* --- Directory tree with collapsible offers --- */
.dir-tree .dir-item {
    padding: .4rem .5rem;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.dir-tree .dir-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    cursor: pointer;
    border-radius: 10px;
    padding: .45rem .55rem;
}

.dir-tree .dir-head:hover {
    background: rgba(255, 255, 255, .05);
}

.dir-tree .dir-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}

.dir-tree .dir-title .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dir-tree .chev {
    transition: transform .18s ease;
    opacity: .65;
}

.dir-tree .dir-item.open .chev {
    transform: rotate(90deg);
    opacity: .9;
}

.dir-tree .offers {
    margin: .25rem 0 .4rem 1.4rem;
    border-left: 1px dashed rgba(255, 255, 255, .12);
    padding-left: .7rem;
}

.dir-tree .offer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .35rem .45rem;
    border-radius: 8px;
    cursor: pointer;
}

.dir-tree .offer-row:hover {
    background: rgba(255, 255, 255, .06);
}

.dir-tree .offer-row.active {
    background: rgba(122, 162, 255, .14);
    border: 1px solid rgba(122, 162, 255, .35);
}

.dir-tree .offer-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Themed modal (global confirm) --- */
.modal .modal-content.card-surface {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
}

.modal .modal-header,
.modal .modal-footer {
    border-color: var(--border);
}

.modal .modal-title {
    color: var(--text);
}

.modal .modal-title .bi {
    color: var(--danger);
}

/* Spójne przyciski */
.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    filter: brightness(1.05);
}

/* === Licencje (warianty + pozycje) === */
.lic-table .table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.lic-table .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .03));
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
}

.lic-table .table thead th:first-child {
    border-top-left-radius: 10px;
}

.lic-table .table thead th:last-child {
    border-top-right-radius: 10px;
}

.lic-table .table tbody td,
.lic-table .table thead th,
.lic-table .table tfoot td {
    border-color: rgba(255, 255, 255, .06);
}

.lic-table .table tbody tr:hover {
    background: rgba(255, 255, 255, .05);
}

.lic-table .table tfoot td {
    background: rgba(255, 255, 255, .04);
    border-top: 1px solid var(--border);
}

.lic-table .table tfoot td.fw-bold {
    color: var(--accent);
}

.lic-table input.form-control-sm {
    height: 30px;
    padding: .25rem .5rem;
}

.lic-table .row-actions .btn {
    padding: .25rem .45rem;
    border-radius: 8px;
}

.lic-table .row-actions .btn:hover {
    transform: translateY(-1px);
}

.lic-table .new-row td {
    background: rgba(255, 255, 255, .02);
}

.lic-table .new-row .btn-primary {
    white-space: nowrap;
}

/* === Licencje === */
.lic-table .nav-pills .nav-link {
    padding: .25rem .6rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--border);
}

.lic-table .nav-pills .nav-link.active {
    color: #e5e7eb;
    background: rgba(255, 255, 255, .08);
}

.lic-table .table thead th,
.lic-table .table tfoot td {
    font-size: .88rem;
}

.lic-table .btn.btn-sm,
.lic-table .row-actions .btn {
    padding: .2rem .4rem;
    line-height: 1.05;
    border-radius: 8px;
}

.lic-table input.form-control-sm {
    height: 28px;
    padding: .2rem .45rem;
    font-size: .9rem;
}

.lic-table .table tbody tr:hover {
    background: rgba(255, 255, 255, .04);
}

.lic-table .gain {
    color: #86efac;
    font-weight: 700;
}

.lic-table .loss {
    color: #fca5a5;
    font-weight: 700;
}

.lic-summary-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.lic-summary-table th,
.lic-summary-table td {
    padding: .5rem .6rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.lic-summary-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .03));
}

/* === Licencje: ciemny styl tabeli i lepsze puste stany === */
.lic-grid-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
    overflow: hidden;
}

.lic-table .table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.lic-table .table thead th {
    color: #cbd5e1;
    background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04));
    border-bottom: 1px solid var(--border);
    padding: .5rem .6rem;
    white-space: nowrap;
}

.lic-table .table thead th:first-child {
    border-top-left-radius: 10px;
}

.lic-table .table thead th:last-child {
    border-top-right-radius: 10px;
}

.lic-table .table tbody td {
    background: rgba(255, 255, 255, .02);
    border-top: 1px solid rgba(255, 255, 255, .05);
    padding: .5rem .6rem;
}

.lic-table .table tbody tr:hover td {
    background: rgba(255, 255, 255, .04);
}

.lic-table .table tfoot td {
    background: rgba(255, 255, 255, .04);
    border-top: 1px solid var(--border);
    padding: .6rem .6rem;
}

/* Komórka pustego stanu – bez białej belki */
.lic-table .table tbody tr.empty-row td {
    background: transparent;
    border-top: 0;
    color: var(--muted);
    font-size: 1.05rem;
}


/* === Licencje: VARIANTY — czysty układ i spójne style === */

/* 1) Ikonki w nagłówku sekcji */
#btnAddVariant i,
#btnReloadLic i {
    font-size: 0.9rem;
    line-height: 1;
}

/* 6) Tabela licencji — jasny tekst i placeholdery na ciemnym tle */
.lic-table .form-control {
    color: #ffffff !important;
}

.lic-table .form-control::placeholder {
    color: #c7d2fe;
    opacity: .85;
}

.lic-table .btn.btn-sm i {
    font-size: 1.1rem;
    line-height: 1;
}

/* === Licencje: pełny wiersz "Dodaj pozycję" === */
.lic-table .new-row td {
    background: rgba(255, 255, 255, .03);
    border-top: 1px solid var(--border);
    padding: 0.75rem !important;
}

.lic-table .new-row .btn.w-100 {
    border-radius: 8px;
    font-size: 0.95rem;
    background: rgba(110, 168, 254, .15);
    border: 1px solid rgba(110, 168, 254, .35);
    color: #dbeafe;
    transition: all 0.15s ease;
}

.lic-table .new-row .btn.w-100:hover {
    background: rgba(122, 162, 255, .25);
    transform: translateY(-1px);
    color: #fff;
}

/* === Licencje: wymuś biały tekst w tabeli === */
.lic-table td,
.lic-table th {
    color: var(--text) !important;
}

.lic-table input.form-control,
.lic-table select.form-select {
    color: var(--text) !important;
    background: rgba(12, 19, 40, 0.85);
    border-color: #25345e;
}

/* Licencje – statystyki wariantu */
.lic-variant-stats .stat-chip {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: .4rem .6rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    min-width: 160px;
}

.lic-variant-stats .stat-chip .label {
    font-size: .75rem;
    color: #9fb2d1;
}

.lic-variant-stats .stat-chip .val {
    font-weight: 700;
    color: #e5efff;
}

/* === Poprawa kontrastu w statystykach wariantu (Licencje) === */
.lic-variant-stats {
    color: var(--text);
}

.lic-variant-stats .small,
.lic-variant-stats label {
    color: #e2e8f0 !important;
    /* lepsza widoczność dla opisów */
}

.lic-variant-stats #statPerCurrency {
    color: #dbeafe !important;
    /* wyróżnij listę walut */
}

.lic-variant-stats #ratesInfo {
    color: #a5b4fc !important;
    /* informacja o dacie NBP – lekko niebieskawa */
}

/* === Logowanie – jasne inputy i tekst === */
#loginForm input.form-control {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text) !important;
}

#loginForm input.form-control::placeholder {
    color: #b0b8c5;
}

#loginForm label.form-label {
    color: #cbd5e1 !important;
}

#loginForm .btn-primary {
    background-color: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* === Login panel polish === */
.login-card .form-label {
    color: #e2e8f0 !important;
}

.login-card input.form-control {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .25);
    color: #f8fafc !important;
}

.login-card input.form-control::placeholder {
    color: #b6c2d1;
}

.login-card .btn-primary {
    background-color: var(--brand);
    border-color: var(--brand);
}

.login-card .alert {
    background: rgba(239, 68, 68, .12);
    color: #fecaca;
    border-color: rgba(239, 68, 68, .35);
}

/* Modules grid readability + switches */
#modulesGrid .form-check-label strong {
    color: var(--text);
}

#modulesGrid .form-check-input {
    border-color: rgba(255, 255, 255, .5);
}

#modulesGrid .form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

/* === Moduły w ofercie – czytelność etykiet i opisów w dark mode === */
#modulesGrid .form-check-label .text-muted,
#modulesGrid .form-check-label .small {
    color: var(--text) !important;
    opacity: 0.9;
}

#modulesGrid .form-check:hover .form-check-label .small {
    opacity: 1;
}

/* ==== Sidebar DnD indicators for directories ==== */
.dir-row[draggable="true"] {
    cursor: grab;
}

.dir-row.dragging {
    opacity: .55;
    cursor: grabbing;
}

.dir-row.drop-forbidden {
    outline: 2px dashed rgba(239, 68, 68, .6);
    outline-offset: 2px;
}

.dir-row.drop-ok {
    background: rgba(34, 197, 94, .12);
    box-shadow: inset 0 0 0 2px rgba(34, 197, 94, .25);
}

.dir-row.drop-ok .title i,
.dir-row.drop-ok .title span {
    color: #eafff3;
}

.dir-drop-line {
    height: 0;
    border-top: 2px solid rgba(122, 162, 255, .9);
    margin: 2px 4px;
    border-radius: 2px;
}

.dir-drop-into {
    margin-left: 28px;
    color: #86efac;
    font-size: .8rem;
    opacity: .9;
}

/* === Services variants look = Licenses variants === */
#srvVariantsList .list-group-item {
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .6rem .75rem;
    transition: all .15s ease;
    position: relative;
}

#srvVariantsList .list-group-item:hover {
    background: rgba(122, 162, 255, .08);
    border-color: rgba(122, 162, 255, .3);
}

#srvVariantsList .list-group-item.active {
    background: rgba(122, 162, 255, .15);
    border-color: rgba(122, 162, 255, .35);
    box-shadow: 0 0 0 1px rgba(122, 162, 255, .3) inset;
}

#srvVariantsList .offer-icon {
    margin-left: 6px;
}

#srvVariantsList .offer-meta {
    flex: 1 1 auto;
    min-width: 0;
}

#srvVariantsList .offer-title {
    display: block;
    width: 100%;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#srvVariantsList .offer-sub {
    display: block;
    font-size: .8rem;
    color: #9fb2d1;
}

#srvVariantsList .actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

#srvVariantsList .list-group-item:hover .actions {
    opacity: 1;
    pointer-events: auto;
}

#srvVariantsList .actions .btn i {
    font-size: .9rem;
    line-height: 1;
}

/* === Services toolbar buttons smaller === */
#btnSrvAddVariant,
#btnSrvReload {
    font-size: 0.85rem !important;
    padding: 0.25rem 0.5rem !important;
    line-height: 1 !important;
    height: auto !important;
}

#btnSrvAddVariant i,
#btnSrvReload i {
    font-size: 0.95rem !important;
}

/* === Dark tables (force) === */
.table-darkish,
.table-darkish thead,
.table-darkish tbody,
.table-darkish tr,
.table-darkish td,
.table-darkish th {
    background-color: var(--panel-2) !important;
    color: var(--text) !important;
    border-color: rgba(255, 255, 255, .08) !important;
}

.table-darkish thead th {
    background: var(--panel) !important;
    font-weight: 600;
}

.table-darkish tbody tr:hover {
    background-color: rgba(255, 255, 255, .04) !important;
}

.table-darkish a {
    color: var(--text);
}

/* Inputs/selecty wewnątrz ciemnych tabelek */
.table-darkish .form-control,
.table-darkish .form-select {
    background: rgba(255, 255, 255, .08) !important;
    border: 1px solid rgba(255, 255, 255, .18) !important;
    color: var(--text) !important;
}

.table-darkish .form-control:focus,
.table-darkish .form-select:focus {
    background: rgba(255, 255, 255, .10) !important;
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 .15rem rgba(122, 162, 255, .25) !important;
    color: var(--text) !important;
}


/* === Clients table row selection === */
.table-darkish tbody tr {
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.table-darkish tbody tr:hover {
    background: rgba(255, 255, 255, .05);
}

.table-darkish tbody tr.selected {
    background: rgba(122, 162, 255, .25);
    border-left: 3px solid var(--brand);
}

.table-darkish th {
    padding: .6rem .75rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.table-darkish td {
    padding: .5rem .75rem;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    vertical-align: middle;
}

.table-darkish tbody tr:hover {
    background: rgba(255, 255, 255, .03);
}

.table-darkish tbody tr:last-child td {
    border-bottom: none;
}

/* Styl inputów w tabelkach (kontakty) */
.table-darkish input.form-control-sm {
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .15);
    color: var(--text);
    font-size: .85rem;
    padding: .25rem .4rem;
}

.table-darkish input.form-control-sm:focus {
    background: rgba(255, 255, 255, .1);
    border-color: var(--brand);
    box-shadow: 0 0 0 .1rem rgba(122, 162, 255, .25);
}

.table-darkish input.form-control-sm::placeholder {
    color: var(--muted);
}

/* Guzik dodaj kontakt */
.btn-add-contact {
    background: var(--brand);
    color: #fff;
    font-weight: 500;
    padding: .35rem .75rem;
    border: none;
    border-radius: 4px;
    transition: background .15s;
}

.btn-add-contact:hover {
    background: #89b1ff;
    color: #fff;
}

/* Guzik kosza */
.btn-ghost.text-danger {
    background: rgba(255, 0, 0, .05);
    border-radius: 4px;
}

.btn-ghost.text-danger:hover {
    background: rgba(255, 0, 0, .15);
}

/* === Clients modal (dark tidy form) === */
#modalClient .modal-content.card-surface {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}

#modalClient .modal-header,
#modalClient .modal-footer {
    border-color: var(--border);
}

#modalClient .form-label {
    color: #e8eeff;
    opacity: .9;
    font-weight: 500;
}

#modalClient .form-control {
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .15);
    color: var(--text);
}

#modalClient .form-control:focus {
    background: rgba(255, 255, 255, .10);
    border-color: var(--brand);
    box-shadow: 0 0 0 .15rem rgba(122, 162, 255, .25);
    color: var(--text);
}

#modalClient .form-control::placeholder {
    color: var(--muted);
}

/* Grid dla pól w modalu */
#modalClient .modal-body .grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem .75rem;
}

/* WBS Summary: zysk na zielono / czerwono */
.wbs-profit {
    font-weight: 600;
    color: #86efac;
    /* zielony jak w profit-pill */
}

.wbs-profit.neg {
    color: #fca5a5;
    /* czerwony jak w profit-neg */
}

.decision-banner {
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid transparent;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
}

.decision-banner.accepted {
    background-color: rgba(0, 255, 100, 0.08);
    border-color: rgba(0, 255, 100, 0.3);
    color: #bdf7cf;
}

.decision-banner {
    border-radius: var(--radius);
}

.decision-banner-accepted {
    background: rgba(34, 197, 94, .12);
    border: 1px solid rgba(34, 197, 94, .45);
    color: #bbf7d0;
}

.decision-banner-rejected {
    background: rgba(239, 68, 68, .12);
    border: 1px solid rgba(239, 68, 68, .45);
    color: #fecaca;
}


/* Global placeholder color for all inputs and textareas (force override) */
input::placeholder,
textarea::placeholder,
.form-control::placeholder {
    color: rgba(229, 231, 235, 0.65) !important;
    opacity: 1 !important;
}

/* For WebKit browsers */
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
    color: rgba(229, 231, 235, 0.65) !important;
    opacity: 1 !important;
}

/* For Firefox */
input::-moz-placeholder,
textarea::-moz-placeholder {
    color: rgba(229, 231, 235, 0.65) !important;
    opacity: 1 !important;
}

/* For Edge/IE */
input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
    color: rgba(229, 231, 235, 0.65) !important;
}

input::-ms-input-placeholder,
textarea::-ms-input-placeholder {
    color: rgba(229, 231, 235, 0.65) !important;
}

/* Założenia & Wykluczenia – hierarchia pod-punktów */
.clauses-grid .clause-col {
    padding-top: .35rem;
    padding-bottom: .35rem;
}

.clauses-grid .clause-col.clause-lvl-1 {
    padding-left: 1.5rem;
}

.clauses-grid .clause-col.clause-lvl-2 {
    padding-left: 3rem;
}

.clauses-grid .clause-prefix i {
    color: var(--muted);
    font-size: .85rem;
    margin-top: .15rem;
}

/* WBS variants list – wygląd jak warianty Licencji */
.wbs-variants-list {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.wbs-variant-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .45rem .7rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, .95);
    border: 1px solid rgba(148, 163, 184, .35);
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
}

.wbs-variant-card.active {
    background: rgba(37, 99, 235, .35);
    border-color: rgba(129, 140, 248, .9);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, .35);
}

.wbs-variant-main {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
}

.wbs-variant-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .9);
    border: 1px solid rgba(148, 163, 184, .45);
    flex: 0 0 26px;
}

.wbs-variant-icon i {
    font-size: .95rem;
    color: #e5e7eb;
}

.wbs-variant-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wbs-variant-title {
    font-size: .9rem;
    font-weight: 600;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wbs-variant-sub {
    font-size: .75rem;
    color: var(--muted);
}

.wbs-variant-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex: 0 0 auto;
}

/* --- Wspólne pigułki wariantów (Usługi, Licencje, Sprzęt, WBS) --- */
.btn-ghost {
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 12px;
    background-color: rgba(30, 41, 59, 0.6);
    color: #e2e8f0;
    padding: 6px 14px;
    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease,
        transform 0.12s ease;
}

.btn-ghost:hover {
    background-color: rgba(122, 162, 255, 0.15);
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.7);
    transform: translateY(-1px);
}

.btn-ghost.active {
    background: rgba(122, 162, 255, 0.25);
    color: #fff;
    border-color: rgba(122, 162, 255, 0.8);
    box-shadow: inset 0 0 0 1px rgba(122, 162, 255, 0.35);
}

/* Dla wewnętrznego układu pigułki */
.btn-ghost .d-flex.flex-column.text-start span:first-child {
    font-weight: 500;
}

.btn-ghost .small.muted {
    font-size: 0.8rem;
    color: #a3b2d3;
}

/* Klient vs Firma w widoku publicznym */
.client-company-card {
    position: relative;
    overflow: hidden;
}

.client-company-card .section-header .section-title {
    font-size: .7rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
}

.client-company-card .tiny-label {
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, .9);
}

.section-pill {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    font-size: .95rem;
    background: rgba(15, 23, 42, .9);
    border: 1px solid var(--border);
}

.section-pill-client {
    background: rgba(59, 130, 246, .18);
    border-color: rgba(59, 130, 246, .55);
    color: #bfdbfe;
}

.section-pill-company {
    background: rgba(34, 197, 94, .16);
    border-color: rgba(34, 197, 94, .5);
    color: #bbf7d0;
}

.client-company-separator {
    border-color: rgba(148, 163, 184, .25);
    opacity: .8;
}

/* Delikatne tło pod danymi firmy – żeby się odcinała od klienta */
.client-company-card .company-block {
    border-radius: 12px;
    padding: 12px 14px 10px;
    background: linear-gradient(90deg, rgba(15, 23, 42, .7), rgba(15, 23, 42, .3));
}

/* Avatar użytkownika (nagłówek / profil) */
.user-avatar-sm {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    object-fit: cover;
    margin-right: .35rem;
    flex-shrink: 0;
}

.profile-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.client-company-logo,
.logo-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: contain;
}

.logo-placeholder i {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.3);
}

.logo-box {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}

.wbs-diagram-host {
    min-height: 720px;
    border-radius: var(--radius);
    overflow: hidden;
}

.wbs-diagram-frame {
    width: 100%;
    min-height: 720px;
    border: 0;
    display: block;
}

/* -------------------------------------------------
   Dokumentacja & Notatki – nagłówki i typ-pillki
   ------------------------------------------------- */
.docs-section-heading {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.1rem;
}

/* Ramka typu (LINK / NOTATKA / PLIK) po lewej */
.docs-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle-color, rgba(255, 255, 255, 0.25));
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.docs-type-label {
    font-weight: 500;
}

/* Dokumentacja & Notatki – wyraźniejsze tytuły sekcji */
.docs-section-heading {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #e5edff;
    margin-bottom: 0.15rem;
}

.fin-card {
    background: rgba(15, 23, 42, .85);
    border-radius: var(--radius);
    padding: .75rem .9rem;
    border: 1px solid rgba(148, 163, 184, .35);
}

.fin-card .fin-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: .35rem;
}

.fin-card .fin-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.badge-soft {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .2rem .6rem;
    border: 1px solid rgba(148, 163, 184, .4);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    background: rgba(15, 23, 42, .85);
}

/* Teleportowany dropdown sidebar — jak w profilu */
.sidebar-dropdown {
    position: fixed;
    background: rgba(255, 255, 255, .98);
    color: #000;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 12px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, .35);
    padding: .35rem 0;
    z-index: 99999;
    min-width: 120px;
}

.sidebar-dropdown .dropdown-btn {
    width: 100%;
    background: transparent;
    border: 0;
    padding: .55rem .9rem;
    text-align: left;
    font-size: .9rem;
}

.sidebar-dropdown .dropdown-btn:hover {
    background: rgba(0, 0, 0, .06);
}

/* ===================== Unified variants pattern ===================== */
/* Kontenery list wariantów we wszystkich modułach */
#srvVariantsList,
#hwVariantsList,
#variantsList,
.wbs-variants-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding-bottom: .25rem;
    flex-direction: row;
    align-items: stretch;
}

/* Wspólny układ: 3 kafelki w rzędzie na desktopie, 2 na tablet, 1 na mobile */
#srvVariantsList .list-group-item,
#hwVariantsList .list-group-item,
#variantsList .list-group-item,
.wbs-variants-list .list-group-item {
    flex: 0 0 calc(33.333% - .5rem);
    /* 3 w rzędzie */
    max-width: calc(33.333% - .5rem);
}

/* Tablet: 2 w rzędzie */
@media (max-width: 992px) {

    #srvVariantsList .list-group-item,
    #hwVariantsList .list-group-item,
    #variantsList .list-group-item,
    .wbs-variants-list .list-group-item {
        flex: 0 0 calc(50% - .5rem);
        max-width: calc(50% - .5rem);
    }
}

/* Mobile: 1 w rzędzie */
@media (max-width: 576px) {

    #srvVariantsList .list-group-item,
    #hwVariantsList .list-group-item,
    #variantsList .list-group-item,
    .wbs-variants-list .list-group-item {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Pojedyncza karta wariantu */
#srvVariantsList .list-group-item,
#hwVariantsList .list-group-item,
#variantsList .list-group-item,
.wbs-variants-list .list-group-item {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 0;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.5rem;
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    flex: 1 1 240px;
    /* wąskie na małych ekranach, szerzej na większych */
}

/* Hover na karcie wariantu */
#srvVariantsList .list-group-item:hover,
#hwVariantsList .list-group-item:hover,
#variantsList .list-group-item:hover,
.wbs-variants-list .list-group-item:hover {
    transform: translateY(-1px);
    background: rgba(15, 23, 42, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* Aktywny wariant */
#srvVariantsList .list-group-item.active,
#hwVariantsList .list-group-item.active,
#variantsList .list-group-item.active,
.wbs-variants-list .list-group-item.active {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px rgba(122, 162, 255, 0.6), 0 16px 40px rgba(15, 23, 42, 0.9);
    background: radial-gradient(circle at 0 0, rgba(122, 162, 255, 0.28), rgba(15, 23, 42, 0.98));
}

/* Kolorowa listwa po lewej stronie aktywnego wariantu */
#srvVariantsList .list-group-item.active::before,
#hwVariantsList .list-group-item.active::before,
#variantsList .list-group-item.active::before,
.wbs-variants-list .list-group-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 999px;
}

/* Wspólne wnętrze karty – korzysta z istniejących klas offer-row / offer-meta */
#srvVariantsList .offer-row,
#hwVariantsList .offer-row,
#variantsList .offer-row,
.wbs-variants-list .offer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

#srvVariantsList .offer-cell,
#hwVariantsList .offer-cell,
#variantsList .offer-cell,
.wbs-variants-list .offer-cell {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    flex: 1 1 auto;
    min-width: 0;
}

#srvVariantsList .offer-icon,
#hwVariantsList .offer-icon,
#variantsList .offer-icon,
.wbs-variants-list .offer-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.4);
    flex-shrink: 0;
}

#srvVariantsList .offer-icon i,
#hwVariantsList .offer-icon i,
#variantsList .offer-icon i,
.wbs-variants-list .offer-icon i {
    font-size: 1rem;
    color: #c7d2fe;
}

/* Tytuł i opis wariantu */
#srvVariantsList .offer-title,
#hwVariantsList .offer-title,
#variantsList .offer-title,
.wbs-variants-list .offer-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

#srvVariantsList .offer-sub,
#hwVariantsList .offer-sub,
#variantsList .offer-sub,
.wbs-variants-list .offer-sub {
    font-size: 0.78rem;
    color: var(--muted);
}

/* Prawa strona – akcje (3 kropki, opcjonalna strzałka) */
#srvVariantsList .actions,
#hwVariantsList .actions,
#variantsList .actions,
.wbs-variants-list .actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

#srvVariantsList .list-group-item:hover .actions,
#hwVariantsList .list-group-item:hover .actions,
#variantsList .list-group-item:hover .actions,
.wbs-variants-list .list-group-item:hover .actions {
    opacity: 1;
    pointer-events: auto;
}

#srvVariantsList .actions .btn,
#hwVariantsList .actions .btn,
#variantsList .actions .btn,
.wbs-variants-list .actions .btn {
    padding-inline: 0.25rem;
}

#srvVariantsList .chevron,
#hwVariantsList .chevron,
#variantsList .chevron,
.wbs-variants-list .chevron {
    font-size: 0.9rem;
    color: rgba(148, 163, 184, 0.8);
}

.share-packages-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

/* pakiet = taka sama pastylka jak wariant usług,
   ale z ograniczoną szerokością i ustaloną wysokością */
.share-package-pill {
    border-color: rgba(148, 163, 184, .45);
    background: transparent;
    padding: 0.35rem 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 180px;
    max-width: 260px;
    min-height: 68px;
    flex: 0 0 auto;
    text-align: left;
}

.share-package-pill .share-package-pill-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-package-pill .share-package-pill-desc {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.1rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    /* max 2 linie opisu */
}

.share-package-pill .share-package-pill-badge {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.share-package-pill.active {
    border-color: var(--brand);
    background: rgba(37, 99, 235, .22);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .65);
}

.share-package-desc-full {
    max-width: 520px;
    white-space: pre-wrap;
    /* zachowuje entery */
}

.share-package-desc-full:empty {
    display: none;
    /* box znika, gdy nie ma opisu */
}

/* Pakiety wariantów – lista w zakładce Udostępnianie */
.share-pkg-row {
    background: rgba(15, 23, 42, .96);
    border-radius: 14px;
    border: 1px solid var(--border);
    margin-bottom: .5rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}

.share-pkg-title {
    font-weight: 600;
    color: #e5e7eb;
}

.share-pkg-badge {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
}

.share-pkg-desc {
    font-size: .8rem;
    color: var(--muted);
}

.share-pkg-variants {
    font-size: .75rem;
}

.share-pkg-pill {
    border-radius: 999px;
    padding: .15rem .6rem;
    background: rgba(15, 23, 42, .9);
    border: 1px solid rgba(148, 163, 184, .45);
}

/* Upewnij się, że przycisk z trzema kropkami wygląda jak w innych miejscach */
.share-pkg-row .btn-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Akcje (3 kropki) w wierszach pakietów – pokaż na hover, jak w innych listach */
.share-pkg-row .actions {
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

.share-pkg-row:hover .actions {
    opacity: 1;
    pointer-events: auto;
}