/* ============================================================
   AIN Alerts & Health — alert command center styling
   Prefix: .alh-
   Theme: red/orange severity colours, with green-success states
   when nothing is firing. Strong vertical hierarchy.
   ============================================================ */

.alh-root {
  /* No `position` — let .scr position us. */
  padding: 18px 22px 32px;
  color: #d4d4d4;
}
.alh-root > * + * { margin-top: 16px; }

/* ── Background ─────────────────────────────────────────── */
.alh-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(239, 68, 68, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(239, 68, 68, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none; z-index: 0;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 0%, transparent 80%);
}
.alh-bg-glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 25% 20%, rgba(239, 68, 68, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 40% at 75% 80%, rgba(245, 158, 11, 0.06), transparent 60%);
  pointer-events: none; z-index: 0;
  animation: alh-glow-shift 16s ease-in-out infinite alternate;
}
@keyframes alh-glow-shift {
  0%   { opacity: 0.7; transform: translate(0, 0); }
  100% { opacity: 1;   transform: translate(2%, -2%); }
}
.alh-root > * { position: relative; z-index: 1; }

/* ── Header ─────────────────────────────────────────────── */
.alh-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.7), rgba(20, 30, 50, 0.5));
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  backdrop-filter: blur(14px);
  position: relative; overflow: hidden;
}
.alh-header::before {
  content: '';
  position: absolute; top: 0; left: -100%; width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, #EF4444, #F59E0B, transparent);
  animation: alh-sweep 4s ease-in-out infinite;
}
@keyframes alh-sweep {
  0%, 100% { left: -100%; }
  50%      { left: 100%; }
}
.alh-title {
  font-size: 18px; font-weight: 800; letter-spacing: 4px;
  background: linear-gradient(135deg, #fff, #fca5a5, #fbbf24);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 26px rgba(239, 68, 68, 0.4);
}
.alh-subtitle {
  font-size: 10px; color: #6b7280;
  letter-spacing: 1.5px; margin-top: 4px;
}
.alh-pill {
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 4px;
  font-size: 11px; color: #fca5a5;
  letter-spacing: 1px; font-weight: 600;
}

/* ── Severity KPI cards ─────────────────────────────────── */
.alh-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.alh-sev-card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.85), rgba(20, 30, 50, 0.7));
  border: 1px solid rgba(239, 68, 68, 0.18);
  border-radius: 8px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  cursor: pointer;
  animation: alh-slide-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.alh-sev-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}
.alh-sev-card::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at top right, var(--accent), transparent 60%);
  opacity: 0.06; pointer-events: none;
}
.alh-sev-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 28px var(--accent)33;
}
.alh-sev-card.alh-sev-active {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent)44;
}
.alh-sev-card.alh-sev-active::after { opacity: 0.12; }
.alh-sev-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 22px;
  flex-shrink: 0;
  position: relative; z-index: 2;
}
.alh-sev-body { flex: 1; min-width: 0; position: relative; z-index: 2; }
.alh-sev-value {
  font-size: 36px; font-weight: 800;
  color: #fff; line-height: 1;
  text-shadow: 0 0 20px var(--accent);
  margin-bottom: 4px;
  font-feature-settings: 'tnum';
}
.alh-sev-label {
  font-size: 9px; color: #6b7280;
  letter-spacing: 1.5px; font-weight: 600;
}
.alh-sev-pulse {
  position: absolute;
  top: 50%; right: 18px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  opacity: 0;
  transform: translateY(-50%);
}
.alh-sev-card.alh-sev-active .alh-sev-pulse {
  opacity: 1;
  animation: alh-pulse-dot 1.4s ease-in-out infinite;
}
@keyframes alh-pulse-dot {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50%      { opacity: 0.3; transform: translateY(-50%) scale(0.7); }
}
.alh-kpi-row .alh-sev-card:nth-child(1) { animation-delay: 0.05s; }
.alh-kpi-row .alh-sev-card:nth-child(2) { animation-delay: 0.10s; }
.alh-kpi-row .alh-sev-card:nth-child(3) { animation-delay: 0.15s; }
.alh-kpi-row .alh-sev-card:nth-child(4) { animation-delay: 0.20s; }

