/* Timbrature aggregate, vista a settimana (solo test, predefinita; "?vista=striscia" e "?vista=classica" non usano questi stili).
   Componenti: AggregatedMonthRail (colonna del mese) + TimeStampsWeekGrid (la griglia delle Timbrature, stili in timbrature-week-v2.css).
   Ogni regola sta sotto body.nh-v2. Solo token del sito (il tema cambia per azienda): toni di ambra e rosso mescolati con
   color-mix dai token, nessun colore fisso. La fascia controlli, la tabella e lo stato di caricamento restano quelli di aggregate-v2.css.
   Per tornare indietro: togliere il <link> e la proprieta' AggregateWeekV2CssHref in App.razor, oppure aprire con "?vista=striscia". */

body.nh-v2 .agg-wk .agg-wkbody {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  border-bottom: 1px solid var(--border);
}

body.nh-v2 .agg-wk .agg-wkgrid {
  min-width: 0;
}

/* La griglia porta gia' la sua riga di base: qui la chiude il contenitore. */
body.nh-v2 .agg-wk .agg-wkgrid .nwk {
  border-bottom: 0;
}

/* ---------- colonna del mese ---------- */
body.nh-v2 .agg-wk .agg-rail {
  --agg-w-ink2: color-mix(in srgb, var(--muted) 62%, var(--text));
  --agg-w-amber-ink: color-mix(in srgb, var(--warning) 38%, var(--text));
  --agg-w-danger-ink: color-mix(in srgb, var(--danger) 72%, var(--text));
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 14px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface-soft);
  font-variant-numeric: tabular-nums;
}

body.nh-v2 .agg-wk .agg-rh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

body.nh-v2 .agg-wk .agg-rh h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-align: center;
}

body.nh-v2 .agg-wk .agg-step {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--agg-w-ink2);
  cursor: pointer;
}

body.nh-v2 .agg-wk .agg-step svg {
  width: 18px;
  height: 18px;
}

body.nh-v2 .agg-wk .agg-step:hover {
  border-color: var(--muted);
  background: var(--surface-soft);
}

body.nh-v2 .agg-wk .agg-step:focus-visible,
body.nh-v2 .agg-wk .agg-wr:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Risultato del mese: il numero grande della colonna. */
body.nh-v2 .agg-wk .agg-tot {
  display: grid;
  gap: 2px;
}

body.nh-v2 .agg-wk .agg-tbig {
  margin: 0;
  color: var(--text);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  white-space: nowrap;
}

body.nh-v2 .agg-wk .agg-tbig small {
  margin-left: 1px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

body.nh-v2 .agg-wk .agg-tbig.is-zero {
  color: var(--muted);
}

body.nh-v2 .agg-wk .agg-tlab {
  color: var(--agg-w-ink2);
  font-size: 12px;
  font-weight: 600;
}

body.nh-v2 .agg-wk .agg-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

body.nh-v2 .agg-wk .agg-pair > div {
  display: flex;
  flex-direction: column-reverse;
  gap: 1px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

body.nh-v2 .agg-wk .agg-pair dd {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

body.nh-v2 .agg-wk .agg-pair dt {
  color: var(--agg-w-ink2);
  font-size: 11px;
  font-weight: 600;
}

body.nh-v2 .agg-wk .agg-pair .agg-ot dd {
  color: var(--agg-w-amber-ink);
}

/* Una riga per settimana: la scelta si riconosce dallo sfondo, mai da un bordo laterale. */
body.nh-v2 .agg-wk .agg-wl {
  display: grid;
  gap: 4px;
}

body.nh-v2 .agg-wk .agg-wr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .12s, border-color .12s;
}

body.nh-v2 .agg-wk .agg-wr:hover {
  border-color: var(--border);
  background: var(--surface);
}

body.nh-v2 .agg-wk .agg-wr[aria-current="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-ink);
}

/* Settimana futura: testo attenuato ma sempre leggibile (>= 4.5:1), niente opacita' sulla riga. */
body.nh-v2 .agg-wk .agg-wr.is-fut:not([aria-current="true"]),
body.nh-v2 .agg-wk .agg-wr.is-fut:not([aria-current="true"]) .agg-wb {
  color: color-mix(in srgb, var(--text) 20%, var(--muted));
}

body.nh-v2 .agg-wk .agg-wa {
  font-size: 14px;
  font-weight: 700;
}

body.nh-v2 .agg-wk .agg-wt {
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

body.nh-v2 .agg-wk .agg-wb {
  grid-column: 1;
  color: var(--agg-w-ink2);
  font-size: 12px;
  white-space: nowrap;
}

body.nh-v2 .agg-wk .agg-wr[aria-current="true"] .agg-wb {
  color: var(--primary-ink);
}

/* Giorni da completare: icona e testo oltre al colore. */
body.nh-v2 .agg-wk .agg-wf {
  display: inline-flex;
  grid-column: 1 / -1;
  grid-row: 3;
  align-items: center;
  justify-self: start;
  margin-top: 3px;
  gap: 4px;
  padding: 0 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 16%, var(--surface));
  color: var(--agg-w-danger-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

body.nh-v2 .agg-wk .agg-wf .nh-dg-ic {
  width: 12px;
  height: 12px;
  flex: none;
}

/* ---------- caricamento: stessa forma della colonna ---------- */
body.nh-v2 .agg-wk .agg-rsk {
  display: block;
  border-radius: 6px;
  background: var(--bg-soft);
  animation: agg-w-pulse 1.4s ease-in-out infinite;
}

body.nh-v2 .agg-wk .agg-rsk-big { width: 150px; height: 34px; margin-bottom: 6px; }
body.nh-v2 .agg-wk .agg-rsk-lab { width: 84px; height: 14px; }
body.nh-v2 .agg-wk .agg-rsk-box { height: 52px; border-radius: var(--radius); }
body.nh-v2 .agg-wk .agg-rsk-week { height: 52px; border-radius: var(--radius); }

@keyframes agg-w-pulse { 50% { opacity: .45; } }

/* Portatile: la colonna si stringe per lasciare spazio alla settimana. */
@media (max-width: 1440px) {
  body.nh-v2 .agg-wk .agg-wkbody {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  body.nh-v2 .agg-wk .agg-rail {
    gap: 12px;
    padding: 12px 10px;
  }

  body.nh-v2 .agg-wk .agg-tbig {
    font-size: 30px;
  }

  body.nh-v2 .agg-wk .agg-rh h3 {
    font-size: 16px;
  }

  body.nh-v2 .agg-wk .agg-pair dd {
    font-size: 15px;
  }
}

@media (max-height: 820px) {
  body.nh-v2 .agg-wk .agg-rail {
    gap: 10px;
  }

  body.nh-v2 .agg-wk .agg-wr {
    padding-block: 6px;
  }
}

@media (forced-colors: active) {
  body.nh-v2 .agg-wk .agg-wr[aria-current="true"],
  body.nh-v2 .agg-wk .agg-wr:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.nh-v2 .agg-wk .agg-rsk { animation: none; }
  body.nh-v2 .agg-wk .agg-wr { transition: none; }
}
