/* =========================================================
   KYC Workflow interactive demo modal
   Brand vars (overridden by colour picker): --kyc-primary · --kyc-primary-dark
   ========================================================= */

.kyc-demo-open {
    margin-top: 0.35rem;
}

/* Backdrop */
.kyc-demo-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(6px);
}
.kyc-demo-modal.is-open {
    display: flex;
}

.kyc-demo-dialog {
    --kyc-primary: #EC2E5E;
    --kyc-primary-dark: #8B1538;
    --kyc-primary-soft: rgba(236, 46, 94, 0.1);
    --kyc-primary-ring: rgba(236, 46, 94, 0.15);
    --kyc-header-mid: #3a1020;
    width: min(720px, 100%);
    max-height: min(92vh, 900px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.35);
    overflow: hidden;
    animation: kycDemoIn 0.22s ease;
}
@keyframes kycDemoIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.kyc-demo-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.35rem;
    background: linear-gradient(135deg, #0f172a 0%, var(--kyc-header-mid) 55%, var(--kyc-primary-dark) 100%);
    color: #fff;
}
.kyc-demo-header-main {
    min-width: 0;
    flex: 1;
}
.kyc-demo-header h2 {
    margin: 0 0 0.25rem;
    font-size: 1.2rem;
    color: #fff;
}
.kyc-demo-header p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    line-height: 1.45;
}
.kyc-demo-brands {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.55rem;
    margin-top: 0.85rem;
}
.kyc-demo-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.35rem 0.65rem;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.kyc-demo-brand img {
    display: block;
    height: 26px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}
/* Arrow points from "your brand" back to eValidate */
.kyc-demo-brand-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    opacity: 0.95;
    padding: 0 0.15rem;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}
.kyc-demo-brand--placeholder {
    gap: 0.4rem;
    border: 1.5px dashed rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: none;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.kyc-demo-brand--placeholder:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: #fff;
}
.kyc-demo-brand--placeholder i {
    font-size: 0.95rem;
    opacity: 0.95;
}
.kyc-demo-brand--placeholder span {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.kyc-demo-brand--custom {
    box-shadow: 0 0 0 2px #fff, 0 4px 14px rgba(0, 0, 0, 0.2);
}
.kyc-demo-brand--custom img {
    height: 28px;
    max-width: 140px;
}
.kyc-demo-brand-reset {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
}
.kyc-demo-brand-reset:hover {
    background: rgba(255, 255, 255, 0.22);
}
.kyc-demo-brand-reset[hidden] {
    display: none !important;
}
.kyc-demo-colour {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: 0.15rem;
    padding: 0.3rem 0.55rem 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    cursor: pointer;
    user-select: none;
}
.kyc-demo-colour-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.kyc-demo-colour input[type="color"] {
    width: 32px;
    height: 28px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
}
.kyc-demo-colour input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
.kyc-demo-colour input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}
.kyc-demo-close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    cursor: pointer;
    font-size: 1.1rem;
}
.kyc-demo-close:hover { background: rgba(255,255,255,0.2); }
.kyc-demo-close-hint {
    margin: 0.35rem 1.35rem 0;
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: right;
}

