/* Fluxo — identidade visual própria: azul-petróleo escuro + verde-menta */
:root {
  --ink: #0B1B2B;
  --ink-2: #13283D;
  --ink-3: #1D3852;
  --mint: #12B886;
  --mint-2: #0E9F73;
  --mint-soft: #E3F8F0;
  --coral: #F0546A;
  --coral-soft: #FDE8EB;
  --amber: #F2A93B;
  --bg: #F3F5F8;
  --card: #FFFFFF;
  --line: #E4E8EE;
  --text: #0F1C2A;
  --muted: #6A7889;
  --shadow: 0 1px 2px rgba(11, 27, 43, .05), 0 6px 20px rgba(11, 27, 43, .06);
  --r: 18px;
  --tab-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1520; --card: #112233; --line: #1F3549; --text: #E8EEF5; --muted: #8DA0B3;
    --mint-soft: #0F3A2F; --coral-soft: #3D1A22;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand-lg { font-size: 30px; justify-content: center; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--mint) 0%, #5EE0B5 100%);
  position: relative; box-shadow: 0 4px 12px rgba(18, 184, 134, .35);
}
.logo::after {
  content: ''; position: absolute; inset: 8px 7px; border-radius: 3px;
  background: linear-gradient(var(--ink) 0 0) top / 100% 3px no-repeat,
              linear-gradient(var(--ink) 0 0) center / 70% 3px no-repeat,
              linear-gradient(var(--ink) 0 0) bottom / 40% 3px no-repeat;
  background-position: left top, left center, left bottom;
}
.brand-lg .logo { width: 44px; height: 44px; border-radius: 13px; }
.brand-lg .logo::after { inset: 12px 10px; }

