/* nh-itops-widgets.css — Styling per IT Ops Dashboard widgets (SM-IO-2) */
/* NH #5 single source: variabili da theme-vars.css. */

/* KPI HERO */
.nhi-kpi {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
  cursor: default;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.nhi-kpi[role="button"] { cursor: pointer; }
.nhi-kpi[role="button"]:hover { border-color: var(--accent, #3b82f6); box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.nhi-kpi-label { font-size: 11px; color: var(--text-3, #64748b); text-transform: uppercase; font-weight: 600; letter-spacing: 0.4px; }
.nhi-kpi-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.nhi-kpi-value { font-size: 26px; font-weight: 700; color: var(--text, #0f172a); line-height: 1.1; }
.nhi-kpi-spark { flex-shrink: 0; opacity: 0.85; }
.nhi-kpi-delta { font-size: 11px; color: var(--text-3, #64748b); }
.nhi-kpi-delta.nhi-pos { color: #10b981; }
.nhi-kpi-delta.nhi-neg { color: #ef4444; }
.nhi-kpi-delta.nhi-flat { color: var(--text-3, #64748b); }
.nhi-kpi-health .nhi-kpi-value { color: #3b82f6; }
.nhi-kpi-danger .nhi-kpi-value { color: #ef4444; }
.nhi-kpi-warn   .nhi-kpi-value { color: #f59e0b; }
.nhi-kpi-ok     .nhi-kpi-value { color: #10b981; }

/* HEALTH GAUGE */
.nhi-gauge { display: inline-block; cursor: help; }
.nhi-gauge svg { display: block; }

/* BREAKDOWN BARS */
.nhi-bars { display: flex; flex-direction: column; gap: 6px; }
.nhi-bar {
  display: grid;
  grid-template-columns: 1fr 2fr 60px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
}
.nhi-bar:hover[role="button"] { background: var(--surface-2, #f8fafc); border-radius: 4px; }
.nhi-bar-label { color: var(--text, #0f172a); font-weight: 500; }
.nhi-bar-sub { color: var(--text-3, #64748b); font-size: 10px; margin-left: 6px; }
.nhi-bar-track { height: 6px; background: var(--surface-2, #f1f5f9); border-radius: 3px; overflow: hidden; }
.nhi-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.nhi-bar-value { text-align: right; color: var(--text-2, #475569); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ALERT FEED */
.nhi-alerts { display: flex; flex-direction: column; gap: 4px; max-height: 380px; overflow-y: auto; }
.nhi-al {
  display: grid;
  grid-template-columns: 22px 40px 110px 1fr 80px 75px;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.1s;
}
.nhi-al:hover { border-color: var(--accent, #3b82f6); }
.nhi-al-ico { font-size: 14px; }
.nhi-al-type { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; text-align: center; background: var(--surface-3, #e2e8f0); }
.nhi-al-p1 .nhi-al-type  { background: rgba(239,68,68,0.15); color: #b91c1c; }
.nhi-al-sla .nhi-al-type { background: rgba(245,158,11,0.15); color: #b45309; }
.nhi-al-rca .nhi-al-type { background: rgba(99,102,241,0.15); color: #4338ca; }
.nhi-al-chg .nhi-al-type { background: rgba(168,85,247,0.15); color: #7e22ce; }
.nhi-al-key { font-family: ui-monospace, monospace; font-weight: 600; color: var(--accent, #3b82f6); }
.nhi-al-summary { color: var(--text-2, #475569); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nhi-al-tenant { color: var(--text-3, #64748b); font-size: 11px; text-align: right; }
.nhi-al-age { font-size: 10px; color: var(--text-3, #64748b); text-align: right; }
.nhi-al-age.nhi-neg { color: #ef4444; font-weight: 600; }

/* DOMAIN SECTION (accordion) */
.nhi-section {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.nhi-section-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--surface, #fff);
  transition: background 0.1s;
}
.nhi-section-summary::-webkit-details-marker { display: none; }
.nhi-section-summary:hover { background: var(--surface-2, #f8fafc); }
.nhi-section-title { font-weight: 600; font-size: 13px; color: var(--text, #0f172a); }
.nhi-section-badge { font-size: 10px; background: var(--surface-2, #f1f5f9); color: var(--text-3, #64748b); padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.nhi-section-caret { margin-left: auto; color: var(--text-3, #64748b); font-size: 14px; transition: transform 0.15s; }
.nhi-section[open] .nhi-section-caret { transform: rotate(180deg); }
.nhi-section-body { padding: 12px 14px 14px; border-top: 1px solid var(--border, #e2e8f0); }

/* EMPTY / LOADER */
.nhi-empty { padding: 14px; text-align: center; color: var(--text-3, #64748b); font-size: 12px; font-style: italic; }
.nhi-loader { padding: 20px; text-align: center; color: var(--text-3, #64748b); font-size: 12px; }
.nhi-err { padding: 10px 12px; background: rgba(239,68,68,0.06); border-left: 3px solid #ef4444; border-radius: 6px; color: #b91c1c; font-size: 12px; }

/* GRID HELPERS */
.nhi-grid-5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.nhi-grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.nhi-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.nhi-panel { background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 12px 14px; }
.nhi-panel h3 { font-size: 12px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; color: var(--text, #0f172a); }
.nhi-panel-sub { font-size: 11px; color: var(--text-3, #64748b); margin-bottom: 8px; }

/* TIER HERO (Tier 1) */
.nhi-hero { background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.nhi-hero-row { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: center; }
.nhi-hero-gauge-wrap { display: flex; flex-direction: column; align-items: center; }
.nhi-hero-gauge-label { font-size: 11px; color: var(--text-3, #64748b); text-transform: uppercase; font-weight: 600; margin-top: -8px; }
.nhi-hero-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

/* CONTEXT BANNER */
.nhi-ctx-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; margin-bottom: 12px;
  background: rgba(59,130,246,0.08); border-left: 3px solid #3b82f6; border-radius: 6px;
  font-size: 12px; color: var(--text-2, #475569);
}
.nhi-ctx-banner.warn { background: rgba(245,158,11,0.08); border-left-color: #f59e0b; color: #92400e; }
.nhi-ctx-banner strong { color: var(--text, #0f172a); }

/* DARK MODE inherit via theme-vars */
html[data-theme="dark"] .nhi-bar-track { background: rgba(255,255,255,0.08); }
html[data-theme="dark"] .nhi-section-summary { background: var(--surface, #1e293b); }
html[data-theme="dark"] .nhi-section-summary:hover { background: var(--surface-2, #0f172a); }
