/* =========================================================================
   AdsFlow — base theme
   ========================================================================= */

:root {
    --bg:            #07070b;
    --bg-elev-1:     #0f0f15;
    --bg-elev-2:     #15151d;
    --bg-card:       #11111a;
    --border:        #23232f;
    --border-strong: #303040;
    --text:          #f5f5f7;
    --text-dim:      #a4a4b3;
    --text-muted:    #6f6f80;

    --accent:        #7c5cff;
    --accent-2:      #4f8cff;
    --accent-soft:   rgba(124, 92, 255, 0.15);
    --danger:        #ff6363;

    --radius-sm: 8px;
    --radius:    14px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow:    0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);

    --maxw: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }

/* The HTML `hidden` attribute is just `display: none`, which any later
   CSS rule with `display: flex/grid/block` will override. Force it. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.container {
    width: 100%;
    max-width: var(--maxw);
    padding: 0 24px;
    margin: 0 auto;
}

/* ---------- Brand ---------- */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    font-weight: 800;
    font-size: 17px;
    box-shadow: 0 6px 18px rgba(124, 92, 255, 0.45);
}
.brand-name { font-size: 17px; }
.brand--floating {
    position: absolute;
    top: 24px;
    left: 28px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14.5px;
    line-height: 1;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .08s ease, background .15s ease, border-color .15s ease, color .15s ease;
    user-select: none;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    box-shadow: 0 8px 24px rgba(124, 92, 255, 0.35);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-ghost:hover { background: var(--bg-elev-1); border-color: #3d3d52; }

/* =========================================================================
   Marketing layout
   ========================================================================= */

.page-marketing { background:
    radial-gradient(1100px 600px at 50% -200px, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(79, 140, 255, 0.10), transparent 60%),
    var(--bg);
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(7, 7, 11, .72);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}
.topnav {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-left: 12px;
    font-size: 14.5px;
    color: var(--text-dim);
}
.topnav a { transition: color .15s ease; }
.topnav a:hover { color: var(--text); }
.topbar-cta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- Hero ---------- */
.hero { padding: 90px 0 80px; }
.hero-inner { text-align: center; }
.hero-eyebrow {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elev-1);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .02em;
    margin-bottom: 24px;
}
.hero-title {
    font-size: clamp(36px, 6vw, 64px);
    line-height: 1.05;
    letter-spacing: -0.025em;
    font-weight: 800;
    margin: 0 0 22px;
}
.hero-title .accent {
    background: linear-gradient(135deg, #b89cff, #5fa0ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-sub {
    max-width: 680px;
    margin: 0 auto 32px;
    color: var(--text-dim);
    font-size: 18px;
    line-height: 1.6;
}
.hero-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.hero-note {
    margin-top: 18px;
    color: var(--text-muted);
    font-size: 13.5px;
}

/* ---------- Section primitives ---------- */
.section-title {
    font-size: clamp(28px, 3.5vw, 38px);
    font-weight: 800;
    text-align: center;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}
.section-sub {
    text-align: center;
    color: var(--text-dim);
    margin: 0 auto 40px;
    max-width: 640px;
}

/* ---------- Features ---------- */
.features { padding: 80px 0; }
.feature-grid {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: border-color .2s ease, transform .2s ease;
}
.feature-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.feature-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    font-size: 22px;
    margin-bottom: 14px;
}
.feature-card h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.feature-card p {
    margin: 0;
    color: var(--text-dim);
    font-size: 14.5px;
}

/* ---------- Pricing ---------- */
.pricing { padding: 80px 0; }
.pricing-grid {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    align-items: stretch;
}
.price-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 26px;
    display: flex;
    flex-direction: column;
}
.price-card--featured {
    border-color: rgba(124, 92, 255, 0.5);
    background:
        linear-gradient(180deg, rgba(124, 92, 255, 0.08), transparent 60%),
        var(--bg-card);
    box-shadow: var(--shadow-lg);
}
.price-tag {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}
.price-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.price-amount {
    margin: 14px 0 22px;
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.price-amount span {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 4px;
}
.price-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    color: var(--text-dim);
    font-size: 14.5px;
    flex: 1 0 auto;
}
.price-features li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.price-features li:last-child { border-bottom: 0; }
.price-features li::before { content: "✓ "; color: var(--accent); font-weight: 700; margin-right: 6px; }

