:root{
  --bg:#F4F6F9;
  --panel:#FFFFFF;
  --primary:#1E88E5;
  --text:#263238;
  --muted:#607D8B;
  --border:rgba(0,0,0,.08);
  --shadow:0 6px 18px rgba(0,0,0,.08);
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
  font-family:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body{
  background:var(--bg);
  color:var(--text);
}

.app{
  display:flex;
  min-height:100vh;
}

/* SIDEBAR */
.sidebar{
  width:260px;
  background: #1e2a47;
  color:#fff;
  display:flex;
  flex-direction:column;
  padding:20px;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:30px;
  justify-content: center;
}

.logo{
  width:100px;
  height:50px;
  /*background:#fff;*/
  border-radius:10px;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.brand small{
  opacity:.8;
  font-size:12px;
}

.menu a{
  display:block;
  padding:12px 14px;
  border-radius:10px;
  margin-bottom:6px;
  cursor:pointer;
  color: white;
   text-decoration: none;
}

.menu a.active,
.menu a:hover{
  background:rgba(255,255,255,.15);
}

.user{
  margin-top:auto;
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.user small{
  opacity:.8;
  font-size:12px;
}

.user button{
  background:#E53935;
  border:none;
  color:#fff;
  padding:8px 12px;
  border-radius:8px;
  cursor:pointer;
}

/* MAIN */
.main{
  flex:1;
  padding:28px;
}

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

.top p{
  color:var(--muted);
  font-size:14px;
}

.help{
  background:#fff;
  border:1px solid var(--border);
  padding:8px 14px;
  border-radius:10px;
  cursor:pointer;
}

/* CARDS */
.cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:18px;
  margin-bottom:24px;
}

.card{
  background:var(--panel);
  padding:18px;
  border-radius:16px;
  box-shadow:var(--shadow);
}

.card span{
  color:var(--muted);
  font-size:14px;
}

.card h2{
  margin:8px 0;
  font-size:26px;
}

.card small{
  font-size:13px;
  color:var(--muted);
}

.pill{
  padding:4px 10px;
  border-radius:20px;
  font-size:12px;
}

.pill.blue{ background:#E3F2FD; color:#1565C0; }
.pill.orange{ background:#FFF3E0; color:#EF6C00; }
.pill.gray{ background:#ECEFF1; }

/* CONTENT */
.content{
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:20px;
  margin-bottom:20px;
}

.panel{
  background:var(--panel);
  padding:20px;
  border-radius:16px;
  box-shadow:var(--shadow);
}

.panel h3{
  margin-bottom:14px;
}

/* TABLE */
table{
  width:100%;
  border-collapse:collapse;
}

th,td{
  padding:12px;
  border-bottom:1px solid var(--border);
  font-size:14px;
}

th{
  background:#F7F9FB;
  text-align:left;
}

.right{
  text-align:right;
}

/* LIST */
.list{
  list-style:none;
  margin-bottom:10px;
}

.list li{
  display:flex;
  justify-content:space-between;
  padding:6px 0;
}

.muted{
  color:var(--muted);
  font-size:12px;
}

/* TIP */
.tip{
  background:#E3F2FD;
  border-left:6px solid var(--primary);
}

/* ==============================
   RESPONSIVO – TABLET
============================== */
@media (max-width: 1024px){

  .content{
    grid-template-columns:1fr;
  }

  .sidebar{
    width:220px;
  }

  .card h2{
    font-size:22px;
  }
}

/* ==============================
   RESPONSIVO – MOBILE
============================== */
@media (max-width: 768px){

  .app{
    flex-direction:column;
  }

  /* SIDEBAR MOBILE */
  .sidebar{
    width:100%;
    flex-direction:row;
    align-items:center;
    padding:14px;
  }

  .brand{
    margin-bottom:0;
  }

  .menu{
    display:flex;
    gap:8px;
    margin-left:auto;
  }

  .menu a{
    padding:8px 10px;
    font-size:13px;
    white-space:nowrap;
  }

  .user{
    display:none;
  }

  /* MAIN */
  .main{
    padding:18px;
  }

  .top{
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
  }

  .top h1{
    font-size:22px;
  }

  /* CARDS */
  .cards{
    grid-template-columns:1fr;
  }

  .card{
    padding:16px;
  }

  /* CONTENT */
  .content{
    grid-template-columns:1fr;
  }

  /* TABELA RESPONSIVA */
  table{
    display:block;
    overflow-x:auto;
    white-space:nowrap;
  }

  th, td{
    font-size:13px;
  }
}

/* ==============================
   MOBILE PEQUENO
============================== */
@media (max-width: 480px){

  .menu{
    overflow-x:auto;
  }

  .menu a{
    font-size: 20px;
    padding: 6px 10px;
  }

  .card h2{
    font-size:20px;
  }

  .panel{
    padding:16px;
  }

  .tip{
    font-size:14px;
  }
}

label{
  font-size:12px;
  color:var(--muted);
}

input, select, textarea{
  width:100%;
  padding:10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
}
input:focus, select:focus, textarea:focus{
  border-color:var(--primary);
}

.chart-wrapper {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}

/* Scroll moderno */
.chart-wrapper::-webkit-scrollbar {
  height: 6px;
}
.chart-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.chart-wrapper::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}
.chart-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

/* Chart */
.chart {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  height: 180px;
  min-width: max-content; /* permite scroll */
  padding: 4px 2px;
}

/* Barra */
.bar {
  width: 70px; /* largura fixa = scroll */
  height: 100%;
  position: relative;
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(226, 232, 240, 0.5),
    rgba(241, 245, 249, 0.9)
  );
  border: 1px solid rgba(148, 163, 184, 0.25);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Hover elegante */
.bar:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

/* Preenchimento */
.bar i {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, rgba(31,119,255,0.95), rgba(31,119,255,0.78));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
  transition: height 0.6s cubic-bezier(.4,0,.2,1);
}

/* Data */
.bar label {
  position: absolute;
  top: 6px;
  width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  pointer-events: none;
}

/* Valor */
.bar b {
  position: absolute;
  bottom: 6px;
  width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #000;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.btn{
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:600;
}
.btn:hover{ background:#F1F5F9; }
.btn.primary{ background:var(--primary); color:#fff; border:none; }
.btn.danger{ background:var(--danger); color:#fff; border:none; }
.btn.small{ padding:8px 10px; font-size:13px; }
.btn.link{ background:none; border:none; color:var(--primary); }

a{ color: inherit; text-decoration:none; }
small{ color: var(--muted); }
hr{ border:0; border-top:1px solid var(--border); margin:16px 0; }

/* MODAL */
.modal{
  position:fixed;
  inset:0;
  display:none;
  justify-content:center;
  align-items:center;
  background:rgba(0,0,0,.35);
}
.modal.show{ display:flex; }
.modal .box{
  background:#fff;
  border-radius:18px;
  padding:14px;
  box-shadow:0 20px 60px rgba(0,0,0,.2);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-grid .card {
    grid-column: span 12 !important;
  }
}





/*HAMBURGUER*/

.hamburger {
  display: none;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

/* OVERLAY */
.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 998;
}

/* MOBILE */
@media (max-width: 768px) {

  .hamburger {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 260px;
    height: 100%;
    z-index: 999;
    transition: left 0.3s ease;
    flex-direction: column;
  }

  .sidebar.open {
    left: 0;
  }

  .menu {
    flex-direction: column;
    margin-left: 0;
    margin-top: 10px;
  }

  .menu-overlay.show {
    display: block;
  }
}

.hamburger {
  display: none; /* some no web */
  background: linear-gradient(180deg,#1E88E5,#1565C0);
  color: #fff;
  border: none;
  font-size: 24px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

/* MOBILE */
@media (max-width: 768px) {

  .hamburger {
    display: block; /* aparece só no mobile */
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 260px;
    height: 100%;
    z-index: 999;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .menu {
    flex-direction: column;
    margin-left: -60px;
  }

  .menu-overlay.show {
    display: block;
  }
}

.chart .bar {
  cursor: pointer;
}

.chart .bar:hover i {
  opacity: 0.7;
}


/* =========================
   RESPONSIVO MODAL DETALHE
   SOMENTE #mDetalhe
========================= */
@media (max-width: 768px) {

  /* Modal ocupa quase toda a tela */
  #mDetalhe .box {
    width: 100vw;
    max-width: 100vw !important;
    height: 100dvh;
    max-height: 100dvh !important;
    border-radius: 0;
    padding: 0;
  }

  /* Header */
  #mDetalhe h3 {
    font-size: 1.1rem;
  }

  /* Corpo com scroll correto */
  #mDetalhe > .box > div:nth-child(2) {
    padding: 8px;
  }

  /* Grid vira coluna */
  #mDetalhe .box > div:nth-child(2) > div {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* Cards ocupam 100% */
  #mDetalhe .card {
    grid-column: span 12 !important;
  }

  /* Títulos dos cards */
  #mDetalhe .card h2 {
    font-size: 1rem;
    margin-bottom: 8px;
  }

  /* Tabelas com scroll horizontal */
  #mDetalhe table {
    min-width: 600px;
  }

  #mDetalhe .card div[style*="overflow"] {
    overflow-x: auto !important;
  }

  /* Inputs e selects maiores para toque */
  #mDetalhe input,
  #mDetalhe select {
    font-size: 1rem;
    padding: 10px;
  }

  /* Botão aplicar ocupa largura */
  #mDetalhe #btnAplicar {
    width: 100%;
  }

  /* Footer fixo e compacto */
  #mDetalhe .box > div:last-child {
    padding: 8px;
    gap: 8px;
  }

  #mDetalhe .box > div:last-child button {
    flex: 1;
  }

}

@media (max-width: 373px){
  .cnmempresa{
    padding: 25% !important;
  }
}

@media (max-width: 303px){
  .cnmempresa{
    padding: 20% !important;
  }
}
