:root {
  --bg: #0b0507;
  --surface: #140c10;
  --surface-2: #1c1317;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3eaee;
  --muted: rgba(243, 234, 238, 0.62);
  --faint: rgba(243, 234, 238, 0.4);
  --brand: #ff00ff;
  --brand-soft: rgba(255, 0, 255, 0.12);
  --ok: #3ddc97;
  --warn: #ffb547;
  --bad: #ff5d6c;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }

.wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 64px; }
.wrap.wide { max-width: 1080px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #0b0507; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.brand small { color: var(--muted); font-weight: 500; }

h1 { font-size: clamp(26px, 6vw, 38px); line-height: 1.12; letter-spacing: -0.03em; margin: 28px 0 10px; font-weight: 750; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -0.01em; font-weight: 650; }
p.lead { color: var(--muted); margin: 0 0 22px; font-size: 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; }
.card.accent { border-color: rgba(255, 0, 255, 0.35); background: linear-gradient(180deg, var(--brand-soft), transparent 70%), var(--surface); }

.points { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 8px; }
.points li { display: flex; gap: 10px; color: var(--muted); }
.points li::before { content: ""; flex: 0 0 6px; height: 6px; margin-top: 9px; border-radius: 50%; background: var(--brand); }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 500; }
input, textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 11px 12px; outline: none; transition: border-color 0.15s;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
.hint { font-size: 12px; color: var(--faint); margin-top: 5px; }
.row { display: grid; gap: 12px; }
@media (min-width: 640px) { .row.two { grid-template-columns: 1fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 18px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2);
  cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #0b0507; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.35); }
.badge.warn { color: var(--warn); border-color: rgba(255, 181, 71, 0.35); }
.badge.bad { color: var(--bad); border-color: rgba(255, 93, 108, 0.35); }
.badge.brand { color: var(--brand); border-color: rgba(255, 0, 255, 0.4); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 22px; letter-spacing: -0.02em; }
.stat span { font-size: 12px; color: var(--muted); }

.list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.item { background: var(--surface); padding: 12px 14px; display: flex; gap: 12px; align-items: center; cursor: pointer; text-align: left; border: 0; width: 100%; }
.item:hover { background: var(--surface-2); }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { color: var(--faint); font-size: 12px; white-space: nowrap; }

.chat { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.user { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.bubble.assistant { align-self: flex-end; background: var(--brand-soft); border: 1px solid rgba(255, 0, 255, 0.25); border-bottom-right-radius: 4px; }
.bubble.owner { align-self: flex-end; background: rgba(61, 220, 151, 0.1); border: 1px solid rgba(61, 220, 151, 0.25); border-bottom-right-radius: 4px; }
.bubble small { display: block; font-size: 11px; color: var(--faint); margin-top: 3px; }

.qr { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 12px; max-width: 280px; margin: 12px auto; }
.qr img { width: 100%; height: auto; display: block; }
.code { font: 700 28px/1.2 "DM Mono", ui-monospace, monospace; letter-spacing: 0.12em; text-align: center; padding: 14px; border: 1px dashed rgba(255, 0, 255, 0.5); border-radius: 12px; margin: 12px 0; }
.steps { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.steps li { margin: 4px 0; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 18px 0 4px; padding-bottom: 2px; }
.tab { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tab.on { color: var(--text); border-color: var(--brand); background: var(--brand-soft); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.scroll-x { overflow-x: auto; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle { position: relative; width: 50px; height: 30px; flex: 0 0 50px; }
.toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong); transition: 0.15s; pointer-events: none; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); transition: 0.15s; }
.toggle input:checked + span { background: var(--brand); border-color: var(--brand); }
.toggle input:checked + span::after { transform: translateX(20px); background: #0b0507; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line-strong); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); }
.toast.bad { border-color: var(--bad); }
.hidden { display: none !important; }
.back { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; margin-bottom: 10px; font-weight: 600; }
pre.doc { white-space: pre-wrap; max-height: 50vh; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; }