/* ---------- CTA band ---------- */
.cta-band {
    padding: 80px 0;
    background:
        radial-gradient(800px 400px at 50% 100%, rgba(124, 92, 255, 0.18), transparent 60%);
}
.cta-band-inner {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 56px 24px;
}
.cta-band-inner h2 {
    margin: 0 0 12px;
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 800;
    letter-spacing: -0.02em;
}
.cta-band-inner p {
    margin: 0 0 24px;
    color: var(--text-dim);
}

/* ---------- Footer ---------- */
.footer {
    border-top: 1px solid var(--border);
    padding: 36px 0;
    color: var(--text-muted);
    font-size: 14px;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.footer-brand { display: inline-flex; align-items: center; gap: 10px; }
.footer-copy { margin: 0; }
.footer-nav {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.footer-nav a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    transition: color .15s ease;
}
.footer-nav a:hover { color: var(--text); }

/* =========================================================================
   Legal pages (Privacy Policy, Terms of Service)
   Generic long-form prose: comfortable measure, soft section spacing,
   well-styled lists. Sits inside the marketing layout.
   ========================================================================= */

.legal-page {
    padding: 64px 0 96px;
}
.legal-inner {
    max-width: 760px;
}
.legal-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-strong);
}
.legal-header h1 {
    margin: 0 0 6px;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text);
}
.legal-meta {
    margin: 0;
    color: var(--text-dim);
    font-size: 14px;
}
.legal-body {
    color: var(--text);
    font-size: 15.5px;
    line-height: 1.7;
}
.legal-body h2 {
    margin: 36px 0 12px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}
.legal-body h3 {
    margin: 24px 0 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.legal-body p {
    margin: 0 0 14px;
    color: var(--text-dim);
}
.legal-body ul,
.legal-body ol {
    margin: 0 0 18px;
    padding-left: 22px;
    color: var(--text-dim);
}
.legal-body li { margin-bottom: 8px; }
.legal-body strong { color: var(--text); font-weight: 600; }
.legal-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, .15);
    transition: text-decoration-color .15s ease;
}
.legal-body a:hover {
    text-decoration-color: var(--accent);
}
.legal-body code {
    background: var(--bg-elev-1);
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    padding: 1px 6px;
    font-size: 13px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    color: var(--text);
}
@media (max-width: 640px) {
    .legal-page { padding: 40px 0 64px; }
    .legal-header h1 { font-size: 28px; }
    .legal-body h2 { font-size: 18px; }
}

/* =========================================================================
   Auth layout
   ========================================================================= */

.page-auth {
    min-height: 100vh;
    background:
        radial-gradient(800px 500px at 30% 20%, rgba(124, 92, 255, 0.18), transparent 60%),
        radial-gradient(700px 500px at 80% 80%, rgba(79, 140, 255, 0.14), transparent 60%),
        var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-main { width: 100%; max-width: 420px; }
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.auth-title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.015em;
}
.auth-sub {
    margin: 0 0 28px;
    color: var(--text-dim);
    font-size: 15px;
}
.auth-error {
    background: rgba(255, 99, 99, 0.08);
    border: 1px solid rgba(255, 99, 99, 0.4);
    color: #ffb3b3;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 18px;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 13px 16px;
    border-radius: 12px;
    background: #ffffff;
    color: #1f1f1f;
    font-weight: 600;
    font-size: 15px;
    border: 1px solid #ffffff;
    transition: filter .15s ease, transform .08s ease;
    cursor: pointer;
}
.google-btn:hover { filter: brightness(.95); }
.google-btn:active { transform: translateY(1px); }
.google-btn-icon { width: 20px; height: 20px; }

