:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b35;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --accent: #5b9cff;
  --error: #ff6b6b;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9; --panel: #ffffff; --line: #e3e6ec;
    --text: #14171c; --muted: #667085;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; letter-spacing: .02em; }
.brand .dot { margin: 0 8px; color: var(--muted); }
.whoami { display: flex; align-items: center; gap: 12px; }

main { max-width: 1100px; margin: 0 auto; padding: 26px 22px 60px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}

h1 { font-size: 22px; margin: 0 0 10px; }
h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.greet { margin-bottom: 18px; }

form { display: flex; flex-direction: column; gap: 14px; max-width: 380px; margin-top: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

input {
  padding: 10px 12px; border-radius: 8px; font-size: 15px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--accent); color: #fff; font-size: 15px; cursor: pointer;
}
button:disabled { opacity: .55; cursor: default; }
button.pick { background: var(--panel); color: var(--text); }
button.pick:hover { border-color: var(--accent); }
button.link {
  background: none; border: none; color: var(--muted);
  padding: 0; font-size: 13px; text-decoration: underline;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: none; }
.list a { color: var(--text); text-decoration: none; }
.list a:hover { text-decoration: underline; }
.list .meta { color: var(--muted); font-size: 13px; }

.badge {
  background: var(--line); color: var(--muted);
  border-radius: 20px; padding: 1px 9px; font-size: 12px; font-weight: 500;
}

.error { color: var(--error); font-size: 14px; }
.fineprint { color: var(--muted); font-size: 12px; margin-top: 18px; max-width: 460px; }
.foot { max-width: 1100px; margin: 0 auto; padding: 0 22px 30px; }

.searchbar { flex-direction: row; max-width: none; margin: 0 0 4px; gap: 10px; }
.searchbar input { flex: 1; }
.chan {
  display: inline-block; margin-left: 8px; font-size: 11px;
  color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px;
}
.snippet { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* --- служебный дашборд --- */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 18px; }
.tile {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.tile .n { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.tile .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tile.bad { border-color: var(--error); }
.tile.bad .n { color: var(--error); }

.alert {
  border: 1px solid var(--error); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; font-size: 14px;
}
.alert b { color: var(--error); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl td { padding: 5px 0; border-top: 1px solid var(--line); vertical-align: top; }
.tbl tr:first-child td { border-top: none; }
.tbl td:first-child { color: var(--muted); padding-right: 12px; white-space: nowrap; }
.tbl td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.ok { color: #3fb950; } .no { color: var(--error); }

.logtabs { display: inline-flex; gap: 6px; margin-left: auto; }
.logtabs button {
  background: none; border: 1px solid var(--line); color: var(--muted);
  font-size: 12px; padding: 2px 8px; border-radius: 5px;
}
.logtabs button.on { color: var(--text); border-color: var(--accent); }
.log {
  margin: 0; padding: 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; font-size: 12px; line-height: 1.45; max-height: 420px;
  overflow: auto; white-space: pre-wrap; word-break: break-word;
}
