/* Copyright RuEngine contributors. SPDX-License-Identifier: Apache-2.0 */
/* Панель администратора «Приморска»: тёмная тема сайта (Tools/Site/index.html). */
@font-face { font-family: Onest; src: url(fonts/Onest-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Onest; src: url(fonts/Onest-Medium.ttf) format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Onest; src: url(fonts/Onest-SemiBold.ttf) format("truetype"); font-weight: 600 800; font-display: swap; }

:root {
  --bg: #0b0e13; --panel: #12161d; --panel2: #181d26; --line: #232a35; --line2: #2d3542;
  --text: #e8ebf0; --text2: #a7b0bd; --muted: #6d7787;
  --accent: #f2a33a; --accent2: #ffc069; --ink: #1c1204;
  --ok: #5bb05e; --info: #6cb6ff; --warn: #e8c14a; --bad: #e5604f; --violet: #a98bff; --teal: #4fc7b8;
  --radius: 14px; --side: 232px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 Onest, system-ui, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
input, select, textarea, button { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a313d; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* --- общие элементы --- */
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; }
.logo b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--ink); font-size: 14px; flex: none; }
.logo span { display: flex; flex-direction: column; line-height: 1.15; font-size: 16px; }
.logo small { color: var(--muted); font-weight: 500; font-size: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  font-weight: 600; font-size: 14px; line-height: 1; border-radius: 10px; padding: 11px 16px; transition: background .12s, transform .12s, opacity .12s; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent2); }
.btn-ghost { background: #ffffff0d; color: var(--text); border: 1px solid #ffffff1a; }
.btn-ghost:hover:not(:disabled) { background: #ffffff1a; }
.btn-danger { background: #e5604f22; color: #ff8f80; border: 1px solid #e5604f55; }
.btn-danger:hover:not(:disabled) { background: #e5604f38; }
.btn-ok { background: #5bb05e22; color: #8fdc91; border: 1px solid #5bb05e55; }
.btn-ok:hover:not(:disabled) { background: #5bb05e38; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 9px; }
.btn-xs { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; color: var(--text2); }
.icon-btn:hover { color: var(--text); background: #222936; }
.icon-btn svg { width: 18px; height: 18px; }
input, select, textarea { background: #0e1218; border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px; outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #f2a33a26; }
textarea { resize: vertical; min-height: 90px; width: 100%; }
select { cursor: pointer; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--text2); font-size: 13px; font-weight: 500; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* --- вход --- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 70% 10%, #f2a33a14, transparent 60%), radial-gradient(700px 500px at 10% 90%, #6cb6ff10, transparent 60%), var(--bg); }
.login-card { width: min(380px, 100%); background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 18px;
  padding: 30px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 30px 80px -30px #000; }
.login-card .logo { margin-bottom: 8px; }
.login-card input { padding: 12px 13px; font-size: 15px; }
.login-card .btn { padding: 14px; font-size: 15px; margin-top: 4px; }
.login-err { color: #ff8f80; min-height: 20px; font-size: 13px; }

/* --- каркас --- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100%; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 20px 14px; background: var(--panel); border-right: 1px solid var(--line); }
.side .logo { padding: 0 8px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: var(--text2); text-decoration: none; font-weight: 500; }
#nav a svg { width: 18px; height: 18px; flex: none; opacity: .9; }
#nav a:hover { background: #ffffff08; color: var(--text); }
#nav a.on { background: #f2a33a1a; color: var(--accent2); }
#nav a .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); font-size: 12.5px; color: var(--text2); display: flex; flex-direction: column; gap: 4px; }
.side-foot b { color: var(--text); font-weight: 600; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 26px; background: #0b0e13e6; backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top h1 { margin: 0; font-size: 19px; font-weight: 700; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user { color: var(--text2); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.user::before { content: ""; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #c06a1c); }
.burger { display: none; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: #ffffff08; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px #5bb05e33; }
.live.off i { background: var(--bad); box-shadow: 0 0 0 3px #e5604f33; }
.content { padding: 24px 26px 60px; display: flex; flex-direction: column; gap: 18px; }

/* --- карточки --- */
.card { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin: -2px 0 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 16px 18px 0; }
.grid { display: grid; gap: 14px; }
.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, 2fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { position: relative; padding: 15px 16px; border-radius: 13px; background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); overflow: hidden; }
.kpi .k { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 7px; }
.kpi .k svg { width: 15px; height: 15px; color: var(--accent); }
.kpi .v { font-size: 27px; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.kpi .s { color: var(--text2); font-size: 12px; margin-top: 2px; }
.kpi.hot::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--accent); }

/* --- сегментированный выбор --- */
.seg { display: inline-flex; background: #0e1218; border: 1px solid var(--line2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 11px; border-radius: 7px; cursor: pointer; color: var(--text2); font-size: 12.5px; font-weight: 600; }
.seg button.on { background: var(--panel2); color: var(--accent2); box-shadow: inset 0 0 0 1px var(--line2); }

/* --- графики --- */
.chart { position: relative; height: 210px; }
.chart canvas { width: 100%; height: 100%; display: block; }
.chart .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text2); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--bad) 0 4px, transparent 4px 7px) !important; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: #0b0e13f2; border: 1px solid var(--line2); border-radius: 9px; padding: 8px 10px; font-size: 12px; box-shadow: 0 10px 30px -10px #000; min-width: 120px; }
.tip b { display: block; margin-bottom: 4px; color: var(--text); font-weight: 600; }
.tip div { display: flex; gap: 10px; justify-content: space-between; color: var(--text2); }
.tip span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }

/* --- таблицы --- */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #12161d; position: sticky; top: 0; }
td { padding: 10px 12px; border-bottom: 1px solid #1d232d; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #ffffff06; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }
.name { font-weight: 600; }
a.name { text-decoration: none; }
a.name:hover { color: var(--accent2); }
.badge:empty { display: none; }
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--text2); font-size: 13px; }
.pager .btn { margin-left: 0; }

/* --- метки --- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #ffffff10; color: var(--text2); }
.b-ok { background: #5bb05e22; color: #8fdc91; }
.b-warn { background: #e8c14a22; color: #f3d77a; }
.b-bad { background: #e5604f22; color: #ff8f80; }
.b-info { background: #6cb6ff1f; color: #9fd0ff; }
.b-acc { background: #f2a33a22; color: var(--accent2); }
.b-vio { background: #a98bff22; color: #c7b5ff; }
.b-teal { background: #4fc7b822; color: #84e2d6; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px #5bb05e2a; }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px #e8c14a2a; }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px #e5604f2a; }
.bar { height: 6px; border-radius: 4px; background: #ffffff10; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--ok); }

/* --- лента событий --- */
.feed { display: flex; flex-direction: column; }
.ev { display: grid; grid-template-columns: 74px 92px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 8px 2px; border-bottom: 1px solid #1d232d; font-size: 13px; }
.ev:last-child { border-bottom: 0; }
.ev .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev .p { font-weight: 600; margin-right: 6px; cursor: pointer; }
.ev .p:hover { color: var(--accent2); }
.ev .x { color: var(--text2); overflow-wrap: anywhere; }
.feed.wide .ev { grid-template-columns: 140px 92px 60px minmax(0, 1fr); }

/* --- карта --- */
.map { position: relative; height: 520px; border-radius: 12px; overflow: hidden; background: #0a0d12; border: 1px solid var(--line); cursor: grab; user-select: none; }
.map.drag { cursor: grabbing; }
.map svg { width: 100%; height: 100%; display: block; }
.map .grid-l { stroke: #ffffff0a; stroke-width: 1; }
.map .grid-t { fill: #6d778799; font-size: 10px; stroke: none; }
.map .pl circle { stroke: #0b0e13; stroke-width: 2; }
.map .pl text { fill: var(--text); font-size: 12px; font-weight: 600; stroke: #0b0e13; stroke-width: 3; paint-order: stroke; }
.map .reg-t { font-size: 12px; font-weight: 700; stroke: #0b0e13; stroke-width: 3; paint-order: stroke; }
.map-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.map-info { position: absolute; left: 12px; bottom: 10px; font-size: 11.5px; color: var(--muted); background: #0b0e13cc; padding: 4px 8px; border-radius: 7px; }
.map-scale { position: absolute; right: 12px; bottom: 12px; font-size: 11px; color: var(--text2); display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.map-scale i { display: block; height: 4px; border: 2px solid var(--text2); border-top: 0; }

/* --- выезжающая карточка игрока --- */
.drawer-back { position: fixed; inset: 0; background: #0006; z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 41; background: var(--panel); border-left: 1px solid var(--line);
  transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column; box-shadow: -30px 0 80px -30px #000; }
.drawer.open { transform: none; }
.dr-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dr-head h2 { margin: 0; font-size: 19px; }
.dr-head .icon-btn { margin-left: auto; }
.avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 18px; color: var(--ink); background: linear-gradient(135deg, var(--accent2), var(--accent)); flex: none; }
.dr-body { overflow: auto; padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.dr-sec h3 { margin: 0 0 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kv div { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.kv span { display: block; color: var(--muted); font-size: 11.5px; }
.kv b { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.actions .btn { justify-content: flex-start; }
.act-form { margin-top: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.act-form .row > label { flex: 1; min-width: 110px; }
.cmd-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid #1d232d; }
.cmd-line:last-child { border-bottom: 0; }
details.raw summary { cursor: pointer; color: var(--text2); font-weight: 500; }
details.raw pre { margin: 10px 0 0; background: #0a0d12; border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto; max-height: 360px; font-size: 12px; }
.warnbox { padding: 10px 12px; border-radius: 10px; background: #e5604f14; border: 1px solid #e5604f40; color: #ffb3a8; font-size: 13px; }
.infobox { padding: 10px 12px; border-radius: 10px; background: #6cb6ff12; border: 1px solid #6cb6ff35; color: #b8dcff; font-size: 13px; }

/* --- модальное окно --- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: #000a; display: grid; place-items: center; padding: 20px; }
.modal { width: min(520px, 100%); background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line2); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 90px -20px #000; }
.modal h2 { margin: 0; font-size: 18px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* --- уведомления --- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--ok); border-radius: 10px; padding: 11px 14px; font-size: 13px; max-width: 380px; box-shadow: 0 10px 30px -10px #000; animation: tin .2s ease; }
.toast.err { border-left-color: var(--bad); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* --- магазин --- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.item { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 13px; display: flex; flex-direction: column; gap: 6px; }
.item .ihead { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; }
.item .nm { font-weight: 600; }
.item .ihead > :last-child { flex: none; }
.item .pr { color: var(--accent2); font-weight: 700; font-variant-numeric: tabular-nums; }
.item .ds { color: var(--text2); font-size: 12.5px; }
.item .id { color: var(--muted); font-size: 11.5px; }
.hbar { display: grid; grid-template-columns: 150px 1fr 110px; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.hbar .bar { height: 8px; }
.hbar .bar i { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.news-item { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; gap: 14px; }
.news-item:last-child { border-bottom: 0; }
.news-item h3 { margin: 0 0 4px; font-size: 15px; }
.news-item p { margin: 0; color: var(--text2); white-space: pre-wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input { width: 200px; }

@media (max-width: 1200px) { .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; width: var(--side); transform: translateX(-100%); transition: transform .2s; }
  .app.menu .side { transform: none; }
  .burger { display: grid; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .top { padding: 0 16px; }
  .user { display: none; }
  .actions { grid-template-columns: 1fr 1fr; }
}
