/* Scrivania del coach, blocco «Peso» (js/desk-weight.js). In cima ultimo peso, cambio nel periodo, andamento a settimana
   e obiettivo; sotto il grafico (linea = media di 7 giorni con il velo sfumato, punti = pesate, fondo colorato = periodo
   scelto, barre = calorie con il tratteggio dell'obiettivo, icone o cerchietti = cardio) oppure l'elenco dei giorni.
   Colore del blocco: --bk (lo mette js/desk.js sul blocco). Solo i colori del tema (chiaro e scuro): sport con --c delle
   classi .s-<sport>. */
.dkw { --wc: var(--bk, var(--accent)); display: flex; flex: 1 1 auto; flex-direction: column; gap: 6px; height: 100%; min-height: 0; }
.dkw.is-empty { justify-content: center; }

/* riga in cima: un numero per casella, il nome piccolo sopra */
.dkw-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 20px; min-height: 22px; padding-top: 2px; }
.dkw-st { display: inline-flex; flex-direction: column; gap: 1px; min-width: 0; white-space: nowrap; }
.dkw-st small { font: 600 10px/1.2 var(--f-display); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.dkw-st b { font: 700 18px/1.1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.dkw-st.is-main b { font-size: 22px; }
.dkw-st em { font: 500 11.5px var(--f-body); font-style: normal; color: var(--muted); }
.dkw-st .dk-nil { line-height: 20px; }
.dkw-st b.dkw-aim { font: 600 13px/20px var(--f-body); color: var(--ink); }
.dkw.is-sm .dkw-top { column-gap: 14px; }
.dkw.is-sm .dkw-st b { font-size: 16px; }
.dkw.is-sm .dkw-st.is-main b { font-size: 19px; }
.dkw.is-sm .dkw-st b.dkw-aim { font-size: 12px; line-height: 18px; }
.dkw.is-lg { gap: 10px; }
.dkw.is-lg .dkw-top { column-gap: 28px; }
.dkw.is-lg .dkw-st small { font-size: 11px; }
.dkw.is-lg .dkw-st b { font-size: 23px; }
.dkw.is-lg .dkw-st.is-main b { font-size: 30px; }
.dkw.is-lg .dkw-st em { font-size: 13px; }
.dkw.is-lg .dkw-st b.dkw-aim { font-size: 15px; line-height: 26px; }
.dkw.is-lg .dkw-key { font-size: 12.5px; }
.dkw-key { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding-bottom: 2px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.dkw-k-dot { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--wc) 55%, var(--surface)); }
.dkw-k-line { width: 14px; height: 3px; margin-left: 8px; border-radius: 2px; background: var(--wc); }
.dkw-k-band { width: 12px; height: 10px; margin-left: 8px; border-radius: 3px; background: color-mix(in srgb, var(--wc) 14%, var(--surface)); box-shadow: inset 0 2px 0 color-mix(in srgb, var(--wc) 60%, var(--surface)); }

/* grafico: l'SVG riempie lo spazio rimasto (la sua misura la sceglie il blocco, non il contenuto) */
.dkw-plot { position: relative; flex: 1 1 auto; min-height: 100px; }
.dkw-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.dkw-band { fill: color-mix(in srgb, var(--wc) 7%, var(--surface)); }
.dkw-bandt { fill: color-mix(in srgb, var(--wc) 55%, var(--surface)); }
.dkw-grid { stroke: var(--line); stroke-width: 1; }
.dkw-vg { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.dkw-now { stroke: color-mix(in srgb, var(--accent) 55%, transparent); stroke-width: 1; stroke-dasharray: 3 3; }
.dkw-yl, .dkw-xl, .dkw-ll { font: 500 9.5px var(--f-body); font-variant-numeric: tabular-nums; fill: var(--muted); }
.dkw-yl, .dkw-ll { text-anchor: end; }
.dkw-ll { font-size: 8.5px; letter-spacing: .02em; }
.dkw-xl { text-anchor: middle; fill: color-mix(in srgb, var(--muted) 75%, var(--surface)); }
.dkw-xl.is-mark { font-weight: 600; fill: var(--muted); }
.dkw-xl.is-today { font-weight: 800; fill: var(--accent); }
.dkw-none { font: 600 10px var(--f-body); text-anchor: middle; fill: var(--muted); }
/* i testi dentro il grafico hanno un alone del colore del fondo: una riga dell'asse o il tratteggio che passa dietro
   si interrompe e non tocca mai le lettere */
.dkw-dl, .dkw-kl, .dkw-none { paint-order: stroke fill; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.dkw-dl.on-band, .dkw-kl.on-band { stroke: color-mix(in srgb, var(--wc) 7%, var(--surface)); }
/* la media di 7 giorni: linea piena del colore del blocco, sotto un velo che sfuma verso il basso */
.dkw-gs0 { stop-color: var(--wc); stop-opacity: .26; }
.dkw-gs1 { stop-color: var(--wc); stop-opacity: 0; }
.dkw-avg { fill: none; stroke: var(--wc); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.dkw-svg.is-lg .dkw-avg { stroke-width: 3; }
.dkw-svg.is-lg .dkw-yl, .dkw-svg.is-lg .dkw-xl { font-size: 10.5px; }
.dkw-dot { fill: color-mix(in srgb, var(--wc) 62%, var(--surface)); stroke: var(--surface); stroke-width: 1.2; }
/* tanti giorni (3 e 6 mesi): punti piccoli senza bordo, sennò il bordo li mangia */
.dkw-svg.is-dense .dkw-dot:not(.is-last) { stroke: none; fill: color-mix(in srgb, var(--wc) 55%, var(--surface)); }
.dkw-dot.is-new, .dkw-svg.is-dense .dkw-dot.is-new { fill: var(--accent); }
.dkw-dot.is-last { fill: var(--wc); stroke-width: 2; }
.dkw-dot.is-last.is-new { fill: var(--accent); }
.dkw-halo { fill: color-mix(in srgb, var(--wc) 20%, transparent); }
/* il numero dell'ultima pesata, in un'etichetta del colore della linea (il filo la lega al punto quando è lontana) */
.dkw-pill rect { fill: var(--wc); }
.dkw-lead { stroke: color-mix(in srgb, var(--wc) 70%, transparent); stroke-width: 1; }
.dkw-pill text { font: 700 10.5px var(--f-body); font-variant-numeric: tabular-nums; text-anchor: middle; fill: var(--surface); }
/* la pesata più alta e la più bassa */
.dkw-dl { font: 600 9.5px var(--f-body); font-variant-numeric: tabular-nums; text-anchor: middle; fill: var(--muted); }
/* calorie: barre più spente del grafico del peso, il tratteggio è l'obiettivo */
.dkw-base { stroke: var(--line); stroke-width: 1; }
.dkw-k { fill: color-mix(in srgb, var(--muted) 40%, var(--surface)); }
.dkw-k.is-ok { fill: color-mix(in srgb, var(--ok) 65%, var(--surface)); }
.dkw-k.is-mid { fill: color-mix(in srgb, var(--partial) 70%, var(--surface)); }
.dkw-k.is-bad { fill: color-mix(in srgb, var(--missed) 65%, var(--surface)); }
.dkw-kl { font: 600 8.5px var(--f-body); font-variant-numeric: tabular-nums; text-anchor: middle; fill: var(--muted); }
.dkw-goal { fill: none; stroke: var(--ink); stroke-opacity: .55; stroke-width: 1.2; stroke-dasharray: 2 1.5; }
.dkw-ca { fill: var(--c, var(--other)); }
.dkw-cai { color: var(--c, var(--other)); }
.dkw-cab { fill: color-mix(in srgb, var(--c, var(--other)) 18%, var(--surface)); }
/* un giorno sotto il mouse (o col fumetto aperto da un clic): riga verticale e punti accesi */
.dkw-day { cursor: pointer; outline: none; }
.dkw-hit { fill: transparent; }
.dkw-day:hover .dkw-hit, .dkw-day[aria-describedby] .dkw-hit { fill: color-mix(in srgb, var(--ink) 4%, transparent); }
.dkw-xh, .dkw-xha, .dkw-xhw { opacity: 0; pointer-events: none; transition: opacity .1s; }
.dkw-xh { stroke: color-mix(in srgb, var(--ink) 45%, transparent); stroke-width: 1; stroke-dasharray: 2 2; }
.dkw-xha { fill: var(--wc); stroke: var(--surface); stroke-width: 1.5; }
.dkw-xhw { fill: none; stroke: var(--wc); stroke-width: 1.5; }
.dkw-day:hover .dkw-xh, .dkw-day:hover .dkw-xha, .dkw-day:hover .dkw-xhw,
.dkw-day[aria-describedby] .dkw-xh, .dkw-day[aria-describedby] .dkw-xha, .dkw-day[aria-describedby] .dkw-xhw { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .dkw-xh, .dkw-xha, .dkw-xhw { transition: none; } }

/* elenco: un giorno per riga, intestazione ferma in alto */
.dkw-list { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; }
.dkw-tb { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dkw-tb th, .dkw-tb td { padding: 4px 6px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
.dkw-tb thead th { position: sticky; top: 0; z-index: 1; border-top: 0; background: var(--surface); font: 600 10px/1.4 var(--f-display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dkw-tb tbody th { font-weight: 600; }
.dkw-tb tbody tr:hover { background: var(--surface-2); }
.dkw-tb tbody tr[aria-current="date"] th { color: var(--accent); }
.dkw-tb .dkw-n { text-align: right; font-variant-numeric: tabular-nums; }
.dkw-tb .dkw-kg { font-weight: 700; }
.dkw-tb .dkw-n small { margin-left: 1px; font-size: 10.5px; color: var(--muted); }
.dkw-tb .dkw-cn { width: 100%; white-space: normal; }
.dkw-kd { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 55%, var(--surface)); vertical-align: 1px; }
.dkw-kd.is-ok { background: var(--ok); }
.dkw-kd.is-mid { background: var(--partial); }
.dkw-kd.is-bad { background: var(--missed); }
.dkw-new { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.dkw-cb {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; margin: 1px 6px 1px 0; padding: 1px 7px 1px 3px;
  border: 0; border-radius: 999px; background: color-mix(in srgb, var(--c, var(--other)) 13%, var(--surface));
  font: 500 11.5px/1.5 var(--f-body); color: var(--ink); vertical-align: middle; cursor: pointer;
}
.dkw-cb:hover { background: color-mix(in srgb, var(--c, var(--other)) 24%, var(--surface)); }
.dkw-cb:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dkw-cb i { display: inline-flex; flex: none; width: 14px; height: 14px; color: var(--c, var(--other)); }
.dkw-cb i svg { width: 100%; height: 100%; }
.dkw-cb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
