/* Hux home category distribution: shadcn-inspired chart hierarchy, Hux geometry. */
#dashboard-view {
  --category-tone-1: #ff5358;
  --category-tone-2: #b9333b;
  --category-tone-3: #f29a9e;
  --category-tone-4: #73737d;
}

html[data-theme="light"] #dashboard-view {
  --category-tone-1: #df3f43;
  --category-tone-2: #962e35;
  --category-tone-3: #ee8b8f;
  --category-tone-4: #52525b;
}

/* The chart header now flows directly into the visualization. */
#dashboard-view :is(.activity-card-header, .category-pane-header) {
  border-bottom: 0;
}

#dashboard-view .activity-category-pane .category-overview {
  min-height: 284px;
}

#dashboard-view .category-distribution-chart {
  display: grid;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 284px;
  grid-template-columns: minmax(154px, 0.82fr) minmax(220px, 1.18fr);
  align-items: center;
  gap: clamp(18px, 2vw, 32px);
  padding: 4px 28px 24px;
}

#dashboard-view .category-pie-visual {
  position: relative;
  display: grid;
  width: min(100%, 190px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
}

#dashboard-view .category-pie {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#dashboard-view :is(.category-pie-track, .category-pie-segment) {
  fill: none;
  vector-effect: non-scaling-stroke;
}

#dashboard-view .category-pie-track {
  stroke: var(--home-track);
  stroke-width: 22;
}

#dashboard-view .category-pie-segment {
  stroke: var(--category-color);
  stroke-width: 22;
  stroke-linecap: butt;
  cursor: pointer;
  outline: none;
  transition: opacity 90ms ease-out, filter 90ms ease-out, stroke-width 90ms ease-out;
}

#dashboard-view .category-pie-center {
  position: absolute;
  inset: 25%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  pointer-events: none;
  text-align: center;
}

#dashboard-view .category-pie-center strong {
  color: var(--home-text);
  font-family: var(--v43-number-font);
  font-size: clamp(28px, 2.2vw, 34px);
  font-weight: 620;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: -0.025em;
  line-height: 1;
}

#dashboard-view .category-pie-center small {
  color: var(--home-secondary);
  font-size: 11px;
  line-height: 16px;
}

#dashboard-view .category-legend {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 6px;
}

#dashboard-view .category-row {
  display: grid;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  height: auto;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  grid-template-rows: 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  box-shadow: none;
  cursor: pointer;
  text-align: left;
  transition: background-color 90ms ease-out, border-color 90ms ease-out, opacity 90ms ease-out;
}

#dashboard-view .category-swatch {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--category-color);
}

#dashboard-view .category-row-label {
  grid-column: 2;
  grid-row: 1;
  gap: 8px;
}

#dashboard-view .category-row-label .ui-icon {
  width: 17px;
  height: 17px;
  background-color: var(--home-secondary);
}

#dashboard-view .category-row-label strong {
  overflow: hidden;
  color: var(--home-text);
  font-size: 14px;
  font-weight: 560;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dashboard-view .category-stat {
  display: grid;
  min-width: 76px;
  grid-column: 3;
  grid-row: 1;
  grid-template-columns: minmax(30px, auto) 34px;
  align-items: baseline;
  justify-content: end;
  gap: 8px;
  text-align: right;
}

#dashboard-view .category-stat strong {
  color: var(--home-text);
  font-family: var(--v43-number-font);
  font-size: 20px;
  font-weight: 620;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

#dashboard-view .category-stat small {
  color: var(--home-secondary);
  font-family: var(--v43-number-font);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

#dashboard-view .category-tone-1 { --category-color: var(--category-tone-1); }
#dashboard-view .category-tone-2 { --category-color: var(--category-tone-2); }
#dashboard-view .category-tone-3 { --category-color: var(--category-tone-3); }
#dashboard-view .category-tone-4 { --category-color: var(--category-tone-4); }

#dashboard-view .category-row:is(:hover, :focus-visible, .is-active) {
  border-color: var(--home-border);
  background: var(--home-hover);
  box-shadow: none;
  transform: none;
}

#dashboard-view .category-row:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

#dashboard-view .category-pie-segment:is(:hover, :focus-visible, .is-active) {
  stroke-width: 26;
  filter: brightness(1.06);
}

#dashboard-view .category-distribution-chart.has-active-category :is(.category-pie-segment, .category-row) {
  opacity: 0.42;
}

#dashboard-view .category-distribution-chart.has-active-category :is(.category-pie-segment, .category-row).is-active {
  opacity: 1;
}

@media (max-width: 1100px) {
  #dashboard-view .activity-category-pane .category-overview,
  #dashboard-view .category-distribution-chart {
    min-height: 260px;
  }

  #dashboard-view .category-distribution-chart {
    grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1.3fr);
  }

  #dashboard-view .category-pie-visual {
    width: min(100%, 206px);
  }
}

@media (max-width: 720px) {
  #dashboard-view :is(.activity-card-header, .category-pane-header) {
    border-bottom: 0;
  }

  #dashboard-view .activity-category-pane .category-overview,
  #dashboard-view .category-distribution-chart {
    min-height: 0;
  }

  #dashboard-view .category-distribution-chart {
    grid-template-columns: 124px minmax(0, 1fr);
    gap: 12px;
    padding: 2px 20px 20px;
  }

  #dashboard-view .category-pie-visual {
    width: 124px;
  }

  #dashboard-view .category-pie-track,
  #dashboard-view .category-pie-segment {
    stroke-width: 20;
  }

  #dashboard-view .category-pie-segment:is(:hover, :focus-visible, .is-active) {
    stroke-width: 23;
  }

  #dashboard-view .category-pie-center strong {
    font-size: 25px;
  }

  #dashboard-view .category-row {
    min-height: 48px;
    grid-template-columns: 8px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 7px 8px;
  }

  #dashboard-view .category-row-label {
    gap: 6px;
  }

  #dashboard-view .category-row-label .ui-icon {
    width: 15px;
    height: 15px;
  }

  #dashboard-view .category-row-label strong {
    font-size: 13px;
  }

  #dashboard-view .category-stat {
    min-width: 62px;
    grid-template-columns: minmax(24px, auto) 30px;
    gap: 5px;
  }

  #dashboard-view .category-stat strong {
    font-size: 17px;
  }

  #dashboard-view .category-stat small {
    font-size: 10px;
  }
}

@media (max-width: 520px) {
  #dashboard-view .category-distribution-chart {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #dashboard-view .category-pie-visual {
    width: 142px;
  }

  #dashboard-view .category-legend {
    width: 100%;
  }

  #dashboard-view .category-row {
    padding-inline: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #dashboard-view :is(.category-pie-segment, .category-row) {
    transition: none;
  }
}
