.rif-wrapper {
    --rif-primary: #c8102e;
    --rif-text: #1f2328;
    --rif-muted: #6b7280;
    --rif-border: #b8b8b8;
    --rif-bg: #ffffff;
    --rif-bg-soft: #f9fafb;
    max-width: 100%;
    margin: 0 auto;
    font-family: inherit;
    color: var(--rif-text);
    box-sizing: border-box;
}

.rif-wrapper *,
.rif-wrapper *::before,
.rif-wrapper *::after {
    box-sizing: inherit;
}

.rif-hp-wrap {
    position: absolute;
    left: -9999px;
    top: -9999px;
}

.rif-form {
    background: var(--rif-bg);
    border: 1px solid var(--rif-border);
    border-radius: 12px;
    padding: 28px;
}

.rif-layout {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ── Horizontal top rail ── */
.rif-rail {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.rif-rail-step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    flex: 1 1 0;
    opacity: 0.55;
}

.rif-rail-step::before {
    content: "";
    position: absolute;
    left: -42%;
    right: 42%;
    top: 15px;
    height: 2px;
    background: var(--rif-border);
    z-index: 0;
}

.rif-rail-step:first-child::before {
    display: none;
}

.rif-rail-circle {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--rif-bg-soft);
    border: 2px solid #535353;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #0b0b0b;
    z-index: 1;
}

.rif-rail-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--rif-muted);
}

.rif-rail-step.is-active {
    opacity: 1;
}

.rif-rail-step.is-active .rif-rail-circle {
    background: var(--rif-primary);
    border-color: var(--rif-primary);
    color: #fff;
}

.rif-rail-step.is-active .rif-rail-label {
    color: var(--rif-text);
}

.rif-rail-step.is-complete {
    opacity: 1;
}

.rif-rail-step.is-complete .rif-rail-circle {
    background: #fff;
    border-color: var(--rif-primary);
    color: var(--rif-primary);
}

.rif-rail-step.is-complete::before {
    background: var(--rif-primary);
}

/* ── Panels ── */
.rif-panels {
    width: 100%;
    min-width: 0;
}

.rif-panel-title {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 700;
}

.rif-panel-title.rif-mt {
    margin-top: 28px;
}

h3.rif-panel-title {
    font-size: 28px;
    font-weight: 700;
}

.rif-elig-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.rif-elig-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--rif-border);
    border-radius: 8px;
    background: var(--rif-bg-soft);
}

.rif-elig-row.is-no {
    border-color: var(--rif-primary);
    background: #fdeeee;
}

.rif-elig-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.rif-elig-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex: 0 0 24px;
}

.rif-elig-toggle {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}

.rif-yn {
    border: 1px solid #000;
    background: #fff;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #000;
}

.rif-yn.is-selected[data-value="yes"] {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.rif-yn.is-selected[data-value="no"] {
    background: var(--rif-primary);
    border-color: var(--rif-primary);
    color: #fff;
}

.rif-hint {
    font-size: 12px;
    color: var(--rif-muted);
    margin: 12px 0 0;
}

.rif-ineligible-notice {
    margin-top: 14px;
    padding: 12px 14px;
    background: #fdeeee;
    border: 1px solid var(--rif-primary);
    color: #7a0d1f;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
}
.rif-ineligible-notice p { margin: 0 0 10px; }
.rif-ineligible-notice p:last-child { margin-bottom: 0; }
.rif-ineligible-notice strong { font-weight: 700; }

.rif-field-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.rif-field-row .rif-field {
    flex: 1 1 180px;
    margin-bottom: 0;
}

.rif-field {
    margin-bottom: 14px;
}

.rif-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}

.rif-field input[type="text"],
.rif-field input[type="email"],
.rif-field input[type="tel"],
.rif-field input[type="number"],
.rif-field select,
.rif-field textarea {
    width: 100%;
    padding: 12px 11px;
    border: 1px solid var(--rif-border);
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    color: var(--rif-text);
}

.rif-field textarea {
    min-height: 80px;
    resize: vertical;
}

.rif-field input:focus,
.rif-field select:focus,
.rif-field textarea:focus {
    outline: none;
    border-color: var(--rif-primary);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.rif-note {
    display: block;
    font-size: 12px;
    color: var(--rif-muted);
    margin-top: 4px;
}

.rif-counter {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--rif-muted);
    margin-top: 4px;
}

.rif-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    line-height: 1.4;
}

.rif-check input {
    margin-top: 3px;
    flex: 0 0 auto;
}

.rif-self-copy {
    padding: 10px 12px;
    background: var(--rif-bg-soft);
    border: 1px dashed var(--rif-border);
    border-radius: 8px;
}

.rif-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px 16px;
    margin-bottom: 4px;
}

.rif-check-grid .rif-check {
    margin-bottom: 0;
}

.rif-other-wrap {
    margin-top: 10px;
}

.rif-other-wrap input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--rif-border);
    border-radius: 7px;
    font-size: 14px;
}

.rif-upload-zone {
    border: 2px dashed var(--rif-border);
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--rif-muted);
    cursor: pointer;
    background: var(--rif-bg-soft);
}

.rif-upload-zone.is-dragover {
    border-color: var(--rif-primary);
    background: #fdeeee;
}

.rif-photo-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.rif-photo-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--rif-border);
    aspect-ratio: 1/1;
}

.rif-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rif-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.rif-summary {
    background: var(--rif-bg-soft);
    border: 1px solid var(--rif-border);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 13px;
    margin-bottom: 18px;
}

.rif-summary div {
    margin-bottom: 4px;
}

.rif-summary strong {
    display: inline-block;
    min-width: 90px;
}

.rif-error-banner {
    margin-top: 14px;
    padding: 12px 14px;
    background: #fdeeee;
    border: 1px solid var(--rif-primary);
    color: #7a0d1f;
    border-radius: 8px;
    font-size: 13px;
}

.rif-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--rif-border);
}

.rif-btn {
    padding: 11px 26px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--rif-border);
    background: #fff;
    color: var(--rif-text);
}

.rif-btn-primary {
    background: var(--rif-primary);
    border-color: var(--rif-primary);
    color: #fff;
    margin-left: auto;
}

.rif-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rif-btn[hidden] {
    display: none;
}

.rif-success {
    text-align: center;
    padding: 60px 20px;
    background: var(--rif-bg);
    border: 1px solid var(--rif-border);
    border-radius: 12px;
}

.rif-success h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

@media (max-width: 720px) {
    .rif-form {
        padding: 18px;
    }

    .rif-layout {
        gap: 18px;
    }

    .rif-rail-label {
        font-size: 11px;
    }

    .rif-elig-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .rif-rail-label {
        display: none;
    }
}