
/* Watchdog — status bar badge, popover, detail. */

.watchdog-status-button {
  position: relative;
}

.watchdog-status-button.is-all-done {
  color: var(--green, #4ade80);
}

.watchdog-status-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-size: 9px;
  font-weight: 600;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
}

.watchdog-popover {
  position: absolute;
  right: 8px;
  bottom: 32px;
  z-index: 30;
  min-width: 280px;
  max-width: 360px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  padding: 4px;
}

.watchdog-popover-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.watchdog-popover-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.watchdog-popover-row {
  display: flex;
  align-items: center;
  border-radius: 5px;
}

.watchdog-popover-row:hover {
  background: var(--surface-muted, rgba(255, 255, 255, 0.04));
}

.watchdog-popover-row-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.watchdog-popover-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.watchdog-popover-row-name {
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watchdog-popover-row-meta {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watchdog-popover-row-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.watchdog-popover-row-action:hover {
  background: var(--border);
  color: var(--text);
}

.watchdog-state-icon.is-running { color: var(--text-muted); }
.watchdog-state-icon.is-triggered { color: var(--accent); }
.watchdog-state-icon.is-intervening { color: var(--accent); animation: watchdog-pulse 1.2s ease-in-out infinite; }
.watchdog-state-icon.is-completed { color: var(--green, #4ade80); }
.watchdog-state-icon.is-canceled { color: var(--text-muted); }
.watchdog-state-icon.is-error { color: var(--red, #ef4444); }

@keyframes watchdog-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.watchdog-detail {
  position: fixed;
  right: 12px;
  bottom: 56px;
  z-index: 40;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

.watchdog-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.watchdog-detail-name {
  flex: 1 1 auto;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watchdog-detail-state {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.watchdog-detail-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.watchdog-detail-close:hover {
  background: var(--border);
  color: var(--text);
}

.watchdog-detail-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.watchdog-detail-sparkline {
  width: 100%;
  height: 64px;
  display: block;
}

.watchdog-detail-sparkline-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.watchdog-detail-sparkline-tip {
  fill: var(--accent);
}

.watchdog-detail-sparkline-empty {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}

.watchdog-detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 0;
}

.watchdog-detail-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.watchdog-detail-stat dt {
  font-size: 10px;
  color: var(--text-muted);
}

.watchdog-detail-stat dd {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.watchdog-detail-triggers h4 {
  margin: 0 0 4px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.watchdog-detail-triggers ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 120px;
  overflow-y: auto;
}

.watchdog-detail-triggers li {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 3px 0;
}

.watchdog-detail-trigger-time {
  color: var(--text-muted);
}

.watchdog-detail-interventions h4 {
  margin: 0 0 4px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.watchdog-detail-interventions ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
}

.watchdog-detail-interventions li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-left: 2px solid var(--border);
  font-size: 11px;
}

.watchdog-detail-interventions li.is-in-flight {
  border-left-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.watchdog-detail-interventions li.is-ok {
  border-left-color: var(--green, #4ade80);
}

.watchdog-detail-interventions li.is-error {
  border-left-color: var(--red, #ef4444);
}

.watchdog-detail-intervention-time {
  color: var(--text-muted);
  font-size: 10px;
}

.watchdog-detail-intervention-summary {
  line-height: 1.4;
}

.watchdog-detail-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.watchdog-detail-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.watchdog-detail-summary-header h4 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.watchdog-detail-summary-button {
  padding: 3px 8px;
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-muted, transparent);
  color: var(--text);
  cursor: pointer;
}

.watchdog-detail-summary-button:hover:not(:disabled) {
  background: var(--border);
}

.watchdog-detail-summary-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.watchdog-detail-summary-text {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-muted, rgba(255, 255, 255, 0.03));
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.watchdog-detail-summary-empty {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.watchdog-detail-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.watchdog-detail-button {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-muted, transparent);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.watchdog-detail-button:hover {
  background: var(--border);
}

.watchdog-detail-button.is-danger {
  border-color: var(--red, #ef4444);
  color: var(--red, #ef4444);
}

.watchdog-detail-button.is-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.watchdog-approval-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.watchdog-approval-lede {
  margin: 0;
  font-weight: 500;
}

.watchdog-approval-fields {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 12px;
  row-gap: 4px;
  font-size: 12px;
}

.watchdog-approval-fields dt {
  color: var(--text-muted);
}

.watchdog-approval-fields dd {
  margin: 0;
  font-family: var(--font-mono, ui-monospace, "SF Mono", monospace);
}

.watchdog-approval-goal,
.watchdog-approval-tools {
  font-size: 12px;
}

.watchdog-approval-goal strong,
.watchdog-approval-tools strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.watchdog-approval-goal p {
  margin: 0;
}

.watchdog-approval-tools ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.watchdog-approval-tools li code {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-muted, transparent);
  font-size: 11px;
}

.watchdog-approval-tools small {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.watchdog-approval-caps {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted, rgba(255, 255, 255, 0.03));
  font-size: 11px;
  color: var(--text-muted);
}
