/* ─────────────────────────────────────────────────────────────────────────
 * v5-integrations.css — ATLAS Integrations page V5 (data-view="integrations")
 *
 * Health of all connected systems + per-connection configure panel.
 * Replaces the legacy .w424-conn stub rendering with a card-grid + health
 * overview strip + events timeline + slide-in configure panel.
 *
 * THEME: every color is a shared token (--panel, --panel2, --border, --border2,
 *   --accent / --accent-rgb, --good / --good-rgb, --warn, --bad, --text /
 *   --text-dim / --text-muted, --mono, --sans, --display, --rad). Light + dark
 *   both work because the tokens swap at :root. No literal theme colors here
 *   except the per-status accent fallbacks (which read fine on both themes).
 *
 * DATA INTEGRITY: status is DERIVED from real probes this session (did the
 *   connector answer?) or honest "—" / "not configured" — never asserted.
 *
 * NO SCROLL RULE: the page body scrolls internally (.w424-body already does);
 *   the outer 1080px frame never scrolls. The configure panel is fixed-position
 *   and scrolls its own content.
 *
 * Prefix: .int5-*   (V5 Integrations — distinct from legacy .w424-conn / .w426-)
 * ───────────────────────────────────────────────────────────────────────── */

/* ── Page body layout ───────────────────────────────────────────────────── */
.int5-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Header health summary chip ─────────────────────────────────────────── */
.int5-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text-dim);
  transition: color .2s, border-color .2s, background .2s;
}
.int5-summary-chip.is-ok {
  color: var(--good);
  border-color: rgba(var(--good-rgb), .4);
  background: rgba(var(--good-rgb), .1);
}
.int5-summary-chip.is-warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 42%, transparent);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}
.int5-summary-chip .int5-summary-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}

/* ── Health overview strip ──────────────────────────────────────────────── */
.int5-health {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 26px;
  border-radius: var(--rad);
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--good) 9%, var(--panel)) 0%,
      var(--panel) 60%);
  overflow: hidden;
  transition: border-color .25s, background .25s;
}
.int5-health.is-warn {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--warn) 11%, var(--panel)) 0%,
      var(--panel) 60%);
  border-color: color-mix(in srgb, var(--warn) 32%, var(--border));
}
.int5-health.is-bad {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--bad) 11%, var(--panel)) 0%,
      var(--panel) 60%);
  border-color: color-mix(in srgb, var(--bad) 32%, var(--border));
}
/* Faint scanning glow on the left edge */
.int5-health::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--good);
  box-shadow: 0 0 18px 2px rgba(var(--good-rgb), .5);
}
.int5-health.is-warn::before { background: var(--warn); box-shadow: 0 0 18px 2px color-mix(in srgb, var(--warn) 60%, transparent); }
.int5-health.is-bad::before  { background: var(--bad);  box-shadow: 0 0 18px 2px color-mix(in srgb, var(--bad) 60%, transparent); }

.int5-health-icon {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  flex-shrink: 0;
  border-radius: 16px;
  font-size: 26px;
  color: var(--good);
  background: rgba(var(--good-rgb), .12);
  border: 1px solid rgba(var(--good-rgb), .3);
}
.int5-health.is-warn .int5-health-icon { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 34%, transparent); }
.int5-health.is-bad  .int5-health-icon { color: var(--bad);  background: color-mix(in srgb, var(--bad) 14%, transparent);  border-color: color-mix(in srgb, var(--bad) 34%, transparent); }

.int5-health-main { flex: 1; min-width: 0; }
.int5-health-title {
  font-family: var(--display, var(--sans));
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--text);
  line-height: 1.1;
}
.int5-health-sub {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}
.int5-health-actions { flex-shrink: 0; }
.int5-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel2);
  cursor: pointer;
  transition: border-color .14s, background .14s, transform .12s;
}
.int5-refresh-btn:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), .08); transform: translateY(-1px); }
.int5-refresh-btn:active { transform: translateY(0); }
.int5-refresh-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.int5-refresh-btn svg { width: 14px; height: 14px; transition: transform .5s ease; }
.int5-refresh-btn.is-spinning svg { transform: rotate(360deg); }

/* ── Section labels ─────────────────────────────────────────────────────── */
.int5-section-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 4px 2px 0;
}

/* ── Integration cards grid ─────────────────────────────────────────────── */
.int5-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.int5-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px 16px 14px 18px;
  border-radius: var(--rad);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  background: var(--panel);
  transition: border-color .16s, transform .14s, box-shadow .16s;
}
.int5-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,.22);
  border-left-color: var(--accent);
}
/* Colored left border by status */
.int5-card[data-status="live"]   { border-left-color: var(--good); }
.int5-card[data-status="warn"]   { border-left-color: var(--warn); }
.int5-card[data-status="error"]  { border-left-color: var(--bad); }
.int5-card[data-status="off"]    { border-left-color: var(--text-muted); }
.int5-card[data-status="check"]  { border-left-color: var(--accent); }

