:root {
  --bg: #08080a;
  --bg-2: #0f0f12;
  --card: #141417;
  --card-2: #1a1a1e;
  --card-3: #202026;
  --line: #27272d;
  --line-2: #35353c;
  --gold: #f5c451;
  --gold-2: #ffe1a3;
  --gold-3: #d99a22;
  --gold-soft: rgba(245, 196, 81, .12);
  --gold-line: rgba(245, 196, 81, .34);
  --text: #f4efe6;
  --muted: #a7a39a;
  --dim: #6f6b63;
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .12);
  --info: #93c5fd;
  --info-soft: rgba(147, 197, 253, .12);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
::selection { background: rgba(245, 196, 81, .3); color: #fff; }

h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.08; letter-spacing: -.03em; }
h2 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; }
h3 { font-size: 18px; line-height: 1.3; }
strong { font-weight: 750; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.gold { color: var(--gold); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden { display: none !important; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--card-2);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  transition: .18s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: #4a4a53; background: var(--card-3); color: var(--text); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: rgba(255, 225, 163, .75);
  color: #151106;
  box-shadow: 0 8px 24px rgba(245, 196, 81, .18);
}
.btn-primary:hover { background: linear-gradient(180deg, #ffedc2, #ffd06b); color: #151106; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger-soft); border-color: rgba(255, 107, 107, .35); color: #ffb4b4; }
.btn-danger:hover { background: rgba(255, 107, 107, .2); color: #ffd1d1; }
.btn-sm { min-height: 32px; padding: 6px 10px; border-radius: 9px; font-size: 12.5px; gap: 6px; }
.btn-icon { width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 10px; }
.btn-block { width: 100%; }

.field { display: grid; gap: 7px; }
.field + .field { margin-top: 14px; }
.label { color: var(--muted); font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
.hint { color: var(--dim); font-size: 12px; line-height: 1.45; }
.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  background: #0d0d10;
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  outline: none;
  transition: .18s ease;
}
.textarea { min-height: 92px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold-line); box-shadow: 0 0 0 3px rgba(245, 196, 81, .09); }
.input::placeholder, .textarea::placeholder { color: #5e5a53; }
.input[type="number"] { appearance: textfield; }
.input[type="number"]::-webkit-outer-spin-button, .input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }
.check { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 13px; }
.check input { margin-top: 3px; accent-color: var(--gold); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.badge.ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(74, 222, 128, .25); }
.badge.gold { color: var(--gold); background: var(--gold-soft); border-color: var(--gold-line); }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(251, 191, 36, .25); }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(255, 107, 107, .25); }
.badge.info { color: var(--info); background: var(--info-soft); border-color: rgba(147, 197, 253, .25); }
.badge.muted { color: var(--muted); }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.015), transparent 40%), var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); }
.card-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.card-title .icon { color: var(--gold); }

.table-wrap { overflow: auto; border-radius: 14px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 1; padding: 11px 14px; background: #111114; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.045); vertical-align: middle; }
.table tbody tr { transition: background .15s ease; }
.table tbody tr:hover { background: rgba(255,255,255,.025); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }

.code, pre.log {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: #cfc9bc;
  background: #09090b;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  overflow: auto;
}
pre.log { max-height: 420px; margin: 0; white-space: pre-wrap; word-break: break-word; }
pre.log:empty::before { content: "Логи появятся здесь."; color: var(--dim); }

.kv { display: grid; gap: 0; }
.kv-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.kv-row:last-child { border-bottom: 0; }
.kv-key { color: var(--dim); font-size: 12.5px; white-space: nowrap; }
.kv-val { text-align: right; font-weight: 650; overflow-wrap: anywhere; }

.empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 42px 20px; color: var(--dim); }
.empty strong { color: var(--text); font-size: 15px; }
.empty p { max-width: 360px; font-size: 13px; line-height: 1.5; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: var(--gold); background: var(--gold-soft); border: 1px solid var(--gold-line); margin-bottom: 4px; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(3, 3, 5, .72);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center; justify-content: center;
  padding: 18px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(560px, 100%);
  max-height: min(86vh, 780px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  box-shadow: 0 28px 90px rgba(0,0,0,.65);
  animation: modal-in .2s ease both;
}
.modal.wide { width: min(760px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; }
.modal-head p { margin-top: 4px; color: var(--dim); font-size: 12.5px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 22px 20px; }
.modal-close { border: 0; background: transparent; color: var(--dim); padding: 4px; border-radius: 8px; }
.modal-close:hover { color: var(--text); background: rgba(255,255,255,.06); }

.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 9px; width: min(380px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: #17171b; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .2s ease both; }
.toast.ok { border-color: rgba(74,222,128,.35); }
.toast.err { border-color: rgba(255,107,107,.4); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card-2); margin-bottom: 16px; font-size: 13.5px; }
.flash.ok { border-color: rgba(74,222,128,.3); background: var(--ok-soft); color: #c9f7d8; }
.flash.err { border-color: rgba(255,107,107,.3); background: var(--danger-soft); color: #ffd1d1; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .95fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.04); color: var(--muted); font-size: 11.5px; font-weight: 700; }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }

.security-list { display: grid; gap: 13px; }
.security-item { display: flex; align-items: flex-start; gap: 12px; }
.security-item > .icon { flex: 0 0 auto; margin-top: 2px; color: var(--gold); }
.security-item strong { display: block; font-size: 13.5px; line-height: 1.35; }
.security-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .card-head, .card-body { padding: 16px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
}
