/* CirculaFlow Lite — Portal Afiliado (afiliados.circulaflow.com.br)
 * Mesma paleta dark + accent lavender (cor do Lite/afiliados).
 */

:root {
    --bg-primary:        #0F0F14;
    --bg-card:           #1A1A24;
    --bg-card-elev:      #22223A;
    --border-subtle:     #2A2A3E;

    --primary-blue:      #5B5FEF;
    --accent-cyan:       #00D4FF;
    --success-green:     #00C896;
    --alert-orange:      #FF9500;
    --error-red:         #FF4757;

    --accent-lavender:   #A78BFA;
    --accent-pink:       #F472B6;
    --neutral-slate:     #5C6175;

    --text-primary:      #FFFFFF;
    --text-secondary:    #8A8FA8;
    --text-muted:        #5C6175;

    --gradient-primary:  linear-gradient(135deg, #5B5FEF 0%, #00D4FF 100%);
    --gradient-lite:     linear-gradient(135deg, #A78BFA 0%, #F472B6 100%);
    --gradient-success:  linear-gradient(135deg, #00C896 0%, #00A876 100%);

    --fill-primary-soft:  rgba(91, 95, 239, 0.15);
    --fill-cyan-soft:     rgba(0, 212, 255, 0.15);
    --fill-success-soft:  rgba(0, 200, 150, 0.15);
    --fill-error-soft:    rgba(255, 71, 87, 0.15);
    --fill-lavender-soft: rgba(167, 139, 250, 0.15);
    --fill-pink-soft:     rgba(244, 114, 182, 0.15);

    --radius-sm:  8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

html, body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace; }

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

button { font-family: inherit; cursor: pointer; }

/* ─── Layout ─────────────────────────────────────────────────────────── */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--border-subtle);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand .brand-name {
    font-size: 14px;
    font-weight: 700;
}
.sidebar-brand .brand-tag {
    font-size: 9px;
    color: var(--accent-lavender);
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 6px;
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
    text-decoration: none; transition: background 120ms;
}

.sidebar-nav a:hover { background: var(--bg-card-elev); color: var(--text-primary); text-decoration: none; }

.sidebar-nav a.active {
    background: var(--bg-card-elev);
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
}

.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: -12px; top: 8px; bottom: 8px;
    width: 3px;
    background: var(--accent-lavender);
    border-radius: 0 2px 2px 0;
}

.sidebar-footer {
    margin-top: auto; padding: 12px 8px 0;
    border-top: 1px solid var(--border-subtle);
    font-size: 11px; color: var(--text-muted);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 56px; flex-shrink: 0;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
    display: flex; align-items: center;
    padding: 0 24px; gap: 16px;
}

.topbar .title { font-size: 16px; font-weight: 700; }
.topbar .spacer { flex: 1; }

.content { flex: 1; overflow: auto; padding: 24px; }

/* ─── Componentes ────────────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.card-title {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-secondary);
}

.kpi {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex; flex-direction: column; gap: 6px;
}

.kpi-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-secondary); font-weight: 600;
}

.kpi-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px; font-weight: 700; line-height: 1.1;
}

.kpi-meta { font-size: 11px; color: var(--text-muted); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border: none; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 150ms; text-decoration: none;
}

.btn-primary { background: var(--accent-lavender); color: #fff; }
.btn-primary:hover { background: #9779e8; box-shadow: 0 0 20px rgba(167, 139, 250, 0.4); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-card-elev); color: var(--text-primary); }

.btn-danger { background: var(--error-red); color: #fff; }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card-elev);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit; font-size: 14px;
    transition: border-color 150ms;
}

.input:focus { outline: none; border-color: var(--accent-lavender); }

.input.input-otp {
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    letter-spacing: 12px;
    font-weight: 700;
}

.label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.pill {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 100px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
}

.pill-success { background: var(--fill-success-soft); color: var(--success-green); }
.pill-pending { background: rgba(255, 149, 0, 0.15); color: var(--alert-orange); }
.pill-error   { background: var(--fill-error-soft); color: var(--error-red); }
.pill-info    { background: var(--fill-cyan-soft); color: var(--accent-cyan); }
.pill-slate   { background: rgba(92, 97, 117, 0.18); color: var(--neutral-slate); }
.pill-lite    { background: var(--fill-lavender-soft); color: var(--accent-lavender); }
.pill-vip     { background: var(--gradient-lite); color: #fff; }

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 13px; margin-bottom: 14px;
}

.alert-error   { background: var(--fill-error-soft); color: var(--error-red); border: 1px solid rgba(255, 71, 87, 0.3); }
.alert-success { background: var(--fill-success-soft); color: var(--success-green); border: 1px solid rgba(0, 200, 150, 0.3); }
.alert-info    { background: var(--fill-cyan-soft); color: var(--accent-cyan); border: 1px solid rgba(0, 212, 255, 0.3); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

table thead th {
    text-align: left; padding: 10px 16px;
    background: var(--bg-card-elev); color: var(--text-secondary);
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px;
}

table tbody td { padding: 14px 16px; border-top: 1px solid var(--border-subtle); }
table tbody tr:hover { background: var(--bg-card-elev); }

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-secondary); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

@media (max-width: 800px) {
    .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .sidebar { width: 100%; height: auto; flex-direction: row; overflow-x: auto; }
    .app-shell { flex-direction: column; }
    .sidebar-nav { flex-direction: row; gap: 4px; }
    .sidebar-nav a.active::before { display: none; }
    .sidebar-footer { display: none; }
}

/* ─── Login ──────────────────────────────────────────────────────────── */

.login-container {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}

.login-card {
    width: 100%; max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 36px 28px;
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-header h1 {
    font-size: 22px; font-weight: 700; margin-bottom: 6px;
    background: var(--gradient-lite);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header .sub { font-size: 13px; color: var(--text-secondary); }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-footer {
    margin-top: 24px; padding-top: 18px;
    border-top: 1px solid var(--border-subtle);
    text-align: center; font-size: 11px; color: var(--text-muted);
}

/* ─── Hero painel afiliado ──────────────────────────────────────────── */

.hero-afil {
    padding: 24px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, #1f1d3a 0%, #2a1f3a 50%, #2a1f30 100%);
    border: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}
.hero-afil::before {
    content: '';
    position: absolute;
    top: -45%; right: -15%;
    width: 340px; height: 340px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.32) 0%, transparent 60%);
    filter: blur(8px);
    pointer-events: none;
}
.hero-afil::after {
    content: '';
    position: absolute;
    bottom: -55%; left: -15%;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(244, 114, 182, 0.22) 0%, transparent 60%);
    filter: blur(8px);
    pointer-events: none;
}
.hero-afil > * { position: relative; z-index: 1; }

