:root {
    --green: #D47A1F;
    --green-dark: #A95816;
    --dark: #212529;
    --muted: #6c757d;
    --bg: #F8F9FA;
    --panel: #ffffff;
    --border: #dfe4ea;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #0d6efd;
    --shadow: 0 18px 45px rgba(33, 37, 41, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--dark);
    background: var(--bg);
}

a { color: inherit; }

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(212, 122, 31, .18), transparent 30%),
        linear-gradient(135deg, #f8f9fa 0%, #edf3ef 100%);
}

.login-card {
    width: min(430px, 100%);
    background: var(--panel);
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.login-logo { width: 190px; height: auto; display: block; margin-bottom: 16px; }
.login-card h1 { margin: 0; font-size: 30px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; line-height: 1.45; }

.form-grid { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 650; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 13px;
    background: #fff;
    color: var(--dark);
    font: inherit;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 3px solid rgba(212, 122, 31, .18);
    border-color: var(--green);
}

.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 11px 18px;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    transition: .15s ease;
    background: #e8f4ff;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn:disabled { opacity: .65; cursor: wait; }
.btn-gus { min-height: 42px; padding-inline: 16px; white-space: nowrap; box-shadow: 0 8px 18px rgba(212, 122, 31, .18); }
.btn-outline { border-color: var(--border); color: var(--dark); }
.btn-outline:hover { border-color: var(--green); color: var(--green-dark); }
.btn-danger { color: var(--danger); border-color: rgba(220, 53, 69, .25); }
.btn-mini { min-height: 32px; padding: 7px 11px; font-size: 12px; }
.icon-button { border: 0; background: transparent; font-size: 24px; cursor: pointer; display: none; }

.alert {
    border-radius: 14px;
    padding: 12px 14px;
    margin: 16px 0;
    font-weight: 650;
}
.alert-error { background: #ffecef; color: #8a1020; border: 1px solid #ffc7d0; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 290px 1fr;
}

.sidebar {
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}
.brand { display: block; padding: 10px 8px 18px; }
.brand img { width: 190px; max-width: 100%; }

.main-nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.main-nav a, .nav-group summary {
    width: 100%;
    border-radius: 12px;
    padding: 10px 12px;
    text-decoration: none;
}
.main-nav a {
    color: #35404a;
    display: block;
    line-height: 1.22;
}
.main-nav a:hover, .main-nav a.active { background: rgba(212, 122, 31, .1); color: var(--green-dark); }
.main-nav a.disabled { opacity: .48; cursor: not-allowed; }
.nav-direct { font-weight: 800; }
.nav-group {
    border: 1px solid transparent;
    border-radius: 15px;
    overflow: hidden;
}
.nav-group[open] {
    background: rgba(248, 249, 250, .95);
    border-color: var(--border);
}
.nav-group summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    color: #35404a;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after {
    content: '›';
    flex: 0 0 auto;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    color: var(--muted);
    transition: transform .16s ease;
}
.nav-group[open] summary::after { transform: rotate(90deg); color: var(--green-dark); }
.nav-group summary:hover { background: rgba(212, 122, 31, .08); color: var(--green-dark); }
.nav-group-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 2px 6px 9px;
}
.nav-group-links a {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 8px 10px 8px 24px;
    font-size: 14px;
    white-space: normal;
}

.main-content { min-width: 0; }
.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: flex-end;
    padding: 14px 26px;
    background: rgba(248, 249, 250, .82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}
.userbox { display: grid; text-align: right; }
.userbox span { color: var(--muted); font-size: 13px; }
.content-area { padding: 28px; }

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 22px;
}
.page-head h1 { margin: 0 0 6px; font-size: clamp(28px, 3vw, 42px); }
.page-head p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.card, .panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card { padding: 20px; }
.card-kicker { color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.card strong { display: block; font-size: 42px; line-height: 1.1; margin: 7px 0; }
.card p { margin: 0; color: var(--muted); }
.panel { padding: 20px; margin-bottom: 18px; }
.panel h2 { margin-top: 0; }

.timeline { display: grid; gap: 10px; }
.timeline div { display: flex; gap: 12px; align-items: center; }
.timeline b {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(212, 122, 31, .12);
    color: var(--green-dark);
    display: inline-grid;
    place-items: center;
}

.table-wrap { overflow-x: auto; }
.table-search { max-width: 340px; margin-bottom: 14px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.data-table th { white-space: nowrap; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.data-table small { color: var(--muted); }
.table-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.contractor-actions {
    min-width: 172px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
}
.contractor-actions .btn-action {
    width: 100%;
    min-height: 36px;
    padding: 8px 11px;
    border-radius: 10px;
    justify-content: flex-start;
    font-size: 12.5px;
    line-height: 1.15;
    font-weight: 850;
    box-shadow: 0 4px 12px rgba(33, 37, 41, .08);
    white-space: nowrap;
}
.contractor-actions .btn-action::before {
    display: inline-grid;
    place-items: center;
    width: 19px;
    height: 19px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 900;
    background: rgba(255,255,255,.22);
    flex: 0 0 19px;
}
.btn-action-gus { background: var(--green); color: #fff; border-color: var(--green); }
.btn-action-gus::before { content: "↻"; }
.btn-action-gus:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-action-edit { background: var(--dark); color: #fff; border-color: var(--dark); }
.btn-action-edit::before { content: "✎"; }
.btn-action-edit:hover { background: #111820; border-color: #111820; }
.btn-action-delete { background: #fff1f2; color: #b42318; border-color: #f3b7bd; }
.btn-action-delete::before { content: "×"; background: rgba(180, 35, 24, .12); }
.btn-action-delete:hover { background: #dc3545; color: #fff; border-color: #dc3545; }
.btn-action-delete:hover::before { background: rgba(255,255,255,.25); }
.empty { text-align: center; color: var(--muted); padding: 36px !important; }
.row-cancelled { opacity: .68; text-decoration: line-through; }

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    background: #eef2f7;
    color: #44515d;
    white-space: nowrap;
}
.badge-ksef { background: rgba(13, 110, 253, .12); color: #0a58ca; }
.badge-nowa { background: rgba(255, 193, 7, .18); color: #8a6200; }
.badge-zadekretowana { background: rgba(13, 110, 253, .12); color: #0a58ca; }
.badge-przekazana-pracownikowi { background: rgba(212, 122, 31, .14); color: var(--green-dark); }
.badge-opisana { background: rgba(212, 122, 31, .2); color: var(--green-dark); }
.badge-wykreslona { background: rgba(220, 53, 69, .12); color: #a51d2a; }
.badge-anulowany { background: rgba(220, 53, 69, .12); color: #a51d2a; }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(33, 37, 41, .55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 20;
}
.modal.is-open { display: flex; }
.modal-card {
    width: min(560px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 22px;
    padding: 24px;
    position: relative;
    box-shadow: 0 25px 60px rgba(0,0,0,.22);
}
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: 0;
    background: #f1f3f5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
}
.form-message { margin: 0; font-weight: 700; }
.form-message.ok { color: var(--green-dark); }
.form-message.error { color: var(--danger); }
.hidden { display: none !important; }

code {
    background: #f1f3f5;
    border-radius: 7px;
    padding: 2px 6px;
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 30;
        width: 290px;
        transform: translateX(-105%);
        transition: .2s ease;
        box-shadow: var(--shadow);
    }
    .sidebar.is-open { transform: translateX(0); }
    .icon-button { display: inline-grid; place-items: center; }
    .topbar { justify-content: space-between; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-head { flex-direction: column; }
    .actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
    .content-area { padding: 18px; }
    .cards { grid-template-columns: 1fr; }
    .topbar { padding: 12px 16px; }
    .userbox { display: none; }
    .login-card { padding: 24px; }
}

@media print {
    .sidebar, .topbar, .actions, .btn, .table-search { display: none !important; }
    .app-shell { display: block; }
    .content-area { padding: 0; }
    .panel, .card { box-shadow: none; border-color: #999; }
}

/* Kontrahenci — MultiNIP / antyduplikat */
.monitor-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}
.monitor-head h2 { margin-bottom: 6px; }
.monitor-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 999px;
    padding: 9px 12px;
    font-weight: 750;
    white-space: nowrap;
}
.stat-pill b { color: var(--green-dark); }
.stat-pill.danger b { color: var(--danger); }
.monitor-details {
    border-top: 1px solid var(--border);
    margin-top: 14px;
    padding-top: 12px;
}
.monitor-details summary {
    cursor: pointer;
    font-weight: 850;
    color: var(--green-dark);
}
.monitor-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}
.monitor-item {
    background: rgba(212, 122, 31, .06);
    border: 1px solid rgba(212, 122, 31, .18);
    border-radius: 14px;
    padding: 12px;
}
.monitor-item.danger {
    background: rgba(220, 53, 69, .06);
    border-color: rgba(220, 53, 69, .18);
}
.monitor-item ul { margin: 8px 0 0; padding-left: 18px; }
.monitor-item li { margin: 4px 0; }
.badge-ok { background: rgba(212, 122, 31, .13); color: var(--green-dark); }
.badge-warning { background: rgba(255, 193, 7, .22); color: #7a5700; }
.badge-danger { background: rgba(220, 53, 69, .12); color: #a51d2a; }
.info-box {
    border: 1px solid rgba(13, 110, 253, .18);
    background: rgba(13, 110, 253, .06);
    border-radius: 14px;
    padding: 12px 14px;
    color: #24415f;
    line-height: 1.45;
}
.form-two-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.modal-card-wide { width: min(680px, 100%); }

@media (max-width: 760px) {
    .monitor-head { flex-direction: column; }
    .monitor-stats { justify-content: flex-start; }
    .form-two-cols { grid-template-columns: 1fr; }
}

.form-section-title {
    grid-column: 1 / -1;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-top: 2px;
}
.input-with-button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}
.input-with-button input { width: 100%; }
.contractor-company-fields { align-items: end; }
@media (max-width: 760px) {
    .input-with-button { grid-template-columns: 1fr; }
}

/* Kontrahenci — zwarta tabela + paginacja */
.compact-monitor {
    padding: 16px 18px;
}
.compact-monitor .monitor-head h2 {
    margin-bottom: 4px;
}
.compact-monitor .monitor-head p {
    margin: 0;
}
.contractor-table-panel {
    padding: 18px;
}
.contractor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}
.contractor-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 260px;
}
.contractor-search-input {
    max-width: 520px;
    margin: 0;
}
.btn-compact {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
}

.date-filter-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
    white-space: nowrap;
}
.date-filter-inline input[type="date"] {
    width: 155px;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 10px;
}
.per-page-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
    white-space: nowrap;
}
.per-page-control select {
    width: auto;
    min-width: 78px;
    padding: 8px 10px;
    border-radius: 10px;
}
.pagination-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
}
.contractors-table {
    table-layout: fixed;
    font-size: 13px;
}
.contractors-table th,
.contractors-table td {
    padding: 9px 10px;
    vertical-align: middle;
}
.contractors-table tbody tr:hover {
    background: rgba(212, 122, 31, .035);
}
.contractors-table th:nth-child(1) { width: 78px; }
.contractors-table th:nth-child(2) { width: 31%; }
.contractors-table th:nth-child(3) { width: 18%; }
.contractors-table th:nth-child(4) { width: 25%; }
.contractors-table th:nth-child(5) { width: 132px; }
.contractors-table th:nth-child(6) { width: 218px; }
.contractor-id-cell b,
.contractor-name-cell b {
    display: block;
    line-height: 1.25;
}
.contractor-id-cell small,
.contractor-name-cell small {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
}
.contractor-identifiers,
.contractor-address-cell {
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.contractor-monitor-cell .badge {
    padding: 4px 8px;
    font-size: 11.5px;
}
.contractors-table .contractor-actions {
    min-width: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 6px;
}
.contractors-table .contractor-actions .btn-action {
    width: 100%;
    min-height: 31px;
    padding: 7px 8px;
    border-radius: 9px;
    justify-content: center;
    font-size: 11.5px;
    line-height: 1;
    box-shadow: none;
}
.contractors-table .contractor-actions .btn-action::before {
    width: 16px;
    height: 16px;
    font-size: 11px;
    border-radius: 5px;
    flex-basis: 16px;
}
.contractors-table .contractor-actions .btn-action-edit:first-child,
.contractors-table .contractor-actions .btn-action-delete:nth-child(2) {
    grid-column: span 1;
}
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.pagination-info {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}
.pagination-pages {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}
.pagination-pages a,
.pagination-pages span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    text-decoration: none;
    color: var(--dark);
    font-size: 13px;
    font-weight: 800;
}
.pagination-pages a:hover {
    border-color: rgba(212, 122, 31, .45);
    background: rgba(212, 122, 31, .07);
}
.pagination-pages .active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}
.pagination-pages .disabled {
    opacity: .45;
    cursor: not-allowed;
}
.pagination-pages .ellipsis {
    border-color: transparent;
    background: transparent;
    min-width: auto;
}
@media (max-width: 1180px) {
    .contractors-table { min-width: 980px; }
}
@media (max-width: 760px) {
    .contractor-toolbar,
    .pagination-bar {
        align-items: stretch;
        flex-direction: column;
    }
    .contractor-search-box {
        min-width: 0;
    }
    .contractor-search-input {
        max-width: none;
    }
    .pagination-pages {
        justify-content: flex-start;
    }
}

/* VERTIS INFRA — Kontrahenci: tabela kompaktowa v2 */
.contractors-table th:nth-child(1) { width: 78px; }
.contractors-table th:nth-child(2) { width: 31%; }
.contractors-table th:nth-child(3) { width: 20%; }
.contractors-table th:nth-child(4) { width: auto; }
.contractors-table th:nth-child(5) { width: 258px; text-align: right; }
.contractors-table td:nth-child(5) { text-align: right; }
.contractor-name-cell b {
    margin-bottom: 1px;
}
.contractor-inline-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.contractor-inline-badges .badge {
    padding: 3px 8px;
    font-size: 11.5px;
}
.contractors-table .contractor-actions {
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: nowrap;
}
.contractors-table .contractor-actions .btn-action {
    width: auto;
    min-width: 74px;
    min-height: 34px;
    padding: 8px 11px;
    border-radius: 10px;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    box-shadow: none;
    white-space: nowrap;
}
.contractors-table .contractor-actions .btn-action-gus {
    min-width: 64px;
}
.contractors-table .contractor-actions .btn-action-edit {
    min-width: 78px;
}
.contractors-table .contractor-actions .btn-action-delete {
    min-width: 72px;
}
.pagination-bar.pagination-top {
    margin: 4px 0 10px;
    padding: 0 0 10px;
    border-top: 0;
    border-bottom: 1px solid var(--border);
}
.pagination-bar.pagination-bottom {
    margin-top: 12px;
}
@media (max-width: 1180px) {
    .contractors-table { min-width: 1040px; }
}

/* VERTIS INFRA — Kontrahenci: kompakt v3 + raport w modalu */
.compact-monitor {
    padding: 13px 16px;
    margin-bottom: 12px;
}
.compact-monitor .monitor-head {
    align-items: center;
}
.compact-monitor .monitor-head h2 {
    font-size: 17px;
    margin: 0 0 2px;
}
.compact-monitor .monitor-head p {
    font-size: 13px;
}
.stat-pill-button {
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: .15s ease;
}
.stat-pill-button:hover {
    border-color: rgba(212, 122, 31, .42);
    background: rgba(212, 122, 31, .07);
    transform: translateY(-1px);
}
.stat-pill-button.danger:hover {
    border-color: rgba(220, 53, 69, .35);
    background: rgba(220, 53, 69, .06);
}
.contractor-table-panel {
    padding: 14px 16px;
}
.contractor-toolbar {
    margin-bottom: 8px;
}
.pagination-topline {
    margin-bottom: 8px;
}
.contractors-table {
    table-layout: fixed;
    font-size: 12.8px;
}
.contractors-table th,
.contractors-table td {
    padding: 7px 9px !important;
    vertical-align: middle;
}
.contractors-table th:nth-child(1) { width: 76px; }
.contractors-table th:nth-child(2) { width: 35%; }
.contractors-table th:nth-child(3) { width: 21%; }
.contractors-table th:nth-child(4) { width: auto; }
.contractors-table th:nth-child(5) { width: 252px; text-align: right; }
.contractors-table td:nth-child(5) { text-align: right; }
.contractor-id-cell b {
    font-size: 13px;
    line-height: 1.1;
}
.contractor-id-cell small {
    margin-top: 1px;
    font-size: 11px;
    line-height: 1.1;
}
.contractor-name-cell b {
    display: inline;
    margin: 0;
    line-height: 1.15;
}
.contractor-name-cell small {
    display: block;
    margin-top: 1px;
    font-size: 11px;
    line-height: 1.15;
}
.contractor-name-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    line-height: 1.15;
}
.contractor-name-line .badge {
    padding: 2px 7px;
    font-size: 10.8px;
    line-height: 1.2;
}
.badge-button {
    border: 0;
    cursor: pointer;
    font-family: inherit;
}
.badge-button:hover {
    filter: brightness(.97);
    box-shadow: 0 0 0 2px rgba(212, 122, 31, .08);
}
.contractor-identifiers,
.contractor-address-cell {
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.contractor-actions-cell {
    text-align: right;
    white-space: nowrap;
}
.contractor-action-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
    width: 100%;
}
.contractor-action-row .btn-action {
    width: auto;
    min-height: 30px;
    padding: 6px 9px;
    border-radius: 9px;
    justify-content: center;
    font-size: 11.5px;
    line-height: 1;
    box-shadow: none;
    white-space: nowrap;
}
.contractor-action-row .btn-action::before {
    width: 15px;
    height: 15px;
    font-size: 10px;
    border-radius: 5px;
    flex-basis: 15px;
}
.contractor-action-row .btn-action-gus { min-width: 58px; }
.contractor-action-row .btn-action-edit { min-width: 70px; }
.contractor-action-row .btn-action-delete { min-width: 66px; }
.pagination-bar.pagination-top {
    margin: 2px 0 8px;
    padding: 0 0 8px;
}
.pagination-bar.pagination-bottom {
    margin-top: 8px;
    padding-top: 8px;
}
.pagination-pages a,
.pagination-pages span {
    min-height: 31px;
    min-width: 31px;
    padding: 6px 9px;
}
.modal-card-monitoring {
    width: min(920px, 100%);
}
.monitor-modal-section {
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding-top: 14px;
}
.monitor-modal-section h3 {
    margin: 0 0 10px;
    font-size: 16px;
}
.monitor-report-list {
    display: grid;
    gap: 10px;
}
.monitor-report-item {
    border: 1px solid rgba(212, 122, 31, .18);
    background: rgba(212, 122, 31, .045);
    border-radius: 14px;
    padding: 11px 12px;
}
.monitor-report-item.danger {
    border-color: rgba(220, 53, 69, .18);
    background: rgba(220, 53, 69, .045);
}
.monitor-report-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
}
.monitor-report-item p {
    margin: 4px 0 0;
}
.monitor-report-item ul {
    margin: 8px 0 0;
    padding-left: 18px;
}
.monitor-report-item li {
    margin: 3px 0;
    line-height: 1.3;
}
.empty-inline {
    color: var(--muted);
    margin: 0;
}
.monitor-limit-note {
    margin-top: 14px;
}
@media (max-width: 1180px) {
    .contractors-table { min-width: 1060px; }
}
.stat-pill-button,
.badge-button {
    text-decoration: none;
}


/* VERTIS INFRA — poprawka kontrolek: GUS bez zmiany etykiety, X w modalu i Usuń */
.btn[aria-busy="true"] {
    cursor: wait;
    opacity: .72;
}

.modal-close,
a.modal-close,
button.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    padding: 0 !important;
    border: 0;
    border-radius: 999px;
    background: #f1f3f5;
    color: #212529;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    line-height: 1;
    font-size: 0;
    font-weight: 900;
    cursor: pointer;
    box-shadow: none;
}
.modal-close::before,
a.modal-close::before,
button.modal-close::before {
    content: "×";
    display: block;
    font-size: 26px;
    line-height: 1;
    transform: translateY(-1px);
}
.modal-close:hover,
a.modal-close:hover,
button.modal-close:hover {
    background: #e9ecef;
    color: #111820;
}

.contractor-action-row .btn-action-delete::before,
.contractors-table .contractor-actions .btn-action-delete::before,
.btn-action-delete::before {
    content: "✕";
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    background: transparent !important;
    font-size: 11px;
    line-height: 1;
    font-weight: 900;
}
.contractor-action-row .btn-action-delete {
    gap: 5px;
}
.contractor-action-row .btn-action-gus[aria-busy="true"] {
    min-width: 58px;
}
.btn-gus[aria-busy="true"]::after {
    content: "";
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: vertis-spin .65s linear infinite;
}
@keyframes vertis-spin {
    to { transform: rotate(360deg); }
}

/* Faktury — czytelne filtry i kwota jako jedna wartość */
.invoice-table-panel {
    padding: 18px;
}
.invoice-filter-box {
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}
.invoice-search-input {
    min-width: 280px;
    flex: 1 1 320px;
    max-width: 420px;
}
.invoice-worker-input {
    min-width: 220px;
    flex: 0 1 280px;
    max-width: 320px;
}
.invoice-filter-box .date-filter-inline {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
}
.invoice-filter-box .date-filter-inline input[type="date"] {
    width: 155px;
}
.invoice-table-panel .data-table th:nth-child(1) { width: 64px; }
.invoice-table-panel .data-table th:nth-child(2) { width: 116px; }
.invoice-table-panel .data-table th:nth-child(3) { width: 145px; }
.invoice-table-panel .data-table th:nth-child(4) { width: 116px; }
.invoice-table-panel .data-table th:nth-child(7),
.invoice-table-panel .data-table td:nth-child(7) {
    text-align: right;
    white-space: nowrap;
}
@media (max-width: 980px) {
    .invoice-filter-box,
    .invoice-filter-box .date-filter-inline {
        align-items: stretch;
    }
    .invoice-search-input,
    .invoice-worker-input,
    .invoice-filter-box .date-filter-inline input[type="date"] {
        width: 100%;
        max-width: none;
    }
}

/* Faktury — rejestr urzędowy, czysty widok i podgląd kliknięciem */
.invoice-toolbar {
    align-items: flex-start;
}
.invoice-bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 14px;
    padding: 10px 12px;
    margin: 8px 0 12px;
}
.invoice-bulk-info {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-right: 4px;
}
.invoice-bulk-info b {
    color: var(--green-dark);
}
.btn-danger-soft {
    color: #a51d2a;
    border-color: rgba(220, 53, 69, .26);
    background: rgba(220, 53, 69, .04);
}
.invoices-table {
    table-layout: fixed;
    font-size: 13px;
}
.invoices-table th,
.invoices-table td {
    padding: 10px 9px;
    vertical-align: middle;
}
.invoices-table tbody tr.invoice-row {
    cursor: pointer;
    transition: background .12s ease, box-shadow .12s ease;
}
.invoices-table tbody tr.invoice-row:hover {
    background: rgba(212, 122, 31, .045);
}
.invoices-table tbody tr.invoice-row:focus {
    outline: 2px solid rgba(212, 122, 31, .35);
    outline-offset: -2px;
}
.invoices-table .check-cell {
    width: 42px;
    text-align: center;
}
.invoices-table .check-cell input {
    width: 17px;
    height: 17px;
    cursor: pointer;
}
.invoices-table th:nth-child(2) { width: 54px; }
.invoices-table th:nth-child(3) { width: 118px; }
.invoices-table th:nth-child(4) { width: 138px; }
.invoices-table th:nth-child(5) { width: 118px; }
.invoices-table th:nth-child(6) { width: 190px; }
.invoices-table th:nth-child(7) { width: 30%; }
.invoices-table th:nth-child(8),
.invoices-table td:nth-child(8) {
    width: 126px;
    text-align: right;
    white-space: nowrap;
}
.invoices-table th:nth-child(9) { width: 160px; }
.lp-cell {
    font-weight: 900;
    color: var(--dark);
}
.registry-cell b,
.date-cell b,
.document-cell b,
.contractor-cell b,
.status-cell b {
    display: block;
    line-height: 1.25;
}
.registry-cell small,
.date-cell small,
.document-cell small,
.contractor-cell small,
.status-cell small {
    display: block;
    margin-top: 3px;
    font-size: 11.5px;
    line-height: 1.25;
}
.registry-cell small {
    color: #6f7a85;
    font-weight: 800;
}
.doc-type-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 999px;
    padding: 3px 8px;
    margin: 0 0 5px;
    background: rgba(212, 122, 31, .1);
    color: var(--green-dark);
    font-size: 11.5px;
    line-height: 1;
    font-weight: 900;
    white-space: nowrap;
}
.contractor-cell {
    overflow-wrap: anywhere;
}
.amount-cell b {
    font-size: 14px;
    color: #111820;
}
.status-cell .badge {
    margin-bottom: 3px;
}
.row-cancelled td {
    opacity: .72;
}
.row-cancelled .registry-cell b,
.row-cancelled .document-cell b,
.row-cancelled .contractor-cell b {
    text-decoration: line-through;
}
.invoice-preview-card {
    width: min(760px, 100%);
}
.invoice-preview-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 16px;
}
.invoice-preview-head h2 {
    margin: 0;
}
.invoice-preview-head .muted {
    margin: 4px 0 0;
}
.invoice-preview-amount {
    flex: 0 0 auto;
    border: 1px solid rgba(212, 122, 31, .18);
    background: rgba(212, 122, 31, .07);
    color: #0f6a2a;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 18px;
    font-weight: 950;
    white-space: nowrap;
}
.invoice-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.invoice-preview-grid div,
.invoice-preview-contractor {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 14px;
    padding: 11px 12px;
}
.invoice-preview-grid span,
.invoice-preview-contractor span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 7px;
}
.invoice-preview-grid b,
.invoice-preview-contractor b {
    display: block;
    overflow-wrap: anywhere;
}
.invoice-preview-contractor {
    margin-top: 10px;
}
.invoice-preview-contractor p {
    margin: 5px 0;
    color: #495057;
}
.invoice-preview-contractor small {
    color: var(--muted);
    font-weight: 750;
}
@media (max-width: 980px) {
    .invoice-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .invoice-preview-head {
        flex-direction: column;
    }
    .invoice-preview-amount {
        width: 100%;
        text-align: center;
    }
    .invoice-preview-grid {
        grid-template-columns: 1fr;
    }
}

/* Faktury — dopięcie UI po uruchomieniu akcji */
.invoices-table {
    min-width: 1220px;
}
.invoices-table th,
.invoices-table td {
    white-space: normal;
    overflow: hidden;
}
.invoices-table th {
    line-height: 1.15;
}
.invoices-table td:nth-child(5),
.invoices-table td:nth-child(6),
.invoices-table td:nth-child(7),
.invoices-table td:nth-child(9) {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.invoices-table .contractor-cell b,
.invoices-table .document-cell b,
.invoices-table .status-cell small {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.invoices-table .status-cell .badge {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    justify-content: center;
    line-height: 1.15;
}
.invoices-table th:nth-child(1) { width: 42px; }
.invoices-table th:nth-child(2) { width: 54px; }
.invoices-table th:nth-child(3) { width: 116px; }
.invoices-table th:nth-child(4) { width: 130px; }
.invoices-table th:nth-child(5) { width: 112px; }
.invoices-table th:nth-child(6) { width: 185px; }
.invoices-table th:nth-child(7) { width: auto; }
.invoices-table th:nth-child(8),
.invoices-table td:nth-child(8) {
    width: 128px;
    min-width: 128px;
    text-align: right;
    white-space: nowrap;
}
.invoices-table th:nth-child(9) {
    width: 145px;
}
.invoice-preview-card {
    position: relative;
    padding-top: 28px;
}
.invoice-preview-card .modal-close {
    top: 14px;
    right: 14px;
    z-index: 4;
}
.invoice-preview-head {
    padding-right: 48px;
}
.invoice-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.invoice-preview-actions .btn[disabled],
.invoice-bulk-toolbar .btn[disabled] {
    opacity: .42;
    cursor: not-allowed;
}
.invoice-action-card {
    width: min(520px, 100%);
}
.modal-action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
@media (max-width: 980px) {
    .invoice-preview-head {
        padding-right: 0;
    }
    .invoice-preview-card {
        padding-top: 54px;
    }
}


/* Faktury — poprawki 2026-07-04: węższe L.P., szerszy status, stabilna tabela */
.invoices-table .lp-header,
.invoices-table .lp-cell {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    text-align: center;
    padding-left: 5px;
    padding-right: 5px;
}
.invoices-table .check-cell {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
}
.invoices-table th:nth-child(2) {
    width: 36px !important;
}
.invoices-table th:nth-child(9),
.invoices-table td:nth-child(9) {
    width: 178px !important;
    min-width: 178px !important;
}
.invoices-table .status-cell .badge {
    width: 100%;
}
.invoice-preview-actions [data-invoice-edit-placeholder] {
    margin-right: auto;
}
@media (max-width: 980px) {
    .invoice-preview-actions [data-invoice-edit-placeholder] {
        margin-right: 0;
    }
}

/* Faktury — formularz ręczny i KSeF */
.contractor-picker {
    border: 1px solid #d8dee6;
    border-radius: 12px;
    background: #fff;
    margin-top: 6px;
    max-height: 240px;
    overflow: auto;
    box-shadow: 0 12px 30px rgba(33, 37, 41, 0.10);
}
.picker-item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid #eef1f4;
    background: #fff;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
}
.picker-item:hover,
.picker-item:focus {
    background: #f3fbf5;
    outline: none;
}
.picker-item b,
.picker-item small {
    display: block;
}
.picker-item small {
    color: #65717d;
    margin-top: 3px;
    line-height: 1.35;
}
.picker-empty {
    padding: 12px;
    color: #65717d;
}
.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 8px 0;
}
.checkbox-grid label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}
.ksef-card {
    width: min(1180px, calc(100vw - 40px));
}
.ksef-results {
    margin-top: 18px;
    border-top: 1px solid #e3e8ef;
    padding-top: 14px;
}
.ksef-results-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}
.ksef-table-scroll {
    max-height: 420px;
    overflow: auto;
    border: 1px solid #e3e8ef;
    border-radius: 14px;
}
.ksef-import-table {
    min-width: 1050px;
}
.ksef-import-table th,
.ksef-import-table td {
    vertical-align: top;
    white-space: normal;
}

.invoice-contractor-line {
    display: flex;
    gap: 8px;
    align-items: center;
}

.invoice-contractor-line input {
    flex: 1 1 auto;
    min-width: 0;
}

.compact-info {
    margin: 8px 0 12px;
    padding: 10px 12px;
}

.picker-empty-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}

.picker-empty-actions .btn {
    align-self: flex-start;
}

/* VERTIS INFRA — globalna zasada modali: bez zamykania kliknięciem w tło + poprawne piętrowanie */
.modal.is-open {
    pointer-events: auto;
}
.modal .modal-card {
    pointer-events: auto;
}
#contractorModal.is-open {
    /* kontrahent może być otwierany z faktury, więc musi wejść nad modal faktury */
    z-index: 60;
}
.disabled-action-tip {
    display: inline-flex;
}
.disabled-action-tip .btn[disabled] {
    pointer-events: none;
}

/* Faktury — historia i czytelny antyduplikat */
.invoice-preview-history {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}
.invoice-preview-history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
}
.invoice-preview-history-head span {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.invoice-audit-list {
    max-height: 260px;
    overflow: auto;
    padding: 10px 12px;
}
.invoice-audit-empty {
    color: var(--muted);
    font-weight: 750;
    padding: 8px 0;
}
.invoice-audit-empty.error { color: var(--danger); }
.invoice-audit-item {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #eef0f2;
}
.invoice-audit-item:last-child { border-bottom: 0; }
.invoice-audit-meta b,
.invoice-audit-meta span {
    display: block;
    overflow-wrap: anywhere;
}
.invoice-audit-meta b { font-size: 12px; }
.invoice-audit-meta span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.invoice-audit-main strong { display: block; }
.invoice-audit-main p { margin: 3px 0 0; color: #495057; }
.invoice-audit-main details { margin-top: 7px; }
.invoice-audit-main summary { cursor: pointer; font-weight: 800; color: var(--muted); }
.invoice-audit-main pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    font-size: 11px;
    margin: 5px 0 0;
}
.invoice-action-card textarea,
.duplicate-warning-card textarea {
    min-height: 88px;
}
.duplicate-warning-card h2 { margin-bottom: 6px; }
.duplicate-list {
    display: grid;
    gap: 8px;
    max-height: 280px;
    overflow: auto;
    margin: 12px 0;
}
.duplicate-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 11px 12px;
}
.duplicate-item b,
.duplicate-item small { display: block; overflow-wrap: anywhere; }
.duplicate-item small { color: var(--muted); margin-top: 3px; font-weight: 800; }
.duplicate-item p { margin: 7px 0 0; color: #495057; }
.duplicate-actions { margin-top: 8px; }
@media (max-width: 700px) {
    .invoice-audit-item { grid-template-columns: 1fr; }
}

/* Faktury — opisy, Moje faktury i uproszczona historia */
.invoice-description-row td {
    background: #fbfcfd;
    border-top: 0;
    padding-top: 0;
    color: #5b6470;
    font-size: 12px;
    font-style: italic;
    line-height: 1.45;
}
.invoice-description-row span {
    font-weight: 900;
    color: var(--muted);
    font-style: normal;
    margin-right: 4px;
}
.invoice-preview-description {
    margin-top: 10px;
    border: 1px solid var(--border);
    background: #fbfcfd;
    border-radius: 14px;
    padding: 11px 12px;
}
.invoice-preview-description span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 7px;
}
.invoice-preview-description p {
    margin: 0;
    color: #343a40;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-style: italic;
}
.invoice-manager-actions,
.invoice-worker-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.invoice-manager-actions.hidden,
.invoice-worker-actions.hidden {
    display: none !important;
}
.invoice-description-card textarea {
    min-height: 180px;
}
.invoice-audit-item-simple .invoice-audit-main p {
    margin-top: 4px;
}
.duplicate-meta {
    display: grid;
    gap: 3px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #d8dee6;
}
.duplicate-meta span {
    display: block;
    color: #495057;
    font-size: 12px;
    font-weight: 800;
}
.invoices-table-no-check th:nth-child(1) { width: 36px !important; }
.invoices-table-no-check th:nth-child(2) { width: 116px !important; }
.invoices-table-no-check th:nth-child(3) { width: 130px !important; }
.invoices-table-no-check th:nth-child(4) { width: 112px !important; }
.invoices-table-no-check th:nth-child(5) { width: 185px !important; }
.invoices-table-no-check th:nth-child(6) { width: auto !important; }
.invoices-table-no-check th:nth-child(7),
.invoices-table-no-check td:nth-child(7) {
    width: 128px !important;
    min-width: 128px !important;
    text-align: right;
    white-space: nowrap;
}
.invoices-table-no-check th:nth-child(8),
.invoices-table-no-check td:nth-child(8) {
    width: 178px !important;
    min-width: 178px !important;
}

/* Faktury — doprecyzowanie widoku Moje faktury i raporty */
.invoices-table tr.invoice-row-has-description td {
    border-bottom: 0 !important;
    padding-bottom: 4px;
}
.invoices-table tr.invoice-description-row td {
    border-top: 0 !important;
    border-bottom: 1px solid var(--border);
    padding: 0 9px 11px 9px;
    background: #fff;
}
.invoices-table tr.invoice-description-row:hover td {
    background: #fff;
}
.report-cards {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: 18px;
    align-items: start;
}
.report-card h2 {
    margin-top: 0;
}
.report-filter-form .form-two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-print-page {
    background: #fff;
    color: #111820;
    padding: 18px;
}
.report-print-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin: 0 0 14px;
}
.report-shell-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.report-shell-table > thead { display: table-header-group; }
.report-shell-table > tfoot { display: table-footer-group; }
.report-shell-table > thead > tr > td,
.report-shell-table > tbody > tr > td,
.report-shell-table > tfoot > tr > td {
    border: 0;
    padding: 0;
}
.report-shell-table > tbody > tr > td {
    vertical-align: top;
}
.report-print-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 2px solid #212529;
    padding: 0 0 6px;
    margin: 0 0 7px;
}
.report-print-header h1 {
    margin: 0 0 3px;
    font-size: 18px;
    line-height: 1.1;
}
.report-print-header p {
    margin: 0;
    font-size: 9.5px;
    color: #495057;
    line-height: 1.18;
}
.report-print-header img {
    max-width: 96px;
    max-height: 36px;
    object-fit: contain;
}
.report-print-footer {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 12px;
    align-items: center;
    border-top: 1px solid #212529;
    padding: 5px 0 0;
    margin: 8px 0 0;
    font-size: 8.5px;
    line-height: 1.15;
    color: #343a40;
}
.report-print-footer > div:nth-child(2) {
    text-align: center;
    font-weight: 700;
}
.report-print-footer > div:nth-child(3) {
    text-align: right;
}
.report-print-footer img {
    max-width: 72px;
    max-height: 22px;
    object-fit: contain;
    margin-top: 2px;
}
.report-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.1px;
    line-height: 1.12;
    table-layout: fixed;
}
.report-data-table th,
.report-data-table td {
    border: 1px solid #9aa4af;
    padding: 2.6px 3.4px;
    vertical-align: top;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    white-space: normal;
}
.report-data-table th {
    background: #e6edf1;
    text-transform: uppercase;
    font-size: 7.1px;
    line-height: 1.0;
    letter-spacing: 0;
}
.report-data-table small {
    color: #4c5661;
}
.report-data-table tr,
.report-data-table td,
.report-data-table th {
    page-break-inside: avoid;
    break-inside: avoid;
}
.report-data-table .amount-cell-print {
    white-space: nowrap;
    text-align: right;
    font-weight: 800;
}
.report-daily-table {
    font-size: 7.7px;
    line-height: 1.06;
}
.report-daily-table th,
.report-daily-table td {
    padding: 1.9px 2.5px;
}
.report-daily-table .daily-document-cell div {
    margin: 0;
}
.report-daily-table .muted-print {
    color: #4c5661;
    font-weight: 400;
}
.report-daily-table .assigned-center-cell {
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
}
.report-daily-table .signature-cell {
    height: 18px;
    min-width: 142px;
}

