:root {
  --bg: #11151c;
  --panel: #1b212b;
  --panel-2: #222b38;
  --text: #e8ecf1;
  --muted: #8a93a3;
  --accent: #3b82f6;
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --radius: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: #93c5fd; overflow-wrap: anywhere; }

.wrap {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.top, .status-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1, h2, p { margin-top: 0; }
h1 { font-size: 1.55rem; margin-bottom: 4px; }
h2 { font-size: 1rem; margin-bottom: 14px; }

.label, #device-line {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.panel {
  background: var(--panel);
  border: 1px solid #273241;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

label + label {
  margin-top: 12px;
}

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid #334155;
  border-radius: var(--radius);
  color: var(--text);
}

button {
  border: 0;
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.success { background: var(--good); }
.danger { background: #991b1b; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.error { color: var(--bad); }
.message { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.badge.active { background: rgba(34, 197, 94, 0.15); color: var(--good); }
.badge.inactive { background: rgba(239, 68, 68, 0.15); color: var(--bad); }

.kv {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.copy-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.copy-line code {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: #0b1020;
  color: #dbeafe;
  overflow-wrap: anywhere;
}

.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.service {
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 12px;
}

.service .name {
  font-weight: 700;
  margin-bottom: 8px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  background: #0b1020;
  border-radius: var(--radius);
  color: #dbeafe;
}

@media (max-width: 640px) {
  .top, .status-panel {
    align-items: stretch;
    flex-direction: column;
  }

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