/* ==============================
   Saldo Verde - stylesheet
   Paleta orgânica (Bone, Forest, Terracotta, Ochre)
   ============================== */

:root {
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --text: #081C15;
  --muted: #525B56;
  --border: #E6E4DD;
  --primary: #1B4332;
  --primary-hover: #2D6A4F;
  --secondary: #E07A5F;
  --accent: #F4A261;
  --accent-2: #E9C46A;
  --green: #2D6A4F;
  --green-soft: rgba(27, 67, 50, 0.10);
  --red-soft: rgba(224, 122, 95, 0.15);
  --accent-soft: rgba(244, 162, 97, 0.20);
  --shadow-card: 0 2px 10px rgba(8, 28, 21, 0.04);
  --shadow-float: 0 10px 40px rgba(8, 28, 21, 0.10);
  --shadow-modal: 0 30px 80px rgba(8, 28, 21, 0.25);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 600; }
h2 { font-size: clamp(24px, 3vw, 32px); }
h3 { font-size: 18px; font-weight: 500; }

p { margin: 0; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.muted-light { color: rgba(255, 255, 255, 0.75); }
.small { font-size: 12.5px; }

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 10px;
}
.tag.light { color: rgba(255, 255, 255, 0.7); }

.link {
  color: var(--primary);
  font-weight: 500;
  background: none;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 14px;
}
.link:hover { text-decoration: underline; }

/* ==============================
   Buttons
============================== */
.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 14px;
  transition: background 0.25s, transform 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-outline {
  border: 2px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 14px;
  background: transparent;
}
.btn-outline:hover { border-color: var(--text); }

.btn-block { width: 100%; justify-content: center; padding: 14px 22px; }

/* ==============================
   Login Screen
============================== */
.login-screen {
  min-height: 100vh;
  display: var(--init-login-display, flex);
  align-items: stretch;
  background: var(--bg);
}

.login-grid {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  min-height: 100vh;
}
@media (min-width: 960px) {
  .login-grid { grid-template-columns: 1.1fr 1fr; }
}

.login-visual {
  position: relative;
  display: none;
  padding: 48px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(27, 67, 50, 0.88), rgba(45, 106, 79, 0.78)),
    radial-gradient(circle at 20% 20%, rgba(244, 162, 97, 0.4), transparent 55%),
    radial-gradient(circle at 80% 85%, rgba(233, 196, 106, 0.35), transparent 50%),
    #1B4332;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.login-visual::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.12'/></svg>");
  opacity: 0.4;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.login-visual > * { position: relative; z-index: 1; }

@media (min-width: 960px) { .login-visual { display: flex; } }

.login-brand {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 600;
}
.login-visual h1 {
  font-size: clamp(32px, 4.5vw, 56px);
  line-height: 1.05;
  margin: 40px 0 20px;
}
.login-visual p {
  max-width: 480px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
}
.login-features {
  list-style: none;
  padding: 0;
  margin: 36px 0 0;
  display: grid;
  gap: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}
.login-features li {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-footer-tag {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 40px;
}

.login-form-wrap {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}
.login-form-wrap h2 { margin-bottom: 12px; }
.login-form-wrap p.muted { margin-bottom: 30px; }
#login-form label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 8px;
}
#login-form input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: transparent;
  margin-bottom: 18px;
  transition: border-color 0.2s;
}
#login-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.privacy-note {
  margin-top: 26px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(45, 106, 79, 0.06);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.privacy-note strong { color: var(--text); }
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-right: 8px;
}

/* ── Auth tabs ── */
.auth-tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 28px;
  width: 100%;
}
.auth-tab {
  flex: 1;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
  text-align: center;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(8,28,21,0.06);
}

/* ── Auth forms ── */
#auth-login label,
#auth-register label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 14px;
}
#auth-login input,
#auth-register input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: transparent;
  transition: border-color 0.2s;
}
#auth-login input:focus,
#auth-register input:focus {
  outline: none;
  border-color: var(--primary);
}

.input-password-wrap {
  position: relative;
  margin-bottom: 4px;
}
.input-password-wrap input { padding-right: 46px; }
.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--muted);
  padding: 4px;
  line-height: 1;
}
.toggle-pw:hover { color: var(--text); }

.auth-error {
  background: var(--red-soft);
  color: var(--secondary);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin: 10px 0 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 20px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.btn-google:hover {
  border-color: #4285F4;
  box-shadow: 0 2px 12px rgba(66,133,244,0.15);
}

.acc-form {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 1fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 26px;
}
.acc-form-btn { display: flex; flex-direction: column; }
@media (max-width: 900px) {
  .acc-form { grid-template-columns: 1fr 1fr; }
}

.rel-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.rel-acc-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.rel-acc-row .rel-acc-name  { font-weight: 600; font-size: 14px; }
.rel-acc-row .rel-acc-bank  { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.rel-acc-row .rel-acc-saldo { font-family: 'Outfit', sans-serif; font-size: 20px; font-weight: 600; color: var(--primary); margin: 4px 0; }
.rel-acc-row .rel-acc-detail { display: flex; gap: 16px; font-size: 12px; }

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.period-selector-wrap {
  position: relative;
  flex-shrink: 0;
}

@media (min-width: 769px) {
  .period-selector-wrap .custom-select-wrap { width: auto; }
  .period-selector-wrap .custom-select-btn { min-width: 160px; width: auto; }
  .dashboard-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

.period-select {
  padding: 10px 36px 10px 16px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23525B56' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.2s;
  min-width: 180px;
}
.period-select:focus {
  outline: none;
  border-color: var(--primary);
}

.period-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.period-custom input[type="date"] {
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
}
.period-custom input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
}
.period-custom span {
  color: var(--muted);
  font-size: 13px;
}

/* ==============================
   App layout
============================== */
.app {
  display: block;
  min-height: 100vh;
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
}
@media (max-width: 960px) { .sidebar { display: none; } }

/* Compensa a sidebar fixa — empurra o main para a direita */
@media (min-width: 961px) {
  .main {
    margin-left: 280px !important;
    max-width: calc(100vw - 280px) !important;
    box-sizing: border-box;
  }
  .mobile-topbar { display: none; }
}
@media (max-width: 960px) {
  .app { display: flex; flex-direction: column; }
}
@media (max-width: 960px) { .sidebar { display: none; } }

.brand {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.nav-btn:hover { background: var(--bg); }
.nav-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(8, 28, 21, 0.08);
}
.nav-icon { font-size: 16px; }

.user-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg);
  margin-top: auto;
  flex-shrink: 0;
}
.user-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}
.logout-btn:hover {
  color: var(--secondary);
  border-color: var(--secondary);
  background: var(--red-soft);
}

