/* Shared service catalog, service details and dynamic request form styles */
.sg-page {
    background: #fff;
    color: #161616;
}

.sg-container {
    width: min(100% - 32px, 1180px);
    margin-inline: auto;
}

.sg-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    color: #6c737f;
    font-size: 13px;
}

.sg-breadcrumb a {
    color: #6c737f;
    text-decoration: none;
}

.sg-breadcrumb a:hover {
    color: #1b8354;
}

.sg-breadcrumb-separator {
    color: #9da4ae;
}

/* Catalog */
.sg-catalog-hero {
    background: #f7fdf9;
    padding: 34px 0 28px;
}

.sg-catalog-hero h1 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.35;
    font-weight: 700;
    color: #161616;
}

.sg-catalog-hero p {
    margin: 0;
    color: #384250;
    font-size: 15px;
    line-height: 1.7;
}

.sg-catalog-body {
    padding: 32px 0 52px;
    min-height: 460px;
}

.sg-search-row {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 34px;
}

.sg-search-box {
    position: relative;
    width: min(100%, 360px);
}

.sg-search-box input {
    width: 100%;
    height: 44px;
    padding-inline: 42px 14px;
    border: 1px solid #9da4ae;
    border-radius: 6px;
    background: #fff;
    color: #161616;
    font-size: 14px;
}

.sg-search-box input:focus {
    outline: 0;
    border-color: #1b8354;
    box-shadow: 0 0 0 3px rgba(27, 131, 84, .12);
}

.sg-search-box button {
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 42px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #384250;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.sg-results-note {
    margin: -20px 0 28px;
    color: #4d5761;
    font-size: 13px;
}

.sg-results-note a {
    color: #1b8354;
    font-weight: 600;
    text-decoration: none;
    margin-inline-start: 8px;
}

.sg-services-grid {
    width: min(100%, 820px);
    margin-inline: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
    align-items: stretch;
}

.sg-service-card {
    border: 1px solid #d2d6db;
    border-radius: 14px;
    background: #fff;
    padding: 20px 18px 16px;
    min-height: 255px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.sg-service-card:hover {
    border-color: #1b8354;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .07);
    transform: translateY(-2px);
}

.sg-service-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ecfdf3;
    color: #1b8354;
    display: grid;
    place-items: center;
    overflow: hidden;
    font-size: 19px;
}

.sg-service-icon img {
    width: 21px;
    height: 21px;
    object-fit: contain;
}

.sg-service-title {
    margin: 18px 0 12px;
    color: #1f2a37;
    font-size: 18px;
    line-height: 1.55;
    font-weight: 700;
}

.sg-service-description {
    margin: 0 0 18px;
    color: #384250;
    font-size: 14px;
    line-height: 1.85;
    flex: 1;
}

.sg-service-card-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 14px;
}

.sg-primary-link,
.sg-primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid #1b8354;
    border-radius: 5px;
    background: #1b8354;
    color: #fff !important;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
}

.sg-primary-link:hover,
.sg-primary-button:hover {
    background: #166a45;
    border-color: #166a45;
}

.sg-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid #1b8354;
    border-radius: 5px;
    background: #fff;
    color: #1b8354;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.sg-danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid #b42318;
    border-radius: 5px;
    background: #fff;
    color: #b42318;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.sg-empty-state {
    width: min(100%, 820px);
    margin-inline: auto;
    padding: 60px 20px;
    border: 1px solid #d2d6db;
    border-radius: 14px;
    text-align: center;
    color: #4d5761;
}

.sg-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 30px;
}

.sg-pagination a {
    min-width: 38px;
    height: 38px;
    border: 1px solid #d2d6db;
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: #384250;
    text-decoration: none;
}

.sg-pagination a.active {
    background: #1b8354;
    color: #fff;
    border-color: #1b8354;
}

/* Details */
.sg-details-page {
    padding: 34px 0 54px;
}

.sg-details-shell {
    width: min(100%, 900px);
    margin-inline: auto;
}

.sg-details-card {
    border: 1px solid #d2d6db;
    border-radius: 14px;
    background: #fff;
    padding: 26px;
    margin-bottom: 18px;
}

.sg-details-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.sg-details-header h1 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.45;
    color: #161616;
}

.sg-category-badge {
    display: inline-flex;
    padding: 5px 11px;
    border-radius: 999px;
    background: #ecfdf3;
    color: #1b8354;
    font-size: 12px;
    font-weight: 600;
}

