:root {
    --esa-deep-space: #003247;
    --esa-deep-space1: #335e6f;
    --esa-pure-teal: #00ae9d;
    --esa-pure-teal1: #76c8ae;
    --esa-neutral-space: #e8e8e4;
    --esa-text-dark: #0f1820;
    --esa-surface: #ffffff;
    --esa-shadow: 0 24px 48px rgba(0, 50, 71, 0.18);
}

@font-face {
    font-family: "NotesESA";
    src:
        url("../fonts/NotesESA/NotesESA-Regular.woff2") format("woff2"),
        url("../fonts/NotesESA/NotesESA-Regular.woff") format("woff"),
        url("../fonts/NotesESA/NotesESA-Regular.ttf") format("truetype");
    font-display: swap;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at top left, rgba(0, 174, 157, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(118, 200, 174, 0.16), transparent 28%),
        linear-gradient(180deg, var(--esa-deep-space) 0%, #072434 100%);
    color: var(--esa-text-dark);
    font-family: "NotesESA", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a {
    color: var(--esa-pure-teal);
}

.page-shell {
    min-height: 100vh;
    padding: 2rem 1.25rem 3rem;
    display: flex;
    flex-direction: column;
}

.page-frame {
    max-width: 980px;
    width: 100%;
    margin: 0 auto;
    flex: 1 0 auto;
}

.hero-bar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hero-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    width: 100%;
}

.hero-title {
    color: #fff;
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 900;
    line-height: 1;
}

.language-switch {
    display: inline-flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.09);
    padding: 0.35rem;
    border-radius: 999px;
}

.language-switch a {
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.95rem;
}

.language-switch a.is-active {
    background: var(--esa-pure-teal);
    color: var(--esa-text-dark);
    font-weight: 700;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    background: rgba(255, 255, 255, 0.09);
    padding: 0.35rem;
    border-radius: 999px;
}

.portal-nav a {
    color: #fff;
    text-decoration: none;
    padding: 0.62rem 1rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
}

.portal-nav a.is-active {
    background: var(--esa-pure-teal);
    color: var(--esa-text-dark);
}

.portal-nav__right {
    margin-left: auto;
}

.hero-logo {
    width: min(240px, 42vw);
    display: flex;
    justify-content: flex-end;
}

.hero-logo img {
    max-width: 100%;
    height: auto;
}

.content-card {
    background: var(--esa-surface);
    border-radius: 28px;
    box-shadow: var(--esa-shadow);
    overflow: hidden;
}

.portal-footer {
    flex-shrink: 0;
    max-width: 980px;
    width: 100%;
    margin: 1.25rem auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.88);
    background: var(--esa-deep-space1);
    border-radius: 18px;
    padding: 0.9rem 1.25rem;
}

.portal-footer a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    font-weight: 700;
}

.footer-language-switch {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 0.25rem;
}

.footer-language-switch a {
    color: rgba(255, 255, 255, 0.9);
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 800;
}

.footer-language-switch a.is-active {
    background: var(--esa-pure-teal);
    color: var(--esa-text-dark);
}

.timeline-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.timeline-card {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 18px;
    padding: 1rem;
    background: #f4f8f9;
}

.timeline-card__label {
    color: #5f7892;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.timeline-card__value {
    color: var(--esa-deep-space);
    font-weight: 800;
}

.content-header {
    padding: 2rem 2rem 1.5rem;
    background: linear-gradient(135deg, rgba(0, 174, 157, 0.08) 0%, rgba(232, 232, 228, 0.6) 100%);
    border-bottom: 1px solid rgba(0, 50, 71, 0.1);
}

.content-header--split .content-header__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
    align-items: center;
    gap: 2.5rem;
}

.content-header--split .content-header__text {
    min-width: 0;
}

