/* =====================================================
   kyc-shared.css — NDB Securities KYC 2026
   Fully responsive — desktop, tablet, mobile
   ===================================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
/*roottest*/
:root {
    --red: #C0202A;
    --red-dark: #9A1820;
    --red-light: #f9e8e9;
    --red-mid: #e8b0b3;
    --navy: #1a2340;
    --navy-light: #2c3a5c;
    --white: #ffffff;
    --off-white: #fafafa;
    --gray-50: #f5f5f5;
    --gray-100: #eeeeee;
    --gray-300: #c8c8c8;
    --gray-500: #888888;
    --gray-700: #444444;
    --text: #1a1a1a;
    --text-muted: #666666;
    --border: #e0e0e0;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.12);
    --radius: 10px;
    --radius-sm: 6px;
}

/* ── Base ── */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Noto Sans Sinhala', 'Inter', sans-serif;
    background: var(--gray-50);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

p, label, span, div, textarea, input, button, select {
    font-family: 'Noto Sans Sinhala', 'Inter', sans-serif;
}

/* ── Header ── */
.header {
    background: var(--white);
    border-bottom: 3px solid var(--red);
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    width: 100%; /* ← NEW */
    overflow-x: hidden; /* ← NEW */
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    padding: 8px 0;
    gap: 10px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

    .logo-area img {
        width: 52px;
        height: auto;
    }

.logo-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

    .logo-text strong {
        display: block;
        color: var(--text);
        font-size: 12px;
        font-weight: 600;
    }

.header-title {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

    .header-title strong {
        display: block;
        color: var(--red);
        font-size: 13px;
        font-weight: 600;
    }

@media (max-width: 480px) {
    .header {
        padding: 0 1rem;
    }

    .logo-area img {
        width: 42px;
    }

    .logo-text {
        display: none;
    }

    .header-title {
        font-size: 11px;
    }

        .header-title strong {
            font-size: 12px;
        }
}

/* ── Progress Bar ── */
.progress-wrap {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 1.25rem;
    width: 100%; /* ← NEW */
    overflow-x: hidden; /* ← NEW */
}

.progress-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 12px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

    .progress-inner::-webkit-scrollbar {
        display: none;
    }

.step-item {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.step-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    transition: all 0.3s;
    flex-shrink: 0;
}

    .step-dot.active {
        border-color: var(--red);
        background: var(--red);
        color: white;
        box-shadow: 0 0 0 3px var(--red-light);
    }

    .step-dot.done {
        border-color: var(--red);
        background: var(--red-light);
        color: var(--red);
    }

.step-label {
    font-size: 10px;
    color: var(--gray-500);
    margin-left: 5px;
    white-space: nowrap;
    font-weight: 500;
}

    .step-label.active {
        color: var(--red);
        font-weight: 600;
    }

    .step-label.done {
        color: var(--text-muted);
    }

.step-line {
    width: 20px;
    height: 2px;
    background: var(--border);
    margin: 0 3px;
    flex-shrink: 0;
}

    .step-line.done {
        background: var(--red-mid);
    }

/* ── Main Layout ── */
.main {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    width: 100%; /* ← NEW */
    overflow-x: hidden; /* ← NEW */
    box-sizing: border-box; /* ← NEW */
}

@media (max-width: 480px) {
    .main {
        padding: 1rem 0.875rem;
    }
}

/* ── Screens ── */
.screen {
    display: none;
    animation: fadeUp 0.3s ease;
}

    .screen.active {
        display: block;
    }

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Cards ── */
.section-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.section-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    width: 34px;
    height: 34px;
    background: var(--red-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.section-head h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.section-head p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.section-body {
    padding: 1.25rem;
}

@media (max-width: 480px) {
    .section-body {
        padding: 1rem;
    }

    .section-head {
        padding: 0.875rem 1rem;
    }
}

/* ── Labels ── */
.sub-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--red);
    letter-spacing: 0.01em;
    text-transform: uppercase;
    padding-bottom: 7px;
    border-bottom: 2px solid var(--red);
    margin-bottom: 1.1rem;
    display: block;
}

.holder-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--navy);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
}

