.monitor-overview {
  display: grid;
  grid-template-columns: 1.3fr repeat(5, 1fr);
  gap: 9px;
  margin-bottom: 16px;
}
.overview-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 3px solid #8c98a6;
  background: #f8fafb;
}
.overview-card span,
.overview-card strong {
  display: block;
}
.overview-card span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.overview-card strong {
  margin-top: 7px;
  color: var(--blue);
  font-size: 17px;
}
.overview-card.healthy {
  border-top-color: var(--success);
}
.overview-card.working {
  border-top-color: #2d79aa;
}
.overview-card.warning,
.overview-card.planned,
.overview-card.waiting {
  border-top-color: var(--gold);
}
.overview-card.critical {
  border-top-color: #a33b3b;
  background: #fff8f7;
}
.monitor-alerts {
  margin-bottom: 16px;
}
.monitor-ok,
.alert-banner {
  border-radius: 4px;
  padding: 12px 14px;
}
.monitor-ok {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #205e44;
  background: #eef8f3;
  font-size: 12px;
}
.monitor-ok span,
.live-indicator i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2f9b6c;
  box-shadow: 0 0 0 4px rgba(47, 155, 108, 0.13);
}
.alert-banner {
  display: grid;
  gap: 6px;
  color: #7e2729;
  background: #fff0ef;
  border-left: 4px solid #a33b3b;
}
.monitor-alert {
  font-size: 12px;
}
.agent-list {
  grid-template-columns: 1fr;
}
.agent-card {
  display: block;
  padding: 0;
  overflow: hidden;
  border-left-width: 5px;
}
.agent-card.monitor-stopped {
  border-left-color: #a33b3b;
}
.agent-card.monitor-working {
  border-left-color: #2d79aa;
}
.agent-card.monitor-review,
.agent-card.monitor-warning,
.agent-card.monitor-planned {
  border-left-color: var(--gold);
}
.agent-identity {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.agent-identity img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
}
.agent-identity strong,
.agent-identity small {
  display: block;
}
.agent-identity strong {
  color: var(--blue);
  font:
    500 23px Georgia,
    serif;
}
.agent-identity p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.agent-state {
  display: flex;
  align-items: center;
  gap: 7px;
}
.agent-state i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.monitor-working .agent-state i,
.monitor-working .live-indicator i {
  animation: status-pulse 1.5s infinite;
}
.monitor-planned .agent-state i {
  background: var(--gold);
}
.agent-operation {
  padding: 16px 18px;
}
.operation-reason {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 12px;
}
.stall-diagnosis {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid #e4b4ae;
  border-radius: 8px;
  background: #fff8f7;
  scroll-margin-top: 20px;
}
.stall-diagnosis:focus-visible,
.agent-card-target {
  outline: 3px solid rgba(195, 82, 70, 0.35);
  outline-offset: 3px;
}
.stall-diagnosis header,
.stall-diagnosis-grid {
  display: grid;
  gap: 14px;
}
.stall-diagnosis header {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding-bottom: 11px;
  border-bottom: 1px solid #ecd2cf;
}
.stall-diagnosis header small,
.stall-diagnosis header strong {
  display: block;
}
.stall-diagnosis header small,
.stall-diagnosis dt {
  color: #7e2729;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stall-diagnosis header strong {
  margin-top: 4px;
  color: var(--blue);
}
.stall-diagnosis header > span {
  padding: 5px 9px;
  border-radius: 999px;
  color: #7e2729;
  background: #f6d9d5;
  font-size: 11px;
  font-weight: 700;
}
.stall-diagnosis-grid {
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
  margin-top: 13px;
}
.stall-diagnosis dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.stall-diagnosis dl > div {
  min-width: 0;
}
.stall-diagnosis dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--blue);
  font-size: 12px;
  line-height: 1.45;
}
.stall-recovery {
  padding: 12px 14px;
  border-radius: 6px;
  color: var(--blue);
  background: white;
}
.stall-recovery ol {
  margin: 8px 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
}
.stall-recovery p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}
.agent-system-alert-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.agent-system-alert-link:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.75);
  outline-offset: 4px;
}
.alert-banner-cta {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 5px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.agent-system-alert-link:hover .alert-banner-cta {
  background: rgba(255, 255, 255, 0.15);
}
.health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.health-grid > div {
  padding: 10px;
  border: 1px solid var(--line);
  background: white;
}
.health-grid span,
.health-grid strong {
  display: block;
}
.health-grid span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}
.health-grid strong {
  margin-top: 5px;
  color: var(--blue);
  font-size: 14px;
}
.run-timeline {
  margin-top: 14px;
}
.run-timeline > div:first-child,
.timeline-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}
.timeline-track {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  margin: 8px 0 4px;
}
.timeline-track i {
  height: 14px;
  border-radius: 2px;
  background: #e3e8ed;
}
.timeline-track .success {
  background: #46a878;
}
.timeline-track .failed,
.timeline-track .mixed {
  background: #bd4c50;
}
.timeline-track .running {
  background: #2d79aa;
  animation: status-pulse 1.5s infinite;
}
.agent-output,
.agent-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 14px;
}
.agent-output span {
  font-size: 11px;
}
.agent-output b {
  color: var(--blue);
}
.agent-controls {
  align-items: flex-start;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.agent-controls details {
  flex: 1;
  min-width: 300px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: white;
}
.agent-config-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 12px;
}
@keyframes office-work {
  from {
    width: 35%;
  }
  to {
    width: 95%;
  }
}
@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(45, 121, 170, 0.4);
  }
  50% {
    opacity: 0.65;
    box-shadow: 0 0 0 5px rgba(45, 121, 170, 0);
  }
}

@media (max-width: 1000px) {
  .monitor-overview {
    grid-template-columns: repeat(3, 1fr);
  }
  .office-layout {
    grid-template-columns: 1fr;
  }
  .health-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .agent-config-form {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 620px) {
  .agent-system-alert-link,
  .stall-diagnosis-grid,
  .stall-diagnosis dl {
    grid-template-columns: 1fr;
  }
  .alert-banner-cta {
    justify-self: start;
  }
  .monitor-overview {
    grid-template-columns: 1fr 1fr;
  }
  .office-worker {
    grid-template-columns: 90px 1fr;
  }
  .agent-identity {
    grid-template-columns: 56px 1fr;
  }
  .agent-identity img {
    width: 56px;
    height: 56px;
  }
  .agent-state {
    grid-column: 1 / -1;
  }
  .agent-config-form,
  .member-form {
    grid-template-columns: 1fr;
  }
}
