/* ============================================================
   Bússola Financeiro — Estilo base
   Paleta: safira (navy) + verde limão, com luz quente suave (glow amarelo)
   Temas: [data-theme="dark"] (padrão) e [data-theme="light"]
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --sidebar-w: 260px;
    --transition: 180ms ease;
}

/* ---------- Tema Escuro (padrão) ---------- */
:root,
[data-theme="dark"] {
    --bg-primary: #0a0f1c;
    --bg-secondary: #0e1524;
    --bg-sidebar: #090d18;
    --bg-card: rgba(24, 34, 56, 0.55);
    --bg-card-solid: #151f34;
    --bg-input: rgba(255, 255, 255, 0.04);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-strong: rgba(255, 255, 255, 0.14);

    --text-primary: #eef1f6;
    --text-secondary: #97a2ba;
    --text-muted: #5e6a83;

    --lime: #a4d65e;
    --lime-dark: #7cb342;
    --lime-glow: rgba(164, 214, 94, 0.38);

    --teal: #21b3a0;
    --yellow-glow: #f5d78a;
    --yellow-glow-soft: rgba(245, 199, 110, 0.16);
    --yellow-glow-strong: rgba(245, 199, 110, 0.30);

    --red: #f2677d;
    --red-bg: rgba(242, 103, 125, 0.12);
    --blue: #5aa4f2;
    --blue-bg: rgba(90, 164, 242, 0.12);
    --orange: #f2a34d;
    --orange-bg: rgba(242, 163, 77, 0.12);
    --lime-bg: rgba(164, 214, 94, 0.12);

    --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* ---------- Tema Claro ---------- */
[data-theme="light"] {
    --bg-primary: #f3f5f9;
    --bg-secondary: #ffffff;
    --bg-sidebar: #101a2c;
    --bg-card: rgba(255, 255, 255, 0.72);
    --bg-card-solid: #ffffff;
    --bg-input: rgba(15, 23, 41, 0.035);
    --border-color: rgba(15, 23, 41, 0.08);
    --border-color-strong: rgba(15, 23, 41, 0.14);

    --text-primary: #16202f;
    --text-secondary: #57627a;
    --text-muted: #8894ab;

    --lime: #6ea83a;
    --lime-dark: #588a2c;
    --lime-glow: rgba(110, 168, 58, 0.28);

    --teal: #0d6157;
    --yellow-glow: #ffdf9e;
    --yellow-glow-soft: rgba(255, 214, 130, 0.35);
    --yellow-glow-strong: rgba(255, 199, 90, 0.45);

    --red: #d1495b;
    --red-bg: rgba(209, 73, 91, 0.10);
    --blue: #2f6fb0;
    --blue-bg: rgba(47, 111, 176, 0.10);
    --orange: #c97327;
    --orange-bg: rgba(201, 115, 39, 0.10);
    --lime-bg: rgba(110, 168, 58, 0.10);

    --shadow-card: 0 8px 30px rgba(20, 30, 50, 0.08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background var(--transition), color var(--transition);
    position: relative;
    overflow-x: hidden;
}

/* Luz quente ambiente (glow amarelo/lima suave ao fundo) */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
}
body::before {
    width: 520px;
    height: 520px;
    top: -180px;
    right: -120px;
    background: radial-gradient(circle, var(--yellow-glow-strong) 0%, transparent 70%);
}
body::after {
    width: 480px;
    height: 480px;
    bottom: -160px;
    left: 220px;
    background: radial-gradient(circle, var(--lime-glow) 0%, transparent 70%);
    opacity: .6;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Layout ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 22px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 18px;
}
.sidebar-brand img { width: 36px; height: 36px; border-radius: 50%; }
.sidebar-brand .brand-name { font-weight: 800; font-size: 15px; color: #fff; line-height: 1.2; }
.sidebar-brand .brand-sub { font-size: 11px; color: var(--lime); font-weight: 600; letter-spacing: .03em; }

.nav-group-title {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin: 18px 10px 8px;
    font-weight: 700;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: #b8c1d6;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background var(--transition), color var(--transition);
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active {
    background: linear-gradient(90deg, var(--lime-bg), transparent);
    color: var(--lime);
    box-shadow: inset 3px 0 0 var(--lime);
}
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

/* ---------- Main content ---------- */
.main {
    flex: 1;
    min-width: 0;
    padding: 26px 32px 60px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
    flex-wrap: wrap;
    gap: 12px;
}
.topbar h1 { font-size: 22px; margin: 0; font-weight: 800; }
.topbar .topbar-sub { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-primary);
}

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    font-size: 13px; font-weight: 600;
}
.user-chip .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--lime), var(--teal));
    display: flex; align-items: center; justify-content: center;
    color: #06110a; font-weight: 800; font-size: 12px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 22px;
}
.card + .card { margin-top: 20px; }

