:root {
  --bg: #f6f3f5;
  --card: #fff;
  --text: #2a1820;
  --muted: #7d6570;
  --line: #eadfe4;
  --pri: #b0306a;
  --pri-2: #8d234f;
  --pri-soft: #f8e6ee;
  --ok: #1f7a4d;
  --ok-soft: #e5f6ec;
  --warn: #9a6412;
  --warn-soft: #fff4dc;
  --danger: #9f1239;
  --danger-soft: #fde8ee;
  --info: #2458a6;
  --info-soft: #e7f0fb;
  --nav-h: 62px;
  --top-h: 56px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #1a1216;
  --card: #2a1c22;
  --text: #f8eef2;
  --muted: #c7b0ba;
  --line: #4a3340;
  --pri: #e989b0;
  --pri-2: #b0306a;
  --pri-soft: #4a2434;
  --ok-soft: #173226;
  --warn-soft: #3a2d14;
  --danger-soft: #3f1824;
  --info-soft: #1b2c48;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--pri); }
h1, h2, h3, p { margin: 0; }
.svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.grow { flex: 1; min-width: 0; }
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 14px;
  background: var(--pri); color: #fff;
}
.topbar h1 { font-size: 17px; font-weight: 700; }
.topbar button { color: #fff; }
.main { flex: 1; width: min(880px, 100%); margin: 0 auto; padding: 14px 14px calc(var(--nav-h) + 24px); }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; height: var(--nav-h);
  background: var(--card); border-top: 1px solid var(--line);
}
.bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
.bottomnav button.active { color: var(--pri); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi b { display: block; font-size: 18px; margin-top: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 700; }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 13px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.lbl { display: block; font-size: 13px; font-weight: 700; margin: 10px 0 4px; }
.inp, select.inp, textarea.inp { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 8px 12px; }
textarea.inp { min-height: 80px; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; background: var(--pri-soft); color: var(--pri-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.kv span { color: var(--muted); }
.note { display: flex; gap: 8px; background: var(--pri-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { flex: 1; min-height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 700; }
.tabs button.active { background: var(--pri); color: #fff; border-color: var(--pri); }
.login { min-height: 100vh; display: flex; flex-direction: column; }
.login-hero { background: var(--pri); color: #fff; padding: 48px 22px 28px; }
.login-mark { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: rgba(255,255,255,.16); font-weight: 800; letter-spacing: .04em; margin-bottom: 12px; }
.login-sheet { background: var(--bg); border-radius: 24px 24px 0 0; margin-top: -16px; padding: 22px 18px 32px; flex: 1; }
.list .row b, .grow b { display: block; }
.modal-bg { position: fixed; inset: 0; background: rgba(28, 12, 18, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal { width: min(560px, 100%); background: var(--card); border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 88vh; overflow: auto; }
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px); z-index: 50; background: #2a1820; color: #fff; border-radius: 12px; padding: 12px 14px; }
.toast.warn { background: #7a3412; }
.lock { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 20px; }
.lock .card { width: min(420px, 100%); }
.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble { align-self: flex-start; max-width: 85%; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.bubble.mine { align-self: flex-end; background: var(--pri-soft); }
.empty { text-align: center; color: var(--muted); padding: 18px 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.qr { display: block; width: 220px; height: 220px; margin: 12px auto; background: #fff; border-radius: 12px; padding: 8px; }
.secret { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; word-break: break-all; font-weight: 700; }
.codes { margin: 8px 0 12px; padding-left: 1.2em; }
.codes li { margin: 4px 0; }
.btn:disabled { opacity: .55; }
@media (max-width: 640px) { .kpis, .grid2 { grid-template-columns: 1fr; } }
@media print {
  .topbar, .bottomnav, .toast, .btn { display: none !important; }
  .main { padding: 0; }
}
