/* VIBEBI — Estilos do dashboard.
   Seções numeradas acompanham a organização do HTML.
   Classes definem a aparência; IDs do HTML conectam os elementos ao JavaScript. */

/* Usa fontes disponíveis no dispositivo, sem carregar fontes de terceiros. */

/* 01. BASE — Fonte, cores gerais e normalização dos elementos. */
:root {
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #25312f;
  background: #f6f8f7;
  font-synthesis: none;
  font-size: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,select {
  font: inherit;
}

button,a,select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}


/* 02. MENU LATERAL — Marca, empresa, navegação e aviso inferior. */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  background: #fff;
  border-right: 1px solid #e6ebe8;
  padding: 32px 22px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1.2px;
}

.logo {
  background: #175d49;
  color: #fff;
  border-radius: 9px;
  font-size: 25px;
  width: 35px;
  height: 35px;
  text-align: center;
  margin-right: 10px;
}

.brand-dot {
  color: #209e77;
}

.workspace {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid #e5eae7;
  border-radius: 9px;
  padding: 12px 9px;
  margin: 35px 0 27px;
  font-size: 12px;
  font-weight: 600;
}

.avatar,.profile {
  display: grid;
  place-items: center;
  background: #eff4ee;
  color: #54725d;
  border-radius: 8px;
  width: 32px;
  height: 34px;
}

.workspace small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: #82908a;
  margin-top: 4px;
}

.nav-label {
  font-size: 10px;
  letter-spacing: 1.7px;
  color: #929c97;
  padding-left: 13px;
}

nav a {
  display: flex;
  gap: 13px;
  padding: 13px 12px;
  margin: 5px 0;
  border-radius: 7px;
  font-size: 12px;
  color: #75817b;
}

nav a span {
  font-size: 18px;
  line-height: 16px;
}

nav a.active {
  background: #eaf3ee;
  color: #246b51;
  font-weight: 600;
}

.sidebar-bottom {
  margin-top: auto;
  color: #66766e;
  font-size: 10px;
  line-height: 1.7;
}

.sidebar-bottom small {
  display: block;
  font-size: 9px;
  color: #9aa49e;
  margin-top: 8px;
}

.status-dot {
  display: inline-block;
  background: #62ac81;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
}


/* 03. ÁREA PRINCIPAL E CABEÇALHO — Espaçamento ao lado do menu. */
main {
  margin-left: 244px;
}

header {
  height: 76px;
  padding: 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid #e6ebe8;
}

.breadcrumb {
  font-size: 12px;
  color: #738179;
}

.breadcrumb span {
  padding: 0 16px;
  color: #bac3be;
}

.profile {
  font-size: 11px;
  border-radius: 50%;
  width: 33px;
  height: 33px;
}


/* 04. APRESENTAÇÃO — Título da página e botão principal. */
.page {
  max-width: 1510px;
  margin: auto;
  padding: 37px 42px 20px;
}

.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.eyebrow {
  font-size: 9px;
  letter-spacing: 1.7px;
  font-weight: 600;
  color: #6f8c7d;
  margin: 0 0 12px;
}

h1 {
  font-size: 28px;
  letter-spacing: -1px;
  margin: 0 0 10px;
  font-weight: 600;
}

.heading p:not(.eyebrow) {
  color: #829087;
  font-size: 12px;
  margin: 0;
}

.primary {
  background: #226b50;
  border: 1px solid #226b50;
  color: #fff;
  border-radius: 7px;
  padding: 12px 17px;
  font-size: 12px;
  box-shadow: 0 3px 5px #1e573212;
}

.primary:hover {
  background: #17533c;
}


/* 05. AVISO DE DEMONSTRAÇÃO — Identificação dos dados fictícios. */
.demo {
  display: flex;
  gap: 14px;
  align-items: center;
  background: #edf3ef;
  border: 1px solid #dce8df;
  border-radius: 8px;
  padding: 16px 19px;
  color: #49745c;
  margin-bottom: 25px;
}

.demo>span:first-child {
  font-size: 22px;
}

.demo strong {
  font-size: 12px;
  font-weight: 600;
}

.demo p {
  font-size: 11px;
  margin: 5px 0 0;
  color: #799080;
}

.badge {
  margin-left: auto;
  font-size: 8px;
  letter-spacing: 1px;
  border: 1px solid #ccddd0;
  padding: 5px 8px;
  border-radius: 4px;
  white-space: nowrap;
}


/* 06. FILTROS — Seletores de período e cidade e botão de limpeza. */
.filters {
  display: flex;
  gap: 15px;
  align-items: end;
  margin-bottom: 24px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 10px;
  font-weight: 600;
  color: #78857e;
}

