:root {
    --navy: #13142b;
    --navy-2: #1c1e3d;
    --navy-3: #252849;
    --purple: #7d5cff;
    --purple-2: #a488ff;
    --accent: #ff2d78;
    --ok: #22c55e;
    --warn: #f59e0b;
    --err: #ef4444;
    --text: #f7f7fb;
    --text-muted: #a0a3c2;
    --border: rgba(255,255,255,.12);
    --border-strong: rgba(255,255,255,.22);
    --card: rgba(255,255,255,.05);
    --card-hover: rgba(255,255,255,.08);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-lg: 0 18px 40px rgba(0,0,0,.35);
    --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--navy);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
body.page-legal, body.page-app {
    background: linear-gradient(180deg, var(--navy) 0%, #0e0f23 100%);
    min-height: 100vh;
}
a { color: var(--purple-2); text-decoration: none; }
a:hover { color: var(--text); text-decoration: underline; }
code { background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }
h1,h2,h3,h4 { margin: 0 0 .6em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
small { font-size: .85em; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.truncate { max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 820px; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(19,20,43,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1400px; margin: 0 auto; padding: 14px 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--purple), var(--accent)); color: white; font-weight: 800; font-size: .8rem; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--text-muted); font-size: .95rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 12px; font-size: .85rem; }
.nav-user-tenant { background: rgba(125,92,255,.15); color: var(--purple-2); padding: 4px 10px; border-radius: 999px; font-weight: 600; }
.nav-user-email { color: var(--text-muted); }
.btn-text { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: .9rem; padding: 0; }
.btn-text:hover { color: var(--text); }

/* Buttons */
.btn { display: inline-block; padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 600; font-size: .95rem; border: 1px solid transparent; cursor: pointer; transition: all .15s; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--purple), var(--accent)); color: white; box-shadow: 0 4px 16px rgba(125,92,255,.35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(125,92,255,.5); text-decoration: none; color: white; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--card); border-color: var(--purple-2); text-decoration: none; color: var(--text); }
.btn-danger { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); text-decoration: none; color: #fca5a5; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-link { color: var(--purple-2); font-size: .9rem; font-weight: 500; }

