/* =========================================================
   SmileAge — MCA Form CSR-2 page styles
   -----------------------------------------------------------
   Every selector is namespaced "sa-csr-" so nothing collides
   with style.css (untouched) or any other page's CSS file.
   This page intentionally does NOT load css/impact.css or
   css/programs.css — it is fully self-contained, following the
   same "separate file per page" convention used across the
   site, since this form has its own distinct visual language
   (dense data-entry, not a marketing page).
   ========================================================= */

/* body defaults to a dark background site-wide (see style.css) —
   every section on every page must set its own background or it
   shows through as black. */
.sa-csr-header,
.sa-csr-section {
    background-color: #fff;
}

/* ---------- Header ---------- */
.sa-csr-header {
    padding-block: 2.5rem 0;
    /* flow-root contains the meta-bar's bottom margin inside this section's
       own box — without it, that margin collapses straight through the
       zero bottom padding and escapes past the white background, exposing
       the dark body color underneath as a thin line. */
    display: flow-root;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(42rem 20rem at 10% -15%, rgba(47, 168, 120, 0.10), transparent 60%),
        radial-gradient(38rem 20rem at 96% -10%, rgba(47, 111, 214, 0.08), transparent 55%),
        #fff;
}

.sa-csr-header::before,
.sa-csr-header::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
}

.sa-csr-header::before {
    width: 16rem;
    height: 16rem;
    top: -7rem;
    left: -5rem;
    background: rgba(47, 168, 120, 0.12);
}

.sa-csr-header::after {
    width: 18rem;
    height: 18rem;
    top: -8rem;
    right: -6rem;
    background: rgba(238, 101, 24, 0.08);
}

.sa-csr-header > .container {
    position: relative;
    z-index: 1;
}

.sa-csr-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--mission-muted, #6f6c63);
    text-decoration: none;
    margin-bottom: 1.5rem;
}

