html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42N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 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===== Toolbar ===== */
.toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ===== Shadcn-style buttons ===== */
.btn-shadcn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid #d5d7da;
    border-radius: 0.42rem;
    background: #fff;
    color: #1f2937;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    transition: all 120ms ease;
    cursor: pointer;
}

.btn-shadcn:hover:not(:disabled) {
    border-color: #b8bcc2;
    background: #f8f9fa;
    color: #111827;
}

.btn-shadcn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-shadcn-primary {
    border-color: #111827;
    background: #111827;
    color: #fff;
}

.btn-shadcn-primary:hover:not(:disabled) {
    background: #1f2937;
    border-color: #1f2937;
    color: #fff;
}

.btn-shadcn-danger {
    border-color: #b91c1c;
    background: #b91c1c;
    color: #fff;
}

.btn-shadcn-danger:hover:not(:disabled) {
    background: #991b1b;
    border-color: #991b1b;
    color: #fff;
}

/* ===== Unified table row typography ===== */
.table-row-font {
    font-size: 0.78rem;
}

.table-row-font th,
.table-row-font td {
    vertical-align: middle;
}

.table-row-font tbody tr {
    font-size: inherit;
    line-height: 1.25;
}

.table-row-font .bi,
.table-row-font input[type="checkbox"] {
    vertical-align: middle;
}

.table-row-font input[type="checkbox"] {
    margin-top: 0;
}

/* ===== Unified form labels ===== */
.app-field-label {
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.2;
    color: #212529;
}

.app-required-mark {
    color: #dc3545;
    font-weight: 700;
    margin-left: 0.15rem;
}

/* Walidacja formularzy */
.invalid-feedback {
    display: block;
    font-size: 0.75rem;
}
.form-control.is-invalid,
.form-select.is-invalid,
.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc3545;
    background-image: none;
}

/* ===== Shared table action buttons ===== */
.table-row-action-btn {
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
}

.table-row-action-edit {
    border: 0;
    background: transparent;
    color: #212529;
}

.table-row-action-edit:hover {
    background: transparent;
    color: #111827;
}

.table-row-action-square,
.table-row-action-delete {
    width: 1.4rem;
    height: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ===== Filters summary bar ===== */
.filters-summary {
    font-size: 0.78rem;
}

.filters-summary-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem;
}