/* Progress */
.kyc-demo-progress {
    display: flex;
    gap: 0.35rem;
    padding: 0.85rem 1.25rem 0.35rem;
    background: #f8fafc;
    border-bottom: 1px solid #e8ecf1;
    overflow-x: auto;
}
.kyc-demo-progress button {
    flex: 1 1 0;
    min-width: 4.5rem;
    border: 0;
    background: transparent;
    padding: 0.35rem 0.25rem 0.55rem;
    cursor: default;
    font-family: inherit;
}
.kyc-demo-progress .dot {
    width: 28px;
    height: 28px;
    margin: 0 auto 0.3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    background: #e5e7eb;
    color: #6b7280;
}
.kyc-demo-progress .lab {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.kyc-demo-progress .is-done .dot {
    background: linear-gradient(145deg, var(--kyc-primary), var(--kyc-primary-dark));
    color: #fff;
}
.kyc-demo-progress .is-active .dot {
    background: #fff;
    color: var(--kyc-primary);
    box-shadow: 0 0 0 2px var(--kyc-primary);
}
.kyc-demo-progress .is-active .lab { color: var(--kyc-primary-dark); }
.kyc-demo-progress .is-done .lab { color: #64748b; }

.kyc-demo-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.25rem 1.35rem 0.5rem;
}
.kyc-demo-step { display: none; }
.kyc-demo-step.is-active { display: block; }
.kyc-demo-step h3 {
    margin: 0 0 0.45rem;
    font-size: 1.15rem;
}
.kyc-demo-step .intro {
    margin: 0 0 1.1rem;
    color: #5f6b7a;
    font-size: 0.92rem;
    line-height: 1.55;
}

.kyc-demo-field {
    margin-bottom: 0.9rem;
}
.kyc-demo-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.35rem;
}
.kyc-demo-field input,
.kyc-demo-field select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
}
.kyc-demo-field input:focus,
.kyc-demo-field select:focus {
    outline: none;
    border-color: var(--kyc-primary);
    box-shadow: 0 0 0 3px var(--kyc-primary-ring);
}
.kyc-demo-field input.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
    background: #fef2f2;
}
.kyc-demo-field input.is-valid {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
    background: #ecfdf5;
}
.kyc-demo-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
@media (max-width: 560px) {
    .kyc-demo-row { grid-template-columns: 1fr; }
}

.kyc-demo-hint {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0.35rem 0 0;
    line-height: 1.45;
}
.kyc-demo-error {
    display: none;
    margin: 0 0 0.85rem;
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 0.88rem;
}
.kyc-demo-error.is-visible { display: block; }
.kyc-demo-success {
    display: none;
    margin: 0 0 0.85rem;
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 0.88rem;
}
.kyc-demo-success.is-visible { display: block; }

.kyc-auth-callout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem 0.9rem;
    margin: 0 0 1.1rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--kyc-primary) 28%, transparent);
    background: var(--kyc-primary-soft);
    color: #0f172a;
}
.kyc-auth-callout > i {
    margin-top: 0.15rem;
    color: var(--kyc-primary);
    font-size: 1.2rem;
}
.kyc-auth-callout strong {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.92rem;
    color: var(--kyc-primary-dark);
}
.kyc-auth-callout p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.55;
    color: #475569;
}
.kyc-demo-pin-box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.kyc-demo-pin-box input {
    flex: 1 1 8rem;
    letter-spacing: 0.35em;
    font-weight: 800;
    font-size: 1.15rem;
    text-align: center;
}
.kyc-demo-demo-pin {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--kyc-primary-dark);
    background: var(--kyc-primary-soft);
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
}

/* Address autocomplete */
.kyc-addr-wrap { position: relative; }
.kyc-addr-dropdown {
    display: none;
    position: absolute;
    left: 0; right: 0; top: calc(100% + 4px);
    z-index: 5;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}