select {
  background: #fff;
  color: #43564a;
  border: 1px solid #e0e6e2;
  border-radius: 6px;
  padding: 10px 30px 10px 12px;
  font-size: 11px;
  min-width: 185px;
}

.reset {
  border: 0;
  background: none;
  color: #7d8d82;
  font-size: 11px;
  padding: 12px 3px;
}

.currency {
  margin-left: auto;
  color: #95a198;
  font-size: 10px;
  padding-bottom: 12px;
}


/* 07. INDICADORES — Cartões financeiros e destaque do resultado. */
.metrics {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 17px;
  margin-bottom: 24px;
}

.metrics article {
  padding: 18px 20px 20px;
  background: #fff;
  border: 1px solid #e3e9e5;
  border-radius: 9px;
}

.metrics p {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #7b8980;
  font-size: 11px;
  margin: 0 0 14px;
}

.metric-icon {
  background: #f2f6f3;
  color: #76907e;
  border-radius: 6px;
  padding: 5px 8px;
}

.metrics h2 {
  font-size: 26px;
  letter-spacing: -1px;
  font-weight: 600;
  margin: 0 0 9px;
  font-variant-numeric: tabular-nums;
}

.metrics small {
  font-size: 9px;
  color: #94a096;
}

.metrics article.profit {
  background: #edf5ef;
  border-color: #d4e5d9;
}

.profit h2 {
  color: #267253;
}


/* 08. GRÁFICOS — Painéis, legenda, barras mensais e cidades. */
.charts {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 22px;
  margin-bottom: 24px;
}

.panel {
  background: #fff;
  border: 1px solid #e3e9e5;
  border-radius: 9px;
  padding: 23px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px;
}

.panel-heading p {
  font-size: 10px;
  color: #93a096;
  margin: 0;
}

.pill {
  font-size: 9px;
  border: 1px solid #e6ebe7;
  border-radius: 5px;
  padding: 6px 9px;
  color: #88958c;
  white-space: nowrap;
}

.legend {
  display: flex;
  gap: 20px;
  font-size: 9px;
  color: #87958b;
  margin-top: 24px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

i {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 2px;
}

.green {
  background: #4f9976;
}

.gray {
  background: #dce7df;
}

.chart {
  height: 224px;
  display: flex;
  gap: 12px;
  padding-top: 16px;
  background: repeating-linear-gradient(to top,transparent 0,transparent 44px,#f0f3f1 45px,#f0f3f1 46px);
  margin-top: 8px;
}

.month {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  color: #91a095;
}

.bars {
  height: 173px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}

.bar {
  width: 22%;
  max-width: 25px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height .25s;
}

.revenue {
  background: #5a9a7c;
}

.expense {
  background: #dce7df;
}

.month>span {
  padding-top: 10px;
}

.month small {
  font-size: 8px;
  margin-top: 5px;
}

.city-list {
  margin-top: 23px;
  display: grid;
  gap: 15px;
}

.city-item {
  border: 1px solid transparent;
  background: none;
  width: 100%;
  padding: 7px;
  border-radius: 6px;
  text-align: left;
  color: #526559;
}

.city-item:hover,.city-item.selected {
  background: #f1f7f2;
  border-color: #dfebe1;
}

.city-item>span:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.city-item strong {
  font-size: 11px;
  font-weight: 500;
}

.track {
  display: block;
  height: 7px;
  background: #eff3ef;
  border-radius: 4px;
  margin: 10px 0 6px;
}

.track>span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: #75a48a;
}

.city-item small {
  font-size: 9px;
  color: #99a59c;
}

.chart-note {
  border-top: 1px solid #eef2ee;
  margin-top: 19px;
  padding-top: 14px;
  font-size: 9px;
  color: #99a69c;
}


/* 09. TABELA — Detalhamento financeiro e etiquetas de margem. */
.table-panel {
  padding-bottom: 8px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 22px;
  white-space: nowrap;
  font-size: 11px;
}

th {
  text-align: right;
  font-size: 9px;
  font-weight: 500;
  color: #95a197;
  background: #f8faf8;
  padding: 13px;
}

th:first-child,td:first-child {
  text-align: left;
}

td {
  text-align: right;
  padding: 18px 13px;
  border-bottom: 1px solid #edf1ed;
  color: #68786d;
}

tr:last-child td {
  border-bottom: 0;
}

.table-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #8fb69a;
  border-radius: 50%;
  margin-right: 10px;
}

.positive {
  color: #40865b;
}

.margin-badge {
  background: #edf6ed;
  color: #63926a;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 10px;
}


/* 10. RODAPÉ — Identidade do produto e informação do protótipo. */
footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 9px;
  color: #a1aca4;
  padding-top: 23px;
}

footer b {
  padding: 0 6px;
}