.sg-details-description,
.sg-rich-text {
    color: #384250;
    font-size: 15px;
    line-height: 1.9;
    white-space: pre-line;
}

.sg-details-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.sg-stat {
    padding: 16px;
    border-radius: 10px;
    background: #f7fdf9;
    text-align: center;
}

.sg-stat-value {
    color: #1b8354;
    font-size: 24px;
    font-weight: 700;
}

.sg-stat-label {
    color: #4d5761;
    font-size: 12px;
    margin-top: 4px;
}

.sg-details-card h2 {
    margin: 0 0 14px;
    font-size: 20px;
    color: #161616;
}

.sg-details-actions {
    text-align: center;
}

/* Dynamic request form */
.sg-request-page {
    background: #fff;
    padding: 24px 0 0;
}

.sg-request-shell {
    width: min(calc(100% - 48px), 1280px);
    margin-inline: auto;
}

/*
   The first grid column follows the page direction:
   - RTL: tracker is on the right.
   - LTR: tracker is on the left.
*/
.sg-request-layout {
    display: grid;
    grid-template-columns: 184px minmax(0, 1fr);
    grid-template-areas: "tracker content";
    gap: 24px;
    align-items: start;
    padding-bottom: 34px;
}

.sg-request-content {
    grid-area: content;
    min-width: 0;
    width: 100%;
}

.sg-request-content--single {
    width: min(100%, 1080px);
    margin-inline: auto;
    padding-bottom: 34px;
}

.sg-request-content .sg-breadcrumb {
    margin-bottom: 14px;
}

.sg-request-heading {
    margin-bottom: 18px;
}

.sg-request-heading h1 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.45;
    color: #161616;
}

.sg-request-heading p {
    margin: 0;
    max-width: 100%;
    color: #384250;
    font-size: 14px;
    line-height: 1.8;
}

.sg-request-number {
    display: inline-block;
    margin-top: 8px;
    color: #6c737f;
    font-size: 12px;
}

.sg-required-note {
    margin-top: 14px;
    color: #b42318;
    font-size: 12px;
}

.sg-dynamic-notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
    margin: 14px 0 20px;
    padding: 13px 14px;
    border-top: 1px solid #f79009;
    border-bottom: 1px solid #f79009;
    background: #fffaeb;
    color: #93370d;
    font-size: 13px;
    line-height: 1.7;
}

.sg-request-tracker {
    grid-area: tracker;
    position: sticky;
    top: 20px;
    width: 100%;
    border-radius: 12px;
    background: #f8f9fa;
    padding: 22px 16px;
}

.sg-step {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    min-height: 82px;
    color: #9da4ae;
}

.sg-step:last-child {
    min-height: auto;
}

.sg-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 30px;
    inset-inline-start: 13px;
    width: 1px;
    height: calc(100% - 10px);
    background: #d2d6db;
}

.sg-step-circle {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #d2d6db;
    background: #fff;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
}

.sg-step-title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 3px;
}

.sg-step-description {
    font-size: 11px;
    line-height: 1.55;
}

.sg-step.is-active,
.sg-step.is-complete {
    color: #1b8354;
}

.sg-step.is-active .sg-step-circle {
    border-color: #1b8354;
    color: #1b8354;
}

.sg-step.is-complete .sg-step-circle {
    border-color: #1b8354;
    background: #1b8354;
    color: #fff;
}

.sg-form-panel {
    display: none;
}

.sg-form-panel.is-active {
    display: block;
}

.sg-form-section-title {
    margin: 0 0 18px;
    font-size: 20px;
    line-height: 1.5;
    color: #161616;
}

