* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #0b0614;
    --bg-2: #14092a;
    --surface: #1c1132;
    --surface-2: #241742;
    --border: rgba(139, 92, 246, 0.22);
    --border-2: rgba(255, 77, 109, 0.22);
    --text: #f8f5ff;
    --muted: rgba(248, 245, 255, 0.58);
    --accent: #a855f7;
    --accent-2: #ff4d6d;
    --gold: #ffd60a;
    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    overflow: hidden;
}

body {
    background:
        radial-gradient(1200px 600px at -10% -20%, rgba(168, 85, 247, 0.18), transparent 60%),
        radial-gradient(1000px 500px at 120% 110%, rgba(255, 77, 109, 0.18), transparent 60%),
        linear-gradient(160deg, #0b0614 0%, #14092a 100%);
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ============ HEADER ============ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(20, 9, 42, 0.9), rgba(20, 9, 42, 0.6));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    font-size: 34px;
    filter: drop-shadow(0 0 12px rgba(255, 214, 10, 0.45));
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

.logo h1 {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, var(--gold), var(--accent-2), var(--accent));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.logo p {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 1px;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============ BOTÕES ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(90deg, #a855f7 0%, #ff4d6d 100%);
    color: #fff;
    border: none;
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.55);
}

.btn-secondary {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #d8b4fe;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
}
.btn-ghost:hover { color: var(--text); border-color: rgba(139, 92, 246, 0.5); }

.btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 10px; }
.btn-lg { padding: 14px 20px; font-size: 14px; border-radius: 14px; }

/* ============ MAIN ============ */
.app-main {
    display: grid;
    grid-template-columns: 480px 1fr;
    flex: 1;
    min-height: 0;
}

/* ============ PAINÉIS ============ */
.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.panel-form {
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(28, 17, 50, 0.5), rgba(20, 9, 42, 0.9));
}

.panel-preview {
    background:
        radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.08), transparent 60%),
        rgba(10, 5, 20, 0.5);
}

.panel-header {
    padding: 18px 22px 10px;
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.panel-hint {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.5px;
}

.panel-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 0 22px 10px;
    flex-shrink: 0;
}

.tab-btn {
    padding: 10px 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    letter-spacing: 0.3px;
}

.tab-btn:hover {
    color: var(--text);
    border-color: rgba(139, 92, 246, 0.5);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(255, 77, 109, 0.22));
    border-color: rgba(168, 85, 247, 0.5);
    color: #fff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.25);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 22px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.4) transparent;
}

.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.3); border-radius: 10px; }

/* 🔥 FORÇA NUCLEAR! Regras com !important para competir com style.setProperty inline de força */
.tab-content { display: none !important; padding-top: 8px; opacity: 0 !important; visibility: hidden !important; height: 0 !important; overflow: hidden !important; position: absolute !important; top: -99999px !important; left: -99999px !important; pointer-events: none !important; }
.tab-content.active { display: block !important; opacity: 1 !important; visibility: visible !important; height: auto !important; overflow: visible !important; position: static !important; top: auto !important; left: auto !important; pointer-events: auto !important; }

/* ============ FORM ============ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 7px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(248, 245, 255, 0.3);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.12);
    background: rgba(168, 85, 247, 0.06);
}

.form-group textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.6;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a855f7' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

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

/* ============ TYPE CARDS ============ */
.type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.type-card {
    padding: 14px 8px 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.type-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0), rgba(255, 77, 109, 0));
    transition: all 0.3s;
    opacity: 0;
}

.type-card:hover {
    transform: translateY(-3px);
    border-color: rgba(168, 85, 247, 0.5);
}

.type-card:hover::before {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(255, 77, 109, 0.08));
    opacity: 1;
}

.type-card.active {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(255, 77, 109, 0.18));
    box-shadow: 0 10px 28px rgba(168, 85, 247, 0.35);
    transform: translateY(-2px);
}

.type-card.active::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

.type-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
    margin-bottom: 2px;
    transition: transform 0.25s;
}

.type-card:hover .type-icon { transform: scale(1.12); }

.type-name {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-align: center;
    line-height: 1.2;
}