/* 11. JANELA DE AVISO — Conteúdo e fundo da janela de importação. */
dialog {
  border: 1px solid #dae5dc;
  border-radius: 14px;
  padding: 30px;
  max-width: 460px;
  width: calc(100% - 32px);
  color: #354c3e;
  box-shadow: 0 20px 90px #18342530;
}

dialog::backdrop {
  background: #182c2260;
}

dialog h2 {
  font-size: 21px;
}

dialog p {
  font-size: 14px;
  line-height: 1.8;
  color: #708176;
}

.dialog-icon {
  font-size: 30px;
  color: #267253;
}


/* 12. ACESSIBILIDADE — Destaque de foco para navegação por teclado. */
button:focus-visible,a:focus-visible,select:focus-visible {
  outline: 3px solid #78ae8f;
  outline-offset: 3px;
}

html {
  scroll-behavior: smooth;
}


/* 13. RESPONSIVIDADE — Ajustes para telas grandes. */
@media(min-width:1600px) {

  /* 04. APRESENTAÇÃO — Título da página e botão principal. */
  .page {
    padding-top: 48px;
  }

  .chart {
    height: 270px;
  }

  .bars {
    height: 219px;
  }

}


/* Telas intermediárias: reduz espaços e largura do menu. */
@media(max-width:1150px) {

  /* 02. MENU LATERAL — Marca, empresa, navegação e aviso inferior. */
  .sidebar {
    width: 205px;
    padding: 28px 15px;
  }


  /* 03. ÁREA PRINCIPAL E CABEÇALHO — Espaçamento ao lado do menu. */
  main {
    margin-left: 205px;
  }


  /* 04. APRESENTAÇÃO — Título da página e botão principal. */
  .page {
    padding: 28px 24px;
  }

  header {
    padding: 0 24px;
  }


  /* 07. INDICADORES — Cartões financeiros e destaque do resultado. */
  .metrics {
    gap: 10px;
  }

  .metrics article {
    padding: 15px 12px;
  }

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

  .currency {
    display: none;
  }


  /* 08. GRÁFICOS — Painéis, legenda, barras mensais e cidades. */
  .charts {
    grid-template-columns: 1.3fr 1fr;
    gap: 15px;
  }

  .panel {
    padding: 17px;
  }

  .badge {
    display: none;
  }

}


/* Tablets: move o menu para o topo e empilha os gráficos. */
@media(max-width:800px) {

  /* 02. MENU LATERAL — Marca, empresa, navegação e aviso inferior. */
  .sidebar {
    position: static;
    width: 100%;
    padding: 16px 20px;
    border-right: 0;
    border-bottom: 1px solid #e6ebe8;
  }

  .brand {
    font-size: 23px;
  }

  .workspace,.nav-label,.sidebar-bottom {
    display: none;
  }

  nav {
    display: flex;
    gap: 6px;
    margin-top: 12px;
  }

  nav a {
    padding: 10px;
    font-size: 11px;
  }


  /* 03. ÁREA PRINCIPAL E CABEÇALHO — Espaçamento ao lado do menu. */
  main {
    margin: 0;
  }

  header {
    height: 53px;
  }


  /* 04. APRESENTAÇÃO — Título da página e botão principal. */
  .page {
    padding: 25px 20px;
  }

  .heading {
    align-items: flex-start;
  }

  h1 {
    font-size: 24px;
  }

  .heading .primary {
    white-space: nowrap;
  }

  .eyebrow {
    font-size: 8px;
  }

  .heading p:not(.eyebrow) {
    line-height: 1.7;
  }


  /* 07. INDICADORES — Cartões financeiros e destaque do resultado. */
  .metrics {
    grid-template-columns: repeat(2,1fr);
  }


  /* 08. GRÁFICOS — Painéis, legenda, barras mensais e cidades. */
  .charts {
    grid-template-columns: 1fr;
  }


  /* 06. FILTROS — Seletores de período e cidade e botão de limpeza. */
  .filters {
    flex-wrap: wrap;
  }

  select {
    min-width: 150px;
  }


  /* 05. AVISO DE DEMONSTRAÇÃO — Identificação dos dados fictícios. */
  .demo {
    padding: 14px;
  }

  .demo p {
    line-height: 1.7;
  }


  /* 10. RODAPÉ — Identidade do produto e informação do protótipo. */
  footer {
    flex-direction: column;
    gap: 7px;
  }

}


