:root {
    --af-primary: #0b5fa8;
    --af-primary-dark: #084b84;
    --af-accent: #f2b134;
    --af-bg: #f4f7f6;
    --af-card: #ffffff;
    --af-text: #17332b;
    --af-muted: #64756f;
    --af-border: #d9e3df;
    --af-danger: #d93d3d;
    --af-shadow: 0 18px 45px rgba(11, 95, 168, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--af-text);
    background: linear-gradient(180deg, #eef7f3 0, var(--af-bg) 24rem);
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.visa-form-mount {
    width: min(1120px, calc(100% - 32px));
    min-height: 560px;
    margin: 24px auto 48px;
    flex-shrink: 0;
}

.af-status-card {
    min-height: 360px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 16px;
    border: 1px solid var(--af-border);
    border-radius: 22px;
    background: var(--af-card);
    box-shadow: var(--af-shadow);
    text-align: center;
}

.af-status-card > i {
    color: var(--af-primary);
    font-size: 42px;
}

.af-status-error > i {
    color: var(--af-danger);
}

.af-page {
    display: grid;
    gap: 14px;
}

.af-steps {
    margin: 0;
    padding: 14px 18px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    list-style: none;
    border: 1px solid var(--af-border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
}

.af-steps li {
    position: relative;
    min-width: 130px;
    flex: 1 0 0;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--af-muted);
}

.af-steps li:not(:last-child) {
    padding-right: 22px;
}

.af-steps li:not(:last-child)::before,
.af-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 8px;
    top: calc(50% - 3px);
    width: 5px;
    height: 5px;
    border-top: 1.5px solid #c2ccd3;
    border-right: 1.5px solid #c2ccd3;
    transform: rotate(45deg);
    pointer-events: none;
}

.af-steps li:not(:last-child)::after { right: 1px; }

.af-steps li.is-done::before,
.af-steps li.is-done::after {
    border-color: var(--af-primary);
    opacity: .55;
}

.af-steps li.is-current::before,
.af-steps li.is-current::after {
    border-color: var(--af-primary);
    animation: af-step-forward 2.6s ease-in-out infinite;
}

.af-steps li.is-current::after { animation-delay: .3s; }

@keyframes af-step-forward {
    0%, 70%, 100% { opacity: .25; }
    35% { opacity: .9; }
}

@media (prefers-reduced-motion: reduce) {
    .af-steps li.is-current::before,
    .af-steps li.is-current::after { animation: none; }
}

.af-steps span {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid var(--af-border);
    border-radius: 50%;
    background: #fff;
    font-weight: 700;
}

.af-steps em {
    font-style: normal;
    font-size: 13px;
    line-height: 1.35;
}

.af-steps .is-current,
.af-steps .is-done {
    color: var(--af-primary-dark);
}

.af-steps .is-current span,
.af-steps .is-done span {
    border-color: var(--af-primary);
    color: #fff;
    background: var(--af-primary);
}

.af-form-card {
    /* Select menus must be able to extend beyond the card. */
    overflow: visible;
    border: 1px solid var(--af-border);
    border-radius: 24px;
    background: var(--af-card);
    box-shadow: var(--af-shadow);
}

.af-step-content {
    min-height: 280px;
    padding: 24px;
}

.af-step-heading {
    margin-bottom: 18px;
}

.af-step-heading > span {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--af-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.af-step-heading h2 {
    margin: 0;
    font-size: 25px;
}

.af-step-heading p {
    margin: 8px 0 0;
    color: var(--af-muted);
    line-height: 1.7;
}

.af-fields {
    margin: 0 !important;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
}

.af-fields::before,
.af-fields::after {
    display: none;
    content: none;
}

.af-fields > [class*="layui-col-"] {
    width: auto;
    min-width: 0;
    padding: 0 !important;
    float: none;
}

.af-fields > .layui-col-md12 {
    grid-column: 1 / -1;
}

.af-field {
    transition: opacity 0.18s ease;
}

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

.af-field .layui-form-item {
    margin-bottom: 4px;
}

.af-field .layui-form-label {
    width: auto;
    padding: 0 0 6px;
    float: none;
    display: block;
    overflow: visible;
    color: var(--af-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.55;
    text-align: left;
    text-overflow: clip;
    white-space: normal;
}

.af-field .layui-form-label b {
    margin-left: 4px;
    color: var(--af-danger);
}

.af-field .layui-input-block {
    min-height: 42px;
    margin-left: 0;
}

.af-field .layui-input,
.af-field .layui-textarea,
.af-field .layui-form-select .layui-input {
    border-color: var(--af-border);
    border-radius: 9px;
    color: var(--af-text);
    background-color: #fff;
}

.af-field .layui-input {
    height: 42px;
}

.af-field .layui-input[data-date-field="1"] {
    background-color: #fff !important;
    cursor: pointer;
}

.af-ocr-control {
    position: relative;
}

.af-ocr-control > .layui-input {
    padding-right: 50px;
}

.af-ocr-button {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--af-border);
    border-radius: 0 8px 8px 0;
    color: var(--af-primary);
    background: #f7faf9;
    cursor: pointer;
}

.af-ocr-button:hover {
    color: #fff;
    background: var(--af-primary);
}

.af-ocr-button.is-loading .layui-icon {
    display: inline-block;
    animation: layui-rotate 1s linear infinite;
}

.af-ocr-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.af-ocr-file {
    display: none !important;
}

.af-field .layui-input:focus,
.af-field .layui-textarea:focus {
    border-color: var(--af-primary) !important;
    box-shadow: 0 0 0 3px rgba(11, 95, 168, 0.1);
}

.af-help {
    padding: 6px 0 0 !important;
    float: none;
    color: var(--af-muted) !important;
    line-height: 1.55;
}

.af-field-error {
    min-height: 14px;
    padding-top: 2px;
    color: var(--af-danger);
    font-size: 12px;
}

.af-field.has-error .layui-input,
.af-field.has-error .layui-textarea,
.af-field.has-error .layui-form-select .layui-input {
    border-color: var(--af-danger) !important;
}

.af-choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
}

.af-agreement {
    min-height: 52px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--af-border);
    border-radius: 11px;
    background: #f8fbfa;
    line-height: 1.6;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.af-agreement:hover {
    border-color: rgba(11, 95, 168, 0.5);
    background: #f3faf7;
}

.af-agreement .layui-form-checkbox[lay-skin="primary"] {
    margin: 0;
}

.af-agreement .layui-form-checkbox[lay-skin="primary"] i {
    border-radius: 4px;
}

.af-agreement span {
    flex: 1;
}

.af-agreement a {
    color: var(--af-primary);
}

.af-agreement-link {
    margin: 0;
    padding: 0;
    border: 0;
    color: var(--af-primary);
    background: transparent;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.af-agreement b {
    margin-left: 4px;
    color: var(--af-danger);
}

.af-agreement-document {
    padding: 20px;
    color: var(--af-text);
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.af-agreement-document img,
.af-agreement-document table {
    max-width: 100%;
}

.af-upload {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.af-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.af-upload-status {
    color: var(--af-muted);
    overflow-wrap: anywhere;
}

.af-upload-status a {
    color: var(--af-primary);
}

.af-repeater {
    padding: 16px;
    border: 1px dashed var(--af-border);
    border-radius: 12px;
    background: #f9fbfa;
}

.af-repeater-item {
    position: relative;
    margin-bottom: 12px;
    padding: 16px;
    border: 1px solid var(--af-border);
    border-radius: 10px;
    background: #fff;
}

.af-inline-label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
}

.af-plans {
    margin-bottom: 28px;
}

.af-plans h3 {
    margin: 0 0 12px;
}

.af-plan-card {
    position: relative;
    min-height: 92px;
    margin-bottom: 10px;
    padding: 17px 120px 17px 48px;
    display: block;
    border: 1px solid var(--af-border);
    border-radius: 13px;
    cursor: pointer;
}

.af-plan-card.is-selected {
    border-color: var(--af-primary);
    background: #f3faf7;
    box-shadow: inset 0 0 0 1px var(--af-primary);
}

.af-plan-card input {
    position: absolute;
    top: 20px;
    left: 18px;
}

.af-plan-card strong,
.af-plan-card span {
    display: block;
}

.af-plan-card span {
    margin-top: 5px;
    color: var(--af-muted);
}

.af-plan-card em {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    color: var(--af-primary-dark);
    font-size: 20px;
    font-style: normal;
    font-weight: 800;
}

.af-plan-choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
}

.af-plan-choice-list .af-plan-card {
    min-height: 0;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.af-plan-choice-list .af-plan-card.is-selected {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.af-plan-choice-list .af-plan-card input {
    position: static;
    margin: 0;
}

.af-plan-choice-list .af-plan-card em {
    position: static;
    transform: none;
    color: var(--af-primary-dark);
    font-size: 14px;
}

.af-plan-details {
    margin-top: 14px;
    padding: 16px 0 0;
    border-top: 1px solid var(--af-border);
}

.af-plan-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--af-primary-dark);
    font-size: 17px;
}

.af-plan-details p {
    margin: 10px 0 0;
    color: var(--af-muted);
    line-height: 1.7;
}

.af-plan-fee-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.af-plan-fee-badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.af-plan-fee-badge.is-included {
    color: #187348;
    background: #eaf8ef;
}

.af-plan-fee-badge.is-excluded {
    color: #b65316;
    background: #fff3e7;
}

.af-field.has-error .af-agreement {
    border-color: var(--af-danger);
}

.af-review-list {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--af-border);
    border-radius: 14px;
}

.af-review-row {
    display: grid;
    grid-template-columns: minmax(140px, 34%) 1fr;
    border-bottom: 1px solid var(--af-border);
}

.af-review-row:last-child {
    border-bottom: 0;
}

.af-review-row dt,
.af-review-row dd {
    margin: 0;
    padding: 13px 16px;
    overflow-wrap: anywhere;
}

.af-review-row dt {
    color: var(--af-muted);
    background: #f7f9f8;
    font-weight: 600;
}

.af-confirm-dialog {
    padding: 18px 22px 4px;
}

.af-confirm-dialog > p {
    margin: 0 0 14px;
    color: var(--af-muted);
}

.af-confirm-dialog dl {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--af-border);
    border-radius: 10px;
}