.card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0 0 14px;
    display: flex; align-items: center; justify-content: space-between;
}

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- KPI stat cards ---------- */
.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-card);
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.lime { background: var(--lime-bg); color: var(--lime); }
.stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat-icon.blue { background: var(--blue-bg); color: var(--blue); }
.stat-icon.orange { background: var(--orange-bg); color: var(--orange); }

.stat-value { font-size: 21px; font-weight: 800; line-height: 1.15; }
.stat-label { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

/* ---------- Tabelas ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}
tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(164,214,94,0.04); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}
.badge.lime { background: var(--lime-bg); color: var(--lime); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 700;
    border: 1px solid transparent;
    transition: transform var(--transition), filter var(--transition);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn-primary {
    background: linear-gradient(135deg, var(--lime), var(--lime-dark));
    color: #08130a;
    box-shadow: 0 4px 18px var(--lime-glow);
}
.btn-outline {
    background: var(--bg-card);
    border-color: var(--border-color-strong);
    color: var(--text-primary);
}
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Formulários ---------- */
label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 6px; }
input, select, textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--lime);
    box-shadow: 0 0 0 3px var(--lime-bg);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-group { margin-bottom: 14px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Kanban ---------- */
.kanban-board { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .kanban-board { grid-template-columns: 1fr; } }

.kanban-column {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    min-height: 200px;
}
.kanban-column-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.kanban-column-header h3 { margin: 0; font-size: 14px; }
.kanban-column.drop-hover { box-shadow: 0 0 0 2px var(--lime) inset; }

.kanban-card {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 13px 14px;
    margin-bottom: 10px;
    cursor: grab;
    transition: transform var(--transition), box-shadow var(--transition);
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.kanban-card.dragging { opacity: .4; }
.kanban-card .kc-title { font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
.kanban-card .kc-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-secondary); }
.kanban-card .kc-value { font-weight: 800; }
.kanban-card .kc-value.despesa { color: var(--red); }
.kanban-card .kc-value.entrada { color: var(--lime); }

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    position: relative; z-index: 1;
}
.login-card {
    width: 100%; max-width: 380px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 36px 32px;
    text-align: center;
}
.login-card img.logo { width: 72px; height: 72px; border-radius: 50%; margin-bottom: 14px; }
.login-card h1 { font-size: 19px; margin: 0 0 4px; font-weight: 800; }
.login-card p.sub { color: var(--text-secondary); font-size: 13px; margin: 0 0 26px; }
.login-card form { text-align: left; }
.login-error {
    background: var(--red-bg); color: var(--red);
    border-radius: var(--radius-sm); padding: 10px 12px;
    font-size: 12.5px; margin-bottom: 16px; font-weight: 600;
}

/* ---------- Utilidades ---------- */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-lime { color: var(--lime); }
.text-red { color: var(--red); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-full { width: 100%; }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13.5px;
}

.chart-container { position: relative; height: 280px; }

/* ---------- Modal ---------- */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: none; align-items: center; justify-content: center;
    background: rgba(4, 8, 16, 0.6);
    backdrop-filter: blur(4px);
    padding: 20px;
}
.modal.open { display: flex; }
.modal-box {
    width: 100%; max-width: 480px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px;
}
.modal-header h2 { font-size: 16px; margin: 0; }
.modal-close {
    width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent; color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px; font-weight: 600;
}
.tab-btn.active { background: var(--lime); color: #08130a; border-color: var(--lime); }

/* Progress bar (para categorias no relatório) */
.progress-track { height: 8px; border-radius: 6px; background: var(--bg-input); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--lime), var(--teal)); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-color-strong); border-radius: 8px; }
