:root {
    --bs-font-sans-serif: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.app-heading {
    display: flex;
    align-items: baseline;
    flex: 1 1 28rem;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    min-width: 0;
}

.app-title {
    flex: 0 1 auto;
    min-width: 0;
    font-size: clamp(1rem, 1.4vw, 1.5rem);
    overflow-wrap: anywhere;
}

.app-group {
    min-width: 0;
    padding-inline-start: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.app-user {
    flex: 0 1 20rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.app-sidebar .sidebar-brand {
    height: auto;
    min-height: 5rem;
    padding: 0.75rem;
    border-bottom: 0;
}

.app-sidebar .sidebar-brand .brand-link {
    width: 100%;
    justify-content: center;
    padding: 0.375rem 0.25rem;
    border-radius: 0.5rem;
}

.app-sidebar .sidebar-brand .brand-image {
    /* Use the logo's natural dimensions, just like EasyAdmin. */
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: none;
    object-fit: contain;
}

.app-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    min-height: 0;
    padding: 0.5rem 0.75rem;
    color: #52627a;
    background-color: #f5f7fb;
    border-top: 1px solid #dce3ee;
    font-size: 0.75rem;
    line-height: 1.5;
}

.portal-footer-product {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 24rem;
    min-width: 0;
}

.portal-footer-mark {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.375rem;
    color: #3862a2;
    background-color: #e7edf7;
}

.portal-footer-title {
    min-width: 0;
    color: #34465f;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.portal-footer-version {
    flex-shrink: 0;
    padding: 0.125rem 0.5rem;
    border: 1px solid #dce3ee;
    border-radius: 999px;
    color: #52627a;
    background-color: white;
    font-size: 0.6875rem;
    white-space: nowrap;
}

.portal-footer-copyright {
    flex-shrink: 0;
    white-space: nowrap;
}

.portal-footer-copyright a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #31588b;
    font-weight: 600;
    text-decoration: none;
}

.portal-footer-copyright a:hover,
.portal-footer-copyright a:focus-visible {
    text-decoration: underline;
}

.portal-footer-copyright .fa {
    font-size: 0.625rem;
}

.app-main > .app-content { padding-inline: 0.75rem; }

/* Keep the overview cards equal; names use the full group-card width. */
.dashboard-panel-body {
    height: 350px;
    min-width: 0;
}

.home-group-list,
.home-sdg-list { overflow: auto; }

.home-group-entry {
    padding-block: 0.75rem;
}

.home-group-entry + .home-group-entry {
    border-top: 1px solid var(--bs-border-color);
}

.home-group-choice {
    display: flex;
    align-items: start;
    gap: 0.5rem;
    min-width: 0;
}

.home-group-choice .form-check-input {
    flex-shrink: 0;
    margin: 0.25rem 0 0;
}

.home-company-list {
    list-style: none;
    margin: 0.75rem 0;
    padding: 0;
    padding-inline-start: 1.5rem;
    min-width: 0;
}

.home-group-choice a,
.home-company-list li { overflow-wrap: anywhere; }

.text-underline-hover { text-decoration: none; }
.text-underline-hover:hover { text-decoration: underline; }
th.header-small { font-weight: bold; font-size: small; }

.viewport-scroll {
    min-width: 0;
    overflow: auto;
}

.viewport-form > .viewport-scroll {
    padding-inline: 0.75rem;
}

.table-summary-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.5rem 0.5rem;
}

.table-summary-heading > div { min-width: 0; }

.page-group-heading {
    overflow-wrap: anywhere;
}

/* Bootstrap's grid stacks controls on mobile; report settings stay compact. */
.report-export-card, .workflow-filter-card, .validation-filter-card, .image-filter-card, .password-change-card, .data-menu-filter-card {
    width: 100%;
    margin-bottom: 1.5rem;
}

.report-export-card, .password-change-card { max-width: 900px; }

.report-export-card, .workflow-filter-card, .validation-filter-card, .image-filter-card, .image-editor-card, .password-change-card, .data-menu-filter-card {
    margin-top: 0.75rem;
}