.af-confirm-dialog dl > div {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    border-bottom: 1px solid var(--af-border);
}

.af-confirm-dialog dl > div:last-child {
    border-bottom: 0;
}

.af-confirm-dialog dt,
.af-confirm-dialog dd {
    margin: 0;
    padding: 10px 12px;
    overflow-wrap: anywhere;
}

.af-confirm-dialog dt {
    color: var(--af-muted);
    background: #f7f9f8;
    font-weight: 600;
}

.af-confirm-layer .layui-layer-btn .layui-layer-btn0 {
    border-color: var(--af-primary);
    background: var(--af-primary);
}

.af-actions {
    border-radius: 0 0 23px 23px;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-top: 1px solid var(--af-border);
    background: #fafcfb;
}

.af-actions .layui-btn {
    min-width: 128px;
    height: 44px;
    border-radius: 9px;
    background: var(--af-primary);
}

.af-actions .layui-btn-primary {
    border-color: var(--af-border);
    color: var(--af-text);
    background: #fff;
}

.af-actions [data-action="next"] {
    margin-left: auto;
}

.af-actions [data-action="previous"][hidden] + [data-action="next"] {
    flex: 0 1 128px;
}

.af-global-error {
    margin: 24px 36px 0;
    padding: 12px 15px;
    border: 1px solid #f2baba;
    border-radius: 9px;
    color: #9f2525;
    background: #fff2f2;
}

