* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1220;
    color: #e8eaf2;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}
a { color: #a5b4fc; }
.wrap {
    max-width: 720px;
    margin: 40px auto;
    padding: 32px;
    background: #181b2e;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
h1 { margin-top: 0; font-size: 28px; }
h2 { font-size: 18px; border-bottom: 1px solid #2a2e48; padding-bottom: 8px; margin-top: 28px; }
label {
    display: block;
    margin: 14px 0 6px;
    font-size: 12px;
    color: #a0a6c0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
input[type=text],
input[type=password],
input[type=email],
input[type=tel],
input[type=number],
textarea {
    width: 100%;
    padding: 12px 14px;
    background: #0f1220;
    color: #e8eaf2;
    border: 1px solid #2a2e48;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: #6366f1; }

/* Password show/hide toggle */
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 72px; }
.pwd-wrap .pwd-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: #2a2e48;
    color: #c7cbe0;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pwd-wrap .pwd-toggle:hover { background: #363b5c; color: #fff; }
.row { display: flex; gap: 12px; align-items: center; }
.row > input { flex: 1; }
.row label.toggle {
    display: flex; align-items: center; gap: 6px;
    margin: 0; text-transform: none; letter-spacing: 0;
    font-size: 13px; white-space: nowrap; color: #c7cbe0;
}
.btn {
    display: inline-block;
    padding: 11px 20px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
}
.btn:hover { background: #4f46e5; }
.btn.secondary { background: #2a2e48; color: #e8eaf2; }
.btn.secondary:hover { background: #363b5c; }
.btn.danger { background: #dc2626; }
.msg { padding: 12px 16px; border-radius: 8px; margin: 16px 0; }
.msg.err { background: #3a1020; color: #fca5a5; border: 1px solid #7f1d1d; }
.msg.ok  { background: #0a2e1c; color: #86efac; border: 1px solid #065f46; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; gap: 16px;
}
code {
    background: #0f1220;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}
table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #2a2e48; }
th { color: #a0a6c0; font-size: 12px; text-transform: uppercase; }
.qr-box { text-align: center; padding: 16px; background: white; border-radius: 8px; display: inline-block; }
.qr-box img, .qr-box canvas { display: block; }

/* Public profile card */
.public-card {
    max-width: 440px; margin: 40px auto; padding: 32px 28px;
    background: #181b2e; border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    text-align: center;
}
.public-card h1 { font-size: 26px; margin: 0 0 4px; }
.public-card .subtitle { color: #a0a6c0; margin-bottom: 24px; }
.contact-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
    width: 100%; padding: 14px;
    margin: 10px 0;
    background: #2a2e48; color: #e8eaf2;
    border-radius: 12px; text-decoration: none;
    font-size: 16px; font-weight: 600;
    transition: transform 0.1s, filter 0.1s;
}
.contact-btn:hover { filter: brightness(1.1); }
.contact-btn:active { transform: scale(0.98); }
.contact-btn.phone     { background: #059669; color: white; }
.contact-btn.whatsapp  { background: #25d366; color: #052e1a; }
.contact-btn.instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); color: white; }
.contact-btn.email     { background: #3b82f6; color: white; }
.contact-btn.telegram  { background: #0088cc; color: white; }
.contact-btn.facebook  { background: #1877f2; color: white; }
.message-box {
    background: #0f1220; padding: 16px; border-radius: 12px;
    margin: 16px 0; text-align: left; white-space: pre-wrap;
    border-left: 3px solid #6366f1;
    color: #d0d4e8;
}
.footer-note { margin-top: 32px; font-size: 12px; color: #5a6080; }

/* Master visibility toggle */
.visibility-toggle {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 20px; border-radius: 12px;
    margin-bottom: 8px; transition: background 0.2s;
}
.visibility-toggle.on  { background: #0a2e1c; border: 1px solid #065f46; }
.visibility-toggle.off { background: #3a1020; border: 1px solid #7f1d1d; }
.vis-label { font-size: 14px; color: #d0d4e8; }

/* iOS-style slider */
.switch { position: relative; display: inline-block; width: 52px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #4b5072; border-radius: 28px; transition: background 0.25s;
}
.slider::before {
    content: '';
    position: absolute; height: 22px; width: 22px;
    left: 3px; bottom: 3px;
    background: white; border-radius: 50%;
    transition: transform 0.25s;
}
.switch input:checked + .slider { background: #22c55e; }
.switch input:checked + .slider::before { transform: translateX(24px); }

/* Scrollable table wrapper for small screens */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ===== RESPONSIVE ===== */

/* Tablets and below (< 768px) */
@media (max-width: 768px) {
    .wrap {
        margin: 16px 10px;
        padding: 20px 16px;
        border-radius: 12px;
    }
    h1 { font-size: 22px; }
    h2 { font-size: 16px; }
    .topbar { flex-wrap: wrap; }
    .topbar h1 { font-size: 20px; }

    /* Stack field + toggle vertically */
    .row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .row > input { width: 100%; }
    .row label.toggle { justify-content: flex-start; }

    /* Visibility toggle */
    .visibility-toggle { flex-direction: column; align-items: flex-start; gap: 10px; }

    /* Public card */
    .public-card {
        margin: 16px 10px;
        padding: 24px 18px;
        border-radius: 16px;
    }
    .public-card h1 { font-size: 22px; }
    .contact-btn { padding: 16px; font-size: 15px; }

    /* Buttons — bigger tap targets on touch */
    .btn { padding: 12px 18px; font-size: 14px; min-height: 44px; }

    /* Message bar stacks on mobile */
    .msg { flex-direction: column !important; gap: 8px !important; }
}

/* Phones (< 480px) */
@media (max-width: 480px) {
    body { font-size: 14px; }
    .wrap {
        margin: 8px;
        padding: 16px 12px;
        border-radius: 10px;
    }
    h1 { font-size: 20px; }
    .topbar h1 { font-size: 18px; }

    code { font-size: 11px; word-break: break-all; }

    /* Public link URL can overflow */
    p { overflow-wrap: break-word; word-break: break-word; }

    .public-card {
        margin: 8px;
        padding: 20px 14px;
    }
    .contact-btn { padding: 14px; font-size: 14px; border-radius: 10px; }
}
