/* features domain styles. Owned by the features domain; loaded by index.html.
 * Build on tokens.css and components.css; prefix selectors with .features- so
 * nothing here can restyle another domain's screens. */

/* ------------------------------------------------ 이벤트 센터 (events) -- */

.features-filters { display: flex; flex-wrap: wrap; gap: var(--sp-sm); align-items: flex-end; }
.features-filters .field { min-width: 140px; }
.features-check { width: 16px; height: 16px; accent-color: var(--signal-live); }
.features-pad { padding: var(--sp-sm) var(--sp-md) 0; }
/* A second line under a list row's title: readable, not a label. */
.features-sub { font-size: var(--fs-label-md); line-height: var(--lh-label-md); color: var(--outline); }

/* Open incidents per source: a row of small tiles that double as a filter. */
.features-ev-sources {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: var(--sp-sm);
  margin: var(--sp-md) 0;
}
@media (max-width: 1200px) { .features-ev-sources { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 700px) { .features-ev-sources { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.features-ev-source {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  background: var(--surface-low);
  color: inherit;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.features-ev-source:hover { border-color: var(--stroke-strong); }
.features-ev-source.on { border-color: var(--signal-live); box-shadow: var(--glow-live); }
.features-ev-source.quiet .stat-value { color: var(--outline); }

.features-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--signal-warn);
  border-radius: 6px;
  background: var(--tint-warn);
  color: var(--signal-warn);
  margin-bottom: var(--sp-md);
}

/* The anomaly-rule editor's parameter grid. */
.features-params { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-sm) var(--sp-md); }
@media (max-width: 800px) { .features-params { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.features-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-sm); }
.features-timeline li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-xs) var(--sp-sm);
  padding: var(--sp-xs) var(--sp-sm);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
}
.features-case { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-md); }
.features-case-step {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--stroke); border-radius: var(--r-md);
}
.features-case-step.crit { --step-c: var(--signal-crit); }
.features-case-step.warn { --step-c: var(--signal-warn); }
.features-case-step.info { --step-c: var(--signal-info, var(--stroke)); }
.features-case-step:is(.crit, .warn, .info) {
  background: color-mix(in srgb, var(--step-c) 7%, transparent);
  border-color: color-mix(in srgb, var(--step-c) 45%, transparent);
}
.features-json {
  margin: 0;
  max-height: 260px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-code);
  color: var(--on-surface-variant);
  white-space: pre-wrap;
  word-break: break-all;
}

/* The dashboard's live anomaly panel. */
.features-live-row { align-items: center; min-width: 0; }
.features-live-row .grow { flex: 1; min-width: 0; }
/* The value here is a phrase ("95.5% / expected 56.3%"), not a lone figure:
   set it at the label's size rather than the meter's metric size. */
.features-live-row .t-metric-inline { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); white-space: nowrap; }
.features-live-open { align-items: center; min-width: 0; color: inherit; text-decoration: none; }
.features-live-open:hover .t-body-sm { text-decoration: underline; }

/* ------------------------------------------- clickable KPI cards (SNMP) -- */
.features-kpi {
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  border: 1px solid var(--stroke);
  transition: border-color var(--t-fast) var(--ease);
}
.features-kpi:hover { border-color: var(--primary); }
.features-kpi.warn .stat-value { color: var(--signal-warn); }
.features-kpi.crit .stat-value { color: var(--signal-crit-text); }

/* ------------------------------------- identification x collection grid -- */
.features-kpis { align-items: flex-start; }
.features-matrix {
  display: grid;
  /* the status label, the four collection levels, the total */
  grid-template-columns: minmax(80px, auto) repeat(5, minmax(64px, 1fr));
  gap: var(--sp-xs) var(--sp-sm);
  align-items: center;
  flex: 1 1 380px;
  min-width: 0;
}
.features-cell {
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--on-surface);
  background: var(--surface-high);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: var(--sp-xs) var(--sp-sm);
  text-align: right;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}
.features-cell:hover { border-color: var(--primary); }
.features-cell.zero { color: var(--on-surface-variant); }
.features-cell.warn { color: var(--signal-warn); }
.features-cell.info { color: var(--signal-info); }
.features-coverage { flex: 1 1 280px; min-width: 0; }

