/* Monitor workspace — inspector-style lists inspired by replay player */

.monitor-workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  flex: 1;
}

.monitor-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fff 0%, var(--shell-elevated) 100%);
  box-shadow: var(--shadow-xs);
}

.monitor-context-copy h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--shell-text);
}

.monitor-context-copy p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--shell-muted);
  max-width: 56ch;
  line-height: 1.45;
}

.monitor-kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.monitor-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 108px;
  padding: 10px 14px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.monitor-kpi:hover {
  border-color: var(--accent-muted);
  box-shadow: var(--shadow-xs);
}

.monitor-kpi.is-accent { border-color: var(--accent-muted); background: var(--accent-soft); }
.monitor-kpi.is-danger { border-color: var(--danger-border); background: var(--danger-soft); }
.monitor-kpi.is-success { border-color: var(--success-border); background: var(--success-soft); }
.monitor-kpi.is-warn { border-color: var(--warn-border); background: var(--warn-soft); }

.monitor-kpi-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.monitor-kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--shell-text);
}

.monitor-kpi-sub {
  font-size: 0.68rem;
  color: var(--shell-muted);
}

.monitor-command-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-panel);
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.monitor-command-bar .search-wrap {
  flex: 1;
  min-width: 220px;
  margin-bottom: 0;
}

.monitor-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.monitor-filter-pill {
  padding: 6px 12px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-full);
  background: var(--shell-elevated);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--shell-muted);
  cursor: pointer;
  transition: all 0.12s;
}

.monitor-filter-pill:hover {
  border-color: var(--accent-muted);
  color: var(--shell-accent);
}

.monitor-filter-pill.is-active {
  border-color: var(--accent-muted);
  background: var(--shell-active);
  color: var(--shell-accent);
}

/* Data pane — replay inspector list style */
.data-pane {
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-md);
  background: var(--shell-panel);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.data-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--shell-border);
  background: var(--shell-elevated);
}

.data-pane-head h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--shell-text);
}

.data-pane-head p,
.data-pane-meta {
  margin: 0;
  font-size: 0.72rem;
  color: var(--shell-muted);
}

.data-list {
  display: flex;
  flex-direction: column;
  max-height: min(68vh, 720px);
  overflow: auto;
  scrollbar-width: thin;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--shell-border);
  transition: background 0.12s;
}

.data-row:last-child { border-bottom: none; }

.data-row:hover {
  background: rgba(79, 70, 229, 0.04);
}

.data-row.is-live {
  background: linear-gradient(90deg, var(--success-soft) 0%, transparent 55%);
  border-left: 3px solid var(--success);
  padding-left: 11px;
}

.data-row.is-danger {
  border-left: 3px solid var(--danger);
  padding-left: 11px;
}

.data-row.is-warn {
  border-left: 3px solid var(--warn);
  padding-left: 11px;
}

.data-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.data-row-id {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--shell-accent);
  word-break: break-all;
}

.data-row-time {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--shell-muted);
}

.data-row-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--shell-text);
  line-height: 1.35;
  word-break: break-word;
}

.data-row-meta {
  margin-top: 3px;
  font-size: 0.72rem;
  color: var(--shell-muted);
  line-height: 1.4;
}

.data-row-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.data-row-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.data-row-risk {
  display: flex;
  align-items: center;
  gap: 8px;
}

.risk-ring {
  --risk-pct: 50;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: conic-gradient(var(--danger) calc(var(--risk-pct) * 1%), var(--surface-dim) 0);
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--danger);
}

.risk-ring::before {
  content: '';
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--shell-panel);
}

.risk-ring span {
  position: absolute;
  font-size: 0.62rem;
  font-weight: 800;
}

