/* ── TOKENS ──────────────────────────────────────── */
:root {
    --bg:        #1a2a3a;
    --card:      #0d1b2a;
    --border:    rgba(255,255,255,0.07);
    --accent:    #1a1bad;
    --accent2:   #f07830;
    --text:      #e8edf2;
    --text-muted:#7a8fa6;
    --success:   #27ae60;
    --danger:    #e74c3c;
    --warning:   #f39c12;
    --radius:    15px;
    --font-title:'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;
    --max-w:     375px;
    --safe-top:  env(safe-area-inset-top, 0px);
    --safe-bot:  env(safe-area-inset-bottom, 0px);
}

/* ── RESET ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

/* ── APP SHELL ───────────────────────────────────── */
.app {
    max-width: var(--max-w);
    min-height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* ── TOPBAR ──────────────────────────────────────── */
.topbar {
    padding: calc(var(--safe-top) + 16px) 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.1);
}

/* ── MAIN CONTENT ────────────────────────────────── */
.main {
    flex: 1;
    padding: 20px 16px;
    padding-bottom: calc(80px + var(--safe-bot));
    overflow-y: auto;
}

/* ── BOTTOM NAV ──────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-w);
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    padding: 8px 0 calc(8px + var(--safe-bot));
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.6rem;
    font-family: var(--font-body);
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-item i { font-size: 1.2rem; }
.nav-item.active { color: var(--accent2); }
.nav-item.active i { color: var(--accent2); }

/* ── CARDS ───────────────────────────────────────── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 18px;
    margin-bottom: 14px;
}

.card-title {
    font-family: var(--font-title);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i { color: var(--accent2); }

/* ── FORMS ───────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    -webkit-appearance: none;
}

.form-input:focus {
    border-color: var(--accent);
    background: rgba(26,27,173,0.08);
}

.form-input::placeholder { color: rgba(255,255,255,0.2); }

.form-input.error { border-color: var(--danger); }

.form-error {
    font-size: 0.72rem;
    color: var(--danger);
    margin-top: 4px;
    display: none;
}

.form-error.visible { display: block; }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-title);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active { transform: scale(0.98); opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, #1a1bad, #2d2ef0);
    color: #fff;
    box-shadow: 0 4px 20px rgba(26,27,173,0.35);
}

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-accent {
    background: linear-gradient(135deg, #f07830, #e85d04);
    color: #fff;
    box-shadow: 0 4px 20px rgba(240,120,48,0.35);
}

.btn-sm {
    width: auto;
    padding: 8px 16px;
    font-size: 0.78rem;
}

/* ── TOAST ───────────────────────────────────────── */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 0.85rem;
    color: var(--text);
    z-index: 999;
    opacity: 0;
    transition: all 0.3s;
    white-space: nowrap;
    pointer-events: none;
    max-width: calc(var(--max-w) - 32px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger);  }

/* ── LOADING ─────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 1;
    transition: opacity 0.4s;
}

.loading-overlay.hide {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent2);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── BADGES / PILLS ──────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
}

.badge-success { background: rgba(39,174,96,0.15);  color: var(--success); }
.badge-warning { background: rgba(243,156,18,0.15); color: var(--warning); }
.badge-danger  { background: rgba(231,76,60,0.15);  color: var(--danger);  }
.badge-accent  { background: rgba(240,120,48,0.15); color: var(--accent2); }
.badge-blue    { background: rgba(26,27,173,0.2);   color: #7c7dff; }

/* ── PROGRESS BAR ────────────────────────────────── */
.progress-wrap {
    background: rgba(255,255,255,0.06);
    border-radius: 20px;
    height: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: width 1s ease;
}

/* ── DIVIDER ─────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── LINK ────────────────────────────────────────── */
.link {
    color: #7c7dff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.link:hover { text-decoration: underline; }

/* ── SPLASH / AUTH PAGES ─────────────────────────── */
.auth-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 24px;
    padding-bottom: calc(32px + var(--safe-bot));
    padding-top: var(--safe-top);
}

.auth-hero {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 0 32px;
}

.auth-logo {
    height: 48px;
    margin-bottom: 28px;
}

.auth-client-logo {
    height: 56px;
    width: auto;
    object-fit: contain;
    margin-bottom: 20px;
    border-radius: 12px;
}

.auth-title {
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    text-align: center;
    line-height: 1.2;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.auth-form { flex: 1; }

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── RODAPÉ PREVENTIVAMENTE ──────────────────────── */
.app-footer {
    text-align: center;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.app-footer img {
    height: 20px;
    opacity: 0.4;
}