/* Mobile top bar */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  justify-content: space-between;
  align-items: center;
}
.mobile-nav {
  display: none;
  position: sticky;
  top: 56px;
  z-index: 19;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
}
.mobile-nav .nav-btn { padding: 8px 14px; border-radius: 999px; font-size: 13px; }
@media (max-width: 960px) {
  .mobile-topbar { display: flex; }
  .mobile-nav { display: flex; }
}
.mobile-nav-toggle {
  font-size: 22px;
  color: var(--text);
  padding: 4px 10px;
  border-radius: 8px;
}

.main {
  padding: 40px;
  max-width: 1400px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  width: 100%;
}
@media (max-width: 700px) { .main { padding: 20px; } }

.page { display: none; animation: fadeUp 0.35s ease both; }
.page.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

/* ==============================
   Cards & BI
============================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}
.card-wide { grid-column: span 2; }
@media (max-width: 960px) { .card-wide { grid-column: 1; } }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}

.bi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 900px) { .bi-grid { grid-template-columns: 1fr; } }

.bi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
}
.bi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.bi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 6px;
}
.bi-value.green { color: var(--primary); }
.bi-value.red { color: var(--secondary); }

.bi-highlight {
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-float);
  position: relative;
  overflow: hidden;
}
.bi-highlight::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.15'/></svg>");
  opacity: 0.3;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.bi-highlight > * { position: relative; z-index: 1; }

.icon-chip {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
}
.icon-chip.green { background: var(--green-soft); color: var(--primary); }
.icon-chip.red { background: var(--red-soft); color: var(--secondary); }
.icon-chip.light { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* Grid layouts */
.grid-2-3 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 960px) { .grid-2-3 { grid-template-columns: 1fr; } }
.grid-2-eq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 960px) { .grid-2-eq { grid-template-columns: 1fr; } }

.chart-wrap { position: relative; height: 280px; margin-top: 12px; }
.chart-wrap.small { height: 220px; }

.legend-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 120px;
  overflow-y: auto;
}
.legend-list li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  gap: 10px;
}
.legend-list .legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; margin-right: 8px;
}

/* ==============================
   Transaction list
============================== */
.tx-list { list-style: none; padding: 0; margin: 0; }
.tx-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 6px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.tx-row:last-child { border-bottom: none; }
.tx-row:hover { background: rgba(230, 228, 221, 0.3); }

.tx-icon {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}
.tx-icon.income { background: var(--green-soft); color: var(--primary); }
.tx-icon.expense { background: var(--red-soft); color: var(--secondary); }

.tx-body { flex: 1; min-width: 0; }
.tx-title {
  font-weight: 500;
  font-size: 14.5px;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-amount {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 15px;
  text-align: right;
  flex-shrink: 0;
}
.tx-amount.income { color: var(--primary); }
.tx-amount.expense { color: var(--secondary); }

.tx-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.tx-row:hover .tx-actions { opacity: 1; }
@media (max-width: 700px) { .tx-actions { opacity: 1; } }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--secondary); }
.icon-btn.success:hover { background: var(--green-soft); color: var(--primary); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--accent-soft);
  color: var(--text);
}

/* ==============================
   Filters / tabs
============================== */
.filters-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filters-row .search-input {
  flex: 1;
  min-width: 180px;
}

.tabs {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-pill);
}
.tabs.pill-tabs { background: var(--bg); }
.tabs.tabs-stand { margin-bottom: 18px; }
.tab {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(8, 28, 21, 0.06);
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--surface);
}
.search-input:focus { outline: none; border-color: var(--primary); }

