:root {
  --bg: #0a0c10;
  --surface: #111318;
  --surface2: #1a1d24;
  --surface3: #22262f;
  --border: #2a2d36;
  --accent: #00e5a0;
  --red: #ff6b6b;
  --yellow: #ffd93d;
  --blue: #6bcbff;
  --purple: #c084fc;
  --text: #f0f2f8;
  --text2: #8b90a0;
  --text3: #555a6a;
  --radius: 12px;
  --radius-sm: 8px
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

body {
  font-family: 'Trebuchet MS', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden
}

.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: visible
}

.nav-logo {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
  padding: 13px 0;
  margin-right: 20px;
  white-space: nowrap
}

.nav-logo span {
  color: var(--text)
}

.nav-tabs {
  display: flex;
  gap: 0;
  flex: 1;
  overflow: visible
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 13px 11px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: .2s;
  white-space: nowrap
}

.tab-btn:hover {
  color: var(--text)
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  position: relative
}
/* Traço acima do item de menu ativo (além do traço inferior já existente) */
.tab-btn.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 11px;
  right: 11px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px
}

/* ── NAV DROPDOWN ─────────────────────────────── */
.nav-dropdown {
  position: relative;
  display: flex;
  align-items: stretch;
}

.nav-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nd-arrow {
  font-size: 9px;
  opacity: .6;
  transition: transform .2s;
}

.nav-dropdown.open .nd-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  min-width: 180px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  padding: 4px 0;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
}

.nav-sub-item {
  padding: 10px 16px !important;
  text-align: left;
  border-radius: 0 !important;
  border-bottom: none !important;
  font-size: 12px !important;
  width: 100%;
}

.nav-sub-item:hover {
  background: var(--surface2);
  color: var(--accent);
}

.nav-sub-item.active {
  color: var(--accent);
  background: var(--surface2);
  border-bottom: none !important;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
  color: var(--text2);
  font-size: 12px;
  white-space: nowrap
}

.btn-logout {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  font: 700 12px inherit
}

.btn-logout:hover {
  background: var(--red);
  color: #fff
}

.main {
  padding: 28px 24px;
  max-width: 1400px;
  margin: 0 auto
}

.page {
  display: none
}

.page.active {
  display: block
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px
}

/* ── CAIXA / INVESTIMENTOS ─────────────────────────── */
.contas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 14px
}
.conta-card {
  background: var(--surface2, var(--surface));
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .2s, transform .2s
}
.conta-card:hover { transform: translateY(-2px) }
.conta-card .cc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.conta-card .cc-nome { font-weight: 700; font-size: 14px; color: var(--text) }
.conta-card .cc-banco { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .5px }
.conta-card .cc-saldo { font-size: 22px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px }
.conta-card .cc-acoes { display: flex; gap: 6px; margin-top: 8px }
.conta-card.inativa { opacity: .55; border-left-color: var(--text3) }
.inv-badge {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .5px
}
.inv-badge.ativo { background: rgba(0,229,160,.15); color: var(--accent) }
.inv-badge.resgatado { background: rgba(139,144,160,.18); color: var(--text3) }
.mov-tipo-tag { font-weight: 700 }
.mov-tipo-tag.entrada { color: var(--green, #00e5a0) }
.mov-tipo-tag.saida { color: var(--red, #ff6b6b) }

.card-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px
}

.card-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px
}

.green {
  color: var(--accent)
}

.red {
  color: var(--red)
}

.yellow {
  color: var(--yellow)
}

.blue {
  color: var(--blue)
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px
}

.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px
}

.chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: .5px;
  margin-bottom: 16px;
  text-transform: uppercase
}

.chart-box canvas {
  max-height: 260px
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap
}

.filter-bar label,
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .5px;
  text-transform: uppercase
}

select,
input,
textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  outline: none
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--accent)
}

select option {
  background: var(--surface2)
}

textarea {
  resize: vertical;
  min-height: 70px;
  width: 100%
}

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

.section-title {
  font-size: 20px;
  font-weight: 800
}

.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: .2s
}