.kyc-addr-dropdown.is-open { display: block; }
.kyc-addr-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    padding: 0.7rem 0.85rem;
    font-size: 0.88rem;
    cursor: pointer;
    font-family: inherit;
    color: #1e293b;
}
.kyc-addr-item:hover { background: #fff5f7; }
.kyc-addr-item:last-child { border-bottom: 0; }
.kyc-addr-item small { display: block; color: #64748b; margin-top: 0.15rem; }
.kyc-selected-addr {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    display: none;
}
.kyc-selected-addr.is-visible { display: block; }
.kyc-selected-addr strong { color: #0f172a; }

/* CoP samples */
.kyc-sample-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
}
.kyc-sample-btns button {
    border: 1px solid color-mix(in srgb, var(--kyc-primary) 30%, transparent);
    background: #fff;
    color: var(--kyc-primary-dark);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.kyc-sample-btns button:hover { background: #fff5f7; }

.kyc-cop-result {
    display: none;
    margin-top: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
}
.kyc-cop-result.is-visible { display: block; }
.kyc-cop-result.match { background: #ecfdf5; border-color: #a7f3d0; }
.kyc-cop-result.close { background: #fffbeb; border-color: #fde68a; }
.kyc-cop-result.nomatch { background: #fef2f2; border-color: #fecaca; }
.kyc-cop-result .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

/* Review */
.kyc-review {
    display: grid;
    gap: 0.75rem;
}
.kyc-review-card {
    border: 1px solid #e8ecf1;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    background: #fafbfc;
}
.kyc-review-card h4 {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--kyc-primary-dark);
}
.kyc-review-card dl {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(7rem, 32%) 1fr;
    gap: 0.3rem 0.65rem;
    font-size: 0.88rem;
}
.kyc-review-card dt { color: #64748b; font-weight: 600; }
.kyc-review-card dd { margin: 0; color: #0f172a; font-weight: 650; word-break: break-word; }

.kyc-json-preview {
    margin-top: 0.85rem;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.72rem;
    line-height: 1.45;
    max-height: 180px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Footer actions */
.kyc-demo-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: space-between;
    align-items: center;
    padding: 0.95rem 1.35rem 1.2rem;
    border-top: 1px solid #e8ecf1;
    background: #fff;
}
.kyc-demo-footer .left,
.kyc-demo-footer .right {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.kyc-demo-footer .btn {
    min-height: 44px;
}
.kyc-demo-footer .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}
/* Theme primary actions inside the dialog from brand colour picker */
.kyc-demo-dialog .btn-primary {
    background: linear-gradient(135deg, var(--kyc-primary) 0%, var(--kyc-primary-dark) 100%) !important;
    border-color: transparent !important;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--kyc-primary) 30%, transparent);
}
.kyc-demo-dialog .btn-secondary {
    border-color: color-mix(in srgb, var(--kyc-primary) 35%, transparent) !important;
    color: var(--kyc-primary-dark) !important;
}
.kyc-demo-dialog .btn-secondary:hover {
    background: var(--kyc-primary-soft) !important;
}
.kyc-demo-dialog .kyc-demo-progress .is-done .dot {
    background: linear-gradient(145deg, var(--kyc-primary), var(--kyc-primary-dark));
}
.kyc-demo-note {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0.15rem 0 0;
}

/* File upload / scan zones */
.kyc-upload-zone {
    position: relative;
    border: 2px dashed color-mix(in srgb, var(--kyc-primary) 35%, transparent);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff7f9 0%, #fff 100%);
    min-height: 140px;
    margin-bottom: 0.85rem;
    overflow: hidden;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.kyc-upload-zone:hover {
    border-color: var(--kyc-primary);
    background: #fff5f7;
}
.kyc-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 2;
}
.kyc-upload-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 140px;
    padding: 1.25rem 1rem;
    text-align: center;
    pointer-events: none;
}
.kyc-upload-ui i {
    font-size: 1.75rem;
    color: var(--kyc-primary);
    margin-bottom: 0.25rem;
}
.kyc-upload-ui strong {
    font-size: 0.95rem;
    color: #0f172a;
}
.kyc-upload-ui span {
    font-size: 0.8rem;
    color: #64748b;
}

.kyc-file-preview {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    margin-bottom: 0.65rem;
}
.kyc-file-preview[hidden] { display: none !important; }
.kyc-file-preview img {
    width: 96px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}
.kyc-file-preview--pdf .kyc-pdf-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #fef2f2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.kyc-file-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.kyc-file-meta strong {
    font-size: 0.9rem;
    color: #0f172a;
    word-break: break-all;
}
.kyc-file-meta span {
    font-size: 0.8rem;
    color: #64748b;
}
.kyc-file-remove {
    align-self: flex-start;
    margin-top: 0.35rem;
    border: 0;
    background: transparent;
    color: #b91c1c;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}
.kyc-file-remove:hover { text-decoration: underline; }

@media (max-width: 640px) {
    .kyc-demo-progress .lab { font-size: 0.62rem; }
    .kyc-demo-progress .dot { width: 24px; height: 24px; font-size: 0.65rem; }
}

body.kyc-demo-open-scroll { overflow: hidden; }