/* ==============================
   Forms
============================== */
.form-row {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 26px;
}
@media (max-width: 900px) { .form-row { grid-template-columns: 1fr 1fr; } }
.form-row .field.small { max-width: 120px; }
@media (max-width: 900px) { .form-row .field.small { max-width: none; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
}
.field input, .field select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

/* ==============================
   Chips / cards grids
============================== */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.account-card .icon-chip { width: 44px; height: 44px; font-size: 20px; border-radius: 14px; }

.chip-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.chip .chip-icon { font-size: 20px; }
.chip-label { flex: 1; font-weight: 500; font-size: 14px; }
.chip-type {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ==============================
   Modal
============================== */
.modal {
  position: fixed; inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 28, 21, 0.35);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-modal);
  animation: modalPop 0.25s cubic-bezier(0.2, 1, 0.4, 1);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.close-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 22px;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.close-btn:hover { background: var(--bg); color: var(--text); }

#tx-modal .tabs { width: 100%; display: flex; margin-bottom: 20px; }
#tx-modal .tabs .tab { flex: 1; text-align: center; }

.amount-input {
  font-family: 'Outfit', sans-serif !important;
  font-size: 28px !important;
  padding: 18px 20px !important;
  font-weight: 600;
}

.switch-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 8px 0 20px;
  cursor: pointer;
}
.switch-row input[type="checkbox"] {
  width: 40px; height: 22px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
  flex-shrink: 0;
}
.switch-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.switch-row input[type="checkbox"]:checked { background: var(--primary); }
.switch-row input[type="checkbox"]:checked::before { transform: translateX(18px); }
.switch-title { font-weight: 500; font-size: 14px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ==============================
   Toast
============================== */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100;
  padding: 14px 20px;
  background: var(--text);
  color: #fff;
  border-radius: 14px;
  font-size: 14px;
  box-shadow: var(--shadow-float);
  animation: toastIn 0.25s ease;
  max-width: 320px;
}
.toast.success { background: var(--primary); }
.toast.error { background: var(--secondary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sidebar Premium CTA */
.sidebar-premium-cta {
  margin: 8px 0;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(244,162,97,0.12), rgba(233,196,106,0.12));
  border: 1px solid rgba(244,162,97,0.3);
  text-align: center;
}
.sidebar-premium-icon { font-size: 28px; margin-bottom: 6px; }
.sidebar-premium-title { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.sidebar-premium-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* Profile Modal */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.profile-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--primary);
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700;
  font-family: 'Outfit', sans-serif;
  flex-shrink: 0;
}
.profile-name { font-weight: 700; font-size: 16px; }
.profile-plan-info {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 13.5px;
  line-height: 1.6;
}
.profile-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.btn-danger {
  background: var(--red-soft);
  color: var(--secondary);
  border: 1px solid var(--secondary);
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  font-weight: 500; font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-danger:hover { background: rgba(224,122,95,0.25); }

/* 2FA login step */
.twofa-icon { font-size: 48px; text-align: center; margin-bottom: 8px; }
#auth-2fa label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
#auth-2fa input { width: 100%; margin-bottom: 0; }

/* 2FA setup modal — stepper */
.twofa-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 4px 0 24px;
}
.twofa-step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  color: var(--muted);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.twofa-step-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.twofa-step-dot.done {
  background: var(--green-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.twofa-step-dot.done::before { content: '✓'; font-size: 14px; }
.twofa-step-dot.done { font-size: 0; }
.twofa-step-line {
  flex: 1; height: 2px;
  background: var(--border);
  max-width: 48px;
  transition: background 0.2s;
}

/* 2FA step content */
.twofa-step-header { margin-bottom: 20px; }
.twofa-step-num {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--primary); margin-bottom: 6px;
}
.twofa-step-header h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.twofa-step-header p { font-size: 14px; }

/* App cards */
.twofa-apps-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.twofa-app-card {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  text-decoration: none; color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.twofa-app-card:hover { border-color: var(--primary); background: var(--green-soft); }
.twofa-app-icon { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; }
.twofa-app-name { font-weight: 600; font-size: 14px; }
.twofa-app-store { font-size: 12px; color: var(--muted); margin-top: 2px; }
.twofa-tip {
  font-size: 13px; color: var(--muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}

/* QR code */
.twofa-qr-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
.twofa-qr-img {
  width: 200px; height: 200px;
  border-radius: 12px;
  border: 3px solid var(--border);
  background: #fff;
}

/* Código manual */
.twofa-manual-wrap {
  margin-bottom: 4px;
  font-size: 13px; color: var(--muted);
}
.twofa-manual-wrap summary { cursor: pointer; padding: 6px 0; }
.twofa-secret {
  font-family: monospace; font-size: 15px; font-weight: 700;
  letter-spacing: 4px; text-align: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; margin-top: 8px;
  word-break: break-all; color: var(--text);
}

/* Code input */
.twofa-code-wrap { text-align: center; }
.twofa-code-input {
  font-size: 28px !important;
  letter-spacing: 8px !important;
  text-align: center !important;
  font-weight: 700 !important;
  width: 100%;
  max-width: 220px;
}

/* 2FA ativo — estado de desativação */
.twofa-active-state { text-align: center; padding: 8px 0 4px; }
.twofa-active-icon { font-size: 52px; margin-bottom: 10px; }
.twofa-active-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }

.user-plan-free {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.user-plan-premium {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #F4A261, #E9C46A);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==============================
   Premium Modal
============================== */
.premium-modal-content {
  max-width: 480px;
  padding: 36px;
  text-align: center;
}
.premium-header { margin-bottom: 24px; }
.premium-badge {
  display: inline-block;
  background: linear-gradient(135deg, #F4A261, #E9C46A);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}
.premium-header h2 { margin-bottom: 10px; }

.premium-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
  text-align: left;
}
.premium-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 14px;
  border: 1px solid var(--border);
}
.premium-feature-icon { font-size: 22px; flex-shrink: 0; }
.premium-feature-title { font-weight: 600; font-size: 14px; }

.premium-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.premium-plan {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  text-align: center;
}
.premium-plan:hover { border-color: var(--primary); }
.premium-plan.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,67,50,0.12);
}
.premium-plan.best-value { border-color: var(--accent); }
.premium-plan.best-value.selected { border-color: var(--primary); }
.plan-badge-best {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.plan-period { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }
.plan-price { font-family: 'Outfit', sans-serif; font-size: 32px; font-weight: 700; color: var(--text); line-height: 1; }
.plan-cents { font-size: 18px; }
.plan-desc { margin-top: 6px; }

.premium-cta { margin-bottom: 12px; font-size: 15px; padding: 14px; }
.premium-footer { text-align: center; }

/* ==============================
   Bank Autocomplete
============================== */
.bank-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 12px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  list-style: none;
  padding: 4px;
  margin: 4px 0 0;
  box-shadow: var(--shadow-float);
}
.bank-logo-img {
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
}
.bank-logo-fallback {
  border-radius: 8px;
  background: var(--green-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.bank-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.bank-suggestion-logo {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  vertical-align: middle;
}
.bank-suggestions li {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}
.bank-suggestions li:hover { background: var(--bg); }
.bank-suggestions li .bank-code {
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
}

/* ==============================
   AI Assistant
============================== */
.ai-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 24px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-float);
  z-index: 60;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, background 0.2s;
}
.ai-fab:hover { background: var(--primary-hover); transform: scale(1.08); }

/* Esconde FAB quando login-screen está visível */
.login-screen:not(.hidden) ~ * .ai-fab,
body:has(#login-screen:not(.hidden)) .ai-fab {
  display: none !important;
}

.ai-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 40px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  z-index: 60;
  display: flex;
  flex-direction: column;
  max-height: 600px;
}
.ai-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.ai-panel-title { font-weight: 600; font-size: 15px; }
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
}
.ai-msg {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 90%;
}
.ai-msg.ai {
  background: var(--green-soft);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  line-height: 1.7;
}
.ai-msg.ai strong {
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
}
.ai-msg.ai br + br { display: none; }
.ai-msg.user {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-msg.loading { opacity: 0.6; font-style: italic; }
.ai-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  align-items: center;
}
.ai-input-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  font-size: 14px;
}
.ai-input-row input:focus { outline: none; border-color: var(--primary); }
.ai-mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.ai-mic-btn:hover { border-color: var(--primary); }
.ai-mic-btn.recording { background: var(--red-soft); border-color: var(--secondary); animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ==============================
   Empty states
============================== */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ==============================
   RESPONSIVIDADE MOBILE
   Breakpoints: 480px, 600px, 768px, 960px
============================== */

/* --- Dashboard actions (filtros do topo) --- */
@media (max-width: 768px) {
  .dashboard-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .period-selector-wrap { flex: 1; min-width: 0; }
  .period-select { min-width: 0 !important; width: 100%; font-size: 13px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header .btn-primary { width: 100%; justify-content: center; }
}

/* --- BI cards --- */
@media (max-width: 600px) {
  .bi-grid { grid-template-columns: 1fr 1fr; }
  .bi-highlight { grid-column: span 2; }
  .bi-value { font-size: 22px; }
}
@media (max-width: 400px) {
  .bi-grid { grid-template-columns: 1fr; }
  .bi-highlight { grid-column: 1; }
}

/* --- Filtros de lançamentos --- */
@media (max-width: 768px) {
  .filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filters-row .tabs { width: 100%; justify-content: center; }
  .filters-row .period-select { width: 100%; }
  .filters-row .search-input { width: 100%; min-width: 0; }
  .period-custom { flex-wrap: wrap; gap: 6px; }
  .period-custom input[type="date"] { flex: 1; min-width: 120px; }
}

/* --- Formulário de contas --- */
@media (max-width: 768px) {
  .acc-form {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .acc-form-btn { grid-column: span 2; }
}
@media (max-width: 480px) {
  .acc-form { grid-template-columns: 1fr !important; }
  .acc-form-btn { grid-column: 1; }
}

/* --- Formulário de categorias --- */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr !important; }
  .form-row .btn-primary { width: 100%; justify-content: center; }
}

/* --- Lançamentos --- */
@media (max-width: 600px) {
  .tx-row { flex-wrap: wrap; gap: 8px; padding: 12px 4px; }
  .tx-body { min-width: calc(100% - 60px); }
  .tx-amount { font-size: 14px; }
  .tx-actions { opacity: 1; gap: 2px; }
  .icon-btn { width: 28px; height: 28px; font-size: 12px; }
}

/* --- Cards de conta --- */
@media (max-width: 600px) {
  .grid-cards { grid-template-columns: 1fr; }
  .account-card { padding: 14px; }
}

/* --- Chips de categoria --- */
@media (max-width: 600px) {
  .chip-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 400px) {
  .chip-list { grid-template-columns: 1fr; }
}

/* --- Modal --- */
@media (max-width: 600px) {
  .modal { padding: 10px; }
  .modal-content { padding: 20px 16px; border-radius: 20px; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .amount-input { font-size: 22px !important; }
}

/* --- Premium modal --- */
@media (max-width: 600px) {
  .premium-modal-content { padding: 24px 16px; }
  .premium-plans { grid-template-columns: 1fr; }
  .plan-badge-best { position: static; transform: none; margin-bottom: 6px; display: inline-block; }
}

/* --- AI Panel --- */
@media (max-width: 600px) {
  .ai-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 80px;
  }
  .ai-fab { bottom: 16px; right: 16px; width: 50px; height: 50px; font-size: 20px; }
}

/* --- Relatórios filtros --- */
@media (max-width: 768px) {
  #page-relatorios .filters-row { flex-direction: column; }
  #page-relatorios .filters-row .period-select { width: 100%; }
}

/* --- Login --- */
@media (max-width: 480px) {
  .login-form-wrap { padding: 28px 20px; }
  .auth-tabs { font-size: 13px; }
}

/* --- Sidebar premium CTA --- */
@media (max-width: 960px) {
  .sidebar-premium-cta { display: none; }
}

/* --- Mobile nav melhorado --- */
@media (max-width: 960px) {
  .mobile-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 6px 12px;
    gap: 6px;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }
  .mobile-nav .nav-btn {
    flex-shrink: 0;
    font-size: 12px;
    padding: 7px 12px;
  }
}