.btn-primary {
  background: var(--accent);
  color: #000
}

.btn-primary:hover {
  background: #00c988
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  padding: 5px 10px;
  font-size: 11px
}

.btn-danger:hover {
  background: var(--red);
  color: #fff
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent)
}

.btn-outline:hover {
  background: var(--accent);
  color: #000
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

thead th {
  background: var(--surface2);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border)
}

tbody tr {
  border-bottom: 1px solid var(--border)
}

tbody tr:hover {
  background: var(--surface2)
}

tbody td {
  padding: 12px 16px;
  color: var(--text);
  font-size: 13px
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600
}

.badge-green {
  background: rgba(0, 229, 160, .15);
  color: var(--accent)
}

.badge-red {
  background: rgba(255, 107, 107, .15);
  color: var(--red)
}

.badge-yellow {
  background: rgba(255, 217, 61, .15);
  color: var(--yellow)
}

.badge-blue {
  background: rgba(107, 203, 255, .15);
  color: var(--blue)
}

.badge-purple {
  background: rgba(192, 132, 252, .15);
  color: var(--purple)
}

.badge-gray {
  background: rgba(139, 144, 160, .15);
  color: var(--text2)
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px
}

.modal-overlay.open {
  display: flex
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px
}

.modal-title {
  font-size: 18px;
  font-weight: 800
}

.modal-close {
  background: var(--surface3);
  border: none;
  color: var(--text2);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px
}

.modal-close:hover {
  background: var(--red);
  color: #fff
}

.form-grid {
  display: grid;
  gap: 16px
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.form-group select,
.form-group input {
  width: 100%
}

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

.empty {
  text-align: center;
  padding: 30px;
  color: var(--text3);
  font-size: 14px
}

.status-pago {
  color: var(--accent);
  font-weight: 700
}

.status-pendente {
  color: var(--red);
  font-weight: 700
}

.cadastro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px
}

.cadastro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px
}

.cadastro-card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text2);
  text-transform: uppercase
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 32px
}

.tag {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px
}

.tag-del {
  cursor: pointer;
  color: var(--text3);
  font-size: 14px
}

.tag-del:hover {
  color: var(--red)
}

.add-inline {
  display: flex;
  gap: 8px
}

.add-inline input {
  flex: 1
}

.amount-positive {
  color: var(--accent);
  font-weight: 700
}

.amount-negative {
  color: var(--red);
  font-weight: 700
}

.mini-summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 0 0 14px;
  color: var(--text2);
  font-size: 12px
}

.mini-summary strong {
  color: var(--text);
  font-size: 15px
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 30px
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--accent)
}

.login-sub {
  color: var(--text2);
  margin-bottom: 24px
}

.alert {
  margin-top: 14px;
  color: var(--red);
  font-size: 13px
}

@media(max-width:700px) {
  .charts-grid {
    grid-template-columns: 1fr
  }

  .form-row {
    grid-template-columns: 1fr
  }

  .nav-logo {
    font-size: 15px;
    margin-right: 16px
  }

  .user-info {
    display: none
  }
}
/* ======================================================
   RESPONSIVIDADE MOBILE — FlowCred
   Breakpoint principal: 768px
   ====================================================== */

/* --- BOTTOM NAV (mobile) --- */
.mobile-bottom-nav {
  display: none;
}

.mobile-fab-area {
  display: none;
}

/* --- HAMBURGER --- */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text2);
  border-radius: 2px;
  transition: all .25s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Drawer overlay */
.nav-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 200;
  backdrop-filter: blur(3px);
}
.nav-drawer-overlay.open { display: block; }

/* Drawer menu */
.nav-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 260px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 201;
  transition: left .28s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.nav-drawer.open { left: 0; }

.nav-drawer-header {
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-drawer-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}
.nav-drawer-logo span { color: var(--text); }
.nav-drawer-close {
  background: var(--surface3);
  border: none;
  color: var(--text2);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-drawer-user {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text2);
}
.nav-drawer-user strong { color: var(--text); font-size: 14px; display: block; margin-bottom: 2px; }