.report-export-card .report-export-header,
.image-filter-card .image-library-header,
.workflow-filter-card .workflow-header,
.validation-filter-card .validation-header,
.password-change-card .password-change-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background-color: var(--bs-body-bg);
}

.report-export-icon, .image-library-icon, .workflow-icon, .validation-icon, .password-change-icon, .data-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--bs-border-radius-lg);
    color: var(--bs-primary-text-emphasis);
    background-color: var(--bs-primary-bg-subtle);
    font-size: 1.375rem;
}

.report-export-intro, .image-library-intro, .workflow-intro, .validation-intro, .password-change-intro, .data-menu-intro { min-width: 0; }
.report-export-intro h1, .image-library-intro h1, .workflow-intro h1, .validation-intro h1, .password-change-intro h1, .data-menu-intro h1 {
    margin: 0 0 0.375rem;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
}

.report-export-card .card-body, .workflow-filter-card .card-body, .validation-filter-card .card-body, .image-filter-card .card-body, .password-change-card .card-body, .data-menu-filter-card .card-body { padding: 1.25rem; }
.report-export-card .form-label, .workflow-filter-card .form-label, .validation-filter-card .form-label, .password-change-card .form-label, .data-menu-filter-card .form-label { font-weight: 600; }
.report-export-card .report-export-actions, .workflow-filter-card .workflow-actions, .validation-filter-card .validation-actions, .image-filter-card .image-filter-actions, .password-change-card .password-change-actions {
    padding: 1rem 1.25rem;
    background-color: var(--bs-tertiary-bg);
}
.report-export-actions .btn, .workflow-actions .btn, .validation-actions .btn, .image-filter-actions .btn, .password-change-actions .btn, .data-menu-actions .btn { min-width: 8rem; }