.sg-field-row {
    --field-count: 1;
    display: grid;
    grid-template-columns: repeat(var(--field-count), minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.sg-field {
    min-width: 0;
}

.sg-field[hidden] {
    display: none !important;
}

.sg-label {
    display: block;
    margin-bottom: 7px;
    color: #161616;
    font-size: 13px;
    font-weight: 600;
}

.sg-required-mark {
    color: #b42318;
}

.sg-control,
.sg-select,
.sg-textarea,
.sg-file-control {
    width: 100%;
    border: 1px solid #9da4ae;
    border-radius: 4px;
    background: #fff;
    color: #161616;
    font-size: 14px;
}

.sg-control,
.sg-select,
.sg-file-control {
    height: 42px;
    padding: 0 12px;
}

.sg-textarea {
    min-height: 110px;
    padding: 11px 12px;
    resize: vertical;
}

.sg-control:focus,
.sg-select:focus,
.sg-textarea:focus,
.sg-file-control:focus {
    outline: 0;
    border-color: #1b8354;
    box-shadow: 0 0 0 3px rgba(27, 131, 84, .12);
}

.sg-control.has-error,
.sg-select.has-error,
.sg-textarea.has-error,
.sg-file-control.has-error,
.sg-field.has-client-error .sg-control,
.sg-field.has-client-error .sg-select,
.sg-field.has-client-error .sg-textarea,
.sg-field.has-client-error .sg-file-control {
    border-color: #b42318;
}

.sg-help-text {
    display: block;
    margin-top: 5px;
    color: #6c737f;
    font-size: 11px;
    line-height: 1.55;
}

.sg-error-text {
    display: block;
    margin-top: 5px;
    color: #b42318;
    font-size: 12px;
}

.sg-choice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 3px;
}

.sg-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #384250;
    font-size: 14px;
}

.sg-choice input {
    accent-color: #1b8354;
}

.sg-panel-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.sg-panel-actions-main,
.sg-panel-actions-secondary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Author button display rules must not override the HTML hidden attribute. */
.sg-panel-actions [hidden],
.sg-feedback-bar [hidden] {
    display: none !important;
}

.sg-feedback-bar {
    border-top: 2px solid #1b8354;
    padding: 18px 0;
    background: #fff;
}

.sg-feedback-content {
    width: min(calc(100% - 48px), 1280px);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    color: #384250;
    font-size: 13px;
}

.sg-feedback-button {
    min-width: 38px;
    height: 32px;
    border: 1px solid #1b8354;
    border-radius: 4px;
    background: #1b8354;
    color: #fff;
    cursor: pointer;
}

.sg-feedback-message {
    color: #1b8354;
    font-weight: 600;
}

@media (max-width: 900px) {
    .sg-request-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "tracker"
            "content";
    }

    .sg-request-tracker {
        position: static;
        display: flex;
        gap: 12px;
        overflow-x: auto;
        padding: 14px;
    }

    .sg-step {
        min-width: 155px;
        min-height: auto;
    }

    .sg-step::after {
        display: none;
    }
}

@media (max-width: 700px) {
    .sg-container,
    .sg-request-shell,
    .sg-feedback-content {
        width: min(calc(100% - 24px), 1180px);
    }

    .sg-catalog-hero h1,
    .sg-request-heading h1,
    .sg-details-header h1 {
        font-size: 24px;
    }

    .sg-field-row {
        grid-template-columns: 1fr;
    }

    .sg-details-card {
        padding: 20px 16px;
    }

    .sg-panel-actions,
    .sg-panel-actions-main,
    .sg-panel-actions-secondary {
        width: 100%;
    }

    .sg-panel-actions button {
        flex: 1 1 auto;
    }
}

/* My Requests */
.sg-my-requests-page {
    min-height: 520px;
}

.sg-my-requests-hero {
    background: #f7fdf9;
    padding: 32px 0 28px;
}

.sg-my-requests-heading-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.sg-my-requests-heading-row h1 {
    margin: 0 0 7px;
    color: #161616;
    font-size: 30px;
    line-height: 1.35;
    font-weight: 700;
}

.sg-my-requests-heading-row p {
    margin: 0;
    color: #4d5761;
    font-size: 14px;
}

.sg-my-requests-body {
    padding: 28px 0 56px;
}

.sg-request-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.sg-filter-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 17px;
    border: 1px solid #d2d6db;
    border-radius: 999px;
    background: #fff;
    color: #384250;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.sg-filter-pill:hover {
    border-color: #1b8354;
    color: #1b8354;
}

.sg-filter-pill.is-active {
    border-color: #1b8354;
    background: #1b8354;
    color: #fff !important;
}

.sg-success-alert {
    margin-bottom: 20px;
    padding: 13px 15px;
    border: 1px solid #75e0a7;
    border-radius: 8px;
    background: #ecfdf3;
    color: #05603a;
    font-size: 14px;
}

.sg-request-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sg-request-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border: 1px solid #d2d6db;
    border-radius: 12px;
    background: #fff;
    color: inherit !important;
    text-decoration: none !important;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.sg-request-card:hover {
    border-color: #1b8354;
    box-shadow: 0 7px 20px rgba(0, 0, 0, .06);
    transform: translateY(-1px);
}