/* ------------------------------------------------- lines and timeline -- */
.features-line {
  padding: var(--sp-xs) 0;
  border-bottom: 1px solid var(--stroke);
}
.features-line:last-child { border-bottom: 0; }
.features-tl {
  align-items: flex-start;
  flex-wrap: wrap;
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--stroke);
}
.features-tl:last-child { border-bottom: 0; }
.features-tl > :first-child { min-width: 150px; }

/* ------------------------------------------- unavailable-tab explanation -- */
.features-explain { padding: var(--sp-md) 0; max-width: 640px; }
.features-explain .btn { align-self: flex-start; }
.features-note { padding: 0 0 var(--sp-sm); }

/* ------------------------------------------------------ candidate picks -- */
.features-pick { cursor: pointer; gap: var(--sp-xs); }
.features-pick input { margin: 0; }

@media (max-width: 640px) {
  .features-tl > :first-child { min-width: 0; width: 100%; }
  .features-matrix { grid-template-columns: auto repeat(5, minmax(44px, 1fr)); }
}

/* --------------------------------------------------- unified rule list -- */
.features-kpi { display: inline-flex; align-items: center; gap: var(--sp-xs); padding: var(--sp-xs) var(--sp-sm); border: 1px solid var(--stroke); border-radius: 6px; }
.features-editor .features-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-sm); }
.features-preview { border-top: 1px solid var(--stroke); padding-top: var(--sp-sm); }

/* ------------------------------------------------------------ silences -- */
.features-silence {
  display: flex; flex-direction: column; gap: var(--sp-xs);
  padding: var(--sp-sm) 0; border-bottom: 1px solid var(--stroke);
}
.features-silence:last-child { border-bottom: 0; }

/* ------------------------------------------------- SNMP layer-2 picture -- */
.features-l2 { min-height: 320px; padding: var(--sp-sm); overflow: hidden; }
.features-l2 svg { display: block; }
.features-l2-edge { stroke: var(--signal-live); stroke-opacity: 0.45; stroke-width: 1.4; }
.features-l2-node rect, .features-l2-node circle { fill: var(--surface-high); stroke: var(--outline); stroke-width: 1.2; }
.features-l2-node.polled rect { stroke: var(--signal-live); }
.features-l2-node.down rect { stroke: var(--signal-crit); }
.features-l2-node text { fill: var(--on-surface-variant); font: 11px var(--font-mono, monospace); }
.features-l2-node:hover text { fill: var(--on-surface); }
.features-l2-legend { padding: var(--sp-xs) var(--sp-sm); font-size: 12px; color: var(--on-surface-variant); }
.features-l2-key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.2px solid var(--outline); }
.features-l2-key.polled { border-radius: 2px; border-color: var(--signal-live); }
.features-l2-key.down { border-radius: 2px; border-color: var(--signal-crit); }

/* ------------------------------------------ SNMP nodes in the fleet grid -- */
/* hosts.js tags each card with its node's role; an SNMP device is badged so
   it is not mistaken for an agent. */
.node-card[data-role="snmp"] { position: relative; border-style: dashed; }
.node-card[data-role="snmp"]::after {
  content: "SNMP";
  position: absolute; right: 10px; bottom: 8px;
  font: 600 10px var(--font-mono, monospace); letter-spacing: 0.06em;
  color: var(--signal-info); opacity: 0.8;
}

/* ------------------------------------------------ Blast Radius (blast) -- */

