* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--app-font-family, "Inter");
  background: var(--app-bg, #eef0f2);
  color: var(--app-text, #111827);
}

.dashboard-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.msc-header {
  width: 100%;
  background: #137ca6;
  flex-shrink: 0;
}

.msc-header__container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 40px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 24px;
}

.msc-header__left,
.msc-header__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.msc-header__left {
  justify-self: start;
}

.msc-header__center {
  justify-self: center;
}

.msc-header__right {
  justify-self: end;
}

.msc-header img {
  height: 54px;
  width: auto;
  object-fit: contain;
}

.msc-header__title {
  font-family: var(--app-font-family, "Inter");
  color: #fff;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

.msc-header__subtitle {
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  line-height: 1.2;
  margin: 0;
}

.top-link {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.top-link--logout {
  margin-left: auto;
}

.auth-btn {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  padding: 6px 10px;
  line-height: 1;
}

.auth-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.top-nav {
  width: 100%;
  max-width: none;
  margin: 0;
  margin-top: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent !important;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.top-nav__container {
  width: min(100%, var(--page-max, 1400px));
  max-width: var(--page-max, 1400px);
  margin: 0 auto;
  padding-left: var(--page-pad, clamp(16px, 4vw, 48px));
  padding-right: var(--page-pad, clamp(16px, 4vw, 48px));
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: clamp(6px, 1vw, 14px);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  background: linear-gradient(90deg, #0d2f4a 0%, #0a2842 100%) !important;
  border: 0;
  border-radius: 0;
  backdrop-filter: none;
  background-clip: padding-box;
}

.top-nav__item {
  color: rgba(236, 247, 255, 0.92) !important;
  text-decoration: none;
  padding: 12px clamp(1px, .35vw, 4px) 10px;
  border-bottom: 2px solid transparent !important;
  white-space: nowrap;
  font-size: clamp(12px, .92vw, 14px);
  line-height: 1.2;
  font-weight: 500;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-nav__item.is-active {
  color: #ffffff !important;
  border-bottom: 2px solid #7ed34a !important;
  font-weight: 600;
}

/* Evita que o item mais longo empurre toda a navbar */
.top-nav__item[href*="bolsa.php"] {
  max-width: clamp(170px, 23vw, 360px);
}

.dashboard-main {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  width: 100%;
  max-width: var(--app-shell-max, 1400px);
  margin: 0 auto;
  padding: 20px var(--app-shell-pad, 24px) 28px;
  flex: 1 1 auto;
}

.filters {
  background: var(--app-surface-muted, #f4f7fa);
  border: 1px solid var(--app-border, #d5d9de);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--app-shadow-sm, 0 2px 10px rgba(16, 35, 58, 0.05));
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

.filters__toggle {
  display: none;
}

.filters__toggle-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.filters__toggle-title {
  color: #10233a;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
}

.filters__toggle-subtitle {
  color: #617891;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.filters__toggle-action {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(46, 204, 113, 0.45);
  padding: 6px 12px;
  background: rgba(46, 204, 113, 0.12);
  color: #146a38;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.filters form {
  min-height: 100%;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.filter-group {
  margin-bottom: 16px;
}

.filter-group label {
  display: block;
  color: var(--app-text-soft, #6b7280);
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.filter-group select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--app-border-strong, #ccd3da);
  border-radius: 12px;
  font-size: 14px;
  background: var(--app-surface, #fff);
  color: var(--app-text, #1f2937);
}

.filters-quick-card {
  margin-top: auto;
  border: 1px solid #d6e2ee;
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fafe 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.filters-quick-card__head h3 {
  margin: 0;
  color: #123962;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
}

.filters-quick-card__head p {
  margin: 6px 0 0;
  color: #617891;
  font-size: 12px;
  line-height: 1.45;
}

.filters-quick-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.filters-quick-card__chip {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #cddceb;
  background: #ffffff;
  color: #264767;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.filters-quick-card__chip.is-active {
  background: rgba(17, 120, 167, 0.12);
  border-color: rgba(17, 120, 167, 0.35);
  color: #0f5e87;
}

.filters-quick-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.filters-quick-card__btn {
  min-height: 38px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
}

.filters-quick-card__btn--secondary {
  background: #ffffff;
  border-color: #ccdae8;
  color: #244363;
}

.filters-quick-card__btn--primary {
  background: linear-gradient(90deg, #1178a7 0%, #0c5d86 100%);
  color: #ffffff;
}

.dashboard-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-content .grid:last-child {
  flex: 1 1 auto;
  margin-bottom: 0;
}

.dashboard-hero {
  margin: 0 0 20px;
  padding: clamp(28px, 4vw, 48px) clamp(24px, 4vw, 40px);
  min-height: clamp(148px, 16vw, 196px);
  border-radius: 18px;
  background-color: #0a5c87;
  background-image: url('../../images/dashboard.png');
  background-size: 108% 118%;
  background-position: center center;
  background-repeat: no-repeat;
  background-clip: padding-box;
  color: #fff;
  box-shadow: var(--app-shadow-sm, 0 2px 10px rgba(16, 35, 58, 0.05));
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  top: clamp(12px, 1.6vw, 20px);
  right: clamp(14px, 2vw, 26px);
  width: clamp(110px, 16vw, 180px);
  aspect-ratio: 1;
  background: url('/images/Heros/h9.png') center/contain no-repeat;
  filter: drop-shadow(0 18px 34px rgba(7, 22, 39, 0.22));
  pointer-events: none;
  z-index: 0;
}

.dashboard-hero__text {
  min-width: 0;
  position: relative;
  z-index: 1;
}

.dashboard-hero__title {
  font-family: var(--app-font-family, "Inter");
  margin: 0;
  font-size: clamp(26px, 2.6vw, 32px);
  font-weight: 700;
  line-height: 1.1;
}

.dashboard-hero__subtitle {
  margin: 8px 0 0;
  max-width: 70ch;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
}

.dashboard-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.dashboard-hero__badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  backdrop-filter: blur(2px);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--app-surface, #fff);
  border: 1px solid var(--app-border, #d5d9de);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--app-shadow-sm, 0 2px 10px rgba(16, 35, 58, 0.05));
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-card__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--app-text-soft, #6b7280);
}

.summary-card__value {
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--app-primary, #0e7cb4);
}

.summary-card__hint {
  font-size: 12px;
  color: var(--app-text-muted, #8a93a0);
}

.overview-band {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--app-surface-muted, #f4f7fa);
  border: 1px solid var(--app-border, #d5d9de);
}

.overview-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 4px;
  background: var(--app-primary, #0e7cb4);
  flex-shrink: 0;
}

.overview-band__text {
  min-width: 0;
}

.overview-band__title {
  font-family: var(--app-font-family, "Inter");
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--app-text, #111827);
}

.overview-band__subtitle {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--app-text-soft, #6b7280);
}

.filters__head {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--app-border, #d5d9de);
}

.filters__title {
  font-family: var(--app-font-family, "Inter");
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--app-text, #111827);
}

.filters__subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--app-text-soft, #6b7280);
}

.grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

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

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

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

.card {
  background: var(--app-surface-muted, #f4f7fa);
  border: 1px solid var(--app-border, #d5d9de);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--app-shadow-sm, 0 2px 10px rgba(16, 35, 58, 0.05));
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.card__head h3 {
  font-family: var(--app-font-family, "Inter");
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--app-text, #111827);
}

.card__head span {
  color: var(--app-text-muted, #6b7280);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.chart-wrap {
  position: relative;
  min-height: 240px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.chart-wrap--donut {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  height: auto;
  min-height: 260px;
  overflow: visible;
}

.chart-wrap canvas {
  max-width: 100%;
}

.chart-wrap--donut canvas {
  width: min(120px, 100%) !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

.legend-list {
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 0;
  overflow: visible;
}

.legend-list li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 9px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--app-text-soft, #53657b);
  min-width: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.legend-list li strong {
  margin-left: auto;
  padding-left: 8px;
  white-space: nowrap;
  color: var(--app-text, #10233a);
  flex-shrink: 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  margin-top: 5px;
}

.d1 { background: #0e7cb4; }
.d2 { background: #2ecc71; }
.d3 { background: #52afd8; }
.d4 { background: #1abc9c; }
.d5 { background: #27ae60; }

.footer {
  background: #f3f6f8;
  color: var(--app-text, #1f2937);
  width: 100%;
  padding: 10px 16px;
}

.footer__content {
  max-width: var(--app-shell-max, 1400px);
  margin: 0 auto;
  padding-left: var(--app-shell-pad, 24px);
  padding-right: var(--app-shell-pad, 24px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.footer__content span {
  font-size: 12px;
}

@media (max-width: 1200px) {
  .dashboard-main {
    grid-template-columns: 1fr;
  }

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

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

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

  .chart-wrap--donut {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 14px;
  }

  .chart-wrap--donut canvas {
    width: min(188px, 100%) !important;
  }

  .legend-list {
    width: 100%;
    min-width: 0;
  }

  .legend-list li strong {
    margin-left: 0;
  }
}

@media (max-width: 900px) {
  .top-nav__container {
    padding: 0 10px;
    gap: 10px;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .top-nav__container::-webkit-scrollbar {
    display: none;
  }

  .top-nav__item {
    padding: 11px 4px 9px;
    font-size: 13px;
  }

  .dashboard-main {
    padding-left: var(--app-shell-pad-mobile, 16px);
    padding-right: var(--app-shell-pad-mobile, 16px);
  }

  .filters {
    padding: 12px;
    border-radius: 14px;
    align-self: auto;
  }

  .filters__toggle {
    display: flex;
    width: 100%;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #d6e2ee;
    border-radius: 12px;
    padding: 8px 10px 8px 12px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(16, 35, 58, 0.04);
    cursor: pointer;
  }

  .filters__toggle:focus-visible {
    outline: 3px solid rgba(17, 120, 167, 0.28);
    outline-offset: 2px;
  }

  .filters.is-ready:not(.is-open) .filters__body {
    display: none;
  }

  .filters.is-ready.is-open .filters__body {
    display: flex;
    margin-top: 14px;
  }

  .filters__head {
    display: none;
  }

  .filter-group {
    margin-bottom: 12px;
  }

  .filters-quick-card {
    margin-top: 4px;
  }

  .dashboard-hero {
    min-height: 170px;
    padding: 22px 16px;
    border-radius: 14px;
    text-align: center;
    align-items: center;
    background-size: cover;
  }
  .dashboard-hero::after {
    width: clamp(84px, 20vw, 118px);
    top: 10px;
    right: 10px;
  }

  .dashboard-hero__text {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .dashboard-hero__subtitle {
    max-width: 34ch;
    margin-left: auto;
    margin-right: auto;
  }

  .dashboard-hero__badges {
    justify-content: center;
  }

  .dashboard-hero__badge {
    justify-content: center;
  }

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

  .summary-card {
    align-items: center;
    text-align: center;
  }

  .card__head {
    justify-content: center;
    text-align: center;
  }

  .card__head h3,
  .card__head span {
    width: 100%;
    text-align: center;
  }

  .footer__content {
    padding-left: var(--app-shell-pad-mobile, 16px);
    padding-right: var(--app-shell-pad-mobile, 16px);
  }
}

@media (max-width: 640px) {
  .top-nav__container {
    padding: 0 8px;
    gap: 8px;
  }

  .top-nav__item {
    padding: 10px 4px 8px;
    font-size: 12px;
  }
}

/* Mantem o menu publico com a mesma distribuicao visual da Home e ESG. */
.dashboard-page .top-nav__container {
  width: min(100%, var(--page-max, 1400px)) !important;
  max-width: var(--page-max, 1400px) !important;
  margin: 0 auto !important;
  padding-left: var(--page-pad, clamp(16px, 4vw, 48px)) !important;
  padding-right: var(--page-pad, clamp(16px, 4vw, 48px)) !important;
  gap: 8px !important;
  justify-content: space-between !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

.dashboard-page .top-nav__item {
  flex: 0 0 auto !important;
  max-width: none !important;
  overflow: visible !important;
  text-overflow: clip !important;
  padding: 12px 2px 10px !important;
  line-height: 1.2 !important;
}

@media (max-width: 900px) {
  .dashboard-page .top-nav__container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    justify-content: stretch !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    gap: 4px !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    white-space: normal !important;
  }

  .dashboard-page .top-nav__item {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 7px 4px !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    text-align: center !important;
    font-size: 11px !important;
  }

  .dashboard-page .top-nav__item[href*="baixe-o-app.php"] {
    grid-column: 1 / -1 !important;
    justify-self: center !important;
    width: min(100%, 220px) !important;
    min-height: 38px !important;
    margin-top: 4px !important;
    border: 1px solid #7ed34a !important;
    border-radius: 999px !important;
    background: rgba(126, 211, 74, 0.12) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
  }
}