.int5-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}
/* Logo placeholder — square colored badge with service initial */
.int5-logo {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  font-family: var(--display, var(--sans));
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  background: rgba(var(--accent-rgb), .12);
  border: 1px solid rgba(var(--accent-rgb), .28);
  text-transform: uppercase;
}
.int5-card-titles { flex: 1; min-width: 0; }
.int5-card-name {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.int5-card-cat {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Status line: pulse dot + label + last ping */
.int5-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.int5-status-label { font-weight: 700; }
.int5-card[data-status="live"]  .int5-status-label { color: var(--good); }
.int5-card[data-status="warn"]  .int5-status-label { color: var(--warn); }
.int5-card[data-status="error"] .int5-status-label { color: var(--bad); }
.int5-card[data-status="off"]   .int5-status-label { color: var(--text-muted); }
.int5-card[data-status="check"] .int5-status-label { color: var(--accent); }
.int5-status-sep { opacity: .4; }
.int5-status-ping { color: var(--text-muted); }

/* Animated pulse dot */
.int-pulse-dot {
  position: relative;
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.int-pulse-dot.is-live  { background: var(--good); }
.int-pulse-dot.is-warn  { background: var(--warn); }
.int-pulse-dot.is-error { background: var(--bad); }
.int-pulse-dot.is-off   { background: var(--text-muted); }
.int-pulse-dot.is-check { background: var(--accent); }
/* Pulse ring — only for live + check (active) states */
.int-pulse-dot.is-live::after,
.int-pulse-dot.is-check::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: inherit;
  opacity: .55;
  animation: int5-pulse 2s cubic-bezier(.4,0,.6,1) infinite;
}
.int-pulse-dot.is-check::after { animation-duration: 1.1s; }
@keyframes int5-pulse {
  0%   { transform: scale(.6); opacity: .55; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .int-pulse-dot.is-live::after,
  .int-pulse-dot.is-check::after { animation: none; opacity: .35; }
  .int5-refresh-btn svg { transition: none; }
}

.int5-card-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  line-height: 1.45;
  min-height: 14px;
}
.int5-card-url {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card action buttons */
.int5-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 3px;
  padding-top: 11px;
  border-top: 1px solid var(--border2);
}
.int5-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--text-dim);
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: color .12s, border-color .12s, background .12s;
}
.int5-act:hover { color: var(--text); border-color: var(--accent); background: rgba(var(--accent-rgb), .07); }
.int5-act:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.int5-act.is-primary { color: var(--accent); border-color: rgba(var(--accent-rgb), .4); }
.int5-act svg { width: 11px; height: 11px; }

/* ── Recent events feed (timeline) ──────────────────────────────────────── */
.int5-events {
  border: 1px solid var(--border);
  border-radius: var(--rad);
  background: var(--panel);
  padding: 6px 4px;
}
.int5-event {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border2);
}
.int5-event:last-child { border-bottom: 0; }
.int5-event-ico {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  flex-shrink: 0;
  border-radius: 7px;
  font-size: 11px;
  margin-top: 1px;
}
.int5-event-ico.is-ok    { color: var(--good); background: rgba(var(--good-rgb), .13); }
.int5-event-ico.is-info  { color: var(--accent); background: rgba(var(--accent-rgb), .12); }
.int5-event-ico.is-warn  { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.int5-event-ico.is-error { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.int5-event-body { flex: 1; min-width: 0; }
.int5-event-line {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  line-height: 1.4;
}
.int5-event-src { font-weight: 700; color: var(--text-dim); }
.int5-event-ts {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.int5-empty {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 14px 16px;
  text-align: center;
}

/* ── Configure slide-in panel ───────────────────────────────────────────── */
.int5-cfg-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s;
  z-index: 1200;
}
.int5-cfg-scrim.is-open { opacity: 1; pointer-events: auto; }

.int5-cfg {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 48px rgba(0,0,0,.4);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  z-index: 1201;
}
.int5-cfg.is-open { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .int5-cfg { transition: none; }
  .int5-cfg-scrim { transition: none; }
}

.int5-cfg-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.int5-cfg-head .int5-logo { width: 42px; height: 42px; font-size: 18px; }
.int5-cfg-titles { flex: 1; min-width: 0; }
.int5-cfg-name {
  font-family: var(--display, var(--sans));
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}
.int5-cfg-cat {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
}
.int5-cfg-close {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.int5-cfg-close:hover { color: var(--text); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.int5-cfg-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.int5-cfg-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.int5-cfg-field { display: flex; flex-direction: column; gap: 6px; }
.int5-cfg-flabel {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.int5-cfg-fval {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  word-break: break-all;
}
.int5-cfg-fval.is-dim { color: var(--text-muted); }

/* Status pill in panel */
.int5-cfg-statusrow {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel2);
}
.int5-cfg-status-txt { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-dim); }

/* Freshness indicator bar */
.int5-fresh {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.int5-fresh-bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--panel2);
  overflow: hidden;
}
.int5-fresh-bar span {
  display: block;
  height: 100%;
  background: var(--good);
  border-radius: 3px;
}
.int5-fresh-bar.is-stale span { background: var(--warn); }
.int5-fresh-bar.is-none span  { background: var(--text-muted); }

.int5-cfg-test {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-rgb), .4);
  background: rgba(var(--accent-rgb), .07);
  cursor: pointer;
  transition: background .14s, transform .12s;
}
.int5-cfg-test:hover { background: rgba(var(--accent-rgb), .14); transform: translateY(-1px); }
.int5-cfg-test:active { transform: translateY(0); }
.int5-cfg-test:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.int5-cfg-note {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px dashed var(--border);
  background: var(--panel2);
}
.int5-cfg-note strong { color: var(--text-dim); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .int5-grid { grid-template-columns: 1fr; }
  .int5-health { flex-direction: column; align-items: flex-start; gap: 14px; }
  .int5-health-actions { width: 100%; }
  .int5-refresh-btn { width: 100%; justify-content: center; }
}