.type-desc {
    font-size: 9.5px;
    color: var(--muted);
    letter-spacing: 0.3px;
    text-align: center;
    line-height: 1.3;
    font-weight: 600;
}

@media (max-width: 520px) {
    .type-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Celulares MUITO PEQUENOS (iPhone SE, A54 etc. ≤430px) → 1 COLUNA SÓ para apertar MENOS! ===== */
@media (max-width: 430px) {
    .type-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    .type-card {
        padding: 14px 14px 12px;
        flex-direction: row;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 12px;
        min-height: 84px;
    }
    .type-card .type-icon {
        width: 42px;
        height: 42px;
        font-size: 24px;
        flex-shrink: 0;
        display: grid;
        place-items: center;
        margin-bottom: 0 !important;
    }
    .type-card > span:not(.type-icon),
    .type-card .type-name,
    .type-card .type-desc {
        text-align: left !important;
        display: block !important;
    }
    .type-card.active::after {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
    .mode-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    .mode-card {
        padding: 12px 12px 10px;
        min-height: 92px;
        flex-direction: row;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 12px;
    }
    .mode-card .mode-icon {
        width: 40px; height: 40px;
        font-size: 22px;
        flex-shrink: 0;
        display: grid;
        place-items: center;
    }
    .form-grid { grid-template-columns: 1fr !important; }
    .panel-body { padding: 6px 14px 20px; }
    .preview-header { padding: 10px 14px 6px; }
    .preview-viewport { padding: 6px 12px 14px; }
    .preview-viewport iframe {
        max-width: 320px;
        aspect-ratio: 390 / 760;
        max-height: 58vh;
        border-radius: 30px;
    }
}

/* ============ MODO CARDS (Convite / Declaração) ============ */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.mode-card {
    padding: 14px 10px 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    color: var(--text);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.mode-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(168,85,247,0), rgba(255,77,109,0));
    transition: all 0.3s;
    opacity: 0;
}
.mode-card:hover::before {
    background: linear-gradient(135deg, rgba(168,85,247,0.12), rgba(255,77,109,0.08));
    opacity: 1;
}
.mode-card:hover { transform: translateY(-2px); border-color: rgba(168,85,247,0.5); }
.mode-card:active { transform: translateY(0) scale(0.98); }
.mode-card > * { position: relative; z-index: 1; }

.mode-card.active {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(168,85,247,0.22), rgba(255,77,109,0.18));
    box-shadow: 0 10px 28px rgba(168,85,247,0.35);
    transform: translateY(-2px);
}
.mode-card.active::after {
    content: '✓';
    position: absolute;
    top: 6px; right: 6px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(16,185,129,0.4);
}
.mode-icon { font-size: 30px; filter: drop-shadow(0 0 8px rgba(168,85,247,0.4)); margin-bottom: 2px; }
.mode-card:hover .mode-icon { transform: scale(1.12); }
.mode-name { font-size: 13px; font-weight: 800; letter-spacing: 0.3px; line-height: 1.2; }
.mode-desc { font-size: 10px; color: var(--muted); line-height: 1.35; font-weight: 600; }

/* ============ TIMELINE INPUTS ============ */
.tl-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
.tl-row input { padding: 10px 12px; }

/* info-row: onde inputs de info-cards */
.info-row .tl-row input:first-child {
    text-align: center;
    font-size: 18px;
    width: 100%;
}

.date-inputs input[type="date"],
.video-inputs input { width: 100%; }

@media (max-width: 520px) {
    .mode-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .mode-card { padding: 12px 6px 10px; min-height: 100px; }
    .mode-name { font-size: 11.5px; }
    .mode-desc { font-size: 9.5px; }
    .tl-row { grid-template-columns: 1fr; gap: 6px; margin-bottom: 10px; }
    .info-row .tl-row input:first-child {
        max-width: 72px;
        margin: 0 auto;
    }
}

.mt-sm { margin-top: 8px !important; }