/* --- Tabela de relatórios --- */
@media (max-width: 768px) {
  .grid-2-eq { grid-template-columns: 1fr; }
  .rel-list { gap: 8px; }
}

/* --- User card --- */
@media (max-width: 960px) {
  /* user card fica oculto na sidebar que some no mobile */
}

/* --- Gráficos menores no mobile --- */
@media (max-width: 600px) {
  .chart-wrap { height: 200px; }
  .chart-wrap.small { height: 160px; }
}

/* --- Saldo total destaque --- */
@media (max-width: 480px) {
  .bi-value { font-size: 20px; }
  .bi-card { padding: 16px; }
}

/* ==============================
   MOBILE FIXES (375px - iPhone SE)
============================== */

@media (max-width: 480px) {

  /* BI cards: Receitas + Despesas lado a lado, Saldo embaixo */
  .bi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .bi-highlight {
    grid-column: span 2;
  }
  .bi-card { padding: 14px 12px; }
  .bi-value { font-size: 18px; }
  .bi-head { margin-bottom: 10px; }
  .icon-chip { width: 30px; height: 30px; font-size: 12px; }

  /* Header da página */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }
  .page-header h1 { font-size: 26px; }
  .page-header .btn-primary,
  .dashboard-actions .btn-primary {
    width: 100%;
    justify-content: center;
  }

  /* Filtros do dashboard empilhados */
  .dashboard-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  .period-selector-wrap { width: 100%; }
  .period-select { width: 100% !important; min-width: 0 !important; }

  /* Main padding menor */
  .main { padding: 14px 12px; }

  /* Mobile topbar mais compacta */
  .mobile-topbar { padding: 10px 14px; }
  .brand { font-size: 18px; }

  /* Nav mobile scroll suave */
  .mobile-nav {
    padding: 6px 10px;
    gap: 4px;
  }
  .mobile-nav .nav-btn {
    font-size: 11px;
    padding: 6px 10px;
    flex-shrink: 0;
  }

  /* Cards de conta em coluna única */
  .grid-cards { grid-template-columns: 1fr; }
  .account-card { padding: 12px; gap: 10px; }

  /* Chips de categoria */
  .chip-list { grid-template-columns: 1fr 1fr; gap: 8px; }
  .chip { padding: 8px 10px; }

  /* Lançamentos */
  .tx-row { padding: 10px 2px; gap: 8px; }
  .tx-title { font-size: 13px; }
  .tx-meta { font-size: 11px; }
  .tx-amount { font-size: 13px; }
  .tx-actions { gap: 2px; }
  .icon-btn { width: 26px; height: 26px; font-size: 11px; }

  /* Filtros de lançamentos */
  .filters-row {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  .filters-row .tabs { width: 100%; }
  .filters-row .tab { flex: 1; text-align: center; font-size: 12px; padding: 7px 10px; }
  .search-input { width: 100%; min-width: 0; font-size: 13px; }

  /* Modal */
  .modal { padding: 8px; align-items: flex-end; }
  .modal-content {
    border-radius: 24px 24px 16px 16px;
    padding: 20px 14px;
    max-height: 92vh;
  }
  .amount-input { font-size: 20px !important; padding: 14px !important; }

  /* AI panel ocupa tela toda no mobile */
  .ai-panel {
    left: 8px;
    right: 8px;
    bottom: 72px;
    width: auto;
    max-height: 70vh;
  }
  .ai-fab { bottom: 14px; right: 14px; width: 48px; height: 48px; font-size: 18px; }

  /* Gráficos */
  .chart-wrap { height: 180px; }
  .chart-wrap.small { height: 150px; }

  /* Formulário de contas */
  .acc-form {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .acc-form-btn { grid-column: 1 !important; }

  /* Premium modal */
  .premium-modal-content { padding: 20px 14px; }
  .premium-plans { grid-template-columns: 1fr; gap: 10px; }
  .premium-feature { padding: 10px 12px; gap: 10px; }
  .premium-feature-icon { font-size: 18px; }

  /* Relatórios */
  .rel-acc-row { padding: 12px; }
  .rel-acc-saldo { font-size: 18px; }

  /* Tags e badges menores */
  .tag { font-size: 10px; }
  .badge { font-size: 9px; padding: 1px 6px; }
}

/* ==============================
   MOBILE DRAWER SIDEBAR
============================== */

.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 28, 21, 0.45);
  backdrop-filter: blur(2px);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.mobile-drawer-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--surface);
  z-index: 201;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 8px;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
}
.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 960px) {
  .mobile-drawer-overlay { display: block; }
  .mobile-drawer { display: flex; }
}

