:root {
  --bg: #0b1226;
  --panel: #101a34;
  --panel2: #0d1730;
  --border: #1f2c4d;
  --text: #e8ecf7;
  --muted: #8b96b8;
  --gold: #f0a733;
  --gold2: #f7c14b;
  --green: #26c079;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --sidebar: #0a1224;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  background: radial-gradient(1200px 600px at 80% -10%, #14204a 0%, transparent 60%), var(--bg);
}

h1, h2, h3, .brand {
  font-family: 'Poppins', sans-serif;
}

.app {
  display: flex;
  min-height: 100vh;
}

.overflow-x {
  overflow-x: auto;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 22px;
}

.logo-m {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #1a1a1a;
  font-size: 18px;
}

.brand-text .t1 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
}

.brand-text .t1 span {
  color: var(--gold);
}

.brand-text .t2 {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 1px;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item i {
  width: 16px;
  text-align: center;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  color: #1a1a1a;
  font-weight: 600;
}

.sidebar-quote {
  margin-top: auto;
  padding: 14px 6px;
  font-family: 'Poppins', sans-serif;
  font-style: italic;
  color: var(--gold2);
  font-size: 13px;
  line-height: 1.5;
}

/* Main Content */
.main {
  flex: 1;
  min-width: 0;
  padding: 22px 26px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.bell {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
}

.bell .dot {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.user .name {
  font-size: 13.5px;
  font-weight: 600;
}

.user .id {
  font-size: 11px;
  color: var(--muted);
}

.hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  padding: 26px 30px;
  margin-bottom: 20px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background:
    linear-gradient(100deg, rgba(10, 16, 36, .92) 30%, rgba(10, 16, 36, .55) 60%, rgba(10, 16, 36, .15) 100%),
    linear-gradient(180deg, #2a3a6b 0%, #d98a3d 55%, #6b3b2a 100%);
}

.hero-text h1 {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 800;
}

.hero-text h1 .accent {
  color: var(--gold2);
}

.hero-text p {
  margin-top: 8px;
  color: #c9d2ee;
  font-size: 13px;
}

.hero-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #fff;
  opacity: .9;
  flex-shrink: 0;
}

.hero-badge .logo-m {
  width: 44px;
  height: 44px;
  font-size: 20px;
}

.hero-badge span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.stat-top {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
}

.ic-gold {
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  color: #1a1a1a;
}

.ic-green {
  background: var(--green);
}

.ic-blue {
  background: var(--blue);
}

.ic-purple {
  background: var(--purple);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(38, 192, 121, .15);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  margin-top: 8px;
}

.stat-btn {
  margin-top: 12px;
  width: 100%;
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  border: none;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-decoration: none;
}

.mid-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.card-title i {
  color: var(--gold2);
}

.pill {
  font-size: 11px;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
}

.link {
  font-size: 11.5px;
  color: var(--gold2);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.chart-wrap {
  height: 190px;
}

.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-btn {
  border: none;
  border-radius: 12px;
  padding: 16px 10px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}

.a-gold {
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  color: #1a1a1a;
}

.a-blue {
  background: var(--blue);
}

.a-green {
  background: var(--green);
}

.a-purple {
  background: var(--purple);
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}

.bottom-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 20px;
}

.node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.node .circ {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
}

.node.root .circ {
  background: var(--gold);
  color: #1a1a1a;
}

.node .lbl {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.node .cnt {
  font-size: 12px;
  font-weight: 700;
}

.tree-line {
  width: 2px;
  height: 16px;
  background: var(--border);
}

.branch-row {
  display: flex;
  gap: 60px;
  position: relative;
  padding-top: 16px;
}

.branch-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50px;
  right: 50px;
  height: 2px;
  background: var(--border);
}

.branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

.branch::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 50%;
  width: 2px;
  height: 16px;
  background: var(--border);
}

.branch .circ {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.mini-row {
  display: flex;
  gap: 4px;
}

.mini {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--panel2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 8px;
}

.total-bar {
  margin-top: 20px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.total-bar b {
  color: var(--gold2);
  font-size: 16px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: none;
}

.a-ic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  flex-shrink: 0;
}

.activity-text {
  flex: 1;
  min-width: 0;
}

.activity-text .t {
  font-size: 12.5px;
  font-weight: 600;
}

.activity-text .s {
  font-size: 11px;
  color: var(--muted);
}

.a-plus {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
}

.comm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.comm-item:last-child {
  border-bottom: none;
}

.comm-ic {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  flex-shrink: 0;
}

.comm-text {
  flex: 1;
}

.comm-text .t {
  font-size: 12.5px;
  font-weight: 600;
}

.comm-text .s {
  font-size: 11px;
  color: var(--muted);
}

.comm-val {
  text-align: right;
}

.comm-val .v {
  font-size: 12.5px;
  font-weight: 700;
}

.comm-val .p {
  font-size: 10.5px;
  color: var(--muted);
}

.comm-total {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}

.comm-total b {
  color: var(--gold2);
}

.goal-card {
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  padding: 22px;
  min-height: 170px;
  background:
    linear-gradient(100deg, rgba(10, 16, 36, .92) 40%, rgba(10, 16, 36, .3) 100%),
    linear-gradient(180deg, #2a3a6b, #d98a3d 70%, #5a2f22);
}

.goal-card h3 {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
}

.goal-card h3 .accent {
  color: var(--gold2);
}

.goal-card p {
  font-size: 11.5px;
  color: #c9d2ee;
  margin-top: 8px;
  max-width: 70%;
}

.goal-btn {
  margin-top: 14px;
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  border: none;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 12px;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
}

footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 11.5px;
}

footer .flinks {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

footer .flinks span {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media(max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .mid-grid, .bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media(max-width: 700px) {
  .sidebar {
    display: none;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .branch-row {
    gap: 24px;
  }
}


/* ====================================================
   AJUSTES MOBILE: DRAWER SIDEBAR & AÇÕES RÁPIDAS
   ==================================================== */

/* Botão Hambúrguer */
.btn-menu-mobile {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-menu-mobile:hover {
  border-color: var(--gold2);
  color: var(--gold2);
}

/* Fundo escurecido atrás do menu mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(3px);
  z-index: 1040;
}
.sidebar-overlay.active {
  display: block;
}

/* Botão Fechar dentro da Sidebar */
.sidebar-close-btn {
  display: none;
}

/* Ajustes exclusivos para telas até 768px */
@media(max-width: 768px) {
  .btn-menu-mobile {
    display: flex;
  }

  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--panel2);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    margin-left: auto;
  }
  .sidebar-close-btn:hover {
    color: #fff;
  }

  .main {
    padding: 16px 14px 30px;
  }

  /* Correção do card de Ações Rápidas no Mobile (Grid 2x2 limpa e compacta) */
  .actions-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .action-btn {
    padding: 12px 6px !important;
    font-size: 11.5px !important;
    border-radius: 10px !important;
    gap: 6px !important;
    text-align: center;
  }
  .action-btn i {
    font-size: 16px !important;
  }

  /* Ajuste no Hero para telas pequenas */
  .hero {
    padding: 18px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .hero-badge {
    display: none;
  }
}