/* botmax-core — вся вёрстка. Тёмная тема, никаких внешних ресурсов и шрифтов:
   только системные шрифты, обычный CSS и инлайн-SVG из app/views.py. */

:root {
  --bg: #0d1117;
  --bg-soft: #131a22;
  --card: #161d26;
  --line: #232c38;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #2f81f7;
  --accent-dark: #1f6feb;
  --ok: #2ea043;
  --warn: #d29922;
  --fail: #da3633;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  background: #0b1017;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ---------- каркас ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); padding: 4px 2px; }
.topbar nav a:hover { color: var(--text); text-decoration: none; border-bottom: 2px solid var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

main { max-width: 1200px; margin: 0 auto; padding: 22px; }
footer { max-width: 1200px; margin: 0 auto; padding: 8px 22px 30px; font-size: 12px; }

h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 16px; margin: 0 0 12px; color: #cbd5e1; }

.muted { color: var(--muted); font-size: 12.5px; }

/* ---------- карточки и сетки ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 0 0 18px;
}
.card.narrow { max-width: 460px; margin: 40px auto; }
.card.danger { border-color: #6b2320; background: #1c1414; }
.card.danger h2 { color: #ffb3ae; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile b { font-size: 22px; }
.tile .label { color: var(--muted); font-size: 12px; }
.tile.accent { border-color: #1b4b8a; }
.tile.accent b { color: #79c0ff; }

/* ---------- таблицы ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: #1b232d; }
tfoot td { border-top: 2px solid var(--line); font-weight: 600; }
td.meta { max-width: 320px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; overflow-wrap: anywhere; }
.table-wrap, .card table { overflow-x: auto; display: block; }
@media (min-width: 901px) { .card table { display: table; } }

/* ---------- статусы ---------- */

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.paid, .badge.ok { background: #10331b; color: #56d364; border-color: #1d6b32; }
.badge.created { background: #1c2a3a; color: #79c0ff; border-color: #24507f; }
.badge.abandoned { background: #3a2f10; color: #e3b341; border-color: #6b5312; }
.badge.failed, .badge.fulfill_failed { background: #3a1614; color: #ff7b72; border-color: #7c2620; }
.badge.attention { background: #3a2f10; color: #e3b341; border-color: #6b5312; }
.badge.muted, .badge.count { background: #1d2530; color: var(--muted); border-color: var(--line); }
.badge.kind { background: #1b2330; color: #a5b4c8; border-color: var(--line); font-family: ui-monospace, Consolas, monospace; }

/* ---------- воронка ---------- */

.funnel .bar {
  display: inline-block;
  width: 90px;
  height: 7px;
  background: #1d2530;
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
  margin-left: 8px;
}
.funnel .bar i { display: block; height: 100%; background: var(--accent); }
.funnel .conv { font-weight: 600; }

/* ---------- формы ---------- */

.filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
}
.filters label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.filters label.check { flex-direction: row; align-items: center; gap: 6px; }
select, input[type="text"], input[type="password"] {
  background: #0b1017;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  font: inherit;
  min-width: 160px;
}
input[type="password"] { width: 100%; }

.btn {
  background: var(--accent-dark);
  color: #fff;
  border: 1px solid #2b6fd0;
  border-radius: 7px;
  padding: 7px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: #2b7ef0; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.ghost:hover { color: var(--text); background: #1b232d; }
.btn.warn { background: #8a6d1f; border-color: #a9852a; }
.btn.warn:hover { background: #a2801f; }
form.inline { display: inline-flex; align-items: center; gap: 10px; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack label { color: var(--muted); font-size: 12.5px; }

.alert { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); }
.alert.error { background: #2a1414; border-color: #7c2620; color: #ffb3ae; }
.alert.warn { background: #2a2410; border-color: #6b5312; color: #e3b341; }
.alert.ok { background: #10291a; border-color: #1d6b32; color: #56d364; }

details { margin-top: 14px; }
summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }

ul.plain { list-style: none; padding-left: 0; margin: 0 0 14px; }
ul.plain li { padding: 3px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
