:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --panel-2: #f6f7fa;
  --line: #e7e9ef;
  --text: #0f172a;
  --muted: #6b7280;
  --soft: #8a919e;
  --blue: #2563eb;
  --blue-soft: #dbe6ff;
  --navy: #1e3a8a;
  --pink: #f43f5e;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17; --panel: #131925; --panel-2: #1a2130; --line: #232b3b; --text: #e5e7eb;
    --muted: #9aa3b2; --soft: #6b7280; --blue-soft: #1e2a4a; --green-soft: #12301f; --amber-soft: #3a2d0c;
    --navy: #3b5bdb; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f17; --panel: #131925; --panel-2: #1a2130; --line: #232b3b; --text: #e5e7eb;
  --muted: #9aa3b2; --soft: #6b7280; --blue-soft: #1e2a4a; --green-soft: #12301f; --amber-soft: #3a2d0c;
  --navy: #3b5bdb; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Layout */
.app { display: grid; grid-template-columns: 240px 1fr; gap: 16px; min-height: 100vh; min-height: 100dvh; padding: 16px; }
.sidebar {
  background: var(--panel); border-radius: var(--radius); padding: 18px 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; position: sticky; top: 16px; height: calc(100vh - 32px); height: calc(100dvh - 32px);
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px 16px; }
.brand strong { display: block; font-size: 14px; }
.brand small { color: var(--muted); font-size: 12px; }
.avatars { display: flex; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--panel); flex: none;
}
.avatars .avatar + .avatar { margin-left: -8px; }
nav .group { color: var(--muted); font-size: 12px; margin: 14px 8px 6px; }
nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 13.5px;
}
nav a.active { background: var(--panel-2); font-weight: 600; }
nav a svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
nav a.active svg { color: var(--blue); }
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.theme-row { display: flex; justify-content: space-between; align-items: center; padding: 0 8px; }
.seg { display: inline-flex; background: var(--panel-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.seg button.on { background: var(--panel); box-shadow: var(--shadow); font-weight: 600; }
.profile { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.profile small { display: block; color: var(--muted); font-size: 11.5px; }

.main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.topbar {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; gap: 10px;
}
.month-nav { display: flex; align-items: center; gap: 4px; position: relative; }
.month-nav h1 { font-size: 22px; margin: 0 0 0 8px; letter-spacing: -.02em; white-space: nowrap; }
.month-nav h1 .yr { color: var(--soft); font-weight: 500; }
.month-picker { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; left: 60px; top: 30px; }
.icon-btn.menu-btn { display: none; }
.scrim { display: none; }

/* Buttons */
.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 14px;
  font-weight: 600; font-size: 13px; white-space: nowrap;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.icon-btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 50%; width: 32px; height: 32px;
  display: grid; place-items: center; font-size: 18px; line-height: 1; padding: 0;
}
.icon-btn.ghost { border-color: transparent; color: var(--muted); }
.link-btn { border: 0; background: none; color: var(--blue); font-weight: 600; padding: 0; font-size: 12.5px; }

.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .14); padding: 6px; min-width: 210px; z-index: 30; display: none;
}
.menu.open { display: block; }
.menu button { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; }

