@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap; src: url("/manrope-cyrillic-wght-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap; src: url("/manrope-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #0d100d;
  --surface: #141914;
  --surface-2: #1a201a;
  --line: #242c24;
  --line-2: #2f382f;
  --text: #e9eee7;
  --muted: #8f9a90;
  --faint: #667067;
  --accent: #c9eb55;
  --accent-ink: #141a07;
  --accent-soft: rgba(201, 235, 85, .12);
  --ok: #52c98e;
  --warn: #efb23a;
  --bad: #ff705f;
  --info: #62adff;
  --violet: #9d8cff;
  --ok-soft: rgba(82, 201, 142, .13);
  --warn-soft: rgba(239, 178, 58, .13);
  --bad-soft: rgba(255, 112, 95, .13);
  --info-soft: rgba(98, 173, 255, .13);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --r: 12px;
  --r-sm: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-2: #f6f8f4;
  --line: #e1e6dd;
  --line-2: #cdd5c8;
  --text: #171c15;
  --muted: #5f6a5d;
  --faint: #8a9487;
  --accent: #6c8f00;
  --accent-ink: #ffffff;
  --accent-soft: rgba(108, 143, 0, .1);
  --ok: #17935b;
  --warn: #b97a00;
  --bad: #d23f2e;
  --info: #1f78d1;
  --violet: #6a55e0;
  --ok-soft: rgba(23, 147, 91, .1);
  --warn-soft: rgba(185, 122, 0, .1);
  --bad-soft: rgba(210, 63, 46, .09);
  --info-soft: rgba(31, 120, 209, .09);
  --shadow: 0 18px 50px rgba(30, 40, 20, .16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; border-right: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.brand span { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; color: var(--faint); font-weight: 600; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: var(--r-sm); color: var(--muted); font-weight: 600; transition: background .12s, color .12s; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.on { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav a.on svg { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; color: var(--faint); }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); width: 100%; background: none; border: 0; text-align: left; }
.me:hover { background: var(--surface); }
.me b { display: block; font-size: 13px; line-height: 1.2; }
.me span { font-size: 12px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); flex: none; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }

.main { min-width: 0; padding: 0 32px 64px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; height: 68px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
.top h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.top .sub { color: var(--muted); font-size: 13px; }
.top .grow { flex: 1; }
.burger { display: none; }
.content { display: grid; gap: 16px; padding-top: 4px; }

/* ---------- элементы ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h2 { margin: 0; font-size: 14px; font-weight: 700; }
.card-h .hint { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.card-b { padding: 14px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; display: grid; gap: 4px; }
.kpi .l { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .v { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; min-height: 18px; }
.kpi .spark { margin-top: 6px; height: 28px; }
.up { color: var(--ok); } .down { color: var(--bad); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 700; font-size: 13.5px; transition: background .12s, border-color .12s, opacity .12s; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-2)); background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }

.field { display: grid; gap: 6px; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg); transition: border-color .12s; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f9a90' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--faint); pointer-events: none; }
.search .input { padding-left: 38px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); flex-wrap: wrap; }
.seg button { height: 30px; padding: 0 12px; border: 0; background: none; border-radius: 7px; color: var(--muted); font-weight: 700; font-size: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .grow { flex: 1; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- таблицы ---------- */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--faint); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--surface-2); }
.t .r { text-align: right; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who b { display: block; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; max-width: 280px; white-space: nowrap; }
.who span { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; max-width: 280px; white-space: nowrap; }
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pager .grow { flex: 1; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty b { color: var(--text); font-size: 15px; }

/* ---------- графики ---------- */
.chart { position: relative; width: 100%; }
.chart svg { overflow: visible; }
.chart text { fill: var(--faint); font-size: 11.5px; font-family: inherit; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; z-index: 3; pointer-events: none; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow); white-space: nowrap; transform: translate(-50%, -100%); }
.tip b { display: block; margin-bottom: 3px; }
.tip div { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.bars { display: grid; gap: 11px; }
.bar-row { display: grid; gap: 5px; }
.bar-row .top2 { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.bar-row .top2 span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-track { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); min-width: 2px; }
.split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.split i { display: block; height: 100%; }

/* ---------- список событий (Discord) ---------- */
.feed { display: grid; gap: 12px; }
.ev { display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.ev-h { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.embed { border-left: 4px solid var(--line-2); background: var(--surface-2); border-radius: 4px 8px 8px 4px; padding: 10px 14px 12px; display: grid; gap: 6px; }
.embed .a { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.embed .tt { font-weight: 800; font-size: 14.5px; }
.embed .ds { color: var(--text); font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.embed pre, .code { margin: 4px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font: 12.5px/1.55 var(--mono); overflow-x: auto; white-space: pre; }
.embed code { font-family: var(--mono); font-size: .92em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin-top: 2px; }
.fields .f b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.fields .f span { font-size: 13.5px; word-break: break-word; }
.embed .ft { font-size: 12px; color: var(--faint); }

/* ---------- панели ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(4, 6, 4, .6); animation: fade .15s ease-out; }
.drawer { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg); border-left: 1px solid var(--line-2); display: flex; flex-direction: column; animation: slide .2s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow); }
.drawer-h { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-h .grow { flex: 1; min-width: 0; }
.drawer-b { overflow-y: auto; padding: 18px 20px 40px; display: grid; gap: 18px; align-content: start; }
.sec { display: grid; gap: 10px; }
.sec > h4 { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.sec > h4 .badge { margin-left: auto; }
.rows { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); min-height: 46px; }
.row:last-child { border-bottom: 0; }
.row .k { color: var(--muted); font-size: 13px; min-width: 120px; }
.row .v { margin-left: auto; text-align: right; font-weight: 600; word-break: break-word; min-width: 0; }
.row .grow { flex: 1; min-width: 0; }
.row small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.callout { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--r-sm); background: var(--info-soft); color: var(--info); font-size: 13px; line-height: 1.45; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.bad { background: var(--bad-soft); color: var(--bad); }
.callout svg { margin-top: 2px; }

.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); animation: pop .16s ease-out; max-height: calc(100vh - 40px); overflow: auto; }
.modal.wide { width: min(560px, 100%); }
.modal-h { padding: 20px 22px 4px; }
.modal-h h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.modal-h p { margin: 0; color: var(--muted); }
.modal-b { padding: 14px 22px; display: grid; gap: 14px; }
.modal-f { padding: 8px 22px 20px; display: flex; gap: 8px; justify-content: flex-end; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.plan { height: 52px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg); font-weight: 700; display: grid; place-items: center; line-height: 1.2; padding: 4px; }
.plan small { color: var(--muted); font-weight: 500; font-size: 12px; }
.plan.on { border-color: var(--accent); background: var(--accent-soft); }
.pick { border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); max-height: 220px; overflow: auto; }
.pick button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--line); }
.pick button:last-child { border-bottom: 0; }
.pick button:hover, .pick button.on { background: var(--surface-2); }

.toasts { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 600; animation: pop .16s ease-out; }
.toast.ok svg { color: var(--ok); } .toast.bad svg { color: var(--bad); }

.skel { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(32px); opacity: 0; } }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: min(400px, 100%); display: grid; gap: 22px; }
.login-card .brand { padding: 0; }
.login-card h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
.login-card p { margin: 0; color: var(--muted); }
.login-form { display: grid; gap: 14px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.pw { position: relative; }
.pw .input { padding-right: 44px; }
.pw button { position: absolute; right: 4px; top: 4px; width: 30px; height: 30px; border: 0; background: none; color: var(--muted); border-radius: 6px; display: grid; place-items: center; }
.pw button:hover { color: var(--text); background: var(--surface-2); }
.err { color: var(--bad); font-size: 13px; min-height: 20px; display: flex; gap: 6px; align-items: center; }
.login small { color: var(--faint); text-align: center; display: block; }

/* ---------- адаптив ---------- */
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 264px; translate: -100% 0; transition: translate .2s ease; box-shadow: var(--shadow); }
  .side.open { translate: 0 0; }
  .burger { display: inline-flex; }
  .main { padding: 0 16px 56px; }
  .top { height: 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .search { max-width: none; flex-basis: 100%; }
  .t th, .t td { padding: 11px 12px; }
  .hide-m { display: none; }
}
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi { padding: 14px; } .kpi .v { font-size: 25px; } .plans { grid-template-columns: repeat(2, 1fr); } .row .k { min-width: 96px; } }
