:root {
  --bg: #0e1215;
  --panel: #161b1f;
  --panel-2: #1c2227;
  --line: #2a3238;
  --text: #e6edf0;
  --muted: #8b989f;
  --accent: #14b8a6;
  --accent-2: #0f766e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #22c55e;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 16px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #062a26;
  display: grid; place-items: center; font-weight: 800;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0;
  color: var(--muted); border-radius: 8px;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: rgba(20, 184, 166, .14); color: var(--text); }
.nav .ico { width: 18px; text-align: center; }
.nav .sep { height: 1px; background: var(--line); margin: 10px 8px; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  padding: 12px 24px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 5;
}
.topbar .menu-btn { display: none; margin-right: auto; }
.content { padding: 24px; max-width: 1200px; }
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: -10px 0 18px; }

/* ---------- elements ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px; font-size: 13px; cursor: default;
}
.chip.click { cursor: pointer; }
.chip.click:hover { border-color: var(--accent); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 16px; }
.grid .card { margin: 0; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.banner {
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  border: 1px solid; font-size: 14px;
}
.banner.warn { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .4); }
.banner.danger { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .4); }
.banner.info { background: rgba(20, 184, 166, .08); border-color: rgba(20, 184, 166, .35); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font: inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #062a26; font-weight: 600; }
.btn.primary:hover { background: #2dd4bf; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; flex: 1; min-width: 180px; }
.field.narrow { flex: 0 0 140px; min-width: 120px; }
label { color: var(--muted); font-size: 13px; }
input, select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); margin-bottom: 12px; cursor: pointer; }
.check input { width: auto; }
.help { color: var(--muted); font-size: 12.5px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: var(--panel-2); }
tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; }
.empty { color: var(--muted); padding: 18px 10px; text-align: center; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); color: var(--muted); margin-right: 4px;
}
.badge.ok { color: var(--ok); border-color: rgba(34, 197, 94, .4); }
.badge.accent { color: var(--accent); border-color: rgba(20, 184, 166, .45); }
.badge.danger { color: var(--danger); border-color: rgba(239, 68, 68, .4); }
.badge.warn { color: var(--warn); border-color: rgba(245, 158, 11, .4); }

.copy-box {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg); border: 1px dashed var(--accent);
  border-radius: 8px; padding: 10px 12px; margin-top: 8px;
}
.copy-box code { flex: 1; overflow-wrap: anywhere; }

/* bars */
.bars .bar-row { display: grid; grid-template-columns: 100px 1fr 90px; gap: 10px; align-items: center; margin: 8px 0; }
.bars .track { height: 14px; background: var(--panel-2); border-radius: 999px; overflow: hidden; position: relative; }
.bars .fill-total { position: absolute; inset: 0 auto 0 0; background: #33414a; border-radius: 999px; }
.bars .fill-active { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }
.bars .num { color: var(--muted); font-size: 13px; text-align: right; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.cols { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.cols .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.cols .col .b { width: 100%; max-width: 38px; background: var(--accent); border-radius: 5px 5px 0 0; min-height: 2px; }
.cols .col .v { font-size: 12px; color: var(--text); }
.cols .col .m { font-size: 11px; color: var(--muted); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .brand { justify-content: center; padding-bottom: 8px; }
.auth p.sub { text-align: center; margin: 0 0 20px; }
.auth .btn.primary { width: 100%; padding: 11px; }
.auth .switch { text-align: center; margin-top: 14px; color: var(--muted); }

/* toast */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 8px; max-width: 360px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.toast.error { border-left-color: var(--danger); }

pre.doc {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; overflow-x: auto; white-space: pre; font-size: 12.5px;
}
ol.steps li { margin-bottom: 8px; }

/* mobile */
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -260px; z-index: 20; transition: left .2s; box-shadow: 0 0 30px rgba(0, 0, 0, .5); }
  .sidebar.open { left: 0; }
  .topbar { padding: 10px 14px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .bars .bar-row { grid-template-columns: 80px 1fr 70px; }
}

/* ---------- оплата ---------- */
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.invoice { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.invoice .qr { background: #fff; border-radius: 10px; padding: 6px; line-height: 0; }
.invoice .inv-body { flex: 1; min-width: 240px; }
code.big { font-size: 18px; font-weight: 700; }
.pay-status { padding: 10px 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.pay-status.ok { color: var(--ok); border-color: rgba(34, 197, 94, .4); }
.pay-status.warn { color: var(--warn); border-color: rgba(245, 158, 11, .4); }
td.plus { color: var(--ok); white-space: nowrap; }
td.minus { color: var(--muted); white-space: nowrap; }

/* Логотип Rayves в боковом меню (вместо буквы R) */
.brand img.logo { background: none; display: block; object-fit: cover; }