@media (min-width: 961px) {
  .mobile-drawer { display: none !important; }
  .mobile-drawer-overlay { display: none !important; }
}

/* ==============================
   MOBILE LAYOUT FIXES v2
============================== */

/* Topbar com hamburger à esquerda */
.mobile-topbar {
  position: relative;
}
.mobile-nav-toggle {
  font-size: 22px;
  color: var(--text);
  padding: 4px 10px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1;
}

/* Dashboard: filtros + botão em grid compacto */
@media (max-width: 768px) {
  .dashboard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .dashboard-actions .period-selector-wrap:first-child { grid-column: 1; }
  .dashboard-actions .period-selector-wrap:nth-child(2) { grid-column: 2; }
  .dashboard-actions .btn-primary[data-action="new-tx"] {
    grid-column: span 2;
    width: 100%;
    justify-content: center;
  }
  .period-custom {
    grid-column: span 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* BI grid: sempre 2 colunas no mobile */
@media (max-width: 768px) {
  .bi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .bi-highlight {
    grid-column: span 2 !important;
  }
}

/* Nav mobile: esconde o toggle antigo, usa só o drawer */
@media (max-width: 960px) {
  .mobile-nav { display: none !important; }
}

/* Topbar: hamburger visível */
@media (max-width: 960px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

/* ==============================
   MOBILE LAYOUT FIXES v3
============================== */

@media (max-width: 960px) {
  /* Garante que o app ocupa 100% sem overflow */
  .app {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
  }

  /* Main sem deslocamento */
  .main {
    padding: 16px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Topbar fixa no topo */
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
  }

  /* Garante que cards não ultrapassem a tela */
  .card, .bi-card, .account-card {
    max-width: 100%;
    overflow: hidden;
  }

  /* Page header sem overflow */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  /* Gráfico não ultrapassa container */
  .chart-wrap canvas {
    max-width: 100%;
  }

  /* Tabela de lançamentos */
  .tx-list { overflow-x: hidden; }
  .tx-row { max-width: 100%; }
  .tx-title { max-width: 160px; }

  /* Formulários */
  .form-row {
    grid-template-columns: 1fr !important;
  }

  /* Filtros de relatórios */
  #page-relatorios .filters-row {
    flex-direction: column;
    align-items: stretch;
  }
  #page-relatorios .period-select {
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  .main { padding: 12px; }

  /* BI grid 2 colunas fixo */
  .bi-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .bi-highlight { grid-column: span 2 !important; }

  /* Dashboard actions */
  .dashboard-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .dashboard-actions .period-selector-wrap {
    width: 100%;
  }
  .dashboard-actions .btn-primary {
    width: 100%;
    justify-content: center;
  }

  /* Títulos menores */
  h1 { font-size: 24px !important; }
  h2 { font-size: 20px !important; }

  /* Chips */
  .chip-list { grid-template-columns: 1fr 1fr; }

  /* Modal de baixo para cima */
  .modal {
    align-items: flex-end;
    padding: 0;
  }
  .modal-content {
    border-radius: 24px 24px 0 0;
    max-height: 90vh;
    width: 100%;
    max-width: 100%;
  }

  /* AI panel */
  .ai-panel {
    left: 0;
    right: 0;
    bottom: 60px;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 75vh;
  }
}

/* ==============================
   OVERFLOW GLOBAL FIX
============================== */

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

@media (max-width: 960px) {
  /* Todos os containers respeitam a largura */
  .app, .main, .page,
  .card, .bi-card, .bi-grid,
  .filters-row, .tx-list, .tx-row,
  .grid-cards, .chip-list, .acc-form,
  .page-header, .dashboard-actions,
  .grid-2-3, .grid-2-eq, .grid-2 {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Textos longos não quebram layout */
  .tx-title, .tx-meta, .user-name,
  .acc-bal-name, .chip-label,
  .rel-acc-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  /* Tabelas e listas */
  .tx-body {
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  /* Gráficos */
  .chart-wrap {
    width: 100%;
    overflow: hidden;
  }

  /* Formulários */
  input, select, textarea {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Modais */
  .modal-content {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Premium modal */
  .premium-modal-content {
    max-width: 100%;
  }

  /* AI panel */
  .ai-panel {
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
  }

  /* Accounts balance grid */
  .accounts-balance-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* Rel list */
  .rel-acc-row {
    max-width: 100%;
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .accounts-balance-grid {
    grid-template-columns: 1fr;
  }
}

/* ==============================
   TX ROW MOBILE FIX
============================== */

@media (max-width: 600px) {
  .tx-row {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 8px;
    padding: 12px 8px;
    align-items: center;
  }

  .tx-icon {
    grid-row: span 2;
    align-self: center;
  }

  .tx-body {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .tx-amount {
    grid-column: 3;
    grid-row: 1;
    font-size: 13px;
    white-space: nowrap;
    text-align: right;
  }

  .tx-actions {
    grid-column: 2 / span 2;
    grid-row: 2;
    opacity: 1;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
  }

  .tx-title {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .tx-meta {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
}

/* ==============================
   CUSTOM SELECT DROPDOWN
============================== */

.custom-select-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select-btn {
  width: 100%;
  padding: 10px 36px 10px 16px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23525B56' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
  transition: border-color 0.2s;
}
.custom-select-btn:focus { outline: none; border-color: var(--primary); }

.custom-select-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 16px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 300;
  list-style: none;
  padding: 6px;
  margin: 0;
  box-shadow: var(--shadow-float);
  display: none;
}
.custom-select-list.open { display: block; }

.custom-select-list li {
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.custom-select-list li:hover { background: var(--bg); }
.custom-select-list li.selected {
  background: var(--green-soft);
  color: var(--primary);
  font-weight: 600;
}

/* ==============================
   DESKTOP FILTERS FIX
============================== */

@media (min-width: 769px) {
  /* Lançamentos — filtros em linha */
  #page-lancamentos .filters-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  #page-lancamentos .filters-row .custom-select-wrap {
    width: auto;
    flex-shrink: 0;
  }
  #page-lancamentos .filters-row .custom-select-btn {
    min-width: 150px;
    width: auto;
  }
  #page-lancamentos .filters-row .search-input {
    flex: 1;
    min-width: 200px;
  }

  /* Relatórios — filtros em linha */
  #page-relatorios .filters-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  #page-relatorios .filters-row .custom-select-wrap {
    width: auto;
    flex-shrink: 0;
  }
  #page-relatorios .filters-row .custom-select-btn {
    min-width: 160px;
    width: auto;
  }
}

/* Recurrence dates */
.recurrence-dates {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: -8px;
  margin-bottom: 8px;
  animation: fadeUp 0.2s ease;
}

/* Installment preview */
.installment-preview {
  background: var(--green-soft);
  color: var(--primary);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Modal de lançamento mais compacto */
#tx-modal .modal-content {
  padding: 22px 24px;
}
#tx-modal .grid-2 {
  margin-bottom: 10px;
}
#tx-modal .field {
  gap: 4px;
}
#tx-modal .field label {
  font-size: 10px;
}
#tx-modal .field input,
#tx-modal .field select {
  padding: 9px 12px;
}
#tx-modal .switch-row {
  padding: 10px 14px;
  margin: 6px 0 10px;
}
#tx-modal .amount-input {
  font-size: 24px !important;
  padding: 12px 16px !important;
}
#tx-modal .modal-header {
  margin-bottom: 12px;
}
#tx-modal .tabs {
  margin-bottom: 12px;
}