/* ── Section shell ──────────────────────────────────────── */
.alh-section {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.8), rgba(20, 30, 50, 0.6));
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 8px;
  padding: 14px 16px;
  backdrop-filter: blur(10px);
  position: relative; overflow: hidden;
  animation: alh-slide-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
  animation-delay: 0.25s;
}
.alh-section::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.4), transparent);
}
.alh-section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid rgba(239, 68, 68, 0.1);
  flex-wrap: wrap; gap: 10px;
}
.alh-section-title {
  font-size: 11px; font-weight: 700;
  color: #fca5a5; letter-spacing: 2px;
}
.alh-section-meta {
  font-size: 10px; color: #9ca3af;
}
.alh-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #6b7280;
  padding: 30px;
  text-align: center;
}

/* ── Timeline ───────────────────────────────────────────── */
.alh-timeline-host { min-height: 140px; }
.alh-tl-wrap {
  display: flex; flex-direction: column;
  height: 140px;
}
.alh-tl-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  align-items: end;
  padding: 0 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.alh-tl-col {
  height: 100%;
  display: flex; align-items: end;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s;
}
.alh-tl-col:hover { transform: scaleY(1.05); }
.alh-tl-bar {
  width: 100%;
  display: flex; flex-direction: column;
  border-radius: 2px 2px 0 0;
  overflow: hidden;
  min-height: 2px;
  animation: alh-bar-rise 0.8s ease backwards;
}
@keyframes alh-bar-rise {
  from { height: 0 !important; }
}
.alh-tl-seg {
  flex: 1;
  min-height: 2px;
}
.alh-tl-hour-label {
  position: absolute;
  bottom: -16px; left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #6b7280;
  font-family: monospace;
}
.alh-tl-axis {
  display: flex; justify-content: space-between;
  font-size: 9px; color: #6b7280;
  letter-spacing: 1px; padding: 6px 4px 0;
}