.sg-request-card-main {
    flex: 1;
    min-width: 0;
}

.sg-request-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.sg-request-card-title-row h2 {
    margin: 0 0 5px;
    color: #1f2a37;
    font-size: 17px;
    line-height: 1.5;
    font-weight: 700;
}

.sg-request-card-number {
    color: #6c737f;
    font-size: 12px;
    direction: ltr;
    unicode-bidi: embed;
}

.sg-status-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.sg-status-badge.is-draft {
    background: #f3f4f6;
    color: #4d5761;
}

.sg-status-badge.is-submitted,
.sg-status-badge.is-under-review {
    background: #fef3c7;
    color: #92400e;
}

.sg-status-badge.is-requires-changes {
    background: #dbeafe;
    color: #1e40af;
}

.sg-status-badge.is-approved,
.sg-status-badge.is-completed {
    background: #d1fae5;
    color: #065f46;
}

.sg-status-badge.is-rejected,
.sg-status-badge.is-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.sg-request-card-dates {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 24px;
    color: #6c737f;
    font-size: 12px;
}

.sg-request-card-dates strong {
    color: #4d5761;
    font-weight: 600;
}

.sg-request-card-arrow {
    flex: 0 0 auto;
    color: #1b8354;
    font-size: 30px;
    line-height: 1;
}

.sg-my-requests-empty {
    margin-top: 8px;
}

.sg-my-requests-empty svg {
    display: block;
    margin: 0 auto 16px;
    color: #9da4ae;
}

.sg-my-requests-empty h2 {
    margin: 0 0 7px;
    color: #1f2a37;
    font-size: 20px;
}

.sg-my-requests-empty p {
    margin: 0 0 18px;
    color: #6c737f;
    font-size: 14px;
}

@media (max-width: 700px) {
    .sg-my-requests-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .sg-my-requests-heading-row .sg-primary-link {
        width: 100%;
    }

    .sg-request-card {
        align-items: flex-start;
        padding: 17px 16px;
    }

    .sg-request-card-title-row {
        flex-direction: column;
    }

    .sg-request-card-arrow {
        display: none;
    }
}

/* =========================================================
   Dynamic request form + repeatable groups (2026-07-13)
   ========================================================= */

[hidden] {
    display: none !important;
}

.sg-request-page {
    background: #fff;
    min-height: 620px;
}

.sg-request-shell {
    width: min(calc(100% - 64px), 1320px);
    margin-inline: auto;
    padding: 34px 0 44px;
}

.sg-request-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    grid-template-areas: "content tracker";
    gap: 34px;
    align-items: start;
}

.sg-request-page[dir="ltr"] .sg-request-layout {
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-areas: "tracker content";
}

.sg-request-content {
    grid-area: content;
    width: 100%;
    min-width: 0;
}

.sg-request-tracker {
    grid-area: tracker;
    position: sticky;
    top: 20px;
    width: 100%;
    padding: 26px 20px;
    border-radius: 12px;
    background: #f7f8f9;
}

.sg-step {
    position: relative;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    min-height: 96px;
    color: #7d8590;
}

.sg-step:last-child {
    min-height: auto;
}

.sg-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 37px;
    inset-inline-start: 17px;
    width: 1px;
    height: calc(100% - 12px);
    background: #ccd2d8;
}

.sg-step-circle {
    position: relative;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid #c8ced6;
    border-radius: 50%;
    background: #fff;
    color: #667085;
    font-size: 14px;
    font-weight: 700;
}

.sg-step-check {
    display: none;
}

.sg-step-copy {
    padding-top: 1px;
}

.sg-step-title {
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 700;
}

.sg-step-description {
    font-size: 13px;
    line-height: 1.65;
    font-weight: 500;
}

.sg-step.is-active,
.sg-step.is-complete {
    color: #087a4b;
}

.sg-step.is-active .sg-step-circle {
    border-color: #138a59;
    color: #087a4b;
}

.sg-step.is-complete .sg-step-circle {
    border-color: #138a59;
    background: #138a59;
    color: #fff;
}

.sg-step.is-complete .sg-step-number {
    display: none;
}

.sg-step.is-complete .sg-step-check {
    display: inline;
}

.sg-breadcrumb {
    margin-bottom: 18px;
    font-size: 12px;
    color: #667085;
}

.sg-breadcrumb a {
    color: #667085;
    text-decoration: none;
}

