/* The admin panel of Tuo: one stylesheet, no external fonts or assets. Phone first (Telegram's in-app browser). */
:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --ink: #1d1d1b;
  --ink-2: #5c5b55;
  --ink-3: #8a8880;
  --line: #e2e0d8;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --good: #2e7d4f;
  --warn: #9a6700;
  --bad: #b3261e;
  --bar: #3d7fae;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1e1e1c;
    --surface-2: #272724;
    --ink: #ecebe6;
    --ink-2: #b3b1a8;
    --ink-3: #85837b;
    --line: #34332f;
    --accent: #6fb0de;
    --accent-ink: #0d1b26;
    --good: #6cc48f;
    --warn: #e0b04a;
    --bad: #f08a82;
    --bar: #6fa8d6;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .2px; margin-right: auto; color: var(--ink); }
.brand span { color: var(--ink-3); font-weight: 500; }
.who { color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
nav.main { max-width: 1200px; margin: 0 auto; padding: 0 16px 8px; display: flex; gap: 4px; overflow-x: auto;
  scrollbar-width: none; }
nav.main a { white-space: nowrap; padding: 6px 10px; border-radius: 999px; color: var(--ink-2); font-size: 14px; }
nav.main a.on { background: var(--ink); color: var(--surface); }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  margin-bottom: 12px; min-width: 0; }
.grid > .card { margin-bottom: 0; }
.stat { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.15; }
.sub { color: var(--ink-2); font-size: 13px; }
.muted { color: var(--ink-3); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
dl.kv dt { color: var(--ink-2); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px;
  white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td.wide { min-width: 220px; overflow-wrap: anywhere; }
pre.text, pre.json { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; margin: 0;
  font: 13px/1.5 var(--mono); background: var(--surface-2); padding: 10px; border-radius: 8px; max-height: 70vh;
  overflow-y: auto; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.good { color: var(--good); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }
.flash { background: var(--surface); border: 1px solid var(--good); color: var(--good); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 12px; }
.error { background: var(--surface); border: 1px solid var(--bad); color: var(--bad); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 12px; }
form.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
form.filters label { display: grid; gap: 2px; font-size: 12px; color: var(--ink-2); }
input, select, button { font: inherit; color: var(--ink); }
input[type=text], input[type=password], input[type=date], input[type=number], select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; min-height: 38px;
  max-width: 100%; }
button, .button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px;
  padding: 8px 14px; min-height: 38px; font-weight: 600; cursor: pointer; display: inline-block; }
button.quiet, .button.quiet { background: var(--surface-2); color: var(--ink); }
button.danger { background: var(--bad); color: #fff; }
.actions form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 0 0 10px; }
.actions label { display: grid; gap: 2px; font-size: 12px; color: var(--ink-2); }
.inline { display: inline; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 10px; font-size: 14px; }
.narrow { max-width: 440px; margin: 40px auto; }
.narrow form { display: grid; gap: 10px; }
.narrow label { display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.narrow input { width: 100%; }
.qr { background: #fff; padding: 8px; border-radius: 8px; display: inline-block; }
.qr img { display: block; width: 220px; height: 220px; image-rendering: pixelated; }
.secret { font: 16px/1.6 var(--mono); letter-spacing: 1px; overflow-wrap: anywhere; }
.codes { font: 16px/1.8 var(--mono); columns: 2; }
.msg { margin: 0 0 10px; }
.msg .meta { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.msg.user pre.text { background: var(--surface); border: 1px solid var(--line); }
.msg.external pre.text { border-left: 3px solid var(--warn); }
svg.bars { width: 100%; height: auto; display: block; }
svg.bars .bar { fill: var(--bar); }
svg.bars .base { stroke: var(--line); stroke-width: 1; }
svg.bars text { fill: var(--ink-3); font-size: 10px; }
details summary { cursor: pointer; color: var(--accent); }
@media (max-width: 560px) {
  main { padding: 12px; }
  .stat { font-size: 22px; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { margin-top: 6px; }
}
.confirm { max-width: 560px; }
.confirm form { margin-top: 14px; }
/* data from the database never reorders the page around it (bidi controls are also stripped on the server) */
td, dd, pre, .msg, .who, .stat, .sub, h1 { unicode-bidi: isolate; }
pre.text, pre.json { unicode-bidi: plaintext; }
