:root {
  --health-bg: #f7f7f8;
  --health-panel: rgba(255, 255, 255, 0.94);
  --health-border: #eceef2;
  --health-border-strong: #dfe4ea;
  --health-text: #1f2937;
  --health-muted: #6b7280;
  --health-accent: #d61f1f;
  --health-accent-soft: rgba(214, 31, 31, 0.08);
  --health-success: #10b981;
  --health-success-soft: rgba(16, 185, 129, 0.08);
  --health-warning: #d97706;
  --health-warning-soft: rgba(217, 119, 6, 0.08);
  --health-danger: #dc2626;
  --health-danger-soft: rgba(220, 38, 38, 0.1);
  --health-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

body {
  background:
    radial-gradient(circle at top left, rgba(214, 31, 31, 0.06), transparent 24%),
    linear-gradient(180deg, #fafafa 0%, #f4f5f7 100%);
}

.health-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 34px 24px 60px;
}

.health-hero,
.health-hero-actions,
.health-card-head,
.scheduler-actions,
.manual-run-actions,
.recent-runs-toolbar {
  display: flex;
  gap: 14px;
}

.health-hero,
.health-card-head,
.scheduler-actions,
.recent-runs-toolbar {
  align-items: center;
  justify-content: space-between;
}

.health-hero {
  margin-bottom: 28px;
}

.health-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--health-muted);
  font-size: 0.98rem;
  font-weight: 600;
}

.health-hero h1 {
  margin: 10px 0 8px;
  color: #182230;
  font-size: clamp(2.5rem, 3vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.health-hero p,
.section-copy,
.action-needed-head,
.scheduler-muted,
.health-empty-state,
.health-copy,
.recent-runs-footer,
.task-summary-note {
  color: var(--health-muted);
}

.health-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid var(--health-border-strong);
  background: #fff;
  color: #202939;
  font-weight: 700;
}

.health-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.health-button-primary {
  border-color: var(--health-accent);
  background: var(--health-accent);
  color: #fff;
}

.health-button-secondary {
  background: #fff;
  color: #202939;
}

.health-button-outline-danger {
  border-color: rgba(214, 31, 31, 0.35);
  color: var(--health-accent);
  background: #fff;
}

.health-card {
  background: var(--health-panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  box-shadow: var(--health-shadow);
  padding: 20px;
  backdrop-filter: blur(10px);
}

.health-card h2,
.health-card p {
  margin: 0;
}

.health-icon-button {
  border: 0;
  background: transparent;
  color: var(--health-muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
}

.health-top-grid,
.health-middle-grid,
.health-bottom-grid {
  display: grid;
  gap: 18px;
}

.health-top-grid,
.health-middle-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.health-bottom-grid {
  margin-top: 18px;
  grid-template-columns: minmax(0, 1fr);
}

.scheduler-panel,
.latest-run-panel {
  border: 1px solid var(--health-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  margin-top: 18px;
}

.scheduler-panel-main,
.scheduler-panel-stats,
.latest-run-main-grid,
.latest-run-summary-grid {
  display: grid;
}

.scheduler-panel-main {
  grid-template-columns: minmax(0, 1fr) 1px minmax(190px, 240px);
  align-items: stretch;
}

.scheduler-panel-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--health-border);
}

.latest-run-main-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--health-border);
}

.latest-run-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.scheduler-block,
.scheduler-mini-block,
.latest-run-block,
.latest-run-summary-block {
  padding: 16px 18px;
}

.scheduler-divider {
  width: 1px;
  background: var(--health-border);
}

.scheduler-label {
  display: block;
  margin-bottom: 8px;
  color: var(--health-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.scheduler-block strong,
.scheduler-mini-block strong,
.latest-run-block strong,
.latest-run-summary-block strong {
  display: block;
  color: var(--health-text);
  font-size: 1.05rem;
  line-height: 1.25;
}

.scheduler-block strong {
  font-size: 1.1rem;
}

.scheduler-state-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.scheduler-state-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #9ca3af;
}

.scheduler-state-dot[data-tone="success"] {
  background: var(--health-success);
}

.scheduler-state-dot[data-tone="danger"] {
  background: var(--health-danger);
}

.scheduler-state-dot[data-tone="warning"] {
  background: var(--health-warning);
}

.scheduler-actions {
  margin-top: 16px;
}

.scheduler-actions > * {
  flex: 1 1 0;
}

.manual-run-card {
  margin-top: 18px;
}

.manual-run-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.manual-run-toggle-copy {
  display: grid;
  gap: 6px;
}

.manual-run-toggle-copy strong {
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.manual-run-toggle-copy span {
  color: var(--health-muted);
}

.manual-run-chevron {
  color: var(--health-muted);
  font-size: 1.8rem;
}

.manual-run-body[hidden] {
  display: none;
}

.manual-run-body {
  margin-top: 18px;
}

.manual-run-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.field-full {
  grid-column: 1 / -1;
}

.manual-run-actions {
  margin-top: 18px;
}

.manual-run-message {
  margin-top: 16px;
  border-radius: 14px;
  border: 1px solid var(--health-border);
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 16px;
  color: var(--health-muted);
  font-weight: 600;
}

.manual-run-message[data-tone="success"] {
  color: #0f766e;
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.18);
}

.manual-run-message[data-tone="danger"] {
  color: var(--health-danger);
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.2);
}