.sg-breadcrumb span {
    margin-inline: 5px;
}

.sg-request-heading {
    margin-bottom: 22px;
}

.sg-request-heading h1 {
    margin: 0 0 9px;
    font-size: 30px;
    line-height: 1.3;
    font-weight: 700;
    color: #101828;
}

.sg-request-number {
    margin-bottom: 10px;
    color: #667085;
    font-size: 13px;
}

.sg-required-note {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #b42318;
    font-size: 12px;
}

.sg-form-error,
.sg-repeatable-error {
    margin-bottom: 16px;
    padding: 11px 13px;
    border: 1px solid #fda29b;
    border-radius: 6px;
    background: #fff5f4;
    color: #b42318;
    font-size: 13px;
}

.sg-repeatable-error.is-visible {
    display: block;
}

.sg-form-panel {
    display: none;
}

.sg-form-panel.is-active {
    display: block;
}

.sg-group-description {
    max-width: 930px;
    margin: 0 0 18px;
    color: #344054;
    font-size: 14px;
    line-height: 1.9;
}

.sg-dynamic-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 24px;
    padding: 13px 16px;
    border-bottom: 2px solid #f79009;
    background: #fffaeb;
    color: #b54708;
    font-size: 13px;
    line-height: 1.75;
}

.sg-notice-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    flex: 0 0 20px;
    border-radius: 50%;
    background: #f79009;
    color: #fff;
    font-weight: 800;
}

.sg-form-section-title {
    margin: 0 0 18px;
    font-size: 19px;
    line-height: 1.45;
    font-weight: 700;
    color: #101828;
}

.sg-field-row {
    display: grid;
    grid-template-columns: repeat(var(--field-count, 1), minmax(0, 1fr));
    gap: 14px 16px;
    margin-bottom: 16px;
    align-items: start;
}

.sg-field {
    min-width: 0;
}

.sg-field--file {
    grid-column: 1 / -1;
}

.sg-label {
    display: block;
    margin-bottom: 7px;
    color: #101828;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 600;
}

.sg-required-mark {
    color: #d92d20;
}

.sg-control,
.sg-textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #98a2b3;
    border-radius: 4px;
    background: #fff;
    color: #101828;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.sg-textarea {
    min-height: 125px;
    resize: vertical;
}

.sg-control:focus,
.sg-textarea:focus {
    outline: none;
    border-color: #138a59;
    box-shadow: 0 0 0 3px rgba(19, 138, 89, .12);
}

.sg-control.has-error,
.sg-textarea.has-error,
.sg-field.has-client-error .sg-control,
.sg-field.has-client-error .sg-textarea,
.sg-field.has-client-error .sg-file-uploader {
    border-color: #d92d20;
}

.sg-help-text {
    display: block;
    margin-top: 5px;
    color: #667085;
    font-size: 12px;
    line-height: 1.55;
}

.sg-error-text {
    display: block;
    margin-top: 5px;
    color: #d92d20;
    font-size: 12px;
}

.sg-choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    min-height: 42px;
    align-items: center;
}

.sg-choice {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    color: #344054;
    font-size: 14px;
    line-height: 1.55;
    cursor: pointer;
}

.sg-choice input {
    margin-top: 3px;
    accent-color: #138a59;
}

.sg-choice--single {
    padding-top: 7px;
}

/* Repeatable researchers/items */
.sg-repeatable-list {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.sg-repeatable-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    padding: 8px 12px;
    border-bottom: 1px solid #eaecf0;
    background: #fff;
}

.sg-repeatable-item.is-incomplete {
    background: #fffaeb;
}

.sg-repeatable-item-copy {
    min-width: 0;
}

.sg-repeatable-item-title {
    color: #101828;
    font-size: 14px;
    font-weight: 600;
}

.sg-repeatable-item-meta {
    margin-top: 2px;
    color: #667085;
    font-size: 11px;
}

.sg-repeatable-item-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.sg-icon-button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 19px;
    cursor: pointer;
}

.sg-icon-button--edit {
    color: #138a59;
}

.sg-icon-button--delete {
    color: #d92d20;
}

.sg-repeatable-editor {
    margin-top: 14px;
    padding: 22px 0 6px;
    border-top: 1px solid #eaecf0;
}

.sg-repeatable-editor-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 17px;
}

.sg-repeatable-editor-heading h3 {
    margin: 0;
    color: #101828;
    font-size: 17px;
    font-weight: 700;
}

