:root {
    --portal-blue: #17618b;
    --portal-blue-dark: #104c70;
    --portal-gold: #80701d;
    --portal-panel: #4d4852;
    --portal-line: #c8c8c8;
    --portal-page: #eeeeee;
}

body {
    color: #282828;
    background: #e5e5e5;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.9rem;
}

.portal-shell {
    width: min(1440px, 94%);
    margin-inline: auto;
}

.portal-header {
    padding-top: 1px;
}

.masthead {
    min-height: 105px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 8px 14px;
    background: linear-gradient(105deg, #fff 0%, #fff 50%, #eef5f8 100%);
    border: 1px solid var(--portal-line);
    border-bottom: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--portal-blue);
    text-decoration: none;
}

.brand:hover {
    color: var(--portal-blue-dark);
}

.brand-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(1.7rem, 4vw, 2.55rem);
    line-height: 1;
}

.header-logo {
    display: block;
    width: auto;
    height: 84px;
    object-fit: contain;
}

.header-report-title {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
    line-height: 1.4;
    color: var(--portal-blue-dark);
    font-size: 0.82rem;
}

.header-report-title strong {
    color: var(--portal-gold);
    font-size: 1rem;
}

.portal-nav {
    display: flex;
    align-items: stretch;
    min-height: 35px;
    background: linear-gradient(#f6f6f6, #d2d2d2);
    border: 1px solid #b9b9b9;
}

.portal-nav a,
.portal-nav span {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: #222;
    border-right: 1px solid #bdbdbd;
    font-size: 0.79rem;
    font-weight: 700;
    text-decoration: none;
}

.portal-nav .active,
.portal-nav a:hover {
    background: #eee;
    color: var(--portal-blue-dark);
}

.portal-panel {
    background: var(--portal-page);
    border: 1px solid #bdbdbd;
    box-shadow: 0 1px 4px rgb(0 0 0 / 14%);
}

.panel-heading {
    padding: 12px 16px;
    color: var(--portal-blue-dark);
    background: #eaf2f7;
    border-bottom: 1px solid #cbdde8;
    font-weight: 700;
    line-height: 1.5;
}

.panel-body {
    padding: 20px;
}

.dashboard-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #c8c8c8;
    border-left: 5px solid var(--portal-blue);
}

.dashboard-intro h1 {
    margin: 0 0 4px;
    color: var(--portal-blue-dark);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.5rem;
}

.dashboard-intro p {
    margin: 0;
    color: #666;
}

.dashboard-intro .dashboard-instruction {
    margin-top: 5px;
    font-size: 0.82rem;
}

.report-tools {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 7px;
}

.report-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

#report-loaded-at {
    color: #64717a;
    font-size: 0.72rem;
}

#refresh-report {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 5px 10px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--portal-blue-dark);
    border-color: #c8dce8;
    white-space: nowrap;
}

#refresh-report:hover {
    color: #fff;
    background: var(--portal-blue-dark);
}

.iris-source-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 5px 10px;
    color: var(--portal-blue-dark);
    background: #edf4f8;
    border: 1px solid #c8dce8;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
}

#status:not(.d-none) {
    margin-top: 18px;
}

.amount-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 0;
}