.auth-tos {
    margin: 22px 0 0;
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.6;
}
.auth-tos a { color: var(--text-dim); text-decoration: underline; }

/* =========================================================================
   App layout
   ========================================================================= */

.page-app {
    min-height: 100vh;
    background: var(--bg);
}

.appbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(7, 7, 11, .85);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.appbar-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 18px;
}
.appbar-spacer { flex: 1; }
.appbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--bg-elev-1);
}
.appbar-user-meta { line-height: 1.2; text-align: right; }
.appbar-user-name { font-size: 13.5px; font-weight: 600; }
.appbar-user-email { font-size: 12px; color: var(--text-muted); }

.app-main { padding: 16px 0 60px; }
.app-container { display: block; }

.welcome-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
}
.welcome-title {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.welcome-sub { margin: 0; color: var(--text-dim); }

.placeholder-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}
.placeholder-card {
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 22px;
    color: var(--text-dim);
}
.placeholder-icon {
    width: 38px; height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 20px;
}
.placeholder-card h3 {
    color: var(--text);
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
}
.placeholder-card p { margin: 0; font-size: 14px; }

/* =========================================================================
   404
   ========================================================================= */
.page-404 {
    padding: 120px 0;
    text-align: center;
}
.page-404 h1 {
    margin: 0 0 12px;
    font-size: 28px;
    font-weight: 800;
}
.page-404 p { color: var(--text-dim); margin: 0 0 24px; }
.page-404-code {
    font-size: 88px;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

/* =========================================================================
   Account switcher / Refresh / Add bar
   ========================================================================= */

.account-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.account-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.account-switcher { position: relative; }
.account-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    color: var(--text);
    padding: 10px 14px;
    font: inherit;
    font-weight: 600;
    font-size: 14.5px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    min-width: 240px;
    justify-content: space-between;
}
.account-switcher-btn:hover:not(:disabled) {
    border-color: #3d3d52;
    background: var(--bg-elev-1);
}
.account-switcher-btn:disabled { opacity: .55; cursor: default; }
.account-switcher-caret { color: var(--text-dim); font-size: 12px; }
.account-switcher.is-open .account-switcher-caret { color: var(--text); }

.account-switcher-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 280px;
    max-width: 380px;
    max-height: 360px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 30;
    padding: 6px;
}
.account-menu-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    background: transparent;
    border: 0;
    color: var(--text);
    padding: 10px 12px;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}
.account-menu-item:hover { background: var(--bg-elev-1); }
.account-menu-item.is-selected { background: var(--accent-soft); }
.account-menu-name { font-weight: 600; font-size: 14px; }
.account-menu-id   { font-size: 12px; color: var(--text-muted); font-family: ui-monospace, Menlo, Consolas, monospace; }

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.refresh-btn .refresh-icon { display: inline-block; transition: transform .3s ease; }
.refresh-btn:hover:not(:disabled) .refresh-icon { transform: rotate(90deg); }
.refresh-spin {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid var(--text-dim);
    border-top-color: transparent;
    animation: spin .8s linear infinite;
}
.refresh-btn:disabled .refresh-icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.last-refreshed { color: var(--text-muted); font-size: 13px; }

/* =========================================================================
   Stat cards
   ========================================================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}
.stat-name {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* =========================================================================
   Account meta block + status badges + alerts
   ========================================================================= */

