/* CirculaFlow Lite — Portal do Assinante (conta.circulaflow.com.br)
 * Paleta dark canônica. Mobile-first. Inter + JetBrains Mono.
 */

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

    --primary-blue:      #5B5FEF;
    --primary-blue-700:  #4A4ECC;
    --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);

    --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-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

.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 img { width: 32px; height: 32px; border-radius: 8px; }

.sidebar-brand .brand-name {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.sidebar-brand .brand-tag {
    font-size: 9px;
    color: var(--primary-blue);
    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);
}

.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(--primary-blue);
    border-radius: 0 2px 2px 0;
}

.sidebar-nav .icon { font-size: 16px; }

.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-elev {
    background: var(--bg-card-elev);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

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

.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(--primary-blue);
    color: var(--text-primary);
    transition: background 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
                transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.btn-primary:hover {
    background: var(--gradient-primary);
    box-shadow: 0 0 24px rgba(91, 95, 239, 0.35);
    transform: translateY(-1px);
}

.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: var(--text-primary);
}

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

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.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(--primary-blue);
}

.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); }

.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);
    color: var(--text-primary);
}

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 img { width: 64px; height: 64px; margin-bottom: 16px; border-radius: 14px; }

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

.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 card (Painel) ─────────────────────────────────────────────── */

.hero-plan {
    padding: 24px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, #1a1f3a 0%, #2a1f3a 100%);
    border: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}
.hero-plan::before {
    content: '';
    position: absolute;
    top: -40%; right: -20%;
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(91, 95, 239, 0.35) 0%, transparent 60%);
    filter: blur(8px);
    pointer-events: none;
}
.hero-plan::after {
    content: '';
    position: absolute;
    bottom: -50%; left: -10%;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.2) 0%, transparent 60%);
    filter: blur(8px);
    pointer-events: none;
}

.hero-plan-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 24px;
}

.hero-plan-icon {
    width: 64px; height: 64px;
    border-radius: 14px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.hero-plan-info { flex: 1; }

.hero-plan-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.hero-plan-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.code-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    letter-spacing: 4px;
    color: var(--primary-blue);
    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: 18px; font-weight: 700; line-height: 1.2; }
.t-title-s    { font-size: 13px; font-weight: 600; }
.t-body-s     { font-size: 11px; color: var(--text-secondary); }

/* ─── Quick stat (4 cards no Painel) ─────────────────────────────── */
.quick-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.quick-stat .qs-icon { font-size: 22px; margin-bottom: 4px; }
.quick-stat .qs-label { font-size: 11px; color: var(--text-secondary); }
.quick-stat .qs-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
}
.quick-stat .qs-hint { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ─── Ação rápida (3 colunas dentro do card "O que você pode fazer") ── */
.acoes-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.acao-rapida {
    padding: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 120ms;
}
.acao-rapida:not(:last-child) { border-right: 1px solid var(--border-subtle); }
.acao-rapida:hover { background: var(--bg-card-elev); }
.acao-rapida .ar-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.acao-rapida .ar-titulo { font-size: 14px; font-weight: 600; }
.acao-rapida .ar-sub { font-size: 11px; color: var(--text-secondary); }
.acao-rapida .ar-link { font-size: 11px; font-weight: 600; margin-top: auto; }

/* ─── Atividade feed item ────────────────────────────────────────── */
.activity-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.activity-item:not(:first-child) { border-top: 1px solid var(--border-subtle); }
.activity-item .ai-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.activity-item .ai-text { flex: 1; font-size: 12px; }
.activity-item .ai-date {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ─── Hero plan ─────────────────────────────────────────────────── */
.plan-hero {
    padding: 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a1f3a 0%, #2a1f3a 100%);
    border: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}
.plan-hero::before {
    content: '';
    position: absolute;
    top: -50%; right: -25%;
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(91, 95, 239, 0.32) 0%, transparent 60%);
    filter: blur(8px);
    pointer-events: none;
}
.plan-hero-row { position: relative; z-index: 1; }
.plan-hero-row {
    display: flex;
    align-items: center;
    gap: 24px;
}
.plan-hero-icon {
    width: 64px; height: 64px;
    border-radius: 14px;
    background: var(--gradient-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    box-shadow: 0 0 24px rgba(91, 95, 239, 0.45);
}
.plan-hero-info { flex: 1; }
.plan-hero-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex; align-items: center; gap: 10px;
}
.plan-hero-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ─── Card par (Plano atual + Método de pagamento) ─────────────── */
.card-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ─── Method badge ─────────────────────────────────────────────── */
.method-badge {
    width: 44px; height: 28px;
    border-radius: 5px;
    background: var(--gradient-success);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800; color: #fff;
    box-shadow: 0 0 12px rgba(0, 200, 150, 0.4);
}

@keyframes contaFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}
.content > .card,
.content > .hero-plan,
.content > .plan-hero,
.content > div { animation: contaFadeIn 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); }

@media (max-width: 800px) {
    .card-pair { grid-template-columns: 1fr; }
    .acoes-grid { grid-template-columns: 1fr; }
    .acao-rapida:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
}
