:root {
    --primary: #101828;
    --border: #eaecf0;
    --bg: #f9fafb;
    --white: #ffffff;
    --text: #344054;
    --magic: linear-gradient(90deg, #ec4899, #8b5cf6);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background: var(--bg); color: var(--primary); }
.hidden { display: none !important; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.mt-10 { margin-top: 10px; } .mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.text-sm { font-size: 14px; } .text-muted { color: var(--text); }
.box-shadow { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
.flex-row { display: flex; align-items: center; } .gap-10 { gap: 10px; } .flex-1 { flex: 1; }

.screen { min-height: 100vh; }
.logo { font-weight: 700; letter-spacing: -1px; }

/* Auth */
.auth-box { background: var(--white); padding: 40px; border-radius: 12px; width: 100%; max-width: 400px; text-align: center; }
.auth-box input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 15px; font-size: 15px; outline: none; }
.btn-primary { width: 100%; padding: 12px; background: var(--primary); color: var(--white); border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { width: 100%; padding: 12px; background: var(--white); color: var(--primary); border: 1px solid var(--border); border-radius: 8px; font-weight: 600; cursor: pointer; }
.error { background: #fee2e2; color: #ef4444; padding: 10px; border-radius: 8px; margin-bottom: 15px; font-size: 14px; }

/* Dashboard Header */
.app-header { background: var(--white); border-bottom: 1px solid var(--border); padding: 15px 40px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.header-right { display: flex; align-items: center; gap: 20px; }
.public-link { color: #6366f1; font-weight: 600; text-decoration: none; }
.public-link:hover { text-decoration: underline; }
#logout-btn { width: auto; padding: 8px 16px; }

/* Dashboard Layout */
.dashboard-layout { display: flex; max-width: 1200px; margin: 0 auto; padding: 40px 20px; gap: 40px; }
.editor-panel { flex: 1; max-width: 600px; }
.preview-panel { flex: 1; display: flex; justify-content: center; position: sticky; top: 100px; height: calc(100vh - 140px); }

/* Cards */
.card { background: var(--white); padding: 25px; border-radius: 16px; border: 1px solid var(--border); }
.card h3 { font-size: 20px; margin-bottom: 15px; }

/* Links Editor */
.add-link-form { display: flex; flex-direction: column; gap: 10px; }
.add-link-form input, .input-standard { padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; }
.links-list { display: flex; flex-direction: column; gap: 10px; }
.link-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; border: 1px solid var(--border); border-radius: 8px; background: #fafafa; }
.link-info strong { display: block; font-size: 15px; }
.link-info span { font-size: 12px; color: var(--text); }
.btn-delete { background: #fee2e2; color: #ef4444; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-weight: bold; }

/* AI Theme */
textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; resize: vertical; }
.btn-magic { width: 100%; padding: 14px; background: var(--magic); color: white; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3); transition: 0.3s; }
.btn-magic:hover { transform: translateY(-2px); }

/* Manual Theme Controls */
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-grid label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: #fafafa; }
input[type="color"] { border: none; width: 30px; height: 30px; border-radius: 4px; cursor: pointer; padding: 0; background: none; }

/* Loader */
.loader { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: #ec4899; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Phone Mockup */
.phone-mockup { width: 320px; height: 650px; border: 12px solid #000; border-radius: 40px; overflow: hidden; background: #fff; position: relative; }
.phone-mockup::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 120px; height: 24px; background: #000; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; z-index: 2; }
#preview-frame { width: 100%; height: 100%; border: none; }

@media(max-width: 900px) {
    .dashboard-layout { flex-direction: column; }
    .preview-panel { position: relative; top: 0; height: auto; margin-top: 20px; }
}
.theme-presets{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
@media(max-width:520px){.theme-presets{grid-template-columns:repeat(3,1fr)}}
.theme-swatch{border:1px solid rgba(0,0,0,.12);border-radius:10px;padding:10px 6px;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:6px;transition:.15s}
.theme-swatch:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(0,0,0,.15)}
.theme-swatch .sw-btn{width:70%;height:8px;border-radius:999px}
.theme-swatch b{font-size:11px;font-weight:700}
