:root {
    --primario: #2563eb;
    --cinza: #f6f7fb;
    --texto: #111827;
    --borda: #e5e7eb;
    --perigo: #dc2626;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    background: var(--cinza);
    color: var(--texto);
}

body.publico {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.nav-lateral {
    width: 260px;
    background: #0f172a;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.4rem;
}

.nav-topo {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 2rem;
}

.logo-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(130deg, #4361ee, #5a67f6);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-mark span,
.logo-mark span::before,
.logo-mark span::after {
    width: 6px;
    height: 20px;
    border-radius: 6px;
    background: #fff;
    content: '';
    display: block;
    position: absolute;
}

.logo-mark span { transform: rotate(-10deg); }
.logo-mark span::before { left: -10px; opacity: 0.6; }
.logo-mark span::after { right: -10px; opacity: 0.3; }

.nav-lateral nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.nav-lateral nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    font-weight: 500;
    transition: background 0.2s, padding-left 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-lateral nav a .icon {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-lateral nav a:hover { background: rgba(255,255,255,0.12); padding-left: 1.3rem; }
.nav-lateral nav a.ativo { background: #fff; color: #0f172a; padding-left: 1.3rem; }
.nav-lateral nav a.bloqueado { opacity: 0.45; }

.nav-footer {
    margin-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 1rem;
}

.nav-footer a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}

.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--cinza);
}

.topo {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem 2rem;
    background: #fff;
    border-bottom: 1px solid var(--borda);
    position: sticky;
    top: 0;
    z-index: 15;
}

.btn-menu {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: #eef2ff;
    margin-right: auto;
    cursor: pointer;
}

.btn-menu .hamburguer,
.btn-menu .hamburguer::before,
.btn-menu .hamburguer::after {
    width: 18px;
    height: 2px;
    background: #1e293b;
    display: block;
    content: '';
    position: relative;
    margin: auto;
}

.btn-menu .hamburguer::before,
.btn-menu .hamburguer::after {
    position: absolute;
    left: 0;
}

.btn-menu .hamburguer::before { top: -6px; }
.btn-menu .hamburguer::after { top: 6px; }

.user-pill {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.4rem 0.95rem;
    background: #f3f4f6;
    border-radius: 999px;
}

.user-pill strong { display: block; }
.user-pill small { color: #6b7280; }

.user-pill .avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f97316;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
}

.conteudo-principal {
    flex: 1;
    padding: 2.5rem;
}

.sidebar-overlay {
    display: none;
}

.sidebar-overlay.ativo {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    z-index: 10;
}

.hero-dashboard {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    color: #fff;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    box-shadow: 0 25px 45px rgba(37, 99, 235, 0.25);
}

.hero-dashboard h1 {
    margin: 0;
    font-size: 2rem;
}

.hero-dashboard p { margin: 0.5rem 0 1.5rem; color: rgba(255,255,255,0.85); }

.hero-dashboard .btn {
    background: #0f172a;
    color: #fff;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.insight {
    background: rgba(255,255,255,0.18);
    border-radius: 18px;
    padding: 1rem;
}

.insight strong {
    display: block;
    font-size: 1.4rem;
    margin-top: 0.4rem;
}

.bloco {
    background: #fff;
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 1.8rem;
    box-shadow: 0 10px 25px rgba(15,23,42,0.05);
}

.bloco-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1.6rem;
    cursor: pointer;
    background: var(--cinza);
    font-weight: 500;
}

