/* rounding-v2: editor degli arrotondamenti della Configurazione timbrature (parametri semplici, righello dei 60 minuti,
   anteprima, fasce) e flusso "Ricalcola timbrature".
   Solo token del sito e solo sotto body.nh-v2; il font e' quello del sito (ereditato, nessuna font-family qui).
   Il blocco Utenti (chip "Accessi gestiti dal Partner", disattivazione) sta in users-v2.css. */

/* Dettaglio del profilo a tutta larghezza (Entrata e Uscita affiancate): stessa scheda delle altre pagine di dettaglio,
   solo senza il limite del 50%. */
.work-surface--half.work-surface--wide { max-width: 100%; }

/* Colori derivati dai token del sito: ambra scuro dell'avviso (stesso valore di .status-pill.warning, >= 4,5:1 sul fondo
   crema; --warning del sito e' un ambra chiaro per i riempimenti) e secondo tono per l'Uscita (--teal del sito). */
body.nh-v2 :is(.rnd, .rnd-dlg, .rnd-empty, .rnd-profile) {
  --rnd-warn-ink: #b45309;
  --rnd-u-ink: var(--teal);
  --rnd-u-bg: color-mix(in srgb, var(--teal) 12%, var(--surface));
  --rnd-danger-ink: color-mix(in srgb, var(--danger) 82%, #000);
}

body.nh-v2 .rnd { display: grid; gap: 14px; container-type: inline-size; container-name: rnd; }
body.nh-v2 :is(.rnd, .rnd-dlg, .rnd-empty) :focus-visible { outline: 3px solid rgba(var(--primary-rgb), .35); outline-offset: 1px; }
/* Elementi che prendono il fuoco da programma (cambio di passo): nessun anello, non sono controlli. */
body.nh-v2 .rnd-dlg [tabindex="-1"]:focus { outline: 0; }

/* ---------- controllo segmentato ---------- */
body.nh-v2 .rnd-seg { display: flex; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
body.nh-v2 .rnd-seg button { flex: 1; min-width: 0; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; font-size: 13px; padding: 6px 4px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
body.nh-v2 .rnd-seg button:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--surface-soft); color: var(--text); }
body.nh-v2 .rnd-seg button[aria-pressed="true"] { background: var(--primary); color: var(--surface); }
body.nh-v2 .rnd-seg button:disabled { cursor: default; opacity: .45; }
body.nh-v2 .rnd-seg button[aria-pressed="true"]:disabled { opacity: 1; background: var(--primary-soft); color: var(--primary-ink); }

/* ---------- parametri: colonne Entrata / Uscita ---------- */
body.nh-v2 .rnd-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
body.nh-v2 .rnd-two > * { min-width: 0; }
body.nh-v2 .rnd-side { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; align-content: start; background: var(--surface); container-type: inline-size; container-name: rndside; }
body.nh-v2 .rnd-side h3 { margin: 0; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
body.nh-v2 .rnd-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
body.nh-v2 .rnd-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
body.nh-v2 .rnd-lb { font-size: 13px; font-weight: 600; }
body.nh-v2 .rnd-tol .field label { white-space: nowrap; }
/* Stessa etichetta di Passo e Direzione (.rnd-lb): niente maiuscolo. */
body.nh-v2 .rnd-tol .field > span:first-child { font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; color: inherit; }
body.nh-v2 .rnd-tol :is(.form-control, .dxbl-text-edit) { width: 96px; max-width: 100%; }
body.nh-v2 .rnd-err { font-size: 13px; color: var(--danger); font-weight: 600; }
/* Errore della tolleranza fuori flusso, nello spazio sotto il campo: se compare in una sola colonna i righelli di Entrata e Uscita restano allineati. */
body.nh-v2 .rnd-pair { margin-bottom: 8px; }
body.nh-v2 .rnd-tol { position: relative; }
body.nh-v2 .rnd-tol > .rnd-err { position: absolute; left: 0; top: 100%; margin-top: 2px; white-space: nowrap; line-height: 17px; }
/* Campo in errore: bordo rosso oltre al messaggio (il colore non e' l'unico segnale, c'e' anche il testo collegato al campo). */
body.nh-v2 :is(.rnd, .rnd-dlg) :is(.dxbl-text-edit, .form-control):has(> input[aria-invalid="true"], input[aria-invalid="true"]) { border-color: var(--danger) !important; }

/* Pannelli stretti (schermi bassi, barra laterale aperta): le colonne si impilano invece di tagliare i controlli. */
@container rnd (max-width: 700px) {
  body.nh-v2 .rnd-two { grid-template-columns: 1fr; }
}
@container rndside (max-width: 400px) {
  body.nh-v2 .rnd-pair { grid-template-columns: 1fr; }
}

/* ---------- righello dell'ora: dove atterrano i 60 minuti ---------- */
body.nh-v2 .rnd-ruler { display: flex; height: 34px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-strong); background: var(--surface); }
body.nh-v2 .rnd-ruler > div { display: grid; place-items: center; font-weight: 700; font-size: 13px; border-right: 1px solid var(--surface); white-space: nowrap; min-width: 0; overflow: hidden; }
body.nh-v2 .rnd-ruler > div:last-child { border-right: 0; }
body.nh-v2 .rnd-ruler .t0 { background: var(--primary-tint-9); color: var(--primary-ink); }
body.nh-v2 .rnd-ruler .t1 { background: var(--primary); color: var(--surface); }
body.nh-v2 .rnd-ruler .t2 { background: var(--primary-tint-13); color: var(--text); }
body.nh-v2 .rnd-ruler .gap { background: repeating-linear-gradient(135deg, var(--danger-soft) 0 6px, color-mix(in srgb, var(--danger) 22%, var(--surface)) 6px 12px); color: var(--rnd-danger-ink, var(--danger)); }
body.nh-v2 .rnd-ruler .off { background: var(--bg-soft); color: var(--muted); }
body.nh-v2 .rnd-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-top: 3px; }