.report-invoice-table {
    font-size: 7.55px;
    line-height: 1.05;
}
.report-invoice-table th,
.report-invoice-table td {
    padding: 1.9px 2.5px;
}
.report-invoice-table th {
    font-size: 6.25px;
    line-height: .98;
    background: #e3eaee;
}

.report-invoice-table th:nth-child(1) { width: 28px; }
.report-invoice-table th:nth-child(2) { width: 64px; }
.report-invoice-table th:nth-child(3),
.report-invoice-table th:nth-child(4) { width: 66px; }
.report-invoice-table th:nth-child(7) { width: 78px; }
.report-invoice-table th:nth-child(8) { width: 78px; }
.report-invoice-table th:nth-child(9),
.report-invoice-table th:nth-child(10) { width: 88px; }
.report-daily-table th:nth-child(1) { width: 28px; }
.report-daily-table th:nth-child(2) { width: 68px; }
.report-daily-table th:nth-child(3),
.report-daily-table th:nth-child(4) { width: 68px; }
.report-daily-table th:nth-child(6) { width: 110px; }
.report-daily-table th:nth-child(7) { width: 165px; }
.report-daily-table th {
    font-size: 6.25px;
    line-height: .98;
    background: #e3eaee;
    padding-top: 1.8px;
    padding-bottom: 1.8px;
}
.report-manual-page-body {
    background: #f5f7f8;
}
.report-page {
    box-sizing: border-box;
    width: 100%;
    min-height: 190mm;
    background: #fff;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0 auto 18px;
}
.report-page-content {
    flex: 1 1 auto;
    min-height: 0;
}
.report-page-footer {
    flex: 0 0 auto;
    margin-top: auto;
}
.report-page + .report-page {
    page-break-before: always;
    break-before: page;
}

@media (max-width: 1100px) {
    .report-cards { grid-template-columns: 1fr; }
}

@media print {
    @page vertisRegistryLandscape { size: A4 landscape; margin: 10mm; }
    html,
    body.report-print-page {
        min-height: 190mm;
    }
    body.report-print-page {
        padding: 0;
        background: #fff;
    }
    .report-shell-table {
        min-height: 190mm;
        height: 190mm;
    }
    .report-shell-table > tbody > tr > td {
        height: 100%;
        vertical-align: top;
    }
    .report-print-header {
        padding-bottom: 5px;
        margin-bottom: 5px;
    }
    .report-print-footer {
        margin-top: 5px;
    }
    .no-print,
    .report-print-actions {
        display: none !important;
    }
    .report-shell-table > thead { display: table-header-group; }
    .report-shell-table > tfoot { display: table-footer-group; }
    .report-data-table {
        page-break-inside: auto;
        break-inside: auto;
    }
    .report-data-table tr,
    .report-data-table td,
    .report-data-table th {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: auto;
    }
    .report-manual-page-body {
        background: #fff;
    }
    .report-page {
        height: 190mm;
        min-height: 190mm;
        margin: 0;
        overflow: hidden;
    }
    .report-page + .report-page {
        page-break-before: always;
        break-before: page;
    }
    .report-data-table th {
        background: #e3eaee !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .report-invoice-table {
        font-size: 7.35px;
        line-height: 1.04;
    }
    .report-invoice-table th {
        font-size: 5.95px;
        line-height: .98;
        padding: 1.55px 1.9px;
    }
    .report-invoice-table td {
        padding: 1.65px 2.1px;
    }
    .report-daily-table {
        font-size: 7.55px;
        line-height: 1.05;
    }
    .report-daily-table th {
        font-size: 6.05px;
        line-height: .98;
        padding: 1.55px 1.9px;
        background: #e3eaee !important;
    }
    .report-daily-table td {
        padding: 1.75px 2.1px;
    }
    .report-daily-table .signature-cell {
        height: 18px;
    }
}

/* VERTIS INFRA — raporty faktur: stałe 20 pozycji na stronę, czytelnie i bez nachodzenia na stopkę */
.report-manual-page-body .report-page {
    page: vertisRegistryLandscape;
    width: 100%;
    min-height: 190mm;
    height: 190mm;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.report-manual-page-body .report-page-header {
    flex: 0 0 auto;
}
.report-manual-page-body .report-page-content {
    flex: 0 0 145mm;
    height: 145mm;
    min-height: 145mm;
    max-height: 145mm;
    overflow: hidden;
}
.report-manual-page-body .report-page-footer {
    flex: 0 0 20mm;
    min-height: 20mm;
    max-height: 20mm;
    margin-top: auto;
}
.report-manual-page-body .report-data-table {
    height: 144mm;
    max-height: 144mm;
    font-size: 7.25px;
    line-height: 1.08;
    table-layout: fixed;
}
.report-manual-page-body .report-data-table th,
.report-manual-page-body .report-data-table td {
    padding: 1.4px 2.2px;
    overflow: hidden;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}
.report-manual-page-body .report-data-table th {
    background: #e4ebef;
    font-size: 6px;
    line-height: 1;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
.report-manual-page-body .report-data-table tbody tr {
    height: 6.85mm;
    max-height: 6.85mm;
    page-break-inside: avoid;
    break-inside: avoid;
}
.report-manual-page-body .report-data-table tbody td {
    height: 6.85mm;
    max-height: 6.85mm;
    vertical-align: top;
}
.report-manual-page-body .report-cell-clip {
    display: block;
    max-height: 6.15mm;
    overflow: hidden;
}
.report-manual-page-body .report-contractor-print-cell,
.report-manual-page-body .report-daily-document-wrap {
    max-height: 6.25mm;
}
.report-manual-page-body .amount-cell-print {
    white-space: nowrap;
    text-align: right;
    font-weight: 800;
}
.report-manual-page-body .report-daily-table .assigned-center-cell {
    vertical-align: middle;
    text-align: center;
    font-weight: 700;
}
.report-manual-page-body .report-daily-table .signature-cell {
    height: 6.85mm;
    min-width: 150px;
}
.report-manual-page-body .report-print-header {
    margin-bottom: 5px;
}
.report-manual-page-body .report-print-footer {
    margin-top: 6px;
    padding-top: 5px;
}

@media print {
    .report-manual-page-body .report-page {
        min-height: 190mm;
        height: 190mm;
        overflow: hidden;
    }
    .report-manual-page-body .report-page-content {
        flex-basis: 145mm;
        height: 145mm;
        min-height: 145mm;
        max-height: 145mm;
        overflow: hidden;
    }
    .report-manual-page-body .report-page-footer {
        flex-basis: 20mm;
        min-height: 20mm;
        max-height: 20mm;
        margin-top: auto;
    }
    .report-manual-page-body .report-data-table {
        height: 144mm;
        max-height: 144mm;
        font-size: 7.25px;
        line-height: 1.08;
    }
    .report-manual-page-body .report-data-table th,
    .report-manual-page-body .report-data-table td {
        padding: 1.4px 2.2px;
    }
    .report-manual-page-body .report-data-table th {
        font-size: 6px;
        background: #e4ebef !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .report-manual-page-body .report-data-table tbody tr,
    .report-manual-page-body .report-data-table tbody td {
        height: 6.85mm;
        max-height: 6.85mm;
    }
    .report-manual-page-body .report-cell-clip {
        max-height: 6.15mm;
        overflow: hidden;
    }
    .report-manual-page-body .report-contractor-print-cell,
    .report-manual-page-body .report-daily-document-wrap {
        max-height: 6.25mm;
    }
}

/* VERTIS INFRA — raporty faktur FIX4: sztywna geometria strony i wierszy */
.report-manual-page-body .report-page {
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 190mm !important;
    height: 190mm !important;
    max-height: 190mm !important;
    display: grid !important;
    grid-template-rows: 15mm 160mm 15mm !important;
    padding: 0 !important;
    margin: 0 auto 18px !important;
    overflow: hidden !important;
    background: #fff !important;
}
.report-manual-page-body .report-page-header {
    box-sizing: border-box !important;
    height: 15mm !important;
    min-height: 15mm !important;
    max-height: 15mm !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 0 2mm 0 !important;
    margin: 0 !important;
    border-bottom: 2px solid #111 !important;
}
.report-manual-page-body .report-page-header h1 {
    font-size: 17px !important;
    line-height: 1.05 !important;
    margin: 0 0 2px !important;
}
.report-manual-page-body .report-page-header p {
    font-size: 8.5px !important;
    line-height: 1.1 !important;
    margin: 0 !important;
    max-height: 5mm !important;
    overflow: hidden !important;
}
.report-manual-page-body .report-page-header img {
    max-width: 22mm !important;
    max-height: 8mm !important;
    object-fit: contain !important;
}
.report-manual-page-body .report-page-content {
    box-sizing: border-box !important;
    height: 160mm !important;
    min-height: 160mm !important;
    max-height: 160mm !important;
    overflow: hidden !important;
    padding: 2mm 0 !important;
}
.report-manual-page-body .report-page-footer {
    box-sizing: border-box !important;
    height: 15mm !important;
    min-height: 15mm !important;
    max-height: 15mm !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-columns: 1fr 1.2fr 1fr !important;
    align-items: center !important;
    gap: 8mm !important;
    margin: 0 !important;
    padding: 2mm 0 0 0 !important;
    border-top: 1px solid #111 !important;
    font-size: 7px !important;
    line-height: 1.12 !important;
}
.report-manual-page-body .report-page-footer img {
    max-width: 20mm !important;
    max-height: 6mm !important;
    object-fit: contain !important;
}
.report-manual-page-body .report-data-table {
    width: 100% !important;
    height: auto !important;
    max-height: 156mm !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 6.9px !important;
    line-height: 1.08 !important;
}
.report-manual-page-body .report-data-table thead tr,
.report-manual-page-body .report-data-table thead th {
    height: 5.8mm !important;
    max-height: 5.8mm !important;
}
.report-manual-page-body .report-data-table th {
    box-sizing: border-box !important;
    padding: 1mm .9mm !important;
    overflow: hidden !important;
    text-align: center !important;
    vertical-align: middle !important;
    background: #e7edf1 !important;
    font-size: 5.6px !important;
    line-height: 1.04 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}
.report-manual-page-body .report-data-table tbody tr {
    height: 7.5mm !important;
    min-height: 7.5mm !important;
    max-height: 7.5mm !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}
.report-manual-page-body .report-data-table tbody td {
    box-sizing: border-box !important;
    height: 7.5mm !important;
    min-height: 7.5mm !important;
    max-height: 7.5mm !important;
    padding: .75mm .9mm !important;
    overflow: hidden !important;
    vertical-align: top !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
}
.report-manual-page-body .report-cell-clip,
.report-manual-page-body .report-contractor-print-cell,
.report-manual-page-body .report-daily-document-wrap,
.report-manual-page-body .report-document-print-cell {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 4 !important;
    max-height: 6mm !important;
    overflow: hidden !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    hyphens: none !important;
}
.report-manual-page-body .amount-cell-print {
    white-space: nowrap !important;
    text-align: right !important;
    vertical-align: middle !important;
    font-weight: 800 !important;
}
.report-manual-page-body .report-daily-table .assigned-center-cell {
    vertical-align: middle !important;
    text-align: center !important;
    font-weight: 700 !important;
}
.report-manual-page-body .report-daily-table .signature-cell {
    vertical-align: middle !important;
    height: 7.5mm !important;
}
.report-manual-page-body .report-page + .report-page {
    page-break-before: always !important;
    break-before: page !important;
}

@media print {
    @page { size: A4 landscape; margin: 10mm; }
    html, body.report-print-page {
        width: auto !important;
        min-height: 190mm !important;
        background: #fff !important;
    }
    body.report-print-page {
        padding: 0 !important;
        margin: 0 !important;
    }
    .report-manual-page-body .report-page {
        width: 100% !important;
        height: 190mm !important;
        min-height: 190mm !important;
        max-height: 190mm !important;
        margin: 0 !important;
        display: grid !important;
        grid-template-rows: 15mm 160mm 15mm !important;
        overflow: hidden !important;
    }
    .report-manual-page-body .report-page-header {
        height: 15mm !important;
        min-height: 15mm !important;
        max-height: 15mm !important;
    }
    .report-manual-page-body .report-page-content {
        height: 160mm !important;
        min-height: 160mm !important;
        max-height: 160mm !important;
        padding: 2mm 0 !important;
        overflow: hidden !important;
    }
    .report-manual-page-body .report-page-footer {
        height: 15mm !important;
        min-height: 15mm !important;
        max-height: 15mm !important;
        overflow: hidden !important;
    }
    .report-manual-page-body .report-data-table {
        max-height: 156mm !important;
        font-size: 6.9px !important;
        line-height: 1.08 !important;
    }
    .report-manual-page-body .report-data-table thead tr,
    .report-manual-page-body .report-data-table thead th {
        height: 5.8mm !important;
        max-height: 5.8mm !important;
    }
    .report-manual-page-body .report-data-table tbody tr,
    .report-manual-page-body .report-data-table tbody td {
        height: 7.5mm !important;
        min-height: 7.5mm !important;
        max-height: 7.5mm !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    .report-manual-page-body .report-data-table th {
        background: #e7edf1 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .report-manual-page-body .report-cell-clip,
    .report-manual-page-body .report-contractor-print-cell,
    .report-manual-page-body .report-daily-document-wrap,
    .report-manual-page-body .report-document-print-cell {
        -webkit-line-clamp: 4 !important;
        max-height: 6mm !important;
    }
}

/* VERTIS INFRA — raporty faktur FIX4 korekta: 4 linie w stałym wierszu */
.report-manual-page-body .report-page-content {
    padding: 0 !important;
}
.report-manual-page-body .report-data-table {
    max-height: 160mm !important;
    font-size: 6.3px !important;
    line-height: 1.08 !important;
}
.report-manual-page-body .report-data-table thead tr,
.report-manual-page-body .report-data-table thead th {
    height: 6mm !important;
    max-height: 6mm !important;
}
.report-manual-page-body .report-data-table tbody tr {
    height: 7.7mm !important;
    min-height: 7.7mm !important;
    max-height: 7.7mm !important;
}
.report-manual-page-body .report-data-table tbody td {
    height: 7.7mm !important;
    min-height: 7.7mm !important;
    max-height: 7.7mm !important;
    padding: .25mm .85mm !important;
}
.report-manual-page-body .report-cell-clip,
.report-manual-page-body .report-contractor-print-cell,
.report-manual-page-body .report-daily-document-wrap,
.report-manual-page-body .report-document-print-cell {
    max-height: 7.2mm !important;
}
.report-manual-page-body .report-daily-table .signature-cell {
    height: 7.7mm !important;
}
@media print {
    .report-manual-page-body .report-page-content {
        padding: 0 !important;
    }
    .report-manual-page-body .report-data-table {
        max-height: 160mm !important;
        font-size: 6.3px !important;
        line-height: 1.08 !important;
    }
    .report-manual-page-body .report-data-table thead tr,
    .report-manual-page-body .report-data-table thead th {
        height: 6mm !important;
        max-height: 6mm !important;
    }
    .report-manual-page-body .report-data-table tbody tr,
    .report-manual-page-body .report-data-table tbody td {
        height: 7.7mm !important;
        min-height: 7.7mm !important;
        max-height: 7.7mm !important;
    }
    .report-manual-page-body .report-data-table tbody td {
        padding: .25mm .85mm !important;
    }
    .report-manual-page-body .report-cell-clip,
    .report-manual-page-body .report-contractor-print-cell,
    .report-manual-page-body .report-daily-document-wrap,
    .report-manual-page-body .report-document-print-cell {
        max-height: 7.2mm !important;
    }
}


.ksef-preview-card {
    width: min(80vw, 1400px);
    max-width: 80vw;
}
.ksef-preview-card .modal-body,
.ksef-preview-content {
    max-height: 78vh;
    overflow: auto;
}
@media (max-width: 900px) {
    .ksef-preview-card {
        width: min(96vw, 100%);
        max-width: 96vw;
    }
}

.ksef-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 14px;
    color: var(--muted);
    font-size: 0.9rem;
}
.ksef-preview-content {
    display: grid;
    gap: 12px;
}
.ksef-preview-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}
.ksef-preview-section h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}
.ksef-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
}
.ksef-preview-field span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    margin-bottom: 2px;
}
.ksef-preview-field b {
    display: block;
    overflow-wrap: anywhere;
}
.ksef-lines-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.9rem;
}
.ksef-lines-table th,
.ksef-lines-table td {
    border: 1px solid var(--border);
    padding: 6px 8px;
    vertical-align: top;
}
.ksef-lines-table th {
    background: #f3f6f4;
    font-size: 0.8rem;
}
.ksef-row-actions {
    white-space: nowrap;
}
@media (max-width: 900px) {
    .ksef-preview-grid { grid-template-columns: 1fr; }
}

/* VERTIS INFRA — wydruk opisu faktury */
.invoice-description-print-body {
    background: #f8f9fa;
}
.invoice-description-print-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    background: #fff;
    color: #111820;
    box-sizing: border-box;
    padding: 13mm 12mm;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 8mm;
    box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
.invoice-description-print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12mm;
    border-bottom: 2px solid #111820;
    padding-bottom: 5mm;
}
.invoice-description-print-header h1 {
    margin: 0 0 2mm;
    font-size: 22px;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.invoice-description-print-header p {
    margin: 0;
    font-size: 12px;
    color: #343a40;
}
.invoice-description-print-header img {
    max-width: 35mm;
    max-height: 16mm;
    object-fit: contain;
}
.invoice-description-print-content {
    font-size: 11px;
    line-height: 1.28;
}
.invoice-description-print-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0 0 5mm;
}
.invoice-description-print-table th,
.invoice-description-print-table td {
    border: 1px solid #adb5bd;
    padding: 2.2mm 2.4mm;
    vertical-align: top;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}
.invoice-description-print-table th {
    width: 20%;
    background: #f1f3f5;
    color: #212529;
    font-weight: 800;
    text-align: left;
}
.invoice-description-print-table td {
    width: 30%;
}
.invoice-description-print-table.compact {
    margin-bottom: 4mm;
}
.invoice-description-print-section {
    margin: 0 0 5mm;
    break-inside: avoid;
    page-break-inside: avoid;
}
.invoice-description-print-section h2 {
    margin: 0 0 2mm;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .025em;
    color: #212529;
}
.invoice-description-print-box {
    border: 1px solid #adb5bd;
    background: #fff;
    padding: 3mm;
    min-height: 12mm;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}
.invoice-description-print-description .description-box {
    min-height: 42mm;
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
}
.invoice-description-print-meta {
    margin-top: 2mm;
    font-size: 10px;
    color: #495057;
    text-align: right;
}
.invoice-description-print-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14mm;
    margin-top: 10mm;
    break-inside: avoid;
    page-break-inside: avoid;
}
.invoice-description-print-signatures div {
    border-top: 1px solid #111820;
    padding-top: 2mm;
    min-height: 12mm;
    text-align: center;
    font-size: 10px;
    color: #343a40;
}
.invoice-description-print-footer {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 8mm;
    align-items: center;
    border-top: 1px solid #111820;
    padding-top: 3mm;
    font-size: 8.5px;
    line-height: 1.18;
    color: #343a40;
}
.invoice-description-print-footer > div:nth-child(2) {
    text-align: center;
    font-weight: 800;
}
.invoice-description-print-footer > div:nth-child(3) {
    text-align: right;
}
.invoice-description-print-footer img {
    max-width: 22mm;
    max-height: 8mm;
    object-fit: contain;
}

@media print {
    body.invoice-description-print-body {
        background: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .invoice-description-print-page {
        width: 210mm !important;
        min-height: 297mm !important;
        height: 297mm !important;
        margin: 0 !important;
        padding: 12mm !important;
        box-shadow: none !important;
        page-break-after: always;
    }
    .invoice-description-print-table tr,
    .invoice-description-print-section,
    .invoice-description-print-signatures {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}


/* VERTIS INFRA — modale 80% ekranu + korekta dostępności */
.modal-card,
.modal-card-wide,
.invoice-preview-card,
.invoice-description-card,
.duplicate-warning-card,
.ksef-card,
.ksef-preview-card,
.modal-card-monitoring {
    width: min(80vw, 1280px) !important;
    max-width: 80vw !important;
}
.invoice-action-card {
    width: min(80vw, 900px) !important;
    max-width: 80vw !important;
}
.modal-card {
    max-height: 90vh !important;
}
@media (max-width: 900px) {
    .modal-card,
    .modal-card-wide,
    .invoice-preview-card,
    .invoice-description-card,
    .duplicate-warning-card,
    .ksef-card,
    .ksef-preview-card,
    .modal-card-monitoring,
    .invoice-action-card {
        width: min(96vw, 100%) !important;
        max-width: 96vw !important;
    }
}

/* VERTIS INFRA — wydruk opisu faktury: układ A4 pionowo */
.invoice-description-print-page {
    page: invoiceDescriptionPortrait;
}
@page invoiceDescriptionPortrait {
    size: A4 portrait;
    margin: 0;
}
@media print {
    body.invoice-description-print-body {
        width: 210mm !important;
        min-height: 297mm !important;
    }
    .invoice-description-print-page {
        width: 210mm !important;
        min-width: 210mm !important;
        max-width: 210mm !important;
        min-height: 297mm !important;
        height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        page-break-after: auto !important;
        break-after: auto !important;
    }
}

/* Korespondencja przychodząca */
.correspondence-filter-form {
    display: block;
    margin-bottom: .75rem;
}
.correspondence-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: flex-end;
}
.correspondence-filter-grid label {
    display: grid;
    flex: 1 1 145px;
    gap: .22rem;
    min-width: 125px;
}
.correspondence-filter-grid .correspondence-filter-search {
    flex: 2.2 1 300px;
    min-width: 260px;
}
.correspondence-filter-grid .correspondence-filter-per-page {
    flex: 0 1 120px;
    min-width: 110px;
}
.correspondence-filter-grid span {
    font-size: .72rem;
    font-weight: 800;
    color: #68717a;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.correspondence-filter-grid input,
.correspondence-filter-grid select {
    width: 100%;
}
.correspondence-filter-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: .45rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}
.correspondence-sender-field {
    position: relative;
}
.correspondence-sender-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem;
    align-items: center;
}
.correspondence-sender-line .btn {
    white-space: nowrap;
}
.correspondence-sender-picked {
    display: block;
    margin-top: .35rem;
    line-height: 1.35;
}
.correspondence-sender-field .contractor-picker {
    margin-top: .45rem;
}
@media (max-width: 620px) {
    .correspondence-sender-line {
        grid-template-columns: 1fr;
    }
    .correspondence-sender-line .btn {
        width: 100%;
    }
}

.correspondence-table th,
.correspondence-table td {
    vertical-align: top;
}
.correspondence-row {
    cursor: pointer;
}
.correspondence-row:hover {
    background: rgba(212, 122, 31, .045);
}
.correspondence-modal-sections {
    display: grid;
    gap: .65rem;
    margin-top: .75rem;
}
.correspondence-modal-section {
    border: 1px solid rgba(33, 37, 41, .10);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.correspondence-modal-section summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem .85rem;
    cursor: pointer;
    font-weight: 800;
    background: #f8f9fa;
}
.correspondence-modal-section summary small {
    font-weight: 600;
    color: #6c757d;
}
.correspondence-modal-section[open] {
    box-shadow: 0 8px 22px rgba(33, 37, 41, .06);
}
.correspondence-modal-section[open] > .mini-history-list,
.correspondence-modal-section[open] > form {
    margin: .75rem .85rem;
}
.row-actions-details summary {
    cursor: pointer;
    font-weight: 700;
    color: #1f7a35;
}
.row-actions-stack {
    display: grid;
    gap: .45rem;
    min-width: 260px;
    margin-top: .45rem;
}
.inline-action-form,
.compact-edit-form {
    display: grid;
    gap: .35rem;
    padding: .45rem;
    border: 1px solid rgba(33, 37, 41, .08);
    border-radius: 10px;
    background: #fff;
}
.inline-action-form select,
.inline-action-form input,
.inline-action-form textarea {
    width: 100%;
}
.correspondence-comment-form textarea,
.correspondence-transfer-form textarea {
    resize: vertical;
}
.mini-history-item {
    padding: .4rem 0;
    border-bottom: 1px dashed rgba(33, 37, 41, .12);
}
.mini-history-item:last-child {
    border-bottom: 0;
}
.mini-history-item p {
    margin: .2rem 0 0;
    white-space: normal;
}
.file-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .45rem 0;
    border-bottom: 1px dashed rgba(33, 37, 41, .12);
}
.file-line:last-child {
    border-bottom: 0;
}
.file-line a {
    font-weight: 800;
}
.correspondence-preview-actions {
    justify-content: space-between;
}
.correspondence-preview-actions .invoice-manager-actions,
.correspondence-preview-actions .invoice-worker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}
.correspondence-file-upload-form input[type="file"] {
    padding: .5rem;
    border: 1px solid rgba(33, 37, 41, .16);
    border-radius: 9px;
}
.badge-wycofana,
.badge-case-odrzucona {
    background: #f8d7da;
    color: #842029;
}
.badge-case-nowa {
    background: #e2e3e5;
    color: #41464b;
}
.badge-case-w-trakcie {
    background: #cff4fc;
    color: #055160;
}
.badge-case-wstrzymana {
    background: #fff3cd;
    color: #664d03;
}
.badge-case-zakonczona {
    background: #d1e7dd;
    color: #0f5132;
}
.report-correspondence-table th,
.report-correspondence-table td,
.report-correspondence-signature-table th,
.report-correspondence-signature-table td {
    font-size: 8pt;
    line-height: 1.15;
    padding-top: 2.2mm;
    padding-bottom: 2.2mm;
}
.report-correspondence-signature-table .signature-cell {
    min-width: 46mm;
    height: 10.5mm;
}
.report-correspondence-signature-page .report-print-header h1,
.report-correspondence-page .report-print-header h1 {
    font-size: 14pt;
}
.report-correspondence-signature-page .report-print-header p,
.report-correspondence-page .report-print-header p {
    font-size: 8pt;
}
@media (max-width: 1100px) {
    .correspondence-filter-grid .correspondence-filter-search {
        flex-basis: 100%;
    }
}
@media (max-width: 700px) {
    .correspondence-filter-grid label,
    .correspondence-filter-grid .correspondence-filter-search,
    .correspondence-filter-grid .correspondence-filter-per-page {
        flex: 1 1 100%;
        min-width: 100%;
    }
    .correspondence-filter-actions {
        width: 100%;
        margin-left: 0;
        justify-content: stretch;
    }
    .correspondence-filter-actions .btn {
        flex: 1 1 auto;
    }
    .row-actions-stack {
        min-width: 0;
    }
}

/* System / konto użytkownika */
.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    align-items: start;
}


.system-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin: 0 0 1rem;
}

.system-subnav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--dark);
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
}

.system-subnav a:hover,
.system-subnav a.is-active {
    border-color: rgba(212, 122, 31, .45);
    background: rgba(212, 122, 31, .12);
    color: var(--green-dark);
}

.system-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.system-admin-tile {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    min-height: 118px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--dark);
    text-decoration: none;
    box-shadow: var(--shadow);
}

.system-admin-tile strong {
    font-size: 1.05rem;
}

.system-admin-tile span {
    color: var(--muted);
    line-height: 1.35;
}

.system-admin-tile:hover {
    transform: translateY(-1px);
    border-color: rgba(212, 122, 31, .35);
    box-shadow: 0 14px 34px rgba(33, 37, 41, .12);
}

.system-admin-cards {
    margin-bottom: 1rem;
}

.system-section {
    margin-top: 1rem;
}

.section-head-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.system-profile-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: .75rem 0 1rem;
}

.system-profile-summary strong,
.system-profile-summary span,
.system-profile-summary small {
    display: block;
}

.system-avatar {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-weight: 800;
    background: rgba(212, 122, 31, .14);
    color: var(--green-dark);
    border: 1px solid rgba(212, 122, 31, .22);
}

.system-meta-list {
    display: grid;
    gap: .65rem;
    margin: 0;
}

.system-meta-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem 0;
    border-bottom: 1px solid rgba(0,0,0,.07);
}

.system-meta-list dt {
    color: var(--muted);
    font-size: .86rem;
}

.system-meta-list dd {
    margin: 0;
    font-weight: 700;
    text-align: right;
}

.system-users-table .action-cell {
    min-width: 190px;
}

.system-inline-form {
    min-width: 240px;
}

.system-inline-form input,
.system-inline-form textarea,
.system-inline-form select {
    width: 100%;
}

.permission-matrix th,
.permission-matrix td {
    vertical-align: middle;
}

.permission-cell {
    text-align: center;
}

.permission-cell input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 42px;
    font-weight: 700;
}

.check-row input {
    width: auto;
}


/* Audit log — kompaktowe filtry w administracji */
.audit-head-row {
    display: block;
}
.audit-head-row > div {
    margin-bottom: .8rem;
}
.audit-filter-form {
    display: grid;
    grid-template-columns: minmax(132px, 150px) minmax(132px, 150px) minmax(190px, 1fr) minmax(135px, 160px) minmax(135px, 160px) minmax(86px, 96px) auto auto;
    gap: .55rem;
    align-items: end;
    max-width: 100%;
}
.audit-filter-form label {
    display: grid;
    gap: .22rem;
    min-width: 0;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .025em;
}
.audit-filter-form input,
.audit-filter-form select {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 10px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 650;
}
.audit-filter-form .per-page-control {
    display: grid;
    gap: .22rem;
    white-space: normal;
}
.audit-filter-form .btn {
    min-height: 38px;
    white-space: nowrap;
}
@media (max-width: 1180px) {
    .audit-filter-form {
        grid-template-columns: repeat(3, minmax(150px, 1fr));
    }
}
@media (max-width: 760px) {
    .audit-filter-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .section-head-row {
        display: block;
    }

    .section-head-row .btn {
        margin-top: .75rem;
    }

    .system-meta-list div {
        display: block;
    }

    .system-meta-list dd {
        text-align: left;
        margin-top: .2rem;
    }
}


.invoice-preview-third-subjects {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 0.75rem;
    background: rgba(212, 122, 31, 0.06);
}

.invoice-preview-third-subjects > span {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--muted-color, #6c757d);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.invoice-preview-third-subjects ul {
    margin: 0;
    padding-left: 1.1rem;
}

.invoice-preview-third-subjects li + li {
    margin-top: 0.35rem;
}

.system-secret-note {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted-color, #6c757d);
    font-size: 0.78rem;
}

/* System admin — Stage 3 formularze i macierz */
.system-two-column {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    align-items: start;
}

.system-card-form {
    display: grid;
    gap: 1rem;
}

.system-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.system-settings-grid.one-column {
    grid-template-columns: 1fr;
}

.system-setting-field {
    display: grid;
    gap: .35rem;
    min-width: 0;
    font-weight: 800;
    color: var(--dark);
}

.system-setting-field span {
    font-size: .86rem;
}

.system-setting-field small {
    color: var(--muted);
    font-weight: 650;
    line-height: 1.35;
}

.system-setting-field input,
.system-setting-field textarea,
.system-setting-field select {
    width: 100%;
    min-height: 42px;
}

.system-setting-field input[type="file"] {
    padding: 9px 10px;
    background: #fff;
}

.system-setting-field.is-secret input,
.system-setting-field.is-secret textarea {
    border-color: rgba(255, 193, 7, .55);
    background: rgba(255, 193, 7, .05);
}

.system-raw-settings {
    padding: 0;
}

.system-raw-settings summary {
    cursor: pointer;
    padding: 1rem 1.25rem;
    font-weight: 900;
}

.system-raw-settings .system-section {
    margin: 0;
    border: 0;
    box-shadow: none;
}

.permission-module-grid {
    display: grid;
    gap: 1rem;
}

.permission-module-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

.permission-module-card > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1rem;
    background: rgba(212, 122, 31, .07);
    border-bottom: 1px solid var(--border);
}

.permission-module-card h2 {
    margin: 0;
    font-size: 1rem;
}

.permission-module-card header span {
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
}

.permission-module-table-wrap {
    box-shadow: none;
    border-radius: 0;
    margin: 0;
}

.permission-matrix-compact th,
.permission-matrix-compact td {
    padding: 9px 10px;
    font-size: 13px;
}

.sticky-action-row {
    position: sticky;
    bottom: 0;
    padding: .85rem 0 0;
    background: linear-gradient(to top, #fff 82%, rgba(255,255,255,0));
    z-index: 3;
}

.system-file-card h2 {
    margin-top: 0;
}

.system-file-preview {
    display: grid;
    place-items: center;
    min-height: 120px;
    padding: 1rem;
    margin: .75rem 0 1rem;
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: #fff;
}

.system-file-preview img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.logo-preview img {
    max-height: 110px;
}

.favicon-preview img {
    max-width: 64px;
    max-height: 64px;
}

@media (max-width: 760px) {
    .system-two-column,
    .system-settings-grid {
        grid-template-columns: 1fr;
    }
    .permission-module-card > header {
        display: block;
    }
}

/* Stage 9 — globalne uporządkowanie UI/UX */
.content-area > .panel,
.content-area > .table-wrap,
.report-card,
.system-card,
.admin-card {
    border-radius: 18px;
}

.page-head {
    gap: 16px;
    align-items: flex-start;
}

.page-head .actions,
.modal-action-row,
.invoice-preview-actions,
.bulk-actions,
.correspondence-filter-actions,
.contractor-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    line-height: 1.15;
    justify-content: center;
    text-decoration: none;
}

.btn-outline {
    background: #e8f4ff;
}

.btn-danger-soft,
.btn-danger {
    white-space: nowrap;
}

.data-table,
.report-data-table {
    border-spacing: 0;
}

.table-wrap {
    overflow-x: auto;
}

.data-table tbody tr:hover {
    background: rgba(212, 122, 31, .045);
}

.data-table th,
.report-data-table th {
    vertical-align: middle;
}

.data-table td,
.report-data-table td {
    vertical-align: top;
}

.empty,
.empty-inline,
.picker-empty {
    color: var(--muted);
    background: rgba(248, 249, 250, .75);
    border-radius: 14px;
}

.badge {
    white-space: nowrap;
    vertical-align: middle;
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 12px;
}

.report-summary-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    background: #fff;
    min-height: 70px;
}

.report-summary-card span,
.report-summary-card small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.report-summary-card strong {
    display: block;
    margin: 3px 0;
    font-size: 15px;
    color: var(--dark);
    line-height: 1.25;
}

.report-filter-form .modal-action-row {
    justify-content: flex-start;
}

.report-filter-form input,
.report-filter-form select,
.audit-filter-form input,
.audit-filter-form select,
.correspondence-filter-form input,
.correspondence-filter-form select {
    min-height: 40px;
}

.checkbox-line {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    color: var(--dark);
    font-weight: 600;
}

.checkbox-line input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 18px;
}

.modal-card {
    max-height: min(88vh, 900px);
    overflow: auto;
}

.modal-card h2,
.panel h2,
.report-card h2 {
    line-height: 1.2;
}

