/* Visage Financeiro — identidade Instituto Visage (navy/verde/coral) + UI do padrão da casa */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #10141a;
  --ink-2: #4c5560;
  --muted: #8a8f96;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(16, 20, 26, 0.10);
  --accent: #173b5d;      /* navy Visage */
  --accent-ink: #fff;
  --good: #1d8a5f;        /* verde Visage escurecido p/ contraste */
  --danger: #d03b3b;
  --s0: #8a8f96;
  --s1: #173b5d; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #f16f89; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --bia: #f16f89;         /* coral — Beatriz */
  --victor: #2a78d6;      /* azul — Victor */
  --verde: #67c39c;
  --shadow: 0 1px 3px rgba(16,20,26,.08), 0 6px 24px rgba(16,20,26,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0e1622;
    --surface: #16202e;
    --ink: #ffffff;
    --ink-2: #c3c9d2;
    --muted: #8a92a0;
    --grid: #243146;
    --baseline: #33415c;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #67c39c;
    --accent-ink: #0e1622;
    --good: #4cc796;
    --danger: #e66767;
    --s1: #5b8fc7; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #f18ba0; --s6: #26a326; --s7: #9085e9; --s8: #e66767;
    --bia: #f18ba0;
    --victor: #5b8fc7;
    --shadow: none;
  }
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--baseline);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); margin: 8px 0; }
.lbl { font-size: 13px; color: var(--ink-2); display: block; margin: 8px 0 4px; }
.err { color: var(--danger); font-size: 13px; min-height: 1em; margin-top: 6px; }
.hint { font-size: 12.5px; color: var(--ink-2); background: color-mix(in srgb, var(--verde) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--verde) 40%, transparent);
  border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
.calc { font-size: 13px; color: var(--ink-2); margin: 6px 2px; line-height: 1.5; }
.calc b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ===== login ===== */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(103, 195, 156, 0.35), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(241, 111, 137, 0.25), transparent 55%),
    linear-gradient(160deg, #10263c, #173b5d 55%, #0e1622);
}
.login-card {
  width: 100%; max-width: 360px;
  background: rgba(252, 252, 251, 0.10);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35); padding: 32px 24px; text-align: center;
  color: #fff;
}
.login-logo { font-size: 34px; color: #67c39c; }
.login-card h1 { font-family: Georgia, 'Times New Roman', serif; font-style: italic;
  font-size: 30px; line-height: 1.1; margin: 8px 0 4px; font-weight: 600; }
.login-sub { color: rgba(255,255,255,.65); margin-bottom: 20px; font-size: 13.5px; }
.user-pills { display: flex; gap: 8px; margin-bottom: 12px; }
.pill {
  flex: 1; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); color: #fff; font-weight: 600;
}
.pill.on { background: #67c39c; color: #0e1622; border-color: #67c39c; }
.login .login-card input {
  background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.25); color: #fff;
}
.login .login-card input::placeholder { color: rgba(255,255,255,.5); }
#login-pass { margin-bottom: 12px; text-align: center; }
.login .btn-primary { background: #67c39c; color: #0e1622; }
.btn-primary {
  width: 100%; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700;
}
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); border-radius: 12px; padding: 12px 18px; font-weight: 600; }

/* ===== shell ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 12px;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  font-weight: 700; font-size: 18px;
  border-bottom: 1px solid var(--border);
}
.topbar-user { font-size: 13px; font-weight: 500; color: var(--muted); }
main { padding: 16px 16px 110px; max-width: 640px; margin: 0 auto; }
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; border: 0; background: none; color: var(--muted);
  font-size: 10.5px; font-weight: 600;
}
.nav-btn span { font-size: 20px; }
.nav-btn.active { color: var(--accent); }
#fab {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 72px); z-index: 21;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink);
  font-size: 30px; line-height: 1; box-shadow: var(--shadow);
}

/* ===== cards & tiles ===== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card h3 { font-size: 14px; color: var(--ink-2); font-weight: 600; margin-bottom: 10px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px; box-shadow: var(--shadow);
}
.tile .t-label { font-size: 12px; color: var(--muted); }
.tile .t-value { font-size: 19px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .t-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.tile.wide { grid-column: 1 / -1; }
.tile.hero { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000)); color: #fff; border: 0; }
.tile.hero .t-label, .tile.hero .t-sub { color: rgba(255,255,255,.75); }

/* ===== registro rápido ===== */
.quick { padding: 12px 14px; }
.qk-row { display: flex; gap: 8px; }
.qk-row input { flex: 1; font-size: 15px; }
.qk-prev { font-size: 13px; color: var(--ink-2); margin-top: 8px; min-height: 0; line-height: 1.5; }
.qk-prev b { color: var(--ink); }
.qk-prev a { color: var(--accent); font-weight: 600; }

