:root {
    --brand-blue: #1877f2;
    --brand-blue-dark: #145dbf;
    --surface: #ffffff;
    --app-bg: #f0f2f5;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --bottom-nav-height: 76px;
}

* { box-sizing: border-box; }
html { min-height: 100%; max-width: 100%; overflow-x: hidden; -webkit-text-size-adjust: 100%; }

/* Belső oldalak alapértelmezett szürke háttere */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background-color: var(--app-bg);
    color: #111;
    max-width: 100%;
    overflow-x: hidden;
}

h1 { font-size: clamp(1.65rem, 4.8vw, 2.5rem); line-height: 1.12; }
h2 { font-size: clamp(1.35rem, 4vw, 2rem); line-height: 1.16; }
h3 { font-size: clamp(1.08rem, 3vw, 1.35rem); line-height: 1.2; }

/* --- 🚀 LOGIN OLDAL MOZGÓ HÁTTEREI (Csak kint működnek) 🚀 --- */
.bg-creator {
    background: linear-gradient(-45deg, #141e30, #243b55, #000000, #434343) !important;
    background-size: 300% 300% !important;
    animation: gradientBG 6s ease infinite !important;
}
.bg-client {
    background: linear-gradient(-45deg, #00c6ff, #0072ff, #1877f2, #0a4b9e) !important;
    background-size: 300% 300% !important;
    animation: gradientBG 6s ease infinite !important;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- LOGIN KÁRTYA (A tejüveg itt megmarad) --- */
.login-container { 
    height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; 
    transition: background 0.5s ease-in-out; position: relative; overflow: hidden;
}
.login-card { 
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 40px; border-radius: 16px; box-shadow: 0 25px 50px rgba(0,0,0,0.25); 
    width: 100%; max-width: 420px; text-align: center; position: relative; z-index: 10;
    animation: cardEntrance 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; color: #111;
}
@keyframes cardEntrance {
    0% { opacity: 0; transform: translateY(40px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- BELSŐ OLDALAK KONTÉNERE --- */
.container {
    background: white; 
    border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%; 
    max-width: 1000px; 
    margin: 0 auto; 
    padding: 40px; 
    height: 100vh; 
    overflow-y: auto;
}

/* --- SZEREPKÖR VÁLASZTÓ --- */
.role-selector { display: flex; justify-content: space-between; background: #f0f2f5; border-radius: 8px; padding: 6px; margin-bottom: 20px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }
.role-selector input[type="radio"] { display: none; }
.role-selector label { flex: 1; text-align: center; padding: 10px 5px; cursor: pointer; border-radius: 6px; font-weight: bold; color: #666; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-size: 0.95rem; }
.role-selector input[type="radio"]:checked + label { background: #ffffff; color: #111; box-shadow: 0 4px 10px rgba(0,0,0,0.1); transform: scale(1.02); }

/* --- LAYOUT OSZLOPOK (Tervező és Szerkesztő) --- */
#preview-section { 
    width: 40%; background: #f0f2f5; padding: 30px; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; border-right: 1px solid #ddd; 
    position: fixed; height: 100%; left: 0; top: 0;
}
#preview-title { text-align: center; margin-bottom: 20px; color: #111; }
#form-section { width: 60%; padding: 30px; overflow-y: auto; margin-left: 40%; }
label { font-weight: bold; font-size: 0.9rem; color: inherit; }

/* Poszt dobozok */
.post-box { border: 1px solid #ddd; padding: 20px; margin-bottom: 20px; border-radius: 12px; background: white; position: relative; cursor: pointer; transition: all 0.2s; }
.post-box.active { border: 2px solid #1877f2 !important; background-color: #f7f9fa; box-shadow: 0 5px 15px rgba(24,119,242,0.15); }

/* --- ŰRLAP ELEMEK & GOMBOK --- */
input[type="text"], input[type="password"], input[type="email"], input[type="datetime-local"], input[type="file"], textarea, select { width: 100%; padding: 12px; margin-top: 5px; margin-bottom: 15px; border: 1px solid #ccc; border-radius: 8px; font-family: inherit; font-size: 1rem; transition: border-color 0.2s;}
input[type="file"] { background: white; }
input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus, input[type="datetime-local"]:focus, textarea:focus, select:focus { outline: none; border-color: #1877f2; box-shadow: 0 0 0 3px rgba(24,119,242,0.1); }
hr { border: 0; border-top: 1px solid #eee; margin: 20px 0;}
.btn { min-height: 44px; padding: 12px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; text-align: center; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; touch-action: manipulation; }
.btn-blue { background: linear-gradient(135deg, #1877f2, #145dbf); color: white; box-shadow: 0 4px 10px rgba(24,119,242,0.3); }
.btn-green { background: linear-gradient(135deg, #36a420, #2a8118); color: white; width: 100%; font-size: 1.1rem; box-shadow: 0 4px 10px rgba(54,164,32,0.3); }
.btn-delete { position: absolute; top: 20px; right: 20px; background-color: #dc3545; color: white; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 0.8rem; transition: background 0.2s;}
.btn-logout { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; background-color: #e4e6eb; color: #050505; text-decoration: none; padding: 10px 15px; border-radius: 6px; font-weight: bold; transition: 0.2s; touch-action: manipulation;}
.nav-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 2px solid #eee; }
.nav-left { display: flex; gap: 10px; }
.mobile-app-header { display: none; }
.nav-icon { display: inline-flex; }
.nav-label { display: inline-flex; margin-left: 4px; }

@media (hover: hover) and (pointer: fine) {
    .btn-blue:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(24,119,242,0.4); }
    .btn-green:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(54,164,32,0.4); }
    .btn-delete:hover { background-color: #bd2130; }
    .btn-logout:hover { background-color: #d8dadf; color: #dc3545; }
    .project-header:hover { background-color: #e4e6eb; }
    .ig-action-icon svg:hover { color: #8e8e8e; }
}

/* --- FACEBOOK PREVIEW DIZÁJN --- */
#facebook-preview-card { background: white; width: 100%; max-width: 500px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); overflow: hidden; text-align: left;}
.fb-header { padding: 12px; display: flex; align-items: center; }
.fb-profile-pic { width: 40px; height: 40px; border-radius: 50%; background-color: #ddd; margin-right: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #aaa;}
.fb-name-area { display: flex; flex-direction: column; }
.fb-name { font-weight: bold; color: #1c1e21; font-size: 0.95rem;}
.fb-time { color: #65676b; font-size: 0.8rem;}
.fb-text-content { padding: 0 12px 12px 12px; font-size: 0.95rem; color: #050505; white-space: pre-wrap; }
#fb-media-preview { width: 100%; background-color: #000; display: flex; align-items: center; justify-content: center; min-height: 250px; max-height: 550px; overflow: hidden; position: relative;}
#fb-img-tag, #fb-vid-tag { width: 100%; height: auto; max-height: 550px; object-fit: contain; display: none;}
#fb-media-placeholder { font-size: 14px; color: #aaa; font-style: italic; display: block; padding: 20px; text-align: center;}
.fb-footer { padding: 10px 12px; border-top: 1px solid #ebedf0; display: flex; justify-content: space-around; color: #65676b; font-size: 0.9rem; font-weight: 600;}

/* --- INSTAGRAM PREVIEW DIZÁJN --- */
#instagram-preview-card { 
    background: white; width: 100%; max-width: 470px; border-radius: 8px; 
    border: 1px solid #dbdbdb; overflow: hidden; color: #000; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: none; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    text-align: left !important; 
}
.ig-header { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #efefef;}
.ig-header-left { display: flex; align-items: center; }
.ig-profile-pic { 
    width: 36px; height: 36px; border-radius: 50%; 
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); 
    padding: 2px; margin-right: 10px; display: flex; align-items: center; justify-content: center;
}
.ig-profile-pic-inner { width: 100%; height: 100%; background-color: #ddd; border-radius: 50%; border: 2px solid #fff; }
.ig-name-container { display: flex; align-items: center; }
.ig-name { font-weight: 600; font-size: 0.85rem; color: #262626;}
.ig-time { color: #737373; font-size: 0.85rem; margin-left: 5px; }
.ig-more svg { fill: #262626; height: 24px; width: 24px; }

#ig-media-preview { width: 100%; background-color: #fafafa; display: flex; align-items: center; justify-content: center; min-height: 300px; max-height: 580px; overflow: hidden; position: relative; }
#ig-img-tag, #ig-vid-tag { width: 100%; height: auto; max-height: 580px; object-fit: cover; display: none; }
#ig-media-placeholder { font-size: 14px; color: #aaa; font-style: italic; display: block; padding: 20px; text-align: center; }

/* IG FOOTER & CAPTION - ERŐSZAKOS BALRA IGAZÍTÁS */
.ig-footer { padding: 12px 14px; text-align: left !important; }
.ig-actions { display: flex; justify-content: space-between; margin-bottom: 12px; }
.ig-actions-left { display: flex; gap: 16px; align-items: center;}
.ig-action-icon svg { color: #262626; height: 24px; width: 24px; cursor: pointer; transition: 0.2s;}
.ig-action-icon svg:hover { color: #8e8e8e; }
.ig-likes { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; color: #262626; text-align: left !important; display: block;}
.ig-caption { font-size: 0.9rem; line-height: 1.4; white-space: pre-wrap; color: #262626; text-align: left !important; display: block; width: 100%; margin: 0; padding: 0;}
.ig-caption span.ig-username { font-weight: 600; margin-right: 5px; }

/* --- PROJEKTEK & ÜGYFÉL PORTÁL SPECIFIKUS DIZÁJN --- */
ul { list-style-type: none; padding: 0; }
.project-card { border: 1px solid #ddd; margin-bottom: 25px; border-radius: 8px; overflow: hidden; margin-top: 30px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.project-header { padding: 20px 25px; background-color: #f8f9fa; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; }
.project-header:hover { background-color: #e4e6eb; }
.post-list { display: none; padding: 25px; background-color: #fff; border-top: 1px solid #ddd; }
.post-list.open { display: block; animation: fadeIn 0.3s ease-in-out; }

/* Miniatűr rács a tartalomkészítőnek */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
.mini-post-card { background: white; border: 3px solid #ccc; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.mini-post-card.status-Jóváhagyva { border-color: #28a745; background-color: #f4fff6; }
.mini-post-card.status-Módosítandó { border-color: #dc3545; background-color: #fff6f6; }
.mini-media { width: 100%; height: 140px; background: #000; border-radius: 4px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #888; font-size: 0.85rem; }
.mini-media img, .mini-media video { width: 100%; height: 100%; object-fit: cover; }
.mini-details { font-size: 0.85rem; color: #555; flex-grow: 1; }
.status-text { font-weight: bold; margin-top: 5px; display: inline-block; }
.text-Jóváhagyva { color: #28a745; }
.text-Módosítandó { color: #dc3545; }
.text-Várakozás { color: #6c757d; }

/* Ügyfél Portál kártyái */
.client-project-box { background: #f8f9fa; border: 1px solid #ddd; padding: 25px; border-radius: 8px; margin-top: 30px; }
.client-post-card { background: white; border: 1px solid #eee; padding: 20px; border-radius: 6px; margin-bottom: 25px; box-shadow: 0 2px 10px rgba(0,0,0,0.04); }
.media-preview-box { width: 100%; max-height: 400px; background: #000; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; border-radius: 6px; overflow: hidden; }
.media-preview-box img, .media-preview-box video { max-width: 100%; max-height: 400px; object-fit: contain; }
.action-buttons { display: flex; gap: 10px; margin-top: 15px; border-top: 1px solid #eee; padding-top: 15px;}
.status-badge { padding: 4px 8px; border-radius: 4px; font-weight: bold; font-size: 0.85rem; }
.status-Jóváhagyva { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb;}
.status-Módosítandó { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb;}
.reject-form { display: none; margin-top: 15px; background: #fff6f6; padding: 15px; border-radius: 6px; border: 1px solid #f5c6cb;}

/* Ügyfelek listája */
.client-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid #eee; font-size: 1.1rem;}
.client-info { display: flex; flex-direction: column; }
.client-email { font-size: 0.9rem; color: #666; margin-top: 3px; }
/* =========================================================
   📱 MOBIL OPTIMALIZÁCIÓ (Responsive Design) 📱
   ========================================================= */
@media (max-width: 768px) {
    body {
        display: block;
        min-height: 100dvh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        padding: var(--safe-top) 0 calc(var(--bottom-nav-height) + var(--safe-bottom));
    }

    body.login-container {
        display: flex;
        padding: max(18px, var(--safe-top)) 16px max(18px, var(--safe-bottom));
        min-height: 100dvh;
        overflow: hidden;
    }

    .login-card {
        margin: 0;
        padding: 26px;
        width: min(100%, 430px);
        max-height: calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom));
        overflow-y: auto;
    }

    .container {
        width: 100%;
        min-height: 100dvh;
        height: auto;
        max-width: none;
        margin: 0;
        padding: 18px 16px calc(var(--bottom-nav-height) + 22px + var(--safe-bottom));
        border-radius: 0;
        overflow: visible;
        box-shadow: none;
    }

    .nav-bar {
        display: block;
        margin: -18px -16px 22px;
        padding: 0;
        border: 0;
    }

    .mobile-app-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 58px;
        padding: 10px 16px;
        background: white;
        border-bottom: 1px solid #e5e7eb;
        position: sticky;
        top: 0;
        z-index: 900;
    }

    .mobile-app-header strong {
        font-size: 1.25rem;
        letter-spacing: -0.03em;
    }

    .mobile-app-header span { color: var(--brand-blue); }

    .nav-left {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0;
        min-height: calc(var(--bottom-nav-height) + var(--safe-bottom));
        padding: 8px 10px calc(8px + var(--safe-bottom));
        background: rgba(255,255,255,0.96);
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -8px 26px rgba(15, 23, 42, 0.12);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    .nav-right { display: none; }

    body.theme-client .nav-left {
        position: static;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
        min-height: auto;
        padding: 14px 16px;
        background: transparent;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    body.theme-client .nav-left .btn {
        width: 100%;
        min-height: 44px;
        background: #eff6ff !important;
        color: var(--brand-blue) !important;
    }

    .nav-tab,
    .nav-left .btn {
        min-height: 54px;
        padding: 6px 4px !important;
        border-radius: 12px;
        flex-direction: column;
        gap: 3px;
        font-size: 0.74rem;
        line-height: 1.1;
        box-shadow: none !important;
        background: transparent !important;
        color: #64748b !important;
        text-decoration: none !important;
    }

    .nav-tab.active,
    .nav-left .btn-blue {
        background: #eff6ff !important;
        color: var(--brand-blue) !important;
    }

    .nav-icon { font-size: 1.18rem; }
    .nav-label { margin-left: 0; }

    #preview-section {
        position: fixed;
        inset: 0;
        z-index: 1200;
        width: 100%;
        height: 100dvh;
        padding: calc(16px + var(--safe-top)) 16px calc(18px + var(--safe-bottom));
        border: 0;
        background: #f0f2f5;
        overflow-y: auto;
        transform: translateY(105%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.28s ease, opacity 0.28s ease;
    }

    body.mobile-preview-open #preview-section {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    #preview-title {
        font-size: 1.25rem;
        margin: 54px 0 16px;
    }

    #form-section {
        width: 100%;
        margin-left: 0;
        padding: 18px 16px calc(var(--bottom-nav-height) + 92px + var(--safe-bottom));
        overflow: visible;
    }

    .mobile-preview-toggle {
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: calc(var(--bottom-nav-height) + 12px + var(--safe-bottom));
        z-index: 980;
        min-height: 52px;
        border: 0;
        border-radius: 999px;
        background: #0f172a;
        color: white;
        font-weight: 800;
        font-size: 1rem;
        box-shadow: 0 16px 34px rgba(15,23,42,0.26);
    }

    .preview-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: calc(12px + var(--safe-top));
        right: 14px;
        z-index: 2;
        min-height: 44px;
        padding: 10px 14px;
        border: 0;
        border-radius: 999px;
        background: #111827;
        color: white;
        font-weight: 800;
    }

    .post-box {
        padding: 16px;
        margin-bottom: 16px;
    }

    .post-box form,
    .post-box > form,
    .container > div[style*="justify-content: space-between"],
    div[style*="display: flex; gap: 20px"],
    div[style*="display: flex; gap: 10px"],
    form[style*="display: flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    label {
        display: block;
        margin-bottom: 6px;
    }

    input[type="text"], input[type="password"], input[type="email"], input[type="datetime-local"], input[type="file"], textarea, select {
        display: block;
        min-height: 44px;
        font-size: 16px;
    }

    .project-card {
        margin-top: 18px;
        border-radius: 12px;
    }

    .project-header {
        display: grid;
        grid-template-columns: 1fr;
        align-items: start;
        gap: 14px;
        padding: 18px;
    }

    .project-header > div:last-child {
        width: 100%;
        display: flex !important;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 10px !important;
    }

    .project-header form,
    .project-header .btn,
    .project-header button {
        width: 100%;
        min-height: 44px;
    }

    .post-list {
        padding: 16px;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .client-item {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
        align-items: start;
        position: relative;
        padding: 18px !important;
    }

    .client-item > div {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 14px !important;
        width: 100%;
    }

    .client-info {
        min-width: 0 !important;
        width: 100%;
    }

    .client-item form,
    .client-item form button {
        width: 100%;
        position: static;
        min-height: 44px;
    }

    .client-item input[id^="magic-"] {
        font-size: 16px !important;
        min-height: 44px;
    }

    .client-item div[style*="Auto-Bejelentkező"],
    .client-item div[style*="f0f4f8"] {
        min-width: 0 !important;
        width: 100%;
    }

    .client-item div[style*="display: flex; gap: 10px"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .action-buttons {
        flex-direction: column;
        gap: 12px;
    }

    .action-buttons form,
    .action-buttons .btn,
    .action-buttons button {
        width: 100% !important;
        min-height: 50px;
    }

    .reject-form {
        padding: 16px;
    }

    .reject-form textarea {
        min-height: 92px;
        font-size: 16px !important;
        resize: vertical;
        scroll-margin-bottom: 40vh;
    }

    .reject-form form > div {
        flex-direction: column !important;
    }

    #facebook-preview-card, 
    #instagram-preview-card, 
    #tiktok-preview-card {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .client-post-card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .client-post-card .reject-form {
        width: 100%;
        box-sizing: border-box;
    }
}

@media (hover: none), (pointer: coarse) {
    .btn:hover,
    .btn-blue:hover,
    .btn-green:hover,
    .btn-delete:hover,
    .btn-logout:hover,
    .project-header:hover,
    .ig-action-icon svg:hover {
        transform: none !important;
        box-shadow: inherit;
    }

    .project-header:hover {
        background-color: #f8f9fa !important;
    }

    .ig-action-icon svg:hover {
        color: #262626 !important;
    }
}

@media (min-width: 769px) {
    .mobile-preview-toggle,
    .preview-close-btn {
        display: none;
    }
}

/* =========================================================
   PostGO Internal App UI Refresh
   ========================================================= */
:root {
    --ink: #0f172a;
    --muted: #64748b;
    --line: rgba(148, 163, 184, 0.26);
    --soft-surface: rgba(255, 255, 255, 0.78);
    --soft-surface-strong: rgba(255, 255, 255, 0.92);
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.10);
    --shadow-card: 0 12px 28px rgba(15, 23, 42, 0.08);
}

body.theme-creator,
body.theme-client {
    display: block;
    min-height: 100dvh;
    overflow-y: auto;
    background:
        radial-gradient(circle at 8% 8%, rgba(24, 119, 242, 0.14), transparent 30%),
        radial-gradient(circle at 88% 10%, rgba(16, 185, 129, 0.11), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #eef4fb 52%, #f8fafc 100%);
    color: var(--ink);
}

body.theme-client {
    background:
        radial-gradient(circle at 12% 4%, rgba(34, 197, 94, 0.12), transparent 30%),
        radial-gradient(circle at 85% 8%, rgba(24, 119, 242, 0.14), transparent 30%),
        linear-gradient(180deg, #f9fbff 0%, #eef6f5 58%, #f8fafc 100%);
}

body.theme-creator::before,
body.theme-client::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 72%);
}

body.theme-creator > .container,
body.theme-client > .container {
    width: min(100% - 32px, 1180px);
    max-width: 1180px;
    min-height: calc(100dvh - 32px);
    height: auto;
    margin: 16px auto;
    padding: 28px;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    background: var(--soft-surface);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.nav-bar {
    position: sticky;
    top: 14px;
    z-index: 800;
    min-height: 66px;
    margin: 0 0 26px;
    padding: 10px;
    border: 1px solid rgba(226, 232, 240, 0.86);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.nav-left {
    gap: 8px;
    flex-wrap: wrap;
}

.nav-tab,
.nav-left > .btn,
.btn-logout {
    border-radius: 12px;
}

.nav-tab,
.nav-left > .btn {
    min-height: 46px;
    border: 1px solid rgba(226, 232, 240, 0.92) !important;
    background: #f8fafc !important;
    color: #334155 !important;
    box-shadow: none !important;
}

.nav-tab.active,
.nav-left .btn-blue.active,
.nav-left > .btn-blue {
    border-color: rgba(24, 119, 242, 0.26) !important;
    background: linear-gradient(135deg, #1877f2, #0f5fc7) !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(24, 119, 242, 0.22) !important;
}

.btn-logout {
    background: #f1f5f9;
    color: #334155;
}

.app-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 26px;
    padding: 22px;
    border: 1px solid rgba(226, 232, 240, 0.82);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.94), rgba(248,250,252,0.76)),
        radial-gradient(circle at 96% 10%, rgba(24,119,242,0.12), transparent 36%);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

.app-page-header h1,
.container > h1,
#form-section > h1 {
    margin-top: 0;
    color: var(--ink);
    letter-spacing: 0;
}

.app-page-header p,
.container > p,
#form-section > p {
    color: var(--muted) !important;
    line-height: 1.65;
}

.post-box,
.project-card,
.client-project-box,
.client-post-card,
.upgrade-plan-card {
    border: 1px solid rgba(226, 232, 240, 0.86) !important;
    border-radius: 16px !important;
    background: var(--soft-surface-strong) !important;
    box-shadow: var(--shadow-card) !important;
}

.post-box {
    padding: 22px;
}

.post-box.active {
    border-color: rgba(24, 119, 242, 0.42) !important;
    background:
        linear-gradient(180deg, #ffffff, #f8fbff) !important;
    box-shadow: 0 18px 38px rgba(24, 119, 242, 0.12) !important;
}

.campaign-setup-card,
.client-preview-stage,
#company_fields {
    border: 1px solid rgba(226, 232, 240, 0.86) !important;
    border-radius: 16px !important;
    background: rgba(248, 250, 252, 0.86) !important;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="datetime-local"],
input[type="file"],
textarea,
select {
    border-color: rgba(203, 213, 225, 0.95);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--ink);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    border-color: rgba(24, 119, 242, 0.78);
    box-shadow: 0 0 0 4px rgba(24, 119, 242, 0.13);
}

.btn {
    border-radius: 12px;
}

.btn-blue {
    background: linear-gradient(135deg, #1877f2, #0f5fc7);
    box-shadow: 0 12px 24px rgba(24,119,242,0.22);
}

.btn-green {
    background: linear-gradient(135deg, #22c55e, #15803d);
    box-shadow: 0 12px 24px rgba(34,197,94,0.20);
}

.project-header {
    background: rgba(248, 250, 252, 0.92);
    border-radius: 16px 16px 0 0;
}

.post-list {
    background: rgba(255, 255, 255, 0.72);
}

.mini-post-card {
    border-width: 1px;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.mini-media,
.media-preview-box {
    border-radius: 12px;
}

.client-item {
    background: rgba(255, 255, 255, 0.74);
}

.client-item + .client-item {
    border-top: 1px solid rgba(226, 232, 240, 0.84);
}

.customers-list {
    display: grid;
    gap: 12px;
}

.customer-row {
    padding: 0 !important;
    border: 0 !important;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.customer-row-inner {
    display: grid !important;
    grid-template-columns: minmax(240px, 1.05fr) minmax(360px, 1.45fr) auto;
    gap: 16px;
    align-items: center !important;
    width: 100%;
    padding: 16px;
}

.customer-identity {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.customer-avatar {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(24,119,242,0.14), rgba(34,197,94,0.13));
    color: #0f5fc7;
    font-weight: 900;
}

.customer-identity strong {
    display: block;
    color: var(--ink);
    font-size: 1.02rem;
    line-height: 1.2;
}

.customer-identity .client-email,
.customer-created-by {
    display: block;
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.45;
}

.customer-created-by {
    color: #94a3b8;
}

.customer-magic-panel {
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(203, 213, 225, 0.72);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(248,250,252,0.96), rgba(241,245,249,0.76));
}

.magic-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 9px;
}

.magic-kicker {
    color: #1877f2;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.magic-countdown {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px !important;
    border-radius: 999px !important;
    background: rgba(22, 163, 74, 0.10) !important;
    color: #166534 !important;
    font-size: 0.76rem !important;
    font-weight: 800 !important;
    white-space: nowrap;
}

.magic-countdown.is-expired {
    background: #fff5f5 !important;
    color: #b42318 !important;
}

.magic-link-control {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.magic-link-control input {
    min-width: 0;
    margin: 0;
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 10px;
    color: #475569;
    font-size: 0.84rem;
    background: rgba(255,255,255,0.92);
}

.magic-copy-btn {
    min-height: 40px;
    padding: 9px 13px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.customer-actions {
    display: flex;
    justify-content: flex-end;
}

.customer-actions form {
    margin: 0;
}

.customer-delete-btn {
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid rgba(220, 38, 38, 0.20);
    background: #fff5f5;
    color: #b42318;
    font-size: 0.84rem;
    box-shadow: none;
}

.admin-create-user-form {
    display: grid;
    grid-template-columns: minmax(180px, 1.15fr) minmax(160px, 0.95fr) minmax(130px, 0.78fr) minmax(150px, 0.75fr) minmax(150px, auto);
    gap: 12px;
    align-items: end;
}

.admin-create-user-form label,
.admin-user-plan-form label {
    min-height: 18px;
    margin-bottom: 6px;
    color: #334155;
    font-size: 0.78rem;
    line-height: 1.2;
}

.admin-create-user-form input,
.admin-create-user-form select,
.admin-user-plan-form input,
.admin-user-plan-form select {
    min-height: 44px;
    margin: 0;
}

.admin-form-submit,
.admin-save-btn,
.admin-delete-btn {
    min-height: 44px;
    margin: 0;
    white-space: nowrap;
}

.admin-form-submit {
    width: 100% !important;
    padding-inline: 18px !important;
}

.admin-users-list {
    padding: 0 !important;
    overflow: hidden;
}

.admin-user-row {
    display: grid;
    grid-template-columns: minmax(230px, 1fr) minmax(360px, 1.35fr) minmax(126px, auto);
    gap: 14px;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.86);
}

.admin-user-row:last-child {
    border-bottom: 0;
}

.admin-user-identity {
    min-width: 0;
}

.admin-user-plan-form {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(96px, auto);
    gap: 10px;
    align-items: end;
    margin: 0;
}

.admin-user-delete-form {
    display: flex;
    justify-content: flex-end;
    margin: 0;
}

.admin-save-btn {
    padding: 9px 14px !important;
    font-size: 0.88rem;
}

.admin-delete-btn {
    padding: 9px 13px !important;
    border: 1px solid rgba(220, 38, 38, 0.24);
    background: #fff5f5;
    color: #b42318;
    font-size: 0.86rem;
    box-shadow: none;
}

.status-badge,
.magic-countdown {
    border-radius: 999px;
}

.role-selector {
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #f8fafc;
}

.role-selector label {
    border-radius: 10px;
}

.plan-summary-card {
    min-width: 230px;
    border-color: rgba(226, 232, 240, 0.9) !important;
    border-radius: 16px !important;
    background: linear-gradient(180deg, #ffffff, #f8fafc) !important;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.pricing-grid-inner {
    align-items: stretch;
}

.upgrade-plan-card {
    position: relative;
    overflow: hidden;
    min-height: 390px !important;
}

.upgrade-plan-card::after {
    content: "";
    position: absolute;
    inset: auto -30px -52px auto;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(24,119,242,0.13), transparent 68%);
    pointer-events: none;
}

.upgrade-plan-card.is-current {
    transform: translateY(-4px);
    box-shadow: 0 22px 48px rgba(24, 119, 242, 0.15) !important;
}

body.app-editor {
    background:
        radial-gradient(circle at 34% 18%, rgba(24,119,242,0.14), transparent 28%),
        linear-gradient(135deg, #eef5ff 0%, #f8fafc 44%, #eefaf5 100%);
}

body.app-editor::before {
    opacity: 0.85;
}

body.app-editor #preview-section {
    width: 42%;
    border-right: 1px solid rgba(15, 23, 42, 0.10);
    background:
        radial-gradient(circle at 50% 24%, rgba(59,130,246,0.30), transparent 30%),
        linear-gradient(180deg, #07111f, #0f172a 66%, #111827);
    color: white;
}

body.app-editor #preview-title {
    color: white;
    font-size: clamp(1.4rem, 2.4vw, 2rem);
}

body.app-editor #form-section {
    width: 58%;
    margin-left: 42%;
    min-height: 100dvh;
    padding: 24px 30px 38px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.74), rgba(248,250,252,0.92));
}

body.app-editor .nav-bar {
    top: 16px;
}

body.app-editor #facebook-preview-card,
body.app-editor #instagram-preview-card,
body.app-editor #tiktok-preview-card {
    box-shadow: 0 26px 70px rgba(0,0,0,0.38);
}

body.app-client .client-post-card {
    padding: 24px;
}

body.app-client .client-preview-stage {
    background:
        radial-gradient(circle at 50% 0%, rgba(24,119,242,0.14), transparent 45%),
        #f8fafc !important;
}

body.app-client .action-buttons {
    border-top-color: rgba(226, 232, 240, 0.9);
}

@media (hover: hover) and (pointer: fine) {
    .nav-tab:hover,
    .nav-left > .btn:hover,
    .project-card:hover,
    .upgrade-plan-card:hover,
    .client-post-card:hover {
        transform: translateY(-2px);
    }

    .project-card:hover,
    .upgrade-plan-card:hover,
    .client-post-card:hover {
        box-shadow: 0 18px 42px rgba(15, 23, 42, 0.11) !important;
    }
}

@media (max-width: 1100px) {
    .admin-create-user-form {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .admin-form-submit {
        grid-column: span 2;
    }

    .admin-user-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .admin-user-plan-form {
        grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(110px, auto);
    }

    .admin-user-delete-form {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    body.theme-creator > .container,
    body.theme-client > .container {
        width: 100%;
        min-height: 100dvh;
        margin: 0;
        padding: 18px 16px calc(var(--bottom-nav-height) + 22px + var(--safe-bottom));
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: rgba(255,255,255,0.82);
    }

    .nav-left {
        grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    }

    .app-page-header {
        display: block !important;
        padding: 18px;
        border-radius: 16px;
    }

    .plan-summary-card {
        min-width: 0;
        margin-top: 14px;
    }

    body.app-editor #preview-section {
        width: 100%;
        background:
            radial-gradient(circle at 50% 18%, rgba(59,130,246,0.28), transparent 34%),
            linear-gradient(180deg, #07111f, #0f172a 70%, #111827);
    }

    body.app-editor #form-section {
        width: 100%;
        margin-left: 0;
        padding: 18px 16px calc(var(--bottom-nav-height) + 92px + var(--safe-bottom));
        background: transparent;
    }

    .upgrade-plan-card.is-current {
        transform: none;
    }

    .customer-row-inner {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px;
    }

    .customer-magic-panel,
    .customer-actions,
    .customer-actions form,
    .customer-delete-btn {
        width: 100%;
    }

    .magic-panel-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .magic-countdown {
        white-space: normal;
    }

    .magic-link-control {
        grid-template-columns: 1fr;
    }

    .magic-copy-btn,
    .customer-delete-btn {
        width: 100%;
    }

    .admin-create-user-form,
    .admin-user-plan-form {
        grid-template-columns: 1fr;
    }

    .admin-form-submit {
        grid-column: auto;
    }

    .admin-user-row {
        padding: 14px;
    }

    .admin-user-delete-form,
    .admin-save-btn,
    .admin-delete-btn {
        width: 100%;
    }
}