@media (max-width: 900px) {
    .report-summary-grid {
        grid-template-columns: 1fr;
    }

    .page-head .actions,
    .modal-action-row {
        width: 100%;
    }

    .page-head .actions .btn,
    .modal-action-row .btn,
    .report-filter-form .modal-action-row .btn {
        flex: 1 1 180px;
    }
}

@media print {
    .report-summary-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        margin-bottom: 8px;
    }

    .report-summary-card {
        padding: 7px 8px;
        min-height: auto;
        break-inside: avoid;
    }

    .report-summary-card strong {
        font-size: 11px;
    }

    .report-summary-card span,
    .report-summary-card small {
        font-size: 8px;
    }
}

/* Stage 6+9 hotfix: pulpit i podsumowania raportów */
.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: stretch;
    padding: 26px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 6px);
    background:
        radial-gradient(circle at 92% 12%, rgba(212, 122, 31, .18), transparent 34%),
        linear-gradient(135deg, #ffffff 0%, #f5fbf7 100%);
    box-shadow: var(--shadow);
}
.dashboard-hero h1 { margin: 4px 0 8px; font-size: clamp(30px, 4vw, 48px); line-height: 1.05; }
.dashboard-hero p { margin: 0; max-width: 760px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.dashboard-eyebrow { color: var(--green-dark); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.dashboard-hero-side {
    min-width: 180px;
    display: grid;
    align-content: center;
    justify-items: end;
    gap: 6px;
    padding: 18px;
    border: 1px solid rgba(212, 122, 31, .22);
    border-radius: 18px;
    background: rgba(255,255,255,.72);
}
.dashboard-hero-side span { color: var(--muted); font-size: 13px; font-weight: 700; }
.dashboard-hero-side strong { color: var(--dark); font-size: 18px; }
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.dashboard-metric-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: var(--shadow);
}
.dashboard-metric-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.dashboard-metric-card strong { display: block; margin: 6px 0 4px; font-size: 38px; line-height: 1; color: var(--green-dark); }
.dashboard-metric-card p { margin: 0; color: var(--muted); line-height: 1.4; }
.dashboard-grid-main {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
    gap: 18px;
    align-items: start;
}
.dashboard-grid-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-panel { min-height: 100%; }
.dashboard-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.dashboard-action-card,
.dashboard-shortcut,
.dashboard-feed-item {
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.dashboard-action-card:hover,
.dashboard-shortcut:hover,
.dashboard-feed-item:hover {
    transform: translateY(-1px);
    border-color: rgba(212, 122, 31, .34);
    box-shadow: 0 12px 24px rgba(11, 31, 18, .08);
}
.dashboard-action-card { display: grid; gap: 5px; padding: 15px; }
.dashboard-action-card > span {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(212, 122, 31, .1);
    color: var(--green-dark);
    font-weight: 900;
}
.dashboard-action-card strong { font-size: 16px; }
.dashboard-action-card small { color: var(--muted); line-height: 1.35; }
.dashboard-shortcut-list,
.dashboard-feed { display: grid; gap: 10px; }
.dashboard-shortcut { display: flex; gap: 12px; align-items: center; padding: 13px; }
.dashboard-shortcut > span {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(212, 122, 31, .1);
    color: var(--green-dark);
    font-weight: 900;
}
.dashboard-shortcut strong,
.dashboard-shortcut small { display: block; }
.dashboard-shortcut small { color: var(--muted); margin-top: 2px; }
.dashboard-feed-item { display: grid; gap: 3px; padding: 13px; }
.dashboard-feed-item strong { color: var(--dark); }
.dashboard-feed-item span,
.dashboard-feed-item small { color: var(--muted); line-height: 1.35; }
.report-summary-final-content {
    display: grid;
    align-content: start;
    gap: 18px;
    padding-top: 10mm;
}
.report-summary-final-page .report-summary-grid {
    grid-template-columns: 1fr;
    gap: 12px;
}
.report-summary-final-page .report-summary-card {
    min-height: 96px;
    padding: 18px;
}
.report-summary-final-page .report-summary-card strong { font-size: 22px; }
.report-summary-final-page .report-summary-card span,
.report-summary-final-page .report-summary-card small { font-size: 13px; }

@media (max-width: 1100px) {
    .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid-main,
    .dashboard-grid-secondary { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .dashboard-hero { grid-template-columns: 1fr; padding: 20px; }
    .dashboard-hero-side { justify-items: start; }
    .dashboard-metrics,
    .dashboard-action-grid { grid-template-columns: 1fr; }
}
@media print {
    .report-summary-final-page .report-summary-grid { grid-template-columns: 1fr; }
    .report-summary-final-page .report-summary-card {
        padding: 14px;
        min-height: 70px;
    }
    .report-summary-final-page .report-summary-card strong { font-size: 18px; }
    .report-summary-final-page .report-summary-card span,
    .report-summary-final-page .report-summary-card small { font-size: 11px; }
}

/* Stage 6+9 hotfix 2: pulpit, topbar, raporty w jednej karcie */
.content-area > section,
.content-area > .panel,
.content-area > .table-wrap {
    margin-bottom: 24px;
}
.content-area > section:last-child,
.content-area > .panel:last-child,
.content-area > .table-wrap:last-child {
    margin-bottom: 0;
}

.topbar {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(92px, 1fr) auto minmax(260px, 1fr);
    justify-content: stretch;
    gap: 18px;
    padding: 18px 22px;
    border: 1px solid rgba(26, 34, 43, .08);
    border-radius: 22px;
    background:
        radial-gradient(circle at 12% 18%, rgba(212, 122, 31, .16), transparent 18%),
        radial-gradient(circle at 88% 24%, rgba(212, 122, 31, .11), transparent 20%),
        linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,249,250,.93));
    box-shadow: 0 14px 34px rgba(33, 37, 41, .08);
}
.topbar::before,
.topbar::after {
    content: "";
    position: absolute;
    inset: auto;
    pointer-events: none;
    z-index: -1;
}
.topbar::before {
    top: -34px;
    right: -28px;
    width: 280px;
    height: 170px;
    background:
        linear-gradient(120deg, rgba(212, 122, 31, .08), rgba(212, 122, 31, .01));
    clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 78%);
}
.topbar::after {
    bottom: -20px;
    left: 110px;
    width: 260px;
    height: 120px;
    background:
        linear-gradient(135deg, rgba(212, 122, 31, .11), rgba(212, 122, 31, 0));
    clip-path: polygon(0 100%, 36% 26%, 100% 0, 100% 100%);
    opacity: .7;
}
.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    position: relative;
    z-index: 1;
}
.topbar-right { justify-content: flex-end; }
.topbar-clock {
    justify-self: center;
    align-self: center;
    min-width: 152px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--green-dark);
    font-size: clamp(28px, 2.7vw, 40px);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    font-weight: 950;
    letter-spacing: .055em;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255,255,255,.76);
    position: relative;
    z-index: 1;
}

.dashboard-hero,
.dashboard-metrics,
.dashboard-grid-main,
.dashboard-grid-secondary {
    margin-bottom: 24px;
}
.dashboard-hero { padding: 30px; }
.dashboard-hero h1 { margin-bottom: 0; }
.dashboard-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}
.dashboard-grid-main,
.dashboard-grid-secondary {
    grid-template-columns: 1fr;
    gap: 24px;
}
.dashboard-panel {
    min-height: auto;
    padding: 24px;
}
.dashboard-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.dashboard-shortcut-list,
.dashboard-feed { gap: 12px; }

.report-cards {
    grid-template-columns: 1fr;
    gap: 24px;
}
.report-card { padding: 24px; }
.report-card + .report-card { margin-top: 0; }
.report-filter-form { gap: 18px; }
.report-filter-form .modal-action-row { margin-top: 4px; }

@media (max-width: 1100px) {
    .topbar {
        grid-template-columns: 1fr auto;
    }
    .topbar-clock {
        order: 3;
        grid-column: 1 / -1;
        justify-self: center;
    }
    .topbar-left { justify-content: flex-start; }
    .topbar-right { justify-content: flex-end; }
    .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .topbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .topbar-left,
    .topbar-right {
        justify-content: space-between;
        width: 100%;
    }
    .topbar-clock {
        grid-column: auto;
        order: 0;
        width: 100%;
    }
    .dashboard-metrics,
    .dashboard-action-grid { grid-template-columns: 1fr; }
    .dashboard-panel,
    .report-card { padding: 18px; }
}

/* Zamówienia — kreator / robocze / rejestry */
.order-wizard-panel { overflow: visible; }
.order-wizard-form { gap: 18px; }
.order-step-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    background: #fff;
}
.order-step-card h2 { margin-top: 0; }
.compact-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.order-procedure-preview {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 12px 14px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: #f8f9fa;
}
.order-procedure-preview strong { color: var(--green-dark); }
.order-procedure-preview small { color: #b42318; }
.order-item-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 120px 120px;
    gap: 10px;
    margin-bottom: 10px;
}
.order-number-hint {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: baseline;
    padding: 14px 16px;
    border: 1px solid rgba(212, 122, 31, .22);
    border-radius: 16px;
    background: rgba(212, 122, 31, .06);
}
.order-number-hint strong { font-size: 18px; }
.order-number-hint small { flex-basis: 100%; color: #6c757d; }
.order-table .table-actions { min-width: 210px; }
.badge-robocze { background: #eef2ff; color: #3538cd; }
.badge-gotowe-do-zatwierdzenia { background: #fff7e6; color: #996400; }
.badge-zatwierdzone { background: #e9f8ef; color: #1f7a3a; }
.badge-w-toku { background: #e7f1ff; color: #0b5ed7; }
.badge-zrealizowane { background: #e9f8ef; color: #1f7a3a; }
.badge-anulowane { background: #ffecef; color: #8a1020; }
@media (max-width: 780px) {
    .order-item-row { grid-template-columns: 1fr; }
}
.required-star { color: #dc3545; font-weight: 900; margin-left: 2px; }
.readonly-input { background: #f1f3f5 !important; color: #495057; cursor: not-allowed; }
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.order-criteria-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 160px;
    gap: 10px;
    margin-bottom: 10px;
}
.order-criteria-summary {
    margin: 8px 0 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}
.danger-text { color: #dc3545 !important; }
.order-wizard-form .alert-info {
    margin: 0 0 14px;
}
.order-item-row label,
.order-criteria-row label {
    margin: 0;
}
@media (max-width: 780px) {
    .order-criteria-row { grid-template-columns: 1fr; }
}
.alert-info {
    background: #eef7ff;
    color: #17496b;
    border: 1px solid #cfe8ff;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 700;
}

/* Zamówienia FIX3 — kreator ekran po ekranie */
.order-stepper-form {
    display: block;
    max-width: 1180px;
    margin: 0 auto;
}
.order-wizard-topline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}
.order-step-pill {
    border-radius: 999px;
    padding: 8px 13px;
    background: rgba(212, 122, 31, .12);
    color: var(--green-dark);
    font-weight: 900;
    white-space: nowrap;
}
.order-step-current {
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
}
.order-step-route {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 12px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}
.order-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: #eef0f2;
    overflow: hidden;
    margin-bottom: 20px;
}
.order-progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--green);
    transition: width .18s ease;
}
.order-wizard-step {
    display: none;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    background: #fff;
    box-shadow: 0 12px 26px rgba(0,0,0,.055);
}
.order-wizard-step.is-active { display: block; }
.order-wizard-step h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.order-type-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.order-type-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 7px 16px rgba(0,0,0,.045);
    min-height: 132px;
}
.order-type-card b {
    display: block;
    font-size: 16px;
    margin-bottom: 8px;
}
.order-type-card small {
    color: var(--muted);
    font-weight: 700;
    line-height: 1.35;
}
.order-type-card.active {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(212, 122, 31, .16), 0 10px 20px rgba(0,0,0,.06);
}
.order-clean-grid {
    display: grid;
    gap: 16px;
    align-items: start;
}
.order-clean-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.order-clean-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.order-clean-grid label,
.order-wizard-step label {
    font-weight: 900;
}
.order-clean-grid input,
.order-clean-grid select,
.order-clean-grid textarea,
.order-wizard-step input,
.order-wizard-step select,
.order-wizard-step textarea {
    margin-top: 6px;
}
.order-procedure-preview.large {
    margin-top: 18px;
    padding: 16px;
    font-size: 15px;
}
.order-procedure-preview.large strong { font-size: 22px; }
.order-readonly-choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(212, 122, 31, .24);
    border-radius: 14px;
    padding: 14px 16px;
    background: rgba(212, 122, 31, .06);
    margin-bottom: 18px;
    max-width: 360px;
}
.order-readonly-choice span { color: var(--muted); font-weight: 900; }
.order-readonly-choice b { color: var(--green-dark); font-size: 18px; }
.order-step-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.order-step-actions .btn-outline:first-child { margin-right: auto; }
.is-procedure-hidden { display: none !important; }
.order-contractor-picker { position: relative; }
.order-contractor-picker .picker-results {
    position: absolute;
    z-index: 50;
    left: 0;
    right: 0;
    top: calc(100% - 4px);
    max-height: 300px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 34px rgba(0,0,0,.16);
    padding: 6px;
}
.order-contractor-picker .picker-item {
    width: 100%;
    display: block;
    text-align: left;
    border: 0;
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
    cursor: pointer;
}
.order-contractor-picker .picker-item:hover { background: #f3f8f5; }
.order-contractor-picker .picker-item b,
.order-contractor-picker .picker-item small { display: block; }
.order-contractor-picker .picker-item small { color: var(--muted); margin-top: 3px; }
.order-contractor-picker .picker-empty { padding: 10px 12px; color: var(--muted); font-weight: 800; }
.field-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .14) !important;
}
.order-stepper-form .form-message { margin-top: 14px; }
@media (max-width: 980px) {
    .order-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .order-clean-grid.two,
    .order-clean-grid.three { grid-template-columns: 1fr; }
    .order-wizard-topline { grid-template-columns: 1fr; }
    .order-step-route { justify-self: flex-start; white-space: normal; }
}
@media (max-width: 620px) {
    .order-type-grid { grid-template-columns: 1fr; }
    .order-wizard-step { padding: 18px; }
    .order-step-actions { flex-direction: column-reverse; }
    .order-step-actions .btn { width: 100%; }
}

/* Zamówienia FIX4 — modal wykonawcy, pozycje bez powielania nagłówków, podgląd roboczych */
.order-field-block {
    font-weight: 900;
}
.order-field-block .btn {
    margin-top: 8px;
}
.order-picked-contractor {
    margin-top: 6px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8f9fa;
    color: var(--muted);
    font-weight: 800;
    min-height: 44px;
}
.contractor-modal-results {
    position: static !important;
    display: block;
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 8px;
    margin-top: 12px;
}
.contractor-modal-results.hidden { display: none; }
.contractor-modal-results .picker-item {
    width: 100%;
    display: block;
    text-align: left;
    border: 0;
    border-radius: 10px;
    background: #fff;
    padding: 12px;
    cursor: pointer;
}
.contractor-modal-results .picker-item:hover { background: #f3f8f5; }
.contractor-modal-results .picker-item b,
.contractor-modal-results .picker-item small { display: block; }
.contractor-modal-results .picker-item small { color: var(--muted); margin-top: 3px; }
.order-items-table {
    margin-top: 10px;
}
.order-item-header,
.order-item-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 120px 120px 86px;
    gap: 10px;
    align-items: end;
}
.order-item-header {
    font-weight: 900;
    margin-bottom: 6px;
    padding: 0 2px;
}
.order-item-row {
    margin-bottom: 10px;
}
.order-item-row input,
.order-item-row select { margin-top: 0 !important; }
.order-criteria-row {
    grid-template-columns: minmax(260px, 1fr) 160px 86px;
    align-items: end;
}
.order-click-row { cursor: pointer; }
.order-click-row:hover { background: rgba(212, 122, 31, .055); }
.order-drafts-table td { vertical-align: middle; }
.order-draft-modal-card { width: min(900px, 100%); }
.order-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
}
.order-detail-grid > div {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: #f8f9fa;
}
.order-detail-grid small {
    display: block;
    color: var(--muted);
    font-weight: 900;
    margin-bottom: 4px;
}
.order-detail-grid b { word-break: break-word; }
.order-detail-section {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 14px;
}
.order-detail-section h3 { margin: 0 0 8px; }
.order-history-details {
    border-top: 1px solid var(--border);
    margin-top: 14px;
    padding-top: 14px;
}
.order-history-details summary {
    cursor: pointer;
    font-weight: 900;
}
.order-history-details summary small { color: var(--muted); margin-left: 6px; }
.order-modal-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}
.print-document {
    max-width: 980px;
    margin: 0 auto;
}
.print-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-bottom: 18px;
}
@media print {
    .no-print, .sidebar, .topbar, .page-head { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .panel.print-document { box-shadow: none !important; border: 0 !important; padding: 0 !important; }
}
@media (max-width: 780px) {
    .order-item-header { display: none; }
    .order-item-row { grid-template-columns: 1fr; }
    .order-criteria-row { grid-template-columns: 1fr; }
    .order-detail-grid { grid-template-columns: 1fr; }
}


/* Zamówienia — ujednolicenie modala roboczych z fakturami/korespondencją */
.order-draft-modal-card {
    width: min(900px, 100%);
    padding-top: 28px;
}
.order-preview-head {
    padding-right: 48px;
}
.order-preview-number {
    max-width: 260px;
    overflow-wrap: anywhere;
    white-space: normal;
    text-align: right;
}
.order-detail-grid.invoice-preview-grid {
    margin: 14px 0 0;
}
.order-detail-grid.invoice-preview-grid > div {
    background: #fff;
    border-radius: 14px;
    padding: 11px 12px;
}
.order-detail-grid.invoice-preview-grid small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 7px;
}
.order-detail-section {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 12px;
    margin-top: 12px;
}
.order-detail-section h3 {
    margin: 0 0 8px;
    font-size: 15px;
}
.order-history-details {
    margin-top: 12px;
    padding-top: 0;
    border-top: 0;
}
.order-modal-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
@media (max-width: 980px) {
    .order-preview-head {
        padding-right: 0;
    }
    .order-preview-number {
        max-width: none;
        text-align: center;
    }
}

/* Zamówienia FIX6 — filtry, gwiazdki i jednolite tabele */
.required-star {
    display: inline !important;
    vertical-align: baseline;
    line-height: inherit;
    white-space: nowrap;
}
.order-wizard-step label,
.order-clean-grid label,
.order-field-block {
    line-height: 1.35;
}
.order-filter-panel {
    margin-bottom: 14px;
}
.order-filter-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(6, minmax(130px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}
.order-filter-grid label {
    font-size: 12px;
    font-weight: 900;
    color: var(--muted);
}
.order-filter-grid input,
.order-filter-grid select {
    margin-top: 5px;
}
.hidden-by-order-filter {
    display: none !important;
}
.order-active-table td,
.order-drafts-table td {
    vertical-align: middle;
}
.order-requests-active-section {
    margin-top: 18px;
    margin-bottom: -4px;
    padding-bottom: 8px;
    box-shadow: none;
}
@media (max-width: 1200px) {
    .order-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .order-filter-grid { grid-template-columns: 1fr; }
}

/* Zamówienia FIX8 — poprawka gwiazdek w kreatorze i statusu wycofania */
.order-wizard-step label,
.order-clean-grid label,
.order-criteria-row label {
    display: block !important;
}
.order-wizard-step label > input,
.order-wizard-step label > select,
.order-wizard-step label > textarea,
.order-clean-grid label > input,
.order-clean-grid label > select,
.order-clean-grid label > textarea,
.order-criteria-row label > input,
.order-criteria-row label > select,
.order-criteria-row label > textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
}
.order-wizard-step .required-star,
.order-clean-grid .required-star,
.order-criteria-row .required-star,
.order-item-header .required-star {
    display: inline !important;
    margin-left: 3px;
    white-space: nowrap;
    vertical-align: baseline;
}
.badge-wycofane { background: #f1f3f5; color: #495057; }

/* Zamówienia - wydruki A4 pionowo */
.order-print-body {
    background: #fff;
    color: #111;
    font-family: Arial, Helvetica, sans-serif;
    padding: 18px;
}
.order-print-body .order-doc-page {
    width: 210mm !important;
    min-height: 297mm !important;
    height: auto !important;
    margin: 0 auto 18px !important;
    padding: 10mm !important;
    display: grid !important;
    grid-template-rows: auto 1fr auto !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    background: #fff !important;
}
.order-doc-header {
    display: grid;
    grid-template-columns: 1fr 1.8fr 28mm;
    align-items: start;
    gap: 8mm;
    margin-bottom: 10mm;
}
.order-doc-header h1 {
    text-align: center;
    font-size: 21px;
    line-height: 1.12;
    margin: 9mm 0 0;
    font-weight: 800;
    letter-spacing: .2px;
    text-transform: uppercase;
}
.order-doc-unit {
    font-size: 13px;
    line-height: 1.3;
}
.order-doc-unit > span {
    display: block;
    font-size: 12px;
    margin-bottom: 2px;
}
.order-doc-unit-name {
    font-weight: 800;
}
.order-doc-logo-box {
    width: 26mm;
    min-height: 24mm;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}
.order-doc-logo-box img {
    max-width: 25mm;
    max-height: 25mm;
    object-fit: contain;
}
.order-doc-content {
    min-height: 0;
}
.order-print-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0 0 8mm;
    font-size: 13px;
    line-height: 1.28;
}
.order-print-table th,
.order-print-table td {
    border: 1.4px solid #111;
    padding: 4mm 3mm;
    vertical-align: top;
}
.order-print-table th {
    width: 30%;
    text-align: left;
    font-weight: 800;
    background: #e6e6e6;
}
.order-print-table td {
    background: #fff;
}
.order-print-table-large th,
.order-print-table-large td {
    padding: 5mm 4mm;
}
.order-print-section-row th {
    background: #e6e6e6 !important;
    font-size: 14px;
    padding: 3.5mm 3mm;
    text-align: left;
}
.order-print-strong {
    font-weight: 800;
}
.order-party-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8mm;
    margin: 0 0 8mm;
}
.order-party-box {
    border: 1.4px solid #111;
    min-height: 30mm;
    font-size: 13px;
    line-height: 1.3;
}
.order-party-box h3 {
    margin: 0;
    padding: 3mm;
    font-size: 14px;
    background: #e6e6e6;
    border-bottom: 1.4px solid #111;
}
.order-party-box p {
    margin: 0;
    padding: 0 3mm 1.5mm;
}
.order-party-box h3 + p {
    padding-top: 3mm;
}
.order-party-box .strong {
    font-weight: 800;
}
.order-items-table th,
.order-items-table td {
    padding: 2mm 2.2mm;
}
.order-items-table col.order-item-col-lp { width: 6%; }
.order-items-table col.order-item-col-name { width: 69%; }
.order-items-table col.order-item-col-unit { width: 8%; }
.order-items-table col.order-item-col-qty { width: 17%; }
.order-items-table th:nth-child(1),
.order-items-table td:nth-child(1),
.order-items-table th:nth-child(3),
.order-items-table td:nth-child(3) {
    white-space: nowrap;
}
.order-bottom-grid .order-party-box { min-height: 22mm; }
.order-signature-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(48mm, 1fr));
    gap: 5mm;
    margin-top: 12mm;
}
.order-signature-box {
    border: 1.4px solid #111;
    height: 35mm;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
    padding: 4mm;
    box-sizing: border-box;
    white-space: pre-line;
    font-size: 12px;
}
.order-signature-line,
.order-single-signature .order-signature-line {
    width: 90%;
    border-top: 1.2px solid #111;
    margin-bottom: 3mm;
}
.order-sign-cell {
    height: 48mm;
}
.order-single-signature {
    min-height: 38mm;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
}
.order-doc-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8mm;
    align-items: end;
    border-top: 1.2px solid #111;
    padding-top: 4mm;
    margin-top: 8mm;
    font-size: 10px;
}
.order-doc-footer > div:last-child {
    text-align: right;
}
.order-doc-footer img {
    max-width: 25mm;
    max-height: 8mm;
    object-fit: contain;
    margin-top: 1mm;
}
.order-print-message {
    border: 1px solid #d0d7de;
    padding: 12mm;
    font-size: 15px;
    text-align: center;
}

/* Druga strona zamówienia / zlecenia - instrukcja wystawiania faktur w KSeF */
.order-invoice-instruction-page .order-doc-header {
    margin-bottom: 8mm;
}
.order-invoice-instruction {
    font-size: 12px;
    line-height: 1.38;
}
.order-instruction-intro {
    max-width: 165mm;
    margin: 0 auto 8mm;
    text-align: center;
    font-size: 13px;
    line-height: 1.45;
}
.order-instruction-data-box {
    border: 1.4px solid #111;
    margin-bottom: 7mm;
    break-inside: avoid;
    page-break-inside: avoid;
}
.order-instruction-data-box h2 {
    margin: 0;
    padding: 2.4mm 3mm;
    border-bottom: 1.4px solid #111;
    background: #e6e6e6;
    font-size: 13px;
    line-height: 1.2;
}
.order-instruction-data-box > div {
    display: grid;
    gap: 1.2mm;
    padding: 4mm 3.5mm;
}
.order-instruction-data-box strong {
    font-size: 14px;
    letter-spacing: .1px;
}
.order-instruction-data-box span {
    display: block;
}
.order-instruction-requirement {
    margin: 0 0 7mm;
    padding: 5mm 7mm;
    border-top: 1.4px solid #111;
    border-bottom: 1.4px solid #111;
    text-align: center;
    break-inside: avoid;
    page-break-inside: avoid;
}
.order-instruction-requirement p {
    margin: 0 0 2.5mm;
}
.order-instruction-requirement > strong {
    display: block;
    margin-bottom: 3mm;
    font-size: 13px;
    text-decoration: underline;
}
.order-instruction-requirement > div {
    display: inline-block;
    padding: 2.2mm 5mm;
    border: 1.4px solid #111;
    background: #e6e6e6;
    font-size: 14px;
    font-weight: 800;
}
.order-instruction-warning,
.order-instruction-note {
    border: 1.4px solid #111;
    padding: 4mm;
    break-inside: avoid;
    page-break-inside: avoid;
}
.order-instruction-warning {
    margin-bottom: 5mm;
    background: #e6e6e6;
    font-weight: 700;
}
.order-instruction-note {
    background: #fff;
}
@page vertisOrderDocumentPortrait {
    size: A4 portrait;
    margin: 0;
}
.order-print-body .order-doc-page {
    page: vertisOrderDocumentPortrait;
}
@media print {
    html, body.order-print-body {
        width: 210mm !important;
        min-height: 297mm !important;
        background: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .order-print-body .order-doc-page {
        width: 210mm !important;
        min-height: 297mm !important;
        margin: 0 !important;
        padding: 10mm !important;
        page-break-after: always;
        break-after: page;
    }
    .order-print-body .order-doc-page:last-child {
        page-break-after: auto;
        break-after: auto;
    }
    .order-print-table th,
    .order-print-table td,
    .order-print-section-row th,
    .order-party-box h3,
    .order-instruction-data-box h2,
    .order-instruction-requirement > div,
    .order-instruction-warning {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .report-print-actions,
    .no-print {
        display: none !important;
    }
}

/* Zamówienia - korekta wydruków FIX10: bardziej zwarte A4 i czyszczenie przepełnień */
.order-print-body { padding: 8px; }
.order-print-body .order-doc-page {
    padding: 8mm !important;
    margin-bottom: 8px !important;
}
.order-doc-header {
    grid-template-columns: 1fr 1.7fr 24mm;
    gap: 6mm;
    margin-bottom: 6mm;
}
.order-doc-header h1 {
    font-size: 18px;
    margin-top: 5mm;
    line-height: 1.08;
}
.order-doc-unit {
    font-size: 11px;
    line-height: 1.22;
}
.order-doc-unit > span { font-size: 10px; }
.order-doc-logo-box { width: 23mm; min-height: 21mm; }
.order-doc-logo-box img { max-width: 22mm; max-height: 22mm; }
.order-print-table {
    margin-bottom: 5mm;
    font-size: 11px;
    line-height: 1.18;
}
.order-print-table th,
.order-print-table td {
    padding: 2.2mm 2.4mm;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.order-print-table-large th,
.order-print-table-large td { padding: 2.5mm 2.6mm; }
.order-print-section-row th {
    font-size: 11.5px;
    padding: 2.2mm 2.4mm;
}
.order-party-grid {
    gap: 5mm;
    margin-bottom: 5mm;
}
.order-party-box {
    min-height: 20mm;
    font-size: 11px;
    line-height: 1.18;
}
.order-party-box h3 {
    font-size: 11.5px;
    padding: 2mm 2.4mm;
}
.order-party-box p { padding: 0 2.4mm 1mm; }
.order-party-box h3 + p { padding-top: 2mm; }
.order-items-table th,
.order-items-table td { padding: 1.3mm 1.6mm; }
.order-bottom-grid .order-party-box { min-height: 17mm; }
.order-signature-row {
    gap: 4mm;
    margin-top: 7mm;
}
.order-signature-box {
    height: 25mm;
    padding: 3mm;
    font-size: 10.5px;
}
.order-signature-line,
.order-single-signature .order-signature-line { margin-bottom: 2mm; }
.order-sign-cell { height: 35mm; }
.order-single-signature { min-height: 30mm; font-size: 11px; }
.order-doc-footer {
    padding-top: 2.5mm;
    margin-top: 5mm;
    font-size: 9px;
}
.order-doc-footer img { max-height: 6mm; }
.order-invoice-instruction-page .order-doc-header { margin-bottom: 6mm; }
.order-invoice-instruction { font-size: 11.5px; }
.order-instruction-intro { margin-bottom: 6mm; font-size: 12px; }
.order-instruction-data-box { margin-bottom: 5mm; }
.order-instruction-data-box h2 { padding: 2mm 2.4mm; font-size: 11.5px; }
.order-instruction-data-box > div { gap: .8mm; padding: 3mm 2.8mm; }
.order-instruction-data-box strong { font-size: 12.5px; }
.order-instruction-requirement { margin-bottom: 5mm; padding: 4mm 6mm; }
.order-instruction-requirement > strong { font-size: 12px; }
.order-instruction-requirement > div { padding: 1.8mm 4mm; font-size: 12.5px; }
.order-instruction-warning,
.order-instruction-note { padding: 3mm; }
.order-instruction-warning { margin-bottom: 4mm; }
@media print {
    .order-print-body .order-doc-page { padding: 8mm !important; }
}
.order-protocol-form .order-detail-section { margin-top: 18px; }
.order-checkbox-list { display: grid; gap: 8px; margin: 10px 0 14px; }
.order-checkbox-list .checkline { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.order-checkbox-list .checkline input { width: auto; }

.order-protocol-subhead {
    display: grid;
    gap: 3px;
    margin: 8px 0 10px;
}
.order-protocol-subhead small {
    color: var(--muted);
    font-size: 12px;
}
.order-protocol-query-table {
    display: grid;
    gap: 8px;
}
.order-protocol-query-head,
.order-protocol-query-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px) auto;
    gap: 10px;
    align-items: center;
}
.order-protocol-query-head {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    padding: 0 2px;
}
.order-protocol-query-row .btn-small {
    white-space: nowrap;
    padding: 8px 12px;
}
.order-protocol-offer-head { margin-top: 18px; }
.order-protocol-offers {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fbfcfd;
}
.order-protocol-offer-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 650;
}
.order-protocol-offer-line input { width: auto; }
.order-request-source-details { margin-top: 16px; }
.order-request-source-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-top: 12px;
}
.order-request-source-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
}
.order-request-source-card.full { grid-column: 1 / -1; }
.order-request-source-card small {
    display: block;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.order-request-source-card p { margin: 0; white-space: normal; }
@media (max-width: 900px) {
    .order-protocol-query-head { display: none; }
    .order-protocol-query-row { grid-template-columns: 1fr; }
    .order-request-source-grid { grid-template-columns: 1fr; }
}

/* Zamówienia — raporty FIX16: A4 poziomo */
.order-report-cards {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
}
.order-report-card .muted {
    margin-top: -4px;
}
.order-report-print-page {
    background: #f5f7f8;
}
.order-report-print-page .order-report-page {
    width: 279mm !important;
    min-height: 192mm !important;
    height: 192mm !important;
    max-height: 192mm !important;
    display: grid !important;
    grid-template-rows: 16mm 158mm 18mm !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    overflow: hidden !important;
}
.order-report-print-page .report-page-header {
    height: 16mm !important;
    min-height: 16mm !important;
    max-height: 16mm !important;
}
.order-report-print-page .report-page-content {
    height: 158mm !important;
    min-height: 158mm !important;
    max-height: 158mm !important;
    padding: 2.5mm 0 !important;
    overflow: hidden !important;
}
.order-report-print-page .report-page-footer {
    height: 18mm !important;
    min-height: 18mm !important;
    max-height: 18mm !important;
}
.order-report-table {
    table-layout: fixed !important;
    font-size: 7.6px !important;
    line-height: 1.08 !important;
}
.order-report-table th,
.order-report-table td {
    padding: 2.1px 2.4px !important;
    overflow: hidden !important;
}
.order-report-table th {
    font-size: 5.9px !important;
    line-height: .96 !important;
}
.order-report-table tbody tr,
.order-report-table tbody td {
    height: 14.7mm !important;
    max-height: 14.7mm !important;
    vertical-align: top !important;
}
.order-report-table th:nth-child(1) { width: 8mm; }
.order-report-table th:nth-child(2) { width: 36mm; }
.order-report-table th:nth-child(3) { width: 74mm; }
.order-report-table th:nth-child(4) { width: 25mm; }
.order-report-table th:nth-child(5) { width: 59mm; }
.order-report-table th:nth-child(6) { width: 24mm; }
.order-report-table th:nth-child(7) { width: 24mm; }
.order-report-table th:nth-child(8) { width: 26mm; }
.order-report-number-cell b {
    display: block;
    font-size: 7px;
    line-height: 1.08;
}
.order-report-number-cell small {
    display: block;
    font-size: 6.2px;
    margin-top: 1px;
}

@media (max-width: 1100px) {
    .order-report-cards { grid-template-columns: 1fr; }
}

@media print {
    html,
    body.order-report-print-page {
        width: auto !important;
        min-height: 192mm !important;
        background: #fff !important;
    }
    body.order-report-print-page {
        padding: 0 !important;
        margin: 0 !important;
    }
    .order-report-print-page .order-report-page {
        width: 279mm !important;
        height: 192mm !important;
        min-height: 192mm !important;
        max-height: 192mm !important;
        margin: 0 !important;
        page-break-after: always !important;
        break-after: page !important;
    }
    .order-report-print-page .order-report-page:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }
}

.btn-link {
    border-color: transparent;
    background: transparent;
    color: var(--green-dark);
    padding-inline: 8px;
}
.btn-link:hover {
    color: var(--green);
    text-decoration: underline;
}
.login-reset-link {
    margin-top: 12px;
    width: 100%;
}
.modal-small {
    width: min(520px, 100%);
}