.sg-repeatable-editor-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.sg-add-item-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    padding: 10px 18px;
    border: 1px solid #138a59;
    border-radius: 4px;
    background: #138a59;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.sg-add-item-button span {
    font-size: 18px;
    line-height: 1;
}

/* File uploader */
.sg-file-uploader {
    width: 100%;
    border-radius: 5px;
}

.sg-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.sg-file-dropzone {
    width: 100%;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 22px;
    border: 1px dashed #b8c0cc;
    border-radius: 5px;
    background: #f8f9fb;
    color: #344054;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.sg-file-dropzone:hover,
.sg-file-uploader.is-dragging .sg-file-dropzone {
    border-color: #138a59;
    background: #f1fbf6;
}

.sg-file-upload-icon {
    color: #344054;
}

.sg-file-dropzone strong {
    font-size: 14px;
}

.sg-file-dropzone small {
    max-width: 610px;
    color: #667085;
    font-size: 11px;
    line-height: 1.6;
}

.sg-file-browse-text {
    margin-top: 5px;
    color: #138a59;
    font-size: 12px;
    font-weight: 600;
}

.sg-selected-file {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    background: #fff;
    color: #344054;
    font-size: 12px;
}

.sg-selected-file-status {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #138a59;
    color: #fff;
    font-size: 11px;
}

.sg-selected-file-remove {
    margin-inline-start: auto;
    border: 0;
    background: transparent;
    color: #667085;
    font-size: 18px;
    cursor: pointer;
}

/* Form actions */
.sg-panel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid #eaecf0;
}

.sg-panel-actions-main,
.sg-panel-actions-secondary {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sg-primary-button,
.sg-secondary-button,
.sg-tertiary-button,
.sg-danger-button {
    min-height: 40px;
    padding: 9px 18px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.sg-primary-button {
    border: 1px solid #138a59;
    background: #138a59;
    color: #fff;
}

.sg-secondary-button {
    border: 1px solid #138a59;
    background: #fff;
    color: #087a4b;
}

.sg-tertiary-button {
    border: 1px solid #d0d5dd;
    background: #fff;
    color: #344054;
}

.sg-danger-button {
    border: 1px solid #d92d20;
    background: #fff;
    color: #d92d20;
}

.sg-primary-button:disabled,
.sg-secondary-button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

@media (max-width: 1100px) {
    .sg-request-shell {
        width: min(calc(100% - 32px), 980px);
    }

    .sg-request-layout,
    .sg-request-page[dir="ltr"] .sg-request-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "tracker"
            "content";
        gap: 22px;
    }

    .sg-request-tracker {
        position: static;
        display: flex;
        overflow-x: auto;
        gap: 12px;
        padding: 15px;
    }

    .sg-step {
        min-width: 180px;
        min-height: auto;
    }

    .sg-step::after {
        display: none;
    }
}

@media (max-width: 760px) {
    .sg-request-shell {
        width: min(calc(100% - 24px), 720px);
        padding-top: 22px;
    }

    .sg-request-heading h1 {
        font-size: 24px;
    }

    .sg-field-row {
        grid-template-columns: 1fr;
    }

    .sg-panel-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .sg-panel-actions-main,
    .sg-panel-actions-secondary {
        width: 100%;
    }

    .sg-panel-actions button {
        flex: 1;
    }
}

/* =========================================================
   Request form visual refinements - conflict/publication/scale
   Applied after the repeatable-researcher version.
   ========================================================= */
.sg-request-shell {
    width: min(calc(100% - 64px), 1540px);
    padding: 38px 0 52px;
}

.sg-request-page[dir="rtl"] .sg-request-layout {
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas: "tracker content";
    gap: 42px;
}

.sg-request-page[dir="ltr"] .sg-request-layout {
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas: "tracker content";
    gap: 42px;
}

.sg-request-content {
    max-width: none;
}

.sg-request-tracker {
    padding: 30px 24px;
    border-radius: 14px;
}

.sg-step {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 14px;
    min-height: 112px;
}

.sg-step:not(:last-child)::after {
    top: 41px;
    inset-inline-start: 19px;
    height: calc(100% - 14px);
}

.sg-step-circle {
    width: 40px;
    height: 40px;
    font-size: 15px;
}

.sg-step-title {
    margin-bottom: 6px;
    font-size: 15px;
    line-height: 1.5;
}

.sg-step-description {
    font-size: 14px;
    line-height: 1.7;
}

.sg-breadcrumb {
    margin-bottom: 20px;
    font-size: 13px;
}

.sg-request-heading {
    margin-bottom: 28px;
}

.sg-request-heading h1 {
    margin-bottom: 10px;
    font-size: 34px;
    line-height: 1.3;
}

.sg-request-number {
    font-size: 14px;
}

.sg-required-note {
    font-size: 13px;
}

.sg-group-description {
    max-width: none;
    margin-bottom: 22px;
    font-size: 16px;
    line-height: 1.9;
}

.sg-form-section-title {
    margin-bottom: 22px;
    font-size: 22px;
}

.sg-field-row {
    gap: 18px 20px;
    margin-bottom: 19px;
}

.sg-label {
    margin-bottom: 8px;
    font-size: 15px;
    line-height: 1.6;
}

.sg-control,
.sg-textarea {
    min-height: 48px;
    padding: 11px 14px;
    font-size: 15px;
}

.sg-textarea {
    min-height: 150px;
    line-height: 1.75;
}

.sg-help-text,
.sg-error-text {
    font-size: 13px;
}

.sg-panel-actions {
    margin-top: 32px;
    padding-top: 22px;
}

.sg-primary-button,
.sg-secondary-button,
.sg-tertiary-button,
.sg-danger-button {
    min-height: 44px;
    padding: 10px 20px;
    font-size: 14px;
}

/* Generic radio-question presentation. It is selected from FieldType, not FieldKey. */
.sg-form-panel--conditional-question .sg-group-description {
    color: #101828;
}

.sg-form-panel--conditional-question .sg-field--radio {
    grid-column: 1 / -1;
    margin-bottom: 6px;
}

.sg-form-panel--conditional-question .sg-field--radio > .sg-label {
    margin-bottom: 15px;
    color: #101828;
    font-size: 17px;
    font-weight: 700;
}

.sg-choice-list--radio {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 18px 32px;
    width: min(100%, 720px);
    min-height: 48px;
}

.sg-choice--radio {
    min-height: 44px;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
}

.sg-choice--radio input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0;
    flex: 0 0 20px;
}