.nav-drawer-items {
  flex: 1;
  padding: 10px 0;
}
.nav-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.nav-drawer-item:hover { background: var(--surface2); color: var(--text); }
.nav-drawer-item.active { background: rgba(0,229,160,.08); color: var(--accent); border-left: 3px solid var(--accent); }
.nav-drawer-item .drawer-icon { font-size: 18px; width: 24px; text-align: center; }

.nav-drawer-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.nav-drawer-footer .btn-logout {
  width: 100%;
  text-align: center;
}

/* --- BOTTOM QUICK ACTION BAR (mobile) --- */
@media (max-width: 768px) {

  /* Esconde nav desktop */
  .nav-tabs { display: none !important; }
  .user-info { display: none !important; }
  .hamburger-btn { display: flex !important; }

  /* Alertas (sino + licença) ficam visíveis e empurrados para a direita */
  #nav-alertas { margin-left: auto; }
  #nav-alertas #licenca-badge { font-size: 10px; padding: 2px 7px; }

  /* Ajusta nav */
  .nav { padding: 0 16px !important; justify-content: space-between !important; }
  .nav-logo { margin-right: 0 !important; }

  /* Main padding bottom para não ficar atrás da bottom nav */
  .main { padding: 16px 12px 90px; }

  /* Cards em coluna */
  .cards-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }

  /* Saúde financeira: empilha abaixo dos cards no mobile */
  .dash-top-row { flex-direction: column !important; }
  #saude-financeira { width: 100% !important; }

  /* Charts em coluna */
  .charts-grid { grid-template-columns: 1fr !important; }

  /* Tabelas — scroll horizontal */
  .table-wrap { overflow-x: auto; }
  table { min-width: 500px; }
  thead th, tbody td { padding: 8px 10px; font-size: 11px; }

  /* Section header empilha */
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .header-actions { width: 100%; }
  .header-actions .btn { font-size: 12px; padding: 7px 12px; }

  /* Filter bar scroll */
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding-bottom: 4px; }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar label { white-space: nowrap; font-size: 10px; }
  .filter-bar select { font-size: 12px; padding: 6px 8px; min-width: 90px; }

  /* Modal full screen no mobile */
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 18px 18px 0 0 !important;
    max-height: 92vh !important;
    padding: 20px 16px 24px !important;
  }

  /* Form row vira coluna */
  .form-row { grid-template-columns: 1fr !important; }

  /* Bottom action bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 150;
    padding: 8px 4px;
    gap: 2px;
    justify-content: space-around;
    align-items: center;
  }

  .mobile-bottom-nav .mbn-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 10px;
    color: var(--text3);
    font-size: 10px;
    font-family: inherit;
    font-weight: 600;
    transition: all .15s;
    min-width: 52px;
  }
  .mobile-bottom-nav .mbn-btn .mbn-icon { font-size: 20px; line-height: 1; }
  .mobile-bottom-nav .mbn-btn.active { color: var(--accent); background: rgba(0,229,160,.08); }
  .mobile-bottom-nav .mbn-btn:hover { color: var(--text); }

  /* FAB botão de ação rápida central */
  .mobile-fab-area {
    display: block;
    position: fixed;
    bottom: 70px;
    right: 16px;
    z-index: 160;
  }

  .fab-main {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    border: none;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,229,160,.4);
    transition: transform .2s, background .2s;
  }
  .fab-main:active { transform: scale(.92); }
  .fab-main.open { background: var(--red); }

  .fab-menu {
    position: absolute;
    bottom: 60px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all .2s;
  }
  .fab-menu.open { opacity: 1; pointer-events: all; transform: translateY(0); }

  .fab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 9px 14px 9px 10px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    transition: background .15s;
  }
  .fab-item:active { background: var(--surface2); }
  .fab-item .fab-item-icon { font-size: 18px; }

  /* Seção title menor */
  .section-title { font-size: 16px !important; }

  /* Cards grid menor em telas muito pequenas */
  @media (max-width: 400px) {
    .cards-grid { grid-template-columns: 1fr !important; }
  }

  /* Plan grid meses */
  #plan-grid-meses { grid-template-columns: 1fr !important; }
}

