html, body{
  margin: 0;
  padding: 0;
}
*, *::before, *::after{
  box-sizing: border-box;
}
:root{
  --bg: #f6f6f6;
  --text: #0f172a;
  --muted: rgba(15, 23, 42, .65);
  --card: #ffffff;
  --border: rgba(15, 23, 42, .12);
  --orange: #f85b33;

  /* gradient Ecoa */
  --g1:#12a79b;
  --g2:#46b59b;
  --g3:#a6c885;
  --g4:#e9cc67;

  --sidebar-w: 260px;
  --sidebar-collapsed-w: 72px;
}

/* ===== Login ===== */
.bg{
  min-height: 100vh;
  background: var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
}
.bg-login{
    background: linear-gradient(
        150deg,
        #02B199 0%,
        #45B68C 56%,
        #6EB984 63%,
        #8BBD7A 68%,
        #A6C171 74%,
        #BFC466 80%,
        #D9C75B 85%,
        #F1CA41 100%
    );
}
.login-wrap{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
}
.login-card{
  width: 100%;
  max-width: 420px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}
.login-logo{
  display:flex;
  justify-content:center;
  margin-bottom: 14px;
}
.login-logo img{
  width: 180px;
  height: 40px;
  object-fit: contain;
}
h1{
  margin: 0 0 6px 0;
  font-size: 22px;
  color: #111827;
}
.muted{
  margin: 0 0 14px 0;
  color: #6b7280;
  font-size: 14px;
}
.form{
  display:flex;
  flex-direction:column;
  gap: 12px;
}
label{
  display:flex;
  flex-direction:column;
  gap: 6px;
  font-size: 13px;
  color:#374151;
}
input{
  height: 42px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}
input:focus{
  border-color: #9ca3af;
}
.btn-primary{
  height: 44px;
  border: none;
  border-radius: 10px;
  background: #111827;
  color: white;
  font-weight: 600;
  cursor:pointer;
}
.alert{
  background: #fee2e2;
  color: #7f1d1d;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
.hint{
  margin-top: 6px;
  font-size: 12px;
  color:#6b7280;
}

/* ===== App Shell ===== */
.app-bg{
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

/* Navbar */
.navbar{
  height: 50px;
  background: linear-gradient(95deg, var(--g1) 0%, var(--g2) 40%, var(--g3) 75%, var(--g4) 100%);
  border-bottom: 1px solid rgba(15, 23, 42, .12);
  position: sticky;
  top:0;
  z-index: 50;
}
.navbar-inner{
  position: relative;
  height: 50px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 16px;
}
.navbar-logo{
  display:flex;
  align-items:center;
  justify-content:center;
  flex: 1;
}
.navbar-logo img{
  width: 180px;
  height: 40px;
  object-fit: contain;
}
.burger{
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.10);
  color: white;
  font-size: 18px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.logout{
  width: auto;
  text-decoration:none;
  color:#000000;
  font-weight:600;
  font-size: 14px;
  text-align:right;
}

/* Sidebar */
.sidebar{
  position: fixed;
  top: 50px;
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - 50px);
  background: #ffffff;
  border-right: 1px solid rgba(15, 23, 42, .12);
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
  padding: 12px;
  z-index: 60;
  transform: translateX(-102%);
  transition: transform .22s ease, width .22s ease;
}
.menu{
  display:flex;
  flex-direction:column;
  gap: 6px;
}
.menu-item{
  text-decoration:none;
  color: rgba(15, 23, 42, .92);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  display:flex;
  align-items:center;
  gap: 10px;
}
.menu-item:hover{
  background: rgba(15, 23, 42, .06);
  border-color: rgba(15, 23, 42, .10);
}
.menu-item.active{
  border-color: rgba(18, 167, 155, .35);
  background: rgba(18, 167, 155, .10);
}
.menu-sep{
  height: 1px;
  background: rgba(15, 23, 42, .10);
  margin: 8px 0;
}

/* overlay (mobile) */
.overlay{
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.45);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

/* When open */
.sidebar-open .sidebar{
  transform: translateX(0);
}
.sidebar-open .overlay{
  opacity: 1;
  pointer-events: auto;
}

/* Content */
.content{
  padding: 18px 16px 28px 16px;
  max-width: none;
  margin: 0;
}
.content h1{
  color: var(--text);
  font-size: 22px;
  margin: 0 0 8px 0;
}
.content .muted{
  color: rgba(15, 23, 42, .65);
}

/* cards */
.grid-cards{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}
.card{
  background: var(--card);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}

/* ===== Stat cards (Dashboard) ===== */
.stats-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

/* Desktop: 4 cards lado a lado */
@media (min-width: 1024px){
  .stats-grid{
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}

.stat-card{
  background: var(--card);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
}

.stat-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
}

.stat-title{
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(15, 23, 42, .60);
  font-weight: 800;
}

.stat-icon{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(79, 70, 229, .12);
  color: #4f46e5;
  font-size: 20px;
  flex: 0 0 auto;
}

.stat-value{
  margin-top: 10px;
  font-size: 34px;
  font-weight: 900;
  color: rgba(15, 23, 42, .92);
  line-height: 1.05;
}

.stat-foot{
  margin-top: 10px;
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-change{
  font-weight: 900;
  font-size: 14px;
}

.stat-change.up{ color: #16a34a; }
.stat-change.down{ color: #dc2626; }

.stat-foot-text{
  color: rgba(15, 23, 42, .55);
  font-size: 14px;
}

/* Mobile: respiro e tamanho */
@media (max-width: 420px){
  .stat-card{ padding: 16px; }
  .stat-value{ font-size: 30px; }
}

/* iframe */
.iframe-wrap{
  margin-top: 12px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 14px;
  overflow:hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.iframe-wrap iframe{
  width: 100%;
  height: 85vh;
  border: 0;
}

/* Desktop: sidebar visible by default */
@media (min-width: 1024px){
  .sidebar{
    transform: translateX(0);
  }
  .overlay{
    display:none;
  }

  /* Conteúdo ocupa a largura disponível */
  .content{
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    max-width: none; /* <- importante: não “encolher” cards */
  }

  .navbar-logo{
    justify-content:center;
  }

  /* Toggle flutuando na borda direita da sidebar */
  .burger{
    position: fixed;
    top: 4px;
    left: calc(var(--sidebar-w) + 8px);
    z-index: 80;
  }
}

/* Desktop collapsed = sidebar some totalmente */
@media (min-width: 1024px){
  .sidebar-collapsed .sidebar{
    transform: translateX(-102%); /* some de verdade */
  }

  .sidebar-collapsed .content{
    margin-left: 0;
    width: 100%;
    max-width: none; /* <- volta a ocupar tudo */
  }

  /* Toggle volta pro canto esquerdo da navbar */
  .sidebar-collapsed .burger{
    left: 12px;
  }
}

/* Hide menu text when collapsed (works if your links have text nodes) */
.sidebar-collapsed .menu-item{
  justify-content: center;
  padding: 10px;
}
.sidebar-collapsed .menu-item span,
.sidebar-collapsed .menu-item .label{
  display:none;
}

/* Ensure burger is always visible on desktop */
@media (min-width: 1024px){
  .burger{
    display:flex;
    align-items:center;
    justify-content:center;
  }
}