* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    color: #10213d;
    background: #f5f7fb;
}

.login-page {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            135deg,
            #071426 0%,
            #102d56 100%
        );

    padding: 24px;
}

.login-container {
    width: 100%;
    max-width: 430px;
}

.login-brand {
    text-align: center;
    color: #ffffff;

    margin-bottom: 28px;
}

.brand-badge {
    width: 64px;
    height: 64px;

    margin: 0 auto 14px;

    border-radius: 16px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ffffff;
    color: #102d56;

    font-size: 20px;
    font-weight: 800;
}

.login-brand h1 {
    margin: 0 0 8px;

    font-size: 32px;
}

.login-brand p {
    margin: 0;

    color: #d8e2f1;

    font-size: 14px;
}

.login-card {
    background: #ffffff;

    border-radius: 18px;

    padding: 34px;

    box-shadow:
        0 24px 65px rgba(0, 0, 0, 0.28);
}

.login-card h2 {
    margin: 0 0 6px;

    font-size: 25px;
}

.login-subtitle {
    margin: 0 0 28px;

    color: #65738a;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;

    margin-bottom: 7px;

    font-size: 14px;
    font-weight: 600;
}

.form-group input {
    width: 100%;

    border: 1px solid #ced6e2;
    border-radius: 9px;

    padding: 12px 14px;

    font-size: 15px;

    outline: none;
}

.form-group input:focus {
    border-color: #174c8f;

    box-shadow:
        0 0 0 3px rgba(23, 76, 143, 0.12);
}

.btn {
    border: 0;
    border-radius: 9px;

    padding: 12px 18px;

    cursor: pointer;

    font-size: 15px;
    font-weight: 600;
}

.btn-primary {
    background: #102d56;
    color: #ffffff;
}

.btn-primary:hover {
    background: #0b2344;
}

.btn-full {
    width: 100%;
}

.alert {
    padding: 12px 14px;

    margin-bottom: 20px;

    border-radius: 8px;

    font-size: 14px;
}

.alert-error {
    color: #8d1b20;

    background: #fff0f1;

    border: 1px solid #f0c9cd;
}

.topbar {
    min-height: 68px;

    padding: 0 28px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: #0b1f3a;
    color: #ffffff;
}

.topbar-subtitle {
    margin-left: 16px;

    color: #c8d4e5;

    font-size: 14px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 18px;
}

.app-layout {
    display: grid;

    grid-template-columns: 230px 1fr;

    min-height: calc(100vh - 68px);
}

.sidebar {
    background: #ffffff;

    border-right: 1px solid #dfe5ee;

    padding: 24px 14px;
}

.sidebar-link {
    display: block;

    padding: 12px 14px;
    margin-bottom: 5px;

    border-radius: 8px;

    text-decoration: none;

    color: #253651;

    font-weight: 600;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: #eaf0f8;

    color: #0b2c59;
}

.main-content,
.page-container {
    padding: 32px;

    width: 100%;
}

.page-container {
    max-width: 1500px;

    margin: 0 auto;
}

.narrow-container {
    max-width: 900px;
}

.page-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 20px;

    margin-bottom: 28px;
}

.page-header h1 {
    margin: 0 0 6px;
}

.page-header p {
    margin: 0;

    color: #65738a;
}

.stat-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 20px;

    margin-bottom: 28px;
}

.stat-card,
.content-card {
    background: #ffffff;

    border: 1px solid #dde4ee;

    border-radius: 14px;

    box-shadow:
        0 5px 18px rgba(17, 36, 64, 0.05);
}

.stat-card {
    padding: 24px;
}

.stat-card span {
    display: block;

    margin-bottom: 10px;

    color: #65738a;
}

.stat-card strong {
    font-size: 32px;

    color: #102d56;
}

.content-card {
    padding: 26px;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;

    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 13px 12px;

    border-bottom: 1px solid #e6eaf0;

    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: #4c5d75;

    background: #f7f9fc;

    font-size: 13px;
}

.action-cell {
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.btn-light {
    background: #ffffff;

    color: #102d56;
}

.btn-small {
    display: inline-block;

    padding: 7px 10px;

    margin: 2px;

    border: 1px solid #ced6e2;

    background: #ffffff;

    color: #173253;

    text-decoration: none;

    border-radius: 7px;
}

.badge {
    display: inline-block;

    padding: 5px 9px;

    border-radius: 20px;

    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    color: #176237;

    background: #e7f6ed;
}

.badge-danger {
    color: #8b2026;

    background: #fcebed;
}

.alert-success {
    color: #176237;

    background: #eaf7ef;

    border: 1px solid #bfe5cc;
}

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;
}

.full-width {
    grid-column: 1 / -1;
}

.form-group select,
.district-section select {
    width: 100%;

    padding: 12px 14px;

    border: 1px solid #ced6e2;

    border-radius: 9px;

    background: #ffffff;

    font-size: 15px;
}

.form-group small {
    display: block;

    margin-top: 6px;

    color: #708096;
}

.district-section {
    display: none;

    margin-top: 26px;

    padding-top: 22px;

    border-top: 1px solid #e1e6ed;
}

