/* Icons: SVG inline com classe .ti, dimensionados via font-size */
.ti { display: inline-flex; vertical-align: -2px; width: 1em; height: 1em; }
.ti svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #FAFAFA; color: #222; font-size: 13px; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* App layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #000; color: #fff; padding: 22px 0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sb-brand { padding: 0 22px 18px; display: flex; flex-direction: column; gap: 6px; }
.sb-logo { line-height: 0; }
.sb-logo-img { display: block; width: auto; max-width: 112px; max-height: 34px; height: auto; }
.sb-role { font-size: 11px; color: #888; margin-top: 3px; }
/* Nome da empresa ativa, abaixo do "Smart" */
.sb-empresa { font-size: 12px; font-weight: 500; color: #fff; margin-top: 6px; padding: 4px 8px; background: rgba(255,255,255,0.08); border-radius: 6px; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tela de escolha de empresa (login) + tag "principal" */
.empresa-lista { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.empresa-opt { display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px 14px; border: 0.5px solid rgba(0,0,0,0.12); border-radius: 10px; background: #fff; cursor: pointer; font-family: inherit; transition: all 0.15s; text-align: left; }
.empresa-opt:hover { border-color: #6D28D9; background: #FAF8FF; }
.empresa-opt-ini { width: 34px; height: 34px; background: #6D28D9; color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 14px; flex-shrink: 0; }
.empresa-opt-nome { flex: 1; font-size: 13px; font-weight: 500; color: #222; }
.empresa-tag { font-size: 9px; font-weight: 600; color: #6D28D9; background: #EEF2FF; padding: 2px 6px; border-radius: 4px; vertical-align: middle; margin-left: 4px; }

/* Hero do modal "Adicionar empresa" (temática roxa Easely) */
.ne-hero { display: flex; gap: 13px; align-items: center; padding: 16px 22px; background: linear-gradient(135deg, #F5F3FF, #EEF2FF); border-bottom: 0.5px solid rgba(0,0,0,0.06); }
.ne-hero-icon { width: 42px; height: 42px; flex-shrink: 0; background: #6D28D9; color: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.ne-hero-icon i { font-size: 22px; }
.ne-hero-txt { font-size: 12px; color: #4338CA; line-height: 1.5; }

/* Popup de pagamento do trial */
.pg-hero { display: flex; gap: 13px; align-items: center; padding: 16px 22px; background: linear-gradient(135deg, #F5F3FF, #EEF2FF); border-bottom: 0.5px solid rgba(0,0,0,0.06); }
.pg-hero-icon { width: 42px; height: 42px; flex-shrink: 0; background: #16A34A; color: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.pg-hero-icon i { font-size: 22px; }
.pg-hero-txt { font-size: 12px; color: #312E81; line-height: 1.5; }
.pg-tabs { display: flex; gap: 6px; background: #F3F4F6; padding: 4px; border-radius: 9px; margin-bottom: 16px; }
.pg-tab { flex: 1; padding: 9px; border: 0; border-radius: 6px; background: transparent; font-size: 13px; font-weight: 500; color: #666; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.pg-tab.active { background: #fff; color: #6D28D9; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.pg-placeholder { border: 1px dashed rgba(0,0,0,0.15); border-radius: 10px; padding: 28px 16px; text-align: center; color: #888; font-size: 13px; }
.pg-placeholder i { font-size: 30px; color: #bbb; display: block; margin-bottom: 8px; }
.pg-placeholder strong { color: #555; }
.pg-placeholder-sub { font-size: 10px; color: #aaa; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.pg-painel { min-height: 60px; }
.pg-benefits { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.pg-benefits li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; }
.pg-benefits li i { color: #16A34A; font-size: 15px; flex-shrink: 0; }
.pg-info { font-size: 11px; color: #9CA3AF; margin: 0; display: flex; align-items: center; gap: 5px; }
.pg-periodo-toggle { display: flex; gap: 6px; background: #F3F4F6; padding: 4px; border-radius: 9px; margin-bottom: 14px; }
.pg-periodo-btn { flex: 1; padding: 8px; border: 0; border-radius: 6px; background: transparent; font-size: 13px; font-weight: 500; color: #666; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.pg-periodo-btn.active { background: #fff; color: #6D28D9; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.pg-preco-box { text-align: center; padding: 12px 0 16px; }
.pg-preco-valor { font-size: 30px; font-weight: 700; color: #111827; }
.pg-preco-unit { font-size: 14px; font-weight: 400; color: #6B7280; }
.pg-preco-total { font-size: 12px; color: #6B7280; margin-top: 4px; }
.pg-desconto-badge { display: inline-block; background: #D1FAE5; color: #065F46; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
.pg-trial-badge { background: #EEF2FF; color: #3730A3; border-radius: 8px; padding: 10px 14px; font-size: 12px; margin-bottom: 14px; display: flex; align-items: center; gap: 7px; }
.pg-loading { text-align: center; padding: 24px 0; color: #9CA3AF; font-size: 13px; }
.sb-item { padding: 11px 22px; font-size: 13px; color: #ccc; display: flex; align-items: center; gap: 11px; cursor: pointer; transition: background 0.15s; border-left: 3px solid transparent; padding-left: 19px; }
.sb-item:hover { background: #1a1a1a; color: #fff; }
.sb-item i { font-size: 16px; }
.sb-item.active { background: #1a1a1a; border-left-color: #6366F1; color: #fff; }
.sb-badge { margin-left: auto; background: #F59E0B; color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 8px; font-weight: 500; }
.sb-section { padding: 18px 22px 6px; font-size: 9px; color: #555; letter-spacing: 1px; text-transform: uppercase; }
.sb-foot { position: absolute; bottom: 0; left: 0; right: 0; padding: 14px 22px; font-size: 10px; color: #555; border-top: 1px solid #1a1a1a; background: #000; }

.main { flex: 1; min-width: 0; padding: 26px 30px 40px; overflow-x: hidden; }
.page { display: none; animation: fade 0.2s ease-out; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 18px; font-weight: 500; }
.page-sub { font-size: 12px; color: #777; margin-top: 2px; }

/* Reusable */
.card { background: #fff; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 12px; padding: 18px 20px; }
.card-soft { background: #FAFAFA; border-radius: 10px; padding: 12px 14px; }
.pill { font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.pill-good { background: #ECFDF5; color: #047857; }
.pill-bad { background: #FEF2F2; color: #B91C1C; }
.pill-warn { background: #FFFBEB; color: #B45309; }
.pill-neutral { background: #F5F5F7; color: #555; }
.pill-info { background: #EEF2FF; color: #4F46E5; }

.btn { font-size: 12px; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 500; border: 0.5px solid rgba(0,0,0,0.08); background: #fff; color: #333; display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s; font-family: inherit; }

/* Seletor de mes de competencia (DRE/Visao Geral/Indicadores). Tinha ficado sem
   estilo proprio e renderizava com a aparencia nativa do navegador (as vezes um
   retangulo azul). Aqui ele herda o visual dos .btn pra ficar consistente. */
.sel-mes-competencia { font-size: 12px; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; border: 0.5px solid rgba(0,0,0,0.08); background: #fff; color: #333; font-family: inherit; min-width: 130px; height: 34px; }
.sel-mes-competencia:hover { background: #F5F5F7; }
.btn:hover { background: #F5F5F7; }
.btn-primary { background: #6366F1; color: #fff; border-color: #6366F1; }
.btn-primary:hover { background: #4F46E5; }
.btn-warn { background: #B45309; color: #fff; border-color: #B45309; }
.btn-warn:hover { background: #92400E; }
.btn-small { font-size: 11px; padding: 6px 11px; }

select, input[type="text"], input[type="search"] { font-family: inherit; font-size: 12px; padding: 8px 11px; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 6px; background: #fff; color: #222; outline: none; }
select:focus, input:focus { border-color: #6366F1; box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* Hero */
.hero { display: flex; gap: 26px; align-items: center; margin-bottom: 22px; }
.hero-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hero-icon.purple { background: #EEF2FF; color: #4F46E5; }
.hero-icon i { font-size: 32px; }
.hero-body { flex: 1; }
.hero-label { font-size: 13px; color: #666; margin-bottom: 6px; }
.hero-value { font-size: 38px; font-weight: 500; color: #111; line-height: 1; }

.divider { height: 1px; background: #F0F0F0; margin: 16px 0; }

.stat-label { font-size: 11px; color: #888; margin-bottom: 5px; letter-spacing: 0.3px; }
.stat-value { font-size: 20px; font-weight: 500; }
.stat-value.good { color: #047857; }
.stat-value.bad { color: #B91C1C; }
.stat-value.muted { color: #555; }
.stat-sub { font-size: 11px; color: #777; margin-top: 2px; }

/* Alerts */
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 13px 16px; border-radius: 10px; border: 0.5px solid; }
.alert i { font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.alert-title { font-size: 12px; font-weight: 500; margin-bottom: 4px; }
.alert-text { font-size: 11px; line-height: 1.5; }
.alert-text strong { font-weight: 500; }
.alert-action { font-size: 11px; cursor: pointer; margin-top: 5px; display: inline-block; font-weight: 500; }
.alert-danger { background: #FEF2F2; border-color: #FECACA; }
.alert-danger i, .alert-danger .alert-title { color: #B91C1C; }
.alert-danger .alert-title { color: #7F1D1D; }
.alert-danger .alert-text { color: #991B1B; }
.alert-warn { background: #FFFBEB; border-color: #FDE68A; }
.alert-warn i { color: #B45309; }
.alert-warn .alert-title { color: #78350F; }
.alert-warn .alert-text { color: #92400E; }
.alert-warn .alert-action { color: #B45309; }
.alert-info { background: #EEF2FF; border-color: #C7D2FE; }
.alert-info i, .alert-info .alert-action { color: #4F46E5; }
.alert-info .alert-title { color: #312E81; }
.alert-info .alert-text { color: #4338CA; }

/* Bars */
.bar-row { margin-bottom: 14px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 6px; }
.bar-left { display: flex; align-items: center; gap: 8px; }
.bar-left i { font-size: 15px; }
.bar-name { font-weight: 500; font-size: 13px; }
.bar-tag { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }
.bar-tag.alta { background: #FEE2E2; color: #B91C1C; }
.bar-tag.media { background: #F3F4F6; color: #6B7280; }
.bar-tag.baixa { background: #DCFCE7; color: #047857; }
.bar-val { font-weight: 500; font-size: 13px; }
.bar-track { background: #F5F5F7; height: 7px; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-overlay.open { display: flex; animation: fade 0.15s ease-out; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 540px; overflow: hidden; max-height: 90vh; overflow-y: auto; }
.modal-head { padding: 18px 22px 14px; border-bottom: 0.5px solid rgba(0,0,0,0.08); display: flex; justify-content: space-between; align-items: flex-start; }
.modal-title { font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.modal-sub { font-size: 11px; color: #777; }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 14px 22px; background: #FAFAFA; border-top: 0.5px solid rgba(0,0,0,0.08); display: flex; justify-content: space-between; align-items: center; }

/* Campos do modal de Nova categoria */
.nc-field { margin-bottom: 16px; }
.nc-field label { display: block; font-size: 12px; font-weight: 500; color: #444; margin-bottom: 6px; }
.nc-field input[type="text"] { width: 100%; padding: 10px 12px; border: 0.5px solid rgba(0,0,0,0.14); border-radius: 8px; font-size: 13px; font-family: inherit; box-sizing: border-box; }
.nc-field input[type="text"]:focus { outline: none; border-color: #6D28D9; }
.nc-tipos { display: flex; gap: 10px; }
.nc-tipo { flex: 1; display: flex; align-items: center; gap: 7px; padding: 10px 12px; border: 0.5px solid rgba(0,0,0,0.14); border-radius: 8px; font-size: 12.5px; color: #444; cursor: pointer; }
.nc-tipo input { accent-color: #6D28D9; }
.nc-tipo:has(input:checked) { border-color: #6D28D9; background: #F5F3FF; color: #5B21B6; font-weight: 500; }
.nc-erro { font-size: 12px; color: #DC2626; min-height: 16px; }

/* Campos de horário da atualização automática (tela admin) */
.cfg-hora { padding: 8px 10px; border: 0.5px solid rgba(0,0,0,0.14); border-radius: 8px; font-size: 13px; font-family: inherit; }
.cfg-hora:focus { outline: none; border-color: #6D28D9; }

/* Banner global de reconexão (topo do portal, qualquer tela) */
.banner-reconexao { display: flex; align-items: center; gap: 12px; background: #FEF2F2; border: 0.5px solid #FCA5A5; color: #991B1B; padding: 12px 18px; border-radius: 10px; margin: 18px 24px 0; font-size: 13px; }
.banner-reconexao i { font-size: 18px; flex-shrink: 0; }
.banner-reconexao span { flex: 1; }
.banner-reconexao .btn { background: #B91C1C; color: #fff; border-color: #B91C1C; flex-shrink: 0; }
.banner-reconexao .btn:hover { background: #991B1B; }

/* Banner de read-only (dia 14 sem pagamento) — tom roxo (ação de ativar, não erro) */
.banner-readonly { display: flex; align-items: center; gap: 12px; background: #F5F3FF; border: 0.5px solid #C4B5FD; color: #5B21B6; padding: 12px 18px; border-radius: 10px; margin: 18px 24px 0; font-size: 13px; }
.banner-readonly i { font-size: 18px; flex-shrink: 0; }
.banner-readonly span { flex: 1; }
.banner-readonly .btn { background: #6D28D9; color: #fff; border-color: #6D28D9; flex-shrink: 0; }
.banner-readonly .btn:hover { background: #5B21B6; }

.icon-btn { cursor: pointer; color: #888; padding: 4px; border-radius: 4px; }
.icon-btn:hover { background: #F5F5F7; color: #333; }

/* Onboarding overlay */
.ob-overlay { position: fixed; inset: 0; background: #FAFAFA; z-index: 50; overflow-y: auto; display: none; }
.ob-overlay.open { display: block; }
.ob-wrap { max-width: 900px; margin: 0 auto; padding: 40px 32px; }
.ob-close { position: absolute; top: 24px; right: 32px; cursor: pointer; color: #666; font-size: 13px; display: flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 6px; background: #fff; border: 0.5px solid rgba(0,0,0,0.08); }
.ob-close:hover { background: #F5F5F7; }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 8px; margin-bottom: 32px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; }
.step-circle { width: 26px; height: 26px; border-radius: 50%; background: #F5F5F7; color: #888; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; }
.step-circle.done { background: #10B981; color: #fff; }
.step-circle.active { background: #6366F1; color: #fff; }
.step-label { font-size: 12px; color: #888; }
.step.done .step-label { color: #047857; }
.step.active .step-label { color: #4F46E5; font-weight: 500; }
.step-line { flex: 0 0 40px; height: 2px; background: #E5E7EB; }
.step-line.done { background: #10B981; }

/* Tables */
.tx-list { background: #fff; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 10px; overflow: hidden; }
.tx-day { padding: 9px 16px; background: #FAFAFA; font-size: 11px; color: #666; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.tx-day:not(:first-child) { border-top: 0.5px solid #F0F0F0; }
.tx-day-sub { font-size: 10px; color: #888; font-weight: 400; }
.tx-day-sub strong { color: #047857; font-weight: 500; }
.tx-row { display: grid; grid-template-columns: 30px 1fr 250px 130px; gap: 12px; padding: 12px 16px; font-size: 12px; align-items: center; border-top: 0.5px solid #F0F0F0; }
.tx-row.pending { background: #FFFBEB; border-top: 0.5px solid #FDE68A; border-bottom: 0.5px solid #FDE68A; }
.tx-name { font-weight: 500; }
.tx-meta { font-size: 10px; color: #888; }
.tx-row.pending .tx-meta { color: #B45309; }
.tx-amount { text-align: right; font-weight: 500; font-size: 13px; }
.tx-amount.in { color: #047857; }
.tx-amount.out { color: #B91C1C; }
.tx-icon { font-size: 17px; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 0.5px solid rgba(0,0,0,0.08); flex-wrap: wrap; }
.tab { font-size: 12px; padding: 9px 14px; background: transparent; border: none; color: #666; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: #333; }
.tab.active { color: #4F46E5; border-bottom-color: #6366F1; font-weight: 500; }
.tab-count { padding: 1px 6px; border-radius: 8px; font-size: 10px; margin-left: 4px; }
.tab.active .tab-count { background: #EEF2FF; color: #4F46E5; }

/* Filter bar */
.filter-bar { background: #fff; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 8px; padding: 11px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #888; font-size: 13px; }
.search-wrap input { width: 100%; padding: 7px 10px 7px 30px; font-size: 11px; }

/* Evolution chart */
.evol-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.evol-col { text-align: center; }
.evol-col.current { background: #F5F3FF; border-radius: 8px; padding: 6px 0; }
.evol-sem { font-size: 10px; color: #888; margin-bottom: 8px; }
.evol-col.current .evol-sem { color: #6D28D9; font-weight: 500; }
.evol-bars { height: 100px; display: flex; align-items: flex-end; justify-content: center; }
.evol-bar { background: #10B981; width: 50px; border-radius: 4px 4px 0 0; }
.evol-val { font-size: 13px; font-weight: 500; margin-top: 8px; }

/* Modal categorize */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.cat-opt { border: 0.5px solid rgba(0,0,0,0.08); border-radius: 8px; padding: 11px 12px; cursor: pointer; display: flex; align-items: center; gap: 9px; transition: all 0.15s; background: #fff; }
.cat-opt:hover { background: #F5F5F7; }
.cat-opt.selected { border: 2px solid #6366F1; background: #EEF2FF; padding: 10px 11px; }
.cat-opt i { font-size: 17px; }
.cat-opt-name { font-size: 12px; font-weight: 500; flex: 1; }
.cat-opt.selected .cat-opt-name { color: #312E81; }
.cat-opt .cat-check { display: none; color: #4F46E5; font-size: 14px; }
.cat-opt.selected .cat-check { display: inline-block; }

/* Onboarding banks grid */
.bank-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 700px; margin-bottom: 22px; }
.bank { background: #fff; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 8px; padding: 14px; cursor: pointer; position: relative; transition: all 0.15s; }
.bank:hover { border-color: #6366F1; }
.bank.selected { border: 2px solid #6366F1; padding: 13px; }
.bank.selected::after { content: ""; position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; background: #6366F1; border-radius: 50%; }
.bank.selected::before { content: "✓"; position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; z-index: 2; }
.bank-logo { position: relative; width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 500; font-size: 13px; margin-bottom: 8px; overflow: hidden; }
/* Logo oficial sobreposta à inicial colorida. Se o PNG não existir, o onerror
   remove a img e a inicial colorida (fallback) reaparece — não quebra nada. */
/* A logo da Pluggy já vem com o fundo/recorte da marca. object-fit: contain
   evita corte; o fundo branco neutraliza a cor da inicial (fallback) por baixo. */
.bank-logo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.bank-name { font-size: 12px; font-weight: 500; }
.bank-tag { font-size: 10px; color: #888; }

/* WhatsApp mock */
.wpp-mock { background: #ECE5DD; border-radius: 10px; padding: 12px 10px; min-height: 240px; }
.wpp-msg-out { background: #DCF8C6; border-radius: 6px; padding: 8px 10px; max-width: 88%; margin-left: auto; margin-bottom: 8px; font-size: 11px; }
.wpp-msg-in { background: #fff; border-radius: 6px; padding: 10px 11px; max-width: 92%; margin-bottom: 8px; font-size: 11px; color: #333; line-height: 1.5; }
.wpp-time { font-size: 9px; color: #999; text-align: right; margin-top: 3px; }

/* DRE simples */
/* ===== DRE comparativo (categorias em linhas × meses em colunas) ===== */
/* O container rola na horizontal quando há mais meses do que cabem. A 1ª coluna
   (categoria) fica fixa (sticky) pra não sumir ao rolar. */
.dre-scroll { overflow-x: auto; background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.dre-tabela { border-collapse: collapse; width: 100%; min-width: 100%; }
.dre-tabela th, .dre-tabela td { padding: 12px 16px; font-size: 13px; text-align: right; white-space: nowrap; }
/* Coluna de categoria: largura fixa, colada na ESQUERDA. Não estica — as colunas
   de mês dividem o resto da largura igualmente entre si. */
.dre-cat-head, .dre-cat { text-align: left !important; position: sticky; left: 0; background: #fff; z-index: 2; width: 240px; min-width: 240px; white-space: normal; }
.dre-cat-head { font-weight: 600; color: #444; border-bottom: 1px solid #eee; }
/* Conteúdo da categoria começa colado à esquerda. */
.dre-cat { padding-left: 20px; }
/* Colunas de mês: dividem o espaço restante igualmente; min-width garante o scroll
   horizontal a partir de ~4 meses (quando não cabem mais lado a lado). */
.dre-col { min-width: 180px; border-bottom: 1px solid #eee; position: relative; vertical-align: top; text-align: right; }
.dre-col-mes { font-weight: 600; font-size: 13px; }
.dre-col-ano { font-size: 11px; color: #888; }
.dre-col-x { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: #F3F4F6; color: #888; cursor: pointer; font-size: 13px; line-height: 1; }
.dre-col-x:hover { background: #FEE2E2; color: #B91C1C; }
.dre-cell { font-weight: 500; vertical-align: middle; }
.dre-cell.in { color: #047857; }
.dre-cell.out { color: #B91C1C; }
.dre-cell-top { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
/* Barra de proporção dentro da célula (só com poucos meses). Largura máxima fixa e
   alinhada à direita, pra não esticar pela tela quando há 1 mês só. */
.dre-cell-bar { margin: 6px 0 0 auto; height: 6px; width: 100%; max-width: 220px; background: #F0F0F2; border-radius: 3px; overflow: hidden; }
.dre-cell-bar-fill { height: 100%; border-radius: 3px; }
.dre-tabela tbody tr { border-top: 0.5px solid #F3F4F6; }
.dre-grupo td { background: #fff; text-align: left; padding-top: 16px; padding-bottom: 10px; }
.dre-grupo-titulo { font-size: 13px; font-weight: 600; color: #222; }
.dre-grupo-sub { font-size: 11px; color: #888; margin-top: 1px; }
.dre-row-semcat td { background: #FFFBEB; }
.dre-row-semcat .dre-cat { background: #FFFBEB; color: #B45309; }
.dre-total-linha td { background: #111; color: #fff; font-weight: 600; }
.dre-total-linha .dre-cat { background: #111; color: #fff; }
/* Valor + % dentro da célula */
.dre-cell .dre-valor { display: inline-block; }
.dre-cell .dre-pct { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; color: #888; cursor: help; border-bottom: 1px dotted #bbb; }
.dre-cell.in .dre-pct { color: #059669; }
.dre-cell.out .dre-pct { color: #9CA3AF; }

/* Bloco "Resultado do período" — destaque roxo (identidade da tela antiga) */
.dre-resultado-bloco { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.dre-res-card { flex: 1; min-width: 200px; background: #F5F3FF; border-radius: 10px; padding: 16px 20px; }
.dre-res-label { font-size: 11px; color: #4338CA; letter-spacing: 0.3px; font-weight: 600; }
.dre-res-sub { font-size: 12px; color: #312E81; margin-top: 2px; }
.dre-res-val { font-size: 24px; font-weight: 600; margin-top: 6px; }

.dre-export-item { padding: 10px 14px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: #222; }
.dre-export-item:hover { background: #F5F5F7; }
.dre-export-item + .dre-export-item { border-top: 0.5px solid rgba(0,0,0,0.06); }

@media print {
  .sidebar { display: none !important; }
  .main { margin: 0 !important; padding: 24px !important; }
  #dre-export-wrap, #dre-add-mes-wrap { display: none !important; }
  .dre-col-x { display: none !important; }
  /* No PDF, mostra todas as colunas (sem scroll) e remove o botão de tirar mês. */
  .dre-scroll { overflow: visible !important; box-shadow: none !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  .modal-overlay, .ob-overlay, .login-overlay, .toast { display: none !important; }
}

/* Indicadores */
.ind-card { background: #fff; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 10px; padding: 16px 18px; }
.ind-label { font-size: 11px; color: #666; letter-spacing: 0.3px; margin-bottom: 4px; }
.ind-value { font-size: 24px; font-weight: 500; margin-bottom: 4px; }
.ind-sub { font-size: 11px; color: #777; }
.ind-explain { font-size: 10px; color: #888; margin-top: 10px; padding-top: 10px; border-top: 0.5px dashed rgba(0,0,0,0.1); line-height: 1.5; }

/* Categorias config */
.cat-config { background: #fff; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 10px; padding: 4px 0; }
.cat-config-row { display: grid; grid-template-columns: 32px 1fr 80px 60px; gap: 12px; padding: 12px 16px; align-items: center; border-top: 0.5px solid #F0F0F0; }
.cat-config-row:first-child { border-top: none; }
.cat-config-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.cat-config-icon i { font-size: 16px; }
.cat-config-name { font-size: 13px; font-weight: 500; }
.cat-config-sub { font-size: 10px; color: #888; margin-top: 1px; }
.cat-config-count { font-size: 12px; color: #555; }

/* Toggle */
.toggle { width: 36px; height: 20px; background: #D1D5DB; border-radius: 12px; position: relative; cursor: pointer; transition: background 0.2s; }
.toggle.on { background: #6366F1; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: left 0.2s; }
.toggle.on::after { left: 18px; }

/* Settings */
.settings-section { background: #fff; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 10px; padding: 4px 0; margin-bottom: 14px; }
.settings-title { font-size: 13px; font-weight: 500; padding: 14px 18px 8px; }
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 0.5px solid #F0F0F0; }
.settings-label { font-size: 12px; font-weight: 500; margin-bottom: 2px; }
.settings-desc { font-size: 11px; color: #777; }

/* Responsive */
@media (max-width: 880px) {
  .sidebar { width: 64px; }
  .sb-brand { padding: 0 0 22px; text-align: center; }
  .sb-logo-img { max-width: 40px; max-height: 16px; margin: 0 auto; }
  .sb-role, .sb-section, .sb-foot { display: none; }
  .sb-item { padding: 12px 0; justify-content: center; border-left: 3px solid transparent; }
  .sb-item span, .sb-item .sb-badge { display: none; }
  .main { padding: 18px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; text-align: left; }
  .hero-value { font-size: 30px; }
  .tx-row { grid-template-columns: 30px 1fr 110px; gap: 8px; }
  .tx-time { display: none; }
  .evol-grid { grid-template-columns: repeat(2, 1fr); }
  .bank-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: 1fr; }
}

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111; color: #fff; padding: 11px 18px; border-radius: 8px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); z-index: 200; display: none; align-items: center; gap: 8px; }
.toast.show { display: flex; animation: slideUp 0.25s ease-out; }
@keyframes slideUp { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Navegação sequencial */
.page-nav { padding: 0 0 24px; display: flex; gap: 10px; }
.page-nav button { padding: 8px 18px; border: 0.5px solid rgba(0,0,0,0.08); border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; font-family: inherit; transition: background 0.15s; }
.page-nav button:hover:not(:disabled) { background: #F5F5F7; }
.page-nav button:disabled { opacity: 0.35; cursor: not-allowed; }

/* ===== Login provisório ===== */
.login-overlay { position: fixed; inset: 0; z-index: 1000; background: #F5F5F7; display: none; align-items: center; justify-content: center; }
.login-overlay.open { display: flex; }
.login-card { width: 360px; max-width: 92vw; background: #fff; border-radius: 14px; padding: 36px 32px; box-shadow: 0 10px 40px rgba(0,0,0,0.10); }
.login-brand { font-size: 24px; font-weight: 600; letter-spacing: -0.5px; margin-bottom: 8px; }
.login-brand span { color: #6D28D9; }
.login-brand-img { display: block; width: 240px; max-width: 100%; max-height: 56px; height: auto; object-fit: contain; }
.login-sub { font-size: 12px; color: #888; margin: 4px 0 26px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; font-weight: 500; color: #444; margin-bottom: 6px; }
.login-field input { width: 100%; padding: 11px 13px; border: 0.5px solid rgba(0,0,0,0.14); border-radius: 8px; font-size: 13px; font-family: inherit; box-sizing: border-box; }
.login-field input:focus { outline: none; border-color: #6D28D9; }
.login-btn { width: 100%; margin-top: 8px; padding: 12px; background: #6D28D9; color: #fff; border: 0; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.login-btn:hover { background: #5B21B6; }
.login-erro { font-size: 12px; color: #DC2626; margin-top: 12px; min-height: 16px; text-align: center; }
.login-hint { margin-top: 20px; padding-top: 16px; border-top: 0.5px solid rgba(0,0,0,0.08); font-size: 10.5px; color: #aaa; line-height: 1.6; }

/* Título maior no topo do cadastro (estilo do protótipo) */
.login-title { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; margin: 14px 0 4px; }

/* Campo de telefone com prefixo de DDI fixo (BR +55) */
.login-tel { display: flex; align-items: stretch; gap: 8px; }
.login-ddi { display: flex; align-items: center; padding: 0 11px; border: 0.5px solid rgba(0,0,0,0.14); border-radius: 8px; font-size: 12px; font-weight: 500; color: #555; background: #FAFAFA; white-space: nowrap; }
.login-tel input { flex: 1; }

/* Campo de senha com "mostrar/ocultar" */
.login-senha-wrap { position: relative; }
.login-senha-wrap input { width: 100%; padding-right: 64px; box-sizing: border-box; }
.login-mostrar { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 500; color: #6D28D9; cursor: pointer; user-select: none; }

/* Checkbox de termos */
.login-termos { display: flex; align-items: flex-start; gap: 8px; font-size: 11px; color: #666; line-height: 1.5; margin: 4px 0 6px; cursor: pointer; }
.login-termos input { margin-top: 1px; flex-shrink: 0; }
.login-termos a { color: #6D28D9; }

/* Selos de confiança abaixo do botão de cadastro */
.login-selos { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; font-size: 10.5px; color: #16A34A; font-weight: 500; }

/* Separador "ou" e botão alternativo (login por WhatsApp) */
.login-ou { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: #bbb; font-size: 11px; }
.login-ou::before, .login-ou::after { content: ''; flex: 1; height: 0.5px; background: rgba(0,0,0,0.10); }
.login-btn-alt { width: 100%; padding: 11px; background: #fff; color: #16A34A; border: 0.5px solid #16A34A; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background 0.15s; }
.login-btn-alt:hover { background: #F0FDF4; }
.login-btn-alt svg { width: 17px; height: 17px; }

/* ===== Tooltip (?) ===== */
.tip { position: relative; display: inline-flex; align-items: center; cursor: help; }
.tip-mark { width: 15px; height: 15px; border-radius: 50%; border: 1px solid currentColor; font-size: 10px; line-height: 14px; text-align: center; opacity: 0.55; font-weight: 600; }
.tip-box { position: absolute; bottom: 150%; left: 50%; transform: translateX(-50%); background: #1F2937; color: #fff; font-size: 11px; font-weight: 400; line-height: 1.5; padding: 9px 11px; border-radius: 7px; width: 230px; opacity: 0; visibility: hidden; transition: opacity 0.15s; z-index: 60; box-shadow: 0 6px 18px rgba(0,0,0,0.22); text-align: left; }
.tip-box::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1F2937; }
.tip:hover .tip-box { opacity: 1; visibility: visible; }
.tip.tip-left .tip-box { left: auto; right: -4px; transform: none; max-width: 230px; }
.tip.tip-left .tip-box::after { left: auto; right: 6px; transform: none; }

/* ===== Métrica de gastos no DRE ===== */
.metrica-gastos { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 12px; padding: 16px 20px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.metrica-gastos .mg-label { font-size: 12px; font-weight: 500; color: #444; display: flex; align-items: center; gap: 7px; }
.metrica-gastos .mg-sub { font-size: 11px; color: #888; margin-top: 3px; }
.metrica-gastos .mg-val { font-size: 28px; font-weight: 600; line-height: 1; }
.metrica-gastos .mg-meta { font-size: 11px; color: #888; margin-top: 4px; text-align: right; }
