/* Dashboard — KPI tiles, hand-rolled SVG charts, lists and shortcuts.
   Chart series are separated by fill/lightness + text labels, never hue alone,
   so they read under colour-vision deficiency. */

.dash { display: flex; flex-direction: column; gap: var(--sp-5); }

/* ---- shortcuts ---- */
.dash-shortcuts { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.dash-shortcut { display: inline-flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); font-weight: var(--fw-medium); color: var(--c-ink); transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.dash-shortcut:hover { background: var(--c-surface-2); border-color: var(--c-border-strong); text-decoration: none; }
.dash-shortcut__icon { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; color: var(--c-accent-ink); }
.dash-shortcut__icon svg { width: 1.15rem; height: 1.15rem; }

/* ---- KPI tiles ---- */
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.kpi { padding: var(--sp-5); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); }
.kpi__label { font-size: var(--fs-sm); color: var(--c-ink-soft); }
.kpi__num { display: block; margin-top: var(--sp-2); font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: var(--fs-xs); color: var(--c-ink-faint); }

/* ---- grids of cards ---- */
.dash-grid { display: grid; gap: var(--sp-5); }
.dash-grid--2 { grid-template-columns: 1.6fr 1fr; }
.dash-grid--3 { grid-template-columns: repeat(3, 1fr); }
.dash-card { padding: var(--sp-5); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); min-width: 0; }
.dash-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.dash-card__title { font-size: var(--fs-lg); }
.dash-card__note { font-size: var(--fs-xs); color: var(--c-ink-faint); text-transform: uppercase; letter-spacing: var(--tracking-label); font-weight: var(--fw-semibold); white-space: nowrap; }

/* ---- SVG chart ---- */
/* Fixed height + width:100% + preserveAspectRatio="none" on the SVG keeps the
   axis text at its real px size (vertical scale = 1) instead of blowing up as
   the card widens; the bars simply stretch to fill. */
.chart { display: block; width: 100%; }
.chart-axis { stroke: var(--c-border); stroke-width: 1; }
.chart-x { fill: var(--c-ink-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.bar-worked { fill: var(--c-border-strong); }
.bar-billed { fill: var(--c-accent); }
.chart-legend { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-3); font-size: var(--fs-sm); color: var(--c-ink-soft); }
.chart-legend__item { display: inline-flex; align-items: center; gap: var(--sp-2); }
.swatch { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 3px; }
.swatch--worked { background: var(--c-border-strong); }
.swatch--billed { background: var(--c-accent); }

/* ---- horizontal bars (billed by client, budget usage) ---- */
.hbars { display: flex; flex-direction: column; gap: var(--sp-4); }
.hbar__top { display: flex; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); font-size: var(--fs-sm); }
.hbar__name { font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar__val { flex: 0 0 auto; color: var(--c-ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar__track { height: 0.5rem; background: var(--c-surface-2); border-radius: var(--r-full); overflow: hidden; }
.hbar__fill { height: 100%; background: var(--c-accent-ink); }

/* ---- compact lists ---- */
.dash-list { display: flex; flex-direction: column; }
.dash-list__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--c-border); }
.dash-list__row:first-child { border-top: 0; }
.dash-list__main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dash-list__title { font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-list__sub { font-size: var(--fs-xs); color: var(--c-ink-soft); font-variant-numeric: tabular-nums; }
.dash-list__meta { flex: 0 0 auto; font-size: var(--fs-sm); color: var(--c-ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- recent entries table ---- */
.dash-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.dash-table th { padding: var(--sp-2) var(--sp-3); text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--c-ink-faint); border-bottom: 1px solid var(--c-border); }
.dash-table td { padding: var(--sp-3); border-bottom: 1px solid var(--c-border); }
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-table__ctx { color: var(--c-ink-soft); }

.dash-empty { padding: var(--sp-4) 0; color: var(--c-ink-faint); font-size: var(--fs-sm); }

@media (max-width: 960px) {
  .dash-grid--2, .dash-grid--3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
}
/* On narrow phones two large tabular numbers don't fit side by side — stack. */
@media (max-width: 460px) {
  .dash-kpis { grid-template-columns: 1fr; }
}

/* This-week work vs leisure balance (colour-blind safe: labelled rows) */
.dash-balance { display: flex; flex-direction: column; gap: var(--sp-3); }
.dash-balance__row { display: flex; flex-direction: column; gap: var(--sp-2); }
.dash-balance__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.dash-balance__k { font-size: var(--fs-sm); color: var(--c-ink-soft); font-weight: var(--fw-medium); }
.dash-balance__v { font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.dash-balance__of { color: var(--c-ink-soft); font-weight: var(--fw-medium); font-size: var(--fs-sm); }
.dash-balance__leisure { background: var(--c-ink-soft); }
.dash-balance__note { font-size: var(--fs-sm); color: var(--c-ink-soft); }