/* VERTIS INFRA — wizualizacja faktury KSeF: styl zbliżony do oficjalnego generatora, ale zwięźlejszy */
.ksef-preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.ksef-preview-toolbar h2 { margin: 0; }
.invoice-ksef-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px dashed var(--border);
    border-bottom: 1px dashed var(--border);
}
.ksef-preview-content {
    background: #f1f3f5;
    padding: 18px;
    overflow: auto;
}
.ksef-document.ksef-official-document {
    background: #fff;
    color: #202428;
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 30px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 1.28;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
}
.ksef-vertis-generated {
    max-width: 1120px;
    margin: 0 auto 12px;
    padding: 7px 0 9px;
    border-bottom: 1px solid #d6d6d6;
    font: 12px/1.25 Arial, Helvetica, sans-serif;
    color: #3c4043;
}
.ksef-vertis-generated strong { font-weight: 700; }
.ksef-official-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.48fr);
    gap: 28px;
    align-items: start;
    border-bottom: 2px solid #c4c4c4;
    padding-bottom: 18px;
    margin-bottom: 14px;
}
.ksef-official-brand {
    font-size: 30px;
    line-height: 1.1;
    color: #000;
    font-weight: 400;
}
.ksef-official-brand span {
    color: #d00000;
    font-weight: 800;
}
.ksef-official-title {
    text-align: right;
    color: #30343a;
}
.ksef-official-title h1 {
    margin: 2px 0 6px;
    font-size: 24px;
    line-height: 1.1;
    color: #000;
    font-weight: 700;
}
.ksef-official-title p { margin: 2px 0; }
.ksef-document-section {
    border-top: 2px solid #c4c4c4;
    padding-top: 14px;
    margin-top: 14px;
}
.ksef-party-section {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}
.ksef-two-parties,
.ksef-details-grid,
.ksef-party-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}
.ksef-details-grid-fixed {
    grid-template-columns: 1fr 1fr;
    gap: 70px;
}
.ksef-one-line {
    white-space: nowrap;
}
.ksef-third-section .ksef-party + .ksef-party {
    border-top: 2px solid #c4c4c4;
    margin-top: 14px;
    padding-top: 14px;
}
.ksef-party h3,
.ksef-document-section h2 {
    margin: 0 0 10px;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 700;
    color: #30343a;
}
.ksef-document-section h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: #30343a;
}
.ksef-party p,
.ksef-line,
.ksef-block-line p {
    margin: 2px 0;
}
.ksef-line strong,
.ksef-block-line strong {
    font-weight: 700;
}
.ksef-line-invert .ksef-label,
.ksef-block-line-invert > .ksef-label,
.ksef-contact-line .ksef-label {
    font-weight: 400;
}
.ksef-line-invert .ksef-value,
.ksef-block-line-invert .ksef-value,
.ksef-contact-line .ksef-value {
    font-weight: 700;
}
.ksef-block-line-invert > .ksef-label {
    display: block;
    margin-bottom: 4px;
}
.ksef-block-line-invert .ksef-value p { margin: 0; }
.ksef-block-line { margin-top: 13px; }
.ksef-block-line > strong {
    display: block;
    margin-bottom: 4px;
}
.ksef-block-line div p { margin: 0; }
.ksef-muted-line { margin: 0 0 9px; }
.ksef-document-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 0;
    font-size: 11px;
    color: #111;
}
.ksef-document-table th,
.ksef-document-table td {
    border: 1px solid #b7b7b7;
    padding: 6px 8px;
    vertical-align: top;
}
.ksef-document-table th {
    background: #f1f2f5;
    font-weight: 700;
    text-align: left;
}
.ksef-document-table tfoot th,
.ksef-document-table tfoot td {
    background: #f7f7f7;
    font-weight: 700;
}
.ksef-document-table .num,
.ksef-document-total { text-align: right; }
.ksef-document-total {
    margin: 22px 0 0;
    font-size: 18px;
    color: #30343a;
}
.ksef-lines-table th:nth-child(1),
.ksef-lines-table td:nth-child(1) { width: 16px; max-width: 16px; padding-left: 2px; padding-right: 2px; text-align: center; }
.ksef-lines-table th:nth-child(2),
.ksef-lines-table td:nth-child(2) { width: 35%; }
.ksef-lines-table th,
.ksef-lines-table td {
    font-size: 11px;
}
.ksef-lines-table th:nth-child(1),
.ksef-lines-table td:nth-child(1) { width: 16px; max-width: 16px; padding-left: 2px; padding-right: 2px; text-align: center; }
.ksef-lines-table th:nth-child(2),
.ksef-lines-table td:nth-child(2) { width: 35%; }
.ksef-lines-table th:nth-child(3),
.ksef-lines-table td:nth-child(3),
.ksef-lines-table th:nth-child(4),
.ksef-lines-table td:nth-child(4),
.ksef-lines-table th:nth-child(5),
.ksef-lines-table td:nth-child(5),
.ksef-lines-table th:nth-child(6),
.ksef-lines-table td:nth-child(6) { width: 7%; }
.ksef-lines-table th:nth-child(7),
.ksef-lines-table td:nth-child(7),
.ksef-lines-table th:nth-child(8),
.ksef-lines-table td:nth-child(8),
.ksef-lines-table th:nth-child(9),
.ksef-lines-table td:nth-child(9) { width: 10%; }
.ksef-remaining-table { max-width: none; }
.ksef-small-table,
.ksef-bank-table,
.ksef-wz-table { max-width: 520px; }
.ksef-bank-table th { width: 170px; }
.ksef-bank-table td { font-weight: 700; }
.ksef-bank-account-number {
    font-size: 13px;
    font-weight: 700 !important;
    letter-spacing: .15px;
    white-space: nowrap;
}
.ksef-payment-due-date {
    font-size: 13px;
    font-weight: 700;
}
.ksef-payment-block + .ksef-payment-block {
    border-top: 1px solid #c4c4c4;
    margin-top: 14px;
    padding-top: 14px;
}
.ksef-payment-terms th:first-child,
.ksef-payment-terms td:first-child { width: 42px; }
.ksef-line-extra-row td {
    background: #fafafa;
    border-top: 0;
    padding-top: 4px;
    padding-bottom: 5px;
}
.ksef-line-details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 9px;
    line-height: 1.2;
}
.ksef-line-details span { display: inline-block; }
.ksef-excise-table { max-width: 340px; margin-top: 12px; }
.ksef-excise-table th:first-child,
.ksef-excise-table td:first-child { width: 42px; }
.ksef-additional-info-table th:first-child,
.ksef-additional-info-table td:first-child { width: 42px; }
.ksef-additional-info-table th:nth-child(2),
.ksef-additional-info-table td:nth-child(2) { width: 82px; }
.ksef-fa3-data-table th { width: 34%; }
.ksef-fa3-data-table th small {
    display: block;
    margin-top: 2px;
    font-size: 8px;
    line-height: 1.15;
    font-weight: 400;
    color: #61676d;
    overflow-wrap: anywhere;
}
.ksef-fa3-data-table td { overflow-wrap: anywhere; }
.ksef-settlement .ksef-document-total { margin-top: 0; }
.ksef-registers-table th,
.ksef-registers-table td { min-width: 140px; }
.ksef-empty-official {
    margin: 6px 0 0;
    color: #60666d;
}
.ksef-verification-grid {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}
.ksef-qr {
    width: 210px;
    height: 210px;
    object-fit: contain;
    display: block;
}
.ksef-qr-number {
    margin: 6px 0 0;
    font-size: 12px;
}
.ksef-verification-link {
    color: #0b57d0;
    overflow-wrap: anywhere;
}
@media (max-width: 900px) {
    .ksef-preview-content { padding: 8px; }
    .ksef-document.ksef-official-document { padding: 18px 14px; }
    .ksef-official-header,
    .ksef-two-parties,
    .ksef-details-grid,
    .ksef-party-grid,
    .ksef-verification-grid {
        grid-template-columns: 1fr;
    }
    .ksef-official-title { text-align: left; }
}
@media print {
    body.ksef-printing * { visibility: hidden !important; }
    body.ksef-printing #ksefPreviewModal,
    body.ksef-printing #ksefPreviewModal * { visibility: visible !important; }
    body.ksef-printing #ksefPreviewModal {
        position: static !important;
        inset: auto !important;
        display: block !important;
        background: #fff !important;
        padding: 0 !important;
    }
    body.ksef-printing #ksefPreviewModal .modal-card {
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        max-height: none !important;
        box-shadow: none !important;
        border: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    body.ksef-printing #ksefPreviewModal .modal-close,
    body.ksef-printing #ksefPreviewModal .ksef-preview-toolbar,
    body.ksef-printing #ksefPreviewModal .ksef-preview-meta,
    body.ksef-printing #ksefPreviewModal .form-message,
    body.ksef-printing #ksefPreviewModal .empty { display: none !important; }
    body.ksef-printing #ksefPreviewModal .ksef-preview-content {
        max-height: none !important;
        overflow: visible !important;
        display: block !important;
        padding: 0 !important;
        background: #fff !important;
    }
    body.ksef-printing .ksef-document.ksef-official-document {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
        width: 100% !important;
        font-size: 8.7pt !important;
        line-height: 1.18 !important;
    }
    body.ksef-printing .ksef-official-brand { font-size: 20pt !important; }
    body.ksef-printing .ksef-official-title h1 { font-size: 18pt !important; font-weight: 700 !important; }
    body.ksef-printing .ksef-document-section h2,
    body.ksef-printing .ksef-party h3 { font-size: 12pt !important; }
    body.ksef-printing .ksef-document-table { font-size: 7.5pt !important; }
    body.ksef-printing .ksef-document-table th,
    body.ksef-printing .ksef-document-table td { padding: 2.2mm 1.5mm !important; }
    body.ksef-printing .ksef-payment-due-date,
    body.ksef-printing .ksef-bank-account-number { font-size: 9pt !important; font-weight: 700 !important; }
    body.ksef-printing .ksef-document-section,
    body.ksef-printing .ksef-party,
    body.ksef-printing .ksef-verification-grid { break-inside: avoid; page-break-inside: avoid; }
    body.ksef-printing .ksef-document-table { page-break-inside: auto; }
    body.ksef-printing .ksef-document-table tr { break-inside: avoid; page-break-inside: avoid; }
}

.form-message.warning { color: #9a6700; }
.badge-warning { background: #fff3cd; color: #664d03; border-color: #ffecb5; }
.ksef-log-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 12px 0 16px; }
.ksef-log-summary-grid div { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.ksef-log-summary-grid span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.ksef-log-summary-grid b { display: block; font-size: 14px; }
.ksef-log-items-table td { vertical-align: top; }
.technical-details summary { cursor: pointer; font-weight: 700; }
.technical-json { max-width: 520px; max-height: 260px; overflow: auto; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: #f8f9fa; font-size: 12px; white-space: pre-wrap; }

/* Faktury — korekta listy: badge KSeF, Podmiot3 i proporcje kolumn */
.invoices-table:not(.invoices-table-no-check) th:nth-child(3),
.invoices-table:not(.invoices-table-no-check) td:nth-child(3) {
    width: 92px !important;
    min-width: 92px !important;
}
.invoices-table-no-check th:nth-child(2),
.invoices-table-no-check td:nth-child(2) {
    width: 92px !important;
    min-width: 92px !important;
}
.invoices-table:not(.invoices-table-no-check) th:nth-child(7),
.invoices-table:not(.invoices-table-no-check) td:nth-child(7),
.invoices-table-no-check th:nth-child(6),
.invoices-table-no-check td:nth-child(6) {
    width: auto !important;
}
.date-cell .invoice-source-line {
    margin-top: 4px;
}
.date-cell .invoice-source-line .badge {
    line-height: 1;
    padding: 3px 7px;
}
.document-cell .ksef-number-line {
    display: block;
    font-size: 9.5px;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: #65717d;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    max-width: 100%;
}
.contractor-cell .contractor-third-subject {
    margin-top: 4px;
    color: #65717d;
    font-size: 11px;
    line-height: 1.22;
    font-weight: 700;
}

/* VERTIS INFRA — lista użytkowników: filtry i wyróżnienie ról */
.system-users-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(160px, .7fr) minmax(180px, .8fr) auto auto;
    gap: .75rem;
    align-items: end;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid rgba(212,122,31,.16);
    border-radius: 16px;
    background: rgba(248,249,250,.78);
}

.system-users-filters label {
    display: grid;
    gap: .35rem;
    margin: 0;
    font-weight: 700;
}

.system-users-filters label span {
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.system-users-filter-counter {
    justify-self: end;
    padding: .58rem .75rem;
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 800;
    border: 1px solid rgba(0,0,0,.08);
    white-space: nowrap;
}

.system-role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 112px;
    padding: .35rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .02em;
    border: 1px solid rgba(0,0,0,.08);
    white-space: nowrap;
}

.system-role-administrator {
    background: #212529;
    color: #fff;
    border-color: #212529;
}

.system-role-kierownik {
    background: #e8f7ed;
    color: #166534;
    border-color: rgba(212,122,31,.35);
}

.system-role-ksiegowosc {
    background: #fff4d6;
    color: #8a5a00;
    border-color: rgba(255,193,7,.45);
}

.system-role-kancelaria {
    background: #e7f1ff;
    color: #0b4f9c;
    border-color: rgba(13,110,253,.28);
}

.system-role-sekretariat {
    background: #ede9fe;
    color: #5b21b6;
    border-color: rgba(109,40,217,.25);
}

.system-role-pracownik {
    background: #f1f3f5;
    color: #495057;
    border-color: rgba(33,37,41,.12);
}

@media (max-width: 980px) {
    .system-users-filters {
        grid-template-columns: 1fr 1fr;
    }

    .system-users-filter-counter {
        justify-self: start;
    }
}

@media (max-width: 640px) {
    .system-users-filters {
        grid-template-columns: 1fr;
    }
}

/* Zamówienia — Zakup z lady */
.order-type-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.order-counter-purchase-box {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid rgba(212, 122, 31, .24);
    border-radius: 16px;
    background: rgba(212, 122, 31, .055);
    display: grid;
    gap: 12px;
}
.order-counter-purchase-box h3 {
    margin: 0 0 4px;
}
.order-counter-purchase-box p {
    margin: 0;
}
.order-counter-purchase-box small {
    color: var(--muted);
    font-weight: 800;
}

/* Zamówienia — trzy rodzaje, zakończenie procesu, firmy w protokole i podsumowanie raportu */
.order-type-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.order-info-note {
    margin: 14px 0 0;
    padding: 12px 14px;
    border: 1px solid rgba(212, 122, 31, .24);
    border-radius: 14px;
    background: rgba(212, 122, 31, .055);
    color: var(--text);
    font-weight: 750;
    line-height: 1.45;
}
.order-completion-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}
.order-completion-card {
    width: 100%;
    min-height: 116px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 7px 16px rgba(0,0,0,.045);
}
.order-completion-card b,
.order-completion-card small {
    display: block;
}
.order-completion-card b {
    margin-bottom: 7px;
    font-size: 15px;
}
.order-completion-card small {
    color: var(--muted);
    font-weight: 700;
    line-height: 1.38;
}
.order-completion-card.active {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(212, 122, 31, .16), 0 10px 20px rgba(0,0,0,.06);
}
.order-completion-card.is-unavailable,
.order-completion-card:disabled {
    opacity: .5;
    cursor: not-allowed;
    box-shadow: none;
}
.order-protocol-query-head-expanded,
.order-protocol-query-row-expanded {
    grid-template-columns: minmax(280px, 1.45fr) minmax(165px, .75fr) minmax(105px, auto) auto;
}
.order-protocol-response-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    white-space: nowrap;
}
.order-protocol-response-check input {
    width: auto;
    margin: 0;
}
.order-report-summary-content {
    display: grid;
    align-content: start;
    gap: 7mm;
}
.order-report-summary-table {
    table-layout: fixed;
    font-size: 9px;
}
.order-report-summary-table th,
.order-report-summary-table td {
    padding: 5px 6px !important;
    text-align: center;
}
.order-report-summary-table th:first-child,
.order-report-summary-table td:first-child {
    width: 48mm;
    text-align: left;
}
.order-report-summary-total td {
    border-top: 2px solid var(--text) !important;
}
.order-report-grand-total {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 10px 16px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8f9fa;
}
.order-report-grand-total span {
    color: var(--muted);
    font-weight: 800;
}
.order-report-grand-total b {
    font-size: 17px;
    white-space: nowrap;
}
.order-report-signature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24mm;
    align-items: end;
    min-height: 42mm;
    padding: 0 12mm;
}
.order-report-signature > div:first-child {
    display: grid;
    gap: 4px;
}
.order-report-signature span,
.order-report-signature small {
    color: var(--muted);
}
.order-report-signature .signature-line {
    border-top: 1px solid var(--text);
    padding-top: 5px;
    text-align: center;
}
.order-report-summary-note {
    margin: 0;
    text-align: center;
    font-size: 9px;
}

@media (max-width: 900px) {
    .order-type-grid-three,
    .order-completion-grid {
        grid-template-columns: 1fr;
    }
    .order-protocol-query-head-expanded {
        display: none;
    }
    .order-protocol-query-row-expanded {
        grid-template-columns: 1fr;
    }
    .order-report-grand-total,
    .order-report-signature {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* Zamówienia — modal kontrahenta w protokole i przebudowa rejestrów */
.order-protocol-contractor-cell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}
.order-protocol-picked-contractor {
    margin: 0;
    min-width: 0;
}
.order-protocol-picked-contractor b,
.order-protocol-picked-contractor small {
    display: block;
}
.order-protocol-picked-contractor b {
    color: var(--text);
    overflow-wrap: anywhere;
}
.order-protocol-picked-contractor small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}
.order-number-document-cell b,
.order-type-procedure-cell b {
    display: block;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}
.order-number-document-cell small,
.order-type-procedure-cell small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.order-number-document-cell small + small {
    margin-top: 2px;
}
.order-number-document-cell small span {
    font-weight: 800;
}
@media (max-width: 900px) {
    .order-protocol-contractor-cell {
        grid-template-columns: 1fr;
    }
}


/* Administracja — porządek ustawień, kreator skrótów i czytelne formularze */
.system-setting-field > label {
    display: grid;
    gap: .35rem;
    min-width: 0;
}

.system-setting-example {
    margin-top: .2rem;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: #f8f9fa;
    overflow: hidden;
}

.system-setting-example summary {
    cursor: pointer;
    padding: .55rem .7rem;
    font-size: .78rem;
    font-weight: 850;
    color: var(--muted);
}

.system-setting-example pre {
    margin: 0;
    padding: .7rem;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: .76rem;
    line-height: 1.45;
    background: #fff;
}

.system-config-note {
    padding: .85rem 1rem;
    border-left: 4px solid var(--green);
    border-radius: 10px;
    background: rgba(212, 122, 31, .07);
    line-height: 1.45;
}

.system-raw-settings-note {
    padding: 0 1.25rem .85rem;
    margin: 0;
}

.dashboard-shortcuts-builder {
    display: grid;
    gap: 12px;
}

.dashboard-shortcuts-list {
    display: grid;
    gap: 10px;
}

.dashboard-shortcut-row {
    display: grid;
    grid-template-columns: minmax(150px, .8fr) minmax(240px, 1.3fr) minmax(220px, 1fr) 90px auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fbfcfd;
}

.dashboard-shortcut-row label {
    display: grid;
    gap: .35rem;
    min-width: 0;
    font-weight: 800;
}

.dashboard-shortcut-row label span {
    font-size: .78rem;
    color: var(--muted);
}

.dashboard-shortcut-row input {
    width: 100%;
}

.dashboard-shortcuts-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-shortcuts-actions small {
    color: var(--muted);
}

.system-unit-layout > article:first-child {
    grid-column: span 1;
}

.order-request-source-panel {
    margin-top: 18px;
    padding: 0;
    overflow: hidden;
}

.order-request-source-panel > summary {
    padding: 14px 16px;
    background: rgba(212, 122, 31, .06);
    border-bottom: 1px solid var(--border);
}

.order-request-source-panel[open] > summary {
    margin-bottom: 0;
}

.order-request-source-panel .order-request-source-grid {
    padding: 16px;
    gap: 12px;
}

.order-request-source-panel .order-request-source-card {
    padding: 14px;
}

@media (max-width: 1100px) {
    .dashboard-shortcut-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-shortcut-row .dashboard-shortcut-icon,
    .dashboard-shortcut-row .btn {
        align-self: end;
    }
}

@media (max-width: 700px) {
    .dashboard-shortcut-row {
        grid-template-columns: 1fr;
    }
}


/* VERTIS INFRA — globalna stopka autorska i centrum pomocy */
.main-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.content-area { flex: 1 0 auto; }
.app-footer {
    flex: 0 0 auto;
    min-height: 86px;
    padding: 18px 28px;
    background:
        linear-gradient(90deg, #11161b 0%, #161d23 48%, #11161b 100%);
    color: rgba(255,255,255,.82);
    border-top: 3px solid var(--green);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
}
.app-footer-brand {
    display: grid;
    gap: 6px;
    line-height: 1.2;
}
.app-footer-brand strong {
    color: #fff;
    font-size: 18px;
    letter-spacing: .035em;
}
.app-footer-brand span {
    font-size: 13px;
    color: rgba(255,255,255,.76);
    font-weight: 700;
}
.app-footer-meta {
    display: grid;
    justify-items: end;
    align-items: end;
    gap: 9px;
    min-width: 0;
    text-align: right;
}
.app-footer-meta span {
    color: rgba(255,255,255,.76);
    font-size: 13px;
    line-height: 1.35;
}
.app-footer-meta img {
    display: block;
    width: min(238px, 32vw);
    height: auto;
    max-height: 36px;
}

.help-page-head { align-items: center; }
.help-eyebrow {
    display: inline-flex;
    margin-bottom: 8px;
    color: var(--green-dark);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .09em;
}
.help-role-card {
    min-width: 210px;
    padding: 14px 18px;
    border: 1px solid rgba(212,122,31,.2);
    border-radius: 16px;
    background: rgba(212,122,31,.07);
    display: grid;
    gap: 4px;
}
.help-role-card span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.help-role-card strong { color: var(--green-dark); font-size: 18px; }
.help-start-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.help-welcome-card {
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.help-card-icon,
.help-summary-icon {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    background: rgba(212,122,31,.12);
    color: var(--green-dark);
    font-weight: 950;
}
.help-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
}
.help-welcome-card h2 { margin: 0 0 7px; font-size: 17px; }
.help-welcome-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.help-index {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}
.help-index h2 { margin: 0 0 4px; }
.help-index p { margin: 0; }
.help-index-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.help-index-links a {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff;
    color: #35404a;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}
.help-index-links a:hover {
    border-color: var(--green);
    color: var(--green-dark);
    background: rgba(212,122,31,.06);
}
.help-sections { display: grid; gap: 14px; }
.help-section {
    margin: 0;
    padding: 0;
    overflow: hidden;
    scroll-margin-top: 92px;
}
.help-section > summary {
    list-style: none;
    cursor: pointer;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    user-select: none;
}
.help-section > summary::-webkit-details-marker { display: none; }
.help-section > summary::after {
    content: '+';
    margin-left: auto;
    color: var(--green-dark);
    font-size: 25px;
    font-weight: 500;
}
.help-section[open] > summary::after { content: '−'; }
.help-section[open] > summary { border-bottom: 1px solid var(--border); }
.help-summary-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 13px;
}
.help-section summary > span:nth-child(2) { display: grid; gap: 3px; }
.help-section summary strong { font-size: 17px; }
.help-section summary small { color: var(--muted); font-size: 13px; font-weight: 550; }
.help-section-content { padding: 20px; }
.help-instruction-grid,
.help-faq-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.help-instruction-grid article,
.help-faq-list article {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    background: #fff;
}
.help-instruction-grid h3,
.help-faq-list h3 { margin: 0 0 8px; font-size: 15px; }
.help-instruction-grid p,
.help-faq-list p { margin: 0; color: #4f5b66; line-height: 1.6; font-size: 14px; }
.help-instruction-grid ol {
    margin: 0;
    padding-left: 20px;
    color: #4f5b66;
    line-height: 1.62;
    font-size: 14px;
}
.help-instruction-grid li + li { margin-top: 4px; }
.help-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(212,122,31,.06);
    border: 1px solid rgba(212,122,31,.14);
}
.help-flow span {
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(212,122,31,.22);
    padding: 7px 11px;
    color: var(--green-dark);
    font-size: 12px;
    font-weight: 850;
}
.help-flow b { color: var(--muted); }
.help-status-note {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-left: 4px solid var(--green);
    border-radius: 10px;
    background: #f5faf6;
    color: #3f4b44;
    line-height: 1.55;
    font-size: 14px;
}

@media (max-width: 980px) {
    .help-start-grid { grid-template-columns: 1fr; }
    .help-index { align-items: flex-start; flex-direction: column; }
    .help-index-links { justify-content: flex-start; }
}
@media (max-width: 700px) {
    .app-footer {
        padding: 18px;
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }
    .app-footer-meta {
        width: 100%;
        justify-items: start;
        text-align: left;
    }
    .app-footer-meta img { width: min(220px, 58vw); }
    .help-role-card { width: 100%; min-width: 0; }
    .help-instruction-grid,
    .help-faq-list { grid-template-columns: 1fr; }
    .help-section > summary { padding: 15px; }
    .help-section-content { padding: 15px; }
    .help-section summary small { line-height: 1.35; }
}
@media print {
    .app-footer,
    .help-index { display: none !important; }
}

.login-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: 24px 24px 0;
}
.login-card { margin-block: auto; }
.login-brand-footer {
    width: calc(100% + 48px);
    margin-inline: -24px;
    flex: 0 0 auto;
    min-height: 74px;
    padding: 15px 28px;
    background: #171b1f;
    color: rgba(255,255,255,.8);
    border-top: 3px solid var(--green);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.login-brand-footer > div { display: grid; gap: 4px; }
.login-brand-footer strong { color: #fff; font-size: 14px; }
.login-brand-footer span { font-size: 12px; }
.login-brand-footer img {
    display: block;
    width: min(220px, 34vw);
    max-height: 31px;
    height: auto;
}
@media (max-width: 640px) {
    .login-body { padding: 18px 18px 0; }
    .login-brand-footer {
        width: calc(100% + 36px);
        margin-inline: -18px;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 15px 18px;
    }
    .login-brand-footer img { width: min(210px, 65vw); }
}
@media print { .login-brand-footer { display: none !important; } }
/* VERTIS INFRA — izolacja wydruków zamówień od raportów rejestrowych */
@page vertisOrderReportLandscape {
    size: A4 landscape;
    margin: 8mm;
}
.order-report-print-page .order-report-page {
    page: vertisOrderReportLandscape;
}



.status-completed {
    background: #d9f2df;
    color: #155724;
}

.status-failed {
    background: #fde2e1;
    color: #842029;
}

.status-started {
    background: #fff3cd;
    color: #664d03;
}

/* Centrum pomocy - przycisk instrukcji PDF i karta bieżącej roli */
.help-head-actions {
    align-items: center;
}
@media (max-width: 700px) {
    .help-head-actions {
        width: 100%;
        align-items: stretch;
        justify-content: flex-start;
    }
    .help-head-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================================================== */
/* VERTIS INFRA — bezpieczny lifting ramy: soft-tech / enterprise (2026-07-21) */
/* Wyłącznie nadpisania nagłówka, zegara, menu i stopek.                      */
/* ========================================================================== */

/* --- Stały nagłówek ramy -------------------------------------------------- */
.topbar {
    min-height: 82px;
    padding: 13px 26px;
    border: 0;
    border-bottom: 1px solid rgba(32, 51, 68, .11);
    border-radius: 0;
    background-color: #f7faf9;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1100' height='82' viewBox='0 0 1100 82'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 54h132l18-18h118l18 18h180' stroke='%23D47A1F' stroke-opacity='.18' stroke-width='1.2'/%3E%3Cpath d='M430 26h112l18 18h118l18-18h148l20 20h118' stroke='%23263d52' stroke-opacity='.14' stroke-width='1.15'/%3E%3Cpath d='M86 0v21l18 18v43M942 0v26l-20 20v36' stroke='%23D47A1F' stroke-opacity='.14' stroke-width='1.1'/%3E%3Cpath d='M328 82v-18l18-18h126' stroke='%23263d52' stroke-opacity='.10' stroke-width='1.05'/%3E%3Ccircle cx='132' cy='54' r='2.7' fill='%23D47A1F' fill-opacity='.28' stroke='none'/%3E%3Ccircle cx='466' cy='54' r='2.7' fill='%23263d52' fill-opacity='.18' stroke='none'/%3E%3Ccircle cx='812' cy='44' r='2.7' fill='%23D47A1F' fill-opacity='.24' stroke='none'/%3E%3Ccircle cx='1052' cy='46' r='2.7' fill='%23263d52' fill-opacity='.16' stroke='none'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(90deg, rgba(38,61,82,.035) 0, rgba(38,61,82,.035) 1px, transparent 1px, transparent 140px),
        radial-gradient(circle at 14% 28%, rgba(212, 122, 31, .11), transparent 25%),
        radial-gradient(circle at 88% 22%, rgba(38, 61, 82, .08), transparent 22%),
        linear-gradient(180deg, rgba(255,255,255,.99), rgba(244,248,247,.99));
    background-repeat: repeat-x, no-repeat, no-repeat, no-repeat;
    background-position: center, center, center, center;
    box-shadow: 0 8px 24px rgba(24, 39, 52, .045);
}

.topbar::before,
.topbar::after {
    content: none !important;
}

/* --- Zegar: cyfrowy, lecz bez ciężkiej kapsuły ---------------------------- */
.topbar-clock {
    position: relative;
    min-width: 190px;
    padding: 15px 18px 7px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #22364a;
    font-family: Bahnschrift, "DIN Alternate", "Segoe UI", Arial, sans-serif;
    font-size: clamp(28px, 2.4vw, 38px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: .105em;
    font-variant-numeric: tabular-nums;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255,255,255,.9);
}
.topbar-clock::before {
    content: "CZAS SYSTEMOWY";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(34, 54, 74, .56);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .18em;
    white-space: nowrap;
}
.topbar-clock::after {
    content: "";
    position: absolute;
    left: 14%;
    right: 14%;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212,122,31,.52), rgba(38,61,82,.26), transparent);
}

.topbar .userbox strong {
    color: #203449;
    font-weight: 750;
}
.topbar .userbox span {
    color: #667789;
}
.topbar .btn-outline {
    border-color: rgba(32, 51, 68, .13);
    background: rgba(226, 241, 255, .92);
    color: #26394b;
    box-shadow: 0 5px 14px rgba(23, 37, 49, .04);
}
.topbar .btn-outline:hover {
    border-color: rgba(212,122,31,.30);
    background: rgba(212,122,31,.08);
    color: #18334a;
}

/* --- Menu boczne: płaska, czytelna nawigacja typu enterprise -------------- */
.sidebar {
    padding: 0 0 18px;
    background-color: #f7f9fa;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='290' height='1200' viewBox='0 0 290 1200'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M0 86h122l18-18h88' stroke='%23D47A1F' stroke-opacity='.10'/%3E%3Cpath d='M44 248h146l16-16h84' stroke='%23263d52' stroke-opacity='.08'/%3E%3Cpath d='M18 0v56l18 18v86M256 0v98l-18 18v126' stroke='%23D47A1F' stroke-opacity='.08'/%3E%3Cpath d='M0 488h96l16 16h124' stroke='%23263d52' stroke-opacity='.07'/%3E%3Cpath d='M30 776h118l16-16h96' stroke='%23D47A1F' stroke-opacity='.09'/%3E%3Cpath d='M0 1034h136l16-16h104' stroke='%23263d52' stroke-opacity='.07'/%3E%3Ccircle cx='122' cy='86' r='2.2' fill='%23D47A1F' fill-opacity='.20' stroke='none'/%3E%3Ccircle cx='190' cy='248' r='2.2' fill='%23263d52' fill-opacity='.12' stroke='none'/%3E%3Ccircle cx='148' cy='488' r='2.2' fill='%23D47A1F' fill-opacity='.16' stroke='none'/%3E%3Ccircle cx='164' cy='776' r='2.2' fill='%23263d52' fill-opacity='.12' stroke='none'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(180deg, #fbfcfc 0%, #f4f7f8 100%);
    border-right: 1px solid rgba(31, 47, 61, .11);
    box-shadow: 8px 0 28px rgba(24, 37, 49, .04);
}
.sidebar .brand {
    display: flex;
    align-items: center;
    min-height: 82px;
    margin: 0;
    padding: 13px 22px;
    border: 0;
    border-bottom: 1px solid rgba(31, 47, 61, .10);
    border-radius: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(250,252,252,.88));
}
.sidebar .brand img {
    width: 180px;
    max-width: 100%;
}
.main-nav {
    gap: 0;
    padding: 8px 0;
}
.main-nav > .nav-direct,
.main-nav > .nav-group {
    margin: 0;
    border: 0;
    border-bottom: 1px solid rgba(31, 47, 61, .075);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}
.main-nav > .nav-direct,
.main-nav > .nav-group > summary {
    min-height: 48px;
    padding: 14px 42px 14px 48px;
    border-radius: 0;
    color: #293c50;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: .005em;
}
.main-nav > .nav-direct::before,
.main-nav > .nav-group > summary::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 50%;
    width: 19px;
    height: 19px;
    transform: translateY(-50%);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 19px 19px;
    opacity: .82;
}
.main-nav > .nav-direct[href*="view=dashboard"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
}
.nav-group[data-nav-group="korespondencja"] > summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m4 7 8 6 8-6'/%3E%3C/svg%3E");
}
.nav-group[data-nav-group="faktury"] > summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8'%3E%3Cpath d='M6 3h9l3 3v15H6z'/%3E%3Cpath d='M15 3v4h4M9 11h6M9 15h6'/%3E%3C/svg%3E");
}

.nav-group[data-nav-group="iod"] > summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 5 6v5c0 4.6 2.8 8.1 7 10 4.2-1.9 7-5.4 7-10V6z'/%3E%3Ccircle cx='12' cy='10' r='2.2'/%3E%3Cpath d='M8.5 16c.7-2 2-3 3.5-3s2.8 1 3.5 3'/%3E%3C/svg%3E");
}
.nav-group[data-nav-group="zamowienia"] > summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8'%3E%3Crect x='4' y='4' width='16' height='17' rx='2'/%3E%3Cpath d='M8 2v4M16 2v4M8 11l2 2 4-4M8 17h8'/%3E%3C/svg%3E");
}
.nav-group[data-nav-group="cru"] > summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8'%3E%3Cpath d='M6 3h9l3 3v7'/%3E%3Cpath d='M15 3v4h4M9 11h5M9 15h3'/%3E%3Ccircle cx='16.5' cy='16.5' r='3.5'/%3E%3Cpath d='m19 19 2 2'/%3E%3C/svg%3E");
}
.nav-group[data-nav-group="kontrahenci"] > summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='9' r='2.5'/%3E%3Cpath d='M3 20c0-4 2.5-6 6-6s6 2 6 6M14 15c3.5-.5 6 1.2 7 4'/%3E%3C/svg%3E");
}
.main-nav > .nav-direct[href*="view=help"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.7 9a2.5 2.5 0 1 1 3.8 2.1c-1 .6-1.5 1.2-1.5 2.4M12 17h.01'/%3E%3C/svg%3E");
}
.nav-group[data-nav-group="system"] > summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19 13.5v-3l-2-1-.5-1.2.7-2.1-2.1-2.1-2.1.7-1.2-.5-1-2h-3l-1 2-1.2.5-2.1-.7-2.1 2.1.7 2.1L1.5 10v3l2 1 .5 1.2-.7 2.1 2.1 2.1 2.1-.7 1.2.5 1 2h3l1-2 1.2-.5 2.1.7 2.1-2.1-.7-2.1z'/%3E%3C/svg%3E");
}
.main-nav > .nav-direct:hover,
.main-nav > .nav-direct.active,
.main-nav > .nav-group > summary:hover,
.main-nav > .nav-group[open] > summary {
    color: #17334a;
    background: linear-gradient(90deg, rgba(212,122,31,.16), rgba(212,122,31,.055) 54%, rgba(38,61,82,.035));
    box-shadow: inset 3px 0 0 var(--green);
}
.main-nav > .nav-group[open] {
    background: linear-gradient(180deg, rgba(240,245,246,.92), rgba(236,242,244,.86));
}
.main-nav > .nav-group > summary::after {
    right: 17px;
    color: #6c7b89;
}
.nav-group-links {
    gap: 0;
    padding: 0 0 6px;
}
.nav-group-links a {
    min-height: 40px;
    padding: 11px 18px 11px 49px;
    border-radius: 0;
    color: #617286;
    font-size: 14px;
    font-weight: 520;
}
.nav-group-links a::before {
    content: "";
    position: absolute;
    left: 31px;
    top: 50%;
    width: 7px;
    height: 1px;
    transform: translateY(-50%);
    background: rgba(82, 102, 120, .62);
}
.nav-group-links a:hover,
.nav-group-links a.active {
    color: #17334a;
    background: linear-gradient(90deg, rgba(255,255,255,.94), rgba(248,251,251,.92));
    box-shadow: inset 3px 0 0 rgba(212,122,31,.72);
}
.nav-group-links a.active {
    font-weight: 700;
}

