/* Assessor: visual no padrão dos apps da Apple. Fundo cinza claro, cartões brancos, listas agrupadas, azul do sistema. */
:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #eeeef3;
  --fill: rgba(118, 118, 128, .12);
  --line: rgba(60, 60, 67, .16);
  --text: #000000;
  --text-2: #3c3c43cc;
  --muted: #8e8e93;
  --accent: #007aff;
  --accent-soft: #e5f0ff;
  --income: #248a3d;
  --income-mark: #34c759;
  --expense-mark: #007aff;
  --warn: #c93400;
  --danger: #d70015;
  --danger-mark: #ff3b30;
  --series-1: #34c759;      /* entradas */
  --series-2: #007aff;      /* saídas */
  --bar: #007aff;
  --ink: #000000;
  --ink-text: #ffffff;
  /* nomes antigos ainda usados no HTML */
  --iris: var(--accent); --iris-2: var(--accent); --iris-soft: var(--accent-soft);
  --radius: 12px;
  --radius-l: 16px;
  --nav-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --fill: rgba(118, 118, 128, .24);
  --line: rgba(84, 84, 88, .55); --text: #ffffff; --text-2: #ebebf5b3; --muted: #8e8e93;
  --accent: #0a84ff; --accent-soft: #0a2a4d; --income: #30d158; --income-mark: #30d158; --expense-mark: #0a84ff;
  --warn: #ff9f0a; --danger: #ff453a; --danger-mark: #ff453a; --series-1: #30d158; --series-2: #0a84ff; --bar: #0a84ff;
  --ink: #ffffff; --ink-text: #000000;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; }
body { font-family: var(--font); font-size: 17px; line-height: 1.35; letter-spacing: -.01em; -webkit-font-smoothing: antialiased; min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

#app { max-width: 600px; margin: 0 auto; padding: calc(var(--safe-t) + 8px) 16px calc(var(--nav-h) + var(--safe-b) + 28px); }

/* ---------- títulos */
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 10px 0 14px; }
.topbar h1 { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 0; line-height: 1.1; }
.topbar .sub { color: var(--muted); font-size: 15px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--fill); color: var(--accent); font-weight: 600; font-size: 15px; display: grid; place-items: center; flex: none; }
.month-nav { display: inline-flex; align-items: center; gap: 2px; background: var(--fill); border-radius: 9px; padding: 2px; }
.month-nav button { width: 30px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--accent); }
.month-nav button:active { background: var(--surface); }
.month-nav span { font-size: 15px; font-weight: 600; min-width: 64px; text-align: center; }
.acct-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.acct-chip span { color: var(--accent); font-size: 15px; font-weight: 600; }

/* ---------- cartão de saldo */
.balance { background: var(--surface); border-radius: var(--radius-l); padding: 18px 18px 6px; margin-bottom: 22px; }
.balance .cap { color: var(--muted); font-size: 15px; font-weight: 500; }
.balance .big { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 2px 0 14px; }
.balance .big small { font-size: 22px; color: var(--muted); margin-right: 4px; font-weight: 600; }
.flows { display: grid; grid-template-columns: 1fr 1fr; border-top: .5px solid var(--line); }
.flows div { padding: 12px 0 10px; }
.flows div + div { padding-left: 16px; border-left: .5px solid var(--line); }
.flows small { display: block; color: var(--muted); font-size: 13px; }
.flows b { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.flows .in b { color: var(--income); }
.today-line { margin: 0; padding: 10px 0 12px; border-top: .5px solid var(--line); color: var(--text-2); font-size: 15px; }
.today-line b { color: var(--text); }

/* ---------- ações rápidas */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px; background: var(--surface); font-size: 15px; font-weight: 500; color: var(--accent); }
.pill:active { background: var(--surface-2); }
.pill .pi { font-size: 15px; }