.account-meta {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
}
.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.meta-row:last-child { border-bottom: 0; }
.meta-key { color: var(--text-muted); }
.meta-val { color: var(--text); font-weight: 500; }
.meta-actions { padding-top: 14px; }

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.status-active        { background: rgba(64, 209, 138, 0.15); color: #67e29a; }
.status-syncing       { background: rgba(124, 92, 255, 0.18); color: #b3a0ff; }
.status-invalid_token { background: rgba(255, 99, 99, 0.15);  color: #ffa1a1; }
.status-error         { background: rgba(255, 99, 99, 0.15);  color: #ffa1a1; }
.status-disabled      { background: rgba(160, 160, 180, 0.15); color: #c7c7d1; }

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 18px;
}
.alert-error {
    background: rgba(255, 99, 99, 0.08);
    border: 1px solid rgba(255, 99, 99, 0.4);
    color: #ffb3b3;
}
.alert-success {
    background: rgba(64, 209, 138, 0.08);
    border: 1px solid rgba(64, 209, 138, 0.4);
    color: #9ce8be;
}
.alert-warn {
    background: rgba(255, 191, 71, 0.08);
    border: 1px solid rgba(255, 191, 71, 0.4);
    color: #ffd591;
}

/* "Reconnect Facebook" link rendered inline inside the sync-error banner
   when the saved token has been revoked or expired. */
.reconnect-link {
    display: inline-block;
    margin-left: 8px;
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}
.reconnect-link:hover { opacity: .85; }

/* =========================================================================
   Empty state
   ========================================================================= */

.empty-state {
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 56px 24px;
    text-align: center;
    margin-bottom: 24px;
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state h2 { margin: 0 0 8px; font-weight: 800; letter-spacing: -0.01em; }
.empty-state p { color: var(--text-dim); margin: 0 auto 22px; max-width: 540px; }

/* =========================================================================
   Modal
   ========================================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px;
    z-index: 100;
    overflow-y: auto;
}
body.no-scroll { overflow: hidden; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.modal-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-dim);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.modal-close:hover { background: var(--bg-elev-1); color: var(--text); }
.modal-body { padding: 20px 22px; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

/* =========================================================================
   Form fields
   ========================================================================= */

.form-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}
.form-field label {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 6px;
}
.form-field .req { color: var(--accent); }
.form-field .opt { color: var(--text-muted); font-weight: 400; }
.form-field input,
.form-field textarea {
    background: var(--bg-elev-1);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    transition: border-color .15s ease;
    resize: vertical;
}
.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-field textarea {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.45;
}
.form-field select.form-select {
    background-color: var(--bg-elev-1);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 11px 36px 11px 12px;
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    transition: border-color .15s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        linear-gradient(45deg,  transparent 50%, var(--text-dim) 50%),
        linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) center,
        calc(100% - 11px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}
.form-field select.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-field select.form-select:disabled {
    opacity: .55;
    cursor: not-allowed;
}
.form-field select.form-select option {
    background: var(--bg-elev-1);
    color: var(--text);
}
.field-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}
.field-hint code {
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11.5px;
    color: var(--text-dim);
}

.form-error {
    background: rgba(255, 99, 99, 0.08);
    border: 1px solid rgba(255, 99, 99, 0.4);
    color: #ffb3b3;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    margin-top: 4px;
}
.add-spin {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: transparent;
    animation: spin .8s linear infinite;
    display: inline-block;
    margin-right: 8px;
    vertical-align: -2px;
}

/* =========================================================================
   Launch page — top account bar + form fields + drop zone + push button
   ========================================================================= */

.btn.btn-block { width: 100%; }
.btn.btn-danger {
    color: #ffb3b3;
    border-color: rgba(255, 99, 99, 0.4);
    background: rgba(255, 99, 99, 0.06);
}
.btn.btn-danger:hover:not(:disabled) {
    background: rgba(255, 99, 99, 0.14);
    color: #ffd0d0;
}

.launch-page {
    padding-top: 24px;
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ---------- Account bar (above the form) ---------- */
.account-bar-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    margin-right: 4px;
}
.account-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.account-select {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text);
    padding: 9px 32px 9px 12px;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    min-width: 240px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
                      linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
    background-position: calc(100% - 16px) center, calc(100% - 11px) center;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    transition: border-color .15s ease, background-color .15s ease;
}
.account-select:hover:not(:disabled) {
    border-color: #3d3d52;
    background-color: var(--bg-elev-1);
}
.account-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.account-select:disabled { opacity: .55; cursor: default; }

/* ---------- Launch panel (the actual form card) ---------- */
.launch-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.launch-panel-head { margin-bottom: 4px; }
.launch-panel-title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.launch-panel-sub {
    margin: 0;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.5;
}

/* ---------- Two-column form row ---------- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-row .form-field { margin-bottom: 0; }

/* ---------- Misc bits reused by the launch bar ---------- */
.launch-bar-counter {
    color: var(--text-muted);
    font-size: 13px;
}

/* ---------- Drop zone ---------- */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-elev-1);
    padding: 36px 20px;
    text-align: center;
    transition: border-color .15s ease, background .15s ease;
    cursor: pointer;
    outline: none;
}
.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.is-active {
    border-color: var(--accent);
    background: rgba(124, 92, 255, 0.05);
}
.drop-zone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.drop-zone-inner { pointer-events: none; }
.drop-zone-icon { font-size: 28px; color: var(--text-dim); margin-bottom: 8px; }
.drop-zone-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.drop-zone-hint { font-size: 13px; color: var(--text-muted); }
.drop-zone-link { color: var(--accent); text-decoration: underline; }