/* --- Wspólne tło technologiczne stopek ----------------------------------- */
.app-footer,
.login-brand-footer {
    position: relative;
    overflow: hidden;
    color: rgba(255,255,255,.84);
    border-top: 3px solid var(--green);
    background-color: #0f171f;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1100' height='96' viewBox='0 0 1100 96'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 67h148l18-18h112l18 18h206' stroke='%23ffffff' stroke-opacity='.11' stroke-width='1.1'/%3E%3Cpath d='M562 22h126l18 18h104l18-18h272' stroke='%23D47A1F' stroke-opacity='.28' stroke-width='1.15'/%3E%3Cpath d='M92 0v24l18 18v54M972 0v28l-20 20v48' stroke='%23ffffff' stroke-opacity='.08' stroke-width='1.05'/%3E%3Cpath d='M320 96v-18l18-18h122' stroke='%23D47A1F' stroke-opacity='.14' stroke-width='1.05'/%3E%3Ccircle cx='148' cy='67' r='2.6' fill='%23ffffff' fill-opacity='.16' stroke='none'/%3E%3Ccircle cx='502' cy='67' r='2.6' fill='%23D47A1F' fill-opacity='.34' stroke='none'/%3E%3Ccircle cx='818' cy='40' r='2.6' fill='%23ffffff' fill-opacity='.14' stroke='none'/%3E%3Ccircle cx='1036' cy='40' r='2.6' fill='%23D47A1F' fill-opacity='.26' stroke='none'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(90deg, rgba(255,255,255,.035) 0, rgba(255,255,255,.035) 1px, transparent 1px, transparent 148px),
        radial-gradient(circle at 14% 20%, rgba(255,255,255,.055), transparent 24%),
        linear-gradient(90deg, #0c141b 0%, #13202a 52%, #0c141b 100%);
    background-repeat: repeat-x, no-repeat, no-repeat;
    background-position: center, center, center;
}
.app-footer::before,
.app-footer::after,
.login-brand-footer::before,
.login-brand-footer::after {
    content: none !important;
}

/* --- Stopka aplikacji ------------------------------------------------------ */
.app-footer {
    min-height: 92px;
    padding: 17px 28px;
    align-items: flex-end;
}
.app-footer-brand {
    display: grid;
    gap: 7px;
    position: relative;
    z-index: 1;
}
.app-footer-vertis-logo {
    display: block;
    width: min(184px, 44vw);
    height: auto;
    filter: none;
    opacity: 1;
    padding: 7px 10px;
    background: rgba(255,255,255,.96);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.app-footer-brand span,
.app-footer-meta span {
    color: rgba(255,255,255,.67);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: .025em;
}
.app-footer-meta {
    display: grid;
    justify-items: end;
    gap: 7px;
    position: relative;
    z-index: 1;
}
.app-footer-meta a {
    display: inline-flex;
}
.app-footer-meta img {
    display: block;
    width: min(232px, 34vw);
    max-height: 34px;
    height: auto;
    transition: opacity .16s ease, transform .16s ease;
}
.app-footer-meta a:hover img {
    opacity: .9;
    transform: translateY(-1px);
}

/* --- Stopka logowania: identyczny język wizualny -------------------------- */
.login-brand-footer {
    width: calc(100% + 48px);
    margin-inline: -24px;
    min-height: 86px;
    padding: 16px 28px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}
.login-footer-product,
.login-footer-author {
    display: grid;
    gap: 7px;
    position: relative;
    z-index: 1;
}
.login-footer-author {
    justify-items: end;
    text-align: right;
}
.login-footer-vertis-logo {
    display: block;
    width: min(176px, 44vw);
    height: auto;
    filter: none;
    opacity: 1;
    padding: 7px 10px;
    background: rgba(255,255,255,.96);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.login-footer-product span,
.login-footer-author span {
    color: rgba(255,255,255,.67);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: .025em;
}
.login-footer-author a {
    display: inline-flex;
}
.login-footer-author img {
    display: block;
    width: min(218px, 34vw);
    max-height: 32px;
    height: auto;
    transition: opacity .16s ease, transform .16s ease;
}
.login-footer-author a:hover img {
    opacity: .9;
    transform: translateY(-1px);
}

/* --- Drobne dopasowania responsywne --------------------------------------- */
@media (max-width: 1100px) {
    .topbar-clock {
        min-width: 175px;
    }
}
@media (max-width: 700px) {
    .topbar {
        padding: 12px 16px;
    }
    .topbar-clock {
        width: 100%;
        min-width: 0;
        padding-top: 14px;
        font-size: 29px;
    }
    .app-footer,
    .login-brand-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 15px;
    }
    .app-footer-meta,
    .login-footer-author {
        width: 100%;
        justify-items: start;
        text-align: left;
    }
    .app-footer-meta img,
    .login-footer-author img {
        width: min(215px, 66vw);
    }
}


/* Bezpieczne pozycjonowanie ikon menu w warstwie nadpisującej. */
.main-nav > .nav-direct,
.main-nav > .nav-group > summary,
.nav-group-links a {
    position: relative;
}


/* Zamówienia — pola płatności naprawdę warunkowe.
   Reguła musi być bardziej szczegółowa niż FIX8 wymuszający display:block na label. */
.order-wizard-step [data-order-payment-date][hidden],
.order-wizard-step [data-order-payment-days][hidden],
.order-wizard-step [data-order-payment-text][hidden],
.order-wizard-step [data-order-payment-date].hidden,
.order-wizard-step [data-order-payment-days].hidden,
.order-wizard-step [data-order-payment-text].hidden {
    display: none !important;
}


/* Zamówienia — osobny wydruk dokumentu procedury pełnej i zwarte akcje modala */
.order-modal-actions {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
}
.order-modal-actions .btn {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 10px;
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.15;
    white-space: nowrap;
}
.order-modal-print-main {
    font-weight: 650 !important;
}
.order-full-procedure-subject {
    margin-top: 6mm;
}
.order-full-procedure-signature {
    display: flex;
    justify-content: flex-end;
    margin-top: 14mm;
    page-break-inside: avoid;
}
.order-signature-box-preparer {
    width: 72mm;
    max-width: 48%;
    height: 34mm;
    flex: 0 0 auto;
}
@media (max-width: 980px) {
    .order-modal-actions {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}
@media print {
    .order-full-procedure-signature {
        margin-top: 12mm;
    }
}

/* CRU JSFP — rejestr, szczegóły i lokalne umowy robocze */
.badge-neutral {
    background: #f1f3f5;
    color: #495057;
    border-color: rgba(33, 37, 41, .14);
}

.cru-status-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cru-status-panel small {
    display: block;
    margin-top: .25rem;
    color: var(--muted);
}

.cru-status-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .75rem 1.25rem;
    white-space: nowrap;
}

.cru-key-expiry {
    padding-left: 1.25rem;
    border-left: 1px solid rgba(31, 47, 61, .16);
}

.cru-key-expiry-valid b {
    color: #207a36;
}

.cru-key-expiry-expiring b {
    color: #a15c00;
}

.cru-key-expiry-expired b {
    color: #b3261e;
}

.cru-key-expiry-unknown b {
    color: #6c757d;
}

.cru-filter-form {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    align-items: end;
}

.cru-filter-form .modal-action-row {
    margin: 0;
    align-self: end;
}

.cru-error-panel {
    border-left: 5px solid #dc3545;
}

.cru-error-panel h2 {
    color: #a51d2a;
}

.cru-register-table th:nth-child(1),
.cru-register-table td:nth-child(1) {
    width: 58px;
    text-align: center;
}

.cru-register-table th:nth-child(2),
.cru-register-table td:nth-child(2),
.cru-register-table th:nth-child(4),
.cru-register-table td:nth-child(4),
.cru-register-table th:nth-child(5),
.cru-register-table td:nth-child(5) {
    white-space: nowrap;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.system-inline-test-form {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.system-inline-test-form .form-message {
    flex: 1;
}

.cru-report-print-page .order-report-page {
    page: vertisCruReportLandscape;
}

.cru-report-table th:nth-child(1),
.cru-report-table td:nth-child(1),
.cru-report-table th:nth-child(2),
.cru-report-table td:nth-child(2),
.cru-report-table th:nth-child(4),
.cru-report-table td:nth-child(4),
.cru-report-table th:nth-child(5),
.cru-report-table td:nth-child(5) {
    white-space: nowrap;
}

.cru-report-error {
    padding: 1.25rem;
    border: 1px solid rgba(220, 53, 69, .35);
    background: rgba(220, 53, 69, .08);
    color: #8a1020;
    font-weight: 700;
}

.cru-report-limit-note {
    max-width: 1100px;
    margin: 1rem auto;
    padding: .75rem 1rem;
    background: #fff3cd;
    border: 1px solid #ffecb5;
}

@media (max-width: 780px) {
    .cru-status-panel,
    .system-inline-test-form {
        align-items: stretch;
        flex-direction: column;
    }
    .cru-status-summary {
        justify-content: flex-start;
    }
}


/* Ustawienia ogólne — nazwa systemu i informacje o serwerze */
.topbar-system-name {
    min-width: 0;
    max-width: min(420px, 34vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--dark);
    font-size: 15px;
    font-weight: 900;
    letter-spacing: .01em;
}

.system-server-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.system-server-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}

.system-server-card h3 {
    margin: 0 0 .75rem;
    font-size: 1rem;
}

.system-server-card dl {
    display: grid;
    gap: 0;
    margin: 0;
}

.system-server-card dl > div {
    display: grid;
    grid-template-columns: minmax(130px, .85fr) minmax(0, 1.35fr);
    gap: .8rem;
    padding: .55rem 0;
    border-top: 1px solid var(--border);
}

.system-server-card dl > div:first-child {
    border-top: 0;
}

.system-server-card dt {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
}

.system-server-card dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--dark);
    font-size: .86rem;
    font-weight: 750;
    text-align: right;
}

.server-info-status-ok {
    color: var(--green-dark) !important;
}

.server-info-status-error {
    color: #b42318 !important;
}

.server-info-status-neutral {
    color: var(--muted) !important;
}

.cru-status-panel-compact {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 900px) {
    .system-server-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .topbar-system-name {
        max-width: 42vw;
        font-size: 13px;
    }

    .system-server-card dl > div {
        grid-template-columns: 1fr;
        gap: .2rem;
    }

    .system-server-card dd {
        text-align: left;
    }

    .cru-status-panel-compact {
        justify-content: flex-start;
    }
}

/* Wskazówki do szczegółowej macierzy uprawnień */
.permission-matrix-guide {
    display: grid;
    gap: 9px;
}
.permission-matrix-guide > strong {
    font-size: .98rem;
}
.permission-matrix-guide p {
    max-width: 1180px;
    margin: 0;
    line-height: 1.55;
}
.permission-guide-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

/* Macierz uprawnień — jeden wspólny grid z podziałem na moduły */
.permission-matrix-wrap {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.permission-matrix-unified {
    width: 100%;
    min-width: 1120px;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.permission-matrix-unified thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--dark, #212529);
    color: #fff;
    white-space: nowrap;
}

.permission-matrix-unified th,
.permission-matrix-unified td {
    padding: 9px 10px;
    font-size: 13px;
    vertical-align: middle;
}

.permission-matrix-unified .permission-key-column,
.permission-matrix-unified .permission-key-cell {
    min-width: 230px;
}

.permission-matrix-unified .permission-description-column,
.permission-matrix-unified .permission-description-cell {
    min-width: 300px;
}

.permission-matrix-unified .permission-role-column {
    min-width: 112px;
    text-align: center;
}

.permission-matrix-unified .permission-key-cell code {
    white-space: nowrap;
}

.permission-module-row th {
    padding: 10px 12px;
    background: rgba(212, 122, 31, .10);
    color: var(--dark, #212529);
    border-top: 2px solid rgba(212, 122, 31, .28);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.permission-module-group:first-of-type .permission-module-row th {
    border-top: 0;
}

.permission-module-row span {
    font-size: .95rem;
    font-weight: 900;
}

.permission-module-row small {
    margin-left: .65rem;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
}

.permission-matrix-unified tbody tr:not(.permission-module-row):hover td {
    background: rgba(212, 122, 31, .035);
}

@media (max-width: 900px) {
    .permission-matrix-wrap {
        border-radius: 8px;
    }
}


/* VERTIS INFRA — KSeF: wariant uproszczony / pełny i wydruk kompaktowy */
.ksef-preview-toolbar-actions,
.ksef-preview-mode-switch {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.ksef-preview-mode-switch .btn.active {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
}
.ksef-document.ksef-official-document {
    padding: 22px 24px;
    font-size: 11px;
    line-height: 1.2;
}
.ksef-official-header {
    padding-bottom: 12px;
    margin-bottom: 9px;
}
.ksef-document-section {
    padding-top: 8px;
    margin-top: 8px;
}
.ksef-party h3,
.ksef-document-section h2 {
    margin-bottom: 5px;
    font-size: 15px;
}
.ksef-block-line { margin-top: 7px; }
.ksef-block-line-invert > .ksef-label { margin-bottom: 2px; }
.ksef-muted-line { margin-bottom: 4px; }
.ksef-document-table {
    margin-top: 4px;
    font-size: 9.5px;
    line-height: 1.12;
}
.ksef-document-table th,
.ksef-document-table td {
    padding: 3px 4px;
}
.ksef-lines-table th,
.ksef-lines-table td {
    font-size: 9.2px;
    padding: 3px 3px;
}
.ksef-line-extra-row td {
    padding-top: 2px;
    padding-bottom: 2px;
}
.ksef-line-uu-id {
    display: block;
    margin-top: 2px;
    color: #747b82;
    font-size: 7.5px;
    line-height: 1.08;
    font-weight: 400;
    overflow-wrap: anywhere;
}
.ksef-payment-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 620px;
    border: 1px solid #b7b7b7;
    margin: 3px 0 6px;
}
.ksef-payment-summary > div {
    min-width: 0;
    padding: 4px 6px;
}
.ksef-payment-summary > div + div {
    border-left: 1px solid #b7b7b7;
}
.ksef-payment-summary span {
    display: block;
    margin-bottom: 1px;
    font-size: 8px;
    color: #626970;
}
.ksef-payment-summary strong {
    display: block;
    font-size: 11px;
}
.ksef-payment-summary .ksef-payment-due-date,
.ksef-bank-account-number {
    font-size: 13px;
    font-weight: 700 !important;
}
.ksef-bank-table {
    margin-top: 4px;
}
.ksef-bank-table th {
    width: 145px;
}
.ksef-payment-full-extra {
    margin-top: 6px;
}
.ksef-payment-full-extra h4 {
    margin-bottom: 2px;
}
.ksef-compact-meta-section {
    border-top: 1px solid #bfc3c7;
    margin-top: 8px;
    padding-top: 4px;
    color: #555b61;
}
.ksef-compact-meta-section h2 {
    margin: 0 0 2px;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: .2px;
    color: #666c72;
}
.ksef-compact-meta-table {
    margin: 0;
    table-layout: fixed;
    font-size: 7px;
    line-height: 1.02;
}
.ksef-compact-meta-table th,
.ksef-compact-meta-table td {
    padding: 1px 2px;
    border-color: #d7dade;
    overflow-wrap: anywhere;
}
.ksef-compact-meta-table th {
    width: 18%;
    background: #f7f7f7;
    color: #555b61;
}
.ksef-compact-meta-table td {
    width: 32%;
}
.ksef-document-full .ksef-fa3-data-table {
    font-size: 8px;
}
.ksef-document-full .ksef-fa3-data-table th,
.ksef-document-full .ksef-fa3-data-table td {
    padding: 2px 3px;
}
.ksef-remaining-table th {
    width: 145px;
}
@media (max-width: 900px) {
    .ksef-preview-toolbar {
        align-items: flex-start;
    }
    .ksef-preview-toolbar-actions {
        width: 100%;
    }
    .ksef-payment-summary {
        grid-template-columns: 1fr;
    }
    .ksef-payment-summary > div + div {
        border-left: 0;
        border-top: 1px solid #b7b7b7;
    }
}
@media print {
    body.ksef-printing .ksef-document.ksef-official-document {
        font-size: 7.8pt !important;
        line-height: 1.08 !important;
    }
    body.ksef-printing .ksef-official-header {
        padding-bottom: 2mm !important;
        margin-bottom: 1.5mm !important;
    }
    body.ksef-printing .ksef-document-section {
        margin-top: 1.4mm !important;
        padding-top: 1.4mm !important;
    }
    body.ksef-printing .ksef-document-section h2,
    body.ksef-printing .ksef-party h3 {
        margin-bottom: .7mm !important;
        font-size: 9.5pt !important;
    }
    body.ksef-printing .ksef-document-table {
        margin-top: .7mm !important;
        font-size: 6.8pt !important;
        line-height: 1.04 !important;
    }
    body.ksef-printing .ksef-document-table th,
    body.ksef-printing .ksef-document-table td {
        padding: .55mm .75mm !important;
    }
    body.ksef-printing .ksef-lines-table th,
    body.ksef-printing .ksef-lines-table td {
        font-size: 6.5pt !important;
        padding: .5mm .55mm !important;
    }
    body.ksef-printing .ksef-line-uu-id {
        font-size: 5.4pt !important;
    }
    body.ksef-printing .ksef-payment-summary {
        margin: .6mm 0 1mm !important;
    }
    body.ksef-printing .ksef-payment-summary > div {
        padding: .7mm 1mm !important;
    }
    body.ksef-printing .ksef-payment-summary span {
        font-size: 5.8pt !important;
    }
    body.ksef-printing .ksef-payment-summary strong,
    body.ksef-printing .ksef-payment-due-date,
    body.ksef-printing .ksef-bank-account-number {
        font-size: 8pt !important;
    }
    body.ksef-printing .ksef-compact-meta-section {
        margin-top: 1.5mm !important;
        padding-top: .7mm !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
    body.ksef-printing .ksef-compact-meta-section h2 {
        font-size: 5.8pt !important;
        margin-bottom: .4mm !important;
    }
    body.ksef-printing .ksef-compact-meta-table {
        font-size: 5.2pt !important;
        line-height: 1 !important;
    }
    body.ksef-printing .ksef-compact-meta-table th,
    body.ksef-printing .ksef-compact-meta-table td {
        padding: .25mm .45mm !important;
    }
}

@media print {
    body.ksef-printing .ksef-document-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }
    body.ksef-printing .ksef-party-section,
    body.ksef-printing .ksef-third-section,
    body.ksef-printing .ksef-authorized-section,
    body.ksef-printing .ksef-settlement,
    body.ksef-printing .ksef-payment-block,
    body.ksef-printing .ksef-compact-meta-section {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}

/* VERTIS INFRA — KSeF FIX: stabilny przełącznik wariantu bez przesuwania paska akcji */
.ksef-preview-toolbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: 390px;
}

.ksef-preview-mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 220px;
    width: 220px;
    gap: 0;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #eef1f3;
    overflow: hidden;
}

.ksef-preview-mode-switch .btn,
.ksef-preview-mode-switch .btn:hover,
.ksef-preview-mode-switch .btn.active,
.ksef-preview-mode-switch .btn.active:hover {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 6px 9px;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    white-space: nowrap;
    transform: none;
}

.ksef-preview-mode-switch .btn {
    background: transparent;
    color: var(--muted);
}

.ksef-preview-mode-switch .btn:hover {
    background: rgba(255, 255, 255, .58);
    color: var(--dark);
}

.ksef-preview-mode-switch .btn.active,
.ksef-preview-mode-switch .btn.active:hover {
    background: var(--text);
    color: #fff;
}

[data-ksef-preview-print] {
    flex: 0 0 158px;
    width: 158px;
    min-width: 158px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .ksef-preview-toolbar-actions {
        min-width: 0;
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    .ksef-preview-toolbar-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .ksef-preview-mode-switch,
    [data-ksef-preview-print] {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
}

/* VERTIS INFRA — KSeF: czytelny przełącznik wariantu */
.ksef-preview-mode-switch {
    padding: 3px;
    border: 1px solid #b8bec4;
    background: #cfd4d9;
}

.ksef-preview-mode-switch .btn,
.ksef-preview-mode-switch .btn:hover,
.ksef-preview-mode-switch .btn[aria-pressed="false"],
.ksef-preview-mode-switch .btn[aria-pressed="false"]:hover {
    background: #e1e4e7;
    color: #212529;
    border-color: transparent;
    font-weight: 700;
}

.ksef-preview-mode-switch .btn[aria-pressed="false"]:hover {
    background: #d3d8dc;
    color: #000;
}

.ksef-preview-mode-switch .btn.active,
.ksef-preview-mode-switch .btn.active:hover,
.ksef-preview-mode-switch .btn[aria-pressed="true"],
.ksef-preview-mode-switch .btn[aria-pressed="true"]:hover {
    background: #D47A1F;
    color: #fff;
    border-color: #D47A1F;
    font-weight: 800;
}

.ksef-preview-mode-switch .btn:focus-visible {
    outline: 2px solid #212529;
    outline-offset: -2px;
}


/* VERTIS INFRA — jednolity system filtrów we wszystkich modułach */
:root {
    --filter-control-height: 42px;
    --filter-gap: 10px;
    --filter-label-size: 10px;
    --filter-control-font-size: 13px;
    --filter-button-font-size: 12px;
}

:is(
    .contractor-toolbar,
    .correspondence-filter-form,
    .report-filter-form,
    .audit-filter-form,
    .cru-filter-form,
    .system-users-filters,
    .order-filter-panel
) label,
.filter-field {
    margin: 0;
    display: grid;
    grid-template-rows: 16px var(--filter-control-height);
    align-content: end;
    gap: 5px;
    min-width: 0;
    font-size: var(--filter-label-size);
    font-weight: 800;
}

:is(
    .contractor-toolbar,
    .correspondence-filter-form,
    .report-filter-form,
    .audit-filter-form,
    .cru-filter-form,
    .system-users-filters,
    .order-filter-panel
) label > span:first-child,
.filter-field > span:first-child {
    display: block;
    min-height: 16px;
    color: var(--muted);
    font-size: var(--filter-label-size);
    line-height: 16px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .035em;
    white-space: nowrap;
}

:is(
    .contractor-toolbar,
    .correspondence-filter-form,
    .report-filter-form,
    .audit-filter-form,
    .cru-filter-form,
    .system-users-filters,
    .order-filter-panel
) :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select),
.filter-field :is(input, select) {
    width: 100%;
    height: var(--filter-control-height);
    min-height: var(--filter-control-height);
    margin: 0;
    padding: 0 13px;
    border-radius: 11px;
    font-size: var(--filter-control-font-size);
    line-height: 1.2;
}

:is(
    .contractor-toolbar,
    .correspondence-filter-form,
    .report-filter-form,
    .audit-filter-form,
    .cru-filter-form,
    .system-users-filters,
    .order-filter-panel
) :is(.btn, button[type="submit"], a.btn),
.filter-actions :is(.btn, button, a) {
    min-height: var(--filter-control-height);
    height: var(--filter-control-height);
    padding: 0 13px;
    border-radius: 11px;
    font-size: var(--filter-button-font-size);
    white-space: nowrap;
}

.filter-actions,
.correspondence-filter-actions,
:is(.report-filter-form, .cru-filter-form) .modal-action-row {
    display: flex;
    align-items: flex-end;
    align-self: end;
    gap: 8px;
    min-height: var(--filter-control-height);
    margin: 0;
    flex-wrap: wrap;
}

/* Rejestry faktur i kontrahentów */
.contractor-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 140px);
    align-items: end;
    gap: var(--filter-gap);
    margin-bottom: 12px;
}
.contractor-search-box {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) auto;
    align-items: end;
    gap: var(--filter-gap);
    min-width: 0;
}
.invoice-filter-box-registry {
    grid-template-columns: minmax(220px, 1.55fr) minmax(175px, 1.05fr) minmax(120px, .7fr) repeat(2, minmax(135px, .8fr)) auto;
}
.invoice-filter-box-mine {
    grid-template-columns: minmax(250px, 1.8fr) minmax(125px, .72fr) repeat(2, minmax(140px, .82fr)) auto;
}
.invoice-filter-box .filter-field-search,
.contractor-search-box .filter-field-search {
    min-width: 0;
}
.contractor-search-input,
.invoice-search-input,
.invoice-worker-input,
.date-filter-inline input[type="date"] {
    width: 100%;
    max-width: none;
}
.date-filter-inline,
.per-page-control {
    display: grid;
    grid-template-rows: 16px var(--filter-control-height);
    align-items: end;
    gap: 5px;
    font-size: inherit;
    white-space: normal;
}
.per-page-control select {
    width: 100%;
    min-width: 0;
}

/* Korespondencja */
.correspondence-filter-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1.7fr) repeat(auto-fit, minmax(145px, 1fr));
    align-items: end;
    gap: var(--filter-gap);
}
.correspondence-filter-grid label,
.correspondence-filter-grid .correspondence-filter-search,
.correspondence-filter-grid .correspondence-filter-per-page {
    min-width: 0;
    width: auto;
    flex: none;
}
.correspondence-filter-actions {
    justify-content: flex-end;
    margin-left: 0;
}

/* Raporty */
.report-filter-form,
.cru-filter-form {
    gap: var(--filter-gap);
}
.report-filter-form .form-two-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--filter-gap);
    align-items: end;
}
.report-filter-form > label:not(.checkbox-line) {
    grid-template-rows: 16px var(--filter-control-height);
}
.report-filter-form .checkbox-line {
    min-height: var(--filter-control-height);
    display: flex !important;
    align-items: center;
    align-self: end;
    gap: 8px;
}

/* Zamówienia */
.order-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--filter-gap);
    align-items: end;
}
.order-filter-grid label {
    font-size: var(--filter-label-size);
}
.order-filter-grid input,
.order-filter-grid select {
    margin-top: 0;
}

/* Administracja, logi i CRU */
.system-users-filters {
    grid-template-columns: minmax(240px, 1.6fr) minmax(160px, .8fr) minmax(180px, .9fr) auto auto;
    align-items: end;
    gap: var(--filter-gap);
}
.system-users-filter-counter {
    min-height: var(--filter-control-height);
    height: var(--filter-control-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: end;
    border-radius: 11px;
    padding: 0 13px;
}
.inline-filter-form.audit-filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    align-items: end;
    gap: var(--filter-gap);
    width: 100%;
}
.cru-filter-form {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
}

@media (max-width: 1250px) {
    .invoice-filter-box-registry,
    .invoice-filter-box-mine {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
    .invoice-filter-box .filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .contractor-toolbar,
    .contractor-search-box,
    .invoice-filter-box,
    .system-users-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .contractor-search-box,
    .invoice-filter-box {
        grid-column: 1 / -1;
    }
    .filter-actions,
    .correspondence-filter-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .contractor-toolbar,
    .contractor-search-box,
    .invoice-filter-box,
    .correspondence-filter-grid,
    .report-filter-form .form-two-cols,
    .order-filter-grid,
    .system-users-filters,
    .inline-filter-form.audit-filter-form,
    .cru-filter-form {
        grid-template-columns: 1fr;
    }
    .invoice-filter-box .filter-actions,
    .contractor-search-box .filter-actions,
    .correspondence-filter-actions,
    :is(.report-filter-form, .cru-filter-form) .modal-action-row {
        grid-column: auto;
        width: 100%;
    }
    .filter-actions :is(.btn, button, a),
    .correspondence-filter-actions .btn,
    :is(.report-filter-form, .cru-filter-form) .modal-action-row .btn {
        flex: 1 1 150px;
    }
}


/* VERTIS INFRA — faktury/KSeF: domyślne filtry, informacja o synchronizacji i kompaktowe modale */
.ksef-last-fetch-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 8px;
    margin-top: 5px;
    color: var(--muted);
    font-size: .82rem;
}
.ksef-last-fetch-info b {
    color: var(--dark);
    font-weight: 800;
}

/* Wszystkie przyciski X mają jednoznaczny kolor zamykania. */
.modal-close,
a.modal-close,
button.modal-close,
.invoice-preview-card .modal-close {
    font-size: 0 !important;
    background: #dc3545 !important;
    color: #fff !important;
    border: 1px solid #bd2130 !important;
    box-shadow: 0 3px 9px rgba(220, 53, 69, .22) !important;
}
.modal-close:hover,
a.modal-close:hover,
button.modal-close:hover,
.invoice-preview-card .modal-close:hover {
    background: #b02a37 !important;
    color: #fff !important;
    border-color: #9f2430 !important;
}

/* Lekko bardziej kompaktowa typografia wszystkich modali. */
.modal-card {
    font-size: .93rem;
    padding: 20px !important;
}
.modal-card h2 {
    font-size: 1.32rem;
    margin-top: 0;
}
.modal-card label,
.modal-card input,
.modal-card select,
.modal-card textarea,
.modal-card .btn {
    font-size: .93rem;
}
.modal-card .form-section-title {
    font-size: .78rem;
}

/* Modal KSeF wykorzystuje prawie całą wysokość ekranu, a wynik ma własny elastyczny obszar. */
.ksef-card {
    width: min(92vw, 1500px) !important;
    max-width: 92vw !important;
    height: 94vh;
    max-height: 94vh !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}
.ksef-card > h2 {
    flex: 0 0 auto;
    margin-bottom: 12px;
}
.ksef-card #ksefFetchForm {
    flex: 0 0 auto;
    gap: 10px;
}
.ksef-control-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}
.ksef-context-block {
    flex: 1 1 auto;
    min-width: 0;
}
.ksef-context-grid {
    padding: 4px 0 0;
    gap: 7px 14px;
}
.ksef-context-grid label {
    font-size: .86rem;
}
.ksef-action-row {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
}
.ksef-action-row .btn {
    min-height: 40px;
    white-space: nowrap;
}
.ksef-results {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    padding-top: 10px;
}
.ksef-results-head {
    flex: 0 0 auto;
    margin-bottom: 7px;
}
.ksef-table-scroll {
    flex: 1 1 auto;
    min-height: 260px;
    max-height: none;
    border-radius: 10px;
}
.ksef-import-table {
    min-width: 1080px;
    table-layout: fixed;
    font-size: .74rem;
    line-height: 1.18;
}
.ksef-import-table th:nth-child(1),
.ksef-import-table td:nth-child(1) { width: 38px; }
.ksef-import-table th:nth-child(2),
.ksef-import-table td:nth-child(2) { width: 17%; }
.ksef-import-table th:nth-child(3),
.ksef-import-table td:nth-child(3),
.ksef-import-table th:nth-child(4),
.ksef-import-table td:nth-child(4),
.ksef-import-table th:nth-child(5),
.ksef-import-table td:nth-child(5) { width: 16.5%; }
.ksef-import-table th:nth-child(6),
.ksef-import-table td:nth-child(6) { width: 10%; }
.ksef-import-table th:nth-child(7),
.ksef-import-table td:nth-child(7) { width: 9%; }
.ksef-import-table th:nth-child(8),
.ksef-import-table td:nth-child(8) { width: 10%; }
.ksef-import-table td:nth-child(2),
.ksef-import-table td:nth-child(3),
.ksef-import-table td:nth-child(4),
.ksef-import-table td:nth-child(5) {
    overflow-wrap: anywhere;
    word-break: normal;
}
.ksef-import-table th,
.ksef-import-table td {
    padding: 5px 6px;
}
.ksef-import-table th {
    font-size: .7rem;
}
.ksef-import-table small {
    font-size: .66rem;
    line-height: 1.15;
}
.ksef-import-table .btn {
    min-height: 28px;
    padding: 4px 7px;
    font-size: .69rem;
}

@media (max-width: 1100px) {
    .ksef-control-row {
        align-items: stretch;
        flex-direction: column;
    }
    .ksef-action-row {
        width: 100%;
        flex-wrap: wrap;
    }
    .ksef-action-row .btn {
        flex: 1 1 180px;
    }
}
@media (max-width: 900px) {
    .ksef-card {
        width: 96vw !important;
        max-width: 96vw !important;
        height: 94vh;
    }
}


/* VERTIS INFRA — kolorystyka specjalnego przycisku KSeF */
.btn-ksef,
.btn-ksef.btn-outline {
    background: #fff !important;
    color: #c62828 !important;
    border-color: #dc3545 !important;
    box-shadow: inset 4px 0 0 #dc3545;
    font-weight: 850;
}
.btn-ksef:hover,
.btn-ksef.btn-outline:hover {
    background: #dc3545 !important;
    color: #fff !important;
    border-color: #b02a37 !important;
    box-shadow: none;
}

/* VERTIS INFRA — finalne dopracowanie czerwonych akcentów i statusów faktur */
.btn-danger,
.btn-danger-soft,
.btn-action-delete {
    background: linear-gradient(135deg, rgba(255, 241, 242, .98) 0%, rgba(255, 231, 235, .96) 52%, rgba(255, 248, 249, .99) 100%) !important;
    color: #a51d2a !important;
    border-color: rgba(220, 53, 69, .48) !important;
    box-shadow: 0 4px 10px rgba(176, 42, 55, .06);
}
.btn-danger:hover,
.btn-danger-soft:hover,
.btn-action-delete:hover {
    background: linear-gradient(135deg, rgba(255, 232, 236, .99) 0%, rgba(252, 214, 220, .95) 52%, rgba(255, 243, 245, .99) 100%) !important;
    color: #842029 !important;
    border-color: #dc3545 !important;
    box-shadow: 0 6px 14px rgba(176, 42, 55, .12);
}
.btn-action-delete::before {
    background: rgba(220, 53, 69, .15) !important;
    color: #a51d2a !important;
}
.btn-action-delete:hover::before {
    background: rgba(220, 53, 69, .22) !important;
    color: #842029 !important;
}

/* Badge statusów faktur — większy kontrast i łatwiejsze skanowanie tabeli */
.invoices-table .status-cell .badge {
    min-height: 25px;
    padding: 5px 10px;
    border: 1px solid transparent;
    font-size: 11.5px;
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: .015em;
    box-shadow: 0 1px 2px rgba(33, 37, 41, .06);
}
.invoices-table .status-cell .badge-nowa {
    background: #fff3cd;
    color: #664d03;
    border-color: #e7c85c;
}
.invoices-table .status-cell .badge-zadekretowana {
    background: #e7f1ff;
    color: #084298;
    border-color: #9ec5fe;
}
.invoices-table .status-cell .badge-przekazana-pracownikowi {
    background: #e8f7ee;
    color: #146c43;
    border-color: #9fd7b4;
}
.invoices-table .status-cell .badge-opisana {
    background: #d1e7dd;
    color: #0f5132;
    border-color: #75b798;
}
.invoices-table .status-cell .badge-wykreslona {
    background: #f8d7da;
    color: #842029;
    border-color: #f1aeb5;
}

/* KSeF — K, S i F czarne; litera e czerwona */
.btn-ksef,
.btn-ksef.btn-outline {
    background: linear-gradient(135deg, rgba(255, 241, 242, .98) 0%, rgba(255, 231, 235, .96) 52%, rgba(255, 250, 250, .99) 100%) !important;
    color: #16191d !important;
    border-color: #dc3545 !important;
    box-shadow: 0 4px 10px rgba(176, 42, 55, .06);
}
.btn-ksef:hover,
.btn-ksef.btn-outline:hover {
    background: linear-gradient(135deg, rgba(255, 232, 236, .99) 0%, rgba(252, 214, 220, .95) 52%, rgba(255, 244, 246, .99) 100%) !important;
    color: #111418 !important;
    border-color: #b02a37 !important;
    box-shadow: 0 6px 14px rgba(176, 42, 55, .12);
}
.ksef-button-wordmark {
    display: inline-flex;
    align-items: baseline;
    color: #16191d;
    font-weight: 900;
    letter-spacing: .01em;
}
.ksef-button-wordmark span {
    color: #dc3545;
}

/* Wylogowanie — czytelny, ale nieagresywny czerwony akcent */
.topbar .btn-logout,
.topbar .btn-logout.btn-outline {
    background: linear-gradient(135deg, rgba(255, 241, 242, .98) 0%, rgba(255, 231, 235, .96) 52%, rgba(255, 248, 249, .99) 100%);
    color: #a51d2a;
    border-color: rgba(220, 53, 69, .52);
    box-shadow: 0 5px 14px rgba(176, 42, 55, .06);
}
.topbar .btn-logout:hover,
.topbar .btn-logout.btn-outline:hover {
    background: linear-gradient(135deg, rgba(255, 232, 236, .99) 0%, rgba(252, 214, 220, .95) 52%, rgba(255, 243, 245, .99) 100%);
    color: #842029;
    border-color: #dc3545;
    box-shadow: 0 6px 15px rgba(176, 42, 55, .11);
}



/* VERTIS INFRA — finalne ujednolicenie przycisków i badge KSeF */
/* Standardowe przyciski: delikatne zielone tło zamiast błękitu. */
.btn:not(.btn-primary):not(.btn-danger):not(.btn-danger-soft):not(.btn-action-delete):not(.btn-ksef):not(.btn-logout),
a.btn:not(.btn-primary):not(.btn-danger):not(.btn-danger-soft):not(.btn-action-delete):not(.btn-ksef):not(.btn-logout),
button.btn-outline:not(.btn-danger):not(.btn-danger-soft):not(.btn-ksef):not(.btn-logout) {
    background: linear-gradient(135deg, rgba(239, 249, 242, .99) 0%, rgba(226, 244, 232, .96) 52%, rgba(247, 252, 248, .99) 100%) !important;
    color: #1f5130;
    border-color: rgba(212, 122, 31, .34);
    box-shadow: 0 4px 10px rgba(212, 122, 31, .06);
}
.btn:not(.btn-primary):not(.btn-danger):not(.btn-danger-soft):not(.btn-action-delete):not(.btn-ksef):not(.btn-logout):hover,
a.btn:not(.btn-primary):not(.btn-danger):not(.btn-danger-soft):not(.btn-action-delete):not(.btn-ksef):not(.btn-logout):hover,
button.btn-outline:not(.btn-danger):not(.btn-danger-soft):not(.btn-ksef):not(.btn-logout):hover {
    background: linear-gradient(135deg, rgba(228, 246, 233, .99) 0%, rgba(207, 236, 216, .97) 52%, rgba(240, 249, 243, .99) 100%) !important;
    color: #174523;
    border-color: rgba(212, 122, 31, .60);
    box-shadow: 0 6px 14px rgba(212, 122, 31, .11);
}