.content-header--split .content-header__logo {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.content-header--split .content-header__logo img {
    display: block;
    max-width: 100%;
    max-height: 112px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.content-header h1 {
    margin: 0 0 0.5rem;
    color: var(--esa-deep-space);
    font-size: clamp(1.9rem, 3vw, 2.7rem);
    line-height: 1.05;
}

.content-header p {
    margin: 0;
    color: var(--esa-deep-space1);
    max-width: 58ch;
    line-height: 1.6;
}

.form-body {
    padding: 2rem;
}

.eyebrow {
    color: var(--esa-pure-teal);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
}

.flash-stack {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.error-banner,
.success-banner,
.privacy-box {
    border-radius: 20px;
    padding: 1rem 1.1rem;
}

.error-banner {
    background: #fff1f1;
    color: #8a1d1d;
    margin-bottom: 1rem;
}

.success-banner {
    background: #edf8f2;
    color: #17683a;
    margin-bottom: 1rem;
}

.privacy-box {
    background: linear-gradient(135deg, rgba(0, 174, 157, 0.11) 0%, rgba(232, 232, 228, 0.85) 100%);
    color: var(--esa-deep-space);
}

.privacy-box h2 {
    margin: 0;
    font-size: 1.2rem;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 1.5rem;
}

.meta-box {
    background: #f4f8f9;
    border-radius: 18px;
    padding: 16px;
    border: 1px solid rgba(0, 50, 71, 0.08);
}

.meta-box__label {
    font-size: 12px;
    color: #5f7892;
    margin-bottom: 6px;
}

.meta-box__value {
    font-weight: 700;
    color: var(--esa-deep-space);
}

.hint-list {
    margin: 0 0 1.75rem;
    padding-left: 1.25rem;
    color: #486684;
    line-height: 1.65;
}

.field {
    margin-bottom: 1.2rem;
}

.field-label {
    display: block;
    margin-bottom: 0.55rem;
    font-weight: 700;
    color: var(--esa-deep-space);
}

.field-input {
    width: 100%;
    border: 1px solid rgba(0, 50, 71, 0.18);
    border-radius: 18px;
    padding: 0.95rem 1rem;
    font: inherit;
    color: var(--esa-text-dark);
    background: #fff;
}

.field-input:focus {
    outline: none;
    border-color: var(--esa-pure-teal);
    box-shadow: 0 0 0 4px rgba(0, 174, 157, 0.12);
}

.field-help {
    display: block;
    color: #64788e;
    margin-top: 0.45rem;
}

.field-error {
    display: block;
    color: #8a1d1d;
    margin-top: 0.45rem;
    font-size: 0.95rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--esa-deep-space);
}

.checkbox-row input[type="checkbox"] {
    margin-top: 0.2rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 0.95rem 1.5rem;
    background: linear-gradient(90deg, var(--esa-pure-teal) 0%, var(--esa-pure-teal1) 100%);
    color: var(--esa-text-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 16px 28px rgba(0, 174, 157, 0.22);
}

.btn:hover {
    filter: brightness(1.02);
}

.btn-secondary {
    background: #fff;
    border: 1px solid rgba(0, 50, 71, 0.18);
    color: var(--esa-deep-space);
    box-shadow: none;
    margin-bottom: 1.25rem;
}

.btn-sm {
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.cost-report-context {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cost-report-context div {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 18px;
    background: #f4f8f9;
    padding: 1rem;
}

.cost-report-context span {
    display: block;
    color: #5f7892;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.cost-report-context strong {
    color: var(--esa-deep-space);
}

.review-context {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.review-context div {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 18px;
    background: #f4f8f9;
    padding: 1rem;
}

.review-context span {
    display: block;
    color: #5f7892;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.review-context strong {
    color: var(--esa-deep-space);
}

.review-unavailable {
    border: 1px solid rgba(0, 50, 71, 0.12);
}

.review-upload-form {
    margin-top: 1.5rem;
}

.cost-report-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.cost-report-toolbar h2 {
    margin-bottom: 1.2rem;
}

.currency-fixed {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 999px;
    background: #f4f8f9;
    color: var(--esa-deep-space);
    font-weight: 800;
    padding: 0.7rem 1rem;
    margin-bottom: 1.2rem;
}

.invoice-list {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.invoice-card {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 18px;
    background: #fbfcfc;
    padding: 1rem;
}

.invoice-card.is-hidden {
    display: none;
}

.invoice-card legend {
    padding: 0 0.35rem;
    color: var(--esa-deep-space);
    font-weight: 800;
}

.invoice-grid {
    display: grid;
    gap: 0.85rem;
}

.invoice-grid--top {
    grid-template-columns: minmax(120px, 0.8fr) repeat(2, minmax(150px, 1fr));
}

.invoice-grid--work {
    grid-template-columns: minmax(140px, 0.9fr) minmax(160px, 1fr) minmax(180px, 1.2fr);
}

.invoice-grid--money {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
}

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

.invoice-card .field {
    margin-bottom: 0.75rem;
}

.money-input {
    text-align: right;
}

.approved-funding-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 2px solid rgba(0, 50, 71, 0.14);
    margin: 0 0 1.5rem;
    padding-top: 1rem;
    color: var(--esa-deep-space);
}

.approved-funding-summary span {
    color: #5f7892;
    font-weight: 700;
}

.approved-funding-summary strong {
    min-width: 150px;
    text-align: right;
    font-size: 1.2rem;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-actions form {
    margin: 0;
}

@media (max-width: 720px) {
    .page-shell {
        padding: 1.25rem 0.85rem 2rem;
    }

    .hero-bar {
        align-items: stretch;
    }

    .hero-brand-row {
        flex-direction: column-reverse;
        align-items: flex-start;
    }

    .hero-title {
        font-size: 2rem;
    }

    .portal-nav {
        width: 100%;
        border-radius: 18px;
        flex-wrap: wrap;
    }

    .portal-nav__right {
        margin-left: 0;
    }

    .portal-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .footer-language-switch {
        align-self: flex-start;
    }

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

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .cost-report-context {
        grid-template-columns: 1fr;
    }

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

    .cost-report-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .invoice-grid,
    .invoice-grid--top,
    .invoice-grid--work,
    .invoice-grid--money,
    .invoice-grid--remarks {
        grid-template-columns: 1fr;
    }

    .approved-funding-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .approved-funding-summary strong {
        min-width: 0;
        text-align: left;
    }

    .hero-logo {
        width: 100%;
        justify-content: flex-start;
    }

    .content-header,
    .form-body {
        padding: 1.5rem;
    }

    .content-header--split .content-header__layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .content-header--split .content-header__logo {
        width: 100%;
        justify-content: flex-start;
    }

    .content-header--split .content-header__logo img {
        max-height: 72px;
    }

    .form-actions {
        justify-content: stretch;
    }

    .form-actions .btn {
        width: 100%;
    }
}

.status-badge {
    display: inline-flex;
    width: auto;
    margin: 0;
    border-radius: 999px;
    background: var(--esa-deep-space);
    color: #fff;
}

.status-approved,
.status-exported {
    background: #17683a;
}

.status-cancelled,
.status-rejected {
    background: #8a1d1d;
}

.status-correction_requested {
    background: #f4cf61;
    color: var(--esa-deep-space);
}

.gateway-note {
    margin-top: 1rem;
}

.muted {
    color: #64788e;
}

.history-list {
    display: grid;
    gap: 0.9rem;
}

.history-item {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 18px;
    background: #f4f8f9;
    padding: 1rem;
}

.history-item__title {
    color: var(--esa-deep-space);
    font-weight: 800;
}

.history-item__date {
    color: #64788e;
    margin-top: 0.25rem;
}

.summary-panel,
.version-links,
.summary-form {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 18px;
    background: #fff;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.section-heading span,
.small-muted,
.empty-text {
    color: #64788e;
}

.section-heading h2 {
    margin: 0.15rem 0 0;
}

.summary-text {
    white-space: normal;
    line-height: 1.7;
}

.version-links summary {
    cursor: pointer;
    color: var(--esa-deep-space);
    font-weight: 800;
}

.version-links ul {
    display: grid;
    gap: 0.4rem;
    margin: 1rem 0;
    padding-left: 1.25rem;
}

.version-links li span {
    color: #64788e;
    margin-left: 0.5rem;
}

.summary-version-preview {
    border-top: 1px solid rgba(0, 50, 71, 0.1);
    padding-top: 0.9rem;
    margin-top: 0.9rem;
}

.choice-group {
    display: grid;
    gap: 0.6rem;
    margin: 1rem 0 1.25rem;
}

.choice-group label {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.75rem;
}

th,
td {
    padding: 0.8rem 0.65rem;
    border-bottom: 1px solid rgba(0, 50, 71, 0.1);
    text-align: left;
    vertical-align: top;
}

th {
    color: #5f7892;
    font-size: 0.9rem;
}

pre {
    max-width: 100%;
    overflow: auto;
    white-space: pre-wrap;
    border-radius: 16px;
    border: 1px solid rgba(0, 50, 71, 0.1);
    background: #f4f8f9;
    padding: 1rem;
}

.annual-survey-form .survey-question {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 18px;
    background: #f4f8f9;
    padding: 1rem;
    margin-bottom: 1.4rem;
}

.annual-survey-form .survey-question legend {
    color: var(--esa-deep-space);
    font-weight: 700;
    padding: 0;
    margin-bottom: .35rem;
}

.annual-survey-form .survey-help {
    color: #667085;
    margin: 0 0 .5rem;
}

.annual-survey-form .survey-error {
    color: #b42318;
    font-size: .9rem;
    margin-top: .35rem;
}

.portal-nav .portal-nav__highlight {
    background: #ffd24a;
    color: #003247;
    border-color: rgba(0, 50, 71, .25);
    font-weight: 900;
}

.portal-section {
    padding: clamp(1.35rem, 3vw, 2rem);
}

.portal-section > * + * {
    margin-top: 1.15rem;
}

.notice {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 14px;
    background: #f4f8f9;
    color: var(--esa-deep-space);
    line-height: 1.55;
    padding: 0.95rem 1rem;
}

.notice.success {
    border-color: rgba(23, 104, 58, 0.18);
    background: #edf8f2;
    color: #17683a;
}

.section-heading {
    display: block;
    margin-bottom: 1.4rem;
}

.section-heading h1 {
    color: var(--esa-deep-space);
    font-size: clamp(1.7rem, 3vw, 2.25rem);
    line-height: 1.12;
    margin: 0;
}

.section-heading p {
    color: #64788e;
    font-size: 1rem;
    line-height: 1.55;
    margin: 0.45rem 0 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.85rem;
    margin: 0 0 1.15rem;
}

.summary-card,
.panel {
    border: 1px solid rgba(0, 50, 71, 0.1);
    border-radius: 14px;
    background: #fff;
    padding: clamp(1rem, 2.2vw, 1.35rem);
}

.summary-label,
.field-hint,
.muted {
    color: #64788e;
    font-size: 0.9rem;
    line-height: 1.5;
}

.summary-value {
    color: var(--esa-deep-space);
    font-weight: 800;
    line-height: 1.35;
    margin-top: 0.28rem;
}

.panel {
    margin-top: 1.15rem;
}

.panel h2 {
    color: var(--esa-deep-space);
    font-size: 1.2rem;
    line-height: 1.25;
    margin: 0 0 0.9rem;
}

.document-list {
    display: grid;
    gap: 0.7rem;
}

.document-row {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: center;
    border: 1px solid rgba(0, 50, 71, 0.08);
    border-radius: 12px;
    background: #f8fbfb;
    padding: 0.8rem 0.9rem;
}

.document-row > span:first-child {
    color: var(--esa-deep-space);
    font-weight: 700;
    line-height: 1.35;
    min-width: 0;
    overflow-wrap: anywhere;
}

.document-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
}

.form-block {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1.05rem;
}

.form-block label {
    display: block;
    font-weight: 800;
    color: var(--esa-deep-space);
    line-height: 1.35;
}

.form-block textarea {
    width: 100%;
    min-height: 8.5rem;
    border: 1px solid rgba(0, 50, 71, 0.18);
    border-radius: 12px;
    padding: 0.85rem 0.95rem;
    font: inherit;
    line-height: 1.5;
    resize: vertical;
}

.form-block textarea:focus {
    outline: none;
    border-color: var(--esa-pure-teal);
    box-shadow: 0 0 0 4px rgba(0, 174, 157, 0.12);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.2rem;
}

@media (max-width: 720px) {
    .portal-section {
        padding: 1.15rem;
    }

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

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

    .document-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .document-actions .btn {
        flex: 1 1 120px;
    }

    .form-block textarea {
        min-height: 7.5rem;
    }
}