/* ============ FOTO UPLOAD (9 CAIXAS) ============ */
.photo-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.photo-box {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    background: var(--input-bg);
    border: 1.5px dashed var(--border);
    overflow: hidden;
    transition: all 0.22s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6px;
}
.photo-box:hover {
    border-color: var(--primary);
    background: rgba(255, 77, 109, 0.05);
    transform: translateY(-1px);
}
.photo-box.has-photo {
    border-style: solid;
    border-color: rgba(255, 77, 109, 0.35);
    background: #000;
}
.photo-box input[type="file"] {
    display: none;
}
.photo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    pointer-events: none;
}
.photo-empty .emoji { font-size: 26px; filter: drop-shadow(0 0 6px rgba(255, 77, 109, 0.35)); }
.photo-empty .txt {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.2px;
    line-height: 1.2;
    color: var(--muted);
}
.photo-empty .n {
    font-size: 10px;
    font-weight: 900;
    color: var(--primary);
    margin-top: 1px;
}
.photo-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 6px;
    gap: 4px;
}
.photo-box.has-photo:hover .photo-overlay { opacity: 1; }
.photo-overlay button {
    flex: 1;
    min-height: 26px;
    border: none;
    border-radius: 8px;
    padding: 4px 5px;
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
    color: #fff;
    font-family: inherit;
    background: rgba(255,255,255,0.14);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.18s ease;
}
.photo-overlay button:hover {
    background: rgba(255, 77, 109, 0.6);
    transform: translateY(-1px);
}
.photo-overlay button.del:hover {
    background: rgba(255, 59, 48, 0.7);
}
.photo-url-input {
    position: absolute;
    inset: auto 4px 4px 4px;
    display: none;
    padding: 5px 7px !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
    min-height: auto !important;
    height: 28px !important;
    border-radius: 8px !important;
    background: rgba(0,0,0,0.75) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: #fff0f3 !important;
    z-index: 3;
}
.photo-box.has-photo .photo-url-input { display: none; }

@media (max-width: 780px) {
    .photo-upload-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .photo-overlay { opacity: 1; background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,0.75) 100%); }
}
@media (max-width: 420px) {
    .photo-empty .txt { font-size: 9px; }
    .photo-empty .emoji { font-size: 22px; }
}

/* ============ VIDEO UPLOAD BOX ============ */
.video-box {
    position: relative;
    border-radius: 14px;
    background: var(--input-bg);
    border: 1.5px dashed var(--border);
    padding: 10px;
    transition: all 0.22s ease;
}
.video-box.has-video {
    border-style: solid;
    border-color: rgba(168,85,247,0.45);
    background: linear-gradient(135deg, rgba(168,85,247,0.05), rgba(255, 77, 109, 0.04));
}
.video-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.video-n {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.3px;
    color: var(--primary);
}
.video-size {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}
.video-size.warn {
    color: #ff9f0a;
    background: rgba(255, 159, 10, 0.1);
    border-color: rgba(255, 159, 10, 0.3);
}
.video-size.bad {
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.1);
    border-color: rgba(255, 59, 48, 0.35);
}
.video-empty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 2px 2px;
}
.video-empty-txt {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted);
    line-height: 1.3;
    flex: 1;
}
.video-empty-txt b { color: var(--creme); font-weight: 800; }
.video-btn {
    min-height: 38px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: #fff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 77, 109, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}
.video-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 77, 109, 0.35); }
.video-btn:active { transform: scale(0.96); }
.video-btn.ghost {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--creme);
    box-shadow: none;
    font-weight: 800;
}
.video-btn.del {
    background: rgba(255, 59, 48, 0.15);
    color: #ff7a70;
    border: 1px solid rgba(255, 59, 48, 0.3);
    box-shadow: none;
    min-height: 34px;
    padding: 7px 10px;
    font-size: 10.5px;
}
.video-preview {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
    background: #000;
    border: 1px solid rgba(255,255,255,0.08);
    aspect-ratio: 16 / 9;
}
.video-preview video,
.video-preview iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}
.video-url-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.video-url-row input[type="text"] {
    flex: 1;
    font-size: 11px;
    padding: 9px 11px !important;
    min-height: 38px;
    height: 38px;
}
.video-actions-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.video-actions-row .video-btn { flex: 1; }

.divider-small {
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--muted);
    margin: 18px 0 14px;
    position: relative;
}
.divider-small::before, .divider-small::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 70px);
    height: 1px;
    background: var(--border);
}
.divider-small::before { left: 0; }
.divider-small::after { right: 0; }

