:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #14211e;
  --muted: #5b6b66;
  --line: #d9e0dd;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --error: #b42318;
  --ok: #067647;
  --focus: #0f766e66;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513;
    --card: #16201d;
    --text: #e8efec;
    --muted: #93a39d;
    --line: #2a3733;
    --accent: #2dd4bf;
    --accent-text: #04201c;
    --error: #ff8a80;
    --ok: #6ee7b7;
    --focus: #2dd4bf55;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 1.5rem; margin: 0.25rem 0 0.25rem; }
h2 { font-size: 1.05rem; margin: 0; }
.muted { color: var(--muted); font-size: 0.92rem; margin: 0.25rem 0 0.9rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 650; }
.logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  display: inline-block; position: relative;
}
.logo::after {
  content: ""; position: absolute; left: 7px; top: 8px; width: 14px; height: 9px;
  background: var(--accent-text); border-radius: 2px;
}
.bar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 820px; margin: 0 auto; padding: 1rem 16px 0;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  max-width: 820px; margin: 1rem auto; padding: 1.5rem;
}
.card.narrow { max-width: 400px; margin-top: 12vh; }
.card.narrow .brand { margin-bottom: 1rem; }
@media (max-width: 640px) {
  .card { margin: 1rem 16px; padding: 1.1rem; }
  .card.narrow { margin: 8vh 16px 0; }
}
section { margin-bottom: 1.6rem; }
label { display: block; font-weight: 600; font-size: 0.92rem; margin: 0.9rem 0 0.3rem; }
label h2 { display: block; }
input:not([type="checkbox"]), textarea {
  width: 100%; padding: 0.65rem 0.75rem; border-radius: 9px; border: 1px solid var(--line);
  background: transparent; color: var(--text); font: inherit;
}
textarea { resize: vertical; min-height: 7rem; line-height: 1.45; }
input:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible, .switch input:focus-visible + .track {
  outline: 3px solid var(--focus); outline-offset: 1px;
}
button { font: inherit; cursor: pointer; border-radius: 9px; padding: 0.6rem 1.1rem; border: 1px solid transparent; }
button.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; width: 100%; margin-top: 1rem; }
.actions button.primary { width: auto; margin: 0; }
button.primary:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--muted); border-color: var(--line); padding: 0.35rem 0.8rem; font-size: 0.88rem; }
button.ghost:hover { color: var(--text); }
.error { color: var(--error); margin: 0.7rem 0 0; font-size: 0.92rem; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.85rem; margin-top: 0.4rem; }
details { border-top: 1px solid var(--line); padding-top: 1rem; }
summary { cursor: pointer; font-weight: 600; margin-bottom: 0.6rem; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-top: 1.4rem; border-top: 1px solid var(--line); padding-top: 1.1rem; }
#status { font-size: 0.9rem; color: var(--muted); }
#status.ok { color: var(--ok); }
#status.bad { color: var(--error); }

.switch { display: flex; align-items: center; gap: 0.6rem; margin: 0; cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track {
  width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; transition: background 0.15s;
}
.track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform 0.15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch-text { font-size: 0.9rem; font-weight: 600; min-width: 5.5rem; }
@media (prefers-reduced-motion: reduce) { .track, .track::after { transition: none; } }

.hero { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto 0.5rem; border-radius: 12px; }
.mark { height: 44px; width: auto; border-radius: 8px; }
.card.narrow h1, .card.narrow > .muted { text-align: center; }
label.show { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; color: var(--muted); margin-top: 0.6rem; }

.badge { font-size: 0.82rem; font-weight: 650; padding: 0.25rem 0.7rem; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.wait { color: var(--muted); }
.badge.off { color: var(--error); border-color: var(--error); }
.tabs { display: flex; gap: 0.4rem; margin: 0.3rem 0 1rem; border-bottom: 1px solid var(--line); }
.tab { background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 0.5rem 0.9rem; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
button.secondary { background: transparent; color: var(--text); border-color: var(--accent); font-weight: 600; }
button.secondary:disabled { opacity: 0.5; cursor: wait; }
button.danger { color: var(--error); border-color: var(--error); }
.qr { margin-top: 1rem; text-align: center; }
.qr img { background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--line); max-width: 100%; height: auto; }
.inline { display: flex; gap: 0.6rem; }
.inline input { flex: 1; }
.pair { margin-top: 1rem; text-align: center; }
#pair-code { display: inline-block; font: 700 2rem/1 ui-monospace, Consolas, monospace; letter-spacing: 0.25em; padding: 0.9rem 1.2rem; border: 1px dashed var(--accent); border-radius: 12px; }
#wa-confirm { margin-left: 0.6rem; font-size: 0.9rem; color: var(--muted); }
@media (max-width: 640px) { .inline { flex-direction: column; } }
