#dashboard-analytics { margin: 8px 0 24px; }
.analytics-topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--soft-surface); }
.analytics-topbar-meta { min-width: 0; display: grid; gap: 3px; }
.analytics-status { color: var(--text-main); font-size: var(--text-xs); font-weight: 500; line-height: 1.5; margin: 0; }
.analytics-shared-note { color: var(--text-muted); font-size: 11px; line-height: 1.45; margin: 0; }
.analytics-toolbar { display: flex; align-items: center; gap: 10px; margin: 0; flex-shrink: 0; }
.analytics-toolbar label { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.analytics-toolbar .modern-select { min-width: 165px; min-height: 36px; padding: 6px 10px; font-size: var(--text-xs); }
.analytics-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.analytics-kpi-card { display: grid; gap: 4px; padding: 12px 16px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-card); box-shadow: var(--shadow-panel); }
.analytics-kpi-label { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.analytics-kpi-value { font-size: 20px; font-weight: 700; line-height: 1.25; color: var(--text-main); font-variant-numeric: tabular-nums; }
.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.analytics-grid > section { min-width: 0; }
.analytics-trend.workspace-surface { padding: 18px 20px 14px; }
.chart-region { min-height: 205px; margin-top: 10px; overflow-x: auto; }
.analytics-trend .chart-region > svg { width: 100%; height: auto; display: block; }
.analytics-credits .chart-region { min-height: 0; }
.chart-grid-line { stroke: var(--border-subtle); stroke-dasharray: 3 5; }
.chart-axis { fill: var(--text-muted); font-size: var(--text-xs); font-family: inherit; }
.chart-trend-line { fill: none; stroke: var(--accent-primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-point { fill: var(--bg-surface); stroke: var(--accent-primary); stroke-width: 3; }
.analytics-trend-four .chart-trend-line { stroke: var(--accent-emerald); }
.analytics-trend-four .chart-point { stroke: var(--accent-emerald); }
.chart-point[role="button"] { cursor: pointer; }
.chart-point[role="button"]:focus-visible { stroke-width: 5; }
.chart-grade-segment { cursor: pointer; }
.chart-grade-segment:focus-visible { stroke-width: 27; }
.chart-grade-segment[aria-expanded="true"] { stroke-width: 27; }
.chart-point-label { fill: var(--text-main); font: 600 13px var(--font-family); font-variant-numeric: tabular-nums; }
.analytics-empty { display: grid; place-items: center; min-height: 210px; padding: 24px; color: var(--text-muted); font-size: var(--text-sm); text-align: center; line-height: 1.9; background: var(--soft-surface); border-radius: 8px; }
.distribution-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 16px; }
.distribution-layout > svg { width: 100%; }
.chart-ring-bg { stroke: var(--border-subtle); }
.chart-ring-total { fill: var(--text-main); font: 600 32px var(--font-family); font-variant-numeric: tabular-nums; }
.distribution-legend { list-style: none; padding: 0; display: grid; gap: 5px; }
.distribution-legend li { font-size: var(--text-sm); }
.distribution-grade-button { display: grid; grid-template-columns: 9px minmax(24px, 1fr) var(--grade-count-width, max-content); column-gap: 6px; align-items: center; width: 100%; padding: 3px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.distribution-grade-button:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; border-radius: 4px; }
.distribution-grade-button[aria-expanded="true"] { background: var(--soft-surface); border-radius: 6px; }
.distribution-grade-button > span:nth-child(2) { overflow-wrap: anywhere; min-width: 0; }
.distribution-legend strong { font-weight: 500; text-align: right; white-space: nowrap; }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
html:has(#analytics-detail[open]) { overflow: hidden; padding-right: var(--analytics-scrollbar-width, 0px); }
.analytics-detail { width: min(1060px, calc(100% - 48px)); max-width: none; max-height: calc(100dvh - 48px); box-sizing: border-box; margin: auto; padding: 28px; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 20px; background: var(--bg-card); color: var(--text-main); font-family: inherit; box-shadow: 0 24px 80px rgb(0 0 0 / 24%); }
.analytics-detail[open] { display: flex; flex-direction: column; }
.analytics-detail::backdrop { background: rgb(12 18 40 / 55%); }
.analytics-detail-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.analytics-detail-head > div { min-width: 0; }
.analytics-detail-head h4 { margin: 0 0 4px; font-size: 18px; line-height: 1.4; color: var(--text-main); }
.analytics-detail-close { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--soft-surface); color: var(--text-main); font: 28px/1 var(--font-family); cursor: pointer; }
.analytics-detail-close:hover { background: var(--hover-surface); }
.analytics-detail-close:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 3px; }
#analytics-detail-meta { margin: 0 0 14px; color: var(--text-muted); font-size: var(--text-sm); line-height: 1.6; }
.analytics-detail-hint { display: none; margin: 0 0 10px; color: var(--text-muted); font-size: var(--text-xs); }
.analytics-detail-scroll { min-height: 0; max-height: none; overscroll-behavior: contain; overflow: auto; border: 1px solid var(--border-subtle); border-radius: 10px; }
#analytics-detail-table { min-width: 620px; font-size: var(--text-sm); }
#analytics-detail-table thead th { position: sticky; top: 0; z-index: 1; font-size: var(--text-sm); }
#analytics-detail-table th:first-child, #analytics-detail-table td:first-child { width: 100px; text-align: left; }
#analytics-detail-table th:nth-child(n+3), #analytics-detail-table td:nth-child(n+3) { min-width: 72px; text-align: center; font-variant-numeric: tabular-nums; }
#analytics-detail-table td:last-child { width: auto; }
#analytics-detail-table .analytics-detail-term th { width: auto; padding: 10px 12px; text-align: left; font-size: var(--text-xs); font-weight: 600; background: var(--soft-surface); color: var(--text-muted); }
#analytics-detail-table tbody tr:not(.analytics-detail-term):hover { background: var(--hover-surface); }
.credit-chart-row { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(100px, 1fr) 45px; align-items: center; gap: 18px; margin: 18px 0; font-size: var(--text-sm); }
.credit-chart-term { color: var(--text-muted); line-height: 1.6; }
.credit-chart-track { height: 12px; background: var(--soft-surface); border-radius: 4px; overflow: hidden; }
.credit-chart-bar { height: 100%; background: var(--action-gradient); border-radius: 5px; }
.credit-chart-row strong { text-align: right; font-size: var(--text-base); font-weight: 600; font-variant-numeric: tabular-nums; }
.analytics-data-table { margin-top: 20px; border-bottom: 1px solid var(--border-subtle); padding: 12px 0 20px; }
.analytics-data-table summary, .dashboard-manual-plan > summary { cursor: pointer; font-size: var(--text-base); font-weight: 600; color: var(--text-main); }
.analytics-data-table .table-scroll { margin-top: 16px; }
#analytics-table { min-width: 960px; font-size: var(--text-sm); }
.dashboard-manual-plan { margin-top: 28px; border-top: 1px solid var(--border-subtle); padding-top: 22px; }
.dashboard-manual-plan > summary { padding: 8px 0; }
.workspace-selectors { grid-template-columns: 1fr; }
@media (max-width: 1200px) { .analytics-grid { grid-template-columns: 1fr; }.analytics-credits { grid-column: auto; }.distribution-layout { grid-template-columns: 190px minmax(0, 1fr); }.analytics-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .analytics-topbar { flex-direction: column; align-items: stretch; }
  .analytics-toolbar label { width: 100%; justify-content: space-between; }
}
@media (max-width: 520px) {
  .analytics-toolbar { flex-wrap: wrap; align-items: start; }
  .analytics-toolbar label { width: 100%; }
  .analytics-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .analytics-grid { gap: 18px; }
  .distribution-layout { grid-template-columns: 140px minmax(0, 1fr); gap: 10px; }
  .credit-chart-row { grid-template-columns: 105px minmax(60px, 1fr) 30px; gap: 10px; font-size: var(--text-xs); }
  .chart-region { min-height: 200px; }
  .analytics-detail-hint { display: block; }
  .analytics-detail { width: calc(100% - 24px); max-height: calc(100dvh - 24px); padding: 18px; border-radius: 16px; }
}
