:root {
  color-scheme: dark light;
  --bg: #0f1419;
  --card: #1a2332;
  --text: #e7ecf3;
  --muted: #8b9bb4;
  --border: #2a3548;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #f87171;
  --ok: #34d399;
  --offline: #94a3b8;
  --radius: 12px;
  --font: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body {
  line-height: 1.45;
}

.shell {
  max-width: 420px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.shell.wide {
  max-width: 640px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 650;
}

.muted {
  color: var(--muted);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.topbar .muted {
  margin-bottom: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 550;
}

.field input,
.field textarea {
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  width: 100%;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  width: auto;
  flex-shrink: 0;
}

.btn.ghost:hover {
  border-color: var(--muted);
}

.error {
  color: var(--danger);
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1.25rem;
}

.status-row .label {
  font-weight: 600;
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 650;
  border: 1px solid transparent;
}

.badge.online {
  background: rgba(52, 211, 153, 0.15);
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.35);
}

.badge.offline {
  background: rgba(148, 163, 184, 0.15);
  color: var(--offline);
  border-color: rgba(148, 163, 184, 0.35);
}

.badge.muted-badge {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  font-weight: 500;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: -0.35rem 0 1rem;
  font-size: 0.85rem;
}

.meta-row .muted {
  margin: 0;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.actions .btn.primary {
  width: 100%;
}

.hint {
  font-size: 0.85rem;
  margin: 0;
}

@media (min-width: 520px) {
  .actions {
    flex-direction: row;
    align-items: center;
  }

  .actions .btn.primary {
    width: auto;
    min-width: 140px;
  }
}
