/* DashNOX — Análises financeiras com visual sóbrio e operacional. */
.finance-analytics-panel {
  overflow: hidden;
  padding: 28px;
  border: 1px solid rgba(118, 146, 188, 0.18);
  border-radius: 16px !important;
  background: #091422;
  box-shadow: none;
}

.finance-analytics-panel::before,
.finance-analytics-panel::after {
  display: none !important;
}

.analytics-panel-header {
  align-items: center;
  margin: 0;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(122, 148, 188, 0.13);
}

.analytics-panel-header h2 {
  margin: 0;
  color: #e8eef8;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.analytics-view-toggle {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid rgba(122, 148, 188, 0.18);
  border-radius: 8px;
  background: #060d18;
}

.analytics-toggle-button {
  min-height: 38px;
  padding: 0 16px;
  color: #7f93b2;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  border: 0;
  border-right: 1px solid rgba(122, 148, 188, 0.14);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.analytics-toggle-button:first-child {
  border-radius: 7px 0 0 7px;
}

.analytics-toggle-button:last-child {
  border-right: 0;
  border-radius: 0 7px 7px 0;
}

.analytics-toggle-button:hover {
  color: #dce6f5;
}

.analytics-toggle-button.active {
  color: #bfeaff;
  background: #10233a;
}

.analytics-toggle-button:focus-visible,
.category-ranking-item:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.temporal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid rgba(122, 148, 188, 0.14);
  border-radius: 12px;
  background: #0b1728;
}

.temporal-kpi {
  min-width: 0;
  padding: 20px 22px;
  border-right: 1px solid rgba(122, 148, 188, 0.11);
}

.temporal-kpi:first-child {
  padding-left: 22px;
}

.temporal-kpi:last-child {
  padding-right: 22px;
  border-right: 0;
}

.temporal-kpi span {
  display: block;
  margin-bottom: 5px;
  overflow: hidden;
  color: #7287a6;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.temporal-kpi strong {
  display: block;
  overflow: hidden;
  color: #dce6f5;
  font-size: clamp(1.1rem, 1.35vw, 1.35rem);
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.temporal-kpi-income strong,
.temporal-selected-day-values > span:first-child strong {
  color: #50d3a0;
}

.temporal-kpi-expense strong,
.temporal-selected-day-values > span:nth-child(2) strong {
  color: #e87589;
}

.temporal-selected-day-card {
  display: grid;
  grid-template-columns: minmax(230px, 0.75fr) minmax(0, 1.3fr);
  gap: 22px;
  align-items: center;
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(122, 148, 188, 0.13);
  border-radius: 12px;
  background: #0a1626;
}

.temporal-selected-day-card[role="button"] {
  cursor: pointer;
}

.temporal-selected-day-card[role="button"]:focus-visible {
  outline: 2px solid rgba(79, 154, 255, 0.55);
  outline-offset: 3px;
}

.temporal-selected-day-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.temporal-selected-day-heading > div {
  min-width: 0;
}

.temporal-selected-day-heading > div > span {
  display: block;
  margin-bottom: 3px;
  color: #647a9b;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.temporal-selected-day-heading strong {
  display: block;
  overflow: hidden;
  color: #dce6f5;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.temporal-day-status {
  position: relative;
  flex-shrink: 0;
  padding-left: 12px;
  color: #7f93b2;
  font-size: 0.76rem;
  font-weight: 650;
}

.temporal-day-status::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #718096;
  transform: translateY(-50%);
}

.temporal-day-positive .temporal-day-status {
  color: #69d9ae;
}

.temporal-day-positive .temporal-day-status::before {
  background: #50d3a0;
}

.temporal-day-negative .temporal-day-status {
  color: #ec8a9b;
}

.temporal-day-negative .temporal-day-status::before {
  background: #e87589;
}

.temporal-selected-day-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
}

.temporal-selected-day-values > span {
  min-width: 0;
  padding: 0 15px;
  color: #6f84a5;
  font-size: 0.76rem;
  border-left: 1px solid rgba(122, 148, 188, 0.12);
}

.temporal-selected-day-values strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #dce6f5;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 15px 0 8px;
  color: #7f93b2;
  font-size: 0.8rem;
  font-weight: 600;
}

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

.analytics-dot {
  width: 10px;
  height: 4px;
  border-radius: 1px;
}

.analytics-dot-income {
  background: #50d3a0;
}

.analytics-dot-expense {
  background: #e87589;
}

.analytics-dot-balance {
  background: #4f9aff;
}

