/* Siloé Financeiro — visual limpo, sóbrio, sem dependências externas */
:root {
    --ink: #16181d;
    --ink-2: #4a4f59;
    --muted: #868b95;
    --line: #e6e4df;
    --bg: #f5f4f1;
    --card: #ffffff;
    --accent: #0f766e;
    --accent-soft: #e3f2f0;
    --pos: #0f7a4f;
    --neg: #b42318;
    --warn: #b45309;
    --info: #1d4ed8;
    --side: #121418;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 18, 24, .04), 0 4px 16px rgba(16, 18, 24, .04);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 1.2em; }
p { margin: 0 0 .7em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; word-break: break-all; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.pad { padding: 18px 20px 0; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .3em; }

/* ---------- Estrutura ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px; flex-shrink: 0; background: var(--side); color: #d6d8dd;
    display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; flex: 1; }
.sidebar nav a { color: #b8bcc5; padding: 9px 12px; border-radius: 9px; font-size: .93rem; }
.sidebar nav a:hover { background: #1d2026; color: #fff; text-decoration: none; }
.sidebar nav a.active { background: #23272f; color: #fff; font-weight: 600; }
.nav-sep { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: #6b707a; padding: 18px 12px 6px; }
.sidebar-user { border-top: 1px solid #262a31; padding-top: 14px; margin-top: 14px; display: grid; gap: 2px; }
.sidebar-user strong { color: #fff; font-size: .9rem; }
.sidebar-user small { color: #8a8f99; font-size: .78rem; margin-bottom: 6px; }
.sidebar-user .btn { color: #b8bcc5; border-color: #30353d; justify-self: start; }

.main { flex: 1; min-width: 0; padding: 30px 36px 40px; max-width: 1280px; }
.foot { margin-top: 40px; font-size: .78rem; color: var(--muted); }

.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand div { display: grid; }
.brand strong { font-size: .98rem; color: #fff; }
.brand small { font-size: .74rem; color: #8a8f99; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: var(--accent); color: #fff; font-weight: 800; font-size: 1.05rem;
}
.topbar { display: none; }

.new-entry { margin: 12px 0 4px; position: relative; }
.new-entry summary { list-style: none; cursor: pointer; }
.new-entry summary::-webkit-details-marker { display: none; }
.new-entry-menu { display: grid; margin-top: 6px; background: #1d2026; border-radius: 10px; padding: 4px; }
.new-entry-menu a { color: #e3e5e9; padding: 9px 12px; border-radius: 7px; }
.new-entry-menu a:hover { background: #2a2e36; text-decoration: none; }

/* ---------- Componentes ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-head a { font-size: .85rem; }
.table-card { padding: 0; overflow: hidden; }
.table-card > h2.pad { padding-bottom: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .grid-2, .grid-2 + .card, .kpis + .grid-2 { margin-top: 18px; }
.stack { display: grid; gap: 18px; }
.stack > .card { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-bottom: 18px; }
.cards .card { margin: 0; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .9rem;
    cursor: pointer; background: none; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0b5f59; }
.btn-ghost { border-color: var(--line); background: #fff; }
.btn-ghost:hover { border-color: #cfccc5; }
.btn-danger { background: #fff; color: var(--neg); border-color: #f1c9c5; }
.btn-danger:hover { background: #fdf1f0; }
.btn-link { color: var(--accent); padding-left: 4px; padding-right: 4px; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-block { width: 100%; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: .92rem; border: 1px solid; }
.flash-success { background: #ecf8f1; border-color: #c3e8d3; color: #0d5c3b; }
.flash-error { background: #fdf1f0; border-color: #f5cbc6; color: #8f1d14; }
.flash-info { background: #eef4fd; border-color: #cddcf6; color: #1e3f7a; }
.flash-secret { background: #fff8e6; border-color: #f2dc9b; color: #6b4b00; font-family: ui-monospace, Menlo, monospace; font-size: .88rem; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.tag-ok { background: #e6f5ec; color: var(--pos); }
.tag-bad { background: #fdeceb; color: var(--neg); }
.tag-warn { background: #fdf3e3; color: var(--warn); }
.tag-info { background: #eaf0fc; color: var(--info); }
.tag-muted { background: #efeeeb; color: var(--muted); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; box-shadow: var(--shadow); color: inherit; }
.kpi span { font-size: .8rem; color: var(--muted); }
.kpi strong { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi small { font-size: .78rem; color: var(--muted); }
.kpi-main { background: var(--side); border-color: var(--side); color: #fff; }
.kpi-main span, .kpi-main small { color: #9aa0aa; }
.kpi-link:hover { border-color: #cfccc5; text-decoration: none; }
.meter { display: block; height: 6px; background: #eeece8; border-radius: 9px; overflow: hidden; margin-top: 6px; }
.meter b { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 9px; }
.meter b.over { background: var(--neg); }

.month-nav { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.month-nav a { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; font-size: 1.3rem; color: var(--ink-2); }
.month-nav a:hover { background: var(--bg); text-decoration: none; }
.month-nav strong { min-width: 150px; text-align: center; font-size: .92rem; }

/* gráficos em CSS puro */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.bar { display: block; width: 40%; max-width: 22px; height: var(--h); min-height: 2px; border-radius: 5px 5px 2px 2px; }
.bar.rec, .dot.rec { background: var(--accent); }
.bar.desp, .dot.desp { background: #d9a58c; }
.bar-col small { font-size: .75rem; color: var(--muted); }
.legend { font-size: .8rem; color: var(--muted); margin: 10px 0 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin: 0 4px 0 10px; }
.legend .dot:first-child { margin-left: 0; }
.hbars { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: .88rem; }
.hbars i { grid-column: 1 / -1; grid-row: 2; display: block; height: 7px; border-radius: 9px; background: linear-gradient(90deg, #d9a58c var(--w), #f1efeb var(--w)); }
.hbars b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Listas e tabelas ---------- */
.list { list-style: none; padding: 0; margin: 4px 0 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0eeea; }
.list li:last-child { border-bottom: 0; }
.list li > a { display: grid; color: inherit; min-width: 0; }
.list li > a:hover { text-decoration: none; }
.list li > a:hover .list-main { color: var(--accent); }
.list-main { font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: .8rem; color: var(--muted); }
.list b { font-variant-numeric: tabular-nums; white-space: nowrap; }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 11px 16px; text-align: left; border-bottom: 1px solid #f0eeea; vertical-align: top; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #fbfaf8; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: #fbfaf8; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .group-row th { background: #f7f6f3; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); padding: 8px 16px; }
.row-cancel td { color: var(--muted); }
.row-cancel td a { color: var(--muted); text-decoration: line-through; }
.row-current td { background: var(--accent-soft); }
.clip { font-size: .8rem; margin-left: 4px; }
.table form { display: inline; }

.totals { display: flex; gap: 28px; margin: 0 0 14px; padding: 0 4px; flex-wrap: wrap; }
.totals div { display: grid; }
.totals span { font-size: .78rem; color: var(--muted); }
.totals strong { font-variant-numeric: tabular-nums; }

.details { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.details dt { color: var(--muted); font-size: .88rem; }
.details dd { margin: 0; }
.amount { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.timeline li { display: grid; padding-left: 14px; border-left: 2px solid var(--line); font-size: .9rem; }
.timeline small { color: var(--muted); font-size: .78rem; }

.account h2 { margin: 2px 0; }
.account strong { font-size: 1.5rem; display: block; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.account .links { display: flex; gap: 14px; margin: 10px 0 0; font-size: .88rem; }
.is-off { opacity: .6; }

.switch { display: inline-flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 6px 0 16px; flex-wrap: wrap; }
.switch a { padding: 6px 14px; border-radius: 8px; color: var(--ink-2); font-size: .88rem; font-weight: 550; }
.switch a:hover { text-decoration: none; background: var(--bg); }
.switch a.on { background: var(--side); color: #fff; }

.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a { padding: 6px 11px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-size: .85rem; }
.pager a.on { background: var(--side); color: #fff; border-color: var(--side); }

.empty { text-align: center; padding: 50px 10px; }
.empty-code { font-size: 3rem; font-weight: 800; color: var(--line); margin: 0; }

/* ---------- Formulários ---------- */
.form { display: grid; gap: 14px; }
.form.narrow { max-width: 620px; }
label { display: grid; gap: 5px; font-size: .85rem; font-weight: 550; color: var(--ink-2); }
input, select, textarea {
    font: inherit; font-size: .95rem; color: var(--ink); background: #fff;
    border: 1px solid #dad7d0; border-radius: 9px; padding: 9px 11px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=file] { padding: 7px; background: #fbfaf8; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; }
.row > label.grow { flex: 2 1 240px; }
.row > .w-money { flex: 0 1 180px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; }
.box legend { font-size: .8rem; font-weight: 650; color: var(--ink-2); padding: 0 6px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.inline-form { gap: 10px; margin-top: 4px; }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f3f1ed; font-size: .9rem; }
.perm-row select { width: 130px; flex-shrink: 0; padding: 6px 8px; }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px; }
.filters > label { flex: 1 1 140px; }
.filters > label.grow { flex: 3 1 220px; }
.filters-actions { display: flex; gap: 8px; }
.presets { flex-basis: 100%; display: flex; gap: 14px; margin: 0; font-size: .85rem; }

.checks { list-style: none; padding: 0; margin: 0 0 14px; font-size: .88rem; display: grid; gap: 4px; }
.checks .ok { color: var(--pos); }
.checks .bad { color: var(--neg); font-weight: 600; }
.code { background: #f6f5f2; padding: 10px; border-radius: 8px; }

/* ---------- Login / instalação ---------- */
body.auth { min-height: 100vh; display: grid; place-content: center; padding: 30px 16px; background: var(--side); }
.auth-card { width: min(440px, 92vw); background: #fff; border-radius: 18px; padding: 30px; display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-card .brand strong { color: var(--ink); }
.auth-card .brand small { color: var(--muted); }
.auth-card h1 { font-size: 1.35rem; margin-top: 8px; }
.auth-card h2 { margin-top: 10px; font-size: .95rem; }
.auth-card form { display: grid; gap: 12px; }
.auth-foot { text-align: center; color: #6b707a; font-size: .78rem; margin-top: 18px; }

/* ---------- Prestação de contas (impressão) ---------- */
body.print { background: #e9e7e2; padding: 24px 12px; }
.print-actions { max-width: 820px; margin: 0 auto 12px; display: flex; gap: 8px; }
.sheet { max-width: 820px; margin: 0 auto; background: #fff; padding: 44px 48px; border-radius: 6px; font-size: .88rem; }
.sheet h1 { font-size: 1.4rem; }
.sheet h2 { margin-top: 26px; font-size: 1rem; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 22px; gap: 20px; }
.sheet-head div { display: grid; }
.sheet-head strong { font-size: 1.05rem; }
.sheet-head span { color: var(--muted); }
.sheet-head small { color: var(--muted); text-align: right; }
.sheet .table th, .sheet .table td { padding: 6px 8px; }
.sheet-summary { border-collapse: collapse; min-width: 340px; margin: 10px 0; }
.sheet-summary th { text-align: left; font-weight: 500; padding: 5px 24px 5px 0; color: var(--ink-2); }
.sheet-summary td { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-summary .strong th, .sheet-summary .strong td, .table .strong td { font-weight: 700; border-top: 1px solid var(--ink); }
.signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 70px; }
.signatures div { border-top: 1px solid var(--ink); padding-top: 6px; text-align: center; font-size: .8rem; color: var(--ink-2); }
.sheet-foot { margin-top: 40px; font-size: .72rem; color: var(--muted); }
@media print {
    @page { margin: 14mm; }
    body.print { background: #fff; padding: 0; }
    .no-print { display: none !important; }
    .sheet { padding: 0; max-width: none; border-radius: 0; }
    .table tr { break-inside: avoid; }
}

/* ---------- Celular ---------- */
@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .topbar {
        display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
        background: var(--side); padding: 10px 14px;
    }
    .menu-btn { background: none; border: 0; padding: 8px; display: grid; gap: 4px; cursor: pointer; }
    .menu-btn span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; }
    .sidebar { position: fixed; z-index: 30; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    body.menu-open .sidebar { transform: none; }
    body.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
    .brand-side { display: none; }
    .main { padding: 18px 14px 30px; }
    h1 { font-size: 1.35rem; }
    .grid-2 { grid-template-columns: 1fr; }
    .hide-sm { display: none; }
    .table th, .table td { padding: 10px 12px; }
    .details { grid-template-columns: 1fr; gap: 2px; }
    .details dd { margin-bottom: 8px; }
    .kpi strong { font-size: 1.15rem; }
    .month-nav { width: 100%; justify-content: space-between; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .sheet { padding: 22px 18px; }
    .signatures { grid-template-columns: 1fr; gap: 40px; }
}
