:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #171a21;
  --muted: #6b7385;
  --line: #dde2ea;
  --accent: #e5533d;
  --accent-ink: #ffffff;
  --ok: #1f9d63;
  --err: #d23b3b;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318;
    --surface: #171b22;
    --ink: #ebeef4;
    --muted: #8b93a4;
    --line: #262c36;
    --accent: #ff6a50;
    --ok: #46c186;
    --err: #f16a6a;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 48px;
}
.hidden { display: none !important; }

.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 20px;
}
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.stack > * { margin-bottom: 14px; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}
input, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 11px 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
}
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 11px 16px;
  font-weight: 600;
  width: 100%;
}
button.link {
  background: none;
  color: var(--muted);
  padding: 4px;
  font-size: 0.85rem;
}
button.link.danger { color: var(--err); }
a { color: var(--accent); }

.row { display: flex; gap: 10px; align-items: stretch; }
.row select { width: auto; flex: 1; }
.row button.primary { width: auto; white-space: nowrap; }

.child-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.status { font-size: 0.85rem; margin: 10px 0 0; min-height: 1.2em; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--err); font-size: 0.9rem; min-height: 1.2em; margin: 8px 0 0; }

.pair summary { font-weight: 600; cursor: pointer; }
.pair form { margin-top: 12px; }

.section-head { margin-bottom: 12px; }