/* ============ THEMES PRESETS ============ */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.theme-preset {
    padding: 10px 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    color: var(--muted);
}

.theme-preset:hover {
    border-color: rgba(168, 85, 247, 0.5);
    transform: translateY(-2px);
    color: var(--text);
}

.theme-preset.active {
    border-color: var(--accent);
    background: rgba(168, 85, 247, 0.1);
    color: #fff;
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.3);
}

.swatch {
    width: 100%;
    height: 32px;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.theme-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ============ COLORS ============ */
.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-row input[type="color"] {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
}

.color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.color-row input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }

.color-hex {
    flex: 1;
    padding: 10px 12px !important;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ============ EMOJI & CHIPS ============ */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.emoji-btn {
    aspect-ratio: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.emoji-btn:hover {
    transform: scale(1.08);
    border-color: rgba(168, 85, 247, 0.5);
}

.emoji-btn.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(255, 77, 109, 0.3));
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.35);
}

.chip-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.chip {
    padding: 9px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    transition: all 0.15s;
    font-family: inherit;
    text-align: center;
}

.chip:hover { color: var(--text); border-color: rgba(255, 214, 10, 0.4); }
.chip.active {
    background: rgba(255, 214, 10, 0.12);
    border-color: rgba(255, 214, 10, 0.5);
    color: var(--gold);
    box-shadow: 0 4px 15px rgba(255, 214, 10, 0.15);
}

/* ============ SWITCH ============ */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.form-row label:first-child {
    margin-bottom: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: none;
}

.switch {
    position: relative;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: 0.3s;
}

.slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: var(--muted);
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked + .slider {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-color: transparent;
}

.switch input:checked + .slider::before {
    transform: translate(20px, -50%);
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ============ PANEL FOOTER / URL BOX ============ */
.panel-footer {
    border-top: 1px solid var(--border);
    padding: 14px 22px 18px;
    flex-shrink: 0;
    background: linear-gradient(0deg, rgba(20, 9, 42, 0.95), rgba(20, 9, 42, 0.6));
}

.url-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 12px;
}

.url-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 8px;
}

.url-row {
    display: flex;
    gap: 8px;
}

.url-row input {
    flex: 1;
    padding: 10px 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
    font-size: 11px;
    font-family: ui-monospace, Menlo, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    outline: none;
}

.btn-row {
    display: flex;
    gap: 10px;
}

.btn-row .btn { flex: 1; }

/* ============ PREVIEW ============ */
.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px 10px;
    flex-shrink: 0;
}

.preview-tabs {
    display: flex;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 12px;
}

.pv-tab {
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: var(--muted);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.pv-tab:hover { color: var(--text); }

.pv-tab.active {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.3), rgba(255, 77, 109, 0.3));
    color: #fff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.25);
}

.badge-preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #d8b4fe;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50px;
    letter-spacing: 0.5px;
}

.preview-viewport {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 28px 28px;
    overflow: hidden;
}

.preview-viewport iframe {
    width: 100%;
    max-width: 430px;
    height: 100%;
    max-height: calc(100vh - 180px);
    aspect-ratio: 390 / 844;
    border: 2px solid rgba(139, 92, 246, 0.35);
    border-radius: 40px;
    background: #000;
    box-shadow:
        0 0 0 8px rgba(0, 0, 0, 0.5),
        0 30px 70px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(168, 85, 247, 0.15);
    overflow: hidden;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
    .app-main { grid-template-columns: 1fr; overflow-y: auto; }
    .panel-form { border-right: none; border-bottom: 1px solid var(--border); max-height: 60vh; }
    .panel-preview { min-height: 700px; }
    html, body { overflow: auto; }
}