.features-blast-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--sp-md); }
@media (max-width: 1100px) { .features-blast-grid { grid-template-columns: minmax(0, 1fr); } }
.features-blast-canvas { width: 100%; max-width: 760px; margin: 0 auto; }
.features-blast-svg { width: 100%; height: auto; display: block; overflow: visible; }
/* Rings: soft concentric bands, the inner one warmest (closest to the compromise). */
.features-blast-band { stroke: none; transition: fill var(--t-base) var(--ease); }
.features-blast-band.r3 { fill: rgb(var(--fg-rgb) / 0.018); }
.features-blast-band.r2 { fill: rgb(var(--fg-rgb) / 0.03); }
.features-blast-band.r1 { fill: rgb(var(--fg-rgb) / 0.045); }
.features-blast-band.focus { fill: rgb(var(--accent-rgb) / 0.07); }
.features-blast-core { pointer-events: none; }
.features-blast-core-in { stop-color: rgb(var(--accent-rgb)); stop-opacity: 0.16; }
.features-blast-core-out { stop-color: rgb(var(--accent-rgb)); stop-opacity: 0; }
.features-blast-orbit { fill: none; stroke: rgb(var(--fg-rgb) / 0.09); stroke-width: 1; }
.features-blast-orbit.focus { stroke: rgb(var(--accent-rgb) / 0.75); stroke-width: 1.5; }
.features-blast-ring-name { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; fill: rgb(var(--fg-rgb) / 0.38); pointer-events: none; }
.features-blast-ring-name.focus { fill: rgb(var(--accent-rgb)); font-weight: 600; }
/* Links: radial curves, width by traffic. */
.features-blast-edge { fill: none; stroke: var(--signal-ok); stroke-linecap: round; opacity: 0.42; transition: opacity var(--t-base) var(--ease); }
.features-blast-edge.policy { stroke: var(--signal-info); stroke-dasharray: 4 4; opacity: 0.55; }
.features-blast-edge.both { stroke: var(--signal-crit); opacity: 0.6; }
/* A member's other ways in: present, but behind its main one. */
.features-blast-edge.minor { opacity: 0.13; }
/* Nodes: a panel-coloured rim keeps each clear of the links under it. */
.features-blast-node { cursor: pointer; transition: opacity var(--t-base) var(--ease); }
.features-blast-body { fill: var(--surface-highest); stroke: rgb(var(--panel-rgb)); stroke-width: 2; transition: r var(--t-base) var(--ease); }
.features-blast-halo { fill: var(--outline); opacity: 0; }
.features-blast-node.crit .features-blast-body { fill: var(--signal-crit); }
.features-blast-node.warn .features-blast-body { fill: var(--signal-warn); }
.features-blast-node.info .features-blast-body { fill: var(--signal-info); }
.features-blast-node.crit .features-blast-halo { fill: var(--signal-crit); opacity: 0.2; }
.features-blast-node.warn .features-blast-halo { fill: var(--signal-warn); opacity: 0.16; }
.features-blast-node:hover .features-blast-halo, .features-blast-node.hot .features-blast-halo { opacity: 0.35; }
.features-blast-node.picked .features-blast-halo { fill: none; stroke: var(--on-surface); stroke-width: 2; opacity: 1; }
.features-blast-node.origin .features-blast-body { stroke: rgb(var(--accent-rgb) / 0.9); stroke-width: 2.5; }
.features-blast-pulse { fill: none; stroke: rgb(var(--accent-rgb) / 0.55); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: features-blast-pulse 2.8s var(--ease) infinite; pointer-events: none; }
.features-blast-pulse.late { animation-delay: 1.4s; }
@keyframes features-blast-pulse { from { transform: scale(0.7); opacity: 0.9; } to { transform: scale(1.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .features-blast-pulse { animation: none; opacity: 0.4; } }
.features-blast-node.dropped { opacity: 0.25; }
.features-blast-node.dropped .features-blast-body { stroke-dasharray: 2 2; stroke: var(--outline); }
/* Labels: haloed in the panel colour so they read over links. */
.features-blast-label { font-size: 10px; fill: var(--on-surface-variant); paint-order: stroke; stroke: rgb(var(--panel-rgb)); stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }
.features-blast-label.origin { font-size: 12px; font-weight: 700; fill: var(--on-surface); }
.features-blast-node:hover .features-blast-label, .features-blast-node.hot .features-blast-label { fill: var(--on-surface); }
/* A label that would overlap another waits for hover. */
.features-blast-label.quiet { opacity: 0; transition: opacity var(--t-fast, 120ms) var(--ease); }
.features-blast-node:hover .features-blast-label.quiet, .features-blast-node.hot .features-blast-label.quiet { opacity: 1; }
/* A picked ring (its KPI tile): its members and links forward, the way in half, the rest faint. */
.features-blast-ringtiles { display: contents; }
.kpi.features-kpi.clickable { cursor: pointer; }
.kpi.features-kpi.on { border-color: rgb(var(--accent-rgb) / 0.7); box-shadow: 0 0 0 1px rgb(var(--accent-rgb) / 0.5) inset; }
.features-blast-svg.focusing .features-blast-node.faded { opacity: 0.13; }
.features-blast-svg.focusing .features-blast-node.context { opacity: 0.6; }
.features-blast-svg.focusing .features-blast-node.focus .features-blast-label { fill: var(--on-surface); font-weight: 600; }
.features-blast-svg.focusing .features-blast-edge.faded { opacity: 0.05; }
.features-blast-svg.focusing .features-blast-edge.focus { opacity: 0.95; }
.features-blast-svg.focusing .features-blast-edge.focus.minor { opacity: 0.35; }
/* Hover: the node, its links and their other ends; the rest steps back. */
.features-blast-svg.hovering .features-blast-node:not(.hot) { opacity: 0.25; }
.features-blast-svg.hovering .features-blast-edge:not(.hot) { opacity: 0.04; }
.features-blast-svg.hovering .features-blast-edge.hot { opacity: 1; }
.features-blast-side { min-height: 120px; }
.features-blast-ev { padding: var(--sp-xs) 0; border-top: 1px solid var(--stroke); }
.features-blast-block { display: inline-flex; align-items: center; gap: 2px; }
.features-blast-swatch { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--signal-ok); vertical-align: middle; }
.features-blast-swatch.policy { border-top: 2px dashed var(--signal-info); }
.features-blast-swatch.both { border-top: 3px solid var(--signal-crit); }
.features-blast-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--surface-highest); border: 1px solid var(--outline); }
.features-blast-dot.crit { background: var(--signal-crit); }
.features-blast-dot.warn { background: var(--signal-warn); }
.features-blast-dot.info { background: var(--signal-info); }