/* ── CADASTROS — novo visual ─────────────────────────────────── */
.cad-new-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.cad-new-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.03);
  border-radius: 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 240px;
  max-height: 340px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
}
.cad-new-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.cad-new-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cad-new-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text2);
}
.cad-new-tags {
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-content: flex-start;
  overflow-y: auto;
  min-height: 80px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.cad-new-tags::-webkit-scrollbar { width: 4px }
.cad-new-tags::-webkit-scrollbar-track { background: transparent }
.cad-new-tags::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px }
.cad-new-tag {
  background: rgba(0,229,160,.08);
  color: var(--accent);
  padding: 5px 10px 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
  max-width: 100%;
  white-space: nowrap;
}
.cad-new-tag:hover { background: rgba(0,229,160,.15) }
.cad-new-tag-del {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  opacity: .6;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.cad-new-tag-del:hover { opacity: 1 }
.cad-new-empty {
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
  padding: 4px 0;
}
.cad-new-input {
  display: flex;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  margin-top: auto;
}
.cad-new-input input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .2s;
  outline: none;
}
.cad-new-input input::placeholder { color: var(--text3) }
.cad-new-input input:focus { border-color: var(--accent) }
.cad-new-input button {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.cad-new-input button:hover { background: var(--accent2, #00b87e) }
.cad-new-input button:active { transform: scale(.95) }

/* ── SIDEBAR LATERAL ─────────────────────────────────────────── */
.sidebar {
  display: none; /* oculta por padrão — ativa com .layout-sidebar no body */
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 200;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-logo {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.sidebar-logo span { color: var(--text) }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px }
.sidebar-item {
  width: 100%;
  background: none;
  border: none;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.sidebar-item:hover, .sidebar-item.active { background: var(--surface2); color: var(--text) }
.sidebar-item.active { color: var(--accent); border-left: 3px solid var(--accent); padding-left: 17px; position: relative }
.sidebar-item.active::before, .sidebar-item.active::after {
  content: ""; position: absolute; left: 17px; right: 12px; height: 2px;
  background: var(--accent); border-radius: 2px; opacity: .65
}
.sidebar-item.active::before { top: 4px }
.sidebar-item.active::after { bottom: 4px }
.si-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0 }
.si-label { flex: 1 }
.si-arrow { font-size: 11px; transition: transform .2s; color: var(--text3) }
.sidebar-group-trigger.open .si-arrow { transform: rotate(180deg) }
.sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.sidebar-submenu.open { max-height: 300px }
.sidebar-subitem {
  width: 100%;
  background: none;
  border: none;
  color: var(--text3);
  display: block;
  padding: 8px 20px 8px 50px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.sidebar-subitem:hover { background: var(--surface2); color: var(--text) }
.sidebar-subitem.active { color: var(--accent) }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 8px; flex-shrink: 0 }

/* ── LAYOUT: SIDEBAR ativo ──────────────────────────────────── */
body.layout-sidebar .sidebar { display: flex }
body.layout-sidebar .nav { display: none !important }
body.layout-sidebar .main {
  margin-left: 220px;
  max-width: none;
  margin-right: 0;
}
body.layout-sidebar .hamburger-btn { display: none }

/* ── LAYOUT CARD selecionado ────────────────────────────────── */
.layout-card-active {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(0,229,160,.15) !important;
}

/* ── Minhas Dívidas — linhas agrupadas ───────────────────────── */
tr.md-grupo-row td { padding: 12px 16px; vertical-align: middle }
tr.md-filho td { padding: 8px 16px; vertical-align: middle }
tr.md-grupo-row:hover td { background: var(--surface3) }

/* ── Alerta devedores ────────────────────────────────────────── */
@keyframes piscarAlerta {
  0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(234,179,8,.5) }
  50%      { opacity: .85; box-shadow: 0 0 0 6px rgba(234,179,8,0) }
}

/* ── Cadastros Submenu ───────────────────────────────────────── */
.cad-submenu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.cad-submenu-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
  line-height: 1.3;
}
.cad-submenu-btn:hover {
  background: var(--surface3);
  color: var(--text1);
  border-color: var(--accent);
}
.cad-submenu-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 700;
}
.cad-sub-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
@media (max-width: 600px) {
  .cad-submenu {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
  }
  .cad-submenu::-webkit-scrollbar { display: none; }
  .cad-submenu-btn {
    flex-shrink: 0;
    padding: 7px 11px;
    font-size: 12px;
  }
  .cad-sub-panel { padding: 14px; }
}

/* ════════════════════════════════════════════════════════════════
   EXPERIÊNCIA MOBILE DEDICADA (Principal / Transações / Devedores)
   Só aparece em telas pequenas. Não afeta o desktop.
   ════════════════════════════════════════════════════════════════ */
#page-mobile-home { display: none; }

@media (max-width: 768px) {
  /* Página mobile-home assume o lugar quando ativa */
  #page-mobile-home.page.active { display: block; }

  /* Esconde o dashboard "desktop" no mobile quando usamos a home mobile */
  body.mobile-home-on #page-dashboard { display: none !important; }

  .mh-wrap { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }

  /* Filtro de período discreto */
  .mh-period {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin: 2px 0 4px;
  }
  .mh-period select {
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text2); font-family: inherit; font-size: 12px; font-weight: 600;
    padding: 4px 8px; border-radius: 8px; cursor: pointer; appearance: none;
    text-align: center;
  }
  .mh-period .mh-period-sep { color: var(--text3); font-size: 12px; }

  /* Cabeçalho de saldo */
  .mh-hero {
    text-align: center;
    padding: 10px 0 14px;
  }
  .mh-hero-label { font-size: 12px; color: var(--text3); letter-spacing: .3px; }
  .mh-hero-value { font-size: 38px; font-weight: 800; letter-spacing: -1.5px; margin-top: 2px; }
  .mh-hero-value.hidden-amount { letter-spacing: 2px; }

  /* Resumo receitas/despesas */
  .mh-rd {
    display: flex; gap: 10px; margin: 6px 0 18px;
  }
  .mh-rd-item {
    flex: 1; display: flex; align-items: center; gap: 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 12px;
  }
  .mh-rd-ico {
    width: 38px; height: 38px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
  }
  .mh-rd-ico.up { background: rgba(0,229,160,.16); color: var(--accent); }
  .mh-rd-ico.down { background: rgba(255,107,107,.16); color: var(--red); }
  .mh-rd-label { font-size: 11px; color: var(--text3); }
  .mh-rd-value { font-size: 15px; font-weight: 700; }

  /* Carrossel deslizável (saldo/cartão/conta/investimento) */
  .mh-section-title {
    font-size: 13px; font-weight: 700; color: var(--text2);
    margin: 18px 2px 8px; display: flex; align-items: center; justify-content: space-between;
  }
  .mh-carousel {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
    padding: 2px 2px 8px; margin: 0 -2px;
    -webkit-overflow-scrolling: touch;
  }
  .mh-carousel::-webkit-scrollbar { display: none; }
  .mh-card {
    scroll-snap-align: start; flex: 0 0 86%; min-width: 86%;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 18px; padding: 18px; position: relative; overflow: hidden;
  }
  .mh-card.grad-caixa  { background: linear-gradient(135deg, #103a30, #0c2a24); }
  .mh-card.grad-conta  { background: linear-gradient(135deg, #10243a, #0c1b2a); }
  .mh-card.grad-invest { background: linear-gradient(135deg, #1a2440, #11182b); }
  .mh-card.grad-cartao { background: linear-gradient(135deg, #2a1038, #1c0c2a); }
  .mh-card-top { display: flex; align-items: center; justify-content: space-between; }
  .mh-card-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text3); font-weight: 700; }
  .mh-card-ico { font-size: 20px; }
  .mh-card-big { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 10px; }
  .mh-card-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
  .mh-card-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); margin-top: 6px; }
  .mh-bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 10px; }
  .mh-bar > div { height: 100%; border-radius: 6px; }
  .mh-dots { display: flex; gap: 5px; justify-content: center; margin-top: 6px; }
  .mh-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: .2s; }
  .mh-dot.active { background: var(--accent); width: 16px; border-radius: 4px; }

  .mh-empty { color: var(--text3); font-size: 13px; padding: 18px; text-align: center; }

  /* Bloco gráfico/planejamento */
  .mh-block {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 16px; margin-top: 14px;
  }
  .mh-block-title { font-size: 13px; font-weight: 700; color: var(--text2); margin-bottom: 12px; }

  /* Bottom nav novo (4 itens + FAB central) */
  .mobile-bottom-nav.mh-nav { padding: 6px 2px; }
  .mobile-bottom-nav.mh-nav .mbn-btn { min-width: 0; flex: 1; }
  .mobile-bottom-nav.mh-nav .mbn-spacer { flex: 0 0 56px; }

  /* FAB central no meio da nav */
  .mh-fab-center {
    position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--accent); color: #04140d; border: none;
    font-size: 30px; font-weight: 400; z-index: 220; cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,229,160,.4);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s, background .2s;
  }
  .mh-fab-center.open { transform: translateX(-50%) rotate(45deg); background: var(--red); color: #fff; }

  /* Menu de ações — bottom sheet opaco (estilo Mobills) */
  .mh-fab-sheet {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 215;
    background: var(--surface);
    border-radius: 22px 22px 0 0;
    padding: 10px 16px calc(96px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 10px;
    transform: translateY(110%); transition: transform .26s cubic-bezier(.3,.8,.3,1);
    box-shadow: 0 -10px 40px rgba(0,0,0,.55);
  }
  .mh-fab-sheet.open { transform: translateY(0); }
  .mh-sheet-title {
    font-size: 13px; font-weight: 700; color: var(--text3);
    text-transform: uppercase; letter-spacing: .6px; text-align: center; margin-bottom: 2px;
  }
  .mh-fab-act {
    display: flex; align-items: center; gap: 14px; width: 100%;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 14px; padding: 15px 16px; color: var(--text);
    font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
    transition: background .15s, transform .1s;
  }
  .mh-fab-act:active { background: var(--border); transform: scale(.985); }
  .mh-fab-act .lbl { flex: 1; text-align: left; }
  .mh-fab-act .ico {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 19px;
  }
  .mh-fab-act .ico.rec { background: rgba(0,229,160,.18); color: var(--accent); }
  .mh-fab-act .ico.des { background: rgba(255,107,107,.18); color: var(--red); }
  .mh-fab-act .ico.car { background: rgba(107,203,255,.18); color: var(--blue); }
  .mh-fab-act .ico.tra { background: rgba(124,106,247,.18); color: #8b7ff7; }

  /* Sheet do menu sanduíche (Mais) */
  .mh-more-sheet {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 210;
    background: var(--surface); border-radius: 20px 20px 0 0;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(110%); transition: .25s; box-shadow: 0 -8px 30px rgba(0,0,0,.4);
  }
  .mh-more-sheet.open { transform: translateY(0); }
  .mh-more-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 6px auto 14px; }
  .mh-more-item {
    display: flex; align-items: center; gap: 14px; width: 100%;
    background: none; border: none; border-bottom: 1px solid var(--border);
    padding: 15px 4px; color: var(--text); font-family: inherit; font-size: 15px; cursor: pointer;
  }
  .mh-more-item:last-child { border-bottom: none; }
  .mh-more-item .mi-ico { font-size: 20px; width: 26px; text-align: center; }
  .mh-sheet-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 205;
    opacity: 0; pointer-events: none; transition: .2s;
  }
  .mh-sheet-overlay.open { opacity: 1; pointer-events: auto; }
  /* O menu de navegação no mobile é o inferior (Mais); esconde o hambúrguer do topo */
  .hamburger-btn { display: none !important; }

  /* Esconde "Importar dados" no celular */
  .import-btn { display: none !important; }

  /* Cards mais compactos no mobile (dashboard, devedores, caixa, invest, dívidas) */
  .card { padding: 12px 14px !important; }
  .card-label { font-size: 11px !important; }
  .card-value { font-size: 20px !important; }
  .card-sub { font-size: 10px !important; }
  .cards-grid { gap: 8px !important; }
  .conta-card { padding: 12px 14px !important; }
  .conta-card .cc-saldo { font-size: 18px !important; }
  .contas-grid { gap: 8px !important; }

  /* Resumo de totais (Despesas) — layout limpo em células */
  .resumo-cells { display: flex; gap: 10px; flex-wrap: wrap; }
  .resumo-cell { display: flex; flex-direction: column; gap: 1px; min-width: 90px; flex: 1; }
  .resumo-cell .rc-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }
  .resumo-cell .rc-val { font-size: 16px; font-weight: 700; }
  .resumo-cell .rc-sub { font-size: 10px; color: var(--text3); }

  /* Botões de ação como ícones (não empilham) */
  td .act-icons { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
}

/* Botões de ação em ícone — válidos em qualquer tela */
.act-icons { display: flex; gap: 6px; align-items: center; }

/* Descrição com truncamento (uma linha + ...); .expanded mostra tudo */
.desc-clamp {
  display: inline-block; max-width: 180px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; vertical-align: bottom;
  cursor: pointer;
}
.desc-clamp.expanded { white-space: normal; overflow: visible; max-width: none; }

/* Strip de resumo compacto (usado no mobile) */
.resumo-strip {
  display: flex; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.resumo-strip .rs-item { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 90px; }
.resumo-strip .rs-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }
.resumo-strip .rs-val { font-size: 17px; font-weight: 700; }
.resumo-strip .rs-sub { font-size: 10px; color: var(--text3); }
.act-ico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; cursor: pointer; line-height: 1;
  background: var(--surface2); border: 1px solid var(--border);
  transition: background .15s, transform .1s;
}
.act-ico:active { transform: scale(.9); }
.act-ico.edit   { border-color: rgba(0,229,160,.4); }
.act-ico.cancel { border-color: rgba(255,107,107,.45); }
.act-ico.pay    { border-color: rgba(255,217,61,.5); }
.act-ico.charge { border-color: rgba(107,203,255,.5); }