.layui-form-radioed,
.layui-form-radioed > i,
.layui-form-radio:hover,
.layui-form-radio:hover > i {
    color: var(--af-primary) !important;
}

.layui-form-checked[lay-skin="primary"] > i,
.layui-laydate .layui-this,
.layui-laydate .layui-this > div {
    border-color: var(--af-primary) !important;
    background-color: var(--af-primary) !important;
}

.layui-form-select dl dd.layui-this {
    color: #fff;
    background: var(--af-primary);
}

@media (max-width: 820px) {
    .visa-form-mount {
        margin-top: 14px;
    }

    .af-steps {
        padding: 14px;
    }

    .af-steps li {
        min-width: 54px;
        justify-content: center;
    }

    .af-steps li:not(:last-child) {
        padding-right: 0;
    }

    .af-steps li:not(:last-child)::before { right: -2px; }
    .af-steps li:not(:last-child)::after { right: -9px; }

    .af-steps em {
        display: none;
    }

    .af-step-content {
        padding: 18px 16px;
    }

    .af-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .af-fields > [class*="layui-col-"] {
        grid-column: 1;
    }

    .af-actions {
        padding: 16px 18px;
    }

    .af-global-error {
        margin: 18px 18px 0;
    }

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

    .af-review-row dd {
        padding-top: 8px;
    }

    .af-confirm-dialog dl > div {
        grid-template-columns: 1fr;
    }

    .af-confirm-dialog dd {
        padding-top: 7px;
    }

    .af-plan-details-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .af-plan-fee-badges {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .visa-form-mount {
        width: min(100% - 20px, 1120px);
    }

    .af-actions .layui-btn {
        min-width: 0;
        flex: 1;
    }

    .af-plan-card {
        padding: 16px 16px 50px 44px;
    }

    .af-plan-card em {
        top: auto;
        right: 16px;
        bottom: 14px;
        transform: none;
    }
}

/* Public application entry and final quote share the existing form palette. */
.af-entry { max-width: 640px; margin: 0 auto; padding: 28px; text-align: left; overflow: visible; }
.af-entry label { display: block; margin: 12px 0 8px; font-weight: 600; }
.af-entry p { line-height: 1.7; overflow-wrap: anywhere; }
.af-entry select, .af-entry input { width: 100%; margin-bottom: 12px; }
.af-entry .layui-btn { background: var(--af-primary); border-radius: 8px; margin-top: 14px; }
.af-direct-status .layui-btn-primary {
    color: var(--af-primary);
    background: #fff;
    border-color: var(--af-primary);
    margin-left: 0;
}
.af-entry-error { color: #9f2525; line-height: 1.7; overflow-wrap: anywhere; }
.af-entry .layui-form-select .layui-input { background: #fff; }
.af-final-price { display: block; color: var(--af-primary); font-size: 28px; margin: 12px 0; }
.af-multi-select {
    position: relative;
    width: 100%;
}
.af-multi-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--af-border);
    border-radius: 2px;
    background: #fff;
    color: var(--af-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.af-multi-select-trigger:hover,
.af-multi-select-trigger:focus,
.af-multi-select.is-open .af-multi-select-trigger {
    border-color: var(--af-primary);
    outline: 0;
    box-shadow: 0 0 0 2px rgba(23, 105, 170, .12);
}
.af-multi-select-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.af-multi-select-trigger .layui-icon {
    flex: 0 0 auto;
    margin-left: 10px;
    color: #9aa6ae;
    transition: transform .18s ease;
}
.af-multi-select.is-open .af-multi-select-trigger .layui-icon { transform: rotate(180deg); }
.af-multi-select-panel {
    margin-top: 6px;
    padding: 10px;
    border: 1px solid var(--af-border);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(4, 24, 45, .12);
}
.af-multi-select-panel[hidden] { display: none; }
.af-multi-select-search {
    width: 100%;
    height: 38px;
    margin-bottom: 8px;
    background: #fff;
}
.af-multi-select-options {
    max-height: 228px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.af-multi-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 7px 8px;
    border-radius: 4px;
    color: var(--af-text);
    cursor: pointer;
}
.af-multi-select-option:hover { background: rgba(23, 105, 170, .08); }
.af-multi-select-option[data-search-hidden="1"] { display: none; }
.af-multi-select-option input {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--af-primary);
}
.af-multi-select-option span {
    min-width: 0;
    overflow-wrap: anywhere;
}
.af-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 19890000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 24, 45, .36);
    backdrop-filter: blur(2px);
}