.task-summary-stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.task-summary-card {
  border: 1px solid var(--health-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 16px;
}

.task-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-summary-head h3 {
  font-size: 1.02rem;
  margin: 0;
}

.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.task-summary-metric {
  border: 1px solid var(--health-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 12px;
}

.task-summary-metric span {
  display: block;
  color: var(--health-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.task-summary-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
}

.task-summary-note {
  margin-top: 12px;
  font-size: 0.92rem;
}

.summary-footer {
  margin-top: 16px;
}

.summary-footer .health-button {
  width: 100%;
}

.action-needed-head {
  margin-top: 14px;
}

.action-needed-head span {
  color: var(--health-muted);
  font-size: 1rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.action-rows,
.success-rows-list {
  display: grid;
  gap: 0;
  margin-top: 16px;
}

.action-row,
.success-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 1fr) minmax(90px, 0.7fr) minmax(150px, 0.9fr);
  gap: 14px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--health-border);
}

.action-row:first-child,
.success-row:first-child {
  border-top: 0;
}

.row-primary {
  display: grid;
  gap: 5px;
}

.row-primary strong {
  font-size: 0.98rem;
}

.row-secondary {
  color: var(--health-muted);
  font-size: 0.88rem;
}

.row-action-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--health-accent);
  font-weight: 700;
}

.successful-rows-panel {
  margin-top: 18px;
  border: 1px solid var(--health-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.successful-rows-panel summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-weight: 700;
}

.successful-rows-panel summary::-webkit-details-marker {
  display: none;
}

.successful-rows-panel summary::after {
  content: "⌄";
  color: var(--health-muted);
}

.successful-rows-panel[open] summary::after {
  content: "⌃";
}

.successful-rows-panel .success-rows-list {
  padding: 0 16px 16px;
  margin-top: 0;
}

.recent-runs-toolbar {
  margin-top: 16px;
  align-items: end;
}

.recent-runs-toolbar .field {
  min-width: 0;
}

.recent-runs-toolbar .health-button {
  min-width: 120px;
}

.recent-runs-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.recent-runs-table {
  width: 100%;
  border-collapse: collapse;
}

.recent-runs-table th,
.recent-runs-table td {
  padding: 16px 12px;
  border-top: 1px solid var(--health-border);
  vertical-align: top;
  text-align: left;
}

.recent-runs-table th {
  color: var(--health-muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.recent-runs-footer {
  padding-top: 16px;
  text-align: center;
}

.recent-run-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recent-run-actions .health-button {
  min-height: 42px;
  padding: 0 18px;
}

.inline-detail-link {
  color: var(--health-accent);
  font-weight: 700;
}

.technical-logs-panel {
  border: 1px solid var(--health-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.technical-logs-panel summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  font-weight: 700;
}

.technical-logs-panel summary::-webkit-details-marker {
  display: none;
}

.technical-logs-panel pre {
  margin: 0;
  border-top: 1px solid var(--health-border);
  padding: 18px;
  overflow: auto;
  background: #171c28;
  color: #e5edf8;
  border-radius: 0 0 16px 16px;
  font-size: 0.84rem;
  line-height: 1.55;
}

.health-empty-state {
  padding: 24px 0;
}

.status-badge[data-tone="warning"] {
  color: #c2410c;
  background: rgba(249, 115, 22, 0.1);
}

.status-badge[data-tone="danger"] {
  color: var(--health-danger);
  background: rgba(220, 38, 38, 0.1);
}

@media (max-width: 1200px) {
  .health-top-grid,
  .health-middle-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .manual-run-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .health-shell {
    padding: 24px 18px 46px;
  }

  .health-hero,
  .recent-runs-toolbar,
  .scheduler-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .scheduler-panel-main,
  .scheduler-panel-stats,
  .latest-run-main-grid,
  .latest-run-summary-grid,
  .task-summary-grid,
  .manual-run-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .scheduler-divider {
    display: none;
  }

  .action-row,
  .success-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
