* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    font-size: 24px;
}

/* Auth Box */
.auth-box {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.auth-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 28px;
}

.form-container h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #555;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #5a6268;
}

.toggle-form {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.toggle-form a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.toggle-form a:hover {
    text-decoration: underline;
}

/* Product Card */
main {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.product-card {
    text-align: center;
    padding: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.product-card h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 26px;
}

.product-card p {
    color: #666;
    margin-bottom: 25px;
    font-size: 16px;
}

.product-card .btn-primary {
    width: auto;
    padding: 12px 40px;
}

/* Add Account Box */
.add-account-box {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.add-account-box h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
}

.add-account-box form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.add-account-box .form-group {
    flex: 1;
    margin-bottom: 0;
}

.add-account-box button {
    width: auto;
    padding: 12px 30px;
}

/* Accounts List */
.accounts-list h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
}

#accountsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.account-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.account-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.account-item h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 18px;
}

.account-item p {
    color: #666;
    font-size: 14px;
}

.account-item .delete-btn {
    margin-top: 15px;
    padding: 8px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.account-item .delete-btn:hover {
    background: #c82333;
}
body.embed-mode{
    background:#f1f5f9;
    margin:0;
}
body.embed-mode .builder-topbar,
body.embed-mode aside.builder,
body.embed-mode .viewport-toggle{display:none;}
body.embed-mode .builder-shell{
    padding-top:0;
    min-height:100vh;
}
body.embed-mode .preview{
    margin-left:0;
    padding:0;
    min-height:100vh;
}
body.embed-mode .preview .preview-frame{
    max-width:100%;
    border:none;
    min-height:100vh;
}
body.embed-mode .load-more{margin-bottom:32px;}
.account-actions{
    display:flex;
    gap:10px;
    margin-top:15px;
    flex-wrap:wrap;
}
.account-item button{
    flex:1 1 auto;
}
.account-item .install-btn{
    padding:8px 20px;
    background:#0a84ff;
    color:#fff;
    border:none;
    border-radius:6px;
    cursor:pointer;
    font-size:13px;
}
.account-item .install-btn:hover{
    background:#086fce;
}

.modal-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.55);
    display:none;
    align-items:center;
    justify-content:center;
    padding:20px;
    z-index:1000;
}
.modal-overlay.open{
    display:flex;
}
.modal-content{
    background:#fff;
    border-radius:12px;
    padding:24px;
    width:min(640px, 100%);
    box-shadow:0 20px 60px rgba(15,23,42,0.25);
    position:relative;
}
.modal-close{
    position:absolute;
    top:12px;
    right:12px;
    width:32px;
    height:32px;
    border:none;
    border-radius:50%;
    background:#f1f5f9;
    color:#0f172a;
    font-size:20px;
    line-height:1;
    cursor:pointer;
}
.modal-description{
    color:#475569;
    margin:12px 0 16px;
}
.embed-snippet{
    width:100%;
    min-height:180px;
    border:1px solid #d1d5db;
    border-radius:10px;
    padding:14px;
    font-family:'SFMono-Regular', Menlo, Consolas, monospace;
    font-size:13px;
    background:#f8fafc;
    color:#0f172a;
    resize:vertical;
}
.install-step{
    border:1px solid #e2e8f0;
    border-radius:12px;
    padding:16px;
    margin-bottom:18px;
    background:#f8fafc;
}
.install-step__header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
}
.install-step__header h4{
    margin:0;
    font-size:16px;
    color:#0f172a;
}
.step-note{
    margin:8px 0 12px;
    color:#475569;
}
.install-step .embed-snippet{
    min-height:140px;
    background:#fff;
}
.modal-actions{
    margin-top:18px;
    display:flex;
    justify-content:flex-end;
    gap:12px;
}
.btn-copy{
    padding:10px 18px;
    background:#16a34a;
    color:#fff;
    border:none;
    border-radius:6px;
    cursor:pointer;
    font-weight:600;
}
.btn-copy:hover{
    background:#12833b;
}
.copy-feedback{
    margin-top:10px;
    color:#16a34a;
    font-size:13px;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.post-card {
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.post-card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.post-info {
    padding: 15px;
}

.post-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    color: #666;
    font-size: 14px;
}

.post-description {
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading and Messages */
.loading {
    text-align: center;
    color: #666;
    padding: 40px;
    font-size: 16px;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* Responsive */
@media (max-width: 768px) {
    .add-account-box form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .add-account-box button {
        width: 100%;
    }
    
    #accountsContainer {
        grid-template-columns: 1fr;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Modern UI Refresh Overrides --- */
:root{
    --surface:#ffffff;
    --bg:#f4f6fb;
    --text:#0f172a;
    --muted:#64748b;
    --border:#e4e7ec;
    --shadow:0 24px 60px rgba(15,23,42,.12);
    --accent:#0a84ff;
}
body{
    background:var(--bg);
    color:var(--text);
    min-height:100vh;
    padding:32px;
    font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    line-height:1.6;
}
.container{
    max-width:1100px;
    margin:0 auto;
    padding:0 24px 48px;
}
header{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:28px;
    padding:24px 32px;
    margin-bottom:28px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:24px;
    box-shadow:var(--shadow);
}
header h1{margin:0;font-size:26px;}
header p{margin:4px 0 0;color:var(--muted);}
.surface-card,
.auth-box,
.product-card,
.add-account-box,
.account-item,
.modal-content{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:28px;
    box-shadow:var(--shadow);
}
.auth-box{
    max-width:420px;
    margin:48px auto;
    padding:40px 44px;
}
.auth-box h1{color:var(--text);font-size:28px;margin-bottom:6px;text-align:center;}
.auth-subtitle{color:var(--muted);text-align:center;margin-bottom:24px;}
.form-group input{
    border:1px solid var(--border);
    border-radius:14px;
    padding:14px;
    background:#f8fafc;
}
.form-group input:focus{
    border-color:var(--accent);
    outline:none;
    background:#fff;
}
.btn-primary{
    width:100%;
    padding:13px 24px;
    border-radius:16px;
    background:var(--accent);
    border:none;
    color:#fff;
    font-weight:600;
    cursor:pointer;
    transition:transform .2s, box-shadow .2s;
}
.btn-primary:hover{
    transform:translateY(-1px);
    box-shadow:0 10px 20px rgba(10,132,255,.35);
}
.btn-secondary{
    padding:11px 20px;
    border-radius:14px;
    border:1px solid var(--border);
    background:#fff;
    color:var(--text);
    cursor:pointer;
}
.product-card{
    padding:56px 48px;
    border:none;
    text-align:left;
}
.product-card h2{font-size:32px;margin-bottom:8px;}
.product-card p{color:var(--muted);margin-bottom:28px;font-size:18px;}
.add-account-box{
    padding:32px;
    border:none;
    margin-bottom:32px;
}
.add-account-box h2,
.accounts-list h2{margin-bottom:6px;font-size:22px;}
.add-account-box p,
.accounts-list .section-note{color:var(--muted);margin-bottom:18px;}
.account-item{
    border:none;
    padding:24px;
}
.account-actions{margin-top:18px;gap:12px;}
.account-actions .btn-primary{
    flex:1;
    border-radius:14px;
    border:none;
    padding:11px 0;
}
.account-actions .btn-secondary{
    flex:1;
    border-radius:14px;
    padding:11px 0;
    border:none;
    background:#ea384c;
    color:#fff;
    font-weight:600;
    cursor:pointer;
}
.loading{color:var(--muted);}
main{background:none;padding:0;box-shadow:none;}