/* Panels */
.view { display: grid; gap: 16px; }
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; position: relative; }
.panel h2 { font-size: 14px; margin: 0 0 12px; font-weight: 700; }
.panel h2 .muted { font-weight: 500; font-size: 12.5px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.illus { font-size: 52px; line-height: 1; filter: drop-shadow(0 8px 10px rgba(0,0,0,.12)); user-select: none; }
.dash {
  display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: "saldo saldo pagar" "cred cred pagar" "casa cartoes moradia" "emp poup bens" "proj proj proj";
}
.a-saldo { grid-area: saldo; } .a-pagar { grid-area: pagar; } .a-casa { grid-area: casa; }
.a-cartoes { grid-area: cartoes; } .a-moradia { grid-area: moradia; } .a-proj { grid-area: proj; }
.a-emp { grid-area: emp; } .a-poup { grid-area: poup; }

.big { display: flex; align-items: baseline; gap: 6px; letter-spacing: -.03em; font-weight: 700; }
.big .cur { color: var(--soft); font-weight: 600; }
.big .cents { color: var(--soft); font-weight: 500; font-size: .5em; }
.big.xl { font-size: 46px; } .big.xl .cur { font-size: 30px; }
.big.lg { font-size: 30px; } .big.lg .cur { font-size: 20px; }
.big.md { font-size: 22px; } .big.md .cur { font-size: 15px; }
.neg { color: var(--red) !important; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: #b45309; }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.gray { background: var(--panel-2); color: var(--muted); }
.good { color: var(--green); font-weight: 600; }

.stackbar { display: flex; gap: 4px; height: 8px; margin: 18px 0 10px; }
.stackbar span { border-radius: 99px; min-width: 4px; }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.legend div { min-width: 0; }
.legend small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend b { font-size: 13px; white-space: nowrap; }
.legend .pct { color: var(--soft); font-size: 11px; font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }

/* Lists */
.rows { display: grid; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .val { font-weight: 600; white-space: nowrap; }
.row.clickable { cursor: pointer; }
.check {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--soft); background: transparent; flex: none; padding: 0;
  display: grid; place-items: center; color: #fff; font-size: 11px;
}
.check.on { background: var(--green); border-color: var(--green); }
.row.done .name span { color: var(--soft); text-decoration: line-through; }

.chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 12px 0 6px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 6px 4px; text-align: center; font-weight: 700; }
.chip small { display: block; font-size: 9px; letter-spacing: 1px; color: var(--soft); min-height: 12px; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.on small { color: #cfe0ff; }

.split-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; position: relative; margin: 8px 0 18px; font-size: 11px; font-weight: 600; color: #fff; }
.split-bar span { display: flex; align-items: center; padding: 0 8px; }
.split-bar span:last-child { justify-content: flex-end; }
.split-bar i { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--text); left: 50%; border-radius: 2px; }
.split-head { display: flex; justify-content: space-between; }
.split-head small { color: var(--muted); display: flex; align-items: center; gap: 5px; font-size: 12px; }
.split-head b { font-size: 16px; }
.settle { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); margin: 12px -18px -18px; padding: 12px 18px; font-size: 12.5px; }

/* Cards */
.card-carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -18px; padding: 4px 18px; }
.card-carousel::-webkit-scrollbar { display: none; }
.ccard {
  flex: 0 0 82%; max-width: 300px; width: 100%; aspect-ratio: 1.586; border-radius: 14px; padding: 14px; scroll-snap-align: start;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
  outline: 2px solid transparent; outline-offset: 2px; box-shadow: 0 6px 18px rgba(15, 23, 42, .18); cursor: pointer;
  background-color: #1f2937; color: #fff;
}
.ccard::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(255,255,255,.16), transparent 45%); pointer-events: none; }
.ccard.has-img::before { background: linear-gradient(180deg, rgba(0,0,0,.45), rgba(0,0,0,0) 35%, rgba(0,0,0,0) 55%, rgba(0,0,0,.6)); }
.ccard > * { position: relative; }
.ccard.sel { outline-color: var(--blue); }
.ccard .top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; gap: 8px; }
.ccard .bk { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.ccard .mid { display: flex; align-items: center; gap: 10px; }
.ccard .chip-ic { width: 32px; height: 24px; border-radius: 5px; background: linear-gradient(135deg, #f3e3a6, #b8963e); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); flex: none; }
.ccard .nm { flex: 1; text-align: center; letter-spacing: 3px; font-weight: 600; text-transform: uppercase; font-size: 12px; opacity: .95; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard .nfc { font-size: 11px; letter-spacing: -2px; opacity: .7; transform: scaleY(1.3); }
.ccard .foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; font-size: 9.5px; letter-spacing: .5px; }
.ccard .foot > span { opacity: .85; }
.ccard .foot b { display: block; font-size: 12px; letter-spacing: 0; }
.ccard .foot .lim { text-align: right; margin-left: auto; }
.ccard .tag { font-size: 10px; background: rgba(255,255,255,.22); border-radius: 99px; padding: 2px 8px; font-weight: 700; backdrop-filter: blur(4px); color: inherit; }
.ccard .tag.st-paid { background: #16a34a; color: #fff; }
.ccard .tag.st-closed { background: rgba(0,0,0,.45); color: #fff; }
.ccard .net { opacity: 1 !important; font-weight: 800; font-style: italic; font-size: 13px; display: flex; align-items: center; }
.ccard .net-mastercard i { width: 16px; height: 16px; border-radius: 50%; background: #eb001b; display: block; }
.ccard .net-mastercard i + i { background: #f79e1b; margin-left: -7px; mix-blend-mode: screen; opacity: .95; }
.ccard .net-elo { font-style: normal; text-transform: lowercase; }
.ccard.page-card { flex: 0 0 260px; max-width: 260px; }
.ccard.preview { flex: none; max-width: 300px; margin: 0 auto; cursor: default; }
.form-preview { display: flex; justify-content: center; padding: 6px 0 4px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; max-height: 196px; overflow-y: auto; padding: 2px; }
.preset { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 5px; display: grid; gap: 4px; text-align: center; }
.preset span { aspect-ratio: 1.586; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 700; padding: 2px; overflow: hidden; }
.preset small { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset.on { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-soft); }
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-top: 12px; }
.bank-item { border: 0; background: none; padding: 0; text-align: left; display: grid; gap: 4px; }
.bank-item small { color: var(--muted); font-size: 11px; }
.ccard.mini-card { max-width: 100%; flex: none; padding: 10px; }
.ccard.mini-card .foot, .ccard.mini-card .tag { display: none; }
.img-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; position: relative; }
.inv-col { border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px 10px; text-align: center; height: 130px; display: flex; flex-direction: column; justify-content: space-between; background: var(--panel); }
.inv-col.cur { border-color: var(--blue); background: linear-gradient(to bottom, transparent 40%, var(--blue-soft)); }
.inv-col b { font-size: 12px; }
.inv-col .v { font-size: 12px; font-weight: 600; color: var(--muted); }
.inv-col.cur .v { color: var(--blue); }
.inv-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.inv-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--panel); border: 1.5px solid var(--soft); transform: translate(-50%, -50%); }
.inv-dot.cur { border-color: var(--blue); width: 11px; height: 11px; }
.a-pagar .rows { max-height: 300px; overflow-y: auto; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.q { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: inherit; text-decoration: none; min-width: 0; }
.q > span { font-size: 20px; }
.q > div { min-width: 0; flex: 1; }
.q small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q b { font-size: 15px; white-space: nowrap; }
.q .progress { height: 5px; margin: 6px 0 4px; }
.label-caps { font-size: 10.5px; letter-spacing: 1px; color: var(--muted); font-weight: 700; text-transform: uppercase; margin: 14px 0 8px; }

/* Moradia */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border-radius: 10px; padding: 3px; margin: 12px 0; }
.tabs button { border: 0; background: transparent; padding: 6px; border-radius: 8px; font-size: 12.5px; }
.tabs button.on { background: var(--panel); box-shadow: var(--shadow); font-weight: 600; }
.gauge { position: relative; height: 12px; background: var(--panel-2); border-radius: 4px; margin: 26px 0 6px; }
.gauge > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--green); }
.gauge > i { position: absolute; top: -6px; bottom: -6px; width: 3px; background: var(--text); border-radius: 2px; }
.gauge > em { position: absolute; top: -22px; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-style: normal; }
.gauge-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--soft); }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini { display: flex; gap: 8px; align-items: center; min-width: 0; }
.mini .ic { width: 30px; height: 30px; border-radius: 8px; background: var(--blue-soft); display: grid; place-items: center; flex: none; font-size: 14px; }
.mini small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini b { font-size: 12.5px; white-space: nowrap; }