.sg-form-panel--conditional-question .sg-field--textarea {
    grid-column: 1 / -1;
    margin-top: 6px;
}

.sg-form-panel--conditional-question .sg-field--textarea > .sg-label {
    font-size: 15px;
    font-weight: 700;
}

/* Generic declaration/publication presentation. It is selected when all group fields are checkboxes. */
.sg-form-panel--declarations .sg-group-description {
    margin-bottom: 24px;
    color: #101828;
    font-size: 17px;
    line-height: 1.8;
    font-weight: 700;
}

.sg-form-panel--declarations .sg-field-row {
    display: block;
    margin-bottom: 2px;
}

.sg-form-panel--declarations .sg-field--checkbox {
    width: 100%;
    padding: 4px 0;
}

.sg-choice--declaration {
    width: 100%;
    min-height: 50px;
    align-items: flex-start;
    gap: 12px;
    padding: 9px 0;
    color: #101828;
    font-size: 15px;
    line-height: 1.75;
    font-weight: 500;
}

.sg-choice--declaration input[type="checkbox"] {
    width: 21px;
    height: 21px;
    margin-top: 2px;
    flex: 0 0 21px;
}

/* Dynamic textarea character counter, enabled by MaxLength metadata. */
.sg-textarea-wrap {
    position: relative;
}

.sg-textarea-wrap .sg-textarea {
    display: block;
}

.sg-character-count {
    display: flex;
    justify-content: flex-end;
    gap: 1px;
    margin-top: 6px;
    color: #667085;
    font-size: 12px;
    direction: ltr;
}

@media (max-width: 1200px) {
    .sg-request-shell {
        width: min(calc(100% - 36px), 1120px);
    }

    .sg-request-page[dir="rtl"] .sg-request-layout,
    .sg-request-page[dir="ltr"] .sg-request-layout {
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 28px;
    }
}

@media (max-width: 900px) {
    .sg-request-page[dir="rtl"] .sg-request-layout,
    .sg-request-page[dir="ltr"] .sg-request-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "tracker"
            "content";
        gap: 22px;
    }

    .sg-request-tracker {
        position: static;
    }
}

