:root {
  --bg: #f4f6f2;
  --ink: #121712;
  --muted: #4f5a4f;
  --line: #cfdbcd;
  --panel: rgba(255, 255, 255, 0.88);
  --accent: #008f5a;
  --accent-strong: #0e6f4a;
  --danger: #c0392b;
  --warn: #b87400;
  --glow: rgba(0, 143, 90, 0.14);
  --shadow: 0 12px 38px rgba(18, 23, 18, 0.1);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 15%, rgba(0, 143, 90, 0.2), transparent 34%),
    radial-gradient(circle at 90% 5%, rgba(21, 89, 161, 0.2), transparent 30%),
    linear-gradient(145deg, #f8fbf6 0%, #ecf4eb 52%, #e4eee3 100%);
  min-height: 100vh;
  padding: 28px 18px;
}

.dashboard {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.hero {
  background: linear-gradient(125deg, #102d24 0%, #174f38 100%);
  color: #eefaf5;
  border-radius: calc(var(--radius) + 6px);
  padding: clamp(22px, 4vw, 36px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: rise 0.55s ease-out both;
}

.hero::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -90px;
  top: -90px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.28), transparent 66%);
  pointer-events: none;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2.35rem);
  letter-spacing: 0.01em;
}

.hero p {
  margin: 12px 0 0;
  max-width: 760px;
  color: rgba(238, 250, 245, 0.86);
  font-size: 0.98rem;
  line-height: 1.55;
}

.meta {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(238, 250, 245, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(238, 250, 245, 0.9);
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.overview-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  animation: rise 0.56s ease-out both;
}

.overview-title {
  color: var(--muted);
  font-size: 0.8rem;
}

.overview-value {
  margin-top: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.45rem;
  font-weight: 600;
}

.overview-value.ok {
  color: var(--accent-strong);
}

.overview-value.warn {
  color: var(--warn);
}

.overview-value.danger {
  color: var(--danger);
}

.overview-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.77rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(3px);
  animation: rise 0.6s ease-out both;
}

.card:nth-child(2) {
  animation-delay: 0.08s;
}

.card-wide {
  grid-column: 1 / -1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.card-header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #95a199;
  box-shadow: 0 0 0 6px rgba(149, 161, 153, 0.14);
  transition: all 0.25s ease;
}

.status-dot.online {
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--glow);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(192, 57, 43, 0.16);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px 14px 4px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fbfdf9;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.1rem;
  font-weight: 500;
}

.log-list,
.pairs-list {
  margin: 0;
  padding: 10px 14px 14px;
  list-style: none;
  max-height: 390px;
  overflow: auto;
}

.log-item,
.pair-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  margin-bottom: 9px;
  animation: fade 0.26s ease-out;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  word-break: break-word;
}

.pair-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
}

.pair-sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.pair-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8faf6;
}

.badge.complete {
  color: #0b6c4a;
  border-color: rgba(11, 108, 74, 0.35);
  background: rgba(11, 108, 74, 0.08);
}

.badge.partial {
  color: #885800;
  border-color: rgba(136, 88, 0, 0.35);
  background: rgba(136, 88, 0, 0.08);
}

.badge.failed {
  color: #972718;
  border-color: rgba(151, 39, 24, 0.35);
  background: rgba(151, 39, 24, 0.08);
}

.pair-item.active {
  border-color: rgba(0, 143, 90, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 143, 90, 0.1);
}

.action-panel {
  padding: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 0;
}

select {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

input,
button {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 11px;
  font: inherit;
}

input {
  flex: 1;
  min-width: 220px;
  background: #fff;
}

button {
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.16s ease, background 0.16s ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  padding: 16px;
  margin: 10px 14px 14px;
  font-size: 0.9rem;
  background: #fafdff;
}

.hidden {
  display: none !important;
}

.audit-content {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.audit-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.audit-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.audit-section h4 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.kv {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}

.kv-label {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.kv-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.79rem;
  word-break: break-word;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.json-view {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbf7;
  padding: 8px;
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.hp-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.hp-pill,
.hp-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #f8faf6;
}

.hp-pill.good {
  color: #0b6c4a;
  border-color: rgba(11, 108, 74, 0.35);
  background: rgba(11, 108, 74, 0.08);
}

.hp-pill.bad {
  color: #972718;
  border-color: rgba(151, 39, 24, 0.35);
  background: rgba(151, 39, 24, 0.08);
}

.stack {
  display: grid;
  gap: 8px;
}

.contract-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fdfefd;
}

.contract-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  max-height: 340px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.73rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f4f8f1;
}

.foot {
  text-align: center;
  color: #536152;
  font-size: 0.8rem;
  font-family: "IBM Plex Mono", monospace;
  margin-top: 3px;
}

@media (max-width: 940px) {
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .kv-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body {
    padding: 16px 12px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .kv-grid {
    grid-template-columns: 1fr;
  }

  .log-list,
  .pairs-list {
    max-height: 300px;
  }

  input {
    min-width: 100%;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
