:root {
  color-scheme: dark;
  --bg: #10141a;
  --card: #1b232e;
  --line: #2c3848;
  --text: #e8eef6;
  --muted: #8b97a8;
  --accent: #3dbea0;
  --danger: #e15d5d;
  --ok: #9ece6a;
}
* { box-sizing: border-box; }
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--tg-theme-bg-color, var(--bg));
  color: var(--tg-theme-text-color, var(--text));
  font: 15px/1.45 "Segoe UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a.on, nav a.on { color: var(--text); border-bottom: 2px solid var(--accent); }
.top {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #151b23;
}
.brand { color: var(--text); font-weight: 650; }
nav { display: flex; gap: 12px 14px; flex: 1; flex-wrap: wrap; min-width: 0; }
main { padding: 12px; max-width: 1100px; width: 100%; }
h1 { margin: 0 0 8px; font-size: 28px; }
h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.error { color: #ffb4b4; }
.card, .chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}
.row, .actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
table { width: 100%; max-width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: middle; word-break: break-word; }
th { color: var(--muted); font-weight: 600; }
label { display: grid; gap: 6px; color: var(--muted); }
input, select, button {
  font: inherit;
  color: var(--text);
  background: #121820;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
button { background: var(--accent); color: #06231c; border: 0; cursor: pointer; font-weight: 650; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.tag { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--muted); }
.chart { width: 100%; height: auto; background: #121820; border-radius: 8px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.facts div { background: #121820; border-radius: 8px; padding: 8px 10px; }
dt { color: var(--muted); }
dd { margin: 2px 0 0; }
.qr-box { display: grid; gap: 12px; justify-items: center; margin-top: 12px; text-align: center; }
.qr-box h2 { font-size: 22px; }
.qr-box img { width: min(220px, 70vw); height: auto; background: white; padding: 8px; border-radius: 8px; }
.who { font-size: 13px; color: var(--muted); }
.people { list-style: none; padding: 0; margin: 12px 0 0; }
.people li {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.meta { display: flex; gap: 8px 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.link, .log, .path {
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
  background: #121820;
  padding: 10px;
  border-radius: 8px;
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.login-body { min-height: 100vh; display: grid; place-items: center; }
.login { width: min(420px, calc(100% - 32px)); }
.hidden { display: none; }
@media (max-width: 800px) {
  .facts, .grid { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; }
}
