/* MS3404 — master event dashboard (MS3404-62).
   Built for a second monitor: larger type than the operator dashboard, glanceable
   from a distance, and it scrolls (styles.css locks body for the main app). */

.event-body {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

.event-body .header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: auto;
  min-height: 3rem;
  flex-wrap: wrap;
  padding-block: var(--space-xs);
}

.header-back {
  font-size: var(--text-xs);
  color: var(--accent);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
}
.header-back:hover { color: var(--accent-strong); border-color: var(--accent); }
.header-back:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.event-main {
  flex: 1;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ---- Hero KPIs ---- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.kpi-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 2.75rem;
  line-height: 1.1;
  color: var(--text-primary);
}
.kpi-value .unit { font-size: var(--text-xl); color: var(--text-muted); }
.kpi-value.error   { color: var(--error); }
.kpi-value.success { color: var(--success); }
.kpi-value.accent  { color: var(--accent); }

.kpi-label {
  margin-top: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kpi-sub { margin-top: var(--space-2xs); font-size: var(--text-xs); color: var(--text-subtle); }

/* ---- Grid ---- */
.event-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  align-items: start;
}

.event-wide { grid-column: 1 / -1; }

.event-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.card-head-meta { color: var(--text-subtle); }

.card-lead {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

/* ---- Agent 365 flow ---- */
.brand { display: flex; align-items: center; gap: var(--space-sm); }
.brand-logo { width: 1.25rem; height: 1.25rem; }
.brand-title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); }
.brand-badge {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 0.375rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}

.agent-flow { list-style: none; display: flex; flex-direction: column; gap: var(--space-xs); }

.agent-step {
  display: grid;
  grid-template-columns: 1.75rem 1fr auto;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm);
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-left: 2px solid var(--surface-border);
  border-radius: var(--radius-md);
}
.agent-step[data-live="true"] { border-left-color: var(--accent); }

.agent-step-num {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--surface-border);
  color: var(--text-muted);
}
.agent-step[data-live="true"] .agent-step-num { background: var(--accent); color: var(--bg); }

.agent-step-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.agent-step-service { font-size: var(--text-xs); color: var(--text-subtle); }

.agent-step-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-base);
  color: var(--accent);
  white-space: nowrap;
}
.agent-step-count .of { color: var(--text-subtle); font-size: var(--text-xs); }

/* ---- Outcomes ---- */
.outcome-list { display: flex; flex-direction: column; gap: var(--space-xs); }

.outcome-row {
  display: grid;
  grid-template-columns: 0.75rem 1fr auto;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm);
  background: var(--surface-raised);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.outcome-dot { width: 0.625rem; height: 0.625rem; border-radius: var(--radius-full); background: var(--text-subtle); }
.outcome-dot.terminated { background: var(--error); }
.outcome-dot.monetised  { background: var(--success); }
.outcome-dot.subscribed { background: var(--accent); }
.outcome-dot.flagged    { background: var(--warning); }
.outcome-dot.challenged { background: var(--accent-strong); }

.outcome-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }

.stat {
  padding: var(--space-sm);
  background: var(--surface-raised);
  border-radius: var(--radius-md);
}
.stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xl);
  color: var(--text-primary);
}
.stat-label { font-size: var(--text-xs); color: var(--text-subtle); }

/* ---- Bar lists (campaigns / regions) ---- */
.bar-list { display: flex; flex-direction: column; gap: var(--space-sm); }

.bar-row { display: grid; gap: var(--space-2xs); }
.bar-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: var(--text-sm);
}
.bar-name { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--error);
  white-space: nowrap;
}
.bar-track { height: 0.375rem; background: var(--surface-border); border-radius: var(--radius-full); overflow: hidden; }
.bar-fill {
  height: 100%;
  background: var(--error);
  border-radius: var(--radius-full);
  transition: width var(--duration-medium) var(--ease);
}
.bar-sub { font-size: var(--text-xs); color: var(--text-subtle); }

/* ---- Sessions table ---- */
.table-scroll { overflow-x: auto; max-height: 40vh; overflow-y: auto; }

.event-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.event-table th {
  position: sticky;
  top: 0;
  background: var(--surface);
  text-align: left;
  font-weight: 500;
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: var(--space-sm) var(--space-sm);
  border-bottom: 1px solid var(--surface-border);
}
.event-table td {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--surface-border);
  color: var(--text-primary);
}
.event-table tr:hover td { background: var(--surface-raised); }
.event-table .right { text-align: right; }
.event-table .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.event-table a { color: var(--accent); text-decoration: none; }
.event-table a:hover { color: var(--accent-strong); text-decoration: underline; }

.pill {
  display: inline-block;
  padding: 2px 0.5rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.pill.detected   { background: var(--warning); color: var(--bg); }
.pill.intervening{ background: var(--accent-soft); color: var(--accent); }
.pill.terminated { background: var(--error); color: var(--text-primary); }
.pill.monetised,
.pill.subscribed { background: var(--success); color: var(--bg); }
.pill.flagged    { background: var(--warning); color: var(--bg); }
.pill.challenged { background: var(--accent-soft); color: var(--accent-strong); }

/* Same pirate origin IP seen on an earlier feed (MS3404-67) */
.repeat-ip {
  display: inline-block;
  margin-left: var(--space-xs);
  padding: 1px 0.375rem;
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--error);
  white-space: nowrap;
}

/* ---- Origin map ---- */
.event-map {
  width: 100%;
  height: 46vh;
  min-height: 21.25rem;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
}

.map-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.map-legend-row .map-legend-item { display: flex; align-items: center; gap: var(--space-xs); }

/* ---- Live feed ---- */
.feed { list-style: none; max-height: 34vh; overflow-y: auto; }

.feed-row {
  display: grid;
  grid-template-columns: 5rem 6.875rem 1fr;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--surface-border);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.feed-time { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-subtle); }
.feed-stream { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); }
.feed-text { color: var(--text-muted); }
.feed-text strong { color: var(--text-primary); font-weight: 500; }
.feed-row[data-status="BLOCKED"] .feed-text strong { color: var(--error); }
.feed-row[data-status="WARNING"] .feed-text strong { color: var(--warning); }
.feed-row[data-status="SUCCESS"] .feed-text strong { color: var(--success); }

.empty { padding: var(--space-md); font-size: var(--text-sm); color: var(--text-subtle); }

/* Single monitor / narrower projector */
@media (max-width: 1500px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .event-grid { grid-template-columns: 1fr; }
  .event-wide { grid-column: auto; }
}