@media (max-width: 760px) {
    .sg-request-shell {
        width: min(calc(100% - 24px), 720px);
    }

    .sg-request-heading h1 {
        font-size: 27px;
    }

    .sg-choice-list--radio {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* =========================================================
   Dynamic budget presentation and calculated total
   ========================================================= */
.sg-form-panel--budget .sg-group-description {
    max-width: 920px;
    margin-bottom: 24px;
}

.sg-form-panel--budget .sg-field-row {
    gap: 18px;
    margin-bottom: 18px;
}

.sg-form-panel--budget .sg-field:not(.sg-field--calculated):not(.sg-field--checkbox) {
    min-height: 132px;
    padding: 16px;
    border: 1px solid #e1e6ea;
    border-radius: 10px;
    background: #fbfcfc;
}

.sg-form-panel--budget .sg-field:not(.sg-field--calculated):not(.sg-field--checkbox) .sg-label {
    min-height: 48px;
    margin-bottom: 10px;
    color: #1f2937;
    font-size: 15px;
    line-height: 1.6;
}

.sg-form-panel--budget .sg-field:not(.sg-field--calculated):not(.sg-field--checkbox) .sg-control {
    background: #fff;
}

.sg-field--readonly .sg-control {
    cursor: default;
}

.sg-field--calculated {
    grid-column: 1 / -1;
    width: 100%;
    padding: 18px 20px;
    border: 1px solid #8fd0ad;
    border-radius: 10px;
    background: #eefbf4;
}

.sg-field--calculated .sg-label {
    margin-bottom: 10px;
    color: #11643f;
    font-size: 17px;
    font-weight: 700;
}

.sg-field--calculated .sg-control {
    min-height: 52px;
    border-color: #54aa7b;
    background: #fff;
    color: #0f5132;
    font-size: 20px;
    font-weight: 700;
}

.sg-field--calculated .sg-help-text {
    color: #397356;
}

.sg-form-panel--budget .sg-field--checkbox {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 4px;
    padding: 18px 20px;
    border: 1px solid #d5dde2;
    border-radius: 10px;
    background: #f8faf9;
}

.sg-form-panel--budget .sg-field--checkbox .sg-choice--declaration {
    min-height: auto;
    padding: 0;
    color: #1f2937;
    font-size: 15px;
    line-height: 1.9;
    font-weight: 600;
}

.sg-form-panel--budget .sg-field--checkbox .sg-choice--declaration input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: 3px;
    flex: 0 0 22px;
}

@media (max-width: 980px) {
    .sg-form-panel--budget .sg-field-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .sg-form-panel--budget .sg-field-row {
        grid-template-columns: 1fr;
    }

    .sg-form-panel--budget .sg-field:not(.sg-field--calculated):not(.sg-field--checkbox) {
        min-height: auto;
    }
}

/* Returned request notes displayed inside the editable research form. */
.sg-return-notes {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 0 0 22px;
    padding: 17px 18px;
    border: 1px solid #f7c96c;
    border-radius: 12px;
    background: #fff8e8;
    color: #7a2e0e;
}

.sg-return-notes__icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f79009;
    color: #fff;
    font-weight: 700;
}

.sg-return-notes strong {
    display: block;
    margin-bottom: 5px;
    color: #93370d;
}

.sg-return-notes p {
    margin: 0 0 7px;
    line-height: 1.8;
    white-space: pre-line;
}

.sg-return-notes small {
    color: #9a5b19;
}

.sg-unavailable-message {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    background: #f8faf9;
    color: #475467;
}

.sg-unavailable-message strong {
    color: #344054;
}

/* Document API upload state */
.sg-file-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid #b2ddc6;
    border-radius: 10px;
    background: #f0faf5;
    color: #136c45;
    font-size: 14px;
    font-weight: 600;
}

.sg-file-progress[hidden],
.sg-file-message[hidden],
.sg-selected-file-download[hidden] {
    display: none !important;
}

.sg-file-progress-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #b2ddc6;
    border-top-color: #1b8354;
    border-radius: 50%;
    animation: sg-file-spin .8s linear infinite;
}

@keyframes sg-file-spin {
    to { transform: rotate(360deg); }
}

.sg-selected-file-download {
    margin-inline-start: auto;
    color: #126b45;
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sg-file-message {
    margin-top: 9px;
    font-size: 13px;
    line-height: 1.6;
}

.sg-file-message.is-success { color: #067647; }
.sg-file-message.is-error { color: #b42318; }

.sg-file-uploader.is-uploading .sg-file-dropzone {
    pointer-events: none;
    opacity: .58;
}