/* Jeden bardziej kwadratowy promień dla wszystkich zwykłych przycisków. */
button:not(.modal-close):not(.icon-button),
a.btn,
.btn,
.btn-action,
.stat-pill-button,
.badge-button {
    border-radius: 8px !important;
}

/* Badge KSeF w rejestrze: wordmark zgodny z przyciskiem KSeF. */
.badge.badge-ksef {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #16191d;
    background: linear-gradient(135deg, rgba(255, 241, 242, .98) 0%, rgba(255, 231, 235, .96) 52%, rgba(255, 250, 250, .99) 100%);
    color: #16191d;
    box-shadow: 0 2px 6px rgba(33, 37, 41, .07);
}
.ksef-badge-wordmark {
    display: inline-flex;
    align-items: baseline;
    color: #16191d;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .01em;
}
.ksef-badge-wordmark span {
    color: #dc3545;
}


/* VERTIS INFRA — końcowe dopracowanie tabeli faktur, KSeF i tła logowania */

/* Standardowe przyciski: prawie białe tło z bardzo subtelnym zielonym tonem. */
.btn:not(.btn-primary):not(.btn-danger):not(.btn-danger-soft):not(.btn-action-delete):not(.btn-ksef):not(.btn-ksef-visual):not(.btn-logout),
a.btn:not(.btn-primary):not(.btn-danger):not(.btn-danger-soft):not(.btn-action-delete):not(.btn-ksef):not(.btn-ksef-visual):not(.btn-logout),
button.btn-outline:not(.btn-danger):not(.btn-danger-soft):not(.btn-ksef):not(.btn-ksef-visual):not(.btn-logout) {
    background: linear-gradient(135deg, rgba(250, 253, 251, .99) 0%, rgba(242, 249, 244, .97) 52%, rgba(252, 254, 252, .99) 100%) !important;
    color: #285436;
    border-color: rgba(212, 122, 31, .25);
    box-shadow: 0 3px 8px rgba(212, 122, 31, .035);
}
.btn:not(.btn-primary):not(.btn-danger):not(.btn-danger-soft):not(.btn-action-delete):not(.btn-ksef):not(.btn-ksef-visual):not(.btn-logout):hover,
a.btn:not(.btn-primary):not(.btn-danger):not(.btn-danger-soft):not(.btn-action-delete):not(.btn-ksef):not(.btn-ksef-visual):not(.btn-logout):hover,
button.btn-outline:not(.btn-danger):not(.btn-danger-soft):not(.btn-ksef):not(.btn-ksef-visual):not(.btn-logout):hover {
    background: linear-gradient(135deg, rgba(244, 251, 246, .99) 0%, rgba(232, 246, 236, .98) 52%, rgba(249, 253, 250, .99) 100%) !important;
    color: #1d4729;
    border-color: rgba(212, 122, 31, .48);
    box-shadow: 0 5px 12px rgba(212, 122, 31, .075);
}

/* Autor wprowadzenia obok czytelnego badge typu dokumentu. */
.invoices-table .document-meta-line {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin: 0 0 6px;
}
.invoices-table .document-meta-line .doc-type-pill {
    min-height: 25px;
    margin: 0;
    padding: 5px 10px;
    border: 1px solid #9fd7b4;
    border-radius: 6px;
    background: #e8f7ee;
    color: #146c43;
    font-size: 11.5px;
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: .015em;
    box-shadow: 0 1px 2px rgba(33, 37, 41, .06);
}
.invoices-table .document-meta-line .document-created-by {
    display: inline;
    margin: 0;
    color: #68737d;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.2;
}

/* Badge KSeF: białe tło, czarny obrys, czerwone wyłącznie „e”. */
.badge.badge-ksef {
    background: #fff !important;
    border-color: #16191d !important;
    color: #16191d !important;
    box-shadow: 0 1px 3px rgba(33, 37, 41, .08);
}

/* Przycisk wizualizacji zgodny z badge KSeF. */
.btn-ksef-visual,
.btn-ksef-visual.btn-outline {
    background: #fff !important;
    color: #16191d !important;
    border: 1px solid #16191d !important;
    box-shadow: 0 3px 8px rgba(33, 37, 41, .06);
}
.btn-ksef-visual:hover,
.btn-ksef-visual.btn-outline:hover {
    background: #f7f8f8 !important;
    color: #111418 !important;
    border-color: #000 !important;
    box-shadow: 0 5px 12px rgba(33, 37, 41, .10);
}
.ksef-inline-wordmark {
    display: inline-flex;
    align-items: baseline;
    color: #16191d;
    font-weight: 900;
    letter-spacing: .01em;
}
.ksef-inline-wordmark > span {
    color: #dc3545;
}

/* Logowanie korzysta z tej samej warstwy tła co nagłówek aplikacji. */
.login-body {
    background-color: #f7faf9;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1100' height='82' viewBox='0 0 1100 82'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 54h132l18-18h118l18 18h180' stroke='%23D47A1F' stroke-opacity='.18' stroke-width='1.2'/%3E%3Cpath d='M430 26h112l18 18h118l18-18h148l20 20h118' stroke='%23263d52' stroke-opacity='.14' stroke-width='1.15'/%3E%3Cpath d='M86 0v21l18 18v43M942 0v26l-20 20v36' stroke='%23D47A1F' stroke-opacity='.14' stroke-width='1.1'/%3E%3Cpath d='M328 82v-18l18-18h126' stroke='%23263d52' stroke-opacity='.10' stroke-width='1.05'/%3E%3Ccircle cx='132' cy='54' r='2.7' fill='%23D47A1F' fill-opacity='.28' stroke='none'/%3E%3Ccircle cx='466' cy='54' r='2.7' fill='%23263d52' fill-opacity='.18' stroke='none'/%3E%3Ccircle cx='812' cy='44' r='2.7' fill='%23D47A1F' fill-opacity='.24' stroke='none'/%3E%3Ccircle cx='1052' cy='46' r='2.7' fill='%23263d52' fill-opacity='.16' stroke='none'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(90deg, rgba(38,61,82,.035) 0, rgba(38,61,82,.035) 1px, transparent 1px, transparent 140px),
        radial-gradient(circle at 14% 28%, rgba(212, 122, 31, .11), transparent 25%),
        radial-gradient(circle at 88% 22%, rgba(38, 61, 82, .08), transparent 22%),
        linear-gradient(180deg, rgba(255,255,255,.99), rgba(244,248,247,.99));
    background-repeat: repeat, repeat, no-repeat, no-repeat, no-repeat;
    background-position: center top, center, center, center, center;
    background-size: 1100px 82px, auto, auto, auto, auto;
}


/* VERTIS INFRA — końcowy szlif tabeli faktur i wariantów KSeF */
/* Dokument otrzymuje więcej miejsca, kontrahent jest bardziej zwarty. */
.invoices-table:not(.invoices-table-no-check) th:nth-child(6),
.invoices-table:not(.invoices-table-no-check) td:nth-child(6) {
    width: 285px !important;
    min-width: 285px !important;
}
.invoices-table:not(.invoices-table-no-check) th:nth-child(7),
.invoices-table:not(.invoices-table-no-check) td:nth-child(7) {
    width: 230px !important;
    min-width: 230px !important;
}
.invoices-table-no-check th:nth-child(5),
.invoices-table-no-check td:nth-child(5) {
    width: 285px !important;
    min-width: 285px !important;
}
.invoices-table-no-check th:nth-child(6),
.invoices-table-no-check td:nth-child(6) {
    width: 230px !important;
    min-width: 230px !important;
}

/* Bliźniacze badge typu dokumentu i autora — autor biały, z czarnym tekstem. */
.invoices-table .document-meta-line {
    flex-wrap: nowrap;
    gap: 6px;
    max-width: 100%;
}
.invoices-table .document-meta-line .doc-type-pill,
.invoices-table .document-meta-line .document-created-by {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin: 0;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 850;
    line-height: 1;
    letter-spacing: .01em;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(33, 37, 41, .05);
}
.invoices-table .document-meta-line .document-created-by {
    color: #16191d;
    background: #fff;
    border: 1px solid #69737d;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Podmiot 3 jest celowo krótszy od głównych danych kontrahenta. */
.contractor-cell .contractor-third-subject {
    font-size: 10.5px;
    line-height: 1.18;
    font-weight: 750;
    color: #596572;
}

/* KSeF oraz wizualizacja KSeF: bez jakiegokolwiek gradientu lub zielonego tonu. */
button.btn.btn-ksef,
button.btn.btn-ksef.btn-outline,
.btn-ksef,
.btn-ksef.btn-outline,
button.btn.btn-ksef-visual,
button.btn.btn-ksef-visual.btn-outline,
.btn-ksef-visual,
.btn-ksef-visual.btn-outline {
    background-color: #fff !important;
    background-image: none !important;
    color: #16191d !important;
    border-color: #16191d !important;
    box-shadow: 0 2px 7px rgba(33, 37, 41, .055) !important;
}
button.btn.btn-ksef:hover,
button.btn.btn-ksef.btn-outline:hover,
.btn-ksef:hover,
.btn-ksef.btn-outline:hover,
button.btn.btn-ksef-visual:hover,
button.btn.btn-ksef-visual.btn-outline:hover,
.btn-ksef-visual:hover,
.btn-ksef-visual.btn-outline:hover {
    background-color: #f6f7f7 !important;
    background-image: none !important;
    color: #111418 !important;
    border-color: #000 !important;
    box-shadow: 0 4px 10px rgba(33, 37, 41, .09) !important;
}
.badge.badge-ksef {
    background-color: #fff !important;
    background-image: none !important;
}

/* Ekran logowania: osobna kompozycja soft-tech, jedynie stylistycznie zgodna z nagłówkiem. */
.login-body {
    background-color: #f5f9f7;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1440' height='900' viewBox='0 0 1440 900'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 168h168l54 54h206l42-42h126' stroke='%23D47A1F' stroke-opacity='.16' stroke-width='1.3'/%3E%3Cpath d='M0 316h108l64-64h146l44 44h164' stroke='%23263d52' stroke-opacity='.10' stroke-width='1.15'/%3E%3Cpath d='M0 682h214l48-48h186l34 34h150' stroke='%23D47A1F' stroke-opacity='.105' stroke-width='1.2'/%3E%3Cpath d='M1440 146h-176l-58 58h-180l-38-38H842' stroke='%23263d52' stroke-opacity='.115' stroke-width='1.2'/%3E%3Cpath d='M1440 354h-112l-62-62h-154l-48 48H920' stroke='%23D47A1F' stroke-opacity='.14' stroke-width='1.25'/%3E%3Cpath d='M1440 704h-228l-46-46h-172l-42 42H804' stroke='%23263d52' stroke-opacity='.09' stroke-width='1.15'/%3E%3Cpath d='M152 0v104l34 34v126M1288 0v96l-38 38v132M262 900V790l42-42v-104M1190 900V784l-36-36V632' stroke='%23D47A1F' stroke-opacity='.09' stroke-width='1.1'/%3E%3Cpath d='M540 116h360M540 784h360' stroke='%23263d52' stroke-opacity='.055' stroke-dasharray='3 13'/%3E%3Ccircle cx='168' cy='168' r='3' fill='%23D47A1F' fill-opacity='.28' stroke='none'/%3E%3Ccircle cx='428' cy='222' r='3' fill='%23263d52' fill-opacity='.18' stroke='none'/%3E%3Ccircle cx='1264' cy='146' r='3' fill='%23263d52' fill-opacity='.19' stroke='none'/%3E%3Ccircle cx='1112' cy='292' r='3' fill='%23D47A1F' fill-opacity='.25' stroke='none'/%3E%3Ccircle cx='262' cy='634' r='3' fill='%23D47A1F' fill-opacity='.20' stroke='none'/%3E%3Ccircle cx='1166' cy='658' r='3' fill='%23263d52' fill-opacity='.15' stroke='none'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(circle at 16% 18%, rgba(212, 122, 31, .10), transparent 26%),
        radial-gradient(circle at 86% 24%, rgba(38, 61, 82, .075), transparent 24%),
        radial-gradient(circle at 50% 78%, rgba(212, 122, 31, .055), transparent 30%),
        linear-gradient(145deg, #fbfdfc 0%, #f2f7f5 48%, #f8faf9 100%);
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
    background-position: center, center, center, center, center;
    background-size: cover, auto, auto, auto, auto;
}

/* VERTIS INFRA — finalna korekta switcha KSeF i badge pracownika */
.ksef-preview-mode-switch {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 220px !important;
    min-width: 220px !important;
    flex: 0 0 220px !important;
    gap: 3px !important;
    padding: 3px !important;
    border: 1px solid #aeb5bb !important;
    border-radius: 8px !important;
    background: #cfd4d9 !important;
    overflow: hidden !important;
}
.ksef-preview-mode-switch .btn,
.ksef-preview-mode-switch .btn:hover,
.ksef-preview-mode-switch .btn[aria-pressed="false"],
.ksef-preview-mode-switch .btn[aria-pressed="false"]:hover {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 32px !important;
    margin: 0 !important;
    padding: 6px 9px !important;
    border: 1px solid transparent !important;
    border-radius: 5px !important;
    background: #e1e4e7 !important;
    background-image: none !important;
    color: #212529 !important;
    font-weight: 750 !important;
    line-height: 1.15 !important;
    box-shadow: none !important;
    transform: none !important;
    white-space: nowrap !important;
}
.ksef-preview-mode-switch .btn[aria-pressed="false"]:hover {
    background: #d7dce0 !important;
    color: #111 !important;
}
.ksef-preview-mode-switch .btn.active,
.ksef-preview-mode-switch .btn.active:hover,
.ksef-preview-mode-switch .btn[aria-pressed="true"],
.ksef-preview-mode-switch .btn[aria-pressed="true"]:hover {
    background: #D47A1F !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #D47A1F !important;
    font-weight: 850 !important;
    box-shadow: none !important;
}
.ksef-preview-mode-switch .btn:focus-visible {
    outline: 2px solid #212529 !important;
    outline-offset: -2px !important;
}

.invoices-table .status-cell {
    display: table-cell;
}
.invoices-table .status-cell .badge,
.invoices-table .status-cell .invoice-assigned-pill {
    display: flex;
    width: 100%;
    min-height: 25px;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 850;
    line-height: 1.08;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.invoices-table .status-cell .invoice-assigned-pill {
    margin-top: 5px;
    color: #16191d;
    background: #fff;
    border: 1px solid #69737d;
    box-shadow: 0 1px 2px rgba(33, 37, 41, .05);
}

@media (max-width: 560px) {
    .ksef-preview-mode-switch {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        flex-basis: auto !important;
    }
}


/* VERTIS INFRA — końcowa korekta switcha KSeF i zamykania modali */
.ksef-preview-mode-switch .btn.active,
.ksef-preview-mode-switch .btn.active:hover,
.ksef-preview-mode-switch .btn[aria-pressed="true"],
.ksef-preview-mode-switch .btn[aria-pressed="true"]:hover {
    background: #edf8f0 !important;
    background-image: none !important;
    color: #198754 !important;
    border-color: #D47A1F !important;
    font-weight: 850 !important;
    box-shadow: inset 0 0 0 1px rgba(212, 122, 31, .08) !important;
}
.ksef-preview-mode-switch .btn.active:hover,
.ksef-preview-mode-switch .btn[aria-pressed="true"]:hover {
    background: #e3f4e8 !important;
    color: #146c43 !important;
}

.modal-close,
a.modal-close,
button.modal-close,
.invoice-preview-card .modal-close {
    top: 6px !important;
    right: 6px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 7px !important;
}
.modal-close::before,
a.modal-close::before,
button.modal-close::before,
.invoice-preview-card .modal-close::before {
    font-size: 24px !important;
    transform: translateY(-1px) !important;
}

/* ========================================================================== */
/* MODUŁ ZADANIA                                                             */
/* ========================================================================== */

.nav-group summary {
    position: relative;
}
.nav-count-badge {
    display: inline-flex;
    min-width: 21px;
    height: 21px;
    margin-left: 8px;
    padding: 0 6px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.task-page-head,
.task-detail-head {
    align-items: flex-end;
}
.task-page-head .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.task-filter-panel {
    padding-block: 14px;
}
.task-filter-form {
    display: grid;
    grid-template-columns: minmax(210px, 1.6fr) repeat(3, minmax(145px, .8fr)) repeat(2, minmax(145px, .8fr));
    gap: 12px;
    align-items: end;
}
.task-filter-form label {
    display: grid;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
}
.task-filter-form input,
.task-filter-form select,
.task-filter-form .btn {
    min-height: 42px;
}
.task-filter-form .check-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--dark);
}
.task-filter-form .check-inline input {
    width: 17px;
    min-height: auto;
}
.task-list-panel {
    padding: 0;
}
.task-list-panel .pagination-topline {
    padding: 16px 18px 8px;
}
.task-table th:first-child,
.task-table td:first-child {
    width: 120px;
}
.task-table th:nth-child(3),
.task-table td:nth-child(3),
.task-table th:nth-child(5),
.task-table td:nth-child(5),
.task-table th:last-child,
.task-table td:last-child {
    white-space: nowrap;
}
.task-row-overdue {
    background: rgba(220, 53, 69, .035);
}
.task-due-cell {
    display: grid;
    gap: 3px;
}
.task-due-cell strong {
    font-size: 14px;
}
.task-due-cell small,
.task-description-preview,
.task-table td > small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}
.task-title-link {
    display: inline-block;
    margin-bottom: 4px;
    color: var(--dark);
    font-weight: 900;
    text-decoration: none;
}
.task-title-link:hover {
    color: var(--green-dark);
}
.task-recurrence-note {
    display: block;
    margin-top: 7px;
    color: var(--green-dark);
    font-size: 11px;
    font-weight: 850;
}
.task-participant-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.task-participant-chips span {
    padding: 4px 7px;
    border: 1px solid rgba(33, 37, 41, .1);
    background: #f5f6f7;
    color: #343a40;
    font-size: 11px;
    font-weight: 750;
}
.badge-task-own {
    background: rgba(33, 37, 41, .08);
    color: #343a40;
}
.badge-task-assigned {
    background: rgba(13, 110, 253, .12);
    color: #0a58ca;
}
.badge-task-todo {
    background: rgba(108, 117, 125, .13);
    color: #495057;
}
.badge-task-in-progress {
    background: rgba(13, 110, 253, .13);
    color: #0a58ca;
}
.badge-task-review {
    background: rgba(255, 193, 7, .22);
    color: #765300;
}
.badge-task-closed {
    background: rgba(212, 122, 31, .15);
    color: var(--green-dark);
}
.badge-task-cancelled,
.badge-task-overdue {
    background: rgba(220, 53, 69, .12);
    color: #a51d2a;
}
.badge-task-recurring {
    background: rgba(212, 122, 31, .1);
    color: var(--green-dark);
}
.task-modal-card {
    width: min(820px, 100%);
}
.task-modal-card select[multiple] {
    min-height: 150px;
}
.task-form-section {
    padding: 14px;
    border: 1px solid var(--border);
    background: #f8f9fa;
}
.task-form-section h3 {
    margin: 0 0 12px;
    font-size: 15px;
}
.task-recurrence-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.task-recurrence-fields label {
    margin: 0;
}

.task-notifications-panel {
    border-left: 4px solid var(--green);
}
.task-notification-list {
    display: grid;
    gap: 8px;
}
.task-notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    background: #fff;
}
.task-notification-item > a {
    display: grid;
    gap: 3px;
    color: var(--dark);
    text-decoration: none;
}
.task-notification-item small {
    color: var(--muted);
}
.task-notification-item form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-back-link {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
}
.task-detail-statuses {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.task-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(300px, .8fr);
    gap: 18px;
    align-items: start;
}
.task-detail-grid-lower {
    margin-top: 0;
}
.task-main-panel,
.task-participants-panel,
.task-result-panel,
.task-files-panel,
.task-comments-panel,
.task-history-panel {
    min-width: 0;
}
.task-description-full,
.task-result-content {
    padding: 15px;
    border-left: 3px solid var(--green);
    background: #f8f9fa;
    line-height: 1.65;
}
.task-meta-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0 0;
}
.task-meta-list > div {
    padding: 11px;
    border: 1px solid var(--border);
    background: #fff;
}
.task-meta-list dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}
.task-meta-list dd {
    margin: 0;
    font-weight: 800;
}
.task-cycle-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.task-cycle-links span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.task-participant-list,
.task-file-list,
.task-comment-list,
.task-history-list {
    display: grid;
    gap: 9px;
}
.task-participant-row,
.task-file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    background: #fff;
}
.task-participant-row > div,
.task-file-row > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.task-participant-row small,
.task-file-row small {
    color: var(--muted);
    font-size: 11px;
}
.task-file-row a {
    overflow-wrap: anywhere;
    color: var(--green-dark);
    font-weight: 850;
    text-decoration: none;
}
.task-participant-row form,
.task-file-row form {
    display: flex;
    align-items: center;
    gap: 6px;
}
.task-participant-add-form,
.task-file-upload-form {
    display: grid;
    gap: 9px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.task-rule-note {
    margin: 14px 0 0;
    padding: 10px;
    background: #f8f9fa;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}
.task-workflow-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 16px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}
.task-workflow-actions form {
    display: flex;
    align-items: center;
    gap: 6px;
}
.task-return-form,
.task-cancel-form {
    display: grid;
    gap: 9px;
    margin-top: 14px;
    padding: 13px;
    border: 1px solid var(--border);
    background: #f8f9fa;
}
.task-cancel-form {
    border-color: rgba(220, 53, 69, .2);
    background: rgba(220, 53, 69, .035);
}
.task-closed-box,
.task-cancelled-box {
    margin-top: 15px;
    padding: 13px;
    border: 1px solid rgba(212, 122, 31, .25);
    background: rgba(212, 122, 31, .06);
}
.task-cancelled-box {
    border-color: rgba(220, 53, 69, .25);
    background: rgba(220, 53, 69, .05);
}
.task-closed-box p,
.task-cancelled-box p {
    margin: 5px 0 0;
}
.task-comment {
    padding: 12px;
    border: 1px solid var(--border);
    background: #fff;
}
.task-comment-return {
    border-left: 3px solid #ffc107;
    background: #fffaf0;
}
.task-comment > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.task-comment small {
    color: var(--muted);
}
.task-comment p {
    margin: 8px 0 0;
    line-height: 1.55;
}
.task-comment-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.task-history-item {
    display: grid;
    gap: 2px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.task-history-item:last-child {
    border-bottom: 0;
}
.task-history-item span,
.task-history-item small {
    color: var(--muted);
    font-size: 11px;
}
.task-edit-form .task-recurrence-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1200px) {
    .task-filter-form {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }
    .task-recurrence-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .task-detail-grid {
        grid-template-columns: 1fr;
    }
    .task-detail-statuses {
        justify-content: flex-start;
    }
    .task-page-head,
    .task-detail-head {
        align-items: flex-start;
    }
    .task-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .task-filter-form,
    .task-recurrence-fields,
    .task-edit-form .task-recurrence-fields,
    .task-meta-list {
        grid-template-columns: 1fr;
    }
    .task-page-head .actions,
    .task-page-head .actions .btn,
    .task-workflow-actions,
    .task-workflow-actions form,
    .task-workflow-actions .btn {
        width: 100%;
    }
    .task-notification-item,
    .task-participant-row,
    .task-file-row,
    .task-comment > div,
    .task-cycle-links {
        align-items: stretch;
        flex-direction: column;
    }
    .task-table th:nth-child(4),
    .task-table td:nth-child(4) {
        min-width: 190px;
    }
}


/* ========================================================================== */
/* MODUŁ ZADANIA — korekta UI 24.07.2026                                     */
/* ========================================================================== */

.nav-group[data-nav-group="zadania"] > summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8'%3E%3Crect x='4' y='3' width='16' height='18' rx='2'/%3E%3Cpath d='M9 3.5h6v3H9zM8 11l2 2 4-4M8 17h8'/%3E%3C/svg%3E");
}

/* Po dołożeniu czwartego kafla pulpit zachowuje jeden rząd na desktopie. */
.dashboard-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.required-mark {
    color: #c82333;
    font-weight: 950;
}

.task-title-due-grid,
.task-title-due-summary {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(230px, .72fr);
    gap: 14px;
    align-items: start;
}
.task-title-due-grid > label {
    margin: 0;
}
.task-title-due-summary {
    margin-bottom: 15px;
}
.task-title-due-summary > div {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: #fff;
}
.task-title-due-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.task-title-due-summary strong {
    overflow-wrap: anywhere;
    font-size: 15px;
}

.task-participant-picker {
    min-width: 0;
    margin: 0;
    padding: 13px;
    border: 1px solid var(--border);
    background: #f8f9fa;
}
.task-participant-picker legend {
    padding: 0 6px;
    color: var(--dark);
    font-size: 13px;
    font-weight: 850;
}
.task-participant-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    max-height: 230px;
    padding: 3px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.task-participant-option {
    display: flex !important;
    min-width: 0;
    min-height: 48px;
    margin: 0 !important;
    padding: 9px 10px;
    align-items: center;
    gap: 9px !important;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
}
.task-participant-option:hover {
    border-color: rgba(212, 122, 31, .55);
    background: #f3faf5;
}
.task-participant-option:has(input:checked) {
    border-color: var(--green);
    background: #edf8f0;
    box-shadow: inset 3px 0 0 var(--green);
}
.task-participant-option input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    min-height: auto !important;
    margin: 0;
}
.task-participant-option > span {
    display: grid;
    min-width: 0;
    gap: 2px;
}
.task-participant-option strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}
.task-participant-option small {
    color: var(--muted);
    font-size: 11px;
}
.task-participant-picker > small {
    display: block;
    margin-top: 8px;
}

.task-action-toolbar {
    display: flex;
    margin-bottom: 18px;
    padding: 13px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-left: 4px solid var(--green);
}
.task-action-toolbar > div:first-child {
    display: grid;
    gap: 2px;
}
.task-action-toolbar > div:first-child span {
    color: var(--muted);
    font-size: 12px;
}
.task-workflow-actions-top {
    margin: 0;
    padding: 0;
    border: 0;
    justify-content: flex-end;
}
.task-workflow-actions-top .form-message {
    display: none;
}

.task-side-stack {
    display: grid;
    gap: 18px;
    min-width: 0;
}
.task-recurrence-edit-form .task-recurrence-fields {
    grid-template-columns: 1fr;
}
.task-recurrence-summary {
    display: grid;
    gap: 8px;
    margin: 0;
}
.task-recurrence-summary > div {
    padding: 10px;
    border: 1px solid var(--border);
    background: #fff;
}
.task-recurrence-summary dt {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.task-recurrence-summary dd {
    margin: 0;
    font-weight: 800;
}

.task-result-panel-full,
.task-history-panel-full {
    margin-top: 18px;
}
.task-history-panel-full {
    padding: 0;
}
.task-history-panel-full > .section-head-row {
    padding: 18px 18px 8px;
}
.task-history-table th:first-child,
.task-history-table td:first-child {
    width: 165px;
    white-space: nowrap;
}
.task-history-table th:nth-child(2),
.task-history-table td:nth-child(2) {
    width: 190px;
}
.task-history-table th:nth-child(3),
.task-history-table td:nth-child(3) {
    width: 165px;
}
.task-cancel-modal-card {
    width: min(580px, 100%);
}

/* Tabela list zadań — proporcje i badge zgodne z rejestrem faktur. */
.task-table {
    table-layout: fixed;
    width: 100%;
}
.task-table th:nth-child(1),
.task-table td:nth-child(1) { width: 64px; }
.task-table th:nth-child(2),
.task-table td:nth-child(2) { width: 112px; }
.task-table th:nth-child(3),
.task-table td:nth-child(3) { width: auto; }
.task-table th:nth-child(4),
.task-table td:nth-child(4) { width: 132px; }
.task-table th:nth-child(5),
.task-table td:nth-child(5) { width: 180px; }
.task-table th:nth-child(6),
.task-table td:nth-child(6) { width: 124px; }
.task-table th:nth-child(7),
.task-table td:nth-child(7) { width: 88px; }
.task-index-cell {
    text-align: center;
}
.task-index-cell strong {
    display: block;
    font-size: 14px;
}
.task-index-cell small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}
.task-table td:nth-child(3) {
    padding-right: 18px;
}
.task-table td:nth-child(6) .badge,
.task-table td:nth-child(4) > .badge {
    display: flex;
    width: 100%;
    min-height: 27px;
    padding: 5px 8px;
    align-items: center;
    justify-content: center;
    border: 1px solid currentColor;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 850;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
}
.task-table td:nth-child(7) .btn {
    width: 100%;
    padding-inline: 7px;
}
.task-participant-chips {
    display: grid;
    gap: 5px;
}
.task-participant-chips span {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    border-radius: 5px;
}