.finance-analytics-panel .chart-wrapper {
  padding: 0;
}

.temporal-chart-wrapper {
  height: clamp(320px, 27vw, 350px);
  min-height: 320px;
  padding: 16px 12px 8px 0 !important;
  border: 1px solid rgba(122, 148, 188, 0.11);
  border-radius: 12px;
  background: #07111f;
}

.temporal-chart-wrapper canvas,
.category-chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

.analytics-chart-hint {
  margin: 8px 0 0;
  color: #586f91;
  font-size: 0.76rem;
}

.temporal-highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(122, 148, 188, 0.13);
}

.temporal-highlight-grid article {
  min-width: 0;
  padding: 0 22px;
  border-right: 1px solid rgba(122, 148, 188, 0.11);
}

.temporal-highlight-grid article:first-child {
  padding-left: 0;
}

.temporal-highlight-grid article:last-child {
  padding-right: 0;
  border-right: 0;
}

.temporal-highlight-grid span {
  display: block;
  margin-bottom: 3px;
  color: #647a9b;
  font-size: 0.75rem;
}

.temporal-highlight-grid strong {
  display: block;
  overflow: hidden;
  color: #b8c7dc;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-total-badge {
  flex-shrink: 0;
  color: #c3d1e4;
  font-size: 0.95rem;
  font-weight: 650;
}

.category-analysis-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.72fr) minmax(430px, 1.28fr);
  gap: 32px;
  align-items: center;
  padding-top: 20px;
}

.category-chart-column,
.category-ranking-column {
  min-width: 0;
}

.category-chart-column {
  padding-right: 32px;
  border-right: 1px solid rgba(122, 148, 188, 0.11);
}

.category-chart-wrapper {
  position: relative;
  height: 340px;
  min-height: 340px;
  padding: 4px !important;
}

