/* ============================================================
   Sistema Financeiro Cristão — CSS principal
   Design limpo, moderno, confiável e responsivo (mobile-first)
   ============================================================ */

/* ── Reset e base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green-50:  #E1F5EE;
    --green-100: #9FE1CB;
    --green-400: #1D9E75;
    --green-600: #0F6E56;
    --green-800: #085041;

    --gray-50:  #F8F9FA;
    --gray-100: #F1F3F4;
    --gray-200: #E8EAED;
    --gray-400: #9AA0A6;
    --gray-600: #5F6368;
    --gray-800: #3C4043;
    --gray-900: #202124;

    --red-400:   #E24B4A;
    --amber-400: #EF9F27;
    --blue-400:  #378ADD;

    --text-primary:   #202124;
    --text-secondary: #5F6368;
    --text-muted:     #9AA0A6;

    --border:         #E8EAED;
    --border-focus:   #1D9E75;

    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.12);

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: .18s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--gray-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Autenticação ─────────────────────────────────────────── */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, #E1F5EE 0%, #F8F9FA 60%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.auth-card {
    width: 100%;
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
}

.auth-brand { text-align: center; margin-bottom: 32px; }

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.form-heading {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

.auth-footer-link {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-verse {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    max-width: 320px;
}

.terms-note {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 12px;
    line-height: 1.5;
}

/* ── Formulários ──────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 18px; }

.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.field-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--text-primary);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.field-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(29,158,117,.15);
}

.field-input--error {
    border-color: var(--red-400) !important;
}

.field-input::placeholder { color: var(--text-muted); }

.field-error {
    font-size: 12px;
    color: var(--red-400);
    min-height: 16px;
}

.field-row {
    display: flex;
    justify-content: flex-end;
}

.input-with-toggle { position: relative; }
.input-with-toggle .field-input { padding-right: 44px; }

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 4px;
    transition: color var(--transition);
}
.toggle-password:hover { color: var(--text-primary); }

/* ── Botões ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background var(--transition), opacity var(--transition), transform var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
    background: var(--green-400);
    color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--green-600); }

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }

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

.btn-full { width: 100%; }

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alertas ──────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
}

.alert-success {
    background: var(--green-50);
    color: var(--green-600);
    border: 1px solid var(--green-100);
}

.alert-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-warning {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
}

/* ── Links ────────────────────────────────────────────────── */
.link-primary { color: var(--green-400); font-weight: 500; text-decoration: none; }
.link-primary:hover { text-decoration: underline; }

.link-subtle { color: var(--text-secondary); font-size: 13px; text-decoration: none; }
.link-subtle:hover { color: var(--text-primary); }

/* ── Força de senha ───────────────────────────────────────── */
.password-strength { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }

.strength-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .3s ease, background .3s ease;
}

/* ── Layout principal (pós-login) ────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--green-400);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-group { margin-bottom: 4px; }

.nav-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    padding: 8px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 0;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.nav-item:hover { background: var(--gray-50); color: var(--text-primary); }

.nav-item--active {
    color: var(--green-600);
    background: var(--green-50);
}

.nav-item--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--green-400);
    border-radius: 0 2px 2px 0;
}

.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item--active svg { opacity: 1; }

/* Conteúdo principal */
.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-content { padding: 24px; flex: 1; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ── Grid responsivo ──────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Badges de status ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: var(--green-50);  color: var(--green-600); }
.badge-warning { background: #FFFBEB; color: #92400E; }
.badge-danger  { background: #FEF2F2; color: #991B1B; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }

/* ── Responsivo mobile ────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .page-content { padding: 16px; }

    .auth-card { padding: 28px 20px; }
}

/* ── Overlay sidebar mobile ───────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 90;
}

.sidebar-overlay.is-visible { display: block; }

/* ── Utilitários ──────────────────────────────────────────── */
.mt-4  { margin-top:    16px; }
.mb-4  { margin-bottom: 16px; }
.gap-4 { gap:           16px; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