.district-section h3 {
    margin-top: 0;
}

.section-help {
    color: #65738a;
}

.district-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 10px;
}

.district-checkbox {
    display: flex;

    gap: 8px;
    align-items: center;

    padding: 10px;

    border: 1px solid #dde4ec;

    border-radius: 8px;

    cursor: pointer;
}

.form-actions {
    display: flex;

    justify-content: flex-end;

    gap: 10px;

    margin-top: 28px;
}

@media (max-width: 900px) {

    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .form-grid,
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .district-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }
}
.stat-text {
    font-size: 19px !important;
}

.scope-list {
    display: flex;
    flex-wrap: wrap;

    gap: 10px;

    margin-top: 18px;
}

.scope-badge {
    display: inline-block;

    padding: 9px 14px;

    border-radius: 20px;

    background: #eaf0f8;

    color: #12396a;

    font-size: 14px;
    font-weight: 700;
}

.scope-description {
    margin-top: 20px;

    color: #65738a;

    line-height: 1.6;
}

.payment-type-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 18px;

    margin-top: 22px;
}

.payment-type-card {
    min-height: 150px;

    padding: 22px;

    display: flex;
    flex-direction: column;

    justify-content: center;

    border:
        1px solid #dbe3ee;

    border-radius: 14px;

    background: #ffffff;

    color: #102d56;

    text-decoration: none;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.payment-type-card:hover {
    transform:
        translateY(-2px);

    border-color:
        #2e5f99;

    box-shadow:
        0 9px 25px
        rgba(
            15,
            43,
            79,
            0.10
        );
}

.payment-type-card strong {
    font-size: 17px;

    line-height: 1.35;

    margin-bottom: 7px;
}

.payment-type-card span {
    color: #65738a;

    font-size: 13px;

    line-height: 1.5;
}

.payment-type-icon {
    width: 42px;
    height: 42px;

    margin-bottom: 15px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #eaf0f8;

    color: #123f76;

    font-size: 20px;
    font-weight: 800;
}

.form-group textarea {
    width: 100%;

    min-height: 90px;

    resize: vertical;

    padding: 12px 14px;

    border:
        1px solid #ced6e2;

    border-radius: 9px;

    font-family: inherit;

    font-size: 15px;
}

.applicant-section {
    margin-top: 32px;

    padding-top: 26px;

    border-top:
        1px solid #e1e6ed;
}

.applicant-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 20px;

    margin-bottom: 20px;
}

.applicant-header h2 {
    margin:
        0 0 5px;
}

.applicant-header p {
    margin: 0;

    color: #65738a;
}

.applicant-card {
    padding: 20px;

    margin-bottom: 16px;

    border:
        1px solid #dce4ee;

    border-radius: 12px;

    background: #f9fbfd;
}

.applicant-card-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 18px;
}

@media (
    max-width: 950px
) {

    .payment-type-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }
}

@media (
    max-width: 650px
) {

    .payment-type-grid {
        grid-template-columns:
            1fr;
    }
}

.document-upload-section {
    margin-top: 30px;

    padding-top: 24px;

    border-top:
        1px solid #e1e6ed;
}

.document-upload-section p {
    color: #65738a;
}

.detail-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 18px;

    margin-top: 20px;
}

.detail-item {
    padding: 14px;

    background: #f7f9fc;

    border-radius: 9px;
}

.detail-item span {
    display: block;

    margin-bottom: 5px;

    color: #65738a;

    font-size: 13px;
}

.detail-item strong {
    display: block;

    color: #102d56;

    word-break: break-word;
}

.section-gap {
    margin-top: 22px;
}

.document-list {
    display: flex;

    flex-direction: column;

    gap: 10px;

    margin-top: 18px;
}

.document-row {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 18px;

    padding: 14px;

    border:
        1px solid #dde4ee;

    border-radius: 9px;
}

.document-row span {
    display: block;

    margin-top: 4px;

    color: #65738a;

    font-size: 12px;
}

.applicant-summary {
    padding: 15px;

    margin-top: 12px;

    border:
        1px solid #dde4ee;

    border-radius: 10px;

    background: #f9fbfd;
}

@media (max-width: 700px) {

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .document-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* =========================================================
   CHECKER WORKFLOW
========================================================= */

.checker-review-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 1.15fr)
        minmax(360px, 0.85fr);

    gap: 22px;

    align-items: start;
}


.checker-search-form {
    display: flex;

    align-items: end;

    gap: 16px;

    flex-wrap: wrap;
}


.checker-search-form .form-group {
    flex: 1;

    min-width: min(280px, 100%);
}

.checker-decision-section .form-actions {
    flex-wrap: wrap;
}

.checker-review-layout > *,
.checker-review-layout .document-row > * {
    min-width: 0;
    overflow-wrap: anywhere;
}


.review-field-list {
    display: flex;

    flex-direction: column;

    gap: 14px;

    margin-top: 20px;
}


.review-field-card {
    padding: 18px;

    border:
        1px solid #dce4ee;

    border-radius: 12px;

    background: #f9fbfd;
}


