/* ═══════════════════════════════════════════════════════════════════════════
   DΛREΛKT_ SHARED — Command-Centre chrome
   Everything scoped under .gns-cc (added by applyCommandCentre) so it only
   dresses pages that opt in. Pairs with commandcentre.js. Load app-wide via the
   app.json shell css array. All motion honours prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

.gns-cc { position: relative; }

/* ─── app-wide data-rain backdrop ──────────────────────────────────────────── */
.gns-cc > .ha-apprain {
  position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%;
  pointer-events: none; user-select: none;
  color: var(--ha-ok, #22c55e);
  opacity: 0.8;
}
.gns-cc > *:not(.ha-apprain) { position: relative; z-index: 1; }

/* ─── HUD console framing on the hero ──────────────────────────────────────── */
.gns-cc .gns-hero,
.gns-cc [data-cc-hero] { position: relative; }
.gns-cc .ha-hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.gns-cc .ha-hud__c {
  position: absolute; width: 20px; height: 20px;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--ha-accent) 50%, transparent));
  opacity: 0; animation: ha-hud-in 0.5s ease-out 0.2s forwards;
}
.gns-cc .ha-hud__c--tl { top: 9px; left: 9px;   border-top: 2px solid color-mix(in srgb, var(--ha-accent) 85%, transparent); border-left: 2px solid color-mix(in srgb, var(--ha-accent) 85%, transparent); }
.gns-cc .ha-hud__c--tr { top: 9px; right: 9px;  border-top: 2px solid color-mix(in srgb, var(--ha-accent) 85%, transparent); border-right: 2px solid color-mix(in srgb, var(--ha-accent) 85%, transparent); }
.gns-cc .ha-hud__c--bl { bottom: 9px; left: 9px;  border-bottom: 2px solid color-mix(in srgb, var(--ha-accent) 85%, transparent); border-left: 2px solid color-mix(in srgb, var(--ha-accent) 85%, transparent); }
.gns-cc .ha-hud__c--br { bottom: 9px; right: 9px; border-bottom: 2px solid color-mix(in srgb, var(--ha-accent) 85%, transparent); border-right: 2px solid color-mix(in srgb, var(--ha-accent) 85%, transparent); }
@keyframes ha-hud-in { from { opacity: 0; transform: scale(1.6); } to { opacity: 1; transform: scale(1); } }
.gns-cc .ha-hud__scan {
  position: absolute; left: 6px; right: 6px; top: 4px; height: 2px;
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--ha-accent) 75%, transparent) 25%,
    color-mix(in srgb, var(--ha-accent) 75%, transparent) 75%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--ha-accent) 55%, transparent);
  opacity: 0; animation: ha-hud-scan 5.5s ease-in-out 1s infinite;
}
@keyframes ha-hud-scan {
  0%   { top: 4px;  opacity: 0; }
  9%   { opacity: 0.75; }
  50%  { opacity: 0.45; }
  91%  { opacity: 0.7; }
  100% { top: calc(100% - 4px); opacity: 0; }
}

/* ─── SIGNAL RULE (was: the vital pulse EKG strip) ───────────────────────────
   The engraved horizon line under the hero: tag · hairline · mono readout.
   No box, no border, no synthetic heartbeat — the strip joins the console
   grammar instead of sitting on it. Alarm-only light: healthy = quiet
   accent-family engraving; warn/down recolor the tag AND the line. */