.data-empty,
.data-loading,
.data-error {
  padding: 48px 24px;
  text-align: center;
  color: var(--shell-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.data-error { color: var(--danger); }

.probe-type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.probe-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  border: 1px solid #c4b5fd;
  background: #f5f3ff;
  color: #6d28d9;
}

.probe-chip.is-devtools { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.probe-chip.is-eval { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.probe-chip.is-script { border-color: #fdba74; background: #fff7ed; color: #c2410c; }

/* Settings drawer — tuck install/config away */
.monitor-settings-drawer {
  margin-bottom: 14px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-md);
  background: var(--shell-panel);
  overflow: hidden;
}

.monitor-settings-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--shell-text);
  list-style: none;
  background: var(--shell-elevated);
  user-select: none;
}

.monitor-settings-drawer summary::-webkit-details-marker { display: none; }

.monitor-settings-drawer summary::after {
  content: '▾';
  color: var(--shell-muted);
  font-size: 0.9rem;
  transition: transform 0.15s;
}

.monitor-settings-drawer[open] summary::after {
  transform: rotate(180deg);
}

body.settings-drawer-open .monitor-settings-drawer {
  display: block !important;
  border-color: var(--shell-accent, #2563eb);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--shell-accent, #2563eb) 25%, transparent);
}

.topbar-actions .btn.is-active {
  border-color: var(--shell-accent, #2563eb);
  background: color-mix(in srgb, var(--shell-accent, #2563eb) 12%, transparent);
}

.monitor-settings-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.monitor-settings-body .panel {
  margin: 0;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
}

.view-only-sessions,
.view-only-pages,
.view-only-incidents,
.view-only-probes,
.view-only-settings {
  display: none !important;
}

body[data-monitor-view="sessions"] .view-only-sessions { display: flex !important; }
body[data-monitor-view="pages"] .view-only-pages { display: flex !important; }
body[data-monitor-view="incidents"] .view-only-incidents { display: flex !important; }
body[data-monitor-view="probes"] .view-only-probes { display: flex !important; }
body[data-monitor-view="settings"] .view-only-settings { display: flex !important; }

body[data-monitor-view="pages"] #stats,
body[data-monitor-view="pages"] #fluid-analytics,
body[data-monitor-view="incidents"] #stats,
body[data-monitor-view="incidents"] #fluid-analytics,
body[data-monitor-view="probes"] #stats,
body[data-monitor-view="probes"] #fluid-analytics,
body[data-monitor-view="settings"] #stats,
body[data-monitor-view="settings"] #fluid-analytics,
body[data-monitor-view="settings"] #live-banner,
body[data-monitor-view="settings"] #attention-panel {
  display: none !important;
}

/* ── Site settings view ───────────────────────────────────── */

.settings-workspace {
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.settings-status-strip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-panel);
  font-size: 0.76rem;
  color: var(--shell-text-secondary);
}

.settings-status-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--shell-accent);
  box-shadow: 0 0 0 3px var(--shell-active);
}

.settings-status-text {
  font-weight: 600;
  color: var(--shell-text);
}

.settings-status-meta {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--shell-muted);
}

.settings-layout {
  display: grid;
  gap: 12px;
  padding-bottom: 8px;
}

.settings-layout .panel {
  margin: 0;
}

body[data-monitor-view="settings"] .page-content.monitor-workspace {
  overflow-y: auto;
}

body[data-monitor-view="settings"] .topbar-actions .btn.is-active {
  border-color: var(--shell-accent, #2563eb);
  background: color-mix(in srgb, var(--shell-accent, #2563eb) 12%, transparent);
}

body[data-monitor-view="settings"] #view-settings.is-active {
  background: var(--shell-active);
  color: var(--shell-accent);
}

.incident-queue-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  border: 1px solid var(--shell-border);
}

.incident-queue-tab {
  padding: 6px 14px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--shell-muted);
  cursor: pointer;
  transition: all 0.12s;
}

.incident-queue-tab:hover { color: var(--shell-text); }

.incident-queue-tab.is-active {
  background: var(--shell-panel);
  color: var(--shell-accent);
  box-shadow: var(--shadow-xs);
}

.incident-queue-tab .count {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--shell-active);
  font-size: 0.65rem;
  font-weight: 800;
}

@media (max-width: 900px) {
  .data-row {
    grid-template-columns: 1fr;
  }
  .data-row-actions {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: flex-end;
  }
}