.amount-card {
    min-width: 0;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 24px 0;
    color: #17394e;
    background: linear-gradient(180deg, #fff 0%, #fff 65%, #fbfaf5 100%);
    border: 1px solid #ccd5db;
    border-top: 3px solid #173e57;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 3px 12px rgb(23 57 78 / 7%);
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.amount-card:not(:disabled):hover {
    border-color: #567d94;
    box-shadow: 0 7px 20px rgb(23 57 78 / 14%);
    transform: translateY(-2px);
}

.amount-card:focus-visible {
    outline: 3px solid #17618b;
    outline-offset: 3px;
}

.amount-card[aria-pressed="true"] {
    border-color: #17618b;
    background: linear-gradient(180deg, #f5fafc, #fff);
    box-shadow: 0 0 0 1px #17618b, 0 5px 16px rgb(23 57 78 / 10%);
}

.amount-card:disabled {
    cursor: not-allowed;
}

.amount-cards[aria-busy="true"] .amount-card:disabled {
    cursor: progress;
}

.amount-card-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    color: var(--portal-blue-dark);
    background: #edf4f8;
    border: 1px solid #c8dce8;
    border-radius: 12px;
    font-size: 1.2rem;
}

.amount-card-caption {
    margin-bottom: 4px;
    color: #687681;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.amount-card-title {
    min-height: 1.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(1.15rem, 2vw, 1.4rem);
    line-height: 1.35;
}

.amount-card-total {
    margin: 8px 0 14px;
    color: #123e59;
    font-size: clamp(1.65rem, 2.7vw, 2.1rem);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.amount-card-footer {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 50px;
    margin-top: auto;
    padding: 10px 0;
    border-top: 1px solid #e0e5e8;
    text-align: left;
}

.amount-card-note {
    color: #64717a;
    font-size: 0.78rem;
}

.amount-card-action {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    color: #174e70;
    background: #edf3f6;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 700;
}

.amount-card:not(:disabled):hover .amount-card-action,
.amount-card[aria-pressed="true"] .amount-card-action {
    color: #fff;
    background: #174e70;
}

.amount-card:disabled .amount-card-action {
    color: #64717a;
    background: #f0f2f3;
}

@media (prefers-reduced-motion: reduce) {
    .amount-card {
        transition: none;
    }

    .amount-card:not(:disabled):hover {
        transform: none;
    }
}

.district-report {
    margin-top: 24px;
    padding: 22px;
    background: #fff;
    border: 1px solid #d6e0e7;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgb(16 76 112 / 5%);
}

.district-table-wrap {
    overflow-x: auto;
    min-width: 0;
}

/* Bootstrap's negative DataTables row margins should not create a scrollbar
 * when the table itself already fits its container. */
.dt-container > .dt-layout-row,
.dt-container.dt-bootstrap5 > .row {
    margin-inline: 0;
}

.dt-container > .dt-layout-row > .dt-layout-cell,
.dt-container.dt-bootstrap5 > .row > [class*="col-"] {
    padding-inline: 0;
    min-width: 0;
}

.dt-container .dt-layout-table {
    width: 100%;
}

#dataset-table {
    table-layout: fixed;
}

#dataset-table .district-name {
    overflow-wrap: anywhere;
}

.institution-name {
    display: block;
    margin-top: 4px;
    color: #64717a;
    font-size: 0.75rem;
    font-weight: 400;
}

.dt-container .dt-length[hidden],
.dt-container .dt-paging[hidden] {
    display: none !important;
}

.report-selection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.report-eyebrow {
    display: block;
    margin-bottom: 6px;
    color: #64717a;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.report-total {
    flex-shrink: 0;
    text-align: right;
}

.report-total span {
    display: block;
    color: #64717a;
    font-size: 0.78rem;
}

.report-total strong {
    display: block;
    margin-top: 4px;
    color: var(--portal-blue-dark);
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}

.report-selection h2 {
    margin: 0;
    color: var(--portal-blue-dark);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.25rem;
    line-height: 1.4;
}

.portal-spinner {
    color: var(--portal-blue);
}

.table-hint {
    margin-bottom: 18px;
    padding: 10px 12px;
    color: #456175;
    background: #f0f5f8;
    border-radius: 6px;
    font-size: 0.82rem;
}

#dataset-table,
#district-records-table {
    border: 1px solid #dce4ea;
    --bs-table-striped-bg: #f7f9fb;
}

#dataset-table thead th,
#district-records-table thead th,
#table-region .dt-scroll-head th,
#details-modal .dt-scroll-head th {
    padding: 14px 12px;
    color: #fff;
    background: #174e70;
    border-color: #2d617f;
    font-size: 0.8rem;
}

#dataset-table td,
#district-records-table td {
    vertical-align: middle;
    padding: 13px 12px;
    border-color: #e2e8ed;
    color: #283f50;
}

#dataset-table tbody tr {
    cursor: pointer;
}

#dataset-table tbody tr:focus {
    outline: 3px solid rgb(23 97 139 / 35%);
    outline-offset: -3px;
}

#dataset-table tbody tr:hover > * {
    --bs-table-bg-state: #edf4f8;
    background-color: #edf4f8;
}

.dt-container .dt-search input,
.dt-container .dt-length select {
    border: 1px solid #bdcbd6;
    border-radius: 6px;
    min-height: 36px;
    background-color: #fff;
}