.btn.primario { background: var(--primario); color: #fff; }
.btn.texto { background: transparent; color: var(--primario); }

.alert {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.alert.sucesso { background: #dcfce7; color: #166534; }
.alert.erro { background: #fee2e2; color: #b91c1c; }

.table-responsive { overflow: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 0.85rem;
    border-bottom: 1px solid var(--borda);
    text-align: left;
    font-size: 0.95rem;
}

th { color: #6b7280; font-weight: 600; }

.filtros {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.filtros input,
.filtros select {
    border-radius: 10px;
    border: 1px solid var(--borda);
    padding: 0.55rem 0.9rem;
}

.oculto { display: none; }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
}

.modal.ativo { display: flex; }

.modal-content {
    background: #fff;
    border-radius: 18px;
    padding: 1.6rem;
    width: min(600px, 100%);
    max-height: 90vh;
    overflow: auto;
}

.modal-content.grande { width: min(900px, 100%); }

.sidebar-overlay {
    display: none;
}

.sidebar-overlay.ativo {
    display: block;
}

@media (max-width: 1024px) {
    .nav-lateral {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 60;
        transition: left 0.3s;
    }
    .nav-lateral.aberta { left: 0; }
    .btn-menu { display: inline-flex; }
}
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
    padding: 1rem;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(15,23,42,0.07);
}

.card.receita { border-left: 4px solid #16a34a; }
.card.despesa { border-left: 4px solid var(--perigo); }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tabs button {
    border: none;
    background: var(--cinza);
    padding: 0.45rem 1rem;
    border-radius: 999px;
    cursor: pointer;
}
.tabs button.ativo { background: var(--primario); color: #fff; }

.tab-conteudo { display: none; }
.tab-conteudo.ativo { display: block; }

.status {
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
}
.status.aberta { background: #e0f2fe; color: #0369a1; }
.status.parcial { background: #fef3c7; color: #b45309; }
.status.paga { background: #dcfce7; color: #15803d; }
.status.vencida { background: #fee2e2; color: #b91c1c; }

.lista-simples {
    list-style: none;
    padding: 0;
    margin: 0;
}
.lista-simples li {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--borda);
}

.btn.ghost {
    background: #eef2ff;
    color: #1d4ed8;
}

.btn.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.btn.icon-left {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.btn.icon-left .icon {
    font-size: 1rem;
}

.pill {
    background: rgba(37, 99, 235, 0.15);
    color: #1d4ed8;
    border-radius: 999px;
    padding: 0.2rem 0.8rem;
    font-size: 0.85rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.8rem;
    border-radius: 999px;
    background: rgba(15,23,42,0.05);
    font-size: 0.88rem;
    font-weight: 500;
}

.chip.destaque {
    background: rgba(37,99,235,0.15);
    color: #1d4ed8;
}

.chip.neutra {
    background: rgba(15,23,42,0.08);
    color: #0f172a;
}

.badge {
    border-radius: 999px;
    padding: 0.2rem 0.9rem;
    font-size: 0.8rem;
}

.badge.sucesso { background: #dcfce7; color: #15803d; }
.badge.perigo { background: #fee2e2; color: #b91c1c; }
.badge.muted { background: #e5e7eb; color: #4b5563; }
.badge.status-ativo,
.badge.status-aberta { background: #dcfce7; color: #166534; }
.badge.status-inativo { background: #fee2e2; color: #b91c1c; }
.badge.status-vencida { background: #fee2e2; color: #b91c1c; }
.badge.status-parcial { background: #fef3c7; color: #b45309; }
.badge.status-paga { background: #d1fae5; color: #065f46; }

.perfil-hero-card {
    background: #fff;
    border-radius: 28px;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    box-shadow: 0 20px 55px rgba(15,23,42,0.08);
    gap: 2rem;
}

.hero-info h1 {
    margin: 0.4rem 0 0.2rem;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.hero-subtitle {
    color: #6b7280;
    margin: 0;
}

.back-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    background: #eef2ff;
    color: #1d4ed8;
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    font-size: 0.9rem;
}

.hero-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.perfil-panels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.perfil-panel {
    background: #fff;
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 35px rgba(15,23,42,0.05);
}

.perfil-panel dl {
    margin: 0;
}

.perfil-panel dl div {
    margin-bottom: 0.6rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.8rem;
}

.info-grid dt {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 0.1rem;
}

.info-grid dd {
    margin: 0;
    font-weight: 600;
}

.perfil-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border-radius: 18px;
    padding: 1.2rem 1.4rem;
    border: 1px solid #e0e7ff;
}

.summary-card p {
    margin: 0;
    color: #475569;
    font-weight: 600;
}

.summary-card strong {
    display: block;
    font-size: 1.6rem;
    margin: 0.4rem 0;
}

.summary-card small {
    color: #64748b;
}

.muted {
    color: #6b7280;
    font-size: 0.9rem;
}

.panel {
    background: #fff;
    border-radius: 26px;
    padding: 1.5rem 1.7rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 18px 40px rgba(15,23,42,0.07);
    margin-bottom: 1.5rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.action-group {
    display: flex;
    gap: 0.6rem;
}

.panel-actions {
    display: flex;
    gap: 0.6rem;
}

.panel-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.panel-table th {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 0.75rem 0.9rem;
}

.panel-table td {
    padding: 0.95rem 0.9rem;
    border-top: 1px solid #e5e7eb;
    font-weight: 500;
    color: #0f172a;
}

.panel-table tbody tr:first-child td {
    border-top: none;
}

.panel-table small {
    color: #94a3b8;
}

.cards-arquivos {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.arquivo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 16px;
    padding: 1rem 1.2rem;
    border: 1px solid var(--borda);
    box-shadow: inset 0 0 0 1px rgba(15,23,42,0.02);
}

.arquivo-actions .btn {
    background: #eef2ff;
}

.acao-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.table-responsive {
    overflow-x: auto;
}

.busca-arquivo {
    border-radius: 999px;
    border: 1px solid var(--borda);
    padding: 0.45rem 1rem;
}

.valor-alerta {
    color: #f97316;
    font-weight: 600;
}

.empty-state {
    background: #f8fafc;
    border: 1px dashed #cbd5f5;
    border-radius: 18px;
    padding: 1rem 1.2rem;
    color: #475569;
}

.fixed-field .fixed-display {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-weight: 600;
}

.auth {
    background: linear-gradient(120deg, #0f172a, #1f2937);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card {
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
    width: min(360px, 100%);
}

.erro-card {
    max-width: 360px;
    margin: 5rem auto;
    text-align: center;
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
}
.conteudo.publico {
    width: min(420px, 100%);
    padding: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.2rem;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0;
    position: relative;
    width: 100%;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.form-grid .span-2 {
    grid-column: span 2;
}

.form-grid .span-3 {
    grid-column: span 3;
}

.form-grid .col-compact {
    max-width: 160px;
}

.form-grid .field-search input[type="text"] {
    border-radius: 999px;
}

.field-search {
    position: relative;
}

.field-search.locked input[type="text"] {
    display: none;
}

.selection-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #eef2ff;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 0.25rem 0.8rem;
    margin-top: 0.4rem;
    font-weight: 500;
}

.selection-chip button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
}

.selection-chip.ativo button {
    display: none;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    border-radius: 10px;
    border: 1px solid var(--borda);
    padding: 0.65rem 0.9rem;
    font-size: 1rem;
}

.form-grid textarea {
    min-height: 110px;
}

.currency-field {
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 190px;
}

.currency-field span {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-weight: 600;
}

.currency-field input {
    padding-left: 46px;
}

.acoes.fixa {
    position: sticky;
    bottom: -1rem;
    background: #fff;
    padding-top: 1rem;
    border-top: 1px solid var(--borda);
    justify-content: flex-end;
    gap: 0.75rem;
}

.autocomplete {
    position: absolute;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--borda);
    border-radius: 12px;
    margin-top: 0.25rem;
    width: 100%;
    z-index: 60;
    box-shadow: 0 15px 30px rgba(15,23,42,0.12);
    max-height: 220px;
    overflow-y: auto;
}

.autocomplete button {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.6rem 1rem;
    text-align: left;
    cursor: pointer;
}

.autocomplete button:hover {
    background: var(--cinza);
}

.autocomplete-empty {
    padding: 0.75rem 1rem;
    color: #6b7280;
    font-size: 0.9rem;
}