.review-field-main {
    margin-bottom: 14px;
}


.review-label {
    display: block;

    margin-bottom: 5px;

    color: #65738a;

    font-size: 13px;

    font-weight: 600;
}


.review-value {
    display: block;

    color: #102d56;

    font-size: 16px;

    line-height: 1.5;

    word-break: break-word;
}


.review-options {
    display: flex;

    flex-wrap: wrap;

    gap: 12px;

    margin-bottom: 15px;
}


.review-choice {
    display: inline-flex;

    align-items: center;

    gap: 7px;

    padding: 9px 12px;

    border:
        1px solid #d6deea;

    border-radius: 9px;

    background: #ffffff;

    cursor: pointer;
}


.review-choice input {
    margin: 0;
}


.checker-decision-section {
    margin-top: 28px;

    padding-top: 24px;

    border-top:
        1px solid #dce4ee;
}


.checker-pdf-preview {
    width: 100%;

    height: 650px;

    margin-top: 20px;

    overflow: hidden;

    border:
        1px solid #dce4ee;

    border-radius: 10px;

    background: #f4f6f9;
}


.checker-pdf-preview iframe {
    width: 100%;

    height: 100%;

    border: 0;
}


.btn-danger {
    background: #a92929;

    color: #ffffff;

    border:
        1px solid #a92929;
}


.btn-danger:hover {
    background: #8d2020;
}


@media (
    max-width: 1000px
) {

    .checker-review-layout {
        grid-template-columns:
            1fr;
    }


    .checker-pdf-preview {
        height: 550px;
    }
}


@media (
    max-width: 650px
) {

    .review-options {
        flex-direction: column;
    }


    .checker-pdf-preview {
        height: 450px;
    }
}

/* Workflow pages reuse the existing review cards and document layout. */
:is(.recommender-page, .head-office-page) .form-actions {
    flex-wrap: wrap;
}

:is(.recommender-page, .head-office-page) .recommendation-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

:is(.recommender-page, .head-office-page) .table-wrapper {
    max-width: 100%;
}

@media (max-width: 650px) {
    :is(.recommender-page, .head-office-page) .topbar {
        flex-wrap: wrap;
        gap: 14px;
        padding: 16px;
    }

    :is(.recommender-page, .head-office-page) .topbar-user {
        flex-wrap: wrap;
    }

    :is(.recommender-page, .head-office-page) .page-container {
        padding: 20px 14px;
    }

    :is(.recommender-page, .head-office-page) .content-card {
        padding: 18px;
    }
}

.workflow-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.head-office-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
    .head-office-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .head-office-stats {
        grid-template-columns: 1fr;
    }
}


/* Step 12 operational pages reuse the existing cards, forms and tables. */
.operational-page .page-container {
    padding: 28px;
}

.operational-page .content-card {
    margin-top: 20px;
}

.operational-page .form-grid {
    margin: 24px 0;
}

.topbar-user {
    flex-wrap: wrap;
}

@media (max-width: 800px) {
    .topbar {
        flex-wrap: wrap;
        gap: 12px;
        padding: 16px;
    }

    .operational-page .page-container {
        padding: 16px;
    }
}


/* Correction feedback stays beside the existing configurable payment fields. */
.correction-summary,
.correction-history {
    margin-bottom: 24px;
}

.correction-incorrect {
    border-left: 4px solid #b42318;
    padding: 12px;
    background: #fff0f1;
    border-radius: 8px;
}

.correction-comment {
    color: #9d2118;
}

.correction-history td:nth-child(4) {
    min-width: 240px;
    overflow-wrap: anywhere;
}


/* Release candidate usability: visible keyboard focus and contained narrow layouts. */
:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid #2b6cb0;
    outline-offset: 3px;
}

.app-layout > *, .form-grid > *, .stat-grid > *, .content-card {
    min-width: 0;
}

.content-card, .detail-item, .badge, .topbar-user {
    overflow-wrap: anywhere;
}

input, select, textarea {
    max-width: 100%;
}

.data-table td, .data-table th {
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .main-content, .page-container {
        padding: 16px;
    }
    .form-actions, .document-actions, .page-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    .detail-grid, .district-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .app-layout .sidebar {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }
}

/* Searchable branch lists and correction review cues. */
[hidden] { display: none !important; }
.branch-picker { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 4px; }
.branch-picker input[type="text"] { width: 100%; }
.branch-toggle { border: 1px solid #cbd5e1; border-radius: 6px; background: #f1f5f9; cursor: pointer; }
.branch-options { grid-column: 1 / -1; max-height: 240px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; }
.branch-option { padding: 10px 12px; min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.branch-option:hover, .branch-option.is-active, .branch-option[aria-selected="true"] { background: #e6efff; }
.branch-options p { padding: 10px; margin: 0; }
.branch-status { grid-column: 1 / -1; font-size: 0.85rem; color: #475569; }
.review-field-updated { border-left: 4px solid #2563eb; background: #eff6ff; }
.badge-ma-updated { background: #dbeafe; color: #1e40af; margin-bottom: 8px; }
.checker-comment { width: 100%; }