/* ===== filtros de período ===== */
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; border: 1px solid var(--baseline); background: var(--surface);
  color: var(--ink-2); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600;
}
.chip.on { background: var(--ink); color: var(--page); border-color: var(--ink); }
.custom-range { display: flex; gap: 8px; margin-bottom: 10px; }
.custom-range label { flex: 1; margin: 0; }

/* ===== listas ===== */
.month-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 18px 4px 8px; font-weight: 700; font-size: 15px;
}
.month-head small { color: var(--muted); font-weight: 600; }
.tx {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
}
.tx .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tx .tx-main { flex: 1; min-width: 0; }
.tx .tx-desc { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .tx-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.tx .tx-val { font-weight: 700; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tx .tx-val.in { color: var(--good); }
.tx .tx-val.out { color: var(--danger); }
.tx .tx-val.neutral { color: var(--accent); }
.searchbar { display: flex; gap: 8px; margin-bottom: 10px; }

/* ===== gráficos ===== */
.chart-wrap { position: relative; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink); color: var(--page);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 1.35;
  transform: translate(-50%, calc(-100% - 8px)); white-space: nowrap;
  opacity: 0; transition: opacity .1s;
}
.chart-tip b { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.legend .li { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .lv { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
svg text { font-family: inherit; }

/* ===== barras de progresso ===== */
.progress { background: var(--grid); border-radius: 999px; height: 12px; overflow: hidden; margin: 6px 0 2px; }
.progress > div { height: 100%; border-radius: 999px; }
.prog-row { margin-bottom: 12px; }
.prog-row .p-head { display: flex; justify-content: space-between; font-size: 13px; }
.prog-row .p-sub { font-size: 12px; color: var(--muted); }

/* ===== tabelas ===== */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: right; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--grid); padding: 6px 8px; white-space: nowrap;
}
table.data td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
.c-bia { color: var(--bia); font-weight: 700; }
.c-victor { color: var(--victor); font-weight: 700; }

/* ===== modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45);
  display: grid; place-items: end center;
}
.modal-card {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--page); border-radius: 20px 20px 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px);
}
@media (min-width: 640px) { .modal { place-items: center; } .modal-card { border-radius: 20px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head h2 { font-size: 18px; }
.icon-btn { border: 0; background: var(--surface); border-radius: 50%; width: 32px; height: 32px; color: var(--ink-2); }
.seg { display: flex; gap: 6px; margin: 8px 0; }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 30%; }
.seg button {
  flex: 1; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--baseline);
  background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13px;
}
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.split-quick { display: flex; gap: 6px; }
.split-quick button {
  flex: 1; font-size: 12px; padding: 8px 4px; border-radius: 8px;
  border: 1px solid var(--baseline); background: var(--surface); color: var(--ink-2);
}
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .btn-primary { flex: 1; }
.view-toggle { display: flex; gap: 6px; margin-bottom: 12px; }
.view-toggle button {
  flex: 1; padding: 9px; border-radius: 10px; border: 1px solid var(--baseline);
  background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13.5px;
}
.view-toggle button.on { background: var(--ink); color: var(--page); border-color: var(--ink); }

/* ===== misc ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 140px);
  transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--page);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.mais-list { display: flex; flex-direction: column; gap: 8px; }
.mais-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; font-weight: 600; cursor: pointer;
}
.socio-card { border-top: 4px solid var(--baseline); }
.socio-card.bia { border-top-color: var(--bia); }
.socio-card.victor { border-top-color: var(--victor); }
.hist p { font-size: 13.5px; color: var(--ink-2); margin: 4px 0; line-height: 1.5; }
.hist b { color: var(--ink); font-variant-numeric: tabular-nums; }
.checkline { flex-direction: row !important; align-items: center; gap: 8px; font-size: 13.5px; }
.checkline input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.lock { opacity: .75; }
