html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    height: 100%;
    margin: 0;
}

/* Full-viewport shell so header + content + footer always fill the screen */
.page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.page > main {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    overflow: hidden;
}

.content {
    flex: 1 1 0;
    overflow-y: auto;
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.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;
}

/* ── Header branding ─────────────────────────────────────────── */
.top-row {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    height: auto;
    min-height: 2.75rem;
    overflow: visible;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
}

.header-logo {
    height: auto;
    max-height: 40px;
    width: auto;
    max-width: 110px;
    object-fit: contain;
}

.header-brand {
    display: flex;
    align-items: center;
    height: 100%;
    overflow: visible;
}

.header-divider {
    display: inline-block;
    width: 1px;
    height: 30px;
    background-color: #dee2e6;
}

.header-product-name {
    display: block;
    margin-top: 0;
    font-size: 0.62rem;
    font-weight: 400;
    color: #a8adb3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── Sortable table headers ──────────────────────────────────── */
.sort-col {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.sort-col:hover {
    background-color: #163263;
}
.sort-arrow {
    font-size: 0.7em;
    margin-left: 0.25rem;
}
.sort-arrow-inactive {
    opacity: 0.4;
}

/* ── Brand table header ──────────────────────────────────────── */
.thead-brand th {
    background-color: #1a3c6e;
    color: #fff;
    border-color: #15305a;
}

/* ── Footer branding ─────────────────────────────────────────── */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
    background-color: #fff;
}

.footer-code-name {
    font-size: 0.62rem;
    font-weight: 400;
    color: #a8adb3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.footer-powered-by {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
}

/* ── Top nav links ───────────────────────────────────────────── */
.app-nav {
    align-items: center;
}

.app-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.app-nav-link:hover {
    background-color: #e9ecef;
    color: #1a3c6e;
}

.app-nav-link.active {
    background-color: #1a3c6e;
    color: #fff;
}

/* ── Breadcrumbs ─────────────────────────────────────────────── */
.app-breadcrumb {
    padding: 0.5rem 0 0.25rem;
    margin-bottom: 0.5rem;
}

.app-breadcrumb .breadcrumb {
    font-size: 0.825rem;
}

.app-breadcrumb .breadcrumb-item a {
    color: #1a3c6e;
    text-decoration: none;
}

.app-breadcrumb .breadcrumb-item a:hover {
    text-decoration: underline;
}

.app-breadcrumb .breadcrumb-item.active {
    color: #6c757d;
}

/* ── Review split-panel layout ───────────────────────────────── */
.review-layout {
    display: flex;
    /* Fill whatever space .content gives us (content is flex:1 and overflow-y:auto,
       so review-layout must not rely on 100vh — just fill its parent) */
    height: 100%;
    overflow: hidden;
    gap: 0;
}

.review-left {
    flex: 0 0 var(--review-left-w, 50%);
    width: var(--review-left-w, 50%);
    overflow-y: auto;
    padding: 0.75rem 1.25rem 2rem;
    min-width: 20%;
    max-width: 80%;
}

.review-divider {
    flex: 0 0 6px;
    width: 6px;
    cursor: col-resize;
    background: #dee2e6;
    transition: background 0.15s;
    position: relative;
    z-index: 10;
}
.review-divider:hover,
.review-divider.dragging {
    background: #0d6efd;
}

.review-right {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    border-left: none;
    overflow: hidden;
    background: #525659;
    min-width: 20%;
}

.pdf-viewer-header {
    background: #3a3d3f;
    color: #f0f0f0;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    flex-shrink: 0;
    min-height: 2rem;
}

.pdf-container {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.pdf-loading, .pdf-error {
    text-align: center;
    color: #ccc;
    padding: 2rem;
    font-size: 0.85rem;
}

/* ── Encompass fee table ─────────────────────────────────────── */
.encompass-section-card {
    border-radius: 6px;
}

.encompass-section-header {
    background: #e9f0f8;
    border-bottom: 1px solid #c5d5e8;
}

.encompass-table {
    font-size: 0.76rem;
}

.encompass-table th,
.encompass-table td {
    padding: 0.2rem 0.3rem !important;
    vertical-align: middle;
}

.encompass-table .charge-col  { min-width: 220px; }
.encompass-table .amount-col  { min-width: 85px; }
.encompass-table .money-col   { min-width: 95px; }
.encompass-table .pba-col     { min-width: 80px; }
.encompass-table .paidby-col  { min-width: 90px; }
.encompass-table .paidto-col  { min-width: 105px; }
.encompass-table .conf-col    { width: 36px; }

.encompass-table .form-control,
.encompass-table .form-select,
.encompass-table .input-group-text {
    font-size: 0.74rem;
    padding: 0.12rem 0.25rem;
    height: auto;
}

/* Field ID hints — inactive (no value / unchecked) */
.fee-fid-inactive { color: #c8cdd2; }

/* Hide number input spinners in fee tables */
.encompass-table input[type=number]::-webkit-inner-spin-button,
.encompass-table input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.encompass-table input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.fee-fixed-name {
    font-size: 0.76rem;
    font-weight: 500;
}

/* P B A checkboxes */
.pba-group {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.pba-label {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

/* Row state highlights */
.row-edited      { background-color: #fffde7 !important; }
.row-focused     { background-color: #d0eaff !important; transition: background-color 1.8s ease-out; }
.row-low-conf td { background-color: #fff3f3 !important; }

/* Confidence badge */
.timer-badge {
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #495057;
    background: #e9ecef;
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
}

.config-table th, .config-table td { vertical-align: middle; font-size: 0.82rem; }
.config-table thead th { position: sticky; top: 0; z-index: 1; }

.conf-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 3px;
    border-radius: 3px;
}
.conf-ok  { color: #198754; background: #d1e7dd; }
.conf-low { color: #842029; background: #f8d7da; }
.user-email {
    color: #495057;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-badge {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    background: linear-gradient(135deg, #e8eef7 0%, #f4f6fb 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    border: none;
    border-radius: 12px;
}

.login-logo {
    height: auto;
    max-height: 120px;
    width: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* Lighter placeholder text so empty inputs are visually distinct */
::placeholder {
    color: #c0c0c0 !important;
    opacity: 1;
}