/* ── Donut + bars row ───────────────────────────────────── */
.alh-row-2 {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 14px;
}
.alh-donut-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px;
}
.alh-donut-flex { display: flex; align-items: center; gap: 16px; width: 100%; }
.alh-donut-svg-wrap { position: relative; flex-shrink: 0; }
.alh-donut-svg { width: 180px; height: 180px; }
.alh-donut-center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center; pointer-events: none;
}
.alh-donut-total {
  font-size: 28px; font-weight: 800; color: #fff;
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}
.alh-donut-total-label {
  font-size: 10px; color: #6b7280;
  letter-spacing: 1.5px; margin-top: 2px;
}
.alh-donut-legend { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.alh-donut-leg-row {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 8px; align-items: center;
  padding: 5px 8px;
  background: rgba(255,255,255,0.025);
  border-radius: 4px;
  font-size: 11px;
}
.alh-donut-dot { width: 10px; height: 10px; border-radius: 50%; }
.alh-donut-leg-label { color: #d4d4d4; font-weight: 600; }
.alh-donut-leg-val { color: #fff; font-weight: 700; }
.alh-donut-leg-pct {
  color: #fca5a5; font-family: monospace;
  min-width: 36px; text-align: right;
}

/* Bars */
.alh-bars { display: flex; flex-direction: column; gap: 8px; }
.alh-bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 50px;
  gap: 12px; align-items: center;
  padding: 4px 0;
  font-size: 11px;
  animation: alh-slide-right 0.4s ease backwards;
}
.alh-bar-name {
  font-weight: 700; letter-spacing: 1px;
  font-size: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.alh-bar-track {
  height: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 5px; overflow: hidden;
}
.alh-bar-fill {
  height: 100%; border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.alh-bar-val {
  text-align: right;
  font-family: monospace; font-weight: 800;
  color: #fff; font-size: 13px;
}

/* ── Active alerts feed ─────────────────────────────────── */
.alh-feed {
  display: flex; flex-direction: column;
  gap: 6px;
  max-height: 480px; overflow-y: auto;
}
.alh-active-item {
  display: flex; align-items: stretch;
  background: rgba(255,255,255,0.025);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.15s, transform 0.15s;
  animation: alh-slide-right 0.4s ease backwards;
}
.alh-active-item:hover {
  background: rgba(239, 68, 68, 0.08);
  transform: translateX(2px);
}
.alh-active-sev-strip {
  width: 4px;
  flex-shrink: 0;
}
.alh-active-body {
  flex: 1; min-width: 0;
  padding: 10px 14px;
}
.alh-active-line-1 {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 4px;
}
.alh-active-sev {
  font-size: 10px; font-weight: 800;
  letter-spacing: 1.5px;
  flex-shrink: 0;
}
.alh-active-title {
  color: #fff; font-weight: 600;
  font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.alh-active-line-2 {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 10px; color: #9ca3af;
}
.alh-active-device { color: #d4d4d4; font-weight: 500; }
.alh-active-ip { color: #67e8f9; font-family: monospace; }
.alh-active-ago { color: #6b7280; }
.alh-active-state {
  display: flex; align-items: center;
  padding: 0 14px;
  font-size: 9px; font-weight: 700;
  color: #fca5a5;
  letter-spacing: 1.5px;
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}

/* ── Noisy + Heat row ───────────────────────────────────── */
.alh-row-3 {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 14px;
}

/* Noisy devices */
.alh-noisy { display: flex; flex-direction: column; gap: 6px; }
.alh-noisy-row {
  display: grid;
  grid-template-columns: 24px 1fr 1.2fr 70px;
  gap: 10px; align-items: center;
  padding: 7px 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  animation: alh-slide-right 0.4s ease backwards;
}
.alh-noisy-row:hover { background: rgba(239, 68, 68, 0.06); }
.alh-noisy-rank {
  text-align: center;
  font-weight: 800; color: #fca5a5;
  font-family: monospace; font-size: 12px;
}
.alh-noisy-name { min-width: 0; }
.alh-noisy-title {
  color: #fff; font-weight: 600; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.alh-noisy-type {
  color: #6b7280; font-size: 9px;
  letter-spacing: 1px; text-transform: uppercase;
  margin-top: 1px;
}
.alh-noisy-bar {
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px; overflow: hidden;
}
.alh-noisy-fill {
  height: 100%;
  background: linear-gradient(90deg, #F59E0B, #d97706);
  border-radius: 4px;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
  transition: width 0.6s ease;
}
.alh-noisy-fill.crit {
  background: linear-gradient(90deg, #EF4444, #b91c1c);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}
.alh-noisy-counts {
  display: flex; gap: 6px; align-items: center;
  justify-content: flex-end;
}
.alh-noisy-total {
  font-family: monospace; font-weight: 800;
  color: #fff; font-size: 13px;
}
.alh-noisy-crit {
  font-size: 10px; font-weight: 700;
  color: #fca5a5;
}

/* Heat calendar */
.alh-heat-host {
  display: flex; flex-direction: column; gap: 8px;
}
.alh-heat-grid {
  display: grid;
  grid-template-columns: 60px repeat(24, 1fr);
  gap: 2px;
}
.alh-heat-corner { /* empty top-left cell */ }
.alh-heat-hour-label {
  font-size: 8px; color: #6b7280;
  text-align: center;
  font-family: monospace;
  height: 14px; line-height: 14px;
}
.alh-heat-day-label {
  font-size: 10px; color: #9ca3af;
  display: flex; align-items: center;
  padding-right: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.alh-heat-cell {
  aspect-ratio: 1;
  min-height: 14px;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.15s;
  animation: alh-fade-in 0.3s ease backwards;
}
.alh-heat-cell:hover {
  transform: scale(1.7);
  z-index: 5; position: relative;
  outline: 1px solid #fff5;
}
.alh-heat-scale {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; color: #6b7280;
  align-self: flex-end;
  letter-spacing: 1px;
}
.alh-heat-scale-tile {
  width: 12px; height: 12px;
  border-radius: 2px;
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes alh-slide-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes alh-slide-right {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes alh-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1280px) {
  .alh-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .alh-row-2, .alh-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .alh-kpi-row { grid-template-columns: 1fr; }
  .alh-header { flex-direction: column; gap: 8px; text-align: center; }
  .alh-heat-grid { grid-template-columns: 50px repeat(24, minmax(8px, 1fr)); }
  .alh-noisy-row { grid-template-columns: 20px 1fr 60px; }
  .alh-noisy-bar { display: none; }
}