/* Celulares: ajusta títulos, filtros e navegação. */
@media(max-width:480px) {
  .heading {
    flex-direction: column;
    gap: 17px;
  }


  /* 04. APRESENTAÇÃO — Título da página e botão principal. */
  .page {
    padding: 22px 15px;
  }

  nav a {
    font-size: 10px;
    padding: 8px;
  }

  nav a span {
    display: none;
  }


  /* 06. FILTROS — Seletores de período e cidade e botão de limpeza. */
  .filters {
    gap: 10px;
  }

  .filters label {
    flex: 1;
  }

  select {
    min-width: 0;
    width: 100%;
    font-size: 10px;
  }

  .reset {
    padding: 4px;
  }

  .metrics h2 {
    font-size: 23px;
  }

  .metrics small {
    font-size: 8px;
  }

  .panel {
    padding: 15px;
  }

  .month small {
    font-size: 7px;
  }

  .bars {
    gap: 4px;
  }

  .chart {
    gap: 5px;
  }

  .demo>span:first-child {
    display: none;
  }

}


/* ACESSIBILIDADE — Respeita a preferência por movimento reduzido. */
@media(prefers-reduced-motion:reduce) {
  html {
    scroll-behavior: auto;
  }

  .bar {
    transition: none;
  }

}


/* 14. IMPORTAÇÃO — Estados ocultos prevalecem sobre regras de layout dos componentes. */
[hidden] {
  display: none !important;
}

/* A janela rola internamente, preservando o acesso aos controles em telas pequenas. */
#import-dialog {
  width: min(940px, calc(100% - 32px));
  max-width: 940px;
  max-height: 90dvh;
  overflow-y: auto;
}

.import-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.import-heading h2 {
  margin: 0;
}

.import-section {
  padding: 20px 0;
  border-top: 1px solid #e3e9e5;
}

.import-section p {
  margin: 8px 0 14px;
  font-size: 12px;
}

.import-section h3 {
  font-size: 14px;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.mapping-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.import-section label {
  gap: 8px;
  font-size: 12px;
}

.import-section select {
  width: 100%;
  min-width: 0;
}

/* Os campos de arquivo e número seguem o mesmo padrão visual dos seletores. */
.import-section input {
  max-width: 100%;
  padding: 10px;
  border: 1px solid #dce5df;
  border-radius: 6px;
  background: #fff;
  color: #43564a;
  font: inherit;
}

#excel-file {
  width: 100%;
  margin-top: 8px;
}

.example-link {
  color: #226b50;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.preview-wrap {
  max-height: 270px;
  border: 1px solid #e3e9e5;
  border-radius: 6px;
}

.preview-wrap table {
  margin: 0;
}

.preview-wrap th,
.preview-wrap td {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.import-feedback {
  max-height: 220px;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

#import-dialog .import-feedback p,
.import-feedback li {
  color: #35634b;
  font-size: 12px;
  line-height: 1.7;
}

#import-dialog .has-errors p,
.has-errors li {
  color: #a04438;
}

.import-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid #e3e9e5;
}

.secondary {
  border: 1px solid #c9d9ce;
  border-radius: 7px;
  padding: 12px 17px;
  color: #226b50;
  background: #f5f9f6;
  font-size: 12px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

input:focus-visible,
.preview-wrap:focus-visible {
  outline: 3px solid #78ae8f;
  outline-offset: 3px;
}

/* 15. DADOS IMPORTADOS — Suporta mais meses, cidades e indicadores indisponíveis. */
.filters {
  flex-wrap: wrap;
}

.chart {
  overflow-x: auto;
  background: none;
}

.month {
  min-width: 75px;
}

.city-list {
  max-height: 310px;
  overflow-y: auto;
}

.metrics h2 {
  font-size: clamp(17px, 1.8vw, 26px);
  overflow-wrap: anywhere;
}

.negative {
  color: #aa5145;
}

/* A linha central representa zero: barras positivas sobem, negativas descem. */
.signed-bars {
  position: relative;
  align-items: unset;
  background: linear-gradient(to bottom, transparent calc(50% - 1px), #dfe8e1 50%, transparent calc(50% + 1px));
}

.signed-bars .bar {
  position: absolute;
  bottom: 50%;
  left: 22%;
}

.signed-bars .expense {
  left: 54%;
}

.signed-bars .negative-bar {
  top: 50%;
  bottom: auto;
  border-radius: 0 0 4px 4px;
}

.empty-state {
  margin: auto;
  color: #829087;
  font-size: 12px;
}

#data-description {
  overflow-wrap: anywhere;
}

/* 16. IMPORTAÇÃO EM CELULARES — Campos e ações empilhados para manter a leitura. */
@media (max-width: 640px) {
  .import-grid,
  .mapping-grid {
    grid-template-columns: 1fr;
  }

  #import-dialog {
    padding: 20px;
  }

  .import-actions > button {
    flex: 1;
  }
}

/* Resultado negativo recebe destaque próprio, em vez de usar o verde de lucro. */
.metrics article.profit.is-negative {
  background: #fcf1ee;
  border-color: #ecd1c9;
}

.profit.is-negative h2 {
  color: #aa5145;
}