/* ---------- login ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, #1C4A5E 0%, transparent 60%), var(--ink); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 24px; padding: 32px 26px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.auth-sub { text-align: center; color: var(--muted); margin: 8px 0 22px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100%; }
.sidebar {
  background: var(--ink); color: #DCE6F0; padding: 22px 16px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { color: #fff; padding: 4px 8px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: #A9BACB; text-decoration: none; font-weight: 600;
}
.side-nav a:hover { background: var(--ink-2); color: #fff; }
.side-nav a.ativo { background: var(--ink-3); color: #fff; }
.side-nav a.ativo .ic { color: var(--mint); }
.side-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: 8px; color: #8197AC; font-size: 14px; }
.ic { width: 22px; height: 22px; flex: none; }

.main { min-width: 0; padding: 0 32px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 0 18px; }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.view { display: grid; gap: 18px; }

.mes-nav { display: flex; align-items: center; gap: 4px; background: var(--card); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.mes-label { border: 0; background: none; font-weight: 700; padding: 6px 10px; min-width: 132px; text-transform: capitalize; }
.icon-btn { border: 0; background: none; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--muted); }
.icon-btn:hover { background: var(--bg); color: var(--text); }

.tabbar, .fab { display: none; }

/* ---------- cartões de conteúdo ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin: 0 0 14px; font-size: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h2 a, .card h2 button.link { font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

.hero {
  background: linear-gradient(135deg, var(--ink) 0%, #164257 100%); color: #fff;
  border-radius: 22px; padding: 22px 22px 18px; box-shadow: 0 12px 30px rgba(11, 27, 43, .25);
  display: grid; gap: 16px;
}
.hero-label { color: #9FB7CB; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hero-valor { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.hero-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero-pill { background: rgba(255,255,255,.07); border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.hero-pill b { display: block; font-size: 17px; }
.hero-pill small { color: #9FB7CB; font-weight: 600; }
.dot { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 16px; font-weight: 800; }
.dot.in { background: rgba(18,184,134,.18); color: #4FE0AE; }
.dot.out { background: rgba(240,84,106,.18); color: #FF8B9B; }
.olho { border: 0; background: none; color: inherit; padding: 0; opacity: .8; font-size: 15px; }

.pos { color: var(--mint-2); }
.neg { color: var(--coral); }
@media (prefers-color-scheme: dark) { .pos { color: #3DDBA4; } }

/* listas */
.lista { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item.clic { cursor: pointer; border-radius: 12px; }
.item.clic:hover { background: var(--bg); margin: 0 -10px; padding-left: 10px; padding-right: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 19px; flex: none; }
.item-main { flex: 1; min-width: 0; }
.item-tit { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-val { font-weight: 700; text-align: right; white-space: nowrap; }
.item-val small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--bg); color: var(--muted); margin-left: 4px; vertical-align: 1px; }
.tag.warn { background: #FFF2DC; color: #A86400; }
@media (prefers-color-scheme: dark) { .tag.warn { background: #3A2B10; color: #F2C26B; } }

.dia { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 14px 0 4px; }

.vazio { text-align: center; color: var(--muted); padding: 26px 10px; }
.vazio .grande { font-size: 34px; display: block; margin-bottom: 6px; }

/* barras de progresso */
.barra { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; margin-top: 6px; }
.barra i { display: block; height: 100%; border-radius: 99px; background: var(--mint); }
.barra i.alto { background: var(--amber); }
.barra i.estourou { background: var(--coral); }

/* cartão de crédito visual */
.cc { border-radius: 18px; padding: 18px; color: #fff; display: grid; gap: 14px; position: relative; overflow: hidden; cursor: pointer; }
.cc::before { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); right: -70px; top: -90px; }
.cc-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; position: relative; }
.cc-valor { font-size: 24px; font-weight: 800; position: relative; }
.cc-info { display: flex; justify-content: space-between; font-size: 13px; opacity: .85; position: relative; }
.cc .barra { background: rgba(255,255,255,.2); }
.cc .barra i { background: #fff; }

/* chips/filtros */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 7px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--muted); }
.chip.ativo { background: var(--ink); border-color: var(--ink); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.ativo { background: var(--mint); border-color: var(--mint); color: #062018; } }

.resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.resumo div { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.resumo small { color: var(--muted); font-weight: 600; font-size: 12px; display: block; }
.resumo b { font-size: 16px; }

/* botões */
.btn { border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 700; background: var(--bg); color: var(--text); }
.btn-primary { background: var(--mint); color: #04261B; }
.btn-primary:hover { background: #19C892; }
.btn-danger { background: var(--coral-soft); color: var(--coral); }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.link { border: 0; background: none; color: var(--mint-2); font-weight: 700; padding: 0; text-decoration: none; }
.sidebar .link { color: #8EE6C7; }

/* formulários */
label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; background: var(--card);
  font-size: 16px; color: var(--text); outline: none;
}
input:focus, select:focus { border-color: var(--mint); }
form { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-erro { color: var(--coral); margin: 0; font-weight: 600; font-size: 14px; min-height: 0; }
.form-erro:empty { display: none; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); }
.check input { width: 22px; height: 22px; accent-color: var(--mint); }
.input-valor { font-size: 30px; font-weight: 800; border: 0; padding: 4px 0; background: transparent; letter-spacing: -.02em; }
.input-valor:focus { border: 0; }
.cores { display: flex; gap: 8px; flex-wrap: wrap; }
.cores input { display: none; }
.cores span { width: 30px; height: 30px; border-radius: 50%; display: block; cursor: pointer; border: 3px solid transparent; }
.cores input:checked + span { border-color: var(--text); }

/* seletor de tipo */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 10px; padding: 9px 4px; font-weight: 700; color: var(--muted); font-size: 14px; }
.seg button.ativo[data-tipo="despesa"] { background: var(--coral); color: #fff; }
.seg button.ativo[data-tipo="receita"] { background: var(--mint); color: #04261B; }
.seg button.ativo[data-tipo="transferencia"] { background: var(--ink-3); color: #fff; }
.valor-box { border-radius: 16px; padding: 14px 16px; }
.valor-box.despesa { background: var(--coral-soft); }
.valor-box.receita { background: var(--mint-soft); }
.valor-box.transferencia { background: var(--bg); }
.valor-box small { font-weight: 700; color: var(--muted); }

/* modal (folha) */
.sheet-bg { position: fixed; inset: 0; background: rgba(5, 14, 24, .55); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
.sheet { background: var(--card); width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; border-radius: 22px; padding: 22px; animation: sobe .2s ease-out; }
.sheet-handle { display: none; }
.sheet h3 { margin: 0 0 16px; font-size: 19px; display: flex; justify-content: space-between; align-items: center; }
.sheet-acoes { display: flex; gap: 10px; margin-top: 4px; }
.sheet-acoes .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes sobe { from { transform: translateY(24px); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  max-width: calc(100% - 32px);
}
.toast.erro { background: var(--coral); }

.chart-box { position: relative; height: 240px; }
.legenda { display: grid; gap: 8px; margin-top: 12px; }
.legenda .item { padding: 6px 0; border: 0; }
.legenda .avatar { width: 32px; height: 32px; font-size: 15px; border-radius: 10px; }

.mais-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mais-grid a { background: var(--card); border-radius: 16px; padding: 18px; text-decoration: none; color: var(--text); font-weight: 700; box-shadow: var(--shadow); display: grid; gap: 8px; }
.mais-grid a span { font-size: 26px; }
.mais-grid a small { color: var(--muted); font-weight: 500; }

/* ---------- celular ---------- */
@media (max-width: 860px) {
  body { font-size: 15px; }
  .app { display: block; padding-bottom: calc(var(--tab-h) + var(--safe-b) + 20px); }
  .sidebar { display: none; }
  .main { padding: 0 16px 20px; }
  .topbar { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: calc(12px + env(safe-area-inset-top, 0px)) 0 12px; flex-wrap: wrap; }
  .topbar h1 { font-size: 22px; }
  .mes-label { min-width: 112px; font-size: 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .view { gap: 14px; }
  .card { padding: 16px; border-radius: 16px; }
  .hero-valor { font-size: 30px; }
  .resumo b { font-size: 14px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: var(--card); border-top: 1px solid var(--line);
  }
  .tabbar a { display: grid; place-items: center; align-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700; }
  .tabbar a.ativo { color: var(--mint-2); }
  .tabbar .vago { pointer-events: none; }
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 21; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--safe-b) + 18px); width: 58px; height: 58px; border-radius: 50%; border: 4px solid var(--bg);
    background: var(--mint); color: #04261B; font-size: 28px; font-weight: 700; box-shadow: 0 8px 22px rgba(18, 184, 134, .45);
  }

  .sheet-bg { place-items: end stretch; padding: 0; }
  .sheet { max-width: none; border-radius: 22px 22px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); max-height: 94vh; }
  .sheet-handle { display: block; width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 14px; }
  .toast { bottom: calc(var(--tab-h) + var(--safe-b) + 16px); }
}