@media (max-width: 1250px) {
    .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .task-table th:nth-child(5),
    .task-table td:nth-child(5) { width: 150px; }
}
@media (max-width: 900px) {
    .task-action-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
    .task-workflow-actions-top {
        justify-content: flex-start;
    }
    .task-title-due-grid,
    .task-title-due-summary {
        grid-template-columns: 1fr;
    }
    .task-participant-checklist {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 700px) {
    .dashboard-metrics { grid-template-columns: 1fr; }
    .task-workflow-actions-top,
    .task-workflow-actions-top form,
    .task-workflow-actions-top .btn {
        width: 100%;
    }
}


/* Dodatkowe domknięcie proporcji tabeli po dodaniu kolumny L.P. */
.task-table {
    min-width: 1080px;
}
.task-table th:nth-child(3),
.task-table td:nth-child(3),
.task-table th:nth-child(5),
.task-table td:nth-child(5) {
    white-space: normal;
}
.task-table th:nth-child(4),
.task-table td:nth-child(4),
.task-table th:nth-child(6),
.task-table td:nth-child(6),
.task-table th:nth-child(7),
.task-table td:nth-child(7) {
    white-space: nowrap;
}
.task-due-cell {
    display: table-cell;
}
.task-due-cell strong,
.task-due-cell small,
.task-due-cell .badge {
    display: block;
}

/* Kontrast badge zgodny z paletą statusów rejestru faktur. */
.task-table .badge-task-own {
    background: #e9ecef;
    color: #343a40;
    border-color: #adb5bd;
}
.task-table .badge-task-assigned,
.task-table .badge-task-in-progress {
    background: #e7f1ff;
    color: #084298;
    border-color: #9ec5fe;
}
.task-table .badge-task-todo {
    background: #fff3cd;
    color: #664d03;
    border-color: #e7c85c;
}
.task-table .badge-task-review {
    background: #fff0d4;
    color: #7a4b00;
    border-color: #e8bd72;
}
.task-table .badge-task-closed {
    background: #d1e7dd;
    color: #0f5132;
    border-color: #75b798;
}
.task-table .badge-task-cancelled,
.task-table .badge-task-overdue {
    background: #f8d7da;
    color: #842029;
    border-color: #f1aeb5;
}


/* ========================================================================== */
/* MODUŁ ZADANIA — ujednolicenie list, szczegółów i kalendarz 24.07.2026      */
/* ========================================================================== */

.task-filter-form { display: grid; grid-template-columns: 1fr; gap: 12px; }
.task-filter-main {
    display: grid;
    grid-template-columns: minmax(220px, 1.7fr) repeat(2, minmax(135px, .75fr)) minmax(150px, .9fr) repeat(2, minmax(140px, .72fr)) auto;
    gap: 10px;
    align-items: end;
}
.task-filter-main label,
.task-filter-bottom label { display: grid; gap: 5px; margin: 0; font-size: 12px; font-weight: 800; color: var(--muted); }
.task-filter-main input,
.task-filter-main select { min-height: 42px; }
.task-filter-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.task-filter-checks,
.task-filter-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-filter-bottom .check-inline { display: inline-flex; min-height: 38px; padding: 0 11px; align-items: center; gap: 8px; border: 1px solid var(--border); background: #fff; color: var(--dark); }
.task-filter-bottom .check-inline input { width: 17px; height: 17px; min-height: auto; }
.task-filter-main .per-page-control { display: grid; gap: 5px; }
.task-filter-main .per-page-control select { min-width: 82px; width: 82px; }

.task-list-panel { padding: 18px; }
.task-list-panel .pagination-topline { padding: 0 0 10px; }
.task-table { table-layout: fixed; }
.task-table th { text-align: center; vertical-align: middle; }
.task-table td { padding: 10px 12px; vertical-align: middle; }
.task-table th:nth-child(1), .task-table td:nth-child(1) { width: 66px; text-align: center; }
.task-table th:nth-child(2), .task-table td:nth-child(2) { width: 118px; text-align: center; }
.task-table th:nth-child(3), .task-table td:nth-child(3) { width: 34%; white-space: normal; }
.task-table th:nth-child(4), .task-table td:nth-child(4) { width: 135px; text-align: center; }
.task-table th:nth-child(5), .task-table td:nth-child(5) { width: 20%; white-space: normal; }
.task-table th:nth-child(6), .task-table td:nth-child(6) { width: 145px; text-align: center; }
.task-table th:nth-child(7), .task-table td:nth-child(7) { width: 96px; text-align: center; }
.task-index-cell strong { display: block; font-weight: 900; }
.task-index-cell small { display: block; margin-top: 3px; color: #6f7a85; font-size: 11.5px; font-weight: 800; }
.task-due-cell { display: table-cell; text-align: center; }
.task-title-cell { overflow-wrap: anywhere; }
.task-type-badge,
.task-status-badge {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 850;
    line-height: 1.08;
    text-align: center;
    box-shadow: 0 1px 2px rgba(33,37,41,.06);
}
.task-status-cell .task-status-badge { width: 100%; }
.badge-task-todo { background: #f1f3f5; color: #343a40; border-color: #c7ccd1; }
.badge-task-in-progress { background: #e7f1ff; color: #084298; border-color: #9ec5fe; }
.badge-task-review { background: #fff3cd; color: #664d03; border-color: #e7c85c; }
.badge-task-closed { background: #d1e7dd; color: #0f5132; border-color: #75b798; }
.badge-task-cancelled, .badge-task-overdue { background: #f8d7da; color: #842029; border-color: #f1aeb5; }
.badge-task-recurring { background: #e8f7ee; color: #146c43; border-color: #9fd7b4; }
.badge-task-own { background: #f1f3f5; color: #343a40; border-color: #c7ccd1; }
.badge-task-assigned { background: #e7f1ff; color: #084298; border-color: #9ec5fe; }

.task-detail-columns { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(310px, .72fr); gap: 18px; align-items: start; }
.task-detail-column { display: grid; gap: 18px; min-width: 0; }
.task-main-panel [hidden] { display: none !important; }
.task-comment-head { display: flex !important; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-comment-head > div { display: grid; gap: 2px; }
.task-comment-head form { display: flex; align-items: center; gap: 5px; }
.task-result-locked { padding: 14px; border: 1px dashed #b8c0c8; background: #f8f9fa; color: var(--muted); }
.task-result-locked strong { display: block; margin-bottom: 4px; color: var(--dark); }
.task-result-locked p { margin: 0; }
.task-history-panel { padding: 18px; }
.task-history-panel .task-history-table th { text-align: center; }
.task-history-panel .task-history-table td { vertical-align: middle; }
.task-recurrence-panel { padding: 0; overflow: hidden; }
.task-recurrence-details > summary { display: flex; padding: 16px 18px; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.task-recurrence-details > summary::-webkit-details-marker { display: none; }
.task-recurrence-details > summary::after { content: "⌄"; color: var(--green-dark); font-size: 18px; font-weight: 900; transition: transform .18s ease; }
.task-recurrence-details[open] > summary::after { transform: rotate(180deg); }
.task-recurrence-details > summary span { display: grid; gap: 3px; }
.task-recurrence-details > summary small { color: var(--muted); font-size: 11px; }
.task-recurrence-content { padding: 0 18px 18px; border-top: 1px solid var(--border); }
.task-recurrence-content form, .task-recurrence-content dl { margin-top: 14px; }

.task-calendar-panel { padding: 18px; overflow-x: auto; }
.task-calendar-toolbar { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin-bottom: 16px; }
.task-calendar-toolbar > div { text-align: center; }
.task-calendar-toolbar h2 { margin: 0 0 3px; text-transform: capitalize; }
.task-calendar-toolbar > div a { color: var(--green-dark); font-size: 12px; font-weight: 800; text-decoration: none; }
.task-calendar-weekdays, .task-calendar-grid { min-width: 980px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.task-calendar-weekdays { border: 1px solid var(--border); border-bottom: 0; background: #f1f3f5; }
.task-calendar-weekdays span { padding: 9px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.task-calendar-grid { border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.task-calendar-day { min-height: 145px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fff; }
.task-calendar-day.is-outside { background: #f7f8f9; color: #9aa1a8; }
.task-calendar-day.is-today { box-shadow: inset 0 0 0 2px var(--green); }
.task-calendar-day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.task-calendar-day-head > span { display: inline-flex; width: 25px; height: 25px; align-items: center; justify-content: center; font-weight: 900; }
.task-calendar-day.is-today .task-calendar-day-head > span { background: var(--green); color: #fff; }
.task-calendar-day-head small { color: var(--green-dark); font-size: 10px; font-weight: 850; }
.task-calendar-day-items { display: grid; gap: 5px; }
.task-calendar-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px; padding: 6px 7px; align-items: start; border: 1px solid #c7ccd1; border-left: 3px solid #6c757d; background: #f8f9fa; color: #212529; text-decoration: none; }
.task-calendar-item span { font-size: 10px; font-weight: 900; }
.task-calendar-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.task-calendar-item.badge-task-in-progress { border-left-color: #0d6efd; background: #e7f1ff; }
.task-calendar-item.badge-task-review { border-left-color: #d39e00; background: #fff3cd; }
.task-calendar-item.badge-task-closed { border-left-color: #D47A1F; background: #e8f7ee; }
.task-calendar-item.badge-task-cancelled, .task-calendar-item.is-overdue { border-left-color: #dc3545; background: #f8d7da; }

@media (max-width: 1250px) {
    .task-filter-main { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
}
@media (max-width: 980px) {
    .task-detail-columns { grid-template-columns: 1fr; }
    .task-filter-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .task-filter-main { grid-template-columns: 1fr; }
    .task-filter-bottom { align-items: stretch; flex-direction: column; }
    .task-filter-actions .btn { flex: 1 1 auto; }
    .task-title-due-grid, .task-title-due-summary { grid-template-columns: 1fr; }
    .task-calendar-toolbar { grid-template-columns: 1fr 1fr; }
    .task-calendar-toolbar > div { grid-column: 1 / -1; grid-row: 1; }
}

.history-per-page-form { margin: 0; }
.history-per-page-form .per-page-control { margin: 0; }


/* ========================================================================== */
/* PULPIT PRACOWNIKA — zwarty widok bieżącej pracy                            */
/* ========================================================================== */
.employee-dashboard {
    display: grid;
    gap: 12px;
    align-content: start;
}
.employee-dashboard-head {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background:
        radial-gradient(circle at 94% 0%, rgba(212, 122, 31, .10), transparent 32%),
        linear-gradient(135deg, #fff 0%, #f8fbf9 100%);
    box-shadow: 0 6px 18px rgba(24, 43, 32, .05);
}
.employee-dashboard-welcome { min-width: 0; }
.employee-dashboard-kicker {
    display: block;
    margin-bottom: 2px;
    color: var(--green-dark);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .11em;
    text-transform: uppercase;
}
.employee-dashboard-welcome h1 {
    margin: 0;
    font-size: clamp(20px, 2vw, 27px);
    line-height: 1.1;
}
.employee-dashboard-welcome p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}
.employee-dashboard-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}
.employee-dashboard-nav a {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid rgba(212, 122, 31, .28);
    border-radius: 7px;
    background: rgba(212, 122, 31, .045);
    color: var(--dark);
    font-size: 11px;
    font-weight: 850;
    text-decoration: none;
}
.employee-dashboard-nav a:hover {
    border-color: var(--green);
    background: rgba(212, 122, 31, .085);
}
.employee-dashboard-nav b {
    min-width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    padding: 0 4px;
    border-radius: 5px;
    background: var(--green);
    color: #fff;
    font-size: 9px;
}
.employee-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}
.employee-stat-card {
    min-height: 82px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    column-gap: 12px;
    align-items: center;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(24, 43, 32, .04);
}
.employee-stat-card:hover {
    border-color: rgba(212, 122, 31, .42);
    box-shadow: 0 6px 16px rgba(24, 43, 32, .07);
}
.employee-stat-card span {
    align-self: end;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .055em;
    text-transform: uppercase;
}
.employee-stat-card strong {
    grid-column: 2;
    grid-row: 1 / 3;
    color: var(--green-dark);
    font-size: 32px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.employee-stat-card small {
    align-self: start;
    margin-top: 4px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.25;
}
.employee-stat-card-alert {
    border-color: rgba(220, 53, 69, .26);
    background: linear-gradient(135deg, #fff 0%, #fff8f8 100%);
}
.employee-stat-card-alert strong,
.employee-stat-card-alert small { color: #a51d2a; }
.employee-dashboard-work {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 10px;
    align-items: stretch;
}
.employee-work-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(24, 43, 32, .045);
}
.employee-work-head {
    min-height: 51px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
    background: #fafcfb;
}
.employee-work-head div { min-width: 0; }
.employee-work-head span,
.employee-work-head strong { display: block; }
.employee-work-head span {
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.employee-work-head strong {
    margin-top: 2px;
    font-size: 13px;
}
.employee-work-head > a {
    flex: 0 0 auto;
    color: var(--green-dark);
    font-size: 10.5px;
    font-weight: 900;
    text-decoration: none;
}
.employee-work-head > a:hover { text-decoration: underline; }
.employee-work-list { display: grid; }
.employee-work-item {
    min-height: 57px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 11px;
    border-bottom: 1px solid rgba(222, 229, 224, .78);
    color: inherit;
    text-decoration: none;
}
.employee-work-item:last-child { border-bottom: 0; }
.employee-work-item:hover { background: rgba(212, 122, 31, .035); }
.employee-work-item > div { min-width: 0; }
.employee-work-item strong,
.employee-work-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.employee-work-item strong { font-size: 11.5px; }
.employee-work-item span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}
.employee-work-item small {
    color: var(--muted);
    font-size: 9.5px;
    line-height: 1.35;
    text-align: right;
    white-space: nowrap;
}
.employee-work-item-alert { background: rgba(220, 53, 69, .025); }
.employee-work-item-alert small { color: #a51d2a; font-weight: 850; }
.employee-work-empty {
    min-height: 171px;
    display: grid;
    place-items: center;
    padding: 16px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}
.employee-dashboard-shortcuts {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 9px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(24, 43, 32, .035);
}
.employee-dashboard-shortcuts-head {
    min-width: 78px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3px 6px;
    border-right: 1px solid var(--border);
}
.employee-dashboard-shortcuts-head strong {
    color: var(--dark);
    font-size: 11px;
    line-height: 1.1;
}
.employee-dashboard-shortcuts-head span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 8.5px;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: .045em;
}
.employee-dashboard-shortcuts-grid {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
    gap: 6px;
}
.employee-shortcut-tile {
    min-width: 0;
    min-height: 43px;
    display: grid;
    grid-template-columns: 27px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    padding: 5px 7px;
    border: 1px solid rgba(212, 122, 31, .22);
    border-radius: 7px;
    background: linear-gradient(135deg, rgba(212, 122, 31, .035), rgba(255, 255, 255, .98));
    color: var(--dark);
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.employee-shortcut-tile:hover {
    border-color: rgba(212, 122, 31, .58);
    background: linear-gradient(135deg, rgba(212, 122, 31, .075), rgba(255, 255, 255, .98));
    transform: translateY(-1px);
}
.employee-shortcut-icon {
    width: 27px;
    height: 27px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(212, 122, 31, .18);
    border-radius: 6px;
    background: rgba(212, 122, 31, .065);
    color: var(--green-dark);
    font-size: 12px;
    font-weight: 950;
}
.employee-shortcut-content {
    min-width: 0;
    display: block;
}
.employee-shortcut-content strong,
.employee-shortcut-content small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.employee-shortcut-content strong {
    color: var(--dark);
    font-size: 10px;
    line-height: 1.15;
}
.employee-shortcut-content small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 8.5px;
    line-height: 1.1;
}
@media (max-width: 1050px) {
    .employee-dashboard-work { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .employee-dashboard-head { align-items: flex-start; flex-direction: column; }
    .employee-dashboard-nav { justify-content: flex-start; }
    .employee-dashboard-work { grid-template-columns: 1fr; }
    .employee-work-empty { min-height: 82px; }
    .employee-dashboard-shortcuts { grid-template-columns: 1fr; }
    .employee-dashboard-shortcuts-head {
        min-width: 0;
        display: block;
        padding: 2px 3px 6px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .employee-dashboard-shortcuts-head strong,
    .employee-dashboard-shortcuts-head span { display: inline; }
    .employee-dashboard-shortcuts-head span { margin-left: 5px; }
}
@media (max-width: 520px) {
    .employee-dashboard-stats { grid-template-columns: 1fr; }
    .employee-dashboard-nav a { flex: 1 1 auto; justify-content: center; }
    .employee-dashboard-shortcuts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .employee-shortcut-content small { display: none; }
}

/* ========================================================================== */
/* PULPIT PRACOWNIKA — skalowanie do pełnej przestrzeni ekranu (vw / vh)      */
/* ========================================================================== */
@media (min-width: 761px) {
    .content-area:has(> .employee-dashboard) {
        display: flex;
        flex-direction: column;
        padding: 1.75vh 1.55vw;
    }

    .employee-dashboard {
        width: 100%;
        height: 70vh;
        height: 70dvh;
        min-height: 60vh;
        max-height: 70vh;
        display: grid;
        grid-template-rows:
            minmax(7.2vh, auto)
            minmax(8.4vh, auto)
            minmax(27vh, 1fr)
            minmax(6.2vh, auto);
        gap: 1.05vh;
        align-content: stretch;
    }

    .employee-dashboard-head {
        min-height: 7.2vh;
        gap: 1.25vw;
        padding: 1.05vh 1.05vw;
    }

    .employee-dashboard-welcome h1 {
        font-size: clamp(1.25rem, 1.65vw, 1.75rem);
    }

    .employee-dashboard-welcome p {
        margin-top: .35vh;
        font-size: clamp(.66rem, .72vw, .78rem);
    }

    .employee-dashboard-nav {
        gap: .42vw;
    }

    .employee-dashboard-nav a {
        min-height: 3.05vh;
        padding: .58vh .72vw;
        font-size: clamp(.66rem, .69vw, .76rem);
    }

    .employee-dashboard-stats {
        min-height: 0;
        grid-template-columns: repeat(auto-fit, minmax(15vw, 1fr));
        gap: .72vw;
    }

    .employee-stat-card {
        min-height: 8.4vh;
        height: 100%;
        column-gap: .82vw;
        padding: .85vh .88vw;
    }

    .employee-stat-card strong {
        font-size: clamp(1.65rem, 2.15vw, 2.35rem);
    }

    .employee-dashboard-work {
        min-height: 0;
        height: 100%;
        grid-template-columns: repeat(auto-fit, minmax(21vw, 1fr));
        gap: .72vw;
        align-items: stretch;
    }

    .employee-work-panel {
        min-height: 0;
        height: 100%;
        display: grid;
        grid-template-rows: minmax(4.7vh, auto) minmax(0, 1fr);
    }

    .employee-work-head {
        min-height: 4.7vh;
        gap: .65vw;
        padding: .72vh .78vw;
    }

    .employee-work-list {
        min-height: 0;
        height: 100%;
        display: grid;
        grid-template-rows: repeat(3, minmax(0, 1fr));
    }

    .employee-work-item {
        min-height: 0;
        height: 100%;
        gap: .68vw;
        padding: .68vh .78vw;
    }

    .employee-work-empty {
        min-height: 0;
        height: 100%;
        padding: 1.2vh 1vw;
    }

    .employee-dashboard-shortcuts {
        min-height: 6.2vh;
        height: 100%;
        grid-template-columns: minmax(5.8vw, auto) minmax(0, 1fr);
        gap: .62vw;
        padding: .62vh .5vw;
    }

    .employee-dashboard-shortcuts-head {
        min-width: 5.8vw;
        padding: .35vh .45vw;
    }

    .employee-dashboard-shortcuts-grid {
        grid-template-columns: repeat(auto-fit, minmax(8.7vw, 1fr));
        gap: .42vw;
        align-content: stretch;
    }

    .employee-shortcut-tile {
        min-height: 4.15vh;
        height: 100%;
        grid-template-columns: 2.15vw minmax(0, 1fr);
        gap: .48vw;
        padding: .44vh .48vw;
    }

    .employee-shortcut-icon {
        width: 2.15vw;
        height: 2.15vw;
        min-width: 2.15vw;
        min-height: 2.15vw;
        max-width: 3.4vh;
        max-height: 3.4vh;
        font-size: clamp(.68rem, .76vw, .86rem);
    }
}

/* Niższe ekrany: nadal wypełniamy obszar, ale nie ściskamy treści ponad miarę. */
@media (min-width: 761px) and (max-height: 820px) {
    .employee-dashboard {
        height: 70vh;
        height: 70dvh;
        min-height: 0;
        max-height: 70vh;
        grid-template-rows: auto auto minmax(23vh, 1fr) auto;
    }

    .employee-work-item {
        min-height: 6.1vh;
    }
}

/* Tablet i telefon: naturalny przepływ i przewijanie zamiast sztywnej wysokości. */
@media (max-width: 760px) {
    .content-area:has(> .employee-dashboard) {
        padding: 1.7vh 3.4vw;
    }

    .employee-dashboard {
        width: 100%;
        height: auto;
        min-height: 0;
        grid-template-rows: none;
        gap: 1.35vh;
    }

    .employee-dashboard-head,
    .employee-stat-card,
    .employee-work-panel,
    .employee-dashboard-shortcuts {
        height: auto;
    }
}

/* VERTIS INFRA — konfiguracja aktywnych modułów */
.system-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
}
.system-module-card {
    display: flex;
    flex-direction: column;
    min-height: 225px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: linear-gradient(145deg, #fff 0%, #f8fbf9 100%);
    box-shadow: 0 5px 16px rgba(33, 37, 41, .045);
}
.system-module-card.is-enabled {
    border-color: rgba(212, 122, 31, .38);
}
.system-module-card.is-disabled {
    background: #f6f7f8;
    border-color: #d7dce0;
}
.system-module-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.system-module-icon {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(212, 122, 31, .32);
    border-radius: 8px;
    background: rgba(212, 122, 31, .07);
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .04em;
}
.system-module-card.is-disabled .system-module-icon {
    border-color: #cbd1d6;
    background: #fff;
    color: #6c757d;
}
.system-module-card h3 {
    margin: 14px 0 5px;
    font-size: 18px;
}
.system-module-card p {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
.system-module-select {
    display: grid;
    gap: 5px;
    margin-top: auto;
}
.system-module-select span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.system-module-select select {
    min-height: 38px;
    font-size: 13px;
    font-weight: 750;
}
.module-disabled-panel {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    text-align: left;
}
.module-disabled-icon {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    display: grid;
    place-items: center;
    border: 2px solid #adb5bd;
    border-radius: 10px;
    color: #6c757d;
    font-size: 38px;
    font-weight: 500;
}
.module-disabled-panel h1 { margin: 0 0 8px; }
.module-disabled-panel p { max-width: 650px; margin: 0; color: var(--muted); }
.module-disabled-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

@media (max-width: 720px) {
    .system-modules-grid { grid-template-columns: 1fr; }
    .module-disabled-panel { align-items: flex-start; flex-direction: column; }
}

/* ========================================================================== */
/* VERTIS INFRA — globalny system badge / etykiet (wzorzec: rejestr faktur)     */
/* ========================================================================== */
:root {
    --vertis-badge-radius: 6px;
    --vertis-badge-height: 25px;
    --vertis-badge-font-size: 11px;
    --vertis-badge-shadow: 0 1px 2px rgba(33, 37, 41, .06);
}

.badge,
.doc-type-pill,
.system-role-badge,
.status-badge,
.task-type-badge,
.task-status-badge,
.invoices-table .document-meta-line .document-created-by,
.invoices-table .status-cell .invoice-assigned-pill {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--vertis-badge-height);
    margin: 0;
    padding: 5px 9px;
    border: 1px solid #c7ccd1;
    border-radius: var(--vertis-badge-radius) !important;
    background: #f1f3f5;
    color: #343a40;
    font-size: var(--vertis-badge-font-size);
    font-weight: 850;
    line-height: 1.08;
    letter-spacing: .012em;
    text-align: center;
    white-space: nowrap;
    box-shadow: var(--vertis-badge-shadow);
}

/* Statusy mają wspólną szerokość minimalną, dzięki czemu tabele są spokojniejsze. */
.badge-status,
.status-badge,
.task-status-badge {
    min-width: 108px;
}
.data-table td.status-cell {
    vertical-align: middle;
    text-align: center;
}
.data-table td.status-cell > .badge,
.data-table td.status-cell > .status-badge {
    width: 100%;
}
.badge-button {
    border-radius: var(--vertis-badge-radius) !important;
}

/* Typ dokumentu / typ rekordu — zielony wariant jak w rejestrze faktur. */
.doc-type-pill,
.invoices-table .document-meta-line .doc-type-pill {
    background: #e8f7ee !important;
    color: #146c43 !important;
    border-color: #9fd7b4 !important;
}
.invoices-table .document-meta-line .document-created-by,
.invoices-table .status-cell .invoice-assigned-pill {
    background: #fff !important;
    color: #16191d !important;
    border-color: #69737d !important;
}

/* Paleta statusów — jednakowa we wszystkich modułach. */
.badge.badge-neutral,
.badge.badge-case-nowa,
.badge.badge-robocze,
.badge.badge-task-todo,
.badge.badge-task-own {
    background: #f1f3f5 !important;
    color: #343a40 !important;
    border-color: #c7ccd1 !important;
}
.badge.badge-zadekretowana,
.badge.badge-w-trakcie,
.badge.badge-case-w-trakcie,
.badge.badge-w-toku,
.badge.badge-wniosek,
.badge.badge-task-in-progress,
.badge.badge-task-assigned {
    background: #e7f1ff !important;
    color: #084298 !important;
    border-color: #9ec5fe !important;
}
.badge.badge-nowa,
.badge.badge-warning,
.badge.badge-wstrzymana,
.badge.badge-case-wstrzymana,
.badge.badge-gotowe-do-zatwierdzenia,
.badge.badge-task-review,
.status-badge.status-started {
    background: #fff3cd !important;
    color: #664d03 !important;
    border-color: #e7c85c !important;
}
.badge.badge-przekazana-pracownikowi,
.badge.badge-zatwierdzone,
.badge.badge-zamowienie,
.badge.badge-task-recurring {
    background: #e8f7ee !important;
    color: #146c43 !important;
    border-color: #9fd7b4 !important;
}
.badge.badge-opisana,
.badge.badge-zakonczona,
.badge.badge-case-zakonczona,
.badge.badge-zrealizowane,
.badge.badge-ok,
.badge.badge-task-closed,
.status-badge.status-completed {
    background: #d1e7dd !important;
    color: #0f5132 !important;
    border-color: #75b798 !important;
}
.badge.badge-wykreslona,
.badge.badge-wycofana,
.badge.badge-wycofane,
.badge.badge-odrzucona,
.badge.badge-case-odrzucona,
.badge.badge-anulowany,
.badge.badge-anulowane,
.badge.badge-danger,
.badge.badge-task-cancelled,
.badge.badge-task-overdue,
.status-badge.status-failed {
    background: #f8d7da !important;
    color: #842029 !important;
    border-color: #f1aeb5 !important;
}

/* KSeF pozostaje własnym, białym wordmarkiem. */
.badge.badge-ksef {
    min-width: auto;
    background: #fff !important;
    background-image: none !important;
    color: #16191d !important;
    border-color: #16191d !important;
    box-shadow: 0 1px 3px rgba(33, 37, 41, .08) !important;
}

/* Role użytkowników zachowują własne kolory, ale korzystają z jednego kształtu. */
.system-role-badge {
    min-width: 112px;
}
.system-role-administrator {
    background: #212529 !important;
    color: #fff !important;
    border-color: #212529 !important;
}
.system-role-kierownik {
    background: #e8f7ee !important;
    color: #146c43 !important;
    border-color: #9fd7b4 !important;
}
.system-role-ksiegowosc {
    background: #fff3cd !important;
    color: #664d03 !important;
    border-color: #e7c85c !important;
}
.system-role-kancelaria {
    background: #e7f1ff !important;
    color: #084298 !important;
    border-color: #9ec5fe !important;
}
.system-role-sekretariat {
    background: #ede9fe !important;
    color: #5b21b6 !important;
    border-color: #c4b5fd !important;
}
.system-role-pracownik {
    background: #f1f3f5 !important;
    color: #343a40 !important;
    border-color: #c7ccd1 !important;
}

/* Pozostałe elementy typu pill — ten sam język wizualny, bez okrągłych pastylek. */
.stat-pill,
.order-step-pill,
.order-step-route,
.system-users-filter-counter {
    border-radius: var(--vertis-badge-radius) !important;
    box-shadow: var(--vertis-badge-shadow);
}
.order-step-pill {
    border: 1px solid #9fd7b4;
    background: #e8f7ee;
    color: #146c43;
}
.order-step-route,
.system-users-filter-counter {
    border: 1px solid #c7ccd1;
    background: #fff;
    color: #343a40;
}

/* Licznik w menu jest małą etykietą ostrzegawczą, a nie okrągłą bańką. */
.nav-count-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid #f1aeb5;
    border-radius: var(--vertis-badge-radius) !important;
    background: #f8d7da;
    color: #842029;
    box-shadow: var(--vertis-badge-shadow);
}

/* Czytelna ikona ustawień/systemu — suwaki konfiguracyjne. */
.nav-group[data-nav-group="system"] > summary::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23283d52' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3'/%3E%3Cpath d='M1 14h6M9 8h6M17 16h6'/%3E%3C/svg%3E") !important;
}

@media (max-width: 560px) {
    .badge-status,
    .status-badge,
    .task-status-badge {
        min-width: 0;
    }
}


/* Drobny opis pod pełnoszerokościowym badge statusu. */
.data-table td.status-cell .status-cell-note {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.18;
    text-align: left;
    overflow-wrap: anywhere;
}

/* Domknięcie lokalnych wyjątków, które wcześniej miały własne rozmiary badge. */
.contractor-monitor-cell .badge,
.contractor-inline-badges .badge,
.contractor-name-line .badge,
.date-cell .invoice-source-line .badge,
.task-due-cell .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--vertis-badge-height);
    padding: 5px 9px;
    border-radius: var(--vertis-badge-radius) !important;
    font-size: var(--vertis-badge-font-size);
    font-weight: 850;
    line-height: 1.08;
}
.task-due-cell .badge {
    width: auto;
    margin: 4px auto 0;
}
.order-step-pill,
.order-step-route {
    min-height: 29px;
    padding: 6px 10px;
    font-size: 11.5px;
    line-height: 1.05;
    font-weight: 850;
}

/* CRU JSFP — pełny podgląd umowy i lokalne umowy robocze */
.cru-clickable-row {
    cursor: pointer;
    transition: background-color .14s ease, box-shadow .14s ease;
}
.cru-clickable-row:hover,
.cru-clickable-row:focus {
    background: rgba(212, 122, 31, .065) !important;
    box-shadow: inset 3px 0 0 rgba(212, 122, 31, .55);
    outline: none;
}
.cru-row-main-link,
.cru-row-subject-link {
    color: inherit;
    text-decoration: none;
}
.cru-row-main-link {
    font-weight: 850;
}
.cru-row-main-link:hover,
.cru-row-subject-link:hover {
    color: var(--green-dark);
    text-decoration: underline;
}
.cru-back-link {
    display: inline-flex;
    margin-bottom: 6px;
    color: var(--green-dark);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}
.cru-detail-page-head {
    align-items: flex-end;
}
.cru-detail-statuses {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.cru-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}
.cru-detail-card {
    margin-bottom: 14px;
}
.cru-detail-card > h2 {
    margin-top: 0;
}
.cru-detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--border);
}
.cru-detail-list > div {
    min-width: 0;
    padding: 9px 11px;
    background: #fff;
}
.cru-detail-list dt {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .035em;
}
.cru-detail-list dd {
    margin: 0;
    color: var(--dark);
    font-size: 13px;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.cru-detail-list-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cru-detail-list .cru-detail-span {
    grid-column: 1 / -1;
}
.cru-mono-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px !important;
}
.cru-subject-value-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(240px, .7fr);
    gap: 12px;
}
.cru-detail-text-block {
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
}
.cru-detail-text-block > span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.cru-detail-text-block p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.48;
}
.cru-detail-text-block small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    line-height: 1.4;
}
.cru-agreement-value {
    font-size: 18px !important;
    font-weight: 900;
}
.cru-secrecy-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.cru-secrecy-card {
    padding: 12px;
    border: 1px solid rgba(220, 53, 69, .30);
    border-radius: 7px;
    background: rgba(255, 241, 242, .76);
}
.cru-secrecy-card h4 {
    margin: 0 0 9px;
    color: #842029;
}
.cru-parties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
    gap: 12px;
}
.cru-party-card {
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
}
.cru-party-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.cru-party-card h3 {
    margin: 9px 0 10px;
    font-size: 14px;
}
.cru-party-card .cru-secrecy-card {
    margin-top: 10px;
}
.cru-changes-table th:first-child,
.cru-changes-table td:first-child {
    width: 54px;
    text-align: center;
}
.cru-changes-table th:nth-child(2),
.cru-changes-table td:nth-child(2),
.cru-changes-table th:nth-child(3),
.cru-changes-table td:nth-child(3) {
    white-space: nowrap;
}
.cru-technical-details summary {
    cursor: pointer;
    font-weight: 850;
}
.cru-technical-details .cru-detail-list {
    margin-top: 12px;
}
.cru-drafts-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.cru-drafts-table th:first-child,
.cru-drafts-table td:first-child {
    width: 54px;
    text-align: center;
}
.cru-drafts-table td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10.5px;
}
@media (max-width: 900px) {
    .cru-detail-grid,
    .cru-subject-value-grid,
    .cru-secrecy-grid {
        grid-template-columns: 1fr;
    }
    .cru-detail-page-head,
    .cru-drafts-summary {
        align-items: flex-start;
        flex-direction: column;
    }
    .cru-detail-statuses {
        justify-content: flex-start;
    }
}
@media (max-width: 620px) {
    .cru-detail-list,
    .cru-detail-list-compact {
        grid-template-columns: 1fr;
    }
    .cru-detail-list .cru-detail-span {
        grid-column: auto;
    }
    .cru-parties-grid {
        grid-template-columns: 1fr;
    }
}

/* CRU JSFP — obieg Moje robocze → Do publikacji */
.cru-workflow-table th:last-child,
.cru-workflow-table td:last-child,
.cru-publish-queue-table th:last-child,
.cru-publish-queue-table td:last-child {
    min-width: 170px;
}
.cru-workflow-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
}
.cru-workflow-actions form {
    display: grid;
    gap: 5px;
    margin: 0;
}
.cru-workflow-actions .btn,
.cru-workflow-actions .badge {
    width: 100%;
}
.cru-return-note {
    display: block;
    margin-top: 7px;
    padding: 6px 8px;
    border: 1px solid rgba(220, 53, 69, .28);
    border-radius: 6px;
    background: #fff5f6;
    color: #842029;
    line-height: 1.35;
}
.cru-publish-queue-table td:nth-child(5) {
    min-width: 260px;
}
.cru-publish-queue-table .cru-mono-value {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
}
@media (max-width: 980px) {
    .cru-workflow-table,
    .cru-publish-queue-table {
        min-width: 1080px;
    }
}


/* CRU — kreator umów roboczych, import z zamówień i podgląd */
.cru-wizard-modal .modal-card {
    width: min(1180px, 96vw);
}
.cru-wizard-card {
    max-height: 94vh;
    overflow-y: auto;
}
.cru-wizard-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-right: 42px;
}
.cru-wizard-heading h2 {
    margin: 0 0 4px;
}
.cru-wizard-progress {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    list-style: none;
    margin: 18px 0;
    padding: 0;
}
.cru-wizard-progress li {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f4f6f5;
    color: var(--muted);
    padding: 8px 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
}
.cru-wizard-progress li.active {
    background: rgba(212, 122, 31, .10);
    border-color: rgba(212, 122, 31, .52);
    color: var(--green-dark);
}
.cru-wizard-progress li.done {
    background: rgba(212, 122, 31, .05);
    color: var(--green-dark);
}
.cru-wizard-step {
    display: none;
}
.cru-wizard-step.active {
    display: block;
}
.cru-wizard-step h3 {
    margin: 16px 0 10px;
}
.cru-wizard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cru-wizard-grid .span-2,
.cru-party-editor .span-2 {
    grid-column: 1 / -1;
}
.cru-wizard-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
.cru-import-source-box {
    display: grid;
    gap: 4px;
    border: 1px solid rgba(212, 122, 31, .34);
    background: linear-gradient(135deg, rgba(212, 122, 31, .065), rgba(255,255,255,.98));
    border-radius: 7px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
.cru-import-source-box > span {
    font-weight: 800;
}
.cru-import-source-box small {
    color: var(--muted);
}
.cru-import-source-box .cru-source-warning {
    color: #8a5a00;
    font-weight: 750;
}
.cru-duration-options {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.cru-duration-options label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    font-weight: 750;
}
.cru-party-list {
    display: grid;
    gap: 12px;
    margin: 12px 0;
}
.cru-party-editor {
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    padding: 12px;
}
.cru-party-editor > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.cru-party-main-grid {
    grid-template-columns: 1.2fr .6fr .8fr;
}
.cru-party-company-fields {
    grid-template-columns: 1.5fr .75fr .75fr;
}
.cru-party-person-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cru-party-address-fields {
    grid-template-columns: 1.4fr .65fr .65fr .8fr 1fr;
}
.cru-party-summary-card {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.cru-party-summary-card > div {
    display: grid;
    gap: 3px;
}
.cru-party-summary-card > div:last-child {
    justify-items: end;
    text-align: right;
}
.cru-party-summary-card small,
.cru-party-summary-card span {
    color: var(--muted);
}
.cru-secrecy-details,
.cru-secrecy-editor {
    border-top: 1px dashed var(--border);
    margin-top: 10px;
    padding-top: 10px;
}
.cru-secrecy-details summary {
    cursor: pointer;
    font-weight: 800;
}
.cru-secrecy-editor {
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fafbfa;
    padding: 11px 12px;
    margin: 10px 0;
}
.cru-save-summary {
    display: grid;
    gap: 3px;
    border: 1px solid rgba(212, 122, 31, .28);
    border-radius: 7px;
    background: rgba(212, 122, 31, .045);
    padding: 11px 13px;
    margin: 14px 0;
}
.cru-save-summary span {
    color: var(--muted);
}
.cru-draft-preview-card {
    max-height: 92vh;
    overflow-y: auto;
}
.cru-preview-section {
    border-top: 1px solid var(--border);
    margin-top: 14px;
    padding-top: 12px;
}
.cru-preview-section h3 {
    margin: 0 0 8px;
}
.cru-preview-parties {
    display: grid;
    gap: 8px;
}
.cru-secret-value {
    color: #842029;
    font-weight: 800;
}
.btn-disabled-static {
    opacity: .68;
    pointer-events: none;
}
.btn-cru-import {
    border-color: #212529;
    background: #fff;
    color: #212529;
}
.btn-cru-import:hover {
    border-color: var(--green);
    color: var(--green-dark);
}
.cru-workflow-actions form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.cru-workflow-actions {
    min-width: 250px;
}
@media (max-width: 900px) {
    .cru-wizard-progress {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .cru-wizard-grid,
    .cru-party-main-grid,
    .cru-party-company-fields,
    .cru-party-person-fields,
    .cru-party-address-fields {
        grid-template-columns: 1fr;
    }
    .cru-party-summary-card {
        grid-template-columns: 1fr;
    }
    .cru-party-summary-card > div:last-child {
        justify-items: start;
        text-align: left;
    }
}

/* CRU — kreator: pola wymagane i wybór okresu obowiązywania */
.cru-required-note {
    margin: -2px 0 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.cru-required-group-note {
    margin: 8px 0 0;
    color: #6b5a11;
    font-size: 12px;
    font-weight: 700;
}
.cru-field-alternative {
    color: var(--muted);
    font-weight: 600;
    margin-left: 4px;
}
.cru-duration-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px;
    margin: 0 0 14px;
}
.cru-duration-options .cru-duration-option {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid #cfd8d2;
    border-radius: 7px;
    background: #f7f9f8;
    color: #212529;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.cru-duration-options .cru-duration-option:hover {
    border-color: rgba(212, 122, 31, .55);
    background: rgba(212, 122, 31, .055);
}
.cru-duration-options .cru-duration-option.active {
    border-color: #D47A1F;
    background: linear-gradient(135deg, rgba(212, 122, 31, .10), rgba(212, 122, 31, .035));
    color: #176b2d;
    box-shadow: 0 0 0 2px rgba(212, 122, 31, .08);
}
.cru-duration-options .cru-duration-option input[type="radio"] {
    margin: 0;
    flex: 0 0 auto;
    accent-color: #D47A1F;
}
.cru-duration-fields {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    margin-bottom: 16px;
}
[data-cru-duration-dates][hidden],
[data-cru-duration-count][hidden],
[data-cru-end-date][hidden],
[data-cru-party-company][hidden],
[data-cru-party-person][hidden],
[data-cru-party-address][hidden],
[data-cru-secrecy-fields][hidden],
[data-cru-party-identifier-note][hidden],
.cru-party-id-star[hidden] {
    display: none !important;
}
.cru-party-identifier-note {
    margin: 2px 0 7px;
    color: #6b5a11;
    font-size: 11.5px;
    font-weight: 700;
}
@media (max-width: 820px) {
    .cru-duration-options {
        grid-template-columns: 1fr;
    }
    .cru-duration-fields {
        grid-template-columns: 1fr;
    }
    .cru-duration-options .cru-duration-option {
        justify-content: flex-start;
        white-space: normal;
    }
}

/* CRU — korekta kreatora, listy roboczych i podglądu */
.cru-wizard-card {
    overflow-x: hidden;
}
.cru-wizard-card .cru-wizard-step,
.cru-wizard-card .form-grid,
.cru-wizard-card .form-grid > * {
    min-width: 0;
}
.cru-wizard-card label:not(.checkbox-line):not(.cru-duration-option) {
    display: block;
    min-width: 0;
    font-weight: 650;
    line-height: 1.3;
}
.cru-wizard-card label:not(.checkbox-line):not(.cru-duration-option) > input,
.cru-wizard-card label:not(.checkbox-line):not(.cru-duration-option) > select,
.cru-wizard-card label:not(.checkbox-line):not(.cru-duration-option) > textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
}
.cru-wizard-card .required-mark {
    display: inline;
    margin-left: 2px;
    color: #dc3545;
    font-weight: 900;
    line-height: inherit;
    vertical-align: baseline;
}
.cru-wizard-card .cru-field-alternative {
    display: inline;
    margin-left: 4px;
    vertical-align: baseline;
}
.cru-duration-options {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.cru-duration-options .cru-duration-option {
    min-width: 0;
    min-height: 48px;
    padding: 10px 16px;
    overflow: hidden;
    white-space: nowrap;
}
.cru-duration-options .cru-duration-option input[type="radio"] {
    appearance: auto !important;
    width: 17px !important;
    min-width: 17px !important;
    max-width: 17px !important;
    height: 17px !important;
    min-height: 17px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    outline-offset: 2px;
    flex: 0 0 17px;
}
.cru-duration-options .cru-duration-option span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.2;
}
.cru-duration-fields[hidden] {
    display: none !important;
}

.cru-drafts-clickable-table {
    table-layout: fixed;
}
.cru-drafts-clickable-table th:nth-child(1),
.cru-drafts-clickable-table td:nth-child(1) { width: 52px; text-align: center; }
.cru-drafts-clickable-table th:nth-child(2),
.cru-drafts-clickable-table td:nth-child(2) { width: 17%; }
.cru-drafts-clickable-table th:nth-child(3),
.cru-drafts-clickable-table td:nth-child(3) { width: 12%; }
.cru-drafts-clickable-table th:nth-child(4),
.cru-drafts-clickable-table td:nth-child(4) { width: 112px; }
.cru-drafts-clickable-table th:nth-child(6),
.cru-drafts-clickable-table td:nth-child(6) { width: 120px; }
.cru-drafts-clickable-table th:nth-child(7),
.cru-drafts-clickable-table td:nth-child(7) { width: 145px; min-width: 0; }
.cru-drafts-clickable-table td {
    vertical-align: middle;
    overflow-wrap: anywhere;
}
.cru-draft-row {
    cursor: pointer;
    transition: background .14s ease, box-shadow .14s ease;
}
.cru-draft-row:hover,
.cru-draft-row:focus-visible {
    background: rgba(212, 122, 31, .055);
    box-shadow: inset 3px 0 0 rgba(212, 122, 31, .55);
    outline: none;
}

.cru-draft-preview-card {
    width: min(1160px, 94vw);
    max-height: 92vh;
    overflow-x: hidden;
}
.cru-draft-preview-head {
    padding-right: 44px;
    margin-bottom: 14px;
}
.cru-draft-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.cru-draft-summary-grid > div {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fbfcfb;
}
.cru-draft-summary-grid > div.cru-detail-span {
    grid-column: 1 / -1;
}
.cru-draft-summary-grid small {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .035em;
}
.cru-draft-summary-grid b {
    display: block;
    min-width: 0;
    color: var(--dark);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.cru-draft-modal-actions {
    position: sticky;
    bottom: -1px;
    z-index: 2;
    margin: 18px -2px -2px;
    padding: 12px 2px 2px;
    background: linear-gradient(to top, #fff 76%, rgba(255,255,255,.92) 88%, rgba(255,255,255,0));
}
.cru-draft-submit-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.cru-draft-submit-form .form-message {
    max-width: 260px;
}

@media (max-width: 980px) {
    .cru-drafts-clickable-table { min-width: 930px; }
    .cru-draft-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
    .cru-duration-options { grid-template-columns: 1fr; }
    .cru-duration-options .cru-duration-option {
        justify-content: flex-start;
        white-space: normal;
    }
    .cru-duration-options .cru-duration-option span {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}
@media (max-width: 620px) {
    .cru-draft-summary-grid { grid-template-columns: 1fr; }
    .cru-draft-summary-grid > div.cru-detail-span { grid-column: auto; }
    .cru-draft-modal-actions { align-items: stretch; }
    .cru-draft-modal-actions .btn,
    .cru-draft-submit-form { width: 100%; }
    .cru-draft-submit-form { display: grid; }
}

/* CRU — wybór stron z bazy, filtry i wspólny układ obiegu */
.alert-success {
    border: 1px solid rgba(212, 122, 31, .34);
    background: rgba(212, 122, 31, .075);
    color: #176b2d;
}
.order-cru-status-note {
    margin: 10px 0 0;
    text-align: center;
    font-weight: 800;
}
.cru-party-picker-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.cru-party-picker-actions .form-message {
    margin: 0;
}
.cru-selected-party {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    padding: 10px 12px;
}
.cru-selected-party > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.cru-selected-party small,
.cru-selected-party span {
    color: var(--muted);
    overflow-wrap: anywhere;
}
.cru-selected-party b {
    overflow-wrap: anywhere;
}
.cru-contractor-picker-card {
    width: min(780px, 92vw);
    max-height: 84vh;
    overflow-y: auto;
}
.cru-contractor-picker-card > label {
    display: block;
    font-weight: 700;
}
.cru-contractor-picker-card > label input {
    display: block;
    width: 100%;
    margin-top: 6px;
}
.cru-contractor-picker-card .contractor-modal-results {
    max-height: 52vh;
    overflow-y: auto;
    margin-top: 10px;
}
.cru-contractor-picker-card .picker-item:disabled {
    opacity: .62;
    cursor: default;
}
.cru-contractor-picker-card .picker-item .badge {
    margin-left: auto;
}

.cru-workflow-filter-panel {
    padding: 12px 14px;
}
.cru-workflow-filter-form {
    display: grid;
    grid-template-columns: minmax(210px, 1.5fr) minmax(150px, .8fr) minmax(145px, .75fr) minmax(145px, .75fr) auto;
    gap: 10px;
    align-items: end;
}
.cru-workflow-filter-form label {
    display: grid;
    gap: 5px;
    min-width: 0;
    font-size: 11px;
    font-weight: 750;
}
.cru-workflow-filter-form input,
.cru-workflow-filter-form select,
.cru-workflow-filter-form .btn {
    min-height: 38px;
    font-size: 12px;
}
.cru-workflow-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.cru-publish-clickable-table {
    table-layout: fixed;
    min-width: 1120px;
}
.cru-publish-clickable-table th:nth-child(1),
.cru-publish-clickable-table td:nth-child(1) { width: 52px; text-align: center; }
.cru-publish-clickable-table th:nth-child(2),
.cru-publish-clickable-table td:nth-child(2) { width: 17%; }
.cru-publish-clickable-table th:nth-child(3),
.cru-publish-clickable-table td:nth-child(3) { width: 14%; }
.cru-publish-clickable-table th:nth-child(4),
.cru-publish-clickable-table td:nth-child(4) { width: 110px; }
.cru-publish-clickable-table th:nth-child(5),
.cru-publish-clickable-table td:nth-child(5) { width: 116px; }
.cru-publish-clickable-table th:nth-child(7),
.cru-publish-clickable-table td:nth-child(7) { width: 122px; }
.cru-publish-clickable-table th:nth-child(8),
.cru-publish-clickable-table td:nth-child(8) { width: 130px; min-width: 0; }
.cru-publish-clickable-table td {
    vertical-align: middle;
    overflow-wrap: anywhere;
}
.cru-draft-modal-action-form {
    margin: 0;
}
.cru-draft-action-message {
    display: block;
    width: 100%;
    margin: 8px 0 0;
    text-align: center;
}
.cru-inline-return-form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(220, 53, 69, .28);
    border-radius: 7px;
    background: #fff7f8;
}
.cru-inline-return-form[hidden] {
    display: none !important;
}
.cru-inline-return-form label {
    display: grid;
    gap: 6px;
    font-weight: 750;
}
.cru-inline-return-form textarea {
    width: 100%;
}

@media (max-width: 1080px) {
    .cru-workflow-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .cru-workflow-filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}
@media (max-width: 620px) {
    .cru-workflow-filter-form {
        grid-template-columns: 1fr;
    }
    .cru-workflow-filter-actions {
        grid-column: auto;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .cru-selected-party {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .cru-selected-party .btn {
        width: 100%;
    }
}


/* VERTIS INFRA — CRU: historia wpisu, badge powiązania i poprawka etykiet protokołu */
.order-protocol-form label > .field-label-line {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    width: auto;
    max-width: 100%;
    line-height: 1.35;
    white-space: normal;
}
.order-protocol-form label > .field-label-line .required-star {
    flex: 0 0 auto;
    margin-left: 0;
}
.order-status-stack {
    display: grid;
    gap: 6px;
    width: 100%;
    align-items: stretch;
}
.order-status-stack > .badge {
    width: 100%;
    justify-content: center;
    text-align: center;
}
.order-cru-badge {
    min-height: 25px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: .01em;
    box-shadow: 0 1px 2px rgba(33, 37, 41, .05);
}
.order-cru-badge-draft {
    background: #f1f3f5;
    color: #495057;
    border-color: #ced4da;
}
.order-cru-badge-pending {
    background: #fff3cd;
    color: #8a4b08;
    border-color: #e8bf61;
}
.order-cru-badge-published {
    background: #d1e7dd;
    color: #0f5132;
    border-color: #75b798;
}
.cru-draft-history-details {
    margin-top: 16px;
    margin-bottom: 4px;
}
.cru-draft-history-details summary {
    cursor: pointer;
}

/* VERTIS INFRA — szczegóły powodów i uzasadnień w audit logu */
.audit-detail-list {
    display: grid;
    gap: 5px;
    margin-top: 7px;
}
.audit-detail-row {
    display: grid;
    grid-template-columns: minmax(128px, max-content) minmax(0, 1fr);
    gap: 7px;
    align-items: start;
    padding: 6px 8px;
    border: 1px solid rgba(33, 37, 41, .12);
    border-radius: 6px;
    background: #fff;
    color: #212529;
    font-size: 12px;
    line-height: 1.35;
}
.audit-detail-row strong {
    color: #495057;
    font-weight: 800;
}
.audit-detail-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}
.invoice-audit-main .audit-detail-list {
    margin-top: 8px;
}
.system-section .audit-detail-row,
.task-history-table .audit-detail-row {
    max-width: 760px;
}
@media (max-width: 720px) {
    .audit-detail-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

/* VERTIS INFRA — moduł IOD / Rejestr Czynności Przetwarzania */
.iod-page-head {
    align-items: flex-start;
}
.iod-page-head > div:first-child {
    flex: 1 1 560px;
    min-width: 0;
    max-width: 820px;
}
.iod-page-head .page-head-actions {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}
.iod-page-head .page-head-actions .btn {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}
@media (max-width: 1180px) {
    .iod-page-head {
        flex-direction: column;
    }
    .iod-page-head > div:first-child {
        flex-basis: auto;
        max-width: none;
    }
    .iod-page-head .page-head-actions {
        justify-content: flex-start;
        width: 100%;
    }
}
.iod-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}
.iod-profile-card {
    position: relative;
    overflow: hidden;
    min-height: 152px;
    padding-top: 22px;
}
.iod-profile-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #D47A1F;
}
.iod-profile-card > span {
    display: block;
    margin-bottom: 7px;
    color: #6c757d;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.iod-profile-card > strong {
    display: block;
    margin-bottom: 8px;
    color: #212529;
    font-size: 17px;
    line-height: 1.25;
}
.iod-profile-card p {
    margin: 0 0 8px;
    color: #495057;
    line-height: 1.45;
}
.iod-profile-card small {
    color: #6c757d;
    overflow-wrap: anywhere;
}
.iod-profile-warning {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 18px;
    align-items: center;
    border-left: 4px solid #d39e00;
    background: #fff9e6;
}
.iod-profile-warning strong {
    color: #664d03;
    font-size: 15px;
}
.iod-profile-warning p {
    grid-column: 1;
    margin: 0;
    color: #664d03;
}
.iod-profile-warning .btn {
    grid-column: 2;
    grid-row: 1 / span 2;
}
.iod-rcp-register {
    padding: 14px 16px 16px;
}
.iod-rcp-toolbar {
    grid-template-columns: minmax(0, 1fr) 112px;
    margin-bottom: 8px;
}
.iod-rcp-filter-box {
    grid-template-columns: minmax(250px, 1.7fr) minmax(170px, 1fr) minmax(125px, .62fr) auto;
}
.iod-rcp-register .pagination-topline {
    margin: 0 0 8px;
}
.iod-rcp-table {
    min-width: 1080px;
    table-layout: fixed;
    font-size: 12.5px;
}
.iod-rcp-table th,
.iod-rcp-table td {
    padding: 8px 9px;
    vertical-align: middle;
    line-height: 1.28;
}
.iod-rcp-table th:first-child,
.iod-rcp-table td:first-child {
    width: 62px;
    text-align: center;
}
.iod-rcp-table th:nth-child(2) { width: 20%; }
.iod-rcp-table th:nth-child(3) { width: 31%; }
.iod-rcp-table th:nth-child(4) { width: 16%; }
.iod-rcp-table th:nth-child(5) { width: 15%; }
.iod-rcp-table th:nth-child(6) { width: 18%; }
.iod-rcp-table td strong,
.iod-rcp-table td small {
    display: block;
}
.iod-rcp-table td small {
    margin-top: 2px;
    color: #6c757d;
    font-size: 11px;
    line-height: 1.22;
}
.iod-rcp-table td b {
    color: #495057;
}
.iod-table-line {
    display: block;
}
.iod-rcp-row {
    cursor: pointer;
}
.iod-rcp-row:hover td,
.iod-rcp-row:focus td {
    background: rgba(212, 122, 31, .055);
}
.iod-rcp-row:focus {
    outline: 2px solid rgba(212, 122, 31, .38);
    outline-offset: -2px;
}
.iod-rcp-table tr.is-muted td {
    background: #f4f5f6;
    color: #6c757d;
}
.iod-rcp-table tr.is-muted:hover td,
.iod-rcp-table tr.is-muted:focus td {
    background: #ecefee;
}
.iod-rcp-modal-card,
.iod-profile-modal-card {
    width: min(1120px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    overflow-y: auto;
}
.iod-rcp-form label:not(.iod-transfer-toggle),
.iod-profile-modal-card label {
    display: block;
}
.iod-rcp-form label:not(.iod-transfer-toggle) > :is(input, select, textarea),
.iod-profile-modal-card label > :is(input, select, textarea) {
    display: block;
    margin-top: 6px;
}
.iod-rcp-form .required-mark,
.iod-profile-modal-card .required-mark {
    display: inline;
    margin-left: 2px;
    white-space: nowrap;
}
.iod-form-section {
    display: grid;
    gap: 12px;
    padding: 15px;
    border: 1px solid #dee2e6;
    background: #fbfcfc;
}
.iod-form-section h3 {
    margin: 0;
    padding-bottom: 9px;
    border-bottom: 1px solid #e9ecef;
    color: #212529;
    font-size: 14px;
}
.iod-form-section label > small {
    display: inline;
    margin-left: 5px;
    color: #6c757d;
    font-weight: 500;
}
.iod-rcp-form textarea {
    min-height: 92px;
}
.iod-transfer-toggle {
    display: flex !important;
    flex-direction: row !important;
    gap: 9px;
    align-items: center;
    padding: 12px 13px;
    border: 1px solid #ced4da;
    background: #fff;
    font-weight: 750;
}
.iod-transfer-toggle input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
}
.iod-profile-optional {
    border: 1px solid #dee2e6;
    background: #fbfcfc;
}
.iod-profile-optional summary {
    cursor: pointer;
    padding: 13px 15px;
    font-weight: 800;
}
.iod-profile-optional[open] summary {
    border-bottom: 1px solid #dee2e6;
}
.iod-profile-optional .form-two-cols {
    padding: 15px;
}
.iod-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(275px, 335px);
    gap: 16px;
    align-items: start;
}
.iod-detail-layout > aside {
    display: grid;
    gap: 14px;
    position: sticky;
    top: 12px;
}
.iod-detail-card {
    padding: 0;
    overflow: hidden;
}
.iod-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    border-bottom: 1px solid #e9ecef;
}
.iod-detail-grid > div {
    display: grid;
    grid-template-columns: 145px minmax(0, 1fr);
    gap: 10px;
    padding: 13px 16px;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}
.iod-detail-grid > div:nth-child(2n) {
    border-right: 0;
}
.iod-detail-grid dt {
    color: #6c757d;
    font-size: 11px;
    font-weight: 800;
}
.iod-detail-grid dd {
    margin: 0;
    color: #212529;
    font-weight: 700;
}
.iod-detail-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.iod-detail-section {
    min-width: 0;
    padding: 18px 20px;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}
.iod-detail-section:nth-child(2n) {
    border-right: 0;
}
.iod-detail-section h3 {
    margin: 0 0 8px;
    color: #495057;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.iod-detail-section p {
    margin: 0;
    color: #212529;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.iod-detail-section.iod-archive-note {
    grid-column: 1 / -1;
    border-right: 0;
    background: #fff3f3;
}
.iod-meta-card h2,
.iod-archive-card h2 {
    margin-top: 0;
}
.iod-meta-card dl {
    display: grid;
    gap: 10px;
    margin: 0;
}
.iod-meta-card dl > div {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 9px;
    border-bottom: 1px solid #e9ecef;
}
.iod-meta-card dl > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}
.iod-meta-card dt {
    color: #6c757d;
    font-size: 11px;
    font-weight: 800;
}
.iod-meta-card dd {
    margin: 0;
    color: #212529;
    font-weight: 700;
}
.iod-meta-card dd small {
    display: block;
    margin-top: 3px;
    color: #6c757d;
    font-weight: 500;
}
.iod-archive-card form {
    display: grid;
    gap: 11px;
}
.iod-archive-card textarea {
    min-height: 84px;
}
.iod-audit-panel {
    margin-top: 16px;
}
.iod-audit-list {
    display: grid;
    gap: 9px;
}
.iod-audit-list article {
    padding: 11px 13px;
    border-left: 3px solid #D47A1F;
    background: #f8f9fa;
}
.iod-audit-list article > div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    justify-content: space-between;
}
.iod-audit-list article strong {
    color: #212529;
}
.iod-audit-list article span {
    color: #6c757d;
    font-size: 12px;
}
.iod-audit-list article p {
    margin: 7px 0 0;
    color: #495057;
}

/* Wydruk RCP */
.iod-print-body {
    margin: 0;
    padding: 0;
    color: #212529;
    font-family: Arial, Helvetica, sans-serif;
}
.iod-print-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 2px solid #212529;
}
.iod-print-header h1 {
    margin: 0 0 3px;
    font-size: 20px;
    letter-spacing: .02em;
}
.iod-print-header p {
    margin: 0;
    font-size: 11px;
}
.iod-print-header img {
    max-width: 46mm;
    max-height: 17mm;
    object-fit: contain;
}
.iod-print-profile {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-top: 9px;
    border: 1px solid #495057;
}
.iod-print-profile article {
    padding: 8px 9px;
    border-right: 1px solid #adb5bd;
}
.iod-print-profile article:last-child {
    border-right: 0;
}
.iod-print-profile h2 {
    margin: 0 0 5px;
    font-size: 10px;
    text-transform: uppercase;
}
.iod-print-profile strong,
.iod-print-profile p {
    display: block;
    margin: 0 0 3px;
    font-size: 9px;
    line-height: 1.3;
}
.iod-print-meta {
    margin: 8px 0 10px;
    color: #495057;
    font-size: 9px;
    text-align: right;
}
.iod-print-entry {
    margin-bottom: 12px;
    border: 1px solid #212529;
}
.iod-print-entry > header {
    padding: 8px 10px;
    border-bottom: 1px solid #495057;
    background: #f1f3f5;
}
.iod-print-entry > header span,
.iod-print-entry > header p {
    margin: 0;
    color: #495057;
    font-size: 8.5px;
}
.iod-print-entry > header h2 {
    margin: 3px 0;
    font-size: 14px;
}
.iod-print-entry dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}
.iod-print-entry dl > div {
    display: grid;
    grid-template-columns: 39mm minmax(0, 1fr);
    min-height: 14mm;
    border-right: 1px solid #adb5bd;
    border-bottom: 1px solid #adb5bd;
}
.iod-print-entry dl > div:nth-child(2n) {
    border-right: 0;
}
.iod-print-entry dt,
.iod-print-entry dd {
    margin: 0;
    padding: 6px;
    font-size: 8.5px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.iod-print-entry dt {
    border-right: 1px solid #ced4da;
    background: #f8f9fa;
    font-weight: 800;
}

@media (max-width: 980px) {
    .iod-rcp-toolbar {
        grid-template-columns: 1fr 112px;
    }
    .iod-rcp-filter-box {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .iod-rcp-filter-box .filter-actions {
        grid-column: 1 / -1;
    }
    .iod-detail-layout {
        grid-template-columns: 1fr;
    }
    .iod-detail-layout > aside {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 720px) {
    .iod-profile-grid,
    .iod-rcp-toolbar,
    .iod-rcp-filter-box,
    .iod-detail-grid,
    .iod-detail-sections,
    .iod-detail-layout > aside {
        grid-template-columns: 1fr;
    }
    .iod-profile-warning {
        grid-template-columns: 1fr;
    }
    .iod-profile-warning p,
    .iod-profile-warning .btn {
        grid-column: 1;
        grid-row: auto;
    }
    .iod-detail-section,
    .iod-detail-section:nth-child(2n) {
        border-right: 0;
    }
    .iod-rcp-modal-card,
    .iod-profile-modal-card {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }
}
@media print {
    .iod-print-entry dl > div {
        break-inside: avoid;
    }
}

/* Rola IOD — odrębne oznaczenie w administracji użytkownikami. */
.system-role-iod {
    background: #e6f7f4 !important;
    color: #0f5f55 !important;
    border-color: #8ed1c8 !important;
}

/* IOD — RKCP, rejestr incydentów i rejestr upoważnień */
.iod-registry-form label:not(.iod-transfer-toggle),
.iod-registry-form .iod-scope-fieldset label {
    display: block;
}
.iod-registry-form label:not(.iod-transfer-toggle) > :is(input, select, textarea) {
    display: block;
    margin-top: 6px;
}
.iod-registry-form .required-mark {
    display: inline;
    margin-left: 2px;
    white-space: nowrap;
}
.iod-registry-form textarea {
    min-height: 88px;
}
.iod-rcp-filter-box.iod-four-filters {
    grid-template-columns: minmax(230px, 1.55fr) repeat(3, minmax(130px, .75fr)) auto;
}
.iod-rcp-filter-box .filter-field,
.iod-rcp-filter-box .filter-actions {
    min-width: 0;
}
.iod-rcp-filter-box .filter-actions {
    align-self: end;
}
.iod-scope-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.iod-scope-fieldset {
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid #d7dcdf;
    background: #fff;
}
.iod-scope-fieldset legend {
    padding: 0 5px;
    color: #495057;
    font-size: 12px;
    font-weight: 850;
}
.iod-scope-list {
    display: grid;
    gap: 7px;
    max-height: 210px;
    overflow-y: auto;
}
.iod-scope-option {
    display: grid !important;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 8px 9px;
    border: 1px solid #e2e6e9;
    background: #fbfcfc;
    cursor: pointer;
}
.iod-scope-option input {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
}
.iod-scope-option span {
    min-width: 0;
    color: #212529;
    font-size: 12px;
    line-height: 1.3;
}
.iod-scope-option small {
    display: block;
    margin-top: 2px;
    color: #6c757d;
    font-size: 10.5px;
}
.iod-check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.iod-check-row label {
    display: flex !important;
    gap: 7px;
    align-items: center;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #d7dcdf;
    background: #fff;
    font-size: 12px;
    font-weight: 750;
}
.iod-check-row input {
    width: 16px;
    height: 16px;
    margin: 0;
}
.iod-linked-list {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.iod-linked-list li {
    padding: 8px 10px;
    border-left: 3px solid #D47A1F;
    background: #f8f9fa;
}
.iod-linked-list a {
    color: #1f7a35;
    font-weight: 800;
    text-decoration: none;
}
.iod-linked-list small {
    display: block;
    margin-top: 2px;
    color: #6c757d;
}
.iod-badge-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.iod-incidents-table td:nth-child(5),
.iod-authorizations-table td:nth-child(5) {
    text-align: left;
}
.iod-print-register-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.iod-print-register-table th,
.iod-print-register-table td {
    padding: 5px 6px;
    border: 1px solid #495057;
    vertical-align: top;
    font-size: 8px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.iod-print-register-table th {
    background: #f1f3f5;
    text-align: left;
}
.iod-authorization-document {
    margin-top: 14px;
    font-size: 11px;
    line-height: 1.55;
}
.iod-authorization-document > h2 {
    margin: 18px 0 2px;
    font-size: 18px;
    text-align: center;
}
.iod-authorization-document > h2 + p {
    margin-top: 0;
    text-align: center;
}
.iod-authorization-document dl {
    margin: 18px 0;
    border: 1px solid #495057;
}
.iod-authorization-document dl > div {
    display: grid;
    grid-template-columns: 42mm minmax(0, 1fr);
    border-bottom: 1px solid #adb5bd;
}
.iod-authorization-document dl > div:last-child {
    border-bottom: 0;
}
.iod-authorization-document dt,
.iod-authorization-document dd {
    margin: 0;
    padding: 7px 8px;
    font-size: 9px;
}
.iod-authorization-document dt {
    border-right: 1px solid #adb5bd;
    background: #f8f9fa;
    font-weight: 800;
}
.iod-document-clause {
    margin: 18px 0 32px;
    text-align: justify;
}
.iod-signatures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 35px;
}
.iod-signatures > div {
    display: grid;
    gap: 5px;
    text-align: center;
}
.iod-signatures span {
    min-height: 24px;
    padding-bottom: 4px;
    border-bottom: 1px dotted #212529;
}
.iod-signatures b {
    font-size: 8px;
    font-weight: 600;
}

@media (max-width: 1120px) {
    .iod-rcp-filter-box.iod-four-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .iod-rcp-filter-box.iod-four-filters .filter-actions {
        grid-column: 1 / -1;
    }
}
@media (max-width: 720px) {
    .iod-scope-columns,
    .iod-signatures,
    .iod-rcp-filter-box.iod-four-filters {
        grid-template-columns: 1fr;
    }
    .iod-rcp-filter-box.iod-four-filters .filter-actions {
        grid-column: auto;
    }
}


/* IOD — etap 1: powierzenia, prawa osób, udostępnienia i szkolenia */
.iod-compact-table td{padding-top:8px!important;padding-bottom:8px!important;vertical-align:middle}.iod-compact-table td>small{display:block;margin-top:3px;color:#6c757d;font-size:10.5px;line-height:1.25}.iod-compact-table tr[data-row-href]{cursor:pointer}.iod-compact-table tr[data-row-href]:hover{background:#f5faf6}.iod-registry-form>.iod-form-section{margin:0;padding:14px;border:1px solid #dfe4e7;background:#fbfcfc}.iod-registry-form>.iod-form-section+ .iod-form-section{margin-top:12px}.iod-registry-form .iod-transfer-toggle{display:flex!important;align-items:center;gap:8px}.iod-registry-form .iod-transfer-toggle input{width:16px;height:16px;margin:0}.iod-danger-zone .inline-form{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.iod-danger-zone .inline-form input{min-width:280px;flex:1}.iod-detail-section dl>div{overflow-wrap:anywhere}.iod-page-head .page-head-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}.iod-page-head .page-head-actions>*{margin:0!important}.iod-linked-list a{display:grid;grid-template-columns:auto 1fr;gap:2px 8px;padding:8px 10px;border-left:3px solid #D47A1F;background:#f8f9fa}.iod-linked-list a small{grid-column:2}.iod-print-entry dl dd{white-space:normal}
@media(max-width:900px){.iod-page-head{align-items:flex-start}.iod-page-head .page-head-actions{width:100%;justify-content:flex-start}.iod-danger-zone .inline-form input{min-width:0;width:100%}}


/* Powiązania nowych rejestrów IOD z RCP i RKCP */
.iod-related-stage1-panel{margin-top:18px}
.iod-related-stage1-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.iod-related-stage1-groups>section{min-width:0}
.iod-related-stage1-groups h3{margin:0 0 9px;font-size:.94rem}
@media(max-width:850px){.iod-related-stage1-groups{grid-template-columns:1fr}}


/* IOD — etap 2: ryzyka, DPIA, audyty i zalecenia */
.iod-screening-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));max-height:none}
.iod-score-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.75rem}
.iod-risk-cards,.iod-recommendation-list{display:grid;gap:.75rem}
.iod-risk-card,.iod-recommendation-card{border:1px solid var(--border,#d9dee3);background:#fff;padding:.9rem}
.iod-risk-card>header,.iod-recommendation-card>header,.iod-risk-card>footer,.iod-recommendation-card>footer{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}
.iod-risk-card header small,.iod-recommendation-card header small{display:block;margin-top:.2rem;color:var(--muted,#667085)}
.iod-risk-card-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.25rem 1rem;margin:.65rem 0}
.iod-risk-card p,.iod-recommendation-card p{margin:.35rem 0;line-height:1.4}
.iod-risk-card footer,.iod-recommendation-card footer{border-top:1px solid var(--border,#e1e5e9);padding-top:.65rem;margin-top:.65rem;align-items:center}
.iod-recommendation-card footer form{margin:0}
.iod-action-panel form{max-width:980px}
@media(max-width:900px){.iod-screening-list,.iod-risk-card-grid{grid-template-columns:1fr}.iod-score-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.iod-risk-card>header,.iod-recommendation-card>header,.iod-risk-card>footer,.iod-recommendation-card>footer{flex-direction:column;align-items:stretch}}

/* IOD — etap 2: gwiazdki pól wymaganych pozostają przy nazwie pola. */
:is(#iodRiskModal, #iodRiskItemModal, #iodAuditModal, #iodRecommendationModal)
    label:not(.iod-scope-option):not(.iod-transfer-toggle) {
    display: block;
}
:is(#iodRiskModal, #iodRiskItemModal, #iodAuditModal, #iodRecommendationModal)
    label:not(.iod-scope-option):not(.iod-transfer-toggle) > :is(input, select, textarea) {
    display: block;
    margin-top: 6px;
}
:is(#iodRiskModal, #iodRiskItemModal, #iodAuditModal, #iodRecommendationModal)
    .required-mark {
    display: inline !important;
    margin-left: 2px;
    white-space: nowrap;
}


/* ========================================================================== */
/* VERTIS INFRA 0.1 — motyw gospodarki komunalnej                            */
/* ========================================================================== */
:root {
    --green: #D47A1F;
    --green-dark: #A95816;
    --infra-accent: #D47A1F;
    --infra-accent-dark: #A95816;
    --infra-slate: #253442;
    --infra-pale: #FFF7EF;
}

body {
    background-color: #f5f7f8;
    background-image:
        radial-gradient(circle at 84% 8%, rgba(212,122,31,.045), transparent 23%),
        linear-gradient(180deg, rgba(255,255,255,.7), rgba(244,247,248,.92));
}

.login-body {
    background-color: #eef2f3;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1500' height='900' viewBox='0 0 1500 900'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 690c115-42 230-42 345 0s230 42 345 0 230-42 345 0 230 42 465-8' stroke='%23D47A1F' stroke-opacity='.13' stroke-width='3'/%3E%3Cpath d='M0 724c115-42 230-42 345 0s230 42 345 0 230-42 345 0 230 42 465-8' stroke='%23253442' stroke-opacity='.08' stroke-width='2'/%3E%3Cpath d='M104 382h215v-96l73-62 73 62v96h216' stroke='%23253442' stroke-opacity='.075' stroke-width='3'/%3E%3Cpath d='M1134 108c-53 75-84 126-84 172a84 84 0 0 0 168 0c0-46-31-97-84-172Z' stroke='%23D47A1F' stroke-opacity='.10' stroke-width='4'/%3E%3Cpath d='M820 492h188v-118h160v118h332M910 492v-62h58v62M1222 492v-74h74v74' stroke='%23253442' stroke-opacity='.065' stroke-width='3'/%3E%3Ccircle cx='742' cy='690' r='42' stroke='%23253442' stroke-opacity='.07' stroke-width='3'/%3E%3Ccircle cx='742' cy='690' r='18' stroke='%23D47A1F' stroke-opacity='.10' stroke-width='3'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(circle at 14% 18%, rgba(212,122,31,.12), transparent 24%),
        linear-gradient(135deg, #f8fafb 0%, #e9eef0 100%);
    background-size: cover, auto, auto;
    background-position: center;
}

.login-card {
    border-top: 4px solid var(--infra-accent);
    box-shadow: 0 24px 65px rgba(27,39,49,.14);
}
.login-card::before {
    content: "INFRASTRUKTURA • USŁUGI • ZASOBY";
    display: block;
    margin: -7px 0 18px;
    color: #8b5b31;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .18em;
}
.login-logo { width: min(330px, 100%); }

.topbar {
    background-color: #f8faf9;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1180' height='82' viewBox='0 0 1180 82'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 58c62-20 124-20 186 0s124 20 186 0 124-20 186 0' stroke='%23D47A1F' stroke-opacity='.17' stroke-width='1.6'/%3E%3Cpath d='M574 63h110v-26h38v26h92v-38h52v38h94' stroke='%23253442' stroke-opacity='.105' stroke-width='1.5'/%3E%3Cpath d='M994 63h112M1050 63V36m-13 0h26M1050 36v-17' stroke='%23D47A1F' stroke-opacity='.15' stroke-width='1.5'/%3E%3Ccircle cx='372' cy='58' r='10' stroke='%23253442' stroke-opacity='.10'/%3E%3Ccircle cx='372' cy='58' r='3' fill='%23D47A1F' fill-opacity='.22' stroke='none'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(circle at 14% 28%, rgba(212,122,31,.10), transparent 25%),
        linear-gradient(180deg, rgba(255,255,255,.99), rgba(245,248,248,.99));
    background-repeat: repeat-x, no-repeat, no-repeat;
    background-position: center, center, center;
}
.topbar-clock::after {
    background: linear-gradient(90deg, transparent, rgba(212,122,31,.62), rgba(37,52,66,.24), transparent);
}

.sidebar {
    background-color: #f6f8f8;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='290' height='1200' viewBox='0 0 290 1200'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 74h94v64h58v-34h92' stroke='%23D47A1F' stroke-opacity='.085' stroke-width='1.5'/%3E%3Cpath d='M0 318c47-18 94-18 141 0s94 18 149 0' stroke='%23253442' stroke-opacity='.07' stroke-width='1.5'/%3E%3Cpath d='M33 538h66v-41h54v41h105' stroke='%23253442' stroke-opacity='.065' stroke-width='1.5'/%3E%3Cpath d='M0 790c54-19 108-19 162 0s86 19 128 4' stroke='%23D47A1F' stroke-opacity='.08' stroke-width='1.5'/%3E%3Ccircle cx='205' cy='104' r='19' stroke='%23253442' stroke-opacity='.07'/%3E%3Ccircle cx='205' cy='104' r='7' stroke='%23D47A1F' stroke-opacity='.10'/%3E%3Cpath d='M62 1046h86v-62h63v62h79' stroke='%23253442' stroke-opacity='.06' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(180deg, #fbfcfc 0%, #f1f4f5 100%);
    background-repeat: repeat-y, no-repeat;
    background-position: top center, center;
}
.sidebar .brand img { width: 232px; }
.main-nav > .nav-direct:hover,
.main-nav > .nav-direct.active,
.main-nav > .nav-group > summary:hover,
.main-nav > .nav-group[open] > summary {
    background: linear-gradient(90deg, rgba(212,122,31,.17), rgba(212,122,31,.055) 54%, rgba(37,52,66,.03));
}

.app-footer,
.login-brand-footer {
    background-color: #111b23;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='110' viewBox='0 0 1200 110'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 80c70-21 140-21 210 0s140 21 210 0 140-21 210 0' stroke='%23D47A1F' stroke-opacity='.32' stroke-width='1.5'/%3E%3Cpath d='M650 84h92V55h46v29h78V38h58v46h122V59h44v25h110' stroke='%23ffffff' stroke-opacity='.10' stroke-width='1.4'/%3E%3Ccircle cx='514' cy='80' r='16' stroke='%23ffffff' stroke-opacity='.10'/%3E%3Ccircle cx='514' cy='80' r='5' stroke='%23D47A1F' stroke-opacity='.30'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(90deg, #0e171e 0%, #172631 52%, #0e171e 100%);
    background-repeat: repeat-x, no-repeat;
    background-position: center, center;
}
.app-footer-vertis-logo,
.login-footer-vertis-logo {
    width: min(245px, 52vw);
    padding: 8px 12px;
    border-radius: 8px;
}

.infra-dashboard-head {
    position: relative;
    overflow: hidden;
}
.infra-dashboard-head::after {
    content: "";
    position: absolute;
    right: 24px;
    bottom: -24px;
    width: 230px;
    height: 92px;
    opacity: .18;
    pointer-events: none;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='230' height='92' viewBox='0 0 230 92'%3E%3Cg fill='none' stroke='%23D47A1F' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M0 70c28-12 56-12 84 0s56 12 84 0 42-12 62-5'/%3E%3Cpath d='M35 66V38h28v28M95 66V24h40v42M168 66V43h22v23' stroke='%23253442'/%3E%3Ccircle cx='206' cy='66' r='12'/%3E%3C/g%3E%3C/svg%3E");
}
.infra-domain-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    margin: 0 0 18px;
    overflow: hidden;
    border: 1px solid rgba(37,52,66,.11);
    background: rgba(37,52,66,.11);
    box-shadow: 0 10px 28px rgba(31,45,57,.055);
}
.infra-domain-strip span {
    min-height: 54px;
    display: grid;
    place-items: center;
    padding: 10px 12px;
    background: linear-gradient(180deg, #fff, #f8faf9);
    color: #455462;
    font-size: 12px;
    font-weight: 760;
    text-align: center;
}
.infra-domain-strip span::before {
    content: "";
    width: 24px;
    height: 2px;
    margin-bottom: 6px;
    background: var(--infra-accent);
}

.system-module-card.is-enabled { border-top: 4px solid var(--infra-accent); }
.system-module-icon { background: rgba(212,122,31,.13); color: var(--infra-accent-dark); }

@media (max-width: 900px) {
    .infra-domain-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .infra-domain-strip span:last-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
    .infra-domain-strip { grid-template-columns: 1fr; }
    .infra-domain-strip span:last-child { grid-column: auto; }
    .infra-dashboard-head::after { display: none; }
}
