:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #111827;
    --muted: #64748b;
    --border: #dbe3ee;
    --border-strong: #cbd5e1;
    --primary: #1f5eff;
    --primary-dark: #1749c9;
    --primary-soft: #eef4ff;
    --success: #087f5b;
    --success-soft: #e9fbf3;
    --danger: #b42318;
    --danger-soft: #fff1f0;
    --shadow: 0 10px 28px rgba(15, 23, 42, .07);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    background:
        linear-gradient(180deg, #eef4ff 0, rgba(238, 244, 255, 0) 320px),
        var(--bg);
    color: var(--text);
}

button,
input,
select,
textarea {
    font: inherit;
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        linear-gradient(180deg, #eef4ff 0, #f8fbff 48%, #f5f7fb 100%),
        var(--bg);
}

.loading-panel {
    position: relative;
    width: min(100%, 460px);
    padding: 34px 34px 30px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
    text-align: center;
}

.loading-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, #1f5eff, #087f5b);
}

.loading-mark {
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    border: 1px solid #dbe7ff;
    border-radius: 50%;
    background: #f6f9ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #dbe7ff;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: loading-spin .75s linear infinite;
}

.loading-eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.loading-panel h1 {
    margin: 0;
    color: var(--text);
    font-size: 24px;
    line-height: 1.35;
}

.loading-panel p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.loading-progress {
    height: 6px;
    margin-top: 24px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eef8;
}

.loading-progress span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--success));
    animation: loading-progress 1.1s ease-in-out infinite;
}

.loading-panel.error {
    border-color: #ffd0cc;
}

.loading-panel.error .loading-mark,
.loading-panel.error .loading-progress {
    display: none;
}

.loading-panel.error h1 {
    color: var(--danger);
}

body.is-ready .loading-screen {
    display: none;
}

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

@keyframes loading-progress {
    0% {
        transform: translateX(-105%);
    }

    100% {
        transform: translateX(245%);
    }
}

.page {
    width: min(100%, 1240px);
    margin: 0 auto;
    padding: 28px 20px 56px;
}

.hero {
    background: #10233f;
    color: #fff;
    border-radius: var(--radius);
    padding: 26px 28px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0;
    color: #b9cdf6;
}

.hero h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.2;
}

.subtitle {
    margin: 12px 0 0;
    max-width: 760px;
    line-height: 1.65;
    color: #dbe7ff;
}

.status-pill {
    padding: 7px 13px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    font-size: 14px;
    white-space: nowrap;
}

.layout {
    margin-top: 22px;
    display: grid;
    gap: 18px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.3;
}

.section-header span {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.section-desc {
    margin: 7px 0 0;
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

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

.contact-grid {
    margin-top: 22px;
}

.full-width {
    grid-column: 1 / -1;
}

.address-section {
    margin-top: 22px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.address-title {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    padding-bottom: 11px;
    border-bottom: 1px solid var(--border);
}

label {
    display: block;
    margin-bottom: 7px;
    color: #263244;
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: #fff;
    padding: 11px 12px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.4;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

select {
    cursor: pointer;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 94, 255, .14);
}

.person-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 14px;
    align-items: end;
    margin-bottom: 20px;
}

.person-list {
    display: grid;
    gap: 14px;
}

.person-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-soft);
    padding: 18px;
}

.person-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.person-card-header h3 {
    margin: 0;
    font-size: 16px;
}

.compact-person-grid {
    display: grid;
    grid-template-columns: 170px minmax(180px, 1.25fr) minmax(160px, 1fr) 150px;
    gap: 14px;
}

.remove-person-btn {
    width: auto;
    margin: 0;
    padding: 9px 12px;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #ffd0cc;
}

.remove-person-btn:hover {
    background: #ffe3e0;
}

.document-list {
    display: grid;
    gap: 14px;
}

.document-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.document-card:hover {
    border-color: #9bbcff;
    box-shadow: 0 8px 22px rgba(31, 94, 255, .08);
    transform: translateY(-1px);
}

.document-main {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 16px;
}

.document-index {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
}

.document-title {
    margin: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.document-desc {
    margin: 7px 0 15px;
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

.file-upload-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.file-upload-box input[type="file"] {
    border: 1px dashed var(--border-strong);
    background: var(--surface-soft);
    cursor: pointer;
}

.file-upload-box input[type="file"]:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.upload-status {
    min-width: 104px;
    padding: 8px 11px;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--muted);
    font-size: 13px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.upload-status.ready {
    background: var(--success-soft);
    color: var(--success);
}

.file-name {
    display: none;
    margin-top: 10px;
    color: var(--primary);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.file-name.show {
    display: block;
}

button {
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 13px 17px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

button:hover {
    background: var(--primary-dark);
    box-shadow: 0 8px 18px rgba(31, 94, 255, .18);
}

button:focus-visible {
    outline: 3px solid rgba(31, 94, 255, .22);
    outline-offset: 2px;
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: .65;
    box-shadow: none;
    transform: none;
}

.secondary-btn {
    background: #243247;
}

.secondary-btn:hover {
    background: #172033;
}

#submitBtn {
    width: 100%;
    margin-top: 20px;
}

#message {
    display: none;
    margin-top: 16px;
    padding: 13px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
}

#message.info,
#message.success,
#message.error {
    display: block;
}

#message.info {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

#message.success {
    background: var(--success-soft);
    color: var(--success);
}

#message.error {
    background: var(--danger-soft);
    color: var(--danger);
}

@media (max-width: 1100px) {
    .compact-person-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .page {
        padding: 18px 14px 42px;
    }

    .hero,
    .section-header,
    .person-card-header {
        flex-direction: column;
    }

    .hero {
        padding: 22px;
    }

    .hero h1 {
        font-size: 26px;
    }

    .card,
    .address-section,
    .person-card,
    .document-card {
        padding: 16px;
    }

    .form-grid,
    .person-control,
    .compact-person-grid,
    .document-main,
    .file-upload-box {
        grid-template-columns: 1fr;
    }

    .document-index {
        width: 40px;
        height: 40px;
    }

    .upload-status {
        width: 100%;
    }
}

.remove-kyc-file-btn {
    padding: 9px 12px;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #ffd0cc;
    white-space: nowrap;
}

.remove-kyc-file-btn:hover {
    background: #ffe3e0;
}


.file-control {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1.15fr) auto;
    gap: 12px;
    align-items: stretch;
}

.file-control input[type="file"] {
    min-height: 52px;
    border: 1px dashed var(--border-strong);
    background: var(--surface-soft);
    cursor: pointer;
}

.file-control input[type="file"]:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.file-summary {
    min-height: 52px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    overflow: hidden;
}

.file-summary-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.file-summary-name {
    color: var(--text);
    font-size: 14px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.file-summary.has-file {
    border-color: #b7e4d3;
    background: var(--success-soft);
}

.file-summary.has-file .file-summary-label,
.file-summary.has-file .file-summary-name {
    color: var(--success);
}

.file-summary.selected {
    border-color: #9bbcff;
    background: var(--primary-soft);
}

.file-summary.selected .file-summary-label,
.file-summary.selected .file-summary-name {
    color: var(--primary-dark);
}

.file-summary.pending-removal {
    border-color: #ffd0cc;
    background: var(--danger-soft);
}

.file-summary.pending-removal .file-summary-label,
.file-summary.pending-removal .file-summary-name {
    color: var(--danger);
}

.file-remove-btn {
    width: auto;
    min-height: 52px;
    padding: 10px 13px;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #ffd0cc;
    white-space: nowrap;
}

.file-remove-btn:hover {
    background: #ffe3e0;
    color: var(--danger);
}

@media (max-width: 900px) {
    .file-control {
        grid-template-columns: 1fr;
    }

    .file-remove-btn {
        width: 100%;
    }
}

/* v25: compact, clean file upload UI */
.document-card {
    padding: 0;
    overflow: hidden;
    transform: none;
}

.document-card:hover {
    transform: none;
}

.document-main {
    grid-template-columns: 54px minmax(220px, 1fr);
    gap: 18px;
    align-items: center;
    padding: 16px 18px;
}

.document-card + .document-card {
    margin-top: 0;
}

.document-index {
    width: 38px;
    height: 38px;
    font-size: 15px;
    border-radius: 10px;
}

.document-title {
    font-size: 15px;
    margin-bottom: 4px;
}

.document-desc {
    margin: 0 0 12px;
    font-size: 13px;
}

.file-control {
    display: grid;
    grid-template-columns: auto minmax(260px, 1fr) auto auto;
    gap: 10px;
    align-items: center;
}

.file-input-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.file-select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid #b8cdfd;
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.file-select-btn:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(31, 94, 255, .10);
}