.sa-csr-back-link:hover { color: var(--green, #2fa878); }

.sa-csr-badge {
    display: inline-flex;
    align-items: center;
    background-color: rgba(47, 168, 120, 0.10);
    border: 1px solid rgba(47, 168, 120, 0.35);
    color: var(--green-dark, #16362a);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.5rem 1.15rem;
    border-radius: 50rem;
    margin-bottom: 1.25rem;
}

.sa-csr-title {
    font-family: var(--font-serif, "Playfair Display", serif);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 2.75rem);
    color: var(--navy-heading, #16213e);
    margin-bottom: 0.85rem;
}

.sa-csr-accent { color: var(--green, #2fa878); }

.sa-csr-subtitle {
    max-width: 46rem;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--mission-muted, #6f6c63);
    margin-bottom: 2rem;
}

.sa-csr-meta-bar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    background: #fff;
    border: 1px solid rgba(22, 33, 62, 0.08);
    border-radius: 1rem;
    padding: 1.15rem 1.5rem;
    box-shadow: 0 0.75rem 2rem rgba(22, 33, 62, 0.06);
    margin-bottom: 2.5rem;
}

.sa-csr-meta-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sa-csr-meta-field > span {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--mission-muted, #6f6c63);
}

.sa-csr-meta-field strong {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy-heading, #16213e);
}

.sa-csr-meta-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.sa-csr-save-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--icon-green-fg, #2f8a63);
    white-space: nowrap;
}

.sa-csr-btn-outline {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid rgba(22, 33, 62, 0.16);
    background: #fff;
    color: var(--navy-heading, #16213e);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.6rem 1.1rem;
    border-radius: 0.65rem;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.sa-csr-btn-outline:hover {
    border-color: var(--green, #2fa878);
    color: var(--green-dark, #16362a);
}

.sa-csr-btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
}

/* ---------- Chip select (Financial Year) ---------- */
.sa-csr-chip-select {
    display: flex;
    gap: 0.4rem;
}

.sa-csr-chip-opt {
    border: 1px solid rgba(22, 33, 62, 0.14);
    background: #fff;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink, #1c1b17);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sa-csr-chip-opt:hover { border-color: var(--green, #2fa878); }

.sa-csr-chip-opt-active {
    background: var(--green, #2fa878);
    border-color: var(--green, #2fa878);
    color: #fff;
}

/* ---------- Layout: sticky TOC sidebar + main form ---------- */
.sa-csr-section {
    padding-block: 0 5rem;
}

.sa-csr-layout {
    display: grid;
    grid-template-columns: 17.5rem 1fr;
    gap: 2.5rem;
    align-items: start;
}

.sa-csr-sidebar {
    position: sticky;
    top: 5.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sa-csr-toc-card,
.sa-csr-help-card {
    background: var(--cream-bg, #f8f4ee);
    border-radius: 1rem;
    padding: 1.5rem;
}

.sa-csr-sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--navy-heading, #16213e);
    margin-bottom: 1rem;
}

.sa-csr-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sa-csr-toc-list a {
    display: block;
    padding: 0.5rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--mission-muted, #6f6c63);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sa-csr-toc-list a:hover {
    background: rgba(47, 168, 120, 0.08);
    color: var(--green-dark, #16362a);
}

.sa-csr-toc-list a.active {
    background: var(--green, #2fa878);
    color: #fff;
}

.sa-csr-help-card {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--mission-muted, #6f6c63);
}

.sa-csr-help-card i {
    flex-shrink: 0;
    color: var(--green, #2fa878);
    margin-top: 0.15rem;
}

.sa-csr-help-card p { margin: 0; }

.sa-csr-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* ---------- Form section cards ---------- */
.sa-csr-card {
    background: #fff;
    border: 1px solid rgba(22, 33, 62, 0.08);
    border-radius: 1.1rem;
    padding: 2rem;
    scroll-margin-top: 6rem;
}

.sa-csr-card-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(22, 33, 62, 0.07);
}

.sa-csr-card-num {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    height: 2.75rem;
    padding-inline: 0.5rem;
    border-radius: 0.75rem;
    background: var(--icon-green-bg, #e2f0e8);
    color: var(--icon-green-fg, #2f8a63);
    font-size: 0.85rem;
    font-weight: 700;
}

.sa-csr-card-head h2 {
    font-family: var(--font-sans, "Plus Jakarta Sans", sans-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy-heading, #16213e);
    margin: 0;
}

/* ---------- Field rows ---------- */
.sa-csr-row {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.sa-csr-row-2 { grid-template-columns: 1fr 1fr; }
.sa-csr-row-3 { grid-template-columns: repeat(3, 1fr); }

.sa-csr-field {
    margin-bottom: 1.25rem;
}

.sa-csr-row .sa-csr-field { margin-bottom: 0; }

.sa-csr-field-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--navy-heading, #16213e);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.sa-csr-input,
.sa-csr-select {
    width: 100%;
    padding: 0.7rem 0.95rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(22, 33, 62, 0.14);
    background: #fff;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--ink, #1c1b17);
}

.sa-csr-input:focus,
.sa-csr-select:focus {
    outline: none;
    border-color: var(--green, #2fa878);
    box-shadow: 0 0 0 3px rgba(47, 168, 120, 0.15);
}

.sa-csr-textarea { resize: vertical; }

.sa-csr-note {
    font-size: 0.8rem;
    color: var(--mission-muted, #6f6c63);
    margin: 0.5rem 0 1.25rem;
}

/* ---------- Radio / checkbox pill groups ---------- */
.sa-csr-radio-group,
.sa-csr-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.sa-csr-radio-opt,
.sa-csr-checkbox-opt {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1.5px solid rgba(22, 33, 62, 0.14);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink, #1c1b17);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.sa-csr-radio-opt input,
.sa-csr-checkbox-opt input {
    accent-color: var(--green, #2fa878);
}

.sa-csr-radio-opt:hover,
.sa-csr-checkbox-opt:hover {
    border-color: var(--green, #2fa878);
}

/* Live active styling driven by the actual checked state, so clicking a
   different option restyles instantly with no JS required. */
.sa-csr-radio-opt:has(input:checked),
.sa-csr-radio-opt-active,
.sa-csr-checkbox-opt:has(input:checked) {
    border-color: var(--green, #2fa878);
    background: var(--icon-green-bg, #e2f0e8);
    color: var(--green-dark, #16362a);
}

/* ---------- Tables ---------- */
.sa-csr-table-wrap {
    margin-bottom: 1.75rem;
}

.sa-csr-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.sa-csr-table-head > span {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--navy-heading, #16213e);
}

.sa-csr-add-row-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    background: var(--icon-green-bg, #e2f0e8);
    color: var(--icon-green-fg, #2f8a63);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.45rem 0.85rem;
    border-radius: 0.55rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sa-csr-add-row-btn:hover {
    background: var(--green, #2fa878);
    color: #fff;
}

.sa-csr-table {
    width: 100%;
    min-width: 36rem;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.sa-csr-table-wide { min-width: 60rem; }

.sa-csr-table-wrap { overflow-x: auto; }

.sa-csr-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--mission-muted, #6f6c63);
    background: var(--cream-bg, #f8f4ee);
    padding: 0.65rem 0.85rem;
    white-space: nowrap;
}

.sa-csr-table th:first-child { border-radius: 0.5rem 0 0 0.5rem; }
.sa-csr-table th:last-child { border-radius: 0 0.5rem 0.5rem 0; }

.sa-csr-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid rgba(22, 33, 62, 0.06);
    color: var(--ink, #1c1b17);
    white-space: nowrap;
}

.sa-csr-table-empty td {
    text-align: center;
    color: var(--mission-muted, #6f6c63);
    font-style: italic;
    white-space: normal;
}

.sa-csr-table-total td {
    font-weight: 700;
    color: var(--navy-heading, #16213e);
    border-bottom: none;
    border-top: 2px solid rgba(22, 33, 62, 0.1);
}

.sa-csr-table-inline-input {
    width: 100%;
    min-width: 6rem;
    border: 1px solid rgba(22, 33, 62, 0.14);
    border-radius: 0.4rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--ink, #1c1b17);
}

.sa-csr-table-inline-input:focus {
    outline: none;
    border-color: var(--green, #2fa878);
}

/* ---------- Attachments ---------- */
.sa-csr-attachment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sa-csr-attachment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--cream-bg, #f8f4ee);
    border-radius: 0.65rem;
}

.sa-csr-attachment-row span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink, #1c1b17);
}

/* ---------- Declaration + bottom actions ---------- */
.sa-csr-declaration {
    border-color: rgba(47, 168, 120, 0.25);
}

.sa-csr-bottom-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed rgba(22, 33, 62, 0.1);
}
