/* Cache (backoffice Partner, tutti gli ambienti). Solo classi nh-cache-*, nessuno stile globale. */
.nh-cache {
  --nhc-muted: var(--muted, #64748b);
  --nhc-ok-ink: #047857;
  --nhc-warn-ink: #b45309;
  --nhc-danger-ink: #b91c1c;
  position: relative;
}

.nh-cache-tabs { margin-bottom: 12px; }
.nh-cache-tabs .nh-cache-tab-count {
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.nh-cache-intro { max-width: 720px; margin: 0 0 14px; font-size: 13px; line-height: 1.4; color: var(--nhc-muted); }

.nh-cache-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.nh-cache-field { display: grid; gap: 4px; margin: 0; font-size: 12.5px; font-weight: 700; color: var(--nhc-muted); }
.nh-cache-field--company { width: 260px; }
.nh-cache-field--search { width: 280px; }
.nh-cache-actions { display: flex; gap: 8px; margin-left: auto; }
.nh-cache-ico { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.nh-cache svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.nh-cache-banner {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; padding: 10px 14px;
  border: 1px solid #a7f3d0; border-radius: 10px;
  background: var(--success-soft); color: var(--nhc-ok-ink);
  font-size: 13.5px; font-weight: 600;
}
.nh-cache-banner svg { flex: none; width: 18px; height: 18px; }
.nh-cache-banner--error { border-color: #fecaca; background: var(--danger-soft); color: var(--nhc-danger-ink); }

.nh-cache-instance { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 12.5px; color: var(--nhc-muted); }
.nh-cache-instance svg { flex: none; width: 16px; height: 16px; }
.nh-cache-instance b { color: var(--text); }
.nh-cache-stamp { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }

.nh-cache-stage { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.nh-cache-scroller { height: clamp(300px, calc(100vh - 430px), 900px); overflow: auto; }
.nh-cache-scroller.is-short { height: clamp(260px, calc(100vh - 520px), 900px); }

/* Fascia delle categorie della scheda: filtro (nome) e svuotamento (pulsante). */
.nh-cache-cats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.nh-cache-cat {
  display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px;
  min-width: 210px; padding: 8px 8px 8px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: left;
}
.nh-cache-cat .nm { font-weight: 700; font-size: 14px; color: var(--text); }
.nh-cache-cat .ds { grid-column: 1; font-size: 12.5px; color: var(--nhc-muted); font-variant-numeric: tabular-nums; }
.nh-cache-cat > :last-child:not(.ds):not(.pick-b) { grid-column: 2; grid-row: 1 / span 2; }
.nh-cache-cat.on { border-color: var(--primary); background: var(--primary-soft); }
.nh-cache-cat.on .ds { color: var(--primary-ink, var(--primary)); }
.nh-cache-cat.zero .nm { color: #64748b; }
.nh-cache-cat button.pick-b { grid-column: 1; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.nh-cache-cat button.pick-b:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }

.nh-cache-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.nh-cache-table th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 12px; text-align: left; white-space: nowrap;
  font-size: 12.5px; font-weight: 700; color: var(--nhc-muted);
  background: var(--surface-soft); border-bottom: 1px solid var(--border);
}
.nh-cache-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; background: var(--surface); transition: opacity .45s ease, background-color .15s ease; }
.nh-cache-table tbody tr:hover td { background: var(--primary-tint-1); }
.nh-cache-table tbody tr.is-selected td { background: var(--primary-soft); }
.nh-cache-table tbody tr.is-leaving td { opacity: 0; }
.nh-cache-chk { width: 44px; }
.nh-cache-act { width: 1%; white-space: nowrap; text-align: right; }
.nh-cache-act .btn-link { font-weight: 700; text-decoration: none; color: var(--primary-strong, var(--primary)); }
.nh-cache-act .btn-link:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary-ink); }

.nh-cache-dato { display: grid; gap: 2px; min-width: 0; }
.nh-cache-dato b { font-weight: 700; color: var(--text); }
.nh-cache-dato b span { font-weight: 500; color: var(--nhc-muted); }
.nh-cache-dato code { font-size: 11.5px; color: var(--nhc-muted); background: none; padding: 0; word-break: break-all; }
.nh-cache-dim { color: var(--nhc-muted); }
.nh-cache-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Conto alla rovescia: numero e barra senza binario di sfondo. */
.nh-cache-ttl { display: grid; gap: 4px; width: 92px; }
.nh-cache-ttl-t { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.nh-cache-ttl-bar { display: block; width: 100%; height: 3px; border-radius: 2px; background: var(--primary); transform-origin: left center; transition: transform 1s linear; }
.nh-cache-ttl.is-warn .nh-cache-ttl-t { color: var(--nhc-warn-ink); }
.nh-cache-ttl.is-warn .nh-cache-ttl-bar { background: var(--warning); }

.nh-cache-auto { display: grid; gap: 2px; }
.nh-cache-auto b { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--nhc-ok-ink); white-space: nowrap; }
.nh-cache-auto b svg { width: 14px; height: 14px; }
.nh-cache-auto span { font-size: 12.5px; color: var(--nhc-muted); font-variant-numeric: tabular-nums; }

/* Vassoio della selezione. */
.nh-cache-tray {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-top: 12px; padding: 10px 14px;
  border: 1px solid var(--primary-tint-10); border-radius: 12px;
  background: var(--primary-soft);
}
.nh-cache-tray-count { margin-right: auto; font-weight: 700; color: var(--primary-ink); }
.nh-cache-tray-count em { margin-right: 6px; font-style: normal; font-variant-numeric: tabular-nums; }

/* Scheletro di caricamento. */
.nh-cache-sk { display: grid; }
.nh-cache-sk-row { display: grid; grid-template-columns: 44px 2.2fr 1.3fr 1.2fr .8fr .8fr 1fr 70px; gap: 14px; align-items: center; padding: 14px 12px; border-bottom: 1px solid var(--border); }
.nh-cache-sk-row--head { background: var(--surface-soft); padding: 12px; }
.nh-cache-sk-row i { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-soft) 0%, var(--border) 50%, var(--surface-soft) 100%); background-size: 200% 100%; animation: nh-cache-shimmer 1.3s linear infinite; }
.nh-cache-sk-row i.box { width: 16px; height: 16px; border-radius: 4px; }
.nh-cache-sk-row i.two { height: 26px; }
@keyframes nh-cache-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Stati vuoto, filtro ed errore. */
.nh-cache-state { display: grid; justify-items: center; align-content: center; gap: 8px; min-height: 100%; padding: 32px 16px; text-align: center; }
.nh-cache-state h3 { margin: 6px 0 0; font-size: 17px; font-weight: 800; color: var(--text); }
.nh-cache-state p { max-width: 460px; margin: 0 0 8px; font-size: 13.5px; line-height: 1.45; color: var(--nhc-muted); }
.nh-cache-halo { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 10px var(--primary-tint-1); }
.nh-cache-halo svg { width: 40px; height: 40px; stroke-width: 1.6; }
.nh-cache-ghost { display: grid; gap: 6px; width: 220px; margin: 10px 0 2px; }
.nh-cache-ghost span { display: block; height: 12px; border: 1.5px dashed var(--border-strong); border-radius: 6px; }
.nh-cache-ghost span:nth-child(2) { width: 80%; }
.nh-cache-ghost span:nth-child(3) { width: 60%; }
.nh-cache-err-ico { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--danger-soft); color: var(--nhc-danger-ink); }
.nh-cache-err-ico svg { width: 32px; height: 32px; }

/* Conferma "Svuota tutto": riepilogo per scheda. */
.nh-cache-dialog .nh-cache-sum { display: grid; margin: 0 0 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.nh-cache-dialog .nh-cache-sum > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.nh-cache-dialog .nh-cache-sum > div:last-child { border-bottom: 0; background: var(--surface-soft); font-weight: 800; }
.nh-cache-dialog .nh-cache-sum b { font-variant-numeric: tabular-nums; }
.nh-cache-dialog .nh-cache-sum b.is-zero { font-weight: 500; color: var(--muted, #64748b); }

@media (prefers-reduced-motion: reduce) {
  .nh-cache-sk-row i { animation: none; }
  .nh-cache-table td, .nh-cache-ttl-bar { transition: none; }
}