/* The overlay on 자산 › 네트워크 맵 › 토폴로지: a halo per ring, the rest dimmed. */
.assets-tmap-asset.features-blast-off { opacity: 0.2; }
.assets-tmap-asset.features-blast-on > circle:last-of-type { stroke-width: 3; }
.assets-tmap-asset.features-blast-on.r0 > circle:last-of-type { stroke: var(--signal-live); stroke-width: 4; }
.assets-tmap-asset.features-blast-on.r1 > circle:last-of-type { stroke: var(--signal-crit); }
.assets-tmap-asset.features-blast-on.r2 > circle:last-of-type { stroke: var(--signal-warn); }
.assets-tmap-asset.features-blast-on.r3 > circle:last-of-type { stroke: var(--signal-info); }
.features-blast-count.r1 { color: var(--signal-crit); }
.features-blast-count.r2 { color: var(--signal-warn); }
.features-blast-count.r3 { color: var(--signal-info); }

/* 보안 진단 현황 on the asset page (features/diagnosis.js): one card per check. */
.features-diag {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--gutter);
}
.features-diag-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  min-width: 0;
  padding: var(--sp-md);
  text-align: left;
  color: inherit;
  font: inherit;
  background: var(--glass-1);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-xl);
  cursor: pointer;
}
.features-diag-card:hover { border-color: rgb(var(--accent-rgb) / 0.35); }
.features-diag-card:focus-visible { outline: 2px solid rgb(var(--accent-rgb) / 0.6); outline-offset: 2px; }
.features-diag-card.ok { --diag-c: var(--signal-ok); }
.features-diag-card.warn { --diag-c: var(--signal-warn); }
.features-diag-card.crit { --diag-c: var(--signal-crit); }
/* A state colours the whole card, a faint wash and a full outline. */
.features-diag-card:is(.ok, .warn, .crit) {
  background: color-mix(in srgb, var(--diag-c) 7%, var(--glass-1));
  border-color: color-mix(in srgb, var(--diag-c) 45%, transparent);
}
.features-diag-card:is(.ok, .warn, .crit):hover {
  background: color-mix(in srgb, var(--diag-c) 12%, var(--glass-1));
  border-color: color-mix(in srgb, var(--diag-c) 70%, transparent);
}
.features-diag-card .baseline { align-items: baseline; }
.features-diag-counts { font-size: var(--fs-label-md); line-height: var(--lh-label-md); }
.features-diag-line,
.features-diag-note { overflow-wrap: anywhere; }