/* ---------- blocos */
.card { background: var(--surface); border-radius: var(--radius-l); padding: 16px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 4px 8px; }
.section-title h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.section-title button, .section-title a { color: var(--accent); font-size: 17px; }
.meter { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.meter.warn > i { background: #ff9500; }
.meter.over > i { background: var(--danger-mark); }
.budget-row { display: grid; gap: 8px; }
.budget-row .top { display: flex; justify-content: space-between; font-size: 15px; }
.budget-row .top span:last-child { color: var(--muted); }
.status { font-size: 13px; color: var(--muted); }
.status.warn { color: var(--warn); } .status.over { color: var(--danger); }
.hint { font-size: 13px; color: var(--muted); margin: 8px 4px 0; }

/* cartões de crédito */
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.credit { min-width: 230px; scroll-snap-align: start; border-radius: var(--radius-l); padding: 16px; color: #fff; background: linear-gradient(135deg, #1c1c1e, #3a3a3c); position: relative; overflow: hidden; }
.credit:nth-child(3n+2) { background: linear-gradient(135deg, #0040dd, #007aff); }
.credit:nth-child(3n+3) { background: linear-gradient(135deg, #248a3d, #34c759); }
.credit small { opacity: .8; font-size: 13px; }
.credit .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 8px 0 2px; }

/* ---------- listas agrupadas (estilo Ajustes do iPhone) */
.list { background: var(--surface); border-radius: var(--radius-l); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 9px 16px; text-align: left; position: relative; background: var(--surface); }
.item + .item::before { content: ""; position: absolute; top: 0; right: 0; left: 62px; border-top: .5px solid var(--line); }
button.item:active, .item button.main:active { background: var(--surface-2); }
.ico { width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--fill); display: grid; place-items: center; font-size: 18px; }
.item .main { flex: 1; min-width: 0; }
.item .t { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.item .amt { font-size: 17px; font-weight: 500; white-space: nowrap; }
.amt.in { color: var(--income); }
.item .chev { color: #c4c4c7; font-size: 22px; line-height: 1; }
.day-head { display: flex; justify-content: space-between; margin: 22px 4px 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.empty { text-align: center; color: var(--muted); padding: 22px 12px; font-size: 15px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.empty .pill { margin-top: 12px; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #c4c4c7; flex: none; display: grid; place-items: center; font-size: 13px; color: #fff; }
.check.on { background: var(--accent); border-color: var(--accent); }
.done .t { text-decoration: line-through; color: var(--muted); }

/* filtros */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-top: 10px; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--surface); font-size: 15px; white-space: nowrap; border: 0; color: var(--text); }
.chip.on { background: var(--accent); color: #fff; }
.search { width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px; border: 0; background: var(--fill) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" stroke="%238e8e93" stroke-width="2" stroke-linecap="round"><circle cx="7" cy="7" r="5"/><path d="m11 11 3.5 3.5"/></svg>') no-repeat 11px center; font-size: 17px; outline: none; }

/* ---------- barra de abas */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); border-top: .5px solid var(--line); padding-bottom: var(--safe-b); }
.nav-inner { max-width: 600px; margin: 0 auto; height: var(--nav-h); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.nav button { display: grid; justify-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); font-weight: 500; padding-top: 4px; }
.nav button svg { width: 25px; height: 25px; }
.nav button.on { color: var(--accent); }

/* ---------- painéis que sobem */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.25); opacity: 0; transition: opacity .25s; }
.backdrop.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 600px; margin: 0 auto; background: var(--bg); border-radius: 14px 14px 0 0; padding: 8px 16px calc(var(--safe-b) + 20px); max-height: 92dvh; overflow-y: auto; transform: translateY(100%); transition: transform .32s cubic-bezier(.32,.72,0,1); }
.sheet.show { transform: none; }
.sheet .grab { width: 36px; height: 5px; border-radius: 9px; background: #c4c4c7; margin: 0 auto 12px; }
.sheet h3 { margin: 4px 0 16px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); margin-left: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 12px 14px; border-radius: 10px; border: 0; background: var(--surface); font-size: 17px; outline: none; appearance: none; }
.field input:focus, .field select:focus, .field textarea:focus { box-shadow: 0 0 0 2px var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); padding: 2px; border-radius: 9px; margin-bottom: 14px; }
.seg button { padding: 6px 8px; border-radius: 7px; font-weight: 500; font-size: 14px; color: var(--text); }
.seg button.on { background: var(--surface); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); font-weight: 600; }
:root[data-theme="dark"] .seg button.on { background: #636366; }
.amount-input { font-size: 40px !important; font-weight: 700; text-align: center; padding: 14px !important; letter-spacing: -.03em; background: transparent !important; box-shadow: none !important; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 0 18px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 600; }
.btn:active { opacity: .8; }
.btn:disabled { opacity: .45; }
.btn.ghost { background: var(--surface); color: var(--accent); }
.btn.danger { background: var(--surface); color: var(--danger-mark); }
.btn + .btn { margin-top: 10px; }
.btn.sm { min-height: 34px; width: auto; padding: 0 14px; font-size: 15px; border-radius: 999px; }
.badge { display: inline-block; font-size: 13px; font-weight: 500; padding: 3px 10px; border-radius: 99px; background: var(--fill); color: var(--text-2); vertical-align: 1px; }
button.badge, a.badge { color: var(--accent); }
.link { color: var(--accent); font-size: 17px; padding: 10px 0; }
.quick { display: flex; gap: 8px; margin-bottom: 14px; }
.quick input { flex: 1; padding: 12px 16px; border-radius: 999px; border: 0; background: var(--surface); font-size: 17px; }
.mic { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.mic.rec { animation: pulse 1.1s infinite; background: var(--danger-mark); }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- assistente (estilo Mensagens) */
.chat { display: flex; flex-direction: column; gap: 6px; padding-bottom: 150px; }
.bubble { max-width: 80%; padding: 8px 13px; border-radius: 18px; font-size: 17px; line-height: 1.32; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; }
.bubble.bot { align-self: flex-start; background: var(--surface); }
:root:not([data-theme="dark"]) .bubble.bot { background: #e9e9eb; }
.bubble .meta { display: block; font-size: 12px; opacity: .65; margin-top: 4px; }
.bubble.typing { color: var(--muted); }
.bubble.typing i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 4px; animation: blink 1.2s infinite; }
.bubble.typing i:nth-child(2) { animation-delay: .2s; } .bubble.typing i:nth-child(3) { animation-delay: .4s; }
.bubble-actions { display: flex; gap: 8px; align-self: flex-start; }
.bubble-actions .pill { padding: 6px 12px; font-size: 14px; }
.assist-hero { text-align: center; padding: 24px 8px 12px; }
.assist-hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 10px 0 6px; }
.assist-hero p { color: var(--muted); margin: 0 auto 18px; max-width: 320px; font-size: 15px; }
.assist-hero .pills { justify-content: center; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 15; padding: 8px 12px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.composer-inner { max-width: 576px; margin: 0 auto; display: flex; align-items: center; gap: 6px; }
.composer input[type=text] { flex: 1; border: .5px solid var(--line); background: var(--surface); border-radius: 20px; padding: 8px 14px; font-size: 17px; outline: none; min-width: 0; }
.composer .attach { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; }
.composer .send { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; background: var(--accent); }
.composer .send.rec { background: var(--danger-mark); animation: pulse 1.1s infinite; }
.recbar { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: var(--surface); border-radius: 20px; height: 38px; }
.recbar .wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 26px; overflow: hidden; }
.recbar .wave i { flex: none; width: 3px; border-radius: 3px; background: var(--danger-mark); }
.recbar .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 15px; }
.recbar .cancel { color: var(--accent); font-size: 15px; }

/* ---------- análises */
.chart-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.catbar { display: grid; grid-template-columns: 34px 1fr auto; column-gap: 12px; row-gap: 6px; align-items: center; padding: 10px 0; text-align: left; width: 100%; }
.catbar + .catbar { border-top: .5px solid var(--line); }
.catbar .em { grid-row: span 3; align-self: start; width: 34px; height: 34px; border-radius: 9px; background: var(--fill); display: grid; place-items: center; font-size: 18px; }
.catbar .nm { font-size: 17px; }
.catbar .vl { font-size: 17px; font-weight: 500; }
.catbar .track { grid-column: 2 / 4; height: 6px; border-radius: 9px; background: var(--fill); position: relative; overflow: visible; }
.catbar .track i { display: block; height: 100%; border-radius: 9px; background: var(--accent); }
.catbar .track b { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--text); border-radius: 2px; }
.catbar .pc { grid-column: 2 / 4; font-size: 13px; color: var(--muted); }
.catbar.on .nm { color: var(--accent); font-weight: 600; }
svg text { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); color: var(--text); font-size: 13px; padding: 6px 10px; border-radius: 10px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: 0 4px 18px rgba(0,0,0,.16); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border-radius: var(--radius-l); padding: 12px 14px; }
.stat small { display: block; color: var(--muted); font-size: 13px; }
.stat b { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.ana-head { padding: 2px 0 10px; min-height: 84px; }
.ana-head .lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
.ana-head .val { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.ana-head .sub2 { font-size: 15px; color: var(--muted); }
.ana-chart { touch-action: pan-y; user-select: none; -webkit-user-select: none; display: block; }
.ana-chart .hit { cursor: pointer; }
.ana-nav { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.ana-nav span { font-size: 17px; font-weight: 600; }
.ana-nav button { width: 36px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--accent); }
.ana-nav button:disabled { color: #c4c4c7; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); border-top: .5px solid var(--line); margin-top: 12px; }
.kpis div { padding: 10px 0 0; min-width: 0; }
.kpis div + div { padding-left: 12px; border-left: .5px solid var(--line); }
.kpis small { display: block; font-size: 12px; color: var(--muted); }
.kpis b { font-size: 14px; font-weight: 600; white-space: nowrap; letter-spacing: -.02em; }
.sel-list-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 4px 8px; }
.sel-list-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.sel-list-head button { color: var(--accent); font-size: 15px; }
.info-card { display: flex; gap: 12px; align-items: flex-start; }
.info-card .ico { background: var(--accent-soft); color: var(--accent); }
.info-card p { margin: 2px 0 0; font-size: 15px; color: var(--text-2); }

.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 12px); transform: translateX(-50%); z-index: 70; background: var(--surface); color: var(--text); padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 500; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.18); }