.filters-summary-center {
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.filters-summary-right {
    text-align: right;
    white-space: nowrap;
}

/* ===== Filter row in table ===== */
.filter-row th {
    padding: 0;
    min-height: 1.75rem;
    vertical-align: middle;
}

.filter-cell {
    position: relative;
    padding: 0;
    min-width: 0;
    overflow: hidden;
}

.filter-cell-date {
    overflow: visible;
    z-index: 30;
}

.filter-cell-control {
    width: 100%;
    height: 100%;
    min-height: 1.75rem;
    border: 0;
    border-radius: 0;
    font-size: 0.78rem;
    padding-right: 1.5rem;
    min-width: 0;
    box-sizing: border-box;
}

.filter-clear-btn {
    position: absolute;
    right: 0.2rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent;
    color: #6c757d;
    padding: 0;
    width: 1rem;
    height: 1rem;
    line-height: 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-clear-btn:hover {
    color: #dc3545;
}

.filter-clear-all {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent;
    color: #6c757d;
    padding: 0;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.filter-clear-all:hover {
    color: #dc3545;
}

/* ===== Date range popover ===== */
.date-range-trigger {
    width: calc(100% - 1.35rem);
    margin-right: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    color: #212529;
    border: 0;
    border-radius: 0;
    padding: 0.2rem 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.date-range-trigger:hover {
    background: #f8f9fa;
}

.date-range-trigger-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.date-range-trigger-text {
    font-size: 0.76rem;
    line-height: 1;
}

.date-range-popover {
    position: absolute;
    left: 0;
    top: calc(100% + 0.2rem);
}

.date-range-panel {
    margin-top: 0;
    width: 9rem;
    z-index: 50;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.35rem;
    box-shadow: 0 0.35rem 0.9rem rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    position: relative;
}

.date-range-close {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    border: 0;
    background: transparent;
    color: #6c757d;
    width: 1.1rem;
    height: 1.1rem;
    line-height: 1rem;
    padding: 0;
    font-size: 0.9rem;
    cursor: pointer;
}

.date-range-close:hover {
    color: #111827;
}

.date-range-panel-label {
    font-size: 0.72rem;
    color: #6c757d;
    margin-bottom: 0.15rem;
}

.date-range-panel .form-control {
    font-size: 0.78rem;
}

/* ===== Type filter chip ===== */
.type-chip {
    width: calc(100% - 1.35rem);
    margin-right: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    background: #fff;
    color: #212529;
    border: 0;
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
    line-height: 1.1;
    cursor: pointer;
}

.type-chip.active {
    color: #0d6efd;
}

.type-filter-panel {
    width: 12rem;
}

.type-filter-list {
    max-height: 12rem;
    overflow: auto;
    padding-left: 0.2rem;
}

.type-filter-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.2rem;
}

.type-filter-option .form-check-input {
    position: static;
    margin: 0;
    float: none;
    flex: 0 0 auto;
}

.type-filter-option .form-check-label {
    margin: 0;
}

/* Tabela z filtrami — popovery muszą wychodzić poza kontener */
.table-responsive-filters {
    overflow: visible;
}

/* ===== XML panel ===== */
tr.xml-panel td {
    background-color: #f8f9fa;
    border-top: none;
    padding: 0 !important;
}

.xml-panel-content {
    border-left: 3px solid #0d6efd;
    background: #f8f9fa;
}

.xml-pre {
    font-size: 0.72rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 18rem;
    overflow-y: auto;
    color: #212529;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

/* ===== Invoice row colors ===== */
tr.inv-cached,
tr.inv-cached td,
tr.inv-cached td span:not(.badge) {
    color: #2b3035 !important;
}

tr.inv-new,
tr.inv-new td {
    color: #2b3035 !important;
}

/* ===== Manual entry dropdown ===== */
.manual-entry-menu {
    position: relative;
}

.manual-entry-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 80;
    min-width: 10rem;
    background: #fff;
    border: 1px solid #d5d7da;
    border-radius: 0.5rem;
    box-shadow: 0 0.35rem 0.9rem rgba(0, 0, 0, 0.15);
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.manual-entry-option {
    width: 100%;
    justify-content: flex-start;
}

/* ===== Sort headers ===== */
.sort-th { cursor: pointer; user-select: none; white-space: nowrap; }
.sort-th:hover { opacity: 0.8; }
.sort-th.active { color: #ff6b6b; }
.sort-arrow { font-size: 0.65rem; opacity: 0.5; margin-left: 0.2rem; }
.sort-th.active .sort-arrow { opacity: 1; }

/* Accordion */
.sh-accordion {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    overflow: hidden;
    font-size: 0.875rem;
}
.sh-accordion-item {
    border-bottom: 1px solid #e2e8f0;
}
.sh-accordion-item:last-child {
    border-bottom: none;
}
.sh-accordion-item > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background-color 0.15s;
}
.sh-accordion-item > summary::-webkit-details-marker { display: none; }
.sh-accordion-item > summary:hover {
    background-color: #f8fafc;
}
.sh-accordion-item > summary::after {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.sh-accordion-item[open] > summary::after {
    transform: rotate(180deg);
}
.sh-accordion-body {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid #e2e8f0;
}

/* Bank account picker panel */
.account-picker {
    position: relative;
}
.account-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.2rem);
    z-index: 40;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.35rem;
    box-shadow: 0 0.35rem 0.9rem rgba(0,0,0,0.15);
    max-height: 11rem;
    overflow: auto;
}
.account-panel-item {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.4rem 0.55rem;
    font-size: 0.82rem;
    cursor: pointer;
}
.account-panel-item:hover {
    background: #f8f9fa;
}
.account-panel-empty {
    padding: 0.4rem 0.55rem;
    font-size: 0.8rem;
    color: #6c757d;
}

/* Pomoc - treść Markdown */
.help-content h1 { font-size: 1.15rem; font-weight: 600; margin-top: 1rem;   margin-bottom: 0.4rem; }
.help-content h2 { font-size: 1rem;    font-weight: 600; margin-top: 0.9rem;  margin-bottom: 0.35rem; }
.help-content h3 { font-size: 0.9rem;  font-weight: 600; margin-top: 0.75rem; margin-bottom: 0.25rem; }
.help-content h4,
.help-content h5,
.help-content h6 { font-size: 0.875rem; font-weight: 600; margin-top: 0.5rem; margin-bottom: 0.2rem; }
.help-content p  { margin-bottom: 0.4rem; }
.help-content ul,
.help-content ol { margin-bottom: 0.4rem; padding-left: 1.4rem; }
.help-content li { margin-bottom: 0.15rem; }
