:root {
  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-soft: #edf4f5;
  --ink: #14232a;
  --muted: #687b84;
  --petrol: #083c47;
  --petrol-2: #0f5562;
  --cyan: #19788a;
  --line: #dce6e8;
  --positive: #178451;
  --positive-soft: #e7f6ee;
  --negative: #c93c3c;
  --negative-soft: #fff0ef;
  --warning: #b77a16;
  --warning-soft: #fff6df;
  --shadow: 0 12px 32px rgba(8, 60, 71, .08);
  --radius: 20px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 18px clamp(18px, 4vw, 48px); background: rgba(243,246,247,.92); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(8,60,71,.08); }
.brand-area { display: flex; gap: 14px; align-items: center; min-width: 0; }
.brand-mark { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--petrol); color: #fff; font-weight: 900; letter-spacing: -.04em; box-shadow: 0 10px 20px rgba(8,60,71,.16); flex: 0 0 auto; }
.brand-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-line h1 { margin: 0; font-size: 1.28rem; letter-spacing: -.03em; }
.brand-subtitle { margin: 2px 0 0; color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid #b7d7cd; background: var(--positive-soft); color: var(--positive); border-radius: 999px; font-size: .72rem; font-weight: 800; }
.live-badge span { width: 7px; height: 7px; border-radius: 999px; background: currentColor; box-shadow: 0 0 0 4px rgba(23,132,81,.1); }
.live-badge.offline { background: var(--warning-soft); color: var(--warning); border-color: #ead3a5; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.sync-text { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.button { border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 800; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--petrol); color: #fff; }
.button.ghost { background: var(--surface); color: var(--petrol); border: 1px solid var(--line); }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); color: var(--petrol); border-radius: 12px; font-weight: 900; }
.tabs { display: flex; gap: 8px; padding: 14px clamp(18px, 4vw, 48px) 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: transparent; color: var(--muted); font-weight: 800; padding: 10px 13px; border-radius: 11px; white-space: nowrap; }
.tab.active { background: var(--petrol); color: #fff; }
main { padding: 24px clamp(18px, 4vw, 48px) 48px; }
.panel { display: none; animation: fade .22s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: .45; transform: translateY(4px); } }
.card { background: var(--surface); border: 1px solid rgba(8,60,71,.08); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.soft-card { background: linear-gradient(145deg, #edf5f6, #ffffff); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, .8fr); gap: 18px; margin-bottom: 18px; }
.hero-copy { padding: 28px; }
.hero-copy h2 { margin: 4px 0 10px; font-size: clamp(1.6rem, 3vw, 2.55rem); line-height: 1.03; max-width: 850px; letter-spacing: -.045em; }
.hero-copy > p:not(.eyebrow) { max-width: 850px; color: var(--muted); line-height: 1.6; }
.principle { margin-top: 18px; border-left: 4px solid var(--cyan); padding: 10px 14px; color: var(--petrol); background: rgba(25,120,138,.06); border-radius: 0 12px 12px 0; font-weight: 800; }
.eyebrow { margin: 0 0 5px; color: var(--cyan); font-size: .7rem; font-weight: 900; letter-spacing: .13em; }
.month-card { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; background: var(--petrol); color: #fff; }
.month-card .eyebrow { color: #83cfdb; }
.month-card h3 { margin: 0; font-size: 1.6rem; }
.month-stat { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: .84rem; }
.month-stat span { color: #bcd2d6; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(155px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-grid.small { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.kpi { padding: 18px; min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi .label { color: var(--muted); font-size: .78rem; font-weight: 800; }
.kpi .value { font-size: clamp(1.35rem, 2vw, 1.85rem); font-weight: 900; letter-spacing: -.04em; margin: 8px 0 2px; }
.kpi .hint { color: var(--muted); font-size: .74rem; }
.positive { color: var(--positive) !important; }
.negative { color: var(--negative) !important; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 18px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 1.08rem; }
.legend { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin: 0 4px 0 9px; }
.dot.realized { background: var(--petrol-2); }
.dot.committed { background: #8db5bd; }
.canvas-wrap { width: 100%; height: 320px; }
canvas { display: block; width: 100%; height: 100%; }
.category-bars { display: grid; gap: 14px; }
.category-row { display: grid; gap: 6px; }
.category-top { display: flex; justify-content: space-between; gap: 12px; font-size: .82rem; }
.category-top strong { white-space: nowrap; }
.bar-track { height: 8px; background: #edf2f3; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--petrol-2); border-radius: 999px; }
.table-wrap { width: 100%; overflow: auto; }
.table-wrap.large { max-height: 620px; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th { position: sticky; top: 0; z-index: 2; background: var(--surface); text-align: left; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; padding: 11px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid #edf1f2; font-size: .82rem; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th.num, td.num { text-align: right; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; background: #eef3f4; color: var(--muted); font-size: .68rem; font-weight: 900; white-space: nowrap; }
.status-pill.realizado { background: var(--positive-soft); color: var(--positive); }
.status-pill.comprometido { background: var(--warning-soft); color: var(--warning); }
.status-pill.planejado, .status-pill.a-confirmar { background: #eef1f7; color: #576482; }
.text-button { background: transparent; border: 0; color: var(--cyan); font-weight: 900; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 22px; margin: 8px 0 18px; }
.section-heading h2 { margin: 3px 0 4px; font-size: clamp(1.5rem, 3vw, 2.2rem); letter-spacing: -.04em; }
.section-heading p:not(.eyebrow) { margin: 0; color: var(--muted); }
.compact-summary { text-align: right; font-weight: 900; }
.filters-card { margin-bottom: 16px; }
.filters-grid { display: grid; grid-template-columns: minmax(210px, 1.4fr) repeat(3, minmax(170px, 1fr)) auto; gap: 12px; align-items: end; }
.search-field, .filter-block { display: grid; gap: 7px; }
.search-field span, .field-label { color: var(--muted); font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.search-field input { width: 100%; border: 1px solid var(--line); background: #fbfcfc; border-radius: 12px; padding: 11px 12px; outline: none; color: var(--ink); }
.search-field input:focus { border-color: #7fb1ba; box-shadow: 0 0 0 3px rgba(25,120,138,.09); }
.check-filter { position: relative; }
.filter-toggle { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fbfcfc; border-radius: 12px; padding: 11px 12px; color: var(--ink); font-weight: 700; }
.filter-menu { position: absolute; z-index: 10; top: calc(100% + 6px); left: 0; right: 0; max-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 7px; }
.filter-option { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 9px; font-size: .8rem; }
.filter-option:hover { background: var(--surface-soft); }
.filter-option input { accent-color: var(--petrol); }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 12px; }
.filter-chip { border: 1px solid #bad2d7; color: var(--petrol); background: #edf7f8; border-radius: 999px; padding: 5px 9px; font-size: .7rem; font-weight: 800; }
.empty-state { text-align: center; padding: 36px; color: var(--muted); }
.credit-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 16px; margin-bottom: 18px; }
.credit-card-ui { min-height: 220px; padding: 24px; background: linear-gradient(135deg, #083c47, #126271); color: #fff; border-radius: 24px; box-shadow: 0 20px 38px rgba(8,60,71,.2); display: flex; flex-direction: column; justify-content: space-between; }
.credit-card-ui .muted { color: #bcd6da; }
.credit-card-ui .amount { font-size: 2rem; font-weight: 900; letter-spacing: -.04em; }
.credit-card-ui .cc-row { display: flex; justify-content: space-between; gap: 16px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stack-list { display: grid; gap: 10px; }
.stack-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; padding: 13px 0; border-bottom: 1px solid #edf1f2; }
.stack-item:last-child { border-bottom: 0; }
.stack-item .meta { color: var(--muted); font-size: .75rem; }
.stack-item .amount { font-weight: 900; text-align: right; }
.goals-list { display: grid; gap: 18px; }
.goal { display: grid; gap: 7px; }
.goal-top { display: flex; justify-content: space-between; gap: 14px; align-items: end; }
.goal-top h4 { margin: 0; }
.goal-top span { color: var(--muted); font-size: .76rem; }
.goal-progress { height: 11px; background: #edf2f3; border-radius: 999px; overflow: hidden; }
.goal-progress div { height: 100%; background: var(--petrol-2); border-radius: 999px; min-width: 0; }
.values-card { margin-top: 18px; display: grid; grid-template-columns: 1.35fr 1fr; gap: 26px; }
.values-card p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
footer { padding: 20px clamp(18px, 4vw, 48px) 32px; color: var(--muted); border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; font-size: .72rem; }
.login-gate { position: fixed; inset: 0; z-index: 100; background: rgba(6,30,35,.72); backdrop-filter: blur(12px); display: grid; place-items: center; padding: 20px; }
.login-card { width: min(520px, 100%); background: #fff; border-radius: 26px; padding: 30px; box-shadow: 0 24px 70px rgba(0,0,0,.26); }
.login-card h1 { margin: 6px 0 8px; letter-spacing: -.04em; }
.login-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.5; }
.login-card form { margin-top: 22px; }
.login-card label { display: block; color: var(--muted); font-size: .75rem; font-weight: 900; margin-bottom: 7px; }
.login-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.login-row input { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.form-error { min-height: 20px; color: var(--negative); font-size: .78rem; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; padding: 11px 14px; background: #102c33; color: #fff; border-radius: 12px; box-shadow: var(--shadow); transform: translateY(18px); opacity: 0; pointer-events: none; transition: .2s ease; font-size: .8rem; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .filters-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { align-items: flex-start; }
  .sync-text, #logoutBtn { display: none; }
  .brand-subtitle { max-width: 60vw; }
  .hero-grid, .two-column, .values-card { grid-template-columns: 1fr; }
  .kpi-grid, .kpi-grid.small { grid-template-columns: repeat(2, 1fr); }
  .credit-grid { grid-template-columns: 1fr; }
  .filters-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .compact-summary { text-align: left; }
  footer { flex-direction: column; }
}
@media (max-width: 480px) {
  .topbar { padding: 14px; }
  .brand-mark { width: 42px; height: 42px; }
  .brand-line h1 { font-size: 1.05rem; }
  .live-badge { display: none; }
  main { padding: 18px 12px 40px; }
  .tabs { padding-left: 12px; }
  .kpi-grid, .kpi-grid.small { grid-template-columns: 1fr; }
  .card { border-radius: 16px; padding: 16px; }
  .hero-copy { padding: 20px; }
  .login-row { grid-template-columns: 1fr; }
}