.dt-container .dt-search {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.dt-container.dt-bootstrap5 .dt-search input {
    margin-left: 0;
    width: 280px;
    max-width: calc(100% - 56px);
}

.dt-container .dt-search input:focus,
.dt-container .dt-length select:focus {
    border-color: var(--portal-blue);
    box-shadow: 0 0 0 3px rgb(23 97 139 / 12%);
}

.dt-container .dt-info,
.dt-container .dt-search,
.dt-container .dt-length {
    color: #536979;
    font-size: 0.8rem;
}

.serial-number {
    min-width: 64px !important;
    width: 64px;
    text-align: center;
    color: #64717a;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.district-name {
    font-weight: 700;
}

.record-count,
.amount-value {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#dataset-table .amount-value {
    font-weight: 700;
}

.dt-container .pagination .page-link {
    color: var(--portal-blue-dark);
    border-radius: 4px;
    border-color: #dce4ea;
}

.dt-container .pagination .active > .page-link {
    color: #fff;
    background: var(--portal-blue-dark);
    border-color: var(--portal-blue-dark);
}

.portal-modal-header {
    padding: 18px 20px;
    color: #fff;
    background: #174e70;
}

.district-records-button {
    white-space: nowrap;
    padding: 7px 12px;
    color: var(--portal-blue-dark);
    background: #edf4f8;
    border-color: #c8dce8;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.78rem;
}

.district-records-button:hover {
    background: var(--portal-blue-dark);
    border-color: var(--portal-blue-dark);
}

#details-modal .modal-body {
    min-width: 0;
    padding: 20px;
}

#details-modal .modal-content {
    border-radius: 12px;
    overflow: hidden;
}

.modal-act-name {
    margin: 6px 0 0;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

#district-name {
    color: #f4d48b;
    font-weight: 700;
}

.modal-records-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 7px;
    padding: 10px 12px;
    color: #536979;
    background: #f0f5f8;
    border: 1px solid #dce7ee;
    border-radius: 7px;
}

.modal-establishment {
    margin: 6px 0 0;
    color: #d9e9f3;
    font-size: 0.83rem;
    line-height: 1.45;
}

.balance-explanation {
    margin: 0 0 10px;
    color: #64717a;
    font-size: 0.76rem;
    line-height: 1.5;
}

#details-modal .dt-layout-row:not(.dt-layout-table),
#details-modal .dt-bootstrap5 > .row:not(.dt-layout-table) {
    margin-block: 8px;
}

.modal-records-summary strong {
    color: var(--portal-blue-dark);
    font-variant-numeric: tabular-nums;
}

.modal-records-table-wrap {
    overflow-x: auto;
    min-width: 0;
}

#district-records-table {
    table-layout: fixed;
}

#district-records-table th {
    padding: 12px 8px;
    overflow-wrap: anywhere;
}

#district-records-table td {
    padding: 14px 8px;
    font-size: 0.82rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#district-records-table .serial-number {
    min-width: 0 !important;
    white-space: nowrap;
    overflow-wrap: normal;
}

.record-status {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-unclaimed {
    color: #24586b;
    background: #eaf3f7;
}

.status-partial {
    color: #795a1b;
    background: #f8f1dd;
}

#details-modal .modal-footer {
    padding: 12px 20px;
    background: #f7f9fb;
    border-color: #e2e8ed;
}

@media (min-width: 576px) {
    #details-modal .modal-dialog {
        max-width: min(1320px, calc(100% - 48px));
    }
}

.portal-footer {
    padding: 10px 0 6px;
}

.footer-inner {
    padding: 12px;
    text-align: center;
    background: #f3f3f3;
    border: 1px solid #bdbdbd;
    color: #333;
    font-size: 0.74rem;
}

.footer-inner a {
    color: var(--portal-gold);
    font-weight: 700;
    text-decoration: none;
}

.footer-inner strong {
    display: block;
    margin-top: 4px;
}

.divider {
    padding-inline: 7px;
    color: #888;
}

@media (max-width: 767.98px) {
    .portal-shell {
        width: calc(100% - 24px);
    }
    #dataset-table {
        min-width: 700px;
    }

    .report-tools {
        width: 100%;
        align-items: stretch;
    }

    .report-actions {
        justify-content: space-between;
    }
    #district-records-table {
        min-width: 760px;
    }

    #details-modal .modal-body {
        padding: 14px;
    }
    .district-report {
        padding: 14px;
    }

    .report-total {
        text-align: left;
    }
    .header-logo {
        height: 68px;
    }

    .masthead {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding-block: 14px;
    }

    .header-report-title {
        align-items: flex-start;
        text-align: left;
    }

    .portal-nav span:not(:last-child) {
        display: none;
    }

    .portal-nav a,
    .portal-nav span {
        padding: 8px 11px;
    }

    .panel-body {
        padding: 12px;
    }

    .dashboard-intro,
    .report-selection {
        flex-direction: column;
    }

    .amount-cards {
        grid-template-columns: 1fr;
    }

    .amount-card {
        min-height: 240px;
        padding-inline: 20px;
    }

    .amount-card-footer {
        flex-wrap: wrap;
    }

    .report-selection {
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .portal-shell {
        width: 100%;
    }

    .masthead {
        min-height: 88px;
        padding-inline: 10px;
    }

    .brand {
        gap: 10px;
    }

    .brand-title {
        font-size: 1.45rem;
    }
}