.holder-divider {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: white;
    padding: 11px 16px;
    border-radius: 8px;
    margin: 1.25rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

    .holder-divider .num {
        width: 26px;
        height: 26px;
        background: rgba(255,255,255,0.2);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        flex-shrink: 0;
    }

/* ── Grid ── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.875rem;
}

.col-span-2 {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }

    .col-span-2 {
        grid-column: span 1;
    }
}

/* ── Fields ── */
.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

    .field label {
        font-size: 13px;
        font-weight: 500;
        color: var(--gray-700);
    }

        .field label .req {
            color: var(--red);
            margin-left: 2px;
        }

    .field input,
    .field select,
    .field textarea {
        width: 100%;
        padding: 11px 14px;
        border: 1.5px solid var(--border);
        border-radius: var(--radius-sm);
        font-family: 'Noto Sans Sinhala', 'Inter', sans-serif;
        font-size: 15px; /* 16px prevents iOS zoom; 15px is safe */
        color: var(--text);
        background: var(--white);
        transition: border-color 0.2s, box-shadow 0.2s;
        outline: none;
        -webkit-appearance: none;
        appearance: none;
        line-height: 1.6;
        touch-action: manipulation;
        box-sizing: border-box; /* ← NEW */
    }

        .field input:focus,
        .field select:focus,
        .field textarea:focus {
            border-color: var(--red);
            box-shadow: 0 0 0 3px rgba(192,32,42,0.08);
        }

        .field input.error,
        .field select.error,
        .field textarea.error {
            border-color: #e74c3c;
        }

.field-error {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 3px;
    display: none;
}

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

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

.field select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Inline table inputs (employment table) */
table input[type="text"],
table textarea {
    font-size: 14px;
    -webkit-appearance: none;
}

/* ── Radio & Checkbox ── */
.radio-group, .check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.radio-item, .check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--gray-700);
    user-select: none;
    background: var(--white);
    transition: all 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

    .radio-item:hover, .check-item:hover {
        border-color: var(--red-mid);
        background: var(--red-light);
    }

    .radio-item input, .check-item input {
        accent-color: var(--red);
        width: 16px;
        height: 16px;
        cursor: pointer;
        flex-shrink: 0;
    }

    .radio-item.selected, .check-item.selected {
        border-color: var(--red);
        background: var(--red-light);
        color: var(--red-dark);
        font-weight: 500;
    }

@media (max-width: 480px) {
    .check-group {
        gap: 6px;
    }

    .check-item, .radio-item {
        padding: 10px 12px;
        font-size: 13px;
        width: 100%;
    }
}

/* ── Yes/No Toggle ── */
.yes-no {
    display: flex;
    gap: 10px;
    max-width: 100%;
}

.yn-btn {
    flex: 1;
    padding: 11px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    background: var(--white);
    transition: all 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px; /* iOS touch target */
}

    .yn-btn:hover {
        border-color: var(--red-mid);
    }

    .yn-btn.selected {
        border-color: var(--red);
        background: var(--red-light);
        color: var(--red-dark);
    }

/* ── Divider ── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1.25rem 0;
}

/* ── Bank Row ── */
.bank-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}

.btn-delete {
    background: #fff5f5;
    color: var(--red);
    border: 1px solid var(--red-mid);
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s;
    text-align: center;
    width: 100%;
    touch-action: manipulation;
}

    .btn-delete:hover {
        background: var(--red);
        color: white;
    }

@media (max-width: 640px) {
    .bank-header-labels {
        display: none !important;
    }

    .bank-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        background: #fafafa !important;
        padding: 14px !important;
        margin-bottom: 14px !important;
        border-radius: 8px !important;
        border: 1px solid var(--gray-300) !important;
    }

        .bank-row .field {
            width: 100% !important;
        }

        .bank-row .btn-delete {
            padding: 12px !important;
            font-size: 13px !important;
        }
}


/* ─────────────────────────────────────────
   Employment Table → Mobile Card Layout
   ───────────────────────────────────────── */
@media (max-width: 640px) {

    .table-scroll {
        overflow-x: visible !important;
    }

        .table-scroll table,
        .table-scroll tbody,
        .table-scroll tr,
        .table-scroll td,
        .table-scroll th {
            display: block;
            width: 100%;
        }

        .table-scroll table {
            min-width: 100% !important;
            border: none;
        }

        .table-scroll thead {
            display: none;
        }

        .table-scroll tr {
            margin-bottom: 14px;
            background: #fafafa;
            border: 1px solid var(--gray-300);
            border-radius: 8px;
            overflow: hidden;
        }

        .table-scroll td {
            border: none !important;
            border-bottom: 1px solid var(--border) !important;
            padding: 12px !important;
            width: 100% !important;
            display: flex;
            flex-direction: column;
        }

            .table-scroll td:last-child {
                border-bottom: none !important;
            }

            /* Section titles */
            .table-scroll td[rowspan] {
                background: var(--navy) !important;
                color: white !important;
                font-weight: 600;
                font-size: 13px;
            }

        /* Inputs */
        .table-scroll input,
        .table-scroll textarea {
            width: 100% !important;
            font-size: 14px;
        }
}







