/* ═══════════════════════════════════════════════════════════════════════════
 * NH Report Design System — v1.1 (2026-07-31, HRD-P4 fix)
 * Estratto da dashboard-kpi-talent-acquisition.html (reference editoriale).
 * SoT unica per palette, tipografia, gauge, tabelle, controlli. NH#4 · NH#5.
 *
 * ⚠ SCOPE: tutte le regole sotto .nh-report (root wrapper obbligatorio nello
 *   shell renderato dal motore). Evita leak quando la CSS viene iniettata in
 *   pagine host (modal preview) che hanno il proprio design system.
 * ═══════════════════════════════════════════════════════════════════════════ */

.nh-report {
  --paper:      #E6EDEF;
  --surface:    #FFFFFF;
  --ink:        #0F2129;
  --muted:      #5C7480;
  --line:       #C6D5DA;
  --line-soft:  #E0E9EC;
  --petrol:     #0B4F5A;
  --petrol-soft:#12707F;
  --moss:       #2E7D5B;
  --ochre:      #B8801A;
  --rose:       #A32F4C;
  --track:      #DCE6E9;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body:    "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono:    "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --r: 3px;
  --shadow: 0 1px 0 rgba(15,33,41,.04), 0 6px 18px -12px rgba(15,33,41,.35);

  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.nh-report, .nh-report * { box-sizing: border-box; }

.nh-report h1, .nh-report h2, .nh-report h3 { font-family: var(--display); margin: 0; letter-spacing: -.015em; }

/* ---------- barra superiore ---------- */
/* HRD-P4-fix2 (2026-07-31): default relative (no sticky) → safe dentro modal
 * con flex/overflow ancestor. E.1 (2026-07-31): .nh-report.standalone riattiva
 * sticky quando il runtime rileva che non c'è ancestor scrollabile (tab intero). */
.nh-report .topbar {
  position: relative; z-index: 30;
  background: var(--petrol);
  color: #EAF3F4;
  border-bottom: 3px solid var(--ink);
}
.nh-report.standalone .topbar   { position: sticky; top: 0; }
.nh-report.standalone .controls { position: sticky; top: var(--topbar-h, 78px); }
.nh-report.standalone nav.aree  { position: sticky; top: calc(var(--topbar-h, 78px) + 54px); }
.nh-report .topbar-inner {
  max-width: 1560px; margin: 0 auto;
  padding: 14px 22px;
  display: flex; flex-wrap: wrap; gap: 18px 26px; align-items: flex-end;
}
.nh-report .brand h1 { font-size: 19px; font-weight: 700; color: #fff; }
.nh-report .brand .eyebrow {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: #8FBCC3; margin-bottom: 3px;
}
.nh-report .brand .periodo { font-family: var(--mono); font-size: 11.5px; color: #A9CBD0; margin-top: 3px; }

.nh-report .totali { display: flex; gap: 20px; margin-left: auto; }
.nh-report .totale { text-align: right; }
.nh-report .totale .n { font-family: var(--mono); font-size: 21px; font-weight: 600; line-height: 1; color: #fff; }
.nh-report .totale .l {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em;
  text-transform: uppercase; color: #8FBCC3; margin-top: 5px;
}
.nh-report .totale.ok  .n { color: #8FE0B8; }
.nh-report .totale.warn .n { color: #F0C670; }
.nh-report .totale.off .n { color: #F4A1B2; }
/* D.1 · totale N/D (descrittivi, senza target) — grigio-blu discreto */
.nh-report .totale.nd .n { color: #A9CBD0; }

/* Back link (per mockup index) */
.nh-report .topbar .back {
  color: #A9CBD0; font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; text-decoration: none; margin-right: 14px;
}
.nh-report .topbar .back:hover { color: #fff; }

/* ---------- controlli ---------- */
.nh-report .controls {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 25;
}
.nh-report .controls-inner {
  max-width: 1560px; margin: 0 auto; padding: 10px 22px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.nh-report input[type="search"], .nh-report select {
  font-family: var(--body); font-size: 13px; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 7px 10px; min-height: 34px;
}
.nh-report input[type="search"] { min-width: 230px; flex: 1 1 230px; max-width: 340px; }
.nh-report input:focus-visible, .nh-report select:focus-visible, .nh-report button:focus-visible, .nh-report a:focus-visible {
  outline: 2px solid var(--petrol-soft); outline-offset: 2px;
}
.nh-report .btn {
  font-family: var(--body); font-size: 12.5px; font-weight: 500;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 7px 12px; min-height: 34px; cursor: pointer;
}
.nh-report .btn:hover { border-color: var(--petrol); color: var(--petrol); }
.nh-report .btn[aria-pressed="true"] { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.nh-report .conteggio-filtro {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  margin-left: auto; white-space: nowrap;
}

/* ---------- impianto ---------- */
.nh-report .layout {
  max-width: 1560px; margin: 0 auto; padding: 22px;
  display: grid; grid-template-columns: 218px minmax(0, 1fr); gap: 26px; align-items: start;
}

.nh-report nav.aree { position: relative; }
.nh-report nav.aree .titolo {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 9px;
}
.nh-report nav.aree ol { list-style: none; margin: 0; padding: 0; }
.nh-report nav.aree a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 6px 9px; border-left: 2px solid var(--line-soft);
  color: var(--ink); text-decoration: none; font-size: 12.5px;
}
.nh-report nav.aree a:hover { border-left-color: var(--petrol); background: var(--surface); }
.nh-report nav.aree a .q { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.nh-report section.area { margin-bottom: 34px; scroll-margin-top: 140px; }
.nh-report section.area[hidden] { display: none; }
.nh-report .area-head {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 8px; margin-bottom: 16px;
  border-bottom: 2px solid var(--ink);
}
.nh-report .area-head h2 { font-size: 16.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.nh-report .area-head .q { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: auto; }

/* ---------- gauge ---------- */
.nh-report .griglia {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.nh-report .gauge {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r);
  padding: 12px 12px 13px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.nh-report .gauge[hidden] { display: none; }
.nh-report .gauge .nome {
  font-size: 12px; font-weight: 500; line-height: 1.3;
  min-height: 32px; margin-bottom: 4px;
}
.nh-report .gauge svg { display: block; width: 100%; height: auto; }
.nh-report .gauge .valore {
  font-family: var(--mono); font-size: 20px; font-weight: 600; text-align: center;
  line-height: 1; margin-top: -6px;
}
.nh-report .gauge .sotto {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  text-align: center; margin-top: 6px;
}
.nh-report .gauge .esito {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  text-align: center; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line-soft);
}
.nh-report .st-ok   { color: var(--moss); }
.nh-report .st-warn { color: var(--ochre); }
.nh-report .st-off  { color: var(--rose); }
.nh-report .st-nd   { color: var(--muted); }

/* HRD-S6 · chart card (bar/pie/line): tono petrol per distinguere dai gauge KPI */
.nh-report .gauge.chart { border-top: 2px solid var(--petrol); }
.nh-report .gauge.chart .esito { color: var(--petrol); letter-spacing: .14em; }
.nh-report .gauge.chart .valore { color: var(--petrol); }
/* D.4 · chart 1-slice: card descrittiva senza SVG */
.nh-report .gauge.chart.chart-single .single-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  color: var(--muted); text-align: center; margin: 14px 0 6px;
  padding: 6px 8px; background: rgba(11,79,90,.06); border-radius: 2px;
}
.nh-report .gauge.chart .chart-hidden {
  font-family: var(--mono); font-size: 9.5px; color: var(--ochre);
  text-align: center; margin-top: 4px; padding: 3px 6px;
  background: #FAF6EE; border-radius: 2px;
}

/* A.1 · table card: full-width nel grid (span tutte le colonne) */
.nh-report .gauge.table-card {
  grid-column: 1 / -1;
  border-top: 2px solid var(--ochre);
}
.nh-report .gauge.table-card .nome {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  min-height: 0; margin-bottom: 10px;
}
.nh-report .gauge.table-card .table-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 400;
}
.nh-report .gauge.table-card .table-wrap-inline {
  overflow-x: auto; margin: 0 -12px -13px; border-top: 1px solid var(--line-soft);
}
.nh-report .gauge.table-card .table-inline {
  border-collapse: collapse; width: 100%; min-width: 100%;
}
.nh-report .gauge.table-card .table-inline th {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); text-align: left; font-weight: 500;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0;
}
.nh-report .gauge.table-card .table-inline td {
  padding: 6px 12px; border-bottom: 1px solid var(--line-soft);
  font-size: 12px; vertical-align: top;
}
.nh-report .gauge.table-card .table-inline th.num,
.nh-report .gauge.table-card .table-inline td.num {
  text-align: right; font-family: var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.nh-report .gauge.table-card .table-inline tbody tr:hover { background: #F4F8F9; }
.nh-report .gauge.table-card .table-trunc {
  font-family: var(--mono); font-size: 10.5px; color: var(--ochre);
  padding: 8px 12px; border-top: 1px solid var(--line-soft); background: #FAF6EE;
  margin: -13px -12px -13px; border-radius: 0 0 var(--r) var(--r);
}

/* ---------- tabelle ---------- */
.nh-report .tabella-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); box-shadow: var(--shadow); }
.nh-report table { border-collapse: collapse; width: 100%; min-width: 880px; }
.nh-report caption { text-align: left; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 0; }
.nh-report th {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); text-align: left; font-weight: 500;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.nh-report td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-size: 12.5px; }
.nh-report tbody tr:last-child td { border-bottom: none; }
.nh-report tbody tr:hover { background: #F4F8F9; }
.nh-report tr[hidden] { display: none; }
.nh-report td.num, .nh-report th.num { text-align: right; font-family: var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.nh-report td.kpi { font-weight: 500; }
.nh-report td.formula, .nh-report td.scopo { color: var(--muted); font-size: 11.5px; }
.nh-report td.stato { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.nh-report .pallino { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

.nh-report .vuoto { padding: 26px 12px; color: var(--muted); font-size: 13px; }

.nh-report footer.nota {
  max-width: 1560px; margin: 0 auto; padding: 0 22px 40px;
  color: var(--muted); font-size: 11.5px; line-height: 1.6;
}
.nh-report footer.nota code { font-family: var(--mono); background: var(--surface); padding: 1px 5px; border: 1px solid var(--line-soft); border-radius: 2px; }

@media (max-width: 900px) {
  .nh-report .layout { grid-template-columns: 1fr; }
  .nh-report nav.aree { position: static; }
  .nh-report nav.aree ol { display: flex; flex-wrap: wrap; gap: 4px; }
  .nh-report nav.aree a { border-left: none; border: 1px solid var(--line); border-radius: var(--r); }
  .nh-report .totali { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .nh-report *, .nh-report *::before, .nh-report *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .nh-report .controls, .nh-report nav.aree { display: none; }
  .nh-report .layout { grid-template-columns: 1fr; padding: 0; }
  .nh-report .topbar { position: static; }
  .nh-report section.area { break-inside: avoid; }
  .nh-report .gauge, .nh-report .tabella-wrap { box-shadow: none; }
}
