.toast-container {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 240px;
    max-width: 360px;
    padding: 13px 16px;
    border-radius: 14px;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
    animation: toastIn 0.2s ease;
}

.toast.success {
    background: #587d18;
}

.toast.error {
    background: #b91c1c;
}

@keyframes toastIn {
    from {
        transform: translateY(8px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* BUTTONS — linki i <button> z klasą .btn wyglądają jak przyciski */

.btn,
.btn:link,
.btn:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 38px;
    padding: 0.45rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.btn-primary,
.btn-primary:link,
.btn-primary:visited {
    background: var(--zhp-green, #87a428);
    border-color: var(--zhp-green-dark, #587d18);
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(88, 125, 24, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--zhp-green-dark, #587d18);
    border-color: var(--zhp-green-dark, #587d18);
    color: #fff !important;
    text-decoration: none !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(88, 125, 24, 0.25);
}

.btn-secondary,
.btn-secondary:link,
.btn-secondary:visited {
    background: #fff;
    border-color: var(--border-soft, #dfe5d6);
    color: var(--zhp-green-dark, #587d18) !important;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: #f4f8ec;
    border-color: var(--zhp-green, #87a428);
    color: var(--zhp-green-dark, #587d18) !important;
    text-decoration: none !important;
    transform: translateY(-1px);
}

.btn-sm {
    min-height: 32px;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
}

.btn-danger,
.btn-danger:link,
.btn-danger:visited {
    background: #fdecea;
    color: #b71c1c;
    border: 1px solid #f5c6c2;
}

.btn-danger:hover,
.btn-danger:focus {
    background: #b71c1c;
    color: #fff;
    border-color: #8b0000;
}

/* MODALS */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.48);
}

.modal {
    width: 100%;
    max-width: 440px;
    padding: 24px;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.30);
}

.modal h3 {
    margin-bottom: 10px;
}

.modal p {
    margin-bottom: 18px;
}

.modal input[type="date"] {
    width: 100%;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

/* EMPTY STATE */

.empty-state {
    padding: 34px 20px;
    border: 1px dashed var(--border-soft);
    border-radius: 18px;
    background: #f8fbf2;
    text-align: center;
}

.empty-state-icon {
    margin-bottom: 10px;
    font-size: 34px;
}

.empty-state h3 {
    margin-bottom: 8px;
}

.empty-state p {
    max-width: 520px;
    margin: 0 auto;
}

/* TABLE ACTIONS */

.table-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.compact-btn {
    width: auto;
    min-height: 38px;
    padding: 9px 14px;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.action-btn,
.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        transform 0.16s ease;
}

.action-btn:hover,
.action-link:hover {
    border-color: var(--zhp-green);
    background: #f8fbf2;
    transform: translateY(-1px);
}

.action-danger {
    color: #b91c1c;
}

.action-danger:hover {
    border-color: #fecdd3;
    background: #fff1f2;
}

.action-btn.copied {
    border-color: var(--zhp-green);
    background: #f0f7dd;
    color: var(--zhp-green-dark);
}

/* STATUS BADGES */

.status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.status-active {
    border: 1px solid #cfe3a1;
    background: #eef6d8;
    color: #587d18;
}

.status-neutral {
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    color: #64748b;
}

.status-expired {
    border: 1px solid #fecdd3;
    background: #fff1f2;
    color: #b91c1c;
}

/* PAGINATION / FIELDS */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.pagination button {
    width: auto;
}

.search-meta {
    margin-top: 7px;
    color: #64748b;
    font-size: 13px;
}

.field-error {
    min-height: 18px;
    margin-top: -6px;
    margin-bottom: 10px;
    color: #b91c1c;
    font-size: 13px;
}

.field-invalid {
    border-color: #b91c1c !important;
    box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.12) !important;
}

/* QR PAGE */

.qr-container {
    text-align: center;
}

.qr-image {
    width: 360px;
    max-width: 100%;
    height: auto;
    padding: 14px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(88, 125, 24, 0.18);
}

.qr-page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.qr-page-actions a {
    text-decoration: none;
}

.qr-page-actions button {
    width: auto;
}

.qr-copy-btn {
    min-height: 44px;
}

.qr-options {
    max-width: 360px;
    margin: 0 auto;
    text-align: left;
}

.qr-options label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 800;
}

.qr-options select {
    width: 100%;
}

.qr-rgb-section {
    margin-top: 14px;
}

.qr-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qr-color-row input[type="color"] {
    width: 58px;
    min-width: 58px;
    height: 44px;
    padding: 4px;
    cursor: pointer;
}

.qr-color-row input[type="text"] {
    flex: 1;
    font-family: monospace;
    text-transform: uppercase;
}

.qr-logo-upload {
    max-width: 520px;
    margin: 24px auto 0;
    padding: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: #f8fbf2;
    text-align: left;
}

.qr-logo-upload h3 {
    margin-bottom: 8px;
}

.qr-logo-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.qr-logo-form input[type="file"] {
    flex: 1;
    min-width: 220px;
}

.qr-logo-library {
    max-width: 520px;
    margin: 24px auto 0;
    padding: 16px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid var(--border-soft);
    text-align: left;
}

.qr-logo-library h3 {
    margin-bottom: 8px;
}

.qr-logo-library-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}

.qr-logo-library-form select {
    flex: 1;
    margin-bottom: 0;
}

.qr-logo-library-form button {
    width: auto;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .qr-logo-library {
        max-width: 100%;
    }

    .qr-logo-library-form {
        flex-direction: column;
        align-items: stretch;
    }

    .qr-logo-library-form select,
    .qr-logo-library-form button {
        width: 100%;
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.kiw-color-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.kiw-color-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-main);
    text-align: left;
    font-weight: 700;
    cursor: pointer;
}

.kiw-color-option:hover {
    background: #f8fbf2;
    border-color: var(--zhp-green);
}

.kiw-color-option.active {
    border-color: var(--zhp-green);
    background: #eef6d8;
    box-shadow: 0 0 0 3px rgba(135, 164, 40, 0.14);
}

.kiw-color-swatch {
    width: 22px;
    min-width: 22px;
    height: 22px;
    border-radius: 7px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.kiw-color-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.kiw-color-dropdown {
    position: relative;
    width: 100%;
}

.kiw-color-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--zhp-gray-light);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-main);
    text-align: left;
    font-weight: 700;
}

.kiw-color-dropdown-toggle:hover {
    background: #ffffff;
    border-color: var(--zhp-green);
}

.kiw-color-dropdown-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 16px;
}

.kiw-color-dropdown-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 50;
    display: none;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.kiw-color-dropdown.open .kiw-color-dropdown-menu {
    display: block;
}

.kiw-color-dropdown-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-main);
    text-align: left;
    font-weight: 700;
    cursor: pointer;
}

.kiw-color-dropdown-option:hover {
    background: #f8fbf2;
}

.kiw-color-dropdown-option.active {
    background: #eef6d8;
    color: var(--zhp-green-dark);
}

.kiw-color-swatch {
    width: 20px;
    min-width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid rgba(15, 23, 42, 0.20);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.kiw-color-selected-label,
.kiw-color-option-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* ANIMATIONS */

.recently-created {
    animation: recentlyCreatedPulse 3s ease;
}

@keyframes recentlyCreatedPulse {
    0% {
        background: rgba(135, 164, 40, 0.22);
    }

    100% {
        background: transparent;
    }
}

/* Rekordy zaimportowane automatycznie — banner i podpowiedzi w formularzach */
.import-lock-banner {
    margin-bottom: 1rem;
    padding: 0.7rem 1rem;
    background: #fff8e6;
    border: 1px solid #f0dfae;
    border-radius: 8px;
    font-size: 0.88rem;
    color: #6b5410;
}

.import-lock-hint {
    font-size: 0.72rem;
    font-weight: 600;
    color: #9a7b1a;
}

input[readonly] {
    background: #f4f4f1;
    color: var(--text-muted, #666);
    cursor: not-allowed;
}

/* Odróżnienie źródła rekordu na listach */
.source-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: #eef3e4;
    color: var(--zhp-green-dark, #3d5a1e);
}

.source-tag--manual {
    background: #e7f0fb;
    color: #1e5aa8;
}

.source-tag--import,
.source-tag--infrastruktura {
    background: #eef3e4;
    color: var(--zhp-green-dark, #3d5a1e);
}

.source-tag--inventory {
    background: #f3eef8;
    color: #5b3d8a;
}

.source-tag--checkmk {
    background: #fff4e5;
    color: #9a5b00;
}

.source-tag--elk {
    background: #fce8ef;
    color: #8a2d52;
}

.source-tag--workflow {
    background: #e8f4fc;
    color: #1565a8;
}

.webapp-cell { position: relative; display: inline-block; max-width: 100%; }
.webapp-label {
    display: inline-block;
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
    line-height: 1.35;
    background: #eef3e4;
}
.webapp-cell--interactive { cursor: pointer; }
.webapp-cell--interactive:focus-visible {
    outline: 2px solid var(--zhp-green, #5a7a2e);
    outline-offset: 2px;
    border-radius: 4px;
}
.webapp-cell--pinned .webapp-label {
    box-shadow: 0 0 0 2px var(--zhp-green, #5a7a2e);
}
.webapp-cell > .sec-popup--source,
.webapp-cell .service-tooltip-bundle {
    display: none !important;
}
.webapp-sec-tooltip,
.floating-tooltip {
    display: none;
    position: fixed;
    z-index: 10050;
    min-width: min(380px, calc(100vw - 24px));
    max-width: min(520px, calc(100vw - 24px));
    max-height: min(70vh, 520px);
    overflow: auto;
    padding: 0.85rem 1rem;
    background: #fff;
    border: 2px solid var(--zhp-green, #5a7a2e);
    border-radius: 10px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.06),
        0 18px 48px rgba(0, 0, 0, 0.22);
    font-size: 0.84rem;
    line-height: 1.5;
    color: #1a1a1a;
    pointer-events: none;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}
.webapp-sec-tooltip.is-open,
.floating-tooltip.is-open {
    display: block !important;
}
.webapp-sec-tooltip.is-pinned,
.floating-tooltip.is-pinned {
    pointer-events: auto;
    border-color: var(--zhp-green-dark, #3d5a1e);
}
.webapp-sec-tooltip__hint {
    display: block;
    margin: 0 0 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #eee;
    font-size: 0.72rem;
    color: var(--text-muted, #666);
}
.webapp-sec-tooltip__close {
    float: right;
    margin: -0.15rem 0 0.25rem 0.5rem;
    padding: 0.1rem 0.45rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f7f7f7;
    font-size: 0.72rem;
    cursor: pointer;
    color: #333;
}
.webapp-sec-tooltip__close:hover {
    background: #eee;
}
.webapp-sec-tooltip::before,
.floating-tooltip::before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border-left: 2px solid var(--zhp-green, #5a7a2e);
    border-top: 2px solid var(--zhp-green, #5a7a2e);
    transform: rotate(45deg);
}
.webapp-sec-tooltip.is-above::before,
.floating-tooltip.is-above::before {
    bottom: -8px;
    left: 24px;
    border-left: none;
    border-top: none;
    border-right: 2px solid var(--zhp-green, #5a7a2e);
    border-bottom: 2px solid var(--zhp-green, #5a7a2e);
}
.webapp-sec-tooltip.is-below::before,
.floating-tooltip.is-below::before {
    top: -8px;
    left: 24px;
}
.webapp-sec-tooltip h4,
.floating-tooltip h4 {
    margin: 0 0 0.35rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--zhp-green-dark, #3d5a1e);
}
.webapp-sec-tooltip section,
.floating-tooltip section { margin-bottom: 0.6rem; }
.webapp-sec-tooltip section:last-child,
.floating-tooltip section:last-child { margin-bottom: 0; }
.webapp-sec-tooltip ul,
.floating-tooltip ul { margin: 0.25rem 0 0; padding-left: 1.15rem; }
.webapp-sec-tooltip li,
.floating-tooltip li { margin: 0.15rem 0; }
