:root {
    --bg: #0f1115;
    --bg-soft: #171a21;
    --panel: #1d212b;
    --border: #2a2f3a;
    --text: #e8eaf0;
    --text-dim: #9aa1b2;
    --accent: #7c5cff;
    --accent-hover: #6b4ce6;
    --danger: #ff5c7a;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
}

.brand { font-size: 20px; font-weight: 700; color: var(--text); }
.brand span { color: var(--accent); }

.topbar nav { display: flex; align-items: center; gap: 16px; }
.user-name { color: var(--text-dim); }

.main-content { max-width: 1100px; margin: 0 auto; padding: 40px 24px; }

.btn-primary, .btn-ghost, .btn-danger {
    display: inline-block;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.landing { text-align: center; padding: 80px 0; }
.landing h1 { font-size: 40px; margin-bottom: 16px; }
.landing p { color: var(--text-dim); max-width: 560px; margin: 0 auto 32px; font-size: 16px; }
.landing .btn-primary, .landing .btn-ghost { margin: 0 8px; }

.auth-box {
    max-width: 380px;
    margin: 40px auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.auth-box h1 { margin-top: 0; font-size: 22px; }
.auth-box form { display: flex; flex-direction: column; gap: 14px; }
.auth-box label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.auth-box input, select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
}
.auth-box button { margin-top: 8px; }
.auth-box p { font-size: 13px; color: var(--text-dim); margin-top: 16px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(255, 92, 122, 0.15); color: var(--danger); border: 1px solid var(--danger); }

.dashboard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.dashboard-head h1 { margin: 0; }

.empty-state { text-align: center; padding: 60px 0; color: var(--text-dim); }

.overlay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.overlay-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.overlay-card-preview {
    position: relative;
    background: repeating-conic-gradient(#20242e 0% 25%, #171a21 0% 50%) 50% / 24px 24px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.overlay-card-thumb {
    position: relative;
    background: #0a0c11;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
}
.overlay-card-preview a {
    opacity: 0;
    background: rgba(0,0,0,0.5);
    color: #fff;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .15s;
}
.overlay-card-preview:hover a { opacity: 1; }
.overlay-card-body { padding: 16px; }
.overlay-card-body h3 { margin: 0 0 4px; }
.dim { color: var(--text-dim); font-size: 13px; margin: 0 0 12px; }
.url-row { display: flex; gap: 8px; margin-bottom: 12px; }
.url-row input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--border); color: var(--text-dim); border-radius: 6px; padding: 8px; font-size: 12px; }
.url-row button { font-size: 12px; padding: 8px 10px; }
.card-actions { display: flex; gap: 8px; }
.card-actions form { margin: 0; }

.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; width: 360px; }
.modal-box h2 { margin-top: 0; }
.modal-box form { display: flex; flex-direction: column; gap: 14px; }
.modal-box label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.template-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.template-preview { position: relative; overflow: hidden; background-size: cover; }
.template-body { padding: 16px; }
.template-body h3 { margin: 0 0 4px; }
.template-body input[type=text] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text);
    font-size: 13px;
}
