[hidden] { display: none !important; }
:root {
  --green: #16a34a;
  --green-dark: #0f7a37;
  --green-soft: #dcfce7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --blue: #2563eb;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; padding: 12px 22px; font-weight: 600;
  text-decoration: none; transition: transform 0.1s, background 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-dark { background: #000; color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: 14px; }

/* ---------- Landing ---------- */
.topbar {
  background: var(--green-dark); color: #fff; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; text-decoration: none; color: inherit; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px; background: #fff; color: var(--green-dark);
  display: grid; place-items: center; font-weight: 900;
}
.nav { display: flex; gap: 28px; align-items: center; }
.nav a { text-decoration: none; font-weight: 600; opacity: 0.95; }
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center;
  max-width: 1200px; margin: 0 auto; padding: 64px 24px;
}
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.1; margin: 0 0 20px; }
.hero p.lead { font-size: 18px; color: var(--muted); margin: 0 0 28px; }
.pill {
  display: inline-block; background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 18px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.mock-chat {
  background: #fff; border-radius: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.12); padding: 20px;
  max-width: 380px; margin-left: auto; border: 8px solid #111;
}
.section { max-width: 1200px; margin: 0 auto; padding: 56px 24px; }
.section h2 { font-size: 32px; text-align: center; margin: 0 0 36px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.feature { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.feature .icon { font-size: 28px; }
.feature h3 { margin: 12px 0 8px; }
.feature p { color: var(--muted); margin: 0; }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.step { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.step::before {
  counter-increment: s; content: counter(s); display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; margin-bottom: 12px;
}
.footer { text-align: center; color: var(--muted); padding: 32px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { background: #fff; width: 100%; max-width: 400px; border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.auth-card .logo { color: var(--green-dark); justify-content: center; margin-bottom: 20px; }
.auth-card .logo-mark { background: var(--green); color: #fff; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.tabs button { border: none; background: transparent; padding: 10px; border-radius: 999px; font-weight: 600; color: var(--muted); }
.tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 600; }
.field input, .field select {
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; background: #fff; width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--green); border-color: transparent; }
.error { color: var(--red); font-size: 14px; min-height: 20px; }

/* ---------- App ---------- */
.app-header {
  background: var(--green-dark); color: #fff; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 10;
}
.app-header .user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.app-header .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.layout { display: grid; grid-template-columns: 1fr 400px; gap: 20px; padding: 20px; max-width: 1500px; margin: 0 auto; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.month-nav { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.month-nav button { border: none; background: transparent; width: 34px; height: 34px; border-radius: 50%; font-size: 18px; }
.month-nav button:hover { background: var(--bg); }
.month-nav span { min-width: 140px; text-align: center; font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card .label { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.card .value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.card.receitas .value { color: var(--green); }
.card.despesas .value { color: var(--red); }
.panels { display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; }
.panel { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.panel h3 { margin: 0 0 14px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.chart-box { position: relative; height: 240px; }
.cat-list { list-style: none; padding: 0; margin: 14px 0 0; font-size: 14px; }
.cat-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
.tx-list { list-style: none; padding: 0; margin: 0; max-height: 520px; overflow: auto; }
.tx { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.tx-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-size: 18px; }
.tx-icon.despesa { background: var(--red-soft); }
.tx-icon.receita { background: var(--green-soft); }
.tx-main { flex: 1; min-width: 0; }
.tx-main .desc { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-main .meta { font-size: 12px; color: var(--muted); }
.tx-amount { font-weight: 700; white-space: nowrap; }
.tx-amount.despesa { color: var(--red); }
.tx-amount.receita { color: var(--green); }
.tx-actions { display: flex; gap: 2px; }
.tx-actions button { border: none; background: transparent; padding: 6px; border-radius: 8px; opacity: .6; }
.tx-actions button:hover { background: var(--bg); opacity: 1; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* ---------- Chat ---------- */
.chat {
  background: #efeae2; border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; height: calc(100vh - 100px); position: sticky; top: 80px; overflow: hidden;
}
.chat-head { background: var(--green); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.chat-head .avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--green); display: grid; place-items: center; font-weight: 900; }
.chat-head .title { flex: 1; }
.chat-head .title small { display: block; opacity: .85; font-size: 12px; }
.chat-head button { background: transparent; border: none; color: #fff; font-size: 18px; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.msg.user { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: #fff; border-top-left-radius: 4px; }
.msg img { max-width: 100%; border-radius: 8px; display: block; margin-bottom: 6px; }
.typing { align-self: flex-start; background: #fff; padding: 10px 14px; border-radius: 12px; }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; background: #9ca3af; border-radius: 50%; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.suggestions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 8px; }
.suggestions button { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.chat-input { display: flex; align-items: flex-end; gap: 6px; padding: 10px; background: #f0f2f5; }
.chat-input textarea {
  flex: 1; resize: none; border: none; border-radius: 20px; padding: 10px 14px; max-height: 120px; min-height: 42px; outline: none;
}
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: none; background: transparent; font-size: 20px; flex-shrink: 0; display: grid; place-items: center; }
.icon-btn.send { background: var(--green); color: #fff; }
.icon-btn.recording { background: var(--red); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.preview { padding: 6px 12px; background: #f0f2f5; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.preview img { height: 48px; border-radius: 6px; }
.chat-fab { display: none; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; place-items: center; padding: 16px; z-index: 50; }
.modal.open { display: grid; }
.modal-card { background: #fff; border-radius: 18px; padding: 24px; width: 100%; max-width: 440px; }
.modal-card h3 { margin-top: 0; }
.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.type-toggle button { border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 10px; font-weight: 600; }
.type-toggle button.active.despesa { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.type-toggle button.active.receita { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .chat { position: fixed; inset: 0; height: 100%; border-radius: 0; z-index: 40; display: none; }
  .chat.open { display: flex; }
  .chat-fab {
    display: grid; place-items: center; position: fixed; right: 20px; bottom: 20px; width: 60px; height: 60px; border-radius: 50%;
    background: var(--green); color: #fff; border: none; font-size: 26px; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 30;
  }
}
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; padding: 40px 16px; }
  .mock-chat { margin: 0 auto; }
  .nav a:not(.btn) { display: none; }
  .cards { grid-template-columns: 1fr; }
  .panels { grid-template-columns: 1fr; }
  .layout { padding: 12px; }
  .app-header .user span { display: none; }
}
.close-mobile { display: none; }
@media (max-width: 1100px) { .close-mobile { display: inline; } }

/* ---------- Contas a pagar ---------- */
.bills { margin-bottom: 16px; }
.bills .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.bill-list { list-style: none; padding: 0; margin: 0; }
.bill { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.bill:last-child { border-bottom: none; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.soon { background: #fef3c7; color: #92400e; }
.badge.today { background: #ffedd5; color: #c2410c; }
.badge.late { background: var(--red-soft); color: var(--red); }
@media (max-width: 800px) {
  .bills .hint { display: none; }
  .bill { flex-wrap: wrap; }
  .bill .tx-main { flex-basis: calc(100% - 60px); }
}
