* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue: #2a78d6;
    --blue-dark: #1e5fa8;
    --text: #263238;
    --muted: #6b7280;
    --border: #e3e7ed;
    --surface: rgba(255,255,255,.96);
    --shadow: 0 12px 32px rgba(0,0,0,.16);
}

html, body { min-height: 100%; font-family: 'Segoe UI', Arial, sans-serif; color: var(--text); }
body {
    min-height: 100vh;
    background: linear-gradient(rgba(245,249,253,.72), rgba(245,249,253,.72)), url('../img/fundo.jpg') center/cover fixed;
    padding: 18px;
}

a { color: inherit; }
.hidden { display: none !important; }

.page-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.page-shell-form { width: min(760px, 100%); }
.form-narrow { width: min(640px, 100%); margin: 0 auto 14px; }

.form-with-list {
    display: grid;
    grid-template-columns: minmax(300px, 400px) 1fr;
    gap: 16px;
    align-items: start;
}
.form-with-list .form-card { height: 100%; }

@media (max-width: 900px) {
    .form-with-list { grid-template-columns: 1fr; }
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: rgba(255,255,255,.96);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 5px 18px rgba(0,0,0,.08);
    margin-bottom: 12px;
}
.topbar strong { font-size: 14px; }
.topbar-subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.nav-actions { display: flex; align-items: center; gap: 4px; }
.nav-link { text-decoration: none; font-size: 13px; font-weight: 600; padding: 7px 10px; border-radius: 7px; color: #4b5563; }
.nav-link:hover, .nav-link.active { background: #edf5ff; color: var(--blue-dark); }
.nav-link.logout { color: #b42318; }
.nav-link.logout:hover { background: #fff0ef; }

.form-card, .panel, .dashboard-header {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 14px;
}
.card {
    width: min(430px, 100%);
    margin: 7vh auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    box-shadow: var(--shadow);
}
.card h1 { text-align: center; margin-bottom: 18px; }
.card form { display: grid; gap: 2px; }
.card button { width: 100%; margin-top: 12px; }

.form-card { padding: 22px; }
.section-heading { margin-bottom: 16px; }
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
h1 { margin-top: 4px; font-size: 24px; line-height: 1.2; }
.section-heading p { margin-top: 4px; color: var(--muted); font-size: 13px; }

.recipe-form { display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 700; color: #4b5563; }
input, select {
    width: 100%; height: 40px; padding: 0 11px;
    border: 1px solid #d5dbe3; border-radius: 8px; background: #fff;
    color: var(--text); font: inherit; font-size: 14px;
}
input:focus, select:focus { outline: 2px solid rgba(42,120,214,.15); border-color: var(--blue); }
.primary-button, .filter-button {
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #2a78d6, #1e5fa8);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    height: 42px;
    box-shadow: 0 3px 8px rgba(42, 120, 214, 0.25);
    transition: all 0.2s ease;
}

.primary-button:hover, .filter-button:hover {
    background: linear-gradient(135deg, #347fd9, #245fa5);
    box-shadow: 0 5px 12px rgba(42, 120, 214, 0.35);
    transform: translateY(-1px);
}

.primary-button:active, .filter-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(42, 120, 214, 0.25);
}

.primary-button {
    width: 100%;
    margin-top: 2px;
    font-size: 14px;
}

.flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.flash.sucesso { background: #eaf8ee; color: #17783a; }
.flash.erro { background: #fff0ef; color: #b42318; }

/* Dashboard compacto: poucos espaços, blocos alinhados e leitura semelhante ao BI. */
.dashboard-header { padding: 12px 14px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.dashboard-header h1 { font-size: 21px; }
.filters { display: grid; grid-template-columns: minmax(160px, 1.4fr) 140px 140px 80px; gap: 7px; width: min(680px, 100%); }
.filters input, .filters select { height: 34px; font-size: 12px; }
.filter-button { height: 34px; font-size: 12px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; box-shadow: 0 5px 16px rgba(0,0,0,.07); min-height: 82px; }
.kpi-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.kpi-card strong { display: block; margin-top: 5px; font-size: 22px; line-height: 1.1; }
.kpi-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.kpi-card.accent-green { border-left: 4px solid #1a9d5a; }
.kpi-card.accent-amber { border-left: 4px solid #d68a1a; }
.kpi-card.accent-blue { border-left: 4px solid var(--blue); }

/* Bloco de destaque: saldo líquido em primeiro plano, é o número que mais importa */
.hero-card {
    background: linear-gradient(135deg, #1e5fa8, #2a78d6);
    border-radius: 14px;
    padding: 18px 22px;
    color: #fff;
    box-shadow: 0 12px 28px rgba(30,95,168,.28);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.hero-card .hero-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; opacity: .85; text-transform: uppercase; }
.hero-card .hero-value { font-size: 34px; font-weight: 800; margin-top: 2px; line-height: 1.1; }
.hero-card .hero-explain { font-size: 12px; opacity: .85; margin-top: 4px; }
.hero-breakdown { display: flex; gap: 22px; flex-wrap: wrap; }
.hero-breakdown div { text-align: right; }
.hero-breakdown span { display: block; font-size: 10.5px; opacity: .8; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.hero-breakdown strong { display: block; font-size: 17px; margin-top: 2px; }

.kpi-section-title { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 6px; }

.progress-track { width: 100%; height: 8px; border-radius: 99px; background: #e7edf5; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(135deg, #2a78d6, #1e5fa8); transition: width .3s ease; }

.status-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.status-badge.pago { background: #eaf8ee; color: #17783a; }
.status-badge.pendente { background: #fff4e6; color: #b7650a; }

.hero-card.negativo { background: linear-gradient(135deg, #a83232, #7a1f1f); box-shadow: 0 12px 28px rgba(122,31,31,.28); }

.tables-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; margin-bottom: 10px; }
@media (max-width: 1000px) {
    .tables-grid { grid-template-columns: 1fr; }
}

.charts-grid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 10px; margin-bottom: 10px; }
.panel { padding: 12px 14px; min-width: 0; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-title h2 { font-size: 14px; }
.panel-title span { color: var(--muted); font-size: 11px; }
.chart-box { height: 270px; position: relative; }
.table-panel { padding-bottom: 8px; }
.table-wrap { max-height: 290px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 7px; border-bottom: 1px solid #edf0f3; text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: #f8fafc; color: #5b6573; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.align-right { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 24px; }

.link { text-align: center; margin-top: 16px; font-size: 13px; }
.link a { color: var(--blue); text-decoration: none; font-weight: 600; }

@media (max-width: 900px) {
    .dashboard-header { align-items: stretch; flex-direction: column; }
    .filters { width: 100%; grid-template-columns: 1fr 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .hero-card { flex-direction: column; align-items: flex-start; }
    .hero-breakdown { width: 100%; justify-content: space-between; gap: 12px; }
    .hero-breakdown div { text-align: left; }
}

@media (max-width: 650px) {
    body { padding: 8px; }
    .topbar { align-items: flex-start; flex-direction: column; padding: 10px; }
    .nav-actions { width: 100%; }
    .nav-link { flex: 1; text-align: center; }
    .form-card, .panel, .dashboard-header { border-radius: 10px; }
    .form-card { padding: 16px; }
    .form-grid, .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi-card strong { font-size: 17px; }
    .filters { grid-template-columns: 1fr 1fr; }
    .chart-box { height: 230px; }
}

@media (max-width: 430px) {
    .form-grid, .kpi-grid, .filters { grid-template-columns: 1fr; }
}