/* ---------- entrada */
.login { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding: max(24px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom)); }
.login .login-top { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.mark { width: 30px; height: 30px; border-radius: 8px; background: url('icons/icon-192.png') center / cover; }
.login .brand { font-size: 17px; font-weight: 600; }
.login .login-mid { align-self: center; padding: 20px 0; }
.login h1 { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.12; margin: 0 0 10px; }
.login p { color: var(--muted); margin: 0; font-size: 17px; max-width: 420px; }
.login .actions { display: grid; gap: 10px; }
.hero-mark { width: 84px; height: 84px; border-radius: 20px; background: url('icons/icon-512.png') center / cover; box-shadow: 0 10px 30px rgba(0,122,255,.25); margin-bottom: 22px; }
.login-form { display: grid; gap: 10px; }
.login-form .group { background: var(--surface); border-radius: 12px; overflow: hidden; }
.login-form .row { display: grid; grid-template-columns: 96px 1fr; align-items: center; padding: 0 16px; min-height: 48px; position: relative; }
.login-form .row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--line); }
.login-form .row label { font-size: 17px; }
.login-form .row input { border: 0; background: none; outline: none; font-size: 17px; padding: 12px 0; width: 100%; min-width: 0; }
.login-form .otp { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.login .status { margin: 0 4px; font-size: 15px; }
.login .row-links { display: flex; justify-content: space-between; }

/* telegram */
.tg-card { display: flex; align-items: center; gap: 12px; }
.tg-card .tg-ico { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #2aabee; color: #fff; }
.tg-card .main { flex: 1; display: grid; gap: 2px; font-size: 15px; }
.tg-card .main span { color: var(--muted); font-size: 13px; }

.demo-banner { background: var(--accent-soft); color: var(--accent); font-size: 13px; text-align: center; padding: 8px; border-radius: 10px; margin-bottom: 8px; }
#nl-badge-frame { display: none !important; }

@media print {
  .nav, .composer, .no-print, .toast { display: none !important; }
  body { background: #fff; } .card, .list, .stat { border: 1px solid #ddd; }
}