.code-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px; letter-spacing: 4px;
    color: var(--accent-lavender);
    background: var(--bg-card-elev);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    user-select: all; -webkit-user-select: all;
    cursor: text; word-break: break-all;
    display: inline-block;
}

/* ─── Tipografia utilitária (espelha mock cflow/) ───────────────────── */
.t-headline-s { font-size: 20px; font-weight: 700; line-height: 1.2; }
.t-title-s    { font-size: 13px; font-weight: 600; }
.t-body-s     { font-size: 12px; color: var(--text-secondary); }

/* ─── Hero saldo (gradient verde com glow) ──────────────────────── */
.hero-saldo {
    padding: 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, #002b25 0%, #003d33 100%);
    border: 1px solid rgba(0, 200, 150, 0.25);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px -10px rgba(0, 200, 150, 0.18) inset;
}
.hero-saldo::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(0, 200, 150, 0.32) 0%, transparent 60%);
    filter: blur(10px);
    pointer-events: none;
}
.hero-saldo > * { position: relative; z-index: 1; }

/* ─── KPI row (4 colunas com sparkline) ─────────────────────────────── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* ─── Grid 2:1 (chart + sidecar) ────────────────────────────────────── */
.grid-21 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

/* ─── VIP box (rodapé sidebar) ──────────────────────────────────────── */
.vip-box {
    margin-top: 24px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 149, 0, 0.10);
    border: 1px dashed rgba(255, 149, 0, 0.40);
}
.vip-tag {
    font-size: 10px;
    color: var(--alert-orange);
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.vip-msg {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ─── Nav badge (na sidebar item, ex: "Indicados · 234") ────────────── */
.nav-badge {
    margin-left: auto;
    font-size: 10px;
    font-family: var(--font-mono);
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--fill-primary-soft);
    color: var(--primary-blue);
}

/* ─── Empty state ───────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 36px 24px;
    color: var(--text-secondary);
}
.empty-state .icon {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.6;
}

@media (max-width: 1100px) {
    .kpi-row { grid-template-columns: 1fr 1fr; }
    .grid-21 { grid-template-columns: 1fr; }
}

/* ─── Effects layer ───────────────────────────────────────────── */

@keyframes afilFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.content > .card,
.content > .hero-afil,
.content > .hero-saldo,
.content > .kpi-row { animation: afilFadeIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }

.card { transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 180ms, box-shadow 180ms; }
.card:hover { border-color: var(--border-strong); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }

.btn-primary { transition: all 180ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.btn-primary:hover { transform: translateY(-1px); }

.input:focus { box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18); }