/* Esconde AI FAB na tela de login - handled above */

/* Login mobile fix */
@media (max-width: 960px) {
  .login-form-wrap {
    padding: 32px 24px;
    justify-content: flex-start;
    padding-top: 48px;
  }
  .login-screen {
    min-height: 100dvh;
  }
  .login-grid {
    min-height: 100dvh;
  }
}

/* Required star */
.required-star { color: var(--secondary); font-size: 12px; }

/* Amount wrap */
.amount-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.amount-wrap .amount-input { flex: 1; }

/* Field error state */
.field-error input,
.field-error select {
  border-color: var(--secondary) !important;
  background: var(--red-soft) !important;
}
.field-error-msg {
  font-size: 11px;
  color: var(--secondary);
  margin-top: 2px;
}

/* Amount wrap com preview */
.amount-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.amount-wrap .amount-input {
  flex: 1;
}
.required-star {
  color: var(--secondary);
  font-size: 12px;
}

/* ==============================
   ZOOM / DESKTOP RESPONSIVIDADE
   Adapta o layout para qualquer
   nivel de zoom do navegador
============================== */

/* Sidebar se adapta ao zoom */
@media (max-width: 1200px) and (min-width: 961px) {
  .app { grid-template-columns: 240px 1fr; }
  .sidebar { padding: 20px 16px; }
  .nav-btn { font-size: 13px; padding: 10px 12px; }
  .brand { font-size: 18px; }
}