.data-menu { min-width: 0; }
.data-menu [hidden] { display: none !important; }
.data-menu-filter-card { margin-bottom: 1rem; }
.data-menu-heading { display: flex; flex: 0 0 auto; align-items: center; gap: 0.75rem; min-height: 2.375rem; }
.data-menu-icon { width: 2.25rem; height: 2.25rem; font-size: 1.125rem; }
.data-menu-intro h1 { margin: 0; }
.data-menu-filter-card .card-body { padding: 0.75rem 1rem; }
.data-menu-filter-card .form-label { margin-bottom: 0.25rem; }
.data-menu-filter-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; }
.data-menu-search { flex: 1 1 14rem; min-width: 0; max-width: 35rem; }
.data-menu-state-filter { flex: 0 1 14rem; min-width: 20rem; max-width: 30rem; }
.data-menu-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 0.5rem; }
.data-menu-actions .btn { min-width: 6rem; }
.data-menu-toggle .form-check { display: flex; align-items: center; gap: 0.5rem; min-height: 2.375rem; padding: 0; margin: 0; }
.data-menu-toggle .form-check-input { float: none; flex-shrink: 0; margin: 0; }
.data-menu-category { min-width: 0; margin-bottom: 1.5rem; }
.data-menu-category-header { padding: 1rem 1.25rem; color: #fff; background: var(--data-menu-color, var(--bs-primary)); }
.data-menu-category-header h2 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.data-menu-category-body { padding: 1.25rem; }
.data-menu-subgroup { min-width: 0; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); overflow: hidden; }
.data-menu-subgroup + .data-menu-subgroup { margin-top: 1.25rem; }
.data-menu-subgroup-header { position: relative; padding: 0.75rem 1rem; border-bottom: 1px solid var(--bs-border-color); color: #fff; background: var(--data-menu-color, var(--bs-primary)); }
.data-menu-subgroup-header h3 { margin: 0; font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.data-menu-anchor { scroll-margin-top: 5rem; }
/* Tables grow with their rows; collapsed borders must not add a vertical scrollbar. */
.data-menu-table-scroll { overflow-x: auto; overflow-y: hidden; }
.data-menu-table th, .data-menu-table td { padding: 0.75rem; }
.data-menu-table thead th { background: var(--bs-tertiary-bg); }
.data-menu-table .data-menu-number { width: 5rem; min-width: 4.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.data-menu-table td.data-menu-number { white-space: nowrap; }
.data-menu-state { min-width: 15rem; white-space: nowrap; }
.data-menu-state span { display: inline-block; padding: 0.25rem 0.625rem; border-radius: 0.375rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.data-menu-name { min-width: 18rem; overflow-wrap: anywhere; }
.data-menu-code { font-size: 0.875rem; }
.data-menu-matches { margin: 0.5rem 0 0; padding-inline-start: 1.25rem; font-size: 0.875rem; }
.data-menu-columns { --bs-gutter-x: 0; --bs-gutter-y: 0; margin: 0; gap: 1.5rem; }
.data-menu-columns > .data-menu-category { flex: 1 1 18rem; max-width: 100%; padding: 0; margin: 0; }
.data-menu-links { padding: 0; }
.data-menu-link-item { padding: 1rem 1.25rem; overflow-wrap: anywhere; }
.data-menu-link-item + .data-menu-link-item { border-top: 1px solid var(--bs-border-color); }
.data-menu-empty .card-body { padding: 2.5rem 1.25rem; text-align: center; color: var(--bs-secondary-color); }
.data-menu-empty .fa { font-size: 1.75rem; }
.data-menu-results { margin-bottom: 1.5rem; }
@media (max-width: 575.98px) {
    .data-menu-heading { flex-basis: 100%; }
    .data-menu-search, .data-menu-state-filter { flex-basis: 100%; max-width: 100%; }
}

.validation-results-card { min-width: 0; margin-bottom: 1.5rem; }
.validation-results-card > .card-header, .image-library-card > .image-library-results-header, .dashboard-card > .card-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; flex-shrink: 0; gap: 0.5rem 1rem; padding: 1rem 1.25rem; background: var(--bs-body-bg); }
.validation-results-card > .card-header::after, .validation-actions::after, .image-library-results-header::after, .image-filter-actions::after, .dashboard-card > .card-header::after { display: none; }
.validation-results-card h2, .image-library-results-header h2, .dashboard-card > .card-header h2 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.dashboard-card > .card-header h2 { min-width: 0; overflow-wrap: anywhere; }
.validation-table-scroll { min-width: 0; overflow: auto; }
.validation-table th, .validation-table td { padding: 0.75rem; }
.validation-table thead th { position: sticky; top: 0; z-index: 1; white-space: nowrap; background: var(--bs-tertiary-bg); }
.validation-name { min-width: 10rem; max-width: 22rem; overflow-wrap: anywhere; }
.validation-type { min-width: 18rem; max-width: 32rem; overflow-wrap: anywhere; }
.validation-state { display: inline-block; padding: 0.25rem 0.625rem; border-radius: 0.375rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.validation-empty td { padding-block: 2.5rem; text-align: center; color: var(--bs-secondary-color); }
.validation-empty .fa { font-size: 1.75rem; }
@media (min-width: 992px) and (min-height: 40rem) {
    .validation-page .page-body > .validation-results-card { flex: 1; min-height: 18rem; }
}

.workflow-results { margin-bottom: 1.5rem; }
.workflow-results > [class*="col-"] { min-width: 0; }
.workflow-result-card { min-width: 0; height: 100%; margin-bottom: 0; }
.workflow-result-card .card-header { padding: 1rem 1.25rem; background-color: var(--bs-body-bg); }
.workflow-result-card h2 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.workflow-result-card .card-body { min-width: 0; padding: 1.25rem; }

/* Image library and editor: bounded previews, readable names and native theme colors. */
.image-page-title { margin: 0; font-size: 1.25rem; font-weight: 700; }
.image-library-card, .image-editor-card { min-width: 0; margin-bottom: 1.5rem; }
.image-editor-card { max-width: 1100px; }
.image-library-card .card-header, .image-editor-card .card-header { padding: 1.25rem; background: var(--bs-body-bg); }
.image-editor-card .card-body { padding: 1.25rem; }
.image-filters .form-label, .image-editor-card .form-label { font-weight: 600; }
.image-library-table { width: auto; max-width: 100%; }
.image-library-table th, .image-library-table td { padding: 0.75rem; }
.image-library-table thead th { position: sticky; top: 0; z-index: 1; background: var(--bs-tertiary-bg); white-space: nowrap; }
.image-library-site, .image-library-type { min-width: 10rem; max-width: 22rem; overflow-wrap: anywhere; }
.image-actions { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.image-library-empty td { text-align: center; color: var(--bs-secondary-color); padding-block: 2.5rem; }
.image-library-empty .fa { font-size: 1.75rem; }
.image-library-footer { display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; flex-shrink: 0; gap: 1rem; padding: 1rem; }
.image-library-footer::after { display: none; }

/* Keep image actions visible; filters and table scroll separately in short windows. */
html:has(> body.image-library-page) { overflow: hidden; }
body.image-library-page { height: 100vh; height: 100dvh; overflow: clip; }
.image-library-page > .app-wrapper {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
}
.image-library-page .app-main { min-height: 0; overflow: hidden; }
.image-library-page .page-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
}
.image-library-page .page-body > header,
.image-library-page .app-main > .alert { flex-shrink: 0; }
.image-library-page .page-body > .image-filters { flex: 0 1 auto; min-height: 0; margin-bottom: 1.5rem; overflow: auto; }
.image-library-page .image-filter-card { margin-bottom: 0; }
.image-library-page .page-body > .image-library-card { flex: 1 0 14rem; min-height: 0; margin-bottom: 0.75rem; }
.image-library-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: auto;
}
.image-library-content > * { flex-shrink: 0; }
.image-library-content > .image-library-scroll { flex: 1; min-height: 0; overflow: auto; }
.image-thumbnail-frame { display: flex; align-items: center; justify-content: center; width: 160px; height: 100px; background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); border-radius: 0.375rem; text-decoration: none; }
.image-thumbnail { display: block; width: 100%; height: 100%; object-fit: contain; }
.image-thumbnail-frame[data-image-open] { cursor: zoom-in; }
.image-viewer {
    width: min(70rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 30%);
}
.image-viewer[open] { display: flex; flex-direction: column; }
.image-viewer::backdrop { background: rgb(0 0 0 / 65%); }
.image-viewer-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--bs-border-color); }
.image-viewer-header h2 { min-width: 0; overflow-wrap: anywhere; }
.image-viewer-header .btn-close { flex-shrink: 0; }
.image-viewer-body { display: grid; place-items: center; min-height: 0; overflow: auto; padding: 1rem; }
.image-viewer-image { display: block; max-width: 100%; max-height: calc(100vh - 9rem); max-height: calc(100dvh - 9rem); object-fit: contain; }
.image-viewer [hidden] { display: none !important; }
.image-file-name { overflow-wrap: anywhere; max-width: 22rem; }
.image-preview-panel { min-width: 0; padding: 1rem; border: 1px solid var(--bs-border-color); border-radius: 0.5rem; background: var(--bs-tertiary-bg); }
.image-editor-preview { display: flex; justify-content: center; align-items: center; min-height: 12rem; }
.image-editor-preview img { display: block; max-width: 100%; max-height: 320px; object-fit: contain; }
.image-preview-placeholder { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 0.75rem; padding: 0.75rem; text-align: center; color: var(--bs-secondary-color); font-size: 0.875rem; }
.image-preview-placeholder .fa { font-size: 2rem; }
.image-editor-card [hidden], .image-thumbnail-frame [hidden] { display: none !important; }
.image-editor-card [data-image-save][aria-disabled="true"] { pointer-events: none; opacity: 0.65; }