/* ── Yes/No — full width on mobile ── */
@media (max-width: 480px) {
    .yes-no {
        max-width: 100% !important;
    }

    .yn-btn {
        font-size: 15px;
    }
}

/* ── Info & Legal Boxes ── */
.info-box {
    background: var(--red-light);
    border-left: 3px solid var(--red);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--navy);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.legal-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.8;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 1rem 1.1rem;
    margin-top: 1rem;
    border: 1px solid var(--gray-100);
    max-height: 220px;
    overflow-y: auto;
    text-align: justify;
    -webkit-overflow-scrolling: touch;
}

    .legal-text::-webkit-scrollbar {
        width: 4px;
    }

    .legal-text::-webkit-scrollbar-thumb {
        background: var(--gray-300);
        border-radius: 2px;
    }

/* ── Signature Box ── */
.sig-box {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s;
    position: relative;
    overflow: hidden;
    touch-action: none; /* essential for finger drawing */
    -webkit-tap-highlight-color: transparent;
}

    .sig-box:hover {
        border-color: var(--red);
    }

canvas {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

@media (max-width: 480px) {
    .sig-box {
        height: 130px;
    }
}

/* ── Navigation Buttons ── */
.form-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0 0.5rem;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: 'Noto Sans Sinhala', 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    letter-spacing: 0.02em;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--gray-700);
}

    .btn-outline:hover {
        border-color: var(--gray-500);
        color: var(--text);
    }

.btn-primary {
    background: var(--red);
    color: white;
    box-shadow: 0 2px 8px rgba(192,32,42,0.25);
}

    .btn-primary:hover {
        background: var(--red-dark);
    }

    .btn-primary:active {
        transform: scale(0.98);
    }

.btn-download {
    background: var(--navy);
    color: white;
    padding: 13px 28px;
    font-size: 15px;
}

    .btn-download:hover {
        background: var(--navy-light);
    }

    .btn-download:active {
        transform: scale(0.98);
    }

@media (max-width: 480px) {
    .form-nav {
        flex-direction: column-reverse;
        gap: 10px;
    }

        .form-nav .btn {
            width: 100%;
            font-size: 15px;
            padding: 14px;
        }

        .form-nav span {
            display: none;
        }
    /* hide empty spacer on mobile */
}

/* ── Screen title ── */
.screen-title p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

/* ── Misc ── */
.note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ── Settlement instruction inline layout — mobile ── */
@media (max-width: 480px) {
    div[style*="display: flex"][style*="align-items: center"][style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
}

/* ── Inline table inputs (employment) ── */
@media (max-width: 480px) {
    div[style*="overflow-x:auto"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* ── Signature Upload Section ── */
.sig-upload-section {
    margin-top: 18px;
    padding: 14px;
    background: var(--gray-50);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    min-height: 150px;
}

    .sig-upload-section .sig-upload-label {
        display: block;
        font-size: 12px;
        font-weight: 600;
        color: var(--gray-700);
        margin-bottom: 8px;
    }

    .sig-upload-section input[type="file"] {
        display: none;
    }

.sig-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    transition: all 0.2s;
    touch-action: manipulation;
}

    .sig-upload-btn:hover {
        border-color: var(--red-mid);
        background: var(--red-light);
        color: var(--red-dark);
    }

.sig-preview-wrap {
    position: relative;
    display: inline-block;
    max-width: 180px;
    margin-top: 4px;
}

.sig-preview-img {
    display: block;
    width: 160px;
    max-height: 90px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.sig-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: #c00;
    color: #fff;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
}

.sig-toggle-wrap {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
    user-select: none;
}

    .sig-toggle-wrap input[type=checkbox] {
        accent-color: var(--red);
        width: 16px;
        height: 16px;
        cursor: pointer;
        flex-shrink: 0;
    }

/* ── Validation error for signature ── */
.sig-error {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 4px;
    display: none;
}

    .sig-error.show {
        display: block;
    }

/* ── Table input focus highlight (issue 1 fix) ── */
table input[type="text"]:focus,
table textarea:focus {
    outline: 2px solid var(--red);
    outline-offset: 1px;
    border-radius: 3px;
    background: #fffbfb !important;
}

/* ── Mobile auto-scroll hint for tables ── */
.table-scroll-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: none;
}

@media (max-width: 640px) {
    .table-scroll-hint {
        display: block;
    }
}
