:root {
  --bg: #0b1220;
  --bg2: #0f172a;
  --panel: #111827;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --green: #22c55e;
  --amber: #f59e0b;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: max(5vmin, 24px);
  overflow: hidden;
}

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  height: calc(100dvh - (max(5vmin, 24px) * 2));
}

.card-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.02);
}

.title {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  letter-spacing: -0.02em;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.18);
  color: var(--accent);
  font-size: 0.92rem;
  white-space: nowrap;
}

.pill .dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.9;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font-size: 0.92rem;
}

.button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.summary {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  background: rgba(255, 255, 255, 0.015);
}

.summary-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  min-width: 0;
}

.summary-label {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.summary-value {
  font-size: 1.05rem;
  font-weight: 700;
  word-break: break-word;
}

.feed {
  min-height: 0;
  overflow: auto;
  padding: 18px 20px 20px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.event-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.045));
}

.event-top {
  padding: 16px 16px 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  flex-wrap: wrap;
}

.event-title-wrap {
  min-width: 0;
}

.event-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  display: flex;
  gap: 10px;
  align-items: center;
}

.event-icon {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.event-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.event-badge {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 0.84rem;
  border: 1px solid transparent;
  white-space: nowrap;
}

.kind-reconnected .event-icon {
  background: var(--green);
}

.kind-reconnected .event-badge {
  color: var(--green);
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.18);
}

.kind-monitoring_started .event-icon {
  background: var(--accent);
}

.kind-monitoring_started .event-badge {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.18);
}

.kind-outage_in_progress .event-icon {
  background: var(--amber);
}

.kind-outage_in_progress .event-badge {
  color: var(--amber);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.18);
}

.kind-generic .event-icon {
  background: var(--muted);
}

.kind-generic .event-badge {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.18);
}

.event-body {
  padding: 0 16px 16px;
  display: grid;
  gap: 12px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}

.detail-full-row {
  grid-column: 1 / -1;
}

.detail-emphasis {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.22);
}

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

.detail-value {
  font-size: 0.95rem;
  font-weight: 600;
  word-break: break-word;
}

.detail-emphasis .detail-label {
  color: #bbf7d0;
}

.detail-emphasis .detail-value {
  font-size: 1.1rem;
}

.event-note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
}

@media (max-width: 980px) {
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  body {
    padding: max(5vmin, 16px);
  }

  .wrap {
    height: calc(100dvh - (max(5vmin, 16px) * 2));
  }

  .header,
  .summary,
  .feed {
    padding-left: 14px;
    padding-right: 14px;
  }

  .header {
    padding-top: 14px;
    padding-bottom: 14px;
  }

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

  .event-top,
  .event-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .event-top {
    padding-top: 14px;
  }

  .event-body {
    padding-bottom: 14px;
  }
}