.table-summary-heading h1 {
    margin: 0;
    color: #193b70;
    font-size: clamp(1.125rem, 1.6vw, 1.5rem);
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.table-summary-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding-bottom: 0.75rem;
    color: #52627a;
    font-size: 0.8125rem;
}

.table-summary-count {
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    color: #31588b;
    background-color: #edf3fc;
    font-variant-numeric: tabular-nums;
}

.table-summary-scroll {
    margin-bottom: 1rem;
    border: 1px solid #dce3ee;
    border-radius: 0.625rem;
    background-color: white;
    box-shadow: 0 2px 6px rgb(25 59 112 / 5%);
}

.table-summary-scroll:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.table-summary-table {
    --bs-table-bg: white;
    --bs-table-striped-bg: #f6f8fc;
    --bs-table-hover-bg: #edf3fc;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    color: #26374d;
    font-size: 0.875rem;
}

.table-summary-table > :not(caption) > * > * {
    padding: 0.75rem 0.875rem;
    vertical-align: middle;
    border-bottom-color: #e5ebf3;
}

.table-summary-table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 2;
    color: white;
    background-color: #193b70;
    border-bottom: 0;
    border-inline-end: 1px solid rgb(255 255 255 / 12%);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: normal;
}

.table-summary-table .table-summary-id {
    min-width: 4rem;
    font-variant-numeric: tabular-nums;
}

