:root {
  --navy: #282FBC;
  --navy-dark: #1f2494;
  --nav-active: #4078DB;
  --light-blue: #E2EFFF;
  --primary: #2F66CB;
  --success: #73A839;
  --warning: #DD5600;
  --border: rgba(0,0,0,.125);
  --header-bg: rgba(0,0,0,.03);
  --text: #272727;
  --muted: #6c757d;
  --alert-primary-bg: #D5E0F5;
  --alert-primary-color: #18356A;
  --alert-primary-border: #C5D4F0;
  --alert-secondary-bg: #FBFBFC;
  --alert-secondary-color: #797B7C;
  --alert-secondary-border: #F9FAFB;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, h5, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Top bar ---------- */
#top-bar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  font-size: 12.6px;
  flex-wrap: wrap;
  gap: 8px;
}

.navbar-toggler {
  background: transparent;
  border: none;
  padding: 4px;
  display: none;
}
.navbar-toggler span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  margin: 3px 0;
}

.top-bar-left, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-bar-left a { color: #fff; }
#sv-usuario { color: rgba(255,255,255,.8); }

.badge-indique {
  background: var(--success);
  color: #fff;
  padding: 3px 12px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.ia-link { display: flex; align-items: center; gap: 4px; color: #fff; }

.badge-expira {
  background: orange;
  color: #fff;
  padding: 3px 8px;
  border-radius: 3px;
  font-weight: 600;
}

.atendimento-link, .sair-link { color: #fff; display: flex; align-items: center; gap: 5px; }
.atendimento-link i { color: #12c100; }

/* ---------- Middle (logo + company name) ---------- */
#middle {
  padding: 16px 24px 0;
}
.topo-linha { display: flex; }
.brand-logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.brand-suas, .brand-endas { color: var(--navy); }
.brand-v { color: var(--warning); }

.company-name {
  font-size: 20px;
  color: var(--text);
  font-weight: 400;
  margin: 6px 0 12px;
}

/* ---------- Main nav ---------- */
#main-nav {
  background: var(--navy);
  padding: 0 24px;
}
.nav-list {
  display: flex;
  flex-wrap: wrap;
}
.nav-list > li > a {
  display: block;
  color: #fff;
  padding: 10px 14px;
  font-size: 12.6px;
  white-space: nowrap;
}
.nav-list > li.active > a,
.nav-list > li > a:hover {
  background: var(--nav-active);
}
.dropdown { position: relative; }
.dropdown-toggle i { margin-left: 4px; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  color: var(--text);
  min-width: 220px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  border-radius: 3px;
  z-index: 50;
  padding: 6px 0;
}
.dropdown-menu a {
  display: block;
  padding: 8px 16px;
  color: var(--text);
}
.dropdown-menu a:hover { background: #f2f2f2; }
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu.show { display: block; }
.dropdown-divider { height: 1px; background: #e9ecef; margin: 6px 0; }
.mobile-only.mobile-only { display: none; }

/* ---------- Content title ---------- */
.content-title {
  background: var(--light-blue);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.content-title h2 {
  font-size: 19.6px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 24px 6px;
}
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar-period { display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.25px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 3px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning sup { font-weight: 600; }
.btn-period {
  background: #6c757d;
  color: #fff;
  border: 1px solid #6c757d;
  border-radius: 3px;
  padding: 7px 12px;
  font-size: 12.25px;
}
.btn-ok {
  background: #6c757d;
  color: #fff;
  border: 1px solid #6c757d;
  border-radius: 3px;
  padding: 7px 16px;
  font-size: 12.25px;
  font-weight: 700;
}

/* ---------- Gadgets grid ---------- */
.gadgets-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  padding: 10px 24px 40px;
}
@media (max-width: 860px) {
  .gadgets-grid { grid-template-columns: minmax(0, 1fr); }
}

.card.gadget {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 0;
}
.card-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-header .total { font-weight: 400; color: var(--text); margin-left: auto; margin-right: 8px; }
.close-icon { color: #adb5bd; font-size: 13px; cursor: pointer; }

.card-body { padding: 18px; min-height: 220px; min-width: 0; }

/* onboarding card */
.onboarding-body { padding: 8px 24px; }
.onboarding-step {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 14px 0;
}
.step-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.step-icon-primary { background: var(--primary); color: #fff; }
.step-icon-secondary { background: #e9ecef; color: var(--primary); }

.step-alert {
  flex: 1;
  border: 1px solid;
  border-radius: 3px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.step-alert h5 { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.step-alert p { font-size: 13px; }
.step-alert-primary {
  background: var(--alert-primary-bg);
  color: var(--alert-primary-color);
  border-color: var(--alert-primary-border);
}
.step-alert-secondary {
  background: var(--alert-secondary-bg);
  color: var(--alert-secondary-color);
  border-color: var(--alert-secondary-border);
}
.help-btn {
  background: none;
  border: none;
  color: inherit;
  opacity: .6;
  font-size: 15px;
}
.onboarding-more {
  text-align: center;
  color: #adb5bd;
  letter-spacing: 3px;
  margin-top: 4px;
}

/* chart card */
.chart-body { position: relative; height: 260px; min-width: 0; }
.chart-body canvas { max-width: 100%; }
.demo-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  color: rgba(0,0,0,.15);
  font-weight: 600;
  pointer-events: none;
  z-index: 1;
}

/* empty card */
.empty-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}
.empty-body h3 { font-size: 17px; font-weight: 400; color: var(--text); }

/* ---------- Footer ---------- */
.page-footer {
  text-align: center;
  padding: 20px 0 60px;
}
.footer-logo { font-size: 16px; }

/* ---------- Floating buttons ---------- */
.fb-container {
  position: fixed;
  right: 24px;
  bottom: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 100;
  pointer-events: none;
}
.fb-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0;
  transform: scale(.4) translateY(8px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.fb-receita { color: var(--success); }
.fb-despesa { color: #dc3545; }

.fb-container:hover .fb-btn,
.fb-container.open .fb-btn {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Cascata: o botão mais próximo do "+" abre primeiro */
.fb-container .fb-btn:nth-last-of-type(1) { transition-delay: 0s; }
.fb-container .fb-btn:nth-last-of-type(2) { transition-delay: .03s; }
.fb-container .fb-btn:nth-last-of-type(3) { transition-delay: .06s; }
.fb-container .fb-btn:nth-last-of-type(4) { transition-delay: .09s; }
.fb-container .fb-btn:nth-last-of-type(5) { transition-delay: .12s; }
.fb-container .fb-btn:nth-last-of-type(6) { transition-delay: .15s; }

.fb-toggle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  border: none;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: transform .2s ease;
}
.fb-container.open .fb-toggle { transform: rotate(45deg); }

.chat-bubble {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #4a3aff;
  color: #fff;
  border: none;
  font-size: 18px;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  z-index: 100;
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .navbar-toggler { display: block; }
  .top-bar-left .site-link { display: none; }
  #main-nav .nav-list { display: none; }
  .toolbar-actions .btn:not(.btn-primary) { display: none; }
  .content-title .btn.mobile-only { display: inline-flex; }
  .toolbar-actions > a.btn-primary { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fb-btn, .fb-toggle, .dropdown-menu { transition: none !important; }
}
