* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6fb;
  color: #1f2937;
}
header {
  background: #111827;
  color: #fff;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
header h1 { font-size: 20px; font-weight: 700; }
header small { display: block; color: #cbd5e1; margin-top: 4px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.user-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 13px;
}
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.card h2, .card h3 {
  font-size: 16px;
  margin-bottom: 14px;
  color: #111827;
}
.muted { color: #6b7280; font-size: 13px; }
.hidden { display: none !important; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.tab {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}
.tab.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}
.stack { display: grid; gap: 16px; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.field { display: grid; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.field a { color: #2563eb; }
.code-input {
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  min-height: 180px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
}
textarea { min-height: 96px; resize: vertical; }
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  background: #111827;
  color: #fff;
}
.btn:hover { background: #1f2937; }
.btn-secondary { background: #475569; }
.btn-secondary:hover { background: #334155; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost {
  background: #fff;
  color: #111827;
  border: 1px solid #d1d5db;
}
.btn-ghost:hover { background: #f8fafc; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}
th {
  color: #6b7280;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.empty {
  text-align: center;
  color: #9ca3af;
  padding: 18px;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.connected { background: #dcfce7; color: #166534; }
.badge.connecting { background: #dbeafe; color: #1d4ed8; }
.badge.disconnected { background: #fef3c7; color: #92400e; }
.badge.error { background: #fee2e2; color: #b91c1c; }
.badge.unknown { background: #e5e7eb; color: #374151; }
.panel-note {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.login-card {
  max-width: 420px;
  margin: 56px auto;
}
.login-actions { display: grid; gap: 10px; }
.login-actions .btn { width: 100%; display: block; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  max-width: 360px;
}
.toast.show { opacity: 1; }
.error-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 8px;
  font-size: 13px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}
.modal {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.25);
  padding: 20px;
}
.modal h3 { margin-bottom: 12px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.json-box, pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  font-size: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.mono { font-family: Consolas, "Courier New", monospace; }
code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
  background: #f1f5f9;
  padding: 2px 5px;
  border-radius: 4px;
  color: #334155;
}
.field .muted { margin-top: 2px; }