@media (max-width: 780px) {
    html, body { overflow: auto; }
    body { touch-action: manipulation; }
    .app { height: auto; min-height: 100vh; width: 100vw; }

    /* Header compacto mobile */
    .app-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 14px;
        align-items: stretch;
    }
    .logo { justify-content: center; }
    .header-actions { justify-content: center; }
    .header-actions .btn { flex: 1; min-height: 44px; }

    /* No mobile: preview VEM PRIMEIRO (cima), formulário DEPOIS (baixo) */
    .app-main {
        display: flex;
        flex-direction: column-reverse;
        min-height: auto;
    }

    /* Preview mobile (cima): iframe quadrado menor, sem moldura grande */
    .panel-preview { min-height: unset; }
    .preview-header {
        padding: 12px 14px 6px;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    .preview-viewport {
        padding: 6px 12px 16px;
    }
    .preview-viewport iframe {
        max-width: 380px;
        width: 100%;
        aspect-ratio: 390 / 780;
        max-height: 62vh;
        border-width: 2px;
        border-radius: 32px;
        box-shadow:
            0 0 0 5px rgba(0,0,0,0.5),
            0 18px 45px rgba(0,0,0,0.65),
            0 0 40px rgba(168,85,247,0.12);
    }

    /* Form (baixo): largura total, scroll só no conteúdo */
    .panel-form {
        border-right: none;
        border-bottom: none;
        border-top: 1px solid var(--border);
        max-height: none;
    }
    .panel-header { padding: 14px 14px 8px; text-align: center; }
    .panel-header h2 { font-size: 15px; }
    .panel-tabs {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 14px 8px;
        gap: 6px;
    }
    .tab-btn {
        min-height: 44px;
        padding: 8px 4px;
        font-size: 12px;
    }
    .panel-body { padding: 6px 14px 16px; }

    /* Formulários: targets mínimos de 44px (Apple HIG) */
    .form-group input[type="text"],
    .form-group input[type="date"],
    .form-group input[type="time"],
    .form-group input[type="email"],
    .form-group textarea,
    .form-group select {
        min-height: 44px;
        padding: 12px 14px;
        font-size: 15px; /* 16px evita zoom no iOS */
    }
    .form-group textarea { min-height: 110px; }
    .form-group label { font-size: 10.5px; margin-bottom: 6px; }

    /* Buttons sempre altura mínima */
    .btn { min-height: 44px; padding: 10px 14px; }
    .btn-primary { min-height: 46px; }

    /* Tipo de convite: 2 colunas no mobile */
    .type-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .type-card { padding: 14px 8px 12px; min-height: 108px; }
    .type-name { font-size: 12.5px; }
    .type-desc { font-size: 10px; }

    /* Temas: 3 colunas */
    .theme-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .theme-preset { padding: 8px 5px; min-height: 82px; }
    .swatch { height: 30px; }
    .theme-label { font-size: 9.5px; }

    /* Cores: 2 colunas */
    .color-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .color-row input[type="color"] { width: 48px; height: 48px; }
    .color-hex { min-height: 44px !important; font-size: 12px !important; }

    /* Chips: 2 colunas */
    .chip-grid { grid-template-columns: repeat(2, 1fr); }
    .chip { min-height: 40px; font-size: 12px; }

    /* Emojis: 6 colunas */
    .emoji-grid { grid-template-columns: repeat(6, 1fr); gap: 6px; }
    .emoji-btn { font-size: 22px; min-height: 40px; }

    /* Footer */
    .panel-footer { padding: 12px 14px 16px; }
    .url-box { padding: 10px; }
    .url-row { flex-direction: column; }
    .url-row input { min-height: 40px; font-size: 11px; }
    .btn-row { flex-wrap: wrap; gap: 8px; }
    .btn-row .btn { flex: 1 1 45%; min-width: 0; font-size: 12px; }

    /* Switch: tamanho maior no mobile */
    .switch { width: 52px; height: 30px; }
    .slider::before { width: 22px; height: 22px; left: 3px; }
    .switch input:checked + .slider::before { transform: translate(23px, -50%); }

    /* Diminuir espaçamento interno dos grupos */
    .form-group { margin-bottom: 14px; }
    .divider-small { margin: 14px 0 12px; }
    .divider-small::before, .divider-small::after { width: calc(50% - 72px); }
}

@media (max-width: 420px) {
    .emoji-grid { grid-template-columns: repeat(5, 1fr); }
    .type-grid { grid-template-columns: repeat(2, 1fr); }
    .color-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; gap: 10px; }
    .btn-row .btn { flex: 1 1 100%; }
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 20px;
    background: linear-gradient(90deg, #10b981, #059669);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 999999;
    letter-spacing: 0.5px;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.error {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
}