/* ---------- Upload grid ---------- */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.upload-card {
    position: relative;
    background: var(--bg-elev-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.upload-card.is-error { border-color: rgba(255, 99, 99, 0.6); }
.upload-card.is-done  { border-color: rgba(64, 209, 138, 0.4); }
.upload-thumb {
    aspect-ratio: 1 / 1;
    background: var(--bg-elev-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 30px;
    overflow: hidden;
}
.upload-thumb img,
.upload-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-meta {
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
}
.upload-name {
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-sub { color: var(--text-muted); font-size: 11px; display: flex; justify-content: space-between; gap: 6px; }
.upload-progress {
    width: 100%;
    height: 4px;
    appearance: none;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background: var(--bg-elev-2);
}
.upload-progress::-webkit-progress-bar { background: var(--bg-elev-2); }
.upload-progress::-webkit-progress-value {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width .15s ease;
}
.upload-progress::-moz-progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.upload-progress.is-done::-webkit-progress-value { background: #40d18a; }
.upload-progress.is-done::-moz-progress-bar { background: #40d18a; }
.upload-progress.is-error::-webkit-progress-value { background: var(--danger); }
.upload-progress.is-error::-moz-progress-bar { background: var(--danger); }

.upload-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(7, 7, 11, .8);
    color: #fff;
    border: 1px solid var(--border-strong);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s ease, transform .15s ease;
}
.upload-remove:hover { background: var(--danger); transform: scale(1.06); }
.upload-error-msg {
    color: #ffb3b3;
    font-size: 11px;
    line-height: 1.35;
    margin: 0;
    word-break: break-word;
}

/* ---------- Launch bar ---------- */
.launch-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    flex-wrap: wrap;
}
.launch-bar-spacer { flex: 1 1 auto; }
.launch-bar-page {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dim);
}
.launch-bar-page select {
    background: var(--bg-elev-1);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 7px 9px;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.launch-bar-status {
    font-size: 12.5px;
    color: var(--text-dim);
    max-width: 480px;
    line-height: 1.4;
}
.launch-bar-status.is-error   { color: #ffb3b3; }
.launch-bar-status.is-success { color: #67e29a; }
.launch-bar-status.is-reason  { color: var(--text-muted); }
.launch-spin {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: transparent;
    animation: spin .8s linear infinite;
    display: inline-block;
}
.launch-btn:disabled { opacity: .55; cursor: not-allowed; }

/* =========================================================================
   Dashboard explorer (account / campaign / adset)
   ========================================================================= */

/* The dashboard page mirrors the old .launch-page wrapper so all the
   gap/padding tricks already established still apply. */
.dashboard-page {
    padding-top: 24px;
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Tiny utility button used inside the adset rows ("Push creatives"). */
.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 7px;
    line-height: 1.4;
}

/* Two-column layout: campaigns rail on the left, adsets / launch in main. */
.explorer {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 18px;
    align-items: stretch;
}

.explorer-side {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 10px;
    align-self: flex-start;
    /* Smaller font so long campaign names fit without wrapping awkwardly. */
    font-size: 12.5px;
    line-height: 1.4;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    position: sticky;
    top: 12px;
}
.side-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 4px 8px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.side-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.side-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-elev-2);
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--border);
}
.side-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.side-item {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 8px;
    color: var(--text-dim);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.side-item:hover {
    background: var(--bg-elev-1);
    color: var(--text);
}
.side-item.is-active {
    background: var(--accent-soft);
    color: var(--text);
    border-color: rgba(124, 92, 255, 0.35);
}
.side-item-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.side-item .status-chip {
    flex: 0 0 auto;
    font-size: 10px;
    padding: 1px 6px;
    text-transform: lowercase;
    letter-spacing: 0;
}
.side-empty {
    margin: 8px 8px 4px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ---------- Main area ---------- */
.explorer-main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;        /* let flex children shrink properly */
}
.explorer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.explorer-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.explorer-sub {
    margin: 0;
    color: var(--text-dim);
    font-size: 13px;
}
.explorer-empty,
.explorer-empty-hint {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

.explorer-placeholder {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-dim);
}
.explorer-placeholder-icon {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.explorer-placeholder h2 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
}
.explorer-placeholder p {
    margin: 0 auto 6px;
    font-size: 13.5px;
    max-width: 520px;
}

/* ---------- Adset table ---------- */
.adset-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.adset-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 100px minmax(0, 1.2fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg-elev-1);
    border: 1px solid transparent;
    font-size: 13px;
}
.adset-row:hover { border-color: var(--border-strong); }
.adset-row-head {
    background: transparent;
    padding: 4px 12px;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}
.adset-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.adset-cell-name { font-weight: 500; color: var(--text); }
.adset-cell-meta { color: var(--text-dim); }
.adset-cell-id code {
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11.5px;
    color: var(--text-dim);
}
.adset-cell-actions { justify-self: end; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 960px) {
    .explorer { grid-template-columns: 1fr; }
    .explorer-side {
        position: static;
        max-height: none;
    }
    .adset-row {
        grid-template-columns: 1fr auto;
        row-gap: 6px;
    }
    .adset-row-head { display: none; }
    .adset-cell-meta, .adset-cell-id { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); }
    .adset-cell-status { grid-column: 1 / -1; }
    .adset-cell-actions { grid-column: 2; grid-row: 1; }
}
@media (max-width: 720px) {
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-row .form-field { margin-bottom: 16px; }
    .account-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .account-bar-left { flex-wrap: wrap; }
    .account-bar-right { margin-left: 0; }
    .account-select { min-width: 0; width: 100%; }
}
@media (max-width: 960px) {
    .feature-grid     { grid-template-columns: repeat(2, 1fr); }
    .placeholder-grid { grid-template-columns: repeat(2, 1fr); }
    .pricing-grid     { grid-template-columns: 1fr; }
    .stats-grid       { grid-template-columns: repeat(2, 1fr); }
    .topnav           { display: none; }
}
@media (max-width: 560px) {
    .feature-grid     { grid-template-columns: 1fr; }
    .placeholder-grid { grid-template-columns: 1fr; }
    .stats-grid       { grid-template-columns: 1fr; }
    .topbar-cta .btn-ghost { display: none; }
    .appbar-user-meta { display: none; }
    .hero { padding: 56px 0 48px; }
    .features, .pricing, .cta-band { padding: 56px 0; }
    .auth-card { padding: 28px 22px; }
    .account-switcher-btn { min-width: 0; width: 100%; }
    .account-bar { flex-direction: column; align-items: stretch; }
    .account-bar-left, .account-bar-right { width: 100%; }
    .modal-overlay { padding: 24px 12px; }
    .launch-panel { padding: 16px; }
}