/* Hero */
.hero { padding: 64px 0 72px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 20% 0%, rgba(125,92,255,.25), transparent 60%), radial-gradient(ellipse at 80% 30%, rgba(255,45,120,.18), transparent 55%); pointer-events: none; }
.hero-inner { position: relative; display: grid; grid-template-columns: 1.2fr 0.9fr; gap: 56px; align-items: center; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.hero-badge { display: inline-block; padding: 6px 14px; border-radius: 999px; background: rgba(125,92,255,.15); color: var(--purple-2); font-size: .85rem; font-weight: 600; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.2rem, 4.5vw, 3.6rem); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 22px; }
.hero-accent { background: linear-gradient(135deg, var(--purple-2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { font-size: 1.12rem; color: var(--text-muted); max-width: 540px; margin-bottom: 28px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 28px; }
.hero-badges { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.hero-badges li { padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-size: .82rem; color: var(--text-muted); }
.hero-visual { display: grid; place-items: center; }

/* Mock phone */
.mock-phone { width: 280px; height: 580px; border-radius: 36px; background: linear-gradient(180deg, var(--navy-2), var(--navy-3)); border: 1px solid var(--border-strong); padding: 16px; box-shadow: var(--shadow-lg); position: relative; }
.mock-phone-top { height: 20px; width: 100px; background: var(--navy); border-radius: 0 0 14px 14px; margin: 0 auto 14px; }
.mock-phone-screen { background: rgba(0,0,0,.3); border-radius: 22px; padding: 16px; height: calc(100% - 44px); }
.mock-tab { color: var(--text-muted); font-size: .75rem; margin-bottom: 12px; }
.mock-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.05); margin-bottom: 10px; }
.mock-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--purple), var(--accent)); }
.mock-avatar.alt { background: linear-gradient(135deg, #22c55e, #0ea5e9); }
.mock-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.mock-line { height: 8px; border-radius: 4px; background: rgba(255,255,255,.15); }
.w-60 { width: 60%; } .w-70 { width: 70%; } .w-40 { width: 40%; } .w-35 { width: 35%; }
.mock-pill { padding: 3px 10px; border-radius: 999px; font-size: .65rem; font-weight: 600; }
.mock-pill.ok { background: rgba(34,197,94,.2); color: #86efac; }
.mock-post { margin-top: 14px; padding: 12px; background: rgba(255,255,255,.05); border-radius: 10px; }
.mock-post-head { font-size: .75rem; color: var(--text-muted); margin-bottom: 8px; }
.mock-progress { height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.mock-progress-bar { height: 100%; width: 67%; background: linear-gradient(90deg, var(--purple), var(--accent)); animation: progress 2.4s ease-in-out infinite; }
@keyframes progress { 0%,100% { width: 67%; } 50% { width: 95%; } }
.mock-post-meta { font-size: .65rem; color: var(--text-muted); margin-top: 6px; }

/* Sections */
.section { padding: 80px 0; }
.section-alt { background: rgba(255,255,255,.02); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-dark { padding: 72px 0; background: linear-gradient(135deg, var(--purple), var(--accent)); text-align: center; }
.section-dark h2 { color: white; font-size: 2.2rem; margin-bottom: 18px; }
.section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); text-align: center; margin-bottom: 14px; letter-spacing: -0.015em; }
.section-sub { text-align: center; color: var(--text-muted); font-size: 1.1rem; margin: 0 auto 48px; max-width: 680px; }
.section-sub-light { color: rgba(255,255,255,.85); font-size: 1.1rem; margin-bottom: 28px; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.two-col { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; transition: all .2s; }
.card:hover { background: var(--card-hover); border-color: var(--border-strong); transform: translateY(-2px); }
.card-icon { font-size: 1.8rem; margin-bottom: 14px; }
.card h3 { margin-bottom: 10px; color: var(--text); }
.card p { color: var(--text-muted); margin: 0; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { position: relative; padding: 10px 0 10px 32px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.check-list li::before { content: '✓'; position: absolute; left: 0; top: 10px; color: var(--ok); font-weight: 700; background: rgba(34,197,94,.15); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; }
.check-list li strong { color: var(--text); }
.check-list li:last-child { border-bottom: 0; }
.security-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.security-stat { padding: 16px; background: rgba(255,255,255,.03); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.security-stat .stat-number { font-size: 1.6rem; font-weight: 800; background: linear-gradient(135deg, var(--purple-2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 4px; }
.security-stat .stat-label { font-size: .85rem; color: var(--text-muted); }

/* Footer */
.footer { background: #0b0c1e; padding: 56px 0 24px; border-top: 1px solid var(--border); margin-top: 80px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; max-width: 1200px; margin: 0 auto; padding: 0 24px 32px; }
.footer-col h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 12px; }
.footer-col a { display: block; color: var(--text); font-size: .9rem; padding: 4px 0; }
.footer-col a:hover { color: var(--purple-2); text-decoration: none; }
.footer-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; font-size: 1rem; }
.footer-desc { color: var(--text-muted); font-size: .9rem; line-height: 1.6; margin: 0; }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 24px 0; max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; gap: 16px; font-size: .8rem; color: var(--text-muted); flex-wrap: wrap; }

/* App */
.app-main { padding: 40px 0 80px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 40px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; }
.stat-value { font-size: 2rem; font-weight: 800; margin-bottom: 4px; background: linear-gradient(135deg, var(--purple-2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: .85rem; color: var(--text-muted); }
.section-block { margin-bottom: 36px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.empty { text-align: center; padding: 56px 24px; background: var(--card); border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-muted); }
.empty h3 { color: var(--text); margin-bottom: 8px; }
.empty p { margin-bottom: 20px; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.account-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 12px; transition: all .2s; }
.account-card:hover { background: var(--card-hover); border-color: var(--border-strong); }
.account-list { display: flex; flex-direction: column; gap: 12px; }
.account-row { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
.account-row-main { min-width: 0; }
.account-row-title { display: flex; gap: 10px; align-items: center; font-size: 1.05rem; margin-bottom: 4px; flex-wrap: wrap; }
.account-row-meta { font-size: .9rem; color: var(--text-muted); margin-bottom: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.account-row-sub { line-height: 1.5; }
.account-row-actions { display: flex; gap: 8px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--navy-3); flex-shrink: 0; }
.avatar-lg { width: 64px; height: 64px; }
.account-info { flex: 1; min-width: 0; }
.account-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.account-handle { font-size: .85rem; color: var(--text-muted); }
.account-label { font-size: .75rem; color: var(--purple-2); margin-top: 2px; }
.account-meta { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.verified { color: #0ea5e9; font-weight: 700; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.pill-active { background: rgba(34,197,94,.18); color: #86efac; }
.pill-revoked, .pill-error, .pill-failed { background: rgba(239,68,68,.18); color: #fca5a5; }
.pill-expired { background: rgba(245,158,11,.18); color: #fbbf24; }
.pill-status { font-size: .72rem; }
.pill-publish_complete { background: rgba(34,197,94,.18); color: #86efac; }
.pill-processing_upload, .pill-processing_publish { background: rgba(14,165,233,.18); color: #7dd3fc; }
.pill-draft { background: rgba(255,255,255,.1); color: var(--text-muted); }

.data-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table thead { background: rgba(255,255,255,.03); }
.data-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td { font-size: .9rem; }

/* Forms */
.form-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.form-card fieldset { border: 0; padding: 0; margin: 0 0 28px; }
.form-card fieldset:last-of-type { margin-bottom: 20px; }
.form-card legend { font-size: .9rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--purple-2); margin-bottom: 12px; padding: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 500; font-size: .9rem; }
.field input[type="text"], .field input[type="number"], .field input[type="email"], .field input[type="file"], .field textarea, .field select {
    background: rgba(0,0,0,.25); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); font-family: inherit; font-size: .95rem;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--purple); outline-offset: 1px; }
.required { color: var(--accent); }
.hint { font-size: .85rem; color: var(--text-muted); margin-top: 6px; }
.info-box { background: rgba(125,92,255,.08); border: 1px solid rgba(125,92,255,.3); border-radius: var(--radius-sm); padding: 14px 18px; }
.info-box legend { color: var(--purple-2); }
.radio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.radio-card, .check-card { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: rgba(0,0,0,.15); transition: all .15s; }
.radio-card:hover, .check-card:hover { border-color: var(--purple-2); background: rgba(0,0,0,.3); }
.radio-card input, .check-card input { width: 16px; height: 16px; accent-color: var(--purple); }
.radio-card input:checked + img, .radio-card:has(input:checked) { border-color: var(--purple-2); background: rgba(125,92,255,.12); }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio-list label { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.radio-list label:hover { background: rgba(255,255,255,.04); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.commercial-sub { margin-top: 12px; padding-left: 22px; border-left: 2px solid var(--purple); display: flex; flex-direction: column; gap: 10px; }
.commercial-warning { background: rgba(245,158,11,.15); color: #fbbf24; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid rgba(245,158,11,.3); font-size: .9rem; }
.form-actions { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.status-out { font-size: .9rem; color: var(--text-muted); }
.status-out.error { color: #fca5a5; }
.status-out.success { color: #86efac; }

.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; border: 1px solid; }
.alert-success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-info { background: rgba(14,165,233,.1); border-color: rgba(14,165,233,.3); color: #7dd3fc; }
.alert-error { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.error { color: #fca5a5; }
.error-code { font-size: 5rem; font-weight: 900; background: linear-gradient(135deg, var(--purple-2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: -0.04em; }

/* Legal pages */
.legal-main { padding: 40px 0 60px; }
.legal h1 { font-size: 2.4rem; margin-bottom: 8px; }
.legal h2 { margin-top: 36px; color: var(--purple-2); font-size: 1.2rem; }
.legal h3 { margin-top: 20px; font-size: 1rem; color: var(--text); }
.legal p, .legal ul { color: var(--text-muted); }
.legal ul { padding-left: 24px; }
.legal ul li { margin-bottom: 6px; }
.legal a { color: var(--purple-2); }

@media (max-width: 900px) {
    .hero-inner, .two-col { grid-template-columns: 1fr; }
    .hero-visual { order: -1; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .nav-links { display: none; }
    .security-card { grid-template-columns: 1fr; }
    .account-row { grid-template-columns: auto 1fr; }
    .account-row-actions { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
    .footer-inner { grid-template-columns: 1fr; }
    .topbar-inner { flex-wrap: wrap; }
    .hero { padding: 40px 0 48px; }
}