.table-summary-table tbody .table-summary-id { color: #64748b; }

.table-summary-table .table-summary-site {
    min-width: 13rem;
    max-width: 20rem;
    font-weight: 600;
}

.table-summary-table .table-summary-number {
    min-width: 10rem;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table-summary-table thead .table-summary-number {
    max-width: 15rem;
    white-space: normal;
}

.table-summary-table .table-summary-text {
    min-width: 12rem;
    max-width: 24rem;
    overflow-wrap: anywhere;
}

.table-summary-table > tfoot > tr > * {
    position: sticky;
    bottom: 0;
    z-index: 1;
    color: #193b70;
    background-color: #eaf1fc;
    border-top: 2px solid #90acd2;
    border-bottom: 0;
    font-weight: 700;
}

.table-summary-table .table-summary-warning {
    color: #842029;
    background-color: #fcebec;
    white-space: normal;
}

.table-summary-table .table-summary-empty td {
    padding-block: 2.5rem;
    color: #64748b;
    text-align: center;
}

@media (max-width: 575.98px) {
    .table-summary-heading { flex-wrap: wrap; }
}

/* Vich's compound file row must not get AdminLTE's decorative fieldset frame. */
.viewport-form fieldset.attachment-upload {
    border: 0;
    padding: 0;
}

.attachment-controls .form-check {
    margin-bottom: 0;
}

.record-header-site {
    min-width: 0;
}

.record-header-fiscal-year .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* Match the Bootstrap control height, without a label-sized top offset. */
    min-height: calc(1.5em + 0.75rem + 2px);
    margin: 0;
    padding: 0;
}

.record-header-fiscal-year .form-check-input {
    float: none;
    flex-shrink: 0;
    margin: 0;
}

.record-header-fiscal-year .form-check-label {
    white-space: nowrap;
}

@media (min-width: 1200px) {
    .record-header-fields { flex-wrap: nowrap; }
    .record-header-site { flex: 0 1 35rem; }
    .record-header-year { width: 7rem; }
}

/* Grid measures header/footer naturally; no JavaScript or fixed-height offsets. */
@media (min-width: 992px) and (min-height: 40rem) {
    body.viewport-page { overflow: hidden; }

    .viewport-page > .app-wrapper {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .viewport-page .app-main {
        min-width: 0;
        min-height: 0;
        overflow: auto;
    }

    .viewport-page .page-body,
    .viewport-page .viewport-form {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        min-width: 0;
    }

    .viewport-page .page-body > *,
    .viewport-page .viewport-form > *,
    .viewport-page .app-main > .alert {
        flex-shrink: 0;
    }

    .viewport-page .page-body > .viewport-form { flex: 1; }
    .viewport-page .viewport-scroll { flex: 1; min-height: 0; }
}

@media (max-width: 575.98px) {
    .app-header .container-fluid { flex-wrap: wrap; }
    .app-heading { flex-basis: calc(100% - 4rem); }
    .app-title { flex-basis: 100%; }
    .app-group { padding-inline-start: 0; }
    .app-user { flex-basis: 100%; font-size: 0.8rem; }
}

.hr-text {
    line-height: 2em;
    position: relative;
    margin: 4px 0;
    border: 0;
    color: #2f4197;
    text-align: start;
    height: 2em;
    opacity: 1;
}
.hr-text::before {
    content: '';
    background: #2f4197;
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
}
.hr-text::after {
    content: attr(data-content);
    position: relative;
    display: inline-block;
    padding: 0 2em;
    line-height: 2em;
    color: white;
    background-color: #2f4197;
}