@media (max-width: 1100px) and (min-width: 961px) {
  .app { grid-template-columns: 200px 1fr; }
  .main { padding: 28px 24px; }
  .bi-grid { grid-template-columns: 1fr 1fr; }
  .bi-highlight { grid-column: span 2; }
}

/* Dashboard actions quebra em 2 linhas quando necessário */
@media (max-width: 1150px) and (min-width: 961px) {
  .dashboard-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }
  .period-selector-wrap .custom-select-btn {
    min-width: 130px;
  }
}

/* Formulário de contas em menos colunas */
@media (max-width: 1100px) and (min-width: 961px) {
  .acc-form {
    grid-template-columns: 1fr 1fr 1fr !important;
  }
  .acc-form-btn { grid-column: span 3; }
}

/* Filtros de lançamentos */
@media (max-width: 1100px) and (min-width: 961px) {
  #page-lancamentos .filters-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  #page-lancamentos .filters-row .custom-select-btn {
    min-width: 120px;
  }
}

/* Cards de conta */
@media (max-width: 1100px) and (min-width: 961px) {
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* Gráficos */
@media (max-width: 1100px) and (min-width: 961px) {
  .grid-2-3 { grid-template-columns: 1fr; }
  .card-wide { grid-column: 1; }
  .chart-wrap { height: 240px; }
}

/* Relatórios */
@media (max-width: 1100px) and (min-width: 961px) {
  .grid-2-eq { grid-template-columns: 1fr; }
}

/* Sidebar premium CTA */
@media (max-width: 1100px) and (min-width: 961px) {
  .sidebar-premium-cta { padding: 12px; }
  .sidebar-premium-icon { font-size: 22px; }
  .sidebar-premium-title { font-size: 13px; }
  .sidebar-premium-desc { font-size: 11px; }
}

/* Garante que o conteúdo nunca ultrapassa a viewport */
@media (min-width: 961px) {
  .main {
    max-width: calc(100vw - 280px);
    overflow-x: hidden;
  }
  .card, .bi-card, .bi-grid,
  .grid-2-3, .grid-2-eq, .grid-cards {
    max-width: 100%;
  }
}

/* AI Quick Questions */
.ai-quick-questions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.ai-quick-questions::-webkit-scrollbar { display: none; }

.ai-quick-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  font-weight: 500;
}
.ai-quick-btn:hover {
  background: var(--green-soft);
  border-color: var(--primary);
  color: var(--primary);
}