.gns-cc .ha-vitals {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 0.85rem;
  margin: 0.55rem 0 1.1rem; padding: 0;
  border: 0; border-radius: 0; background: none; overflow: hidden;
}
.gns-cc .ha-vitals__tag {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--gns-mono, ui-monospace, monospace);
  font-size: 0.6rem; letter-spacing: 0.18em; font-weight: 700;
  color: color-mix(in srgb, var(--ha-accent) 55%, var(--ha-text-muted));
  white-space: nowrap;
}
.gns-cc .ha-vitals--warn .ha-vitals__tag { color: var(--ha-warn); }
.gns-cc .ha-vitals--down .ha-vitals__tag { color: var(--ha-danger); }
.gns-cc .ha-vitals__rule {
  flex: 1 1 auto; min-width: 0; height: 1px; align-self: center;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--ha-accent) 32%, var(--ha-border-hi, var(--ha-border))),
    var(--ha-border-hi, var(--ha-border)) 55%,
    transparent);
}
.gns-cc .ha-vitals--warn .ha-vitals__rule {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--ha-warn) 60%, transparent), transparent);
}
.gns-cc .ha-vitals--down .ha-vitals__rule {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--ha-danger) 65%, transparent), transparent);
}
/* Legacy EKG canvas (deploy-skew guard: old cached commandcentre.js may still
   inject it) — lays out as a flat invisible line instead of a 40px band. */
.gns-cc .ha-vital { flex: 1 1 auto; min-width: 0; height: 1px; display: block; opacity: 0; }
.gns-cc .ha-vitals__read {
  font-family: var(--gns-mono, ui-monospace, monospace);
  font-size: 0.62rem; letter-spacing: 0.06em; color: var(--ha-text-muted);
  white-space: nowrap;
}

/* ─── card cohesion — every standard atom card wears the module skin ───────── */
/* LIVE cards (metric readouts): vertical data-stream grid + solid edge. */
.gns-cc .gns-kpi,
.gns-cc .ui-statuspanel__cell,
.gns-cc .ui-statusgrid__tile {
  position: relative; overflow: hidden;
  background:
    linear-gradient(158deg, color-mix(in srgb, var(--ha-surface) 88%, transparent), color-mix(in srgb, var(--ha-bg) 55%, transparent)),
    repeating-linear-gradient(90deg, transparent 0 13px, color-mix(in srgb, var(--ha-accent) 6%, transparent) 13px 14px) !important;
  border: 1px solid color-mix(in srgb, var(--ha-accent) 16%, var(--ha-border-hi, var(--ha-border))) !important;
}
/* STATIC cards (reference / actions): dot-grid blueprint + dashed edge. */
.gns-cc .ui-statcardgrid__card {
  position: relative; overflow: hidden;
  background:
    radial-gradient(color-mix(in srgb, var(--ha-accent) 12%, transparent) 1px, transparent 1.5px) 0 0 / 13px 13px,
    linear-gradient(158deg, color-mix(in srgb, var(--ha-surface) 80%, transparent), color-mix(in srgb, var(--ha-bg) 48%, transparent)) !important;
  border: 1px dashed color-mix(in srgb, var(--ha-accent) 20%, var(--ha-border-hi, var(--ha-border))) !important;
}
/* HUD corner tick on the live cards (::before is free on gns-kpi) */
.gns-cc .gns-kpi::before,
.gns-cc .ui-statusgrid__tile::before {
  content: ""; position: absolute; top: 6px; right: 6px; width: 9px; height: 9px;
  border-top: 1.5px solid color-mix(in srgb, var(--ha-accent) 42%, transparent);
  border-right: 1.5px solid color-mix(in srgb, var(--ha-accent) 42%, transparent);
  pointer-events: none; z-index: 2;
}

/* ─── shared command-console rows ──────────────────────────────────────────── */
/* The row + bar vocabulary itself (.gns-crow*, .gns-bar*, @keyframes
   gns-crow-led) MOVED to /tools/modules/ui.atom.consolerow/ui.atom.consolerow.css
   — one source of truth, loaded by the atom's ensureCss() and listed in each
   app.json css[] immediately after this file so the head order (and therefore
   every equal-specificity page override) is unchanged.
   .gns-clist stays here: it is a HOST container class, never emitted by
   consoleRow(). */
.gns-cc .gns-clist { display: flex; flex-direction: column; gap: 0.4rem; }

@media (prefers-reduced-motion: reduce) {
  .gns-cc .ha-hud__c { opacity: 1; animation: none; }
  .gns-cc .ha-hud__scan { display: none; }
}
