:root {
            --surface: #fff;
            --text: #111827;
            --sub: #6b7280;
            --primary: #551fbd;
            --border: #e5e7eb;
            --shadow: 0 18px 45px rgba(88, 28, 135, .12);
        }

        body {
            margin: 0;
            background: #fff;
            color: var(--text);
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        main {
            max-width: 1050px;
            margin: 20px auto 40px;
            padding: 0 16px
        }

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

        .pad {
            padding: 18px 18px 26px
        }

        h1 {
            margin: 0 0 12px;
            color: var(--primary);
            font-size: 26px;
            font-weight: 900
        }

        h2 {
            margin: 18px 0 10px;
            color: var(--primary);
            font-size: 16px;
            font-weight: 800
        }

        label {
            font-size: 13px;
            color: var(--sub)
        }

        input,
        select,
        textarea {
            width: 100%;
            padding: 11px;
            border: 1px solid var(--border);
            border-radius: 12px;
            background: #f9fafb;
            box-sizing: border-box
        }

        .row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px
        }

        @media(max-width:700px) {
            .row {
                grid-template-columns: 1fr
            }
        }

        .btn {
            border: 1px solid var(--primary);
            background: var(--primary);
            color: #fff;
            border-radius: 999px;
            padding: 11px 20px;
            font-weight: 800;
            cursor: pointer;
            display: inline-flex;
            gap: 10px;
            align-items: center
        }

        .btn.outline {
            background: #fff;
            color: var(--primary)
        }

        .help {
            font-size: 12px;
            color: #9aa1a9;
            margin-top: 4px
        }

        .error {
            background: #feecec;
            border: 1px solid #f5b3b3;
            color: #7a1f1f;
            border-radius: 12px;
            padding: 12px;
            margin-bottom: 12px
        }

        .ok {
            background: #eafff0;
            border: 1px solid #86efac;
            color: #166534;
            border-radius: 12px;
            padding: 12px;
            margin-bottom: 12px
        }

        /* phone inline like screenshot */
        .phone-inline {
            display: grid;
            grid-template-columns: 180px 1fr;
            gap: 8px;
            align-items: center
        }

        .phone-inline {
            grid-template-columns: 160px 1fr;
        }

        @media(max-width: 400px) {
            .phone-inline {
                grid-template-columns: 1fr;
            }
        }


        .terms {
            display: flex;
            gap: 10px;
            align-items: flex-start;
            margin-top: 10px;
            padding: 12px;
            border-radius: 14px;
            border: 1px solid #ddd6fe;
            background: linear-gradient(135deg, #f3e8ff, #e0faff)
        }

        .terms input {
            width: auto;
            margin-top: 3px
        }

        .seg {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 8px
        }

        .pill {
            display: inline-flex;
            gap: 8px;
            align-items: center;
            padding: 10px 12px;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: #f9fafb;
            font-weight: 800
        }

        .pill input {
            width: auto
        }

        .sig-wrap {
            border: 1px dashed #c4b5fd;
            border-radius: 14px;
            background: #fff;
            padding: 12px
        }

        canvas {
            width: 100%;
            height: 180px;
            border-radius: 12px;
            background: #f9fafb;
            border: 1px solid var(--border);
            touch-action: none
        }

        /* =======================
       TOAST NOTIFICATIONS
       ======================= */
        .toast-wrap {
            position: fixed;
            right: 18px;
            bottom: 18px;
            z-index: 9999;
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: none;
        }

        .toast-item {
            pointer-events: auto;
            min-width: 260px;
            max-width: 360px;
            padding: 12px 14px;
            border-radius: 14px;
            color: #fff;
            box-shadow: 0 14px 40px rgba(2, 6, 23, .22);
            transform: translateY(6px);
            opacity: 0;
            transition: opacity .25s ease, transform .25s ease;
            font-size: 14px;
            font-weight: 700
        }

        .toast-item.show {
            opacity: 1;
            transform: translateY(0)
        }

        .toast-success {
            background: #16a34a
        }

        .toast-error {
            background: #dc2626
        }

        .toast-info {
            background: #551fbd
        }

        .toast-close {
            float: right;
            cursor: pointer;
            font-weight: 900;
            margin-left: 10px;
            opacity: .9
        }

        /* =======================
       OTP POPUP (same style as create page)
       ======================= */
        .popup-overlay {
            position: fixed;
            inset: 0;
            background: color-mix(in srgb, var(--primary) 45%, transparent);
            backdrop-filter: blur(6px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 5000;
        }

        .popup-box {
            background: var(--surface);
            padding: 28px 26px;
            width: 92%;
            max-width: 430px;
            border-radius: 18px;
            border: 1px solid var(--border);
            box-shadow: var(--shadow);
            text-align: center;
            animation: popupFade .25s ease;
        }

        .popup-box h2 {
            margin: 0 0 10px;
            font-size: 20px;
            color: var(--primary);
            font-weight: 900
        }

        .popup-box p {
            font-size: 14px;
            color: var(--sub);
            margin: 0 0 18px
        }

        .popup-buttons {
            display: flex;
            gap: 12px;
            justify-content: center
        }

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

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

        body.popup-open .card {
            pointer-events: none;
            opacity: .9
        }

        .terms {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 14px;
            flex-wrap: wrap;
            /* allow wrapping naturally */
        }

        .terms-left {
            display: flex;
            gap: 10px;
            align-items: flex-start;
            min-width: 240px;
            /* prevents crush */
            flex: 1 1 320px;
        }

        .terms-text {
            color: var(--text);
            flex: 1;
        }

        .terms-right {
            flex: 0 0 auto;
            display: flex;
            align-items: center;
        }

        .terms-link {
            font-weight: 800;
            color: var(--primary);
            text-decoration: none;
            white-space: nowrap;
            display: inline-flex;
            gap: 8px;
            align-items: center;
        }

        /* ✅ Mobile: put link UNDER checkbox text */
        @media (max-width: 520px) {
            .terms {
                flex-direction: column;
                align-items: flex-start;
            }

            .terms-right {
                width: 100%;
                padding-left: 34px;
                /* aligns under text (checkbox width + gap) */
            }

            .terms-link {
                white-space: normal;
            }
        }

        /* FIX: stop the terms card from stretching vertically */
        .terms {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 14px;
            flex-wrap: wrap;
            height: auto !important;
            min-height: unset !important;
        }

        /* FIX: don't let left side stretch */
        .terms-left {
            display: flex;
            gap: 10px;
            align-items: flex-start;
            flex: 1 1 auto;
        }

        /* FIX: right side should sit just under, not at bottom */
        .terms-right {
            flex: 0 0 auto;
            margin: 6px 0 0 34px;
            /* aligns under text, small spacing */
            width: 100%;
        }

        /* Desktop: keep it on the right */
        @media (min-width: 521px) {
            .terms-right {
                width: auto;
                margin: 0;
                /* no weird spacing */
                align-self: flex-start;
            }
        }

        /* Global sanity */
        * {
            box-sizing: border-box;
        }

        html,
        body {
            width: 100%;
            overflow-x: hidden;
        }

        /* Mobile spacing improvements */
        @media (max-width: 520px) {
            main {
                margin: 10px auto 20px;
                padding: 0 10px;
            }

            .pad {
                padding: 14px 12px 18px;
            }

            h1 {
                font-size: 22px;
            }

            input,
            select,
            textarea {
                padding: 10px;
            }
        }

        /* Give space at bottom so floating buttons don't cover form */
        main {
            padding-bottom: 120px;
        }

        /* On small screens move floating buttons away from form */
        @media (max-width: 520px) {
            .toast-wrap {
                right: 10px;
                bottom: 10px;
            }

            /* If your whatsapp/chat are fixed-position, this reduces overlap */
            .whatsapp-float,
            .chat-float,
            .floating-chat,
            .wa-float {
                transform: scale(0.9);
                bottom: 14px !important;
                right: 14px !important;
            }
        }

        /* Better looking select (ONLY the closed control, not the opened list) */
        select {
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            background: #f9fafb;
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 11px 42px 11px 11px;
            /* room for arrow */
            font-weight: 600;
            cursor: pointer;
            background-image:
                linear-gradient(45deg, transparent 50%, #6b7280 50%),
                linear-gradient(135deg, #6b7280 50%, transparent 50%),
                linear-gradient(to right, transparent, transparent);
            background-position:
                calc(100% - 20px) 50%,
                calc(100% - 14px) 50%,
                calc(100% - 42px) 50%;
            background-size: 6px 6px, 6px 6px, 1px 22px;
            background-repeat: no-repeat;
        }

        select:focus {
            outline: none;
            border-color: #c4b5fd;
            box-shadow: 0 0 0 4px rgba(196, 181, 253, .35);
        }

        /* Skeleton Loader Styles */.skeleton {
  border-radius: 8px;
}
.skeleton-card { height: 600px; width: 100%; border-radius: 18px; margin-bottom: 20px; }

        /* Hide real content initially */
        .content-hidden { 
            display: none !important; 
            opacity: 0; 
        }
        .content-reveal { 
            display: block !important; 
            animation: fadeIn 0.4s ease forwards; 
        }
        @keyframes fadeIn { 
            from { opacity: 0; transform: translateY(5px); } 
            to { opacity: 1; transform: translateY(0); } 
        }