/* ---------- anteprima "09:07 -> 09:30" ---------- */
body.nh-v2 .rnd-prev { display: grid; }
body.nh-v2 .rnd-prev .r { display: grid; grid-template-columns: 1fr 24px 1fr; align-items: center; min-height: 30px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
body.nh-v2 .rnd-prev .r:last-child { border-bottom: 0; }
body.nh-v2 .rnd-prev .r > span:first-child { color: var(--muted); text-align: right; }
body.nh-v2 .rnd-prev .r > i { font-style: normal; color: var(--muted); text-align: center; }
body.nh-v2 .rnd-prev .r > b { font-weight: 800; }
body.nh-v2 .rnd-prev .r.try { padding: 4px 0; }
body.nh-v2 .rnd-prev .r.try .field { margin-left: auto; width: 110px; }

/* ---------- fasce personalizzate / profilo senza fasce ---------- */
body.nh-v2 .rnd-cust { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 22px; display: grid; gap: 14px; justify-items: start; }
body.nh-v2 .rnd-cust h3 { margin: 0; font-size: 16px; font-weight: 800; }
body.nh-v2 .rnd-cust .rnd-two { width: 100%; }
body.nh-v2 .rnd-acts { display: flex; gap: 8px; }
/* Riga fantasma = BlazorActionButton (DxButton): fondo, bordo e colore con !important come le altre righe fantasma del sito. */
body.nh-v2 .btn.rnd-ghost { display: flex !important; align-items: center; justify-content: center; width: 100%; height: 60px; border: 2px dashed var(--border-strong) !important; border-radius: 12px; background: transparent !important; color: var(--muted) !important; font-weight: 700; box-shadow: none; }
body.nh-v2 .btn.rnd-ghost:hover:not(:disabled) { border-color: var(--primary) !important; color: var(--primary) !important; }
body.nh-v2 .btn.rnd-ghost:disabled { cursor: default; opacity: .55; }
body.nh-v2 .rnd-cov-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* ---------- chip di stato (Entrata / Uscita): blu per l'Entrata, teal del sito per l'Uscita ---------- */
body.nh-v2 .rnd-eu { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 99px; font-size: 13px; font-weight: 800; background: var(--primary-soft); color: var(--primary-strong); }
body.nh-v2 .rnd-eu.is-u { background: var(--rnd-u-bg, var(--bg-soft)); color: var(--rnd-u-ink, var(--teal)); }
body.nh-v2 .status-pill.info.rnd-tone-u { background: color-mix(in srgb, var(--teal) 12%, var(--surface)); color: var(--teal); border-color: color-mix(in srgb, var(--teal) 25%, transparent); }

/* ---------- ricalcolo ---------- */
body.nh-v2 .rnd-dlg { display: grid; gap: 14px; }
body.nh-v2 .rnd-wait { display: grid; gap: 14px; }
body.nh-v2 .rnd-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
body.nh-v2 .rnd-chips { display: flex; gap: 8px; flex-wrap: wrap; }
body.nh-v2 .btn.rnd-chip { height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 99px; background: var(--surface); font-weight: 600; }
body.nh-v2 .btn.rnd-chip:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--surface); }
body.nh-v2 .rnd-range { display: flex; align-items: center; gap: 10px; font-weight: 700; }
body.nh-v2 .rnd-stats { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
body.nh-v2 .rnd-stats > div { padding: 10px 14px; border-right: 1px solid var(--border); min-width: 0; }
body.nh-v2 .rnd-stats > div:last-child { border-right: 0; }
body.nh-v2 .rnd-stats b { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
body.nh-v2 .rnd-stats span { color: var(--muted); font-size: 13px; font-weight: 600; }
body.nh-v2 .rnd-stats .hot { background: var(--primary-soft); }
body.nh-v2 .rnd-stats .hot b { color: var(--primary-strong); }
body.nh-v2 .rnd-who { display: flex; gap: 18px; font-weight: 600; }
body.nh-v2 .rnd-who b { font-variant-numeric: tabular-nums; }
body.nh-v2 .rnd-ex { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
body.nh-v2 .rnd-ex th { background: var(--surface-soft); color: var(--muted); font-weight: 600; font-size: 13px; text-align: left; padding: 0 12px; height: 38px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
body.nh-v2 .rnd-ex td { padding: 0 12px; height: 38px; border-bottom: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
body.nh-v2 .rnd-ex .c { text-align: center; }
body.nh-v2 .rnd-ex td.to { font-weight: 800; }
body.nh-v2 .rnd-alert { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); font-weight: 600; }
body.nh-v2 .rnd-alert.warn { background: var(--warning-soft); color: var(--rnd-warn-ink, #b45309); border: 1px solid color-mix(in srgb, var(--rnd-warn-ink, #b45309) 30%, transparent); }
body.nh-v2 .rnd-alert.bad { background: var(--danger-soft); color: var(--rnd-danger-ink, var(--danger)); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
body.nh-v2 .rnd-alert .btn, body.nh-v2 .rnd-alert button { margin-left: auto; }
body.nh-v2 .rnd-done { display: grid; justify-items: center; gap: 6px; padding: 26px 0 8px; text-align: center; }
body.nh-v2 .rnd-done .ring { width: 56px; height: 56px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: grid; place-items: center; font-size: 28px; font-weight: 800; }
body.nh-v2 .rnd-done b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
body.nh-v2 .rnd-sk { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-soft), var(--border), var(--bg-soft)); background-size: 200% 100%; animation: rnd-sh 1s infinite linear; }
body.nh-v2 .rnd-sk.tall { height: 64px; }
@keyframes rnd-sh { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  body.nh-v2 .rnd-sk { animation: none; }
}

/* ---------- profilo: riga dei dati e stato vuoto dell'elenco ---------- */
body.nh-v2 .rnd-profile { display: grid; gap: 14px; }
body.nh-v2 .rnd-ident { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto auto; gap: 14px; align-items: end; }
body.nh-v2 .rnd-ident .switch-line { height: var(--ctl, 36px); align-items: center; }
body.nh-v2 .rnd-empty { padding: 14px; }
/* "Modifiche non salvate" a sinistra del dock, come nel prototipo (il gruppo dei pulsanti e' allineato a destra). */
body.nh-v2 .rnd-profile .modal-form-main-actions { width: 100%; }
body.nh-v2 .rnd-dirty { order: -1; color: var(--rnd-warn-ink, #b45309); font-weight: 600; margin-right: auto; }
