* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #f6f7f9;
  color: #17202a;
}

.page {
  width: min(960px, calc(100% - 32px));
  margin: 32px auto;
  display: grid;
  gap: 16px;
}

.card {
  background: white;
  border: 1px solid #e7e9ee;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(20, 30, 50, 0.05);
}

h1,
h2 {
  margin: 0 0 12px;
}

.subtitle {
  margin-top: -4px;
  color: #667085;
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: #344054;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.actions,
.send-row {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  background: #111827;
  color: white;
}

button:hover {
  opacity: 0.9;
}

.status {
  display: inline-flex;
  border-radius: 8px;
  background: #eef2ff;
  padding: 8px 12px;
  font-weight: 700;
}

.status[data-state="connected"] {
  background: #ecfdf3;
}

.status[data-state="error"] {
  background: #fef3f2;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-grid > div {
  display: grid;
  gap: 6px;
}

.status-grid span,
.presence-summary span,
.presence-list span {
  color: #667085;
  font-size: 13px;
}

.presence-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.presence-summary strong {
  font-size: 28px;
}

.presence-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.presence-list li {
  display: grid;
  gap: 4px;
  border: 1px solid #e7e9ee;
  border-radius: 8px;
  padding: 10px 12px;
}

pre {
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  white-space: pre-wrap;
  background: #0b1020;
  color: #d6e4ff;
  border-radius: 8px;
  padding: 16px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

.events-table th,
.events-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e7e9ee;
  vertical-align: top;
}

.events-table th {
  background: #f6f7f9;
  font-weight: 600;
  color: #4b5563;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.events-table td.payload {
  font-family: ui-monospace, "SF Mono", Monaco, Menlo, Consolas, monospace;
  color: #1f2937;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hint {
  color: #6b7280;
  font-size: 13px;
  margin: 8px 0 0;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4b5563;
  margin: 8px 0;
}

.inline-toggle input[type="checkbox"] {
  width: auto;
}

@media (max-width: 720px) {
  .grid,
  .send-row,
  .status-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .actions {
    display: grid;
  }
}