/* Tables & forms */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; font-weight: 600; }
td.r, th.r { text-align: right; white-space: nowrap; }
tr.clickable { cursor: pointer; }
.table-wrap { overflow-x: auto; margin: 0 -8px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat small { color: var(--muted); display: block; font-size: 12px; }
.stat b { font-size: 20px; letter-spacing: -.02em; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }
.progress { height: 10px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress span { display: block; height: 100%; background: var(--green); border-radius: 99px; }

dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--panel); color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog form { padding: 20px; display: grid; gap: 12px; max-height: 85vh; overflow-y: auto; }
dialog h3 { margin: 0 0 4px; font-size: 17px; }
.field { display: grid; gap: 5px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 9px 11px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.field.check-field { display: flex; align-items: center; gap: 8px; }
.field.check-field input { width: 18px; height: 18px; }
.field.check-field label { color: var(--text); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }
.form-actions .right { display: flex; gap: 8px; margin-left: auto; }
.error { color: var(--red); font-size: 12.5px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: var(--text); color: var(--panel);
  padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .2s; pointer-events: none; z-index: 100; font-weight: 600;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login .panel { width: min(360px, 100%); display: grid; gap: 12px; }

/* Responsivo */
@media (max-width: 1180px) {
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "saldo saldo" "cred cred" "pagar casa" "cartoes moradia" "emp poup" "bens proj"; }
}
@media (max-width: 1300px) { .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; height: 100dvh; width: 260px; z-index: 50; padding-top: calc(18px + env(safe-area-inset-top, 0px)); padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; overscroll-behavior: contain; border-radius: 0 18px 18px 0; transform: translateX(-105%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 40; display: none; }
  .scrim.open { display: block; }
  .icon-btn.menu-btn { display: grid; }
  .month-nav h1 { font-size: 18px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .dash { grid-template-columns: 1fr; grid-template-areas: "saldo" "cred" "pagar" "casa" "cartoes" "moradia" "emp" "poup" "bens" "proj"; }
  .legend, .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loan-top, .sv-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .big.xl { font-size: 38px; }
  .illus { font-size: 40px; }
  .top-actions .btn { padding: 8px 10px; }
  .month-nav #prevMonth, .month-nav #nextMonth { width: 28px; }
  .form-row { grid-template-columns: 1fr; }
}

/* Empréstimos e poupança */
.loan-row { display: block; color: inherit; text-decoration: none; padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.loan-row:last-child { border-bottom: 0; }
.loan-row .name { gap: 8px; }
.loan-top, .sv-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 6px; }
.sv-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.loan-top small, .sv-facts small { display: block; color: var(--muted); font-size: 11.5px; }
.loan-top b, .sv-facts b { font-size: 15px; }
.inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 4px; }
.inst { display: grid; place-items: center; height: 26px; border-radius: 6px; font-size: 10.5px; font-weight: 600; background: var(--panel-2); color: var(--muted); }
.inst.paga { background: var(--green); color: #fff; }
.inst.antecipada { background: #14b8a6; color: #fff; }
.inst.atrasada { background: var(--red); color: #fff; }
.inst.now { outline: 2px solid var(--blue); outline-offset: 1px; }
.inst-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.inst-legend span { display: flex; align-items: center; gap: 5px; }
.inst-legend i.inst { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.dist-in { width: 120px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 8px 10px; text-align: right; }

/* Acesso, perfil */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar { overflow: hidden; }
.avatar.lg { width: 38px; height: 38px; font-size: 14px; }
.avatar.xl { width: 72px; height: 72px; font-size: 26px; border: 0; }
.profile { justify-content: space-between; }
.profile-link { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; flex: 1; }
.profile-link .avatar { width: 32px; height: 32px; }
.profile-link b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-pick { display: flex; align-items: center; gap: 14px; }
.auth-card { width: min(420px, 100%); display: grid; gap: 12px; padding: 24px; }
.auth-card.wide { width: min(560px, 100%); }
.auth-card h2 { font-size: 20px; margin: 4px 0 0; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand img, .auth-brand .logo-anim { width: 64px; height: 64px; flex: none; }
.auth-brand b { font-size: 18px; }
.logo-anim { border-radius: 12px; box-shadow: 0 6px 18px rgba(37, 99, 235, .28); }
.logo-anim .eye { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
.logo-anim .eye + .eye { animation-delay: .04s; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.12); } }
.peek-off .logo-anim .eye { animation: none; transform: scaleY(.12); transition: transform .18s ease; }
@media (prefers-reduced-motion: reduce) { .logo-anim .eye { animation: none; } }
.auth-brand small { display: block; color: var(--muted); font-size: 12px; }
.role-pick { display: grid; gap: 6px; }
.role-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; cursor: pointer; }
.role-opt:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.role-opt input { margin-top: 3px; }
.role-opt small { display: block; color: var(--muted); font-size: 12px; }
#app[hidden] { display: none !important; }
.role-opt input[type="radio"] { width: auto; flex: none; padding: 0; }
.role-opt span { flex: 1; min-width: 0; }

.notice { background: var(--green-soft); color: var(--green); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; }
.pending-box { border: 1px solid var(--amber); }

/* Ícones low poly */
img.illus { width: 76px; height: 76px; object-fit: contain; flex: none; filter: drop-shadow(0 10px 12px rgba(15, 23, 42, .16)); user-select: none; pointer-events: none; }
img.illus.lg { width: 96px; height: 96px; }
.q-ic { width: 34px; height: 34px; object-fit: contain; flex: none; filter: drop-shadow(0 3px 4px rgba(15, 23, 42, .15)); }
.stat-ic { position: relative; padding-right: 64px; }
.stat-ic .q-ic { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; }
.menu-ic { width: 22px; height: 22px; object-fit: contain; display: inline-grid; place-items: center; flex: none; }
.menu button { align-items: center; }
@media (max-width: 720px) { img.illus { width: 58px; height: 58px; } img.illus.lg { width: 72px; height: 72px; } }
.notice.info { background: var(--blue-soft); color: var(--blue); font-weight: 500; }
.settle-ic { width: 40px; height: 40px; object-fit: contain; flex: none; margin: -6px 2px -6px -4px; filter: drop-shadow(0 3px 4px rgba(15, 23, 42, .15)); }
.emoji-ic { display: inline-grid; place-items: center; line-height: 1; }
span.illus.emoji-ic { width: 76px; height: 76px; font-size: 52px; }
span.q-ic.emoji-ic { font-size: 24px; }
span.menu-ic.emoji-ic { font-size: 16px; }

/* Crédito e dívidas */
.a-cred { grid-area: cred; }
.cred-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.cred-debt { border-left: 1px solid var(--line); padding-left: 28px; }
.cred-cards { display: grid; gap: 8px; margin-top: 12px; }
.cred-card { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.cred-card .sw { width: 30px; height: 20px; border-radius: 4px; flex: none; }
.debt-rows { display: grid; margin-top: 10px; }
.debt-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; font-size: 13px; }
.debt-row:last-child { border-bottom: 0; }
.debt-row b { white-space: nowrap; }
.a-pagar { display: flex; flex-direction: column; }
.a-pagar .rows { flex: 1 1 0; min-height: 220px; max-height: none; overflow-y: auto; }
@media (max-width: 1180px) { .a-pagar .rows { flex: none; max-height: 380px; } }
@media (max-width: 720px) { .cred-grid { grid-template-columns: 1fr; gap: 18px; } .cred-debt { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; } }

/* Hover só em mouse (no toque o :hover fica "grudado") */
@media (hover: hover) and (pointer: fine) {
  nav a:hover { background: var(--panel-2); }
  .btn:hover { background: var(--panel-2); }
  .btn.primary:hover { filter: brightness(1.08); }
  .icon-btn:hover { background: var(--panel-2); }
  .menu button:hover { background: var(--panel-2); }
  .row.clickable:hover .name span { color: var(--blue); }
  .q:hover { background: var(--panel-2); }
  tr.clickable:hover td { background: var(--panel-2); }
}

/* ---------- Celular: comportamento de app ---------- */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { overscroll-behavior: none; }
button, a, [role="button"], .chip, .preset, .role-opt, label.btn { touch-action: manipulation; }
button, .btn, .chip, .tab-bar a, .preset, .menu button { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.btn, .icon-btn, .chip, .q, .menu button, .tab-bar a, .tab-add { transition: transform 120ms ease-out, background 120ms ease-out; }
.btn:active, .icon-btn:active, .chip:active, .tab-add:active { transform: scale(.96); }
.q:active, .row.clickable:active, tr.clickable:active td, .menu button:active { background: var(--panel-2); }
@media (pointer: coarse) { input, textarea, select { font-size: 16px; } }
.card-carousel { overscroll-behavior-x: contain; }
dialog form, .a-pagar .rows, .preset-grid, .table-wrap { overscroll-behavior: contain; }

/* Barra de navegação inferior (só no celular/tablet) */
.tab-bar { display: none; }
@media (max-width: 900px) {
  .app { padding: calc(10px + env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) calc(84px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)); }
  .topbar { position: sticky; top: calc(6px + env(safe-area-inset-top, 0px)); z-index: 30; padding: 8px 10px; }
  .top-actions { display: none; }
  .month-nav { flex: 1; justify-content: center; }
  .month-nav h1 { margin: 0 4px; }
  .tab-bar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tab-bar a, .tab-bar button.tab { display: grid; justify-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 10.5px; font-weight: 600; padding: 6px 0; border: 0; background: none; }
  .tab-bar a svg, .tab-bar button.tab svg { width: 22px; height: 22px; }
  .tab-bar a.on { color: var(--blue); }
  .tab-add { justify-self: center; width: 54px; height: 54px; border-radius: 18px; border: 0; background: var(--blue); color: #fff; font-size: 28px; line-height: 1; margin-top: -18px; box-shadow: 0 8px 20px rgba(37, 99, 235, .35); display: grid; place-items: center; }
  /* "+ Adicionar" vira folha que sobe de baixo */
  .menu.sheet { position: fixed; left: max(8px, env(safe-area-inset-left, 0px)); right: max(8px, env(safe-area-inset-right, 0px)); top: auto; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); min-width: 0; border-radius: 18px; padding: 8px; display: none; grid-template-columns: 1fr 1fr; gap: 4px; z-index: 45; }
  .menu.sheet.open { display: grid; }
  .menu.sheet button { padding: 12px 10px; font-size: 14px; }
  /* Formulários como folha inferior */
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92dvh; }
  dialog form { max-height: 92dvh; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  dialog::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 0; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 720px) {
  .panel { padding: 16px; border-radius: 16px; }
  .page-head { gap: 8px; }
  .page-head > div:last-child { flex-wrap: wrap; }
  .big.lg { font-size: 26px; }
  .chips { gap: 6px; }
  .grid-3 { gap: 10px; }
  .loan-top { grid-template-columns: 1fr 1fr; }
  .sv-grid { grid-template-columns: 1fr; }
  .inst-grid { grid-template-columns: repeat(auto-fill, minmax(28px, 1fr)); }
  .settle { flex-wrap: wrap; }
  .ccard { flex-basis: 86%; }
  .auth-card { padding: 20px; }
}

/* Contas bancárias */
.cred-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cred-mid { border-left: 1px solid var(--line); padding-left: 28px; }
.cred-card .row { border: 0; padding: 0; }
.alert-bad { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border-radius: 10px; padding: 8px 10px; margin-top: 8px; font-weight: 600; font-size: 12.5px; }
.acct-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 24px; }
.acct-head { border-radius: 16px; padding: 16px; display: grid; gap: 6px; position: relative; overflow: hidden; box-shadow: 0 8px 20px rgba(15,23,42,.15); }
.acct-head::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(255,255,255,.16), transparent 45%); pointer-events: none; }
.acct-head > * { position: relative; }
.acct-top { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; }
.acct-top .tag { font-size: 10.5px; background: rgba(255,255,255,.22); border-radius: 99px; padding: 2px 8px; }
.acct-name { font-size: 18px; font-weight: 700; }
.acct-bal small { display: block; opacity: .85; font-size: 11px; }
.acct-bal b { font-size: 24px; letter-spacing: -.02em; }
.acct-head.preview { max-width: 320px; margin: 0 auto; width: 100%; }
.acct-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.acct-facts small { display: block; color: var(--muted); font-size: 11px; }
.acct-facts b { font-size: 13.5px; white-space: nowrap; }
.acct-cards { display: grid; gap: 8px; }
.acct-card { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.acct-card .sw { width: 34px; height: 22px; border-radius: 5px; flex: none; }
.acct-card small { display: block; color: var(--muted); font-size: 11.5px; }
.date-chip { font-size: 11px; font-weight: 700; background: var(--panel-2); border-radius: 6px; padding: 3px 6px; flex: none; }
.date-chip.late { background: var(--amber-soft); color: #b45309; }
.sv-ic { width: 26px; height: 26px; object-fit: contain; flex: none; }
.sv-ic.lg { width: 34px; height: 34px; }
span.sv-ic.emoji-ic { font-size: 18px; }
.mini .ic { background: none; }
img.ic { width: 30px; height: 30px; object-fit: contain; }
@media (max-width: 1180px) { .cred-grid.three { grid-template-columns: 1fr 1fr; } .cred-grid.three > :last-child { grid-column: 1 / -1; border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; } }
@media (max-width: 900px) { .acct-layout { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .cred-grid.three { grid-template-columns: 1fr; } .cred-mid { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; } }
.nowrap { white-space: nowrap; }
.cred-grid.three { gap: 22px; }
.cred-grid.three .cred-mid, .cred-grid.three .cred-debt { padding-left: 22px; }
.cred-grid.three .big.lg { font-size: 26px; }
.cred-card .row { gap: 8px; }
.cred-card .row > span:first-child { min-width: 0; flex: 1; }
.cred-grid > div { min-width: 0; }
.cred-card, .acct-card, .debt-row { min-width: 0; }

/* Conectar IA */
.token-box { margin-top: 14px; border: 1px solid var(--blue); background: var(--blue-soft); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.token-row { display: flex; gap: 8px; }
.token-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 11px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
#tokenName { font-family: inherit; font-size: 14px; }
.tabs.four { grid-template-columns: repeat(4, 1fr); }
.steps { padding-left: 20px; display: grid; gap: 8px; margin: 12px 0; }
.code { display: block; background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; overflow-x: auto; white-space: nowrap; margin-top: 4px; }
.ia-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; columns: 1; }
@media (max-width: 720px) { .token-row { flex-direction: column; } .tabs.four { grid-template-columns: 1fr 1fr; } }

/* Menu lateral: rola quando a tela é baixa (nenhum item fica escondido) */
.sidebar { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.sidebar-foot { padding-top: 12px; }
@media (min-width: 901px) and (max-height: 820px) {
  nav a { padding: 6px 10px; }
  nav .group { margin: 10px 8px 4px; }
  .brand { padding-bottom: 10px; }
}

/* Notificações */
.bell-wrap { position: relative; margin-left: auto; }
.bell-wrap .icon-btn { position: relative; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--panel); }
.notif-panel { width: min(380px, calc(100vw - 24px)); padding: 0; max-height: min(70vh, 560px); overflow: hidden; display: none; flex-direction: column; right: 0; }
.notif-panel.open { display: flex; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { overflow-y: auto; overscroll-behavior: contain; }
.notif { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif.unread { background: var(--blue-soft); }
.notif b { font-size: 13px; display: block; }
.notif p { margin: 2px 0; font-size: 12.5px; color: var(--muted); }
.notif small { font-size: 11px; color: var(--soft); }
.notif-ic { width: 30px; height: 30px; object-fit: contain; flex: none; }
.link-plain { border: 0; background: none; padding: 0; text-align: left; color: inherit; font: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; cursor: pointer; }
.link-plain:hover { color: var(--blue); }
.row.done .link-plain { color: var(--soft); text-decoration: line-through; }
.prefs { display: grid; gap: 10px; }
.pref { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.pref > input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.pref span { display: grid; gap: 3px; min-width: 0; }
.pref small { color: var(--muted); font-size: 12px; }
.pref .inline { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pref .inline input { border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 4px 6px; width: auto; max-width: 110px; }
@media (max-width: 900px) {
  .bell-wrap { margin-left: 0; }
  .notif-panel { position: fixed; top: calc(70px + env(safe-area-inset-top, 0px)); right: max(8px, env(safe-area-inset-right, 0px)); left: max(8px, env(safe-area-inset-left, 0px)); width: auto; }
}
.badge[hidden] { display: none !important; }
.notif-head a.link-btn { text-decoration: none; line-height: 1.4; }
.notif-head > div { align-items: center; }

/* Bens */
.a-bens { grid-area: bens; }
.assets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.asset-val { display: grid; gap: 4px; justify-items: start; margin-top: 6px; }
.asset-val small, .asset-facts small { color: var(--muted); font-size: 11.5px; display: block; }
.asset-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0 4px; }
.asset-facts b { font-size: 14.5px; }
.asset-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.value-chart { width: 100%; height: 90px; display: block; }
@media (max-width: 720px) { .assets-grid { grid-template-columns: 1fr; } }

/* Formulário: campos que somem conforme o tipo */
.form-row { display: flex; gap: 10px; }
.form-row > * { flex: 1 1 0; min-width: 0; }
.form-row[hidden], .field[hidden] { display: none !important; }
@media (max-width: 720px) { .form-row { flex-direction: column; } }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:disabled { opacity: .6; cursor: progress; }

/* ---------- Polimento visual ---------- */
.gi { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }
.icon-btn .gi { width: 18px; height: 18px; }
.btn .gi { width: 15px; height: 15px; margin-right: 2px; }
.check .gi { width: 12px; height: 12px; vertical-align: 0; }
.seg button { display: inline-grid; place-items: center; }
.month-nav h1 .chev .gi { width: 14px; height: 14px; vertical-align: 1px; }
.pill .gi, .small .gi, .alert-bad .gi { width: 13px; height: 13px; vertical-align: -2px; }
.avatar.xl .gi { width: 28px; height: 28px; color: #fff; }
/* Títulos de seção em texto normal (menos "robótico" que caixa alta espaçada) */
.label-caps { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); font-weight: 650; margin: 16px 0 8px; }
/* Dicas e textos pequenos com contraste de leitura */
.field .hint, .muted.small, .legend small, .asset-facts small, .loan-top small, .sv-facts small, .acct-facts small { color: var(--muted); }
.big .cents { color: var(--muted); }
/* Partes do navegador no tema do app */
::selection { background: color-mix(in srgb, var(--blue) 22%, transparent); }
html { accent-color: var(--blue); caret-color: var(--blue); scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; scrollbar-width: thin; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline-offset: -1px; }
/* Saudação no topo */
.greeting { margin-left: auto; color: var(--muted); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.greeting + .bell-wrap { margin-left: 4px; }
@media (max-width: 1100px) { .greeting { display: none; } .greeting + .bell-wrap { margin-left: auto; } }
@media (max-width: 900px) { .greeting + .bell-wrap { margin-left: 0; } }
/* Números alinhados e um pouco mais de respiro nos painéis */
.val, .big, td.r, .stat b { font-variant-numeric: tabular-nums; }
.panel h2 { letter-spacing: -.01em; }

/* Primeiros passos (sistema vazio) */
.start-guide { border: 1px solid var(--blue-soft); }
.steps-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.steps-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.steps-list li small { display: block; color: var(--muted); font-size: 12.5px; }
.steps-list li.done b { color: var(--muted); }
.step-dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--soft); display: grid; place-items: center; flex: none; color: #fff; }
.steps-list li.done .step-dot { background: var(--green); border-color: var(--green); }
.step-dot .gi { width: 13px; height: 13px; }

/* Ajuda: ícone ? e balão */
.help { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--soft); background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 700; line-height: 1; padding: 0; margin-left: 3px; vertical-align: 1px; cursor: help; flex: none; text-transform: none; letter-spacing: 0; }
.help:hover, .help:focus-visible { border-color: var(--blue); color: var(--blue); }
.help-tip { position: fixed; z-index: 300; background: var(--text); color: var(--panel); font-size: 12.5px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .25); pointer-events: none; font-weight: 500; }
.help-tip[hidden] { display: none; }
#helpTopBtn { margin-left: 4px; }
.greeting + #helpTopBtn { margin-left: 10px; }
@media (max-width: 1100px) { .greeting + #helpTopBtn { margin-left: auto; } }
@media (max-width: 900px) { #helpTopBtn { display: none; } }
/* Tour guiado */
#tourLayer { position: fixed; inset: 0; z-index: 250; }
.tour-hole { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .58); transition: all .25s ease-out; pointer-events: none; outline: 2px solid var(--blue); }
.tour-hole.none { left: 50%; top: 50%; width: 0; height: 0; outline: 0; }
.tour-pop { position: fixed; background: var(--panel); color: var(--text); border-radius: 16px; padding: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); display: grid; gap: 6px; width: min(360px, calc(100vw - 24px)); }
.tour-pop.center { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.tour-pop h3 { margin: 0; font-size: 16px; }
.tour-pop p { margin: 0 0 6px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.tour-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
@media (max-width: 720px) {
  .tour-pop:not(.center) { left: 12px !important; right: 12px; width: auto !important; top: auto !important; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .tour-hole { transition: none; } }
/* Como usar */
.howto { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.howto li { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.howto .num { width: 28px; height: 28px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 700; flex: none; }
.howto p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .howto li { flex-wrap: wrap; } }
.q small.q-t { overflow: visible; white-space: nowrap; display: flex; align-items: center; gap: 2px; }

/* Barra fina no topo enquanto carrega (só aparece se demorar). */
body::before { content: ""; position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 100; background: var(--blue, #2563eb); opacity: 0; pointer-events: none; }
body.is-loading::before { opacity: 1; animation: loadbar 1.2s ease-out infinite; }
@keyframes loadbar { 0% { width: 0; left: 0; } 60% { width: 70%; left: 10%; } 100% { width: 10%; left: 100%; } }
@media (prefers-reduced-motion: reduce) { body.is-loading::before { animation: none; width: 100%; opacity: .6; } }

/* Mascote do saldo previsto (casinha com expressão). */
.mascot { width: 76px; height: 76px; flex: none; border-radius: 18px; box-shadow: 0 10px 18px rgba(15, 23, 42, .16); overflow: visible; }
.mascot .eye { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
.mascot.mood-feliz { animation: mascot-hop 3.2s ease-in-out infinite; }
.mascot.mood-preocupado { animation: mascot-fidget 2.4s ease-in-out infinite; }
.mascot.mood-triste .eye { animation: none; }
.mascot .drop { animation: mascot-drop 2.4s ease-in infinite; }
.mascot .tear { animation: mascot-tear 2.8s ease-in infinite; }
@keyframes mascot-hop { 0%, 70%, 100% { transform: translateY(0); } 78% { transform: translateY(-5px); } 86% { transform: translateY(0); } 92% { transform: translateY(-2px); } }
@keyframes mascot-fidget { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
@keyframes mascot-drop { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(6px); opacity: 0; } }
@keyframes mascot-tear { 0% { transform: translateY(0); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(9px); opacity: 0; } }
@media (max-width: 720px) { .mascot { width: 58px; height: 58px; border-radius: 14px; } }
@media (prefers-reduced-motion: reduce) { .mascot, .mascot .eye, .mascot .drop, .mascot .tear { animation: none !important; } }
.warn { color: #b45309; }
:root[data-theme="dark"] .warn { color: #fbbf24; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .warn { color: #fbbf24; } }

/* Assinaturas */
.sub-badge { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 17px; flex: none; box-shadow: 0 3px 8px rgba(15, 23, 42, .14); }
.sub-bar { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.sub-bar .progress { margin: 0; }
.row .r { text-align: right; }