.category-chart-center {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  width: 46%;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.category-chart-center span {
  width: 100%;
  overflow: hidden;
  color: #6d83a5;
  font-size: 0.78rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-chart-center strong {
  width: 100%;
  overflow: hidden;
  color: #dce6f5;
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-chart-center small {
  color: #526989;
  font-size: 0.72rem;
}

.category-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(122, 148, 188, 0.13);
}

.category-summary-grid article {
  padding: 0 20px;
  border-right: 1px solid rgba(122, 148, 188, 0.11);
}

.category-summary-grid article:first-child {
  padding-left: 0;
}

.category-summary-grid article:last-child {
  padding-right: 0;
  border-right: 0;
}

.category-summary-grid span {
  display: block;
  margin-bottom: 3px;
  color: #647a9b;
  font-size: 0.78rem;
}

.category-summary-grid strong {
  color: #c8d5e7;
  font-size: 1.1rem;
}

.category-ranking-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.category-ranking-heading span {
  color: #aebed4;
  font-size: 0.86rem;
  font-weight: 650;
}

.category-ranking-heading small {
  color: #526989;
  font-size: 0.74rem;
}

.category-ranking-list {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-color: rgba(92, 121, 164, 0.45) transparent;
  scrollbar-width: thin;
}

.category-ranking-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 13px 5px;
  color: inherit;
  font: inherit;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(122, 148, 188, 0.09);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.category-ranking-item:hover,
.category-ranking-item.active {
  background: rgba(105, 135, 178, 0.055);
}

.category-ranking-item.active {
  box-shadow: inset 2px 0 0 var(--category-color);
}

.category-ranking-position {
  color: #617799;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
}

.category-ranking-content {
  display: block;
  min-width: 0;
}

.category-ranking-line {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.category-ranking-line strong {
  overflow: hidden;
  color: #cbd7e8;
  font-size: 0.86rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-ranking-line > span {
  flex-shrink: 0;
  color: #9aacc5;
  font-size: 0.82rem;
  font-weight: 600;
}

.category-ranking-progress {
  display: block;
  width: 100%;
  height: 3px;
  margin-top: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.045);
}

.category-ranking-progress i {
  display: block;
  height: 100%;
  background: var(--category-color);
}

.category-ranking-share {
  color: #7086a7;
  font-size: 0.76rem;
  font-weight: 650;
  text-align: right;
}

.category-ranking-empty {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  color: #7187a7;
  text-align: center;
  border: 1px solid rgba(122, 148, 188, 0.1);
  border-radius: 12px;
  background: #081320;
}

.category-empty-symbol {
  color: #4f9aff;
  font-size: 1.7rem;
  line-height: 1;
}

.category-ranking-empty strong {
  color: #cbd7e8;
  font-size: 1.05rem;
}

.category-ranking-empty small {
  max-width: 520px;
  color: #6f84a5;
  font-size: 0.82rem;
  line-height: 1.55;
}

.category-analysis-panel.is-empty .category-analysis-grid {
  display: block;
  padding-top: 16px;
}

.category-analysis-panel.is-empty .category-chart-column,
.category-analysis-panel.is-empty .category-summary-grid,
.category-analysis-panel.is-empty .category-ranking-heading {
  display: none;
}

.category-analysis-panel.is-empty .category-ranking-column {
  width: 100%;
}

.category-ranking-empty.hidden {
  display: none;
}

@media (max-width: 1080px) {
  .temporal-selected-day-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .temporal-selected-day-values > span:first-child {
    padding-left: 0;
    border-left: 0;
  }

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

  .category-chart-column {
    padding-right: 0;
    padding-bottom: 20px;
    border-right: 0;
    border-bottom: 1px solid rgba(122, 148, 188, 0.11);
  }

  .category-chart-wrapper {
    height: 330px;
    min-height: 330px;
  }

  .category-ranking-list {
    max-height: 380px;
  }
}

@media (max-width: 720px) {
  .finance-analytics-panel {
    padding: 18px;
  }

  .analytics-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .analytics-view-toggle {
    width: 100%;
    margin-top: 12px;
  }

  .analytics-toggle-button {
    flex: 1;
  }

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

  .temporal-kpi,
  .temporal-kpi:first-child,
  .temporal-kpi:last-child {
    padding: 16px;
  }

  .temporal-kpi:nth-child(2) {
    border-right: 0;
  }

  .temporal-kpi:nth-child(3) {
    border-top: 1px solid rgba(122, 148, 188, 0.1);
  }

  .temporal-kpi:nth-child(4) {
    border-top: 1px solid rgba(122, 148, 188, 0.1);
  }

  .temporal-selected-day-heading {
    align-items: flex-start;
  }

  .temporal-selected-day-values > span {
    padding: 0 9px;
  }

  .temporal-chart-wrapper {
    height: 310px;
    min-height: 310px;
  }

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

  .temporal-highlight-grid article,
  .temporal-highlight-grid article:first-child,
  .temporal-highlight-grid article:last-child {
    padding: 8px 0;
    border-right: 0;
    border-bottom: 1px solid rgba(122, 148, 188, 0.08);
  }

  .temporal-highlight-grid article:last-child {
    border-bottom: 0;
  }

  .category-chart-wrapper {
    height: 300px;
    min-height: 300px;
  }

  .category-ranking-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 480px) {
  .temporal-selected-day-values {
    grid-template-columns: 1fr;
  }

  .temporal-selected-day-values > span,
  .temporal-selected-day-values > span:first-child {
    padding: 7px 0;
    border-top: 1px solid rgba(122, 148, 188, 0.08);
    border-left: 0;
  }

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

  .category-summary-grid article,
  .category-summary-grid article:first-child,
  .category-summary-grid article:last-child {
    padding: 6px 0;
    border-right: 0;
  }

  .category-ranking-item {
    grid-template-columns: 20px minmax(0, 1fr) 50px;
    gap: 7px;
  }
}

/* RC44: funcionalidades privadas continuam carregadas, mas ficam fora da navegação
   principal até voltarem a fazer parte do fluxo público do Financeiro. */
.finance-internal-tabs > [data-finance-tab="connected"],
.finance-internal-tabs > [data-finance-tab="sync"] {
  display: none !important;
}

.finance-internal-tabs {
  position: sticky;
  top: 10px;
  z-index: 22;
  display: flex;
  gap: 6px;
  margin: 0 0 18px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid rgba(var(--user-accent-rgb), 0.15);
  border-radius: 14px;
  background: rgba(5, 11, 25, 0.88);
  backdrop-filter: blur(16px);
}

.finance-internal-tabs button {
  flex: 1 0 auto;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 750;
  cursor: pointer;
}

.finance-internal-tabs button:hover,
.finance-internal-tabs button.active {
  border-color: rgba(var(--user-accent-rgb), 0.32);
  background: rgba(var(--user-accent-rgb), 0.12);
  color: var(--text);
}

.finance-tab-hidden {
  display: none !important;
}

@media (max-width: 680px) {
  .finance-internal-tabs {
    top: 4px;
    margin-inline: -4px;
  }

  .finance-internal-tabs button {
    flex: 0 0 auto;
  }
}
