.org-generation-chart {
  min-height: 300px;
  padding: 18px 14px 16px;
  display: grid;
  grid-template-columns: repeat(
    var(--org-visible-count, 8),
    minmax(max(82px, calc((100% / var(--org-columns-in-view, 8)) - 10px)), 1fr)
  );
  align-items: end;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.org-generation-message {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
}

.org-generation-column {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  font: inherit;
}

.org-generation-column:focus-visible {
  outline: 2px solid color-mix(in srgb, #e8ad00 70%, transparent);
  outline-offset: 4px;
  border-radius: 8px;
}

.org-generation-value {
  min-height: 34px;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-align: center;
}

.org-generation-value small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
}

.org-generation-track {
  width: min(48px, 72%);
  height: 158px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

html.theme-dark .org-generation-track {
  background: rgba(255, 255, 255, 0.08);
}

.org-generation-fill {
  width: 100%;
  height: var(--bar-height);
  min-height: 4px;
  border-radius: 8px 8px 5px 5px;
  background: linear-gradient(180deg, #ffe477 0%, #ffd13f 48%, #f0b900 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46), 0 6px 14px rgba(240, 185, 0, 0.14);
  transition: height 180ms ease, filter 160ms ease;
}

.org-generation-column:hover .org-generation-fill {
  filter: saturate(1.08) brightness(1.02);
}

.org-generation-name {
  min-height: 34px;
  max-width: 112px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: center;
}

.org-generation-popover {
  position: fixed;
  z-index: 1200;
  max-height: min(520px, calc(100vh - 24px));
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, var(--bg));
  color: var(--text);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px) saturate(150%);
}

html.theme-dark .org-generation-popover {
  background: rgba(36, 36, 36, 0.97);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.46);
}

.org-generation-popover-head {
  min-height: 58px;
  padding: 10px 10px 10px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 6px;
}

.org-generation-popover-back,
.org-generation-popover-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 22px;
  line-height: 1;
}

.org-generation-popover-back:hover:not(:disabled),
.org-generation-popover-close:hover,
.org-generation-popover-back:focus-visible,
.org-generation-popover-close:focus-visible {
  background: color-mix(in srgb, var(--surface) 76%, var(--line));
  color: var(--text);
  outline: none;
}

.org-generation-popover-back:disabled {
  opacity: 0;
  pointer-events: none;
}

.org-generation-popover-path {
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-generation-popover-total {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.org-generation-popover-body {
  max-height: min(450px, calc(100vh - 94px));
  padding: 8px;
  overflow-y: auto;
}

.org-generation-detail-label {
  padding: 5px 8px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.org-generation-detail-label:not(:first-child) {
  margin-top: 6px;
  border-top: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  padding-top: 10px;
}

.org-generation-detail-row {
  width: 100%;
  min-height: 42px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  font: inherit;
  text-align: left;
}

.org-generation-detail-row.is-action {
  cursor: pointer;
}

.org-generation-detail-row.is-action:hover,
.org-generation-detail-row.is-action:focus-visible {
  background: color-mix(in srgb, var(--surface) 76%, var(--line));
  outline: none;
}

.org-generation-detail-name {
  min-width: 0;
  font-size: 12px;
  font-weight: 560;
  overflow-wrap: anywhere;
}

.org-generation-detail-name i {
  margin-left: 6px;
  color: var(--muted);
  font-size: 16px;
  font-style: normal;
}

.org-generation-detail-count {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.org-generation-detail-count small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.org-generation-detail-empty {
  padding: 22px 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 720px) {
  .org-generation-chart {
    grid-template-columns: repeat(var(--org-visible-count, 4), minmax(82px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .org-generation-fill { transition: none; }
}