/* Esconde a home mobile / nav nova em telas grandes sempre */
@media (min-width: 769px) {
  .mh-fab-center, .mh-fab-sheet, .mh-more-sheet, .mh-sheet-overlay { display: none !important; }
}

/* ── Onboarding (tour com spotlight) ──────────────────────────── */
#onb-overlay {
  position: fixed; inset: 0; z-index: 100000;
  pointer-events: none; display: none;
}
#onb-overlay.open { display: block; }
#onb-hole {
  position: absolute; border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.72);
  transition: all .35s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  border: 2px solid var(--accent, #00e5a0);
}
#onb-tip {
  position: absolute; z-index: 100001; max-width: 300px;
  background: var(--surface, #15171c); color: var(--text, #fff);
  border: 1px solid var(--border, #2a2d36); border-radius: 12px;
  padding: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
  pointer-events: auto; transition: all .35s cubic-bezier(.4,0,.2,1);
}
#onb-tip .onb-title { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
#onb-tip .onb-text { font-size: 13px; color: var(--text2, #b8bdc9); line-height: 1.5; }
#onb-tip .onb-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 8px; }
#onb-tip .onb-step { font-size: 11px; color: var(--text3, #6b7180); }
#onb-tip .onb-btns { display: flex; gap: 8px; }
#onb-tip button { border-radius: 8px; font: 600 12px inherit; padding: 6px 14px; cursor: pointer; border: 1px solid var(--border, #2a2d36); }
#onb-tip .onb-skip { background: transparent; color: var(--text3, #6b7180); }
#onb-tip .onb-next { background: var(--accent, #00e5a0); color: #06231b; border-color: var(--accent, #00e5a0); }