.file-summary {
    min-height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 0;
    gap: 3px;
    justify-content: center;
}

.file-summary.has-file,
.file-summary.selected,
.file-summary.pending-removal {
    border: 0;
    background: transparent;
}

.file-summary-name {
    color: var(--text);
    font-size: 14px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-summary-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.file-summary.has-file .file-summary-name,
.file-summary.selected .file-summary-name {
    color: var(--text);
}

.file-summary.has-file .file-summary-label {
    color: var(--success);
}

.file-summary.selected .file-summary-label {
    color: var(--primary-dark);
}

.file-summary.pending-removal .file-summary-name,
.file-summary.pending-removal .file-summary-label {
    color: var(--danger);
}

.upload-status {
    min-width: auto;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.file-remove-btn,
.remove-kyc-file-btn {
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    background: #fff;
    color: var(--danger);
    border: 1px solid #ffb9b2;
    box-shadow: none;
}

.file-remove-btn:hover,
.remove-kyc-file-btn:hover {
    background: var(--danger-soft);
    box-shadow: none;
}

.bo-file-control {
    grid-template-columns: auto minmax(220px, 1fr) auto auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

@media (max-width: 900px) {
    .document-main {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .file-control,
    .bo-file-control {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .file-select-btn,
    .file-remove-btn,
    .remove-kyc-file-btn {
        width: 100%;
    }

    .file-summary-name {
        white-space: normal;
    }
}

/* v26: table-like KYC/BO file upload layout inspired by the approved mockup */
.section-header h2::before {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-right: 10px;
    border-radius: 7px;
    background: #eaf1ff;
    color: var(--primary);
    font-size: 13px;
    vertical-align: -2px;
}

#documentList.document-list {
    gap: 0;
    overflow: hidden;
    border: 1px solid #dce6f5;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.kyc-document-row.document-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
}

.kyc-document-row + .kyc-document-row {
    border-top: 1px solid #e4ebf5;
}

.kyc-row-grid.document-main {
    display: grid;
    grid-template-columns: 48px minmax(230px, 1.05fr) minmax(520px, 2.4fr);
    gap: 24px;
    align-items: center;
    min-height: 76px;
    padding: 16px 20px;
}

.kyc-row-grid .document-index {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #eef4ff;
    color: var(--primary);
    font-size: 14px;
    font-weight: 800;
}

.document-copy {
    min-width: 0;
}

.kyc-row-grid .document-title {
    margin: 0;
    color: #172033;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

.kyc-row-grid .document-desc {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


.doc-meta-label {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.document-requires {
    margin: 8px 0 0;
    padding: 9px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.document-requires-label {
    margin-bottom: 6px;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1.1;
    text-transform: uppercase;
}

.document-requires-list {
    display: grid;
    gap: 4px;
}

.document-requires-line {
    position: relative;
    padding-left: 12px;
    color: #1e293b;
    font-size: 12px;
    line-height: 1.45;
}

.document-requires-line::before {
    content: "";
    position: absolute;
    left: 0;
    top: .58em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #94a3b8;
}

.file-control.kyc-file-control,
.file-control.bo-file-control {
    display: grid;
    grid-template-columns: auto minmax(210px, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.file-control.bo-file-control {
    padding: 9px 10px;
    border: 1px solid #e0e7f2;
    border-radius: 10px;
    background: #fbfdff;
}

.file-select-btn {
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid #c7d9ff;
    border-radius: 7px;
    background: #fff;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    gap: 6px;
}

.upload-icon {
    font-size: 16px;
    line-height: 1;
}

.file-summary {
    min-width: 0;
    min-height: 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.file-summary-name {
    max-width: 100%;
    color: #172033;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.file-summary-label {
    margin-top: 3px;
    color: #71809a;
    font-size: 12px;
    line-height: 1.15;
}

.file-summary.pending-removal .file-summary-name {
    color: var(--danger);
    font-weight: 800;
}

.file-summary.pending-removal .file-summary-label {
    color: #b42318;
}

.upload-status {
    min-width: 86px;
    padding: 6px 11px;
    border-radius: 999px;
    background: #f2f5fa;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.upload-status.ready {
    background: #dff6eb;
    color: #087f5b;
}

.upload-status.ready::before {
    content: '✓';
    margin-right: 6px;
}

.file-remove-btn,
.remove-kyc-file-btn,
.remove-bo-file-btn {
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid #ffb9b2;
    border-radius: 7px;
    background: #fff;
    color: var(--danger);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    box-shadow: none;
    white-space: nowrap;
}

.file-remove-btn:hover,
.remove-kyc-file-btn:hover,
.remove-bo-file-btn:hover {
    background: #fff1f0;
    border-color: #ff9d94;
    box-shadow: none;
}

.person-card .bo-file-control .upload-status {
    min-width: 78px;
}

@media (max-width: 1180px) {
    .kyc-row-grid.document-main {
        grid-template-columns: 42px minmax(180px, .9fr) minmax(360px, 1.8fr);
        gap: 16px;
    }

    .file-control.kyc-file-control,
    .file-control.bo-file-control {
        grid-template-columns: auto minmax(180px, 1fr) auto;
    }

    .file-remove-btn,
    .remove-kyc-file-btn,
    .remove-bo-file-btn {
        grid-column: 3;
    }
}

@media (max-width: 820px) {
    .kyc-row-grid.document-main {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 12px;
        align-items: start;
    }

    .kyc-row-grid .kyc-file-control {
        grid-column: 1 / -1;
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .file-control.bo-file-control {
        grid-template-columns: 1fr;
    }

    .file-select-btn,
    .file-remove-btn,
    .remove-kyc-file-btn,
    .remove-bo-file-btn,
    .upload-status {
        width: 100%;
    }

    .file-remove-btn,
    .remove-kyc-file-btn,
    .remove-bo-file-btn {
        grid-column: auto;
    }
}

/* v27: refine KYC + BO layout to match the approved table-style mockup */
.kyc-section,
.bo-section {
    border: 1px solid #dce6f5;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
}

.kyc-section .section-header,
.bo-section .section-header {
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 0;
}

.section-title-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #0f172a;
    font-size: 20px;
    font-weight: 800;
}

.section-title-with-icon::before {
    content: "▤";
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: linear-gradient(180deg, #2f7cff 0%, #1358e8 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 5px 12px rgba(31, 94, 255, .22);
}

.bo-title::before {
    content: "♟";
    font-size: 14px;
}

.kyc-section .section-header h2::before,
.bo-section .section-header h2::before {
    margin-right: 0;
}

.bo-section .section-desc {
    display: none;
}

.bo-section .person-control {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: -58px 0 18px;
    min-height: 42px;
}

.bo-section .person-control > div {
    display: none;
}

.add-bo-btn {
    width: auto;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #1f5eff;
    border-radius: 7px;
    background: #fff;
    color: #1f5eff;
    box-shadow: none;
    font-size: 14px;
    font-weight: 800;
}

.add-bo-btn:hover {
    background: #eef4ff;
    box-shadow: none;
}

.person-list {
    gap: 0;
}

.bo-table {
    overflow: hidden;
    border: 1px solid #dce6f5;
    border-radius: 10px;
    background: #fff;
}

.bo-table-head,
.bo-table-row {
    display: grid;
    grid-template-columns: 42px minmax(120px, .75fr) minmax(150px, 1fr) minmax(145px, .9fr) minmax(112px, .7fr) minmax(210px, 1.25fr) minmax(500px, 2.2fr) 42px;
    gap: 14px;
    align-items: center;
}

.bo-table-head {
    min-height: 44px;
    padding: 0 16px;
    background: #fbfdff;
    border-bottom: 1px solid #e4ebf5;
    color: #536178;
    font-size: 12px;
    font-weight: 800;
}

.bo-table-body {
    display: grid;
    gap: 0;
}

.bo-table-row.person-card {
    min-height: 76px;
    padding: 14px 16px;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}

.bo-table-row + .bo-table-row {
    border-top: 1px solid #e4ebf5;
}

.bo-index-cell {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #eef4ff;
    color: #1f5eff;
    font-size: 13px;
    font-weight: 800;
}

.bo-field-cell {
    min-width: 0;
}

.bo-field-cell input,
.bo-field-cell select,
.bo-field-cell textarea {
    min-height: 34px;
    padding: 7px 9px;
    border-color: #dce6f5;
    border-radius: 7px;
    background: #fff;
    font-size: 13px;
}

.bo-field-cell textarea {
    height: 34px;
    min-height: 34px;
    resize: vertical;
}

.bo-mobile-label {
    display: none;
}

.bo-file-cell {
    min-width: 0;
}

.file-control.bo-file-control {
    grid-template-columns: auto minmax(160px, 1fr) auto auto;
    gap: 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.bo-table .file-select-btn,
.kyc-section .file-select-btn {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 13px;
    white-space: nowrap;
}

.bo-table .file-summary-name,
.kyc-section .file-summary-name {
    font-size: 13px;
    font-weight: 700;
}

.bo-table .file-summary-label,
.kyc-section .file-summary-label {
    font-size: 11px;
}

.bo-table .upload-status,
.kyc-section .upload-status {
    min-width: 78px;
    padding: 6px 10px;
    font-size: 12px;
}

.bo-table .file-remove-btn,
.kyc-section .file-remove-btn,
.kyc-section .remove-kyc-file-btn {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 12px;
}

.remove-person-btn {
    width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    border-radius: 7px;
    border-color: #ffb9b2;
    background: #fff;
    color: #b42318;
    font-size: 18px;
    line-height: 1;
    box-shadow: none;
}

.remove-person-btn:hover {
    background: #fff1f0;
    box-shadow: none;
}

.bo-row-action {
    display: flex;
    justify-content: center;
}

/* make the KYC rows visually match the same compact table rhythm */
.kyc-row-grid.document-main {
    grid-template-columns: 48px minmax(260px, 1.25fr) minmax(560px, 2.6fr);
    min-height: 74px;
    padding: 14px 20px;
}

.kyc-row-grid .document-index {
    width: 34px;
    height: 34px;
}

@media (max-width: 1320px) {
    .bo-table {
        overflow-x: auto;
    }

    .bo-table-head,
    .bo-table-row {
        min-width: 1160px;
    }
}

@media (max-width: 900px) {
    .bo-section .person-control {
        margin: 0 0 14px;
        justify-content: stretch;
    }

    .add-bo-btn {
        width: 100%;
    }

    .bo-table-head {
        display: none;
    }

    .bo-table-row.person-card {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        min-width: 0;
        gap: 12px;
        padding: 14px;
    }

    .bo-field-cell,
    .bo-file-cell,
    .bo-row-action {
        grid-column: 1 / -1;
    }

    .bo-mobile-label {
        display: block;
        margin-bottom: 5px;
        color: #536178;
        font-size: 12px;
        font-weight: 800;
    }

    .file-control.bo-file-control {
        grid-template-columns: 1fr;
    }

    .bo-row-action {
        justify-content: stretch;
    }

    .remove-person-btn {
        width: 100%;
    }
}

/* v34: unified visual system across all modules */
:root {
    --font-ui: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
    --page-max: 1240px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 12px 32px rgba(15, 23, 42, .06);
    --shadow-soft: 0 6px 18px rgba(15, 23, 42, .045);
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-base: 14px;
    --fs-md: 15px;
    --fs-lg: 18px;
    --fs-xl: 22px;
    --line-tight: 1.25;
    --line-base: 1.5;
}

html,
body {
    font-family: var(--font-ui);
    font-size: var(--fs-base);
    line-height: var(--line-base);
    color: #111827;
}

.page {
    width: min(100%, var(--page-max));
    padding: 24px 20px 52px;
}

.hero {
    border-radius: 14px;
    padding: 24px 26px;
    box-shadow: var(--shadow);
}

.eyebrow,
.loading-eyebrow {
    font-size: var(--fs-xs);
    font-weight: 800;
    letter-spacing: .04em;
}

.hero h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.18;
}

.subtitle {
    margin-top: 10px;
    font-size: var(--fs-base);
    line-height: 1.55;
}

.status-pill,
.section-header span,
.upload-status {
    font-size: var(--fs-xs);
    font-weight: 800;
}

.layout {
    margin-top: 20px;
    gap: 18px;
}

.card,
.kyc-section,
.bo-section,
.address-section,
.person-card,
.document-card {
    border-radius: var(--radius);
}

.card,
.kyc-section,
.bo-section {
    padding: 22px;
    border: 1px solid #dce6f5;
    box-shadow: var(--shadow);
}

.section-header {
    min-height: 34px;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e4ebf5;
}

.kyc-section .section-header,
.bo-section .section-header {
    border-bottom: 1px solid #e4ebf5;
    padding-bottom: 12px;
    margin-bottom: 18px;
}

.section-header h2,
.section-title-with-icon {
    margin: 0;
    color: #0f172a;
    font-size: var(--fs-lg);
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: var(--line-tight);
}

.section-title-with-icon::before {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    font-size: 13px;
    flex: 0 0 auto;
}

.section-desc {
    margin-top: 6px;
    color: #64748b;
    font-size: var(--fs-sm);
    line-height: 1.45;
}

.address-section {
    margin-top: 18px;
    padding: 18px;
    border-color: #e4ebf5;
    background: #fbfdff;
}

.address-title {
    margin-bottom: 14px;
    padding-bottom: 10px;
    font-size: var(--fs-md);
    font-weight: 800;
    line-height: var(--line-tight);
}

label,
.bo-mobile-label,
.bo-table-head,
.document-requires-label,
.file-summary-label,
.doc-meta-label {
    color: #536178;
    font-size: var(--fs-xs);
    font-weight: 800;
    line-height: var(--line-tight);
}

label {
    margin-bottom: 6px;
    text-transform: none;
}

input,
select,
textarea {
    min-height: 40px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    border-color: #dce6f5;
    color: #172033;
    font-size: var(--fs-base);
    line-height: 1.35;
}

textarea {
    min-height: 88px;
}

.form-grid {
    gap: 14px;
}

.contact-grid {
    margin-top: 18px;
}

button,
.file-select-btn,
.add-bo-btn,
.file-remove-btn,
.remove-kyc-file-btn,
.remove-bo-file-btn,
.remove-person-btn {
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: 800;
    line-height: 1;
    box-shadow: none;
}

button {
    min-height: 38px;
    padding: 9px 14px;
}

button:hover {
    box-shadow: none;
}

.secondary-btn,
.add-bo-btn {
    min-height: 38px;
    padding: 9px 14px;
}

#submitBtn {
    min-height: 44px;
    margin-top: 18px;
    font-size: var(--fs-base);
}

/* Unified KYC document table */
#documentList.document-list,
.bo-table {
    border: 1px solid #dce6f5;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.kyc-row-grid.document-main {
    grid-template-columns: 46px minmax(260px, 1.18fr) minmax(520px, 2.25fr);
    gap: 18px;
    min-height: 76px;
    padding: 15px 18px;
}

.kyc-row-grid .document-index,
.bo-index-cell {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: var(--fs-sm);
    font-weight: 800;
}

.kyc-row-grid .document-title,
.document-title {
    color: #172033;
    font-size: var(--fs-base);
    font-weight: 800;
    line-height: 1.3;
}

.kyc-row-grid .document-desc,
.document-desc {
    margin-top: 5px;
    color: #64748b;
    font-size: var(--fs-xs);
    line-height: 1.45;
}

.document-requires {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f8fafc;
    color: #334155;
    font-size: var(--fs-xs);
    line-height: 1.45;
}

.document-requires-line {
    font-size: var(--fs-xs);
    line-height: 1.45;
}

/* Unified BO table */
.bo-section .person-control {
    margin: -56px 0 18px;
}

.bo-table-head,
.bo-table-row {
    grid-template-columns: 42px minmax(118px, .75fr) minmax(150px, 1fr) minmax(145px, .9fr) minmax(110px, .7fr) minmax(210px, 1.25fr) minmax(500px, 2.2fr) 42px;
    gap: 12px;
}

.bo-table-head {
    min-height: 42px;
    padding: 0 16px;
    background: #fbfdff;
}

.bo-table-row.person-card {
    min-height: 76px;
    padding: 14px 16px;
}

.bo-field-cell input,
.bo-field-cell select,
.bo-field-cell textarea {
    min-height: 36px;
    padding: 8px 10px;
    font-size: var(--fs-sm);
}

.bo-field-cell textarea {
    height: 36px;
    min-height: 36px;
}

/* Unified file controls */
.file-control.kyc-file-control,
.file-control.bo-file-control {
    grid-template-columns: auto minmax(190px, 1fr) auto auto;
    gap: 10px;
    align-items: center;
}

.file-select-btn,
.bo-table .file-select-btn,
.kyc-section .file-select-btn {
    min-height: 34px;
    padding: 8px 12px;
    border-color: #c7d9ff;
    color: #1f5eff;
    background: #fff;
    font-size: var(--fs-xs);
    white-space: nowrap;
}

.file-select-btn:hover {
    background: #eef4ff;
    border-color: #1f5eff;
}

.file-summary {
    min-height: 34px;
}

.file-summary-name,
.bo-table .file-summary-name,
.kyc-section .file-summary-name {
    color: #172033;
    font-size: var(--fs-sm);
    font-weight: 700;
    line-height: 1.25;
}

.file-summary-label,
.bo-table .file-summary-label,
.kyc-section .file-summary-label {
    margin-top: 3px;
    color: #71809a;
    font-size: 11px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.upload-status,
.bo-table .upload-status,
.kyc-section .upload-status {
    min-width: 76px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.file-remove-btn,
.remove-kyc-file-btn,
.remove-bo-file-btn,
.bo-table .file-remove-btn,
.kyc-section .file-remove-btn,
.kyc-section .remove-kyc-file-btn {
    min-height: 34px;
    padding: 8px 11px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    font-weight: 800;
}

.remove-person-btn {
    width: 30px;
    height: 30px;
    min-height: 30px;
    border-radius: var(--radius-sm);
    font-size: 17px;
}

#message {
    margin-top: 14px;
    padding: 12px 13px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    line-height: 1.45;
}

@media (max-width: 1320px) {
    .bo-table-head,
    .bo-table-row {
        min-width: 1160px;
    }
}

@media (max-width: 900px) {
    .card,
    .kyc-section,
    .bo-section {
        padding: 16px;
    }

    .section-header h2,
    .section-title-with-icon {
        font-size: 17px;
    }

    .kyc-row-grid.document-main {
        grid-template-columns: 38px minmax(0, 1fr);
        padding: 14px;
    }

    .kyc-row-grid .kyc-file-control,
    .file-control.bo-file-control {
        grid-template-columns: 1fr;
    }

    .bo-section .person-control {
        margin: 0 0 14px;
    }
}


/* Phone input with country flag and calling code */
.phone-input-group {
    display: grid;
    grid-template-columns: 178px minmax(0, 1fr);
    align-items: center;
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.phone-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 94, 255, .12);
}

.phone-country {
    width: 100%;
    min-height: 48px;
    height: 48px;
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: #f8fafc;
    color: #263244;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 650;
    outline: none;
    box-shadow: none;
    cursor: pointer;
}

.phone-country:focus {
    border: 0;
    box-shadow: none;
}

.phone-input-group input {
    min-height: 48px;
    height: 48px;
    border: 0 !important;
    border-radius: 0;
    background: #fff;
    padding: 0 14px;
    box-shadow: none !important;
}

.phone-input-group input:focus {
    border: 0 !important;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    .phone-input-group {
        grid-template-columns: 148px minmax(0, 1fr);
    }

    .phone-country {
        font-size: 13px;
        padding: 0 9px;
    }
}


.phone-input-group.has-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .12);
}

.field-error-message {
    display: none;
    margin-top: 6px;
    color: var(--danger);
    font-size: 12px;
    line-height: 1.45;
}

.field-error-message.show {
    display: block;
}

/* v39: keep phone input visually aligned with all standard fields */
.phone-input-group {
    min-height: 44px;
    height: 44px;
    grid-template-columns: 150px minmax(0, 1fr);
}

.phone-country,
.phone-input-group input {
    min-height: 44px;
    height: 44px;
    font-size: 15px;
    line-height: 1.4;
}

.phone-country {
    padding: 0 10px;
}

.phone-input-group input {
    padding: 0 12px;
}

@media (max-width: 768px) {
    .phone-input-group {
        grid-template-columns: 132px minmax(0, 1fr);
    }

    .phone-country {
        font-size: 14px;
        padding: 0 8px;
    }
}

/* v40: strict control sizing - phone field must match every normal input/select */
:root {
    --control-height: 40px;
}

/* Apply exact height only to one-line form controls. Textareas keep their own height. */
input:not([type="file"]),
select {
    height: var(--control-height);
    min-height: var(--control-height);
    padding-top: 0;
    padding-bottom: 0;
    line-height: var(--control-height);
}

textarea {
    height: auto;
    min-height: 88px;
    line-height: 1.35;
    padding-top: 9px;
    padding-bottom: 9px;
}

/* The phone widget is a composite input, so the wrapper and its children must all use the same final size. */
.phone-input-group {
    height: var(--control-height);
    min-height: var(--control-height);
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
}

.phone-country,
.phone-input-group input {
    height: calc(var(--control-height) - 2px);
    min-height: calc(var(--control-height) - 2px);
    padding-top: 0;
    padding-bottom: 0;
    line-height: calc(var(--control-height) - 2px);
}

.phone-country {
    border-right: 1px solid #dce6f5;
}

.phone-input-group input {
    border: 0 !important;
}

@media (max-width: 768px) {
    .phone-input-group {
        grid-template-columns: 132px minmax(0, 1fr);
    }
}

/* v41: searchable country/nationality/phone selectors - unified with normal fields */
.native-select-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.searchable-select {
    position: relative;
    width: 100%;
    min-width: 0;
    font-size: 14px;
}

.searchable-select-trigger {
    width: 100%;
    height: var(--control-height);
    min-height: var(--control-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-align: left;
    box-shadow: none;
    cursor: pointer;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.searchable-select-trigger:hover {
    background: #fff;
    box-shadow: none;
    border-color: var(--primary);
}

.searchable-select-trigger:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 94, 255, .14);
}

.searchable-select-trigger.is-placeholder .searchable-select-label {
    color: #94a3b8;
    font-weight: 400;
}

.searchable-select-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select-caret {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
    transform: translateY(-1px);
}

.searchable-select-menu {
    position: absolute;
    z-index: 80;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    display: none;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .16);
}

.searchable-select.is-open .searchable-select-menu {
    display: block;
}

.searchable-select-search {
    width: 100%;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 9px !important;
    background: var(--surface-soft);
    font-size: 13px !important;
    line-height: 36px !important;
    margin: 0 0 7px !important;
}

.searchable-select-search:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(31, 94, 255, .12) !important;
    background: #fff;
}

.searchable-select-options {
    max-height: 238px;
    overflow-y: auto;
    display: grid;
    gap: 2px;
    padding-right: 2px;
}

.searchable-select-option {
    width: 100%;
    min-height: 34px;
    padding: 8px 9px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
    text-align: left;
    box-shadow: none;
}

.searchable-select-option:hover,
.searchable-select-option.is-selected {
    background: var(--primary-soft);
    color: var(--primary-dark);
    box-shadow: none;
}

.searchable-select-empty {
    padding: 10px 8px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.phone-input-group {
    overflow: visible;
    position: relative;
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
}

.phone-input-group .searchable-select {
    height: calc(var(--control-height) - 2px);
}

.phone-input-group .searchable-select-trigger {
    height: calc(var(--control-height) - 2px);
    min-height: calc(var(--control-height) - 2px);
    border: 0;
    border-right: 1px solid #dce6f5;
    border-radius: var(--radius) 0 0 var(--radius);
    background: #f8fbff;
    padding: 0 10px;
}

.phone-input-group .searchable-select-trigger:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(31, 94, 255, .20);
}

.phone-input-group .searchable-select-menu {
    left: 0;
    right: auto;
    width: min(360px, calc(100vw - 40px));
}

.phone-input-group input {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.phone-input-group.has-error .searchable-select-trigger {
    border-right-color: #ffd0cc;
}

.bo-field-cell .searchable-select-trigger {
    font-size: 13px;
}

.bo-field-cell .searchable-select-menu {
    min-width: 220px;
}

@media (max-width: 768px) {
    .phone-input-group {
        grid-template-columns: 145px minmax(0, 1fr);
    }

    .searchable-select-menu,
    .phone-input-group .searchable-select-menu {
        width: min(340px, calc(100vw - 32px));
    }
}

/* v42: unified dropdown arrow for all searchable selects */
.searchable-select-trigger {
    height: var(--control-height) !important;
    min-height: var(--control-height) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    line-height: 1 !important;
}

.searchable-select-caret {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    flex: 0 0 16px !important;
    display: block !important;
    color: #64748b !important;
    transform: none !important;
    transition: transform .16s ease, color .16s ease !important;
}

.searchable-select-caret path {
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

.searchable-select.is-open .searchable-select-caret {
    transform: rotate(180deg) !important;
    color: var(--primary) !important;
}

.searchable-select-label {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    line-height: 1.2 !important;
}

.phone-input-group .searchable-select,
.phone-input-group .searchable-select-trigger {
    height: var(--control-height) !important;
    min-height: var(--control-height) !important;
}

.phone-input-group .searchable-select-trigger {
    padding: 0 10px 0 12px !important;
    border-radius: var(--radius) 0 0 var(--radius) !important;
}

.phone-input-group .searchable-select-caret,
.bo-field-cell .searchable-select-caret {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    flex-basis: 16px !important;
}

/* v43: BO table refinements - wider Type field and non-overlapping Add BO button */
.bo-section {
    position: relative;
}

.bo-section .section-header {
    padding-right: 130px;
}

.bo-section .person-control {
    position: absolute;
    top: 22px;
    right: 22px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 38px;
    margin: 0 !important;
}

.bo-section .person-control > div {
    display: none !important;
}

.add-bo-btn {
    min-height: 36px;
    height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.bo-table-head,
.bo-table-row {
    grid-template-columns: 42px minmax(190px, 1.05fr) minmax(145px, .9fr) minmax(145px, .9fr) minmax(105px, .65fr) minmax(190px, 1.05fr) minmax(430px, 2fr) 42px !important;
}

.bo-field-cell:first-of-type .searchable-select,
.bo-field-cell:first-of-type .searchable-select-trigger,
.bo-field-cell:first-of-type select {
    min-width: 180px;
}

.bo-field-cell:first-of-type .searchable-select-menu {
    min-width: 280px;
}

.bo-field-cell:first-of-type .searchable-select-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1100px) {
    .bo-section .person-control {
        position: static;
        justify-content: flex-start;
        margin: 0 0 14px !important;
    }

    .bo-section .section-header {
        padding-right: 0;
    }
}


/* v44 real: BO header alignment fix based on original v43 structure */
.bo-section .bo-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e4ebf5;
}

.bo-heading-block {
    min-width: 0;
}

.bo-section .section-desc {
    display: block;
    margin-top: 6px;
    max-width: 680px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.bo-header-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.bo-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-width: 58px;
    padding: 0 11px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 700;
    line-height: 1;
}

.bo-section .person-control {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.bo-section .person-control label {
    margin: 0;
}

.add-bo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: 92px;
    height: 34px;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid #1f5eff;
    border-radius: 8px;
    background: #fff;
    color: #1f5eff;
    box-shadow: none;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.add-bo-btn:hover {
    background: #eef4ff;
    color: #1749c9;
    box-shadow: none;
    transform: none;
}

/* give BO Type enough room for longer values without breaking the table */
.bo-table-head,
.bo-table-row {
    grid-template-columns: 42px minmax(170px, .95fr) minmax(150px, 1fr) minmax(145px, .9fr) minmax(112px, .7fr) minmax(210px, 1.2fr) minmax(430px, 2fr) 42px;
}

.bo-field-cell .searchable-select,
.bo-field-cell select[name^="person_type_"] {
    min-width: 150px;
}

@media (max-width: 900px) {
    .bo-section .bo-section-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .bo-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .add-bo-btn {
        min-width: 112px;
    }
}

/* v45: precise BO header right-side vertical centering */
.bo-section .bo-section-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    column-gap: 24px !important;
    row-gap: 0 !important;
    margin: 0 0 18px !important;
    padding: 0 0 18px !important;
    border-bottom: 1px solid #e4ebf5 !important;
}

.bo-section .bo-heading-block {
    min-width: 0 !important;
    align-self: center !important;
}

.bo-section .bo-title,
.bo-section .bo-heading-block h2 {
    margin: 0 !important;
    line-height: 1.25 !important;
}

.bo-section .section-desc {
    margin: 8px 0 0 !important;
    line-height: 1.45 !important;
}

.bo-section .bo-header-actions {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    justify-self: end !important;
    align-self: center !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    white-space: nowrap !important;
}

.bo-section .bo-count-pill {
    height: 36px !important;
    min-height: 36px !important;
    min-width: 64px !important;
    padding: 0 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    margin: 0 !important;
}

.bo-section .add-bo-btn {
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 15px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    margin: 0 !important;
}

@media (max-width: 900px) {
    .bo-section .bo-section-header {
        grid-template-columns: 1fr !important;
        align-items: stretch !important;
        row-gap: 12px !important;
    }

    .bo-section .bo-header-actions {
        width: 100% !important;
        justify-content: space-between !important;
        justify-self: stretch !important;
    }
}

/* v47: unified searchable dropdown portal layer
   Menus are rendered under <body> with fixed positioning so table/phone wrappers
   cannot clip them. This fixes BO Nationality and Contact Number dropdown overflow
   without making any single module use a special CSS exception. */
.searchable-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

.searchable-select-trigger {
    width: 100%;
    height: var(--control-height) !important;
    min-height: var(--control-height) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    box-sizing: border-box !important;
}

.searchable-select-label {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.searchable-select-caret {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    flex: 0 0 16px !important;
    display: block !important;
    transform-origin: center !important;
}

.searchable-select-menu.searchable-select-menu-portal {
    position: fixed !important;
    display: none !important;
    z-index: 2147483000 !important;
    right: auto !important;
    padding: 8px !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .18) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.searchable-select-menu.searchable-select-menu-portal.is-open {
    display: block !important;
}

.searchable-select-menu.searchable-select-menu-portal .searchable-select-options {
    max-height: calc(100% - 48px) !important;
    overflow-y: auto !important;
}

/* The table can keep horizontal scrolling. Dropdowns are portaled out, so no vertical clipping. */
.bo-table,
.kyc-section,
.bo-section,
.phone-input-group {
    overflow-y: visible;
}

.phone-input-group {
    position: relative;
}

.phone-input-group .searchable-select-trigger {
    border-radius: var(--radius) 0 0 var(--radius) !important;
}



/* v50: unified existing searchable select styling only. No new JS helpers. */
.searchable-select-menu-portal {
    position: fixed !important;
    z-index: 2147483000 !important;
    display: none !important;
    padding: 8px !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .16) !important;
    overflow: hidden !important;
}

.searchable-select-menu-portal.is-open {
    display: block !important;
}

.searchable-select-trigger {
    width: 100% !important;
    height: var(--control-height) !important;
    min-height: var(--control-height) !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 0 12px !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius) !important;
    background: #fff !important;
    color: var(--text) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
}

.searchable-select-label {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.searchable-select-caret {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    flex: 0 0 16px !important;
    display: block !important;
    color: #64748b !important;
    transform: none !important;
}

.searchable-select.is-open .searchable-select-caret {
    transform: rotate(180deg) !important;
    color: var(--primary) !important;
}

.searchable-select-search {
    display: block !important;
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    box-sizing: border-box !important;
    margin: 0 0 8px !important;
    padding: 0 10px !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 9px !important;
    background: #fff !important;
    font-size: 13px !important;
    line-height: 36px !important;
}

.searchable-select-options {
    max-height: calc(100% - 48px) !important;
    overflow-y: auto !important;
    display: grid !important;
    gap: 2px !important;
}

.searchable-select-option {
    min-height: 34px !important;
    padding: 8px 9px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
    text-align: left !important;
}

.phone-input-group .searchable-select-trigger {
    border: 0 !important;
    border-right: 1px solid #dce6f5 !important;
    border-radius: var(--radius) 0 0 var(--radius) !important;
    background: #f8fbff !important;
    padding: 0 10px 0 12px !important;
}

.bo-field-cell .searchable-select-trigger {
    min-width: 220px !important;
}



/* v51: fix BO Nationality select overflow
   The trigger must respect its table cell width. Only the floating menu can be wider. */
.bo-field-cell,
.bo-field-cell .searchable-select,
.bo-field-cell .searchable-select-trigger {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

.bo-field-cell .searchable-select-trigger {
    min-width: 0 !important;
    padding-left: 12px !important;
    padding-right: 10px !important;
}

.bo-field-cell .searchable-select-label {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* The body-level dropdown can be wider for readability without stretching the table cell. */
.searchable-select-menu-portal {
    min-width: 240px;
}

/* Keep BO table controls aligned and prevent one cell control from covering the next cell. */
.bo-table td,
.bo-table th,
.bo-table-cell {
    overflow: visible;
}

.bo-table input,
.bo-table textarea,
.bo-table .searchable-select-trigger {
    max-width: 100% !important;
}



/* v52: restore searchable dropdown scrolling without changing table-cell trigger width */
.searchable-select-menu-portal,
.searchable-select-menu {
    overflow: hidden !important;
    max-height: min(320px, calc(100vh - 24px)) !important;
}

.searchable-select-options {
    max-height: 260px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Keep the search input visible while only the options list scrolls */
.searchable-select-menu-portal .searchable-select-search,
.searchable-select-menu .searchable-select-search {
    flex: 0 0 auto !important;
}

/* BO table select trigger stays inside its column; portal menu remains scrollable */
.bo-field-cell,
.bo-field-cell .searchable-select,
.bo-field-cell .searchable-select-trigger {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* Do not let table cells stretch the dropdown trigger into the next column */
.bo-field-cell .searchable-select-label {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}



/* v53: real dropdown scrolling.
   The menu is a fixed portal. The search input stays visible; only the option list scrolls. */
.searchable-select-menu-portal.is-open,
.searchable-select-menu.is-open {
    display: flex !important;
    flex-direction: column !important;
}

.searchable-select-menu-portal,
.searchable-select-menu {
    box-sizing: border-box !important;
    max-height: min(360px, calc(100vh - 32px)) !important;
    overflow: hidden !important;
}

.searchable-select-menu-portal .searchable-select-search,
.searchable-select-menu .searchable-select-search {
    flex: 0 0 auto !important;
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 0 8px !important;
}

.searchable-select-menu-portal .searchable-select-options,
.searchable-select-menu .searchable-select-options {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 4px !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
}

.searchable-select-options::-webkit-scrollbar {
    width: 8px;
}

.searchable-select-options::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cbd5e1;
}

.searchable-select-options::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 999px;
}



/* v55: fix Contact Number composite input overflow
   Root cause: the country searchable trigger had its own control height while the wrapper also clipped/boxed it,
   causing the left control to visually cover the lower border. The wrapper is now the single border box. */
.phone-input-group {
    height: var(--control-height) !important;
    min-height: var(--control-height) !important;
    max-height: var(--control-height) !important;
    display: grid !important;
    grid-template-columns: 170px minmax(0, 1fr) !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--radius) !important;
    background: #fff !important;
}

.phone-input-group .searchable-select,
.phone-input-group .searchable-select-trigger,
.phone-input-group input {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    box-sizing: border-box !important;
}

.phone-input-group .searchable-select {
    display: block !important;
    min-width: 0 !important;
}

.phone-input-group .searchable-select-trigger {
    border: 0 !important;
    border-right: 1px solid #dce6f5 !important;
    border-radius: 0 !important;
    background: #f8fbff !important;
    padding: 0 10px 0 12px !important;
    line-height: 1.2 !important;
    overflow: hidden !important;
}

.phone-input-group input {
    border: 0 !important;
    border-radius: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: normal !important;
    box-shadow: none !important;
    background: #fff !important;
}

.phone-input-group:focus-within {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(31, 94, 255, .14) !important;
}

.phone-input-group.has-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .10) !important;
}

.phone-input-group.has-error .searchable-select-trigger {
    border-right-color: #ffd0cc !important;
}

/* Phone dropdown is portaled, so keep menu independent from the clipped input wrapper. */
.searchable-select-menu-portal {
    overflow: hidden !important;
}

/* v56: prevent BO file controls from overlapping the row delete button.
   Keep long file names inside the file column and reserve enough width for the final X column. */
.bo-file-cell {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.file-control.bo-file-control {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr) max-content max-content !important;
    align-items: center !important;
    gap: 10px !important;
    overflow: hidden !important;
}

.file-control.bo-file-control .file-summary {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.file-control.bo-file-control .file-summary-name {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
}

.file-control.bo-file-control .file-select-btn,
.file-control.bo-file-control .upload-status,
.file-control.bo-file-control .remove-bo-file-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

.bo-row-action {
    min-width: 54px !important;
    width: 54px !important;
    position: relative !important;
    z-index: 2 !important;
    display: flex !important;
    justify-content: center !important;
}

.bo-table-head,
.bo-table-row {
    grid-template-columns: 42px minmax(170px, .95fr) minmax(150px, 1fr) minmax(145px, .9fr) minmax(112px, .7fr) minmax(210px, 1.2fr) minmax(560px, 2.2fr) 54px !important;
}

body.kyc-submitting-locked input,
body.kyc-submitting-locked select,
body.kyc-submitting-locked textarea,
body.kyc-submitting-locked button {
    pointer-events: none !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}

body.kyc-submitting-locked input,
body.kyc-submitting-locked select,
body.kyc-submitting-locked textarea {
    background-color: #f3f4f6 !important;
    border-color: #d1d5db !important;
    color: #6b7280 !important;
}

body.kyc-submitting-locked button,
body.kyc-submitting-locked .file-select-btn,
body.kyc-submitting-locked .file-remove-btn,
body.kyc-submitting-locked .remove-kyc-file-btn,
body.kyc-submitting-locked .remove-bo-file-btn,
body.kyc-submitting-locked .remove-person-btn,
body.kyc-submitting-locked .add-person-btn {
    background-color: #e5e7eb !important;
    border-color: #d1d5db !important;
    color: #6b7280 !important;
    box-shadow: none !important;
    transform: none !important;
}

body.kyc-submitting-locked .file-control,
body.kyc-submitting-locked .bo-file-control,
body.kyc-submitting-locked .file-summary,
body.kyc-submitting-locked .upload-status {
    background-color: #f3f4f6 !important;
    border-color: #d1d5db !important;
    color: #6b7280 !important;
}

body.kyc-submitting-locked {
    cursor: default;
}

/* v29: during submit, upload controls must look and feel disabled, no hand cursor */
body.kyc-submitting-locked .file-select-btn,
body.kyc-submitting-locked .file-select-btn:hover,
body.kyc-submitting-locked .file-control,
body.kyc-submitting-locked .bo-file-control,
body.kyc-submitting-locked .kyc-file-control {
    cursor: not-allowed !important;
}

body.kyc-submitting-locked .file-select-btn,
body.kyc-submitting-locked .file-select-btn:hover {
    pointer-events: auto !important;
    background-color: #e5e7eb !important;
    border-color: #d1d5db !important;
    color: #6b7280 !important;
    box-shadow: none !important;
    transform: none !important;
}

body.kyc-submitting-locked .file-input-native,
body.kyc-submitting-locked input[type="file"] {
    cursor: not-allowed !important;
}

/* v31: KYC status gate */
.kyc-status-block {
    max-width: 760px;
    margin: 80px auto;
    padding: 0 24px;
}

.kyc-status-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    padding: 36px;
    text-align: center;
}

.kyc-status-card h1 {
    margin: 8px 0 16px;
    font-size: 30px;
    line-height: 1.2;
    color: #111827;
}

.kyc-status-card p {
    margin: 10px 0;
    color: #374151;
    font-size: 16px;
}

.kyc-status-card strong {
    color: #111827;
}

.kyc-status-note {
    color: #6b7280 !important;
}

/* v44: BO/KYC layout correction after full CSS review
   Root cause: earlier table rules forced large min-width columns and one-line file names,
   so the BO document column overflowed the card/page. This version makes the BO table
   fit the available card width, allows long headers and file names to wrap, and changes
   the BO file control to a wrapping flex layout instead of a rigid four-column grid. */
.bo-section,
.kyc-section,
.card {
    max-width: 100%;
}

.bo-table {
    width: 100%;
    max-width: 100%;
    overflow-x: visible !important;
}

.bo-table-head,
.bo-table-row {
    width: 100%;
    min-width: 0 !important;
    grid-template-columns:
        36px
        minmax(88px, .82fr)
        minmax(112px, 1fr)
        minmax(112px, 1fr)
        minmax(82px, .72fr)
        minmax(126px, 1.05fr)
        minmax(250px, 2.15fr)
        34px !important;
    gap: 10px !important;
}

.bo-table-head {
    align-items: center;
    padding: 0 14px !important;
}

.bo-table-head > div {
    min-width: 0;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.25;
}

.bo-table-row.person-card {
    padding: 14px !important;
    align-items: center;
}

.bo-field-cell,
.bo-file-cell,
.bo-row-action,
.document-copy {
    min-width: 0 !important;
}

.bo-field-cell .searchable-select,
.bo-field-cell select,
.bo-field-cell input,
.bo-field-cell textarea {
    width: 100% !important;
    min-width: 0 !important;
}

.bo-field-cell .searchable-select-trigger,
.bo-field-cell .searchable-select-label {
    min-width: 0 !important;
}

.file-control.bo-file-control {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
}

.bo-file-control .file-select-btn {
    flex: 0 0 auto;
}

.bo-file-control .file-summary {
    flex: 1 1 130px;
    min-width: 0 !important;
    max-width: 100%;
}

.bo-file-control .upload-status,
.bo-file-control .remove-bo-file-btn {
    flex: 0 0 auto;
}

.file-summary-name,
.bo-table .file-summary-name,
.kyc-section .file-summary-name {
    display: block;
    max-width: 100%;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word;
    line-height: 1.3;
}

.file-summary {
    overflow: visible !important;
}

.kyc-row-grid.document-main {
    grid-template-columns: 42px minmax(220px, 1fr) minmax(0, 2fr) !important;
    max-width: 100%;
}

.file-control.kyc-file-control {
    grid-template-columns: auto minmax(0, 1fr) auto auto !important;
    min-width: 0 !important;
}

@media (max-width: 1180px) {
    .bo-table-head,
    .bo-table-row {
        grid-template-columns:
            34px
            minmax(82px, .8fr)
            minmax(102px, 1fr)
            minmax(102px, 1fr)
            minmax(76px, .7fr)
            minmax(112px, 1fr)
            minmax(220px, 2fr)
            32px !important;
        gap: 8px !important;
    }

    .bo-table-head,
    .bo-table-row.person-card {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

@media (max-width: 980px) {
    .bo-table {
        overflow-x: hidden !important;
    }

    .bo-table-head {
        display: none !important;
    }

    .bo-table-row.person-card {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) 34px !important;
        gap: 12px !important;
        min-width: 0 !important;
        align-items: start !important;
    }

    .bo-field-cell,
    .bo-file-cell {
        grid-column: 1 / -1 !important;
    }

    .bo-row-action {
        grid-column: 3 !important;
        grid-row: 1 !important;
        justify-content: end !important;
    }

    .bo-mobile-label {
        display: block !important;
    }

    .file-control.bo-file-control {
        align-items: stretch !important;
    }

    .bo-file-control .file-select-btn,
    .bo-file-control .upload-status,
    .bo-file-control .remove-bo-file-btn {
        width: 100%;
    }
}

@media (max-width: 820px) {
    .kyc-row-grid.document-main {
        grid-template-columns: 38px minmax(0, 1fr) !important;
    }

    .kyc-row-grid .kyc-file-control {
        grid-column: 1 / -1 !important;
        grid-template-columns: 1fr !important;
    }
}

/* v51 mobile responsive polish: full-width, readable card layout for phones */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

.page,
.card,
.kyc-section,
.bo-section,
.address-section,
.bo-table,
#documentList.document-list,
.kyc-document-row,
.bo-table-row,
.file-control,
.file-summary,
.searchable-select,
.searchable-select-trigger {
    min-width: 0 !important;
}

.file-summary-name,
.document-title,
.document-requires-line,
.bo-table-head > div,
.bo-mobile-label,
input,
textarea,
.searchable-select-label {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.file-summary-name {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

@media (max-width: 768px) {
    :root {
        --page-max: 100%;
        --control-height: 44px;
        --fs-base: 14px;
    }

    body {
        background:
            linear-gradient(180deg, #eef4ff 0, rgba(238, 244, 255, 0) 220px),
            var(--bg);
    }

    .page {
        width: 100%;
        padding: 12px 10px 32px !important;
    }

    .layout {
        gap: 12px !important;
        margin-top: 12px !important;
    }

    .hero {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        padding: 18px 16px !important;
        border-radius: 14px !important;
    }

    .hero h1 {
        font-size: 22px !important;
        line-height: 1.22 !important;
    }

    .subtitle {
        font-size: 13px !important;
        line-height: 1.5 !important;
    }

    .status-pill {
        justify-self: start !important;
        padding: 7px 12px !important;
    }

    .card,
    .kyc-section,
    .bo-section {
        padding: 14px !important;
        border-radius: 14px !important;
        box-shadow: 0 8px 22px rgba(15, 23, 42, .05) !important;
    }

    .section-header,
    .bo-section .bo-section-header {
        display: grid !important;
        grid-template-columns: 1fr !important;
        align-items: start !important;
        gap: 10px !important;
        margin-bottom: 14px !important;
        padding-bottom: 12px !important;
    }

    .section-header h2,
    .section-title-with-icon {
        font-size: 17px !important;
        line-height: 1.25 !important;
    }

    .section-title-with-icon::before {
        width: 22px !important;
        height: 22px !important;
        border-radius: 7px !important;
    }

    .section-desc {
        font-size: 12px !important;
        line-height: 1.45 !important;
    }

    .form-grid,
    .contact-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-top: 12px !important;
    }

    .address-section {
        margin-top: 14px !important;
        padding: 14px !important;
        border-radius: 12px !important;
    }

    .address-title {
        font-size: 15px !important;
        margin-bottom: 12px !important;
    }

    label {
        font-size: 12px !important;
    }

    input:not([type="file"]),
    select,
    textarea,
    .searchable-select-trigger,
    .phone-input-group,
    .phone-country,
    .phone-input-group input {
        min-height: 44px !important;
        height: 44px !important;
        font-size: 14px !important;
    }

    textarea,
    .bo-field-cell textarea {
        height: auto !important;
        min-height: 78px !important;
        line-height: 1.4 !important;
    }

    .phone-input-group {
        grid-template-columns: 132px minmax(0, 1fr) !important;
    }

    .phone-input-group .searchable-select-trigger {
        height: 44px !important;
        min-height: 44px !important;
        padding-left: 9px !important;
        padding-right: 8px !important;
    }

    .phone-input-group input {
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 10px !important;
    }

    .bo-header-actions {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: auto 1fr !important;
        gap: 10px !important;
    }

    .bo-count-pill {
        justify-self: start !important;
        height: 36px !important;
    }

    .add-bo-btn {
        width: 100% !important;
        min-width: 0 !important;
        height: 40px !important;
        min-height: 40px !important;
    }

    .bo-table {
        overflow: visible !important;
        border: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .bo-table-head {
        display: none !important;
    }

    .bo-table-body {
        display: grid !important;
        gap: 12px !important;
    }

    .bo-table-row.person-card {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) !important;
        gap: 12px !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        padding: 14px !important;
        border: 1px solid #dce6f5 !important;
        border-radius: 14px !important;
        background: #fff !important;
        box-shadow: 0 6px 18px rgba(15, 23, 42, .045) !important;
    }

    .bo-index-cell {
        grid-column: 1 !important;
        grid-row: 1 !important;
        align-self: start !important;
    }

    .bo-table-row > input[type="hidden"] {
        display: none !important;
    }

    .bo-field-cell,
    .bo-file-cell,
    .bo-row-action {
        grid-column: 1 / -1 !important;
        width: 100% !important;
    }

    .bo-table-row .bo-field-cell:first-of-type {
        grid-column: 2 !important;
        grid-row: 1 !important;
    }

    .bo-mobile-label {
        display: block !important;
        margin-bottom: 6px !important;
        color: #536178 !important;
        font-size: 12px !important;
        font-weight: 800 !important;
    }

    .bo-field-cell input,
    .bo-field-cell select,
    .bo-field-cell textarea,
    .bo-field-cell .searchable-select-trigger {
        width: 100% !important;
        font-size: 14px !important;
    }

    .file-control.kyc-file-control,
    .file-control.bo-file-control {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 9px !important;
        width: 100% !important;
        padding: 10px !important;
        border: 1px solid #e4ebf5 !important;
        border-radius: 12px !important;
        background: #fbfdff !important;
    }

    .file-select-btn,
    .file-remove-btn,
    .remove-kyc-file-btn,
    .remove-bo-file-btn,
    .upload-status {
        width: 100% !important;
        min-height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .file-summary {
        min-height: 42px !important;
        padding: 8px 10px !important;
        border: 1px solid #e4ebf5 !important;
        border-radius: 10px !important;
        background: #fff !important;
    }

    .file-summary.has-file,
    .file-summary.selected {
        border-color: #b7e4d3 !important;
        background: #f2fbf7 !important;
    }

    .file-summary.pending-removal {
        border-color: #ffd0cc !important;
        background: #fff1f0 !important;
    }

    .file-summary-name {
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    .file-summary-label {
        font-size: 11px !important;
        line-height: 1.25 !important;
    }

    .bo-row-action {
        display: block !important;
    }

    .remove-person-btn {
        width: 100% !important;
        height: 40px !important;
        min-height: 40px !important;
        font-size: 14px !important;
    }

    #documentList.document-list {
        display: grid !important;
        gap: 12px !important;
        border: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
        overflow: visible !important;
    }

    .kyc-document-row.document-card {
        border: 1px solid #dce6f5 !important;
        border-radius: 14px !important;
        box-shadow: 0 6px 18px rgba(15, 23, 42, .045) !important;
        overflow: visible !important;
    }

    .kyc-document-row + .kyc-document-row {
        border-top: 1px solid #dce6f5 !important;
    }

    .kyc-row-grid.document-main {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) !important;
        gap: 12px !important;
        min-height: 0 !important;
        padding: 14px !important;
    }

    .kyc-row-grid .document-index {
        width: 32px !important;
        height: 32px !important;
        align-self: start !important;
    }

    .document-copy {
        min-width: 0 !important;
    }

    .kyc-row-grid .document-title {
        font-size: 14px !important;
        line-height: 1.35 !important;
    }

    .document-requires {
        margin-top: 8px !important;
        padding: 8px 9px !important;
        font-size: 12px !important;
    }

    .kyc-row-grid .kyc-file-control {
        grid-column: 1 / -1 !important;
    }

    #submitBtn {
        min-height: 46px !important;
        font-size: 15px !important;
    }

    .searchable-select-menu,
    .searchable-select-menu-portal,
    .phone-input-group .searchable-select-menu {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
    }
}

@media (max-width: 420px) {
    .page {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .hero,
    .card,
    .kyc-section,
    .bo-section,
    .address-section {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .hero h1 {
        font-size: 20px !important;
    }

    .phone-input-group {
        grid-template-columns: 118px minmax(0, 1fr) !important;
    }

    .bo-header-actions {
        grid-template-columns: 1fr !important;
    }

    .bo-count-pill {
        width: 100% !important;
    }
}
