:root {
  --bg: #0f1115; --panel: #171a21; --panel-2: #1e222b; --text: #e6e8ec;
  --muted: #98a0ae; --line: #2a2f3a; --accent: #ff5722; --accent-dim: #b93f18;
  --ok: #3fb950; --warn: #d29922; --err: #f85149; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: #79b8ff; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* ---------- каркас ---------- */
header { display: flex; align-items: center; gap: 20px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
header .logo { font-weight: 700; color: var(--accent); letter-spacing: .5px; padding: 14px 0; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { color: var(--muted); padding: 14px 10px; border-bottom: 2px solid transparent;
  font-weight: 500; }
nav a:hover { color: var(--text); text-decoration: none; }
nav a.active { color: var(--text); border-bottom-color: var(--accent); }
main { padding: 24px 20px 60px; max-width: 1180px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0 0 18px; font-weight: 650; }
h2 { font-size: 15px; margin: 22px 0 10px; font-weight: 600; letter-spacing: .2px; }
h2:first-child { margin-top: 0; }

.card { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 940px) { .split { grid-template-columns: 1fr; } }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--panel-2); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 24px; line-height: 1.2; font-weight: 650; }
.stat span { color: var(--muted); font-size: 12px; }

/* ---------- кнопки: одинаковые для button и ссылок ---------- */
button, .btn, input[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font: 500 13.5px/1 inherit; font-family: inherit;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s;
}
button:hover, .btn:hover { background: var(--accent-dim); text-decoration: none; color: #fff; }
button.ghost, .btn.ghost { background: var(--panel-2); color: var(--text);
  border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { background: #262b36; color: var(--text); }
button.danger, .btn.danger { background: transparent; color: var(--err);
  border-color: transparent; padding: 0 8px; }
button.danger:hover { background: rgba(248, 81, 73, .12); }
button:disabled { opacity: .5; cursor: default; }

/* ---------- формы ---------- */
input, select, textarea { font: 14px/1.4 inherit; font-family: inherit; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; height: 36px; }
textarea { height: auto; min-height: 340px; width: 100%; padding: 12px;
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", monospace; font-size: 13px;
  line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent);
  outline-offset: -1px; }
input[type="checkbox"] { height: auto; width: auto; accent-color: var(--accent); }
label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.field { margin-bottom: 12px; flex: 1 1 200px; min-width: 0; }
.field input, .field select { width: 100%; }
.field .hint { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.field.actions { padding-top: 24px; display: flex; gap: 8px; align-items: center; }
.field.actions.no-label { padding-top: 0; }
.row.tight { gap: 8px; align-items: center; }
.row .field { margin-bottom: 0; }
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--text);
  font-size: 13px; margin: 0; cursor: pointer; }
form.inline { display: inline-flex; margin: 0; }

/* ---------- таблицы ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line);
  vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .4px; }
tbody tr:hover td { background: var(--panel-2); }
td:last-child, th:last-child { text-align: right; }

/* ---------- табы ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  flex-wrap: wrap; }
.tabs a { padding: 7px 16px; border-radius: 7px; color: var(--muted); font-size: 13.5px;
  font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; background: rgba(255,255,255,.04); }
.tabs a.active { background: var(--accent); color: #fff; }
.tabs a.active:hover { background: var(--accent); color: #fff; }

/* ---------- мелочи ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: #1f4d2c; background: rgba(63,185,80,.08); }
.badge.warn { color: var(--warn); border-color: #4d3f13; background: rgba(210,153,34,.08); }
.badge.err { color: var(--err); border-color: #5c2020; background: rgba(248,81,73,.08); }
pre { background: var(--panel-2); padding: 14px; border-radius: 8px; overflow-x: auto;
  white-space: pre-wrap; word-wrap: break-word; font-size: 13px; line-height: 1.6;
  border: 1px solid var(--line); margin: 0 0 12px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: rgba(63,185,80,.1); border: 1px solid #1f4d2c; }
.flash.err { background: rgba(248,81,73,.1); border: 1px solid #5c2020; }
details { margin: 10px 0 0; }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 6px 0;
  list-style: none; user-select: none; }
details > summary::before { content: "▸ "; }
details[open] > summary::before { content: "▾ "; }
details > summary:hover { color: var(--text); }
.logline { font-family: ui-monospace, monospace; font-size: 12px; padding: 4px 0;
  border-bottom: 1px solid var(--line); }
.logline.ERROR { color: var(--err); }
.logline.WARN { color: var(--warn); }
.logline.DEBUG { color: var(--muted); }
.item { border-left: 2px solid var(--line); padding: 2px 0 2px 14px; margin-bottom: 14px; }
.item:hover { border-left-color: var(--accent); }
.scroll { max-height: 620px; overflow: auto; }
pre.clamp { max-height: 260px; overflow: hidden; position: relative;
  mask-image: linear-gradient(to bottom, #000 70%, transparent); }

/* ---------- поле секрета ---------- */
.secret { display: flex; gap: 8px; }
.secret input { flex: 1; }
.secret button { flex: 0 0 auto; }

/* ---------- липкая панель действий формы ---------- */
.sticky-actions { position: sticky; bottom: 0; margin-top: 8px; padding: 14px 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* ---------- узкие экраны ---------- */
@media (max-width: 700px) {
  header { gap: 8px; padding: 0 14px; }
  header .logo { padding: 12px 0; }
  nav a { padding: 10px 8px; font-size: 13px; }
  main { padding: 18px 14px 48px; }
  .field.actions { padding-top: 0; }
}

/* ---------- переключатель языка ---------- */
.userbox { display: flex; align-items: center; gap: 8px; margin-left: auto;
  color: var(--muted); font-size: 13px; }
.login { max-width: 360px; margin: 14vh auto; }
.langswitch { display: flex; gap: 2px; padding: 3px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.langswitch button { height: 26px; padding: 0 10px; font-size: 12px; font-weight: 600;
  background: transparent; color: var(--muted); border-radius: 6px; }
.langswitch button:hover { background: rgba(255,255,255,.05); color: var(--text); }
.langswitch button.active { background: var(--accent); color: #fff; }
