/* Home dashboards, Agenda and the shared SVG charts. Same tokens and rhythm as styles.css. */

/* ---------- Stat rows: every row is full, whatever the number of tiles ---------- */
.stats.hm-stats { display: flex; flex-wrap: wrap; }
.stats.hm-stats > * { flex: 1 1 calc(25% - var(--gap)); min-width: 0; }
.stats.hm-stats-5 > * { flex-basis: calc(20% - var(--gap)); }
.stats.hm-stats-6 > * { flex-basis: calc(33.333% - var(--gap)); }
.hm-stats .stat strong { overflow-wrap: normal; }

/* ---------- Home panels ---------- */
.hm-alerts .list-row { align-items: flex-start; justify-content: flex-start; }
.hm-alerts .alert-dot { margin-top: 7px; }
.hm-rows .list-row.as-link { padding: 12px 4px; }
.hm-date { flex: none; font-size: .78rem; white-space: nowrap; }
.hm-table-panel .table-wrap { border: 0; border-radius: 0; background: none; }
.hm-table-panel .dtable th:first-child, .hm-table-panel .dtable td:first-child { padding-left: 4px; }

/* ---------- Charts: colours come only from these classes ---------- */
.chart { min-width: 0; }
.chart .bar, .chart .col, .chart .arc, .chart .chart-swatch { color: var(--accent); }
.chart .bar, .chart .col { fill: currentColor; }
.chart .chart-swatch { background: currentColor; }
.chart .c-accent { color: var(--accent); }
.chart .c-good { color: var(--good); }
.chart .c-warn { color: var(--warn); }
.chart .c-orange { color: #f99541; }
.chart .c-bad { color: var(--bad); }
.chart .c-violet { color: var(--violet); }
.chart .c-muted { color: #5d7489; }
/* Severity steps chosen to stay distinguishable side by side (also for colour-blind readers); labels always carry the name. */
.chart .sev-critical { color: #e8455f; }
.chart .sev-high { color: #f99541; }
.chart .sev-medium { color: #f5df90; }
.chart .sev-low { color: var(--accent); }
.chart .sev-informational { color: #5d7489; }

/* Horizontal bars */
.bar-list { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.bar-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--ink); text-decoration: none; }
a.bar-row { border-radius: 6px; outline-offset: 4px; }
a.bar-row:hover .bar-label { color: var(--accent); }
a.bar-row:hover .bar { filter: brightness(1.15); }
.bar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: .84rem; line-height: 1.35; }
.bar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-svg { display: block; width: 100%; height: 8px; }
.bar-track { fill: #0f2a3d; }

/* Columns */
.chart-columns { display: flex; flex-direction: column; gap: 10px; }
.col-plot { display: flex; flex-direction: column; gap: 6px; }
.col-svg { display: block; width: 100%; height: 150px; overflow: visible; }
.col-hit { fill: transparent; }
.col-slot:hover .col { filter: brightness(1.18); }
.col-value { fill: var(--ink); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.col-base { fill: var(--line); }
.col-labels { display: flex; }
.col-labels span { flex: 1 1 0; min-width: 0; overflow: hidden; color: var(--muted); font-size: .7rem; text-align: center; white-space: nowrap; }
.chart-note { color: var(--muted); font-size: .78rem; }

/* Donut */
.chart-donut { display: flex; align-items: center; flex-wrap: wrap; gap: 18px 32px; }
.donut-svg { flex: none; width: 148px; height: 148px; }
.arc { fill: none; stroke: currentColor; stroke-width: 14; transition: stroke-width .15s; }
.arc:hover { stroke-width: 17; }
.donut-center { fill: var(--ink); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.donut-sub { fill: var(--muted); font-size: 10px; }
.chart-legend { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.chart-legend li > a, .chart-legend .legend-row { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 6px; color: var(--ink); font-size: .85rem; text-decoration: none; }
.chart-legend li > a:hover { background: #10283c66; }
.chart-legend li > a:hover .legend-label { color: var(--accent); }
.chart-legend .is-zero .legend-label, .chart-legend .is-zero .legend-value { color: var(--muted); }
.chart-swatch { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Agenda · calendar ---------- */
.ag-legend { margin-left: auto; justify-content: flex-end; }
.legend-item.evg-task::before { background: var(--accent); }
.legend-item.evg-session::before { background: var(--good); }
.legend-item.evg-milestone::before { background: var(--violet); }
.legend-item.evg-deadline::before { background: var(--bad); }
.legend-item.evg-followup::before { background: var(--warn); }
.legend-item.evg-sales::before { background: var(--muted); }
.cal-event.evg-task { border-left-color: var(--accent); }
.cal-event.evg-session { border-left-color: var(--good); }
.cal-event.evg-milestone { border-left-color: var(--violet); }
.cal-event.evg-deadline { border-left-color: var(--bad); }
.cal-event.evg-followup { border-left-color: var(--warn); }
.cal-event.evg-sales { border-left-color: var(--muted); }
a.cal-event { text-decoration: none; }
.cal-event:hover { filter: brightness(1.18); }
button.cal-more { display: block; margin-top: 4px; padding: 2px 0; border: 0; background: none; color: var(--muted); font-size: .7rem; cursor: pointer; }
button.cal-more:hover { color: var(--accent); }
.ag-day-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }
.ag-day-list .cal-event { margin-top: 0; padding: 10px 12px; font-size: .85rem; white-space: normal; }

/* ---------- Agenda · timeline ---------- */
.ag-gantt { gap: 12px; }
.ag-gantt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; }
.ag-gantt .gantt-row { grid-template-columns: 220px minmax(0, 1fr); }
.ag-gantt .gantt-body { gap: 8px; }
.ag-gantt .gantt-track { height: 26px; }
.ag-gantt .gantt-bar { top: 5px; height: 16px; border-radius: 8px; background: var(--accent); }
.ag-gantt .gantt-dot { top: 5px; }
.ag-glabel { display: flex; flex-direction: column; min-width: 0; color: var(--ink); text-decoration: none; line-height: 1.35; }
.ag-glabel b { font-size: .86rem; font-weight: 600; }
.ag-glabel small { font-size: .72rem; }
.ag-glabel:hover b { color: var(--accent); }
.gantt-bar.ag-st-prep, .legend-item.ag-st-prep::before { background: var(--violet); }
.gantt-bar.ag-st-testing, .legend-item.ag-st-testing::before { background: var(--accent); }
.gantt-bar.ag-st-report, .legend-item.ag-st-report::before { background: var(--good); }
.gantt-bar.ag-st-paused, .legend-item.ag-st-paused::before { background: var(--warn); }
.legend-item.ag-lg-ms::before { background: var(--accent); transform: rotate(45deg) scale(.8); border-radius: 1px; }
.legend-item.ag-lg-now::before { width: 2px; height: 12px; background: var(--warn); border-radius: 0; }
.ag-scale { min-height: 18px; }
.ag-ticks { position: relative; height: 18px; overflow: hidden; }
.ag-tick { position: absolute; top: 0; display: none; padding-left: 5px; border-left: 1px solid var(--line); color: var(--muted); font: 11px/18px var(--mono); white-space: nowrap; }
.ag-tick.lbl-d { display: block; }
.ag-gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: #11283a; pointer-events: none; }

/* ---------- Agenda · team and time ---------- */
.ag-skills { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.ag-certs { display: flex; flex-direction: column; gap: 4px; }
.ag-cert { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ag-conflicts small a { text-decoration: none; }
.ag-conflicts small a:hover { text-decoration: underline; }
.ag-team .dtable td:first-child { width: auto; min-width: 180px; }
.ag-team .dtable th { white-space: normal; overflow-wrap: normal; vertical-align: bottom; }
.ag-team .dtable td:nth-child(2), .ag-team .dtable td:nth-child(n+5) { white-space: nowrap; }
.ag-approve { min-height: 30px; padding: 3px 11px; font-size: .75rem; white-space: nowrap; }
.ag-approve[aria-pressed=true] { background: #0f3a33; border-color: var(--good); color: var(--good); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats.hm-stats-5 > *, .stats.hm-stats-6 > * { flex-basis: calc(33.333% - var(--gap)); }
  .ag-gantt .gantt-row { grid-template-columns: 160px minmax(0, 1fr); }
}
@media (min-width: 721px) {
  .ag-skills { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .stats.hm-stats > * { flex-basis: calc(50% - 10px); }
  .ag-legend { margin-left: 0; justify-content: flex-start; }
  #agenda-body > .toolbar .toolbar-row > select { flex: 1 1 150px; }
  .ag-gantt .gantt-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ag-gantt .ag-scale > .gantt-label { display: none; }
  .ag-tick.lbl-d { display: none; }
  .ag-tick.lbl-p { display: block; }
  .hm-overdue tbody tr:nth-child(n+5) { display: none; }
  .ag-certs { align-items: flex-end; }
  .chart-donut { justify-content: center; }
}