/* AI Pending Confirmations */
.ai-pending-confirms {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.ai-confirm-card {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ai-confirm-info {
  flex: 1;
  min-width: 0;
}
.ai-confirm-desc {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-confirm-detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.ai-confirm-amount {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.ai-confirm-amount.despesa { color: var(--secondary); }
.ai-confirm-amount.receita { color: var(--primary); }
.ai-confirm-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.ai-confirm-ok {
  background: var(--green-soft);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.ai-confirm-ok:hover { background: var(--primary); color: #fff; }
.ai-confirm-cancel {
  background: var(--red-soft);
  color: var(--secondary);
  border: 1px solid var(--secondary);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.ai-confirm-cancel:hover { background: var(--secondary); color: #fff; }

.ai-confirm-card-delete {
  border-color: var(--secondary);
}
.ai-confirm-ok-delete {
  background: var(--red-soft);
  color: var(--secondary);
  border-color: var(--secondary);
}
.ai-confirm-ok-delete:hover {
  background: var(--secondary);
  color: #fff;
}

/* ==============================
   Manual Page
============================== */
.manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 20px;
}
@media (max-width: 900px) {
  .manual-grid { grid-template-columns: 1fr; }
}

.manual-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.manual-icon { font-size: 24px; }
.manual-card h3 { margin: 0; }

.manual-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.manual-list li {
  font-size: 14px;
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
  color: var(--text);
}
.manual-list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}
.manual-list li strong { color: var(--primary); }
.manual-list li em {
  background: var(--bg);
  border-radius: 6px;
  padding: 1px 6px;
  font-style: normal;
  font-size: 13px;
  font-family: monospace;
}

.manual-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.manual-example {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--primary);
}
.manual-example em {
  font-style: normal;
  font-family: monospace;
}
.manual-example-bad {
  background: var(--red-soft);
  color: var(--secondary);
}

.manual-tip {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

/* Mensagens de confirmação da IA — linha única compacta */
.ai-msg.ai:has(> *:only-child) {
  padding: 8px 14px;
}
.ai-msg.ai {
  word-break: break-word;
}

/* ==============================
   Viagens
============================== */
.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.trips-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.trips-empty-icon { font-size: 56px; margin-bottom: 16px; }
.trips-empty h3 { margin-bottom: 8px; color: var(--text); }

.trip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: box-shadow 0.2s;
}
.trip-card:hover { box-shadow: var(--shadow-float); }

.trip-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.trip-card-info { flex: 1; min-width: 0; }
.trip-card-name {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trip-card-dest,
.trip-card-dates {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.trip-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.trip-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.trip-status-planned  { background: var(--accent-soft); color: var(--text); }
.trip-status-active   { background: rgba(45,106,79,0.12); color: var(--primary); }
.trip-status-done     { background: var(--green-soft); color: var(--primary); }

.trip-card-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px;
  background: var(--bg);
  border-radius: 14px;
  border: 1px solid var(--border);
}
.trip-val-item { text-align: center; }
.trip-val-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 4px;
}
.trip-val-amount {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
}
.trip-val-amount.green { color: var(--primary); }
.trip-val-amount.red   { color: var(--secondary); }

.trip-progress-wrap { display: flex; flex-direction: column; gap: 4px; }
.trip-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.trip-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.trip-progress-fill.over { background: var(--secondary); }
.trip-progress-label {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

/* Trip detail modal */
.trip-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

/* Botões de ação sempre visíveis dentro do modal de detalhes da viagem */
#trip-detail-modal .tx-actions { opacity: 1; }
.trip-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}
.trip-notes {
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 4px;
}

/* ==============================
   Nav Premium Badge (Viagens)
============================== */
.nav-premium-badge {
  font-size: 11px;
  margin-left: auto;
  opacity: 0.7;
}

.nav-btn-locked {
  opacity: 0.6;
  position: relative;
}
.nav-btn-locked::after {
  content: "🔒";
  font-size: 12px;
  margin-left: auto;
}
/* Esconde o badge ✨ quando bloqueado (o 🔒 já aparece via ::after) */
.nav-btn-locked .nav-premium-badge {
  display: none;
}

/* ==============================
   AI — Trip context hint
============================== */
.ai-trip-hint {
  margin: 8px 0;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(27,67,50,0.08), rgba(45,106,79,0.06));
  border: 1px solid rgba(27,67,50,0.2);
  border-radius: 12px;
  font-size: 13px;
  color: var(--primary);
  line-height: 1.4;
}
.ai-trip-hint strong { font-weight: 700; }

/* ==============================
   Free plan limit banners
============================== */
.limit-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: var(--red-soft);
  border: 1px solid rgba(224, 122, 95, 0.3);
  font-size: 13.5px;
  color: var(--text);
}
.limit-banner strong { color: var(--secondary); }
.limit-banner-btn {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.limit-banner-btn:hover { background: var(--primary-hover); }

.limit-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(244, 162, 97, 0.25);
  font-size: 12.5px;
  color: var(--muted);
}
.limit-info strong { color: var(--text); }

/* ==============================
   Trip — Transfer balance box
============================== */
.trip-transfer-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  margin-bottom: 4px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(27,67,50,0.06), rgba(45,106,79,0.04));
  border: 1px solid rgba(27,67,50,0.18);
}
.trip-transfer-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.trip-transfer-icon { font-size: 28px; }
.trip-transfer-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.trip-transfer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
