/* ==========================================================================
   OBLIVET — analytics, charts, and observations
   ========================================================================== */

/* --------------------------------------------------------------------------
   11. Analytics
   -------------------------------------------------------------------------- */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.mini-stat {
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.016);
}

.mini-stat > p {
  overflow: hidden;
  margin-top: 12px;
  color: var(--white);
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mini-stat-foot {
  display: block;
  margin-top: 7px;
  color: var(--muted-dim);
  font-size: 10.5px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.donut-panel { grid-column: span 5; }
.bars-panel { grid-column: span 7; }
.observations-panel { grid-column: span 12; }

.donut-wrap {
  display: flex;
  justify-content: center;
  padding: 14px 0 26px;
}

.donut {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 208px;
  height: 208px;
  border-radius: 50%;
  background: #141414;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: background 0.5s var(--ease);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(5, 5, 5, 0.9);
  border-radius: 50%;
  pointer-events: none;
}

.donut-hole {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 134px;
  height: 134px;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: #080808;
  text-align: center;
}

.donut-hole strong {
  margin: 5px 0 3px;
  color: var(--white);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.donut-hole > span:last-child {
  color: var(--muted-dim);
  font-size: 9.5px;
}

.legend-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  border-top: 1px solid var(--line-soft);
}

.legend-list li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.legend-list li:last-child {
  border-bottom: 0;
}

.legend-list li:nth-last-child(2) {
  border-bottom: 0;
}

.legend-list .legend-empty {
  grid-column: 1 / -1;
  display: block;
  padding: 12px 0;
}

.legend-swatch {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.legend-name {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-value {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 450;
  font-variant-numeric: tabular-nums;
}

.legend-pct {
  width: 34px;
  color: var(--muted-dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Pure CSS/JS bar chart */
.bar-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: clamp(8px, 2vw, 24px);
  min-height: 328px;
  padding: 20px 4px 0;
  background-image: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(25% - 1px),
    rgba(255, 255, 255, 0.055) calc(25% - 1px),
    rgba(255, 255, 255, 0.055) 25%
  );
  background-size: 100% calc((100% - 30px) / 4);
  background-position: 0 0;
  background-repeat: repeat-y;
}

.bar-month {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 306px;
  min-width: 0;
  border-radius: 10px;
  color: inherit;
  transition: background 0.2s var(--ease);
}

.bar-month:hover {
  background: rgba(255, 255, 255, 0.03);
}

.bar-month:focus-visible {
  outline-offset: 4px;
}

.chart-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted-dim);
  font-size: 10.5px;
}

.chart-hint .status-dot {
  width: 4px;
  height: 4px;
  box-shadow: none;
  opacity: 0.7;
}

.bar-pair {
  display: flex;
  flex: 1;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(3px, 0.7vw, 7px);
  width: 100%;
}

.bar {
  position: relative;
  width: clamp(9px, 1.2vw, 16px);
  min-height: 2px;
  border-radius: 3px 3px 1px 1px;
  transition: height 0.7s var(--ease), opacity 0.2s var(--ease);
}

.bar--income {
  background: linear-gradient(to top, #9b9b9b, #ffffff);
}

.bar--expense {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0 2px,
    rgba(255, 255, 255, 0.055) 2px 5px
  );
}

.bar-month:hover .bar {
  opacity: 1;
}

.bar-chart:hover .bar {
  opacity: 0.55;
}

.bar-chart:hover .bar-month:hover .bar {
  opacity: 1;
}

.bar::after {
  content: attr(data-value);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 4;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101010;
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 450;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 3px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.bar:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.bar-label {
  color: var(--muted-dim);
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.bar-legend {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-dim);
  font-size: 10px;
}

.bar-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 17px;
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.bar-summary > div {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.bar-summary .micro-label {
  white-space: nowrap;
}

.bar-summary strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line-soft);
}

.note {
  padding: 18px 22px 0 0;
  border-right: 1px solid var(--line-soft);
}

.note:nth-child(2) {
  padding-left: 22px;
}

.note:last-child {
  border-right: 0;
  padding-right: 0;
  padding-left: 22px;
}

.note-no {
  display: block;
  margin-bottom: 12px;
  color: var(--muted-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.note p {
  max-width: 300px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: -0.005em;
  line-height: 1.65;
}

.note strong {
  color: var(--text-soft);
  font-weight: 450;
}