.af-busy-overlay[hidden] {
    display: none;
}

.af-busy-box {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    max-width: calc(100vw - 40px);
    padding: 18px 22px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 36px rgba(4, 24, 45, .2);
    color: #15324a;
    font-size: 15px;
    line-height: 1.5;
}

.af-busy-box .layui-icon-loading {
    flex: 0 0 auto;
    color: #1769aa;
    font-size: 28px;
}

/* Compact uploaded-file link, including long generated filenames. */
.af-upload { flex-wrap: wrap; }
.af-upload > .af-upload-status { min-width: 0; max-width: 100%; }
.af-file-card { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; box-sizing: border-box; padding: 10px 14px; border: 1px solid var(--af-border); border-radius: 10px; background: #f3f8f7; }
.af-file-card > .layui-icon { color: var(--af-primary); font-size: 20px; flex-shrink: 0; }
.af-file-name { min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.af-upload-status a.af-file-view { flex-shrink: 0; font-size: 13px; font-weight: 600; text-decoration: none; padding: 4px 0; }
.af-upload-status a.af-file-view:hover { text-decoration: underline; }
.af-file-view:focus-visible { outline: 2px solid var(--af-primary); outline-offset: 3px; border-radius: 3px; }
@media (max-width: 600px) { .af-file-name { max-width: 140px; } }

.af-file-card { gap: 12px; }
.af-file-remove { display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex-shrink: 0; padding: 7px 10px; margin: 0; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #b34c4c; font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; transition: background .15s, border-color .15s; }
.af-file-remove:hover { background: #fff0ef; border-color: #f1ceca; color: #a62f2f; }
.af-file-remove:focus-visible { outline: 2px solid #b34c4c; outline-offset: 2px; }
.af-file-remove:disabled { opacity: .5; cursor: not-allowed; }
.af-file-card .af-file-view { padding-right: 12px; border-right: 1px solid var(--af-border); }
@media (max-width: 600px) { .af-file-card { gap: 8px; padding: 8px 10px; } .af-file-card .af-file-name { max-width: 110px; flex: 1; } .af-file-remove { padding: 7px; } .af-file-card .af-file-view { padding-right: 8px; } }

/* Optional headings group related dynamic fields without adding submitted values. */
.af-fields > .af-field-section { grid-column: 1 / -1; clear: both; }
.af-field-section h3 { margin: 12px 0 18px; padding: 10px 0 10px 12px; border-left: 3px solid #0b63ad; border-bottom: 1px solid #dce7e7; color: #003b49; font-size: 17px; font-weight: 600; }
