:root {
  --pm-bg: #f5f2ea;
  --pm-surface: rgba(255, 255, 255, 0.72);
  --pm-surface-strong: #fffdf8;
  --pm-ink: #18312c;
  --pm-muted: #5f6f68;
  --pm-line: rgba(24, 49, 44, 0.12);
  --pm-ok: #2f7d4c;
  --pm-warn: #c48b18;
  --pm-fail: #be4a2f;
  --pm-unreachable: #7c3aed;
  --pm-stale: #6b7280;
}

html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  color: var(--pm-ink);
  background:
    radial-gradient(circle at top left, rgba(36, 91, 76, 0.14), transparent 32%),
    radial-gradient(circle at top right, rgba(196, 139, 24, 0.12), transparent 28%),
    linear-gradient(180deg, #f6f3ec 0%, #ece6da 100%);
  font-family: Georgia, "Times New Roman", serif;
}

a {
  color: #1f5f51;
  text-decoration: none;
}

a:hover {
  color: #143c33;
}

.dashboard-hero,
.details-hero,
.auth-panel__card,
.empty-state-panel,
.host-card,
.details-panel,
.metric-card,
.notice {
  background: var(--pm-surface);
  border: 1px solid var(--pm-line);
  box-shadow: 0 18px 40px rgba(24, 49, 44, 0.08);
  backdrop-filter: blur(10px);
}

.dashboard-hero,
.details-hero,
.auth-panel__card {
  border-radius: 28px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.dashboard-hero h1,
.details-hero h1,
.auth-panel__card h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  margin: 0.35rem 0 0.75rem;
}

.dashboard-hero p,
.details-hero p,
.auth-panel__lead,
.panel-empty,
.table-subtle,
.host-card__meta,
.metric-label,
.eyebrow,
.facts-list {
  color: var(--pm-muted);
}

.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
}

.host-grid,
.metrics-grid,
.details-grid,
.auth-panel {
  display: grid;
  gap: 1rem;
}

.host-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 1.5rem;
}

.details-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-bottom: 1.5rem;
}

.details-grid--history {
  align-items: start;
}

.auth-panel {
  min-height: calc(100vh - 240px);
  place-items: center;
}

.auth-panel__card {
  width: min(100%, 520px);
}

.auth-form {
  margin-top: 1.25rem;
}

.auth-panel__submit {
  min-width: 220px;
}

.host-card,
.details-panel,
.metric-card,
.empty-state-panel {
  border-radius: 24px;
  padding: 1.25rem;
}

.details-panel--scroll {
  display: flex;
  flex-direction: column;
}

.details-panel__scroll-body {
  /* Внутренняя прокрутка не даёт блоку истории запусков растягивать всю карточку PACS. */
  overflow: auto;
  max-height: 440px;
  margin-top: 0.75rem;
}

.form-panel {
  max-width: 880px;
}

.settings-form {
  max-width: 720px;
}

.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.host-card__header,
.details-hero {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}

.host-card__title-row,
.step-list__header,
.run-summary {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.host-card__title-row h2,
.details-panel h2 {
  margin: 0;
}

.host-card__heartbeat {
  min-width: 170px;
  text-align: right;
}

.pacs-table-wrap {
  overflow-x: auto;
}

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

.pacs-table th,
.pacs-table td {
  padding: 0.8rem 0.55rem;
  border-bottom: 1px solid var(--pm-line);
  vertical-align: top;
}

.pacs-table th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pm-muted);
}

.pacs-link {
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-status,
.status-pill--ok {
  color: var(--pm-ok);
}

.status-pill--warn {
  color: var(--pm-warn);
}

.status-pill--fail {
  color: var(--pm-fail);
}

.status-pill--unreachable {
  color: var(--pm-unreachable);
}

.status-pill--stale {
  color: var(--pm-stale);
}

.status-pill--ok,
.status-pill--warn,
.status-pill--fail,
.status-pill--unreachable,
.status-pill--stale {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid currentColor;
}

.step-list {
  margin: 1rem 0 0;
  padding-left: 1.25rem;
}

.step-list__item + .step-list__item {
  margin-top: 0.85rem;
}

.facts-list {
  margin: 0;
  padding-left: 1rem;
}

.run-check-button {
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.25rem;
  color: #f7f3e9;
  background: linear-gradient(135deg, #234c42, #2f7d4c);
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(35, 76, 66, 0.24);
}

.back-link {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--pm-muted);
}

.hero-actions {
  display: flex;
  align-items: flex-start;
}

.list-toolbar {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(260px, 1.8fr) minmax(180px, 1fr) auto;
  align-items: end;
  margin-bottom: 1.25rem;
}

.filter-chips {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--pm-line);
  color: #1f5f51;
  background: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-weight: 600;
}

.filter-chip--active {
  color: #f7f3e9;
  background: linear-gradient(135deg, #234c42, #2f7d4c);
  border-color: transparent;
}

.runtime-editor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.runtime-editor__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.runtime-editor__header h3 {
  margin: 0;
}

.runtime-editor-list {
  display: grid;
  gap: 1rem;
}

.runtime-editor-card {
  border: 1px solid var(--pm-line);
  border-radius: 16px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.7);
}

.facts-banner {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  color: var(--pm-muted);
}

.managed-group + .managed-group {
  margin-top: 1.5rem;
}

.managed-group__header {
  margin-bottom: 0.85rem;
}

.managed-group__header h2 {
  margin: 0;
}

.table-actions {
  min-width: 180px;
}

.inline-form {
  display: inline;
}

.table-action-link {
  color: #1f5f51;
  font-weight: 600;
  text-decoration: none;
}

.table-action-link:hover {
  color: #143c33;
}

.notice {
  border-radius: 18px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.notice--success {
  border-color: rgba(47, 125, 76, 0.25);
  color: #225b38;
}

.notice--error {
  border-color: rgba(190, 74, 47, 0.25);
  color: #8c3420;
}

@media (max-width: 767px) {
  .list-toolbar {
    grid-template-columns: 1fr;
  }

  .runtime-editor__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .host-card__header,
  .details-hero {
    flex-direction: column;
  }

  .host-card__heartbeat {
    min-width: auto;
    text-align: left;
  }
}

@media (max-width: 767px) {
  .host-card__header,
  .details-hero {
    flex-direction: column;
  }

  .host-card__heartbeat {
    text-align: left;
  }
}
