/* MC Panel v2 — плоский минимализм. Без градиентов, без размытий, без свечений. Иерархия — поверхностями и 1px границами. */
:root {
  --bg: #0b0c0f;
  --surface: #111318;
  --surface-2: #171a21;
  --surface-3: #1d212a;
  --border: #23272f;
  --border-strong: #2e333d;
  --text: #e6e8ee;
  --text-2: #9aa3b2;
  --text-3: #6b7383;
  --accent: #34d399;
  --accent-ink: #06281c;
  --accent-soft: rgba(52, 211, 153, 0.12);
  --warn: #f5b942;
  --warn-soft: rgba(245, 185, 66, 0.12);
  --danger: #f25f5f;
  --danger-soft: rgba(242, 95, 95, 0.12);
  --info: #6aa9ff;
  --info-soft: rgba(106, 169, 255, 0.12);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  --radius-s: 6px;
  --radius-xs: 4px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --sidebar-w: 232px;
  --topbar-h: 52px;
  --dur: 140ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e9ecf1;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #14161a;
  --text-2: #4d5665;
  --text-3: #7b8494;
  --accent: #059669;
  --accent-ink: #ffffff;
  --accent-soft: rgba(5, 150, 105, 0.1);
  --warn: #b7791f;
  --warn-soft: rgba(183, 121, 31, 0.1);
  --danger: #d43d3d;
  --danger-soft: rgba(212, 61, 61, 0.1);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.1);
  --shadow-pop: 0 8px 24px rgba(20, 22, 26, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font); font-size: 13.5px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }
::selection { background: var(--accent-soft); }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex.wrap { flex-wrap: wrap; }
.flex.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.ml-auto { margin-left: auto; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.divider { height: 1px; background: var(--border); margin: 8px 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Вход */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: var(--bg); z-index: 5; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.login-card .brand { padding: 0; margin-bottom: 20px; }
.login-card h1 { font-size: 18px; margin-bottom: 4px; }
.login-card .stack { margin-top: 18px; }
.form-error { padding: 8px 10px; border-radius: var(--radius-s); background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger); font-size: 12.5px; }
.form-error.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }

/* Каркас */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 4; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; height: var(--topbar-h); border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.brand img, .brand .mark { width: 22px; height: 22px; border-radius: 5px; display: block; }
.brand .sidebar-close { margin-left: auto; display: none; }
.nav { flex: 1; overflow-y: auto; padding: 8px 8px; }
.nav-group { margin-bottom: 6px; }
.nav-group > .label { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 10px 5px; border: 0; background: transparent; cursor: pointer; text-align: left; border-radius: var(--radius-s); }
.nav-group > .label:hover { background: var(--surface-2); color: var(--text-2); }
.nav-group > .label > span:first-child { flex: 1; }
.nav-group > .label .cnt { font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-group > .label svg { width: 14px; height: 14px; color: var(--text-3); transition: transform var(--dur) var(--ease); transform: rotate(90deg); }
.nav-group.collapsed > .label svg { transform: rotate(0deg); }
.nav-group.collapsed > a { display: none; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius-s); color: var(--text-2); position: relative; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); text-decoration: none; font-weight: 500; }
.theme-top span { font-size: 12.5px; }

/* Настройка сервера: строки «подпись — контрол» */
.qrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.qrow:last-child { border-bottom: 0; }
.qrow-text { min-width: 0; flex: 1 1 240px; }
.qrow-title { font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qrow-ctl { flex: none; display: flex; align-items: center; gap: 8px; }
.qrow.changed .qrow-title { color: var(--accent); }
.qslider { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.qslider .range { width: 160px; }
.qslider output { min-width: 78px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
@media (max-width: 760px) { .qrow { flex-direction: column; align-items: stretch; } .qslider { min-width: 0; } .qslider .range { flex: 1; } }
.nav a svg { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a:hover svg { color: var(--text-2); }
.nav a.active { background: var(--surface-3); color: var(--text); }
.nav a.active svg { color: var(--accent); }
.nav a.active::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 2px; background: var(--accent); border-radius: 1px; }
.nav a .cnt { margin-left: auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.addr { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--bg); }
.addr code { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.user-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.user-row .who { flex: 1; min-width: 0; }
.user-row .who b { display: block; font-weight: 600; }
.user-row .who span { color: var(--text-3); font-size: 11px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 3; height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--border); }
.burger { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.crumbs b { color: var(--text); font-weight: 600; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px 0 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-weight: 500; font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.running { background: var(--accent); }
.dot.starting, .dot.stopping { background: var(--warn); animation: blink 1s steps(2, start) infinite; }
.dot.failed { background: var(--danger); }
@keyframes blink { to { visibility: hidden; } }
.top-metrics { display: flex; gap: 6px; }
.metric { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.metric b { color: var(--text); font-weight: 600; }
.metric i { font-style: normal; color: var(--text-3); }
.metric svg { width: 14px; height: 14px; color: var(--text-3); }
.metric.ok b { color: var(--accent); } .metric.warn b { color: var(--warn); } .metric.danger b { color: var(--danger); }
.power { margin-left: auto; display: flex; gap: 6px; }
.content { padding: 20px 20px 48px; max-width: 1440px; width: 100%; margin: 0 auto; animation: fade var(--dur) var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.page-head h1 svg { width: 20px; height: 20px; color: var(--text-3); }
.page-head .sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-s); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease); user-select: none; }
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-3); border-color: var(--text-3); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; 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(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.warn { color: var(--warn); border-color: var(--warn); background: transparent; }
.btn.warn:hover { background: var(--warn-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: var(--radius-xs); }
.btn.xs svg { width: 13px; height: 13px; }
.btn.wide { width: 100%; }
.btn.active { border-color: var(--accent); color: var(--accent); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-s); border: 1px solid transparent; background: transparent; color: var(--text-3); cursor: pointer; transition: background var(--dur), color var(--dur); flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn svg { width: 15px; height: 15px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-s); overflow: hidden; }
.seg button { height: 28px; padding: 0 10px; border: 0; border-right: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--surface-3); color: var(--text); }

/* Формы */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.input, .select, .textarea { width: 100%; height: 32px; padding: 0 10px; border-radius: var(--radius-s); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); outline: none; transition: border-color var(--dur); }
[data-theme="light"] .input, [data-theme="light"] .select, [data-theme="light"] .textarea { background: var(--surface); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.input.sm, .select.sm { height: 28px; font-size: 12.5px; }
.input.mono { font-family: var(--mono); font-size: 12.5px; }
.textarea { height: auto; min-height: 88px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 9px center; }
.select option { background: var(--surface); color: var(--text); }
.input[type="number"] { font-variant-numeric: tabular-nums; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 140px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .tk { width: 32px; height: 18px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background var(--dur); flex: none; }
.switch .tk::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); transition: transform var(--dur) var(--ease); }
[data-theme="light"] .switch .tk::after { background: #fff; }
.switch input:checked + .tk { background: var(--accent); }
.switch input:checked + .tk::after { transform: translateX(14px); background: var(--accent-ink); }
.switch input:focus-visible + .tk { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .tk { opacity: 0.4; }
.range { width: 100%; accent-color: var(--accent); }
.checkbox { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* Карточки и метрики */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head h2 svg, .card-head h3 svg { width: 16px; height: 16px; color: var(--text-3); }
.card.pad-0 .card-head { padding: 12px 16px; margin: 0; border-bottom: 1px solid var(--border); }
.grid { display: grid; gap: 12px; }
.grid > *, .stack > * { min-width: 0; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.stat .label { display: flex; justify-content: space-between; align-items: center; }
.stat .label svg { width: 14px; height: 14px; color: var(--text-3); }
.stat .value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .value small { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.stat .sub { font-size: 12px; color: var(--text-3); }
.stat.ok .value { color: var(--accent); } .stat.warn .value { color: var(--warn); } .stat.danger .value { color: var(--danger); }
.bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); transition: width 300ms var(--ease); }
.bar.warn > span { background: var(--warn); } .bar.danger > span { background: var(--danger); } .bar.info > span { background: var(--info); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--text-3); margin: 0; }
.kv dd { margin: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--border-strong); color: var(--text-2); background: transparent; white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge.ok { color: var(--accent); border-color: var(--accent); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.danger { color: var(--danger); border-color: var(--danger); }
.badge.info { color: var(--info); border-color: var(--info); }
.badge.solid { background: var(--surface-3); border-color: transparent; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12px; background: var(--surface-2); }
.chip button { border: 0; background: transparent; color: var(--text-3); cursor: pointer; display: inline-flex; padding: 0; }
.chip button:hover { color: var(--danger); }
.chip button svg { width: 12px; height: 12px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; }
.alert svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.alert.warn { border-color: var(--warn); background: var(--warn-soft); } .alert.warn svg { color: var(--warn); }
.alert.danger { border-color: var(--danger); background: var(--danger-soft); } .alert.danger svg { color: var(--danger); }
.alert.ok { border-color: var(--accent); background: var(--accent-soft); } .alert.ok svg { color: var(--accent); }
.alert.info { border-color: var(--info); background: var(--info-soft); } .alert.info svg { color: var(--info); }

/* Таблицы */
.table-wrap { overflow-x: auto; }
.card.pad-0 .table-wrap { border: 0; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { height: 36px; padding: 0 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table td.wrap { white-space: normal; }
.table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); background: var(--surface); position: sticky; top: 0; z-index: 1; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .sort { margin-left: 4px; font-size: 10px; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.selected { background: var(--accent-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.actions { text-align: right; }
.table td.actions .icon-btn { width: 26px; height: 26px; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .checkbox { vertical-align: middle; }

/* Вкладки */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs button { height: 34px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--text-2); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; transition: color var(--dur); }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs button .cnt { margin-left: 6px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Пустое состояние, скелетоны */
.empty { padding: 36px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty svg { width: 28px; height: 28px; display: block; margin: 0 auto 8px; color: var(--text-3); }
.skeleton { background: var(--surface-3); border-radius: var(--radius-xs); min-height: 12px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.skel-rows > div { height: 36px; margin-bottom: 6px; }

/* Тосты */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(400px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-size: 12.5px; animation: rise var(--dur) var(--ease); }
.toast svg { flex: none; width: 15px; height: 15px; margin-top: 1px; }
.toast.success svg { color: var(--accent); } .toast.error svg { color: var(--danger); } .toast.info svg { color: var(--info); } .toast.warn svg { color: var(--warn); }
.toast.leaving { opacity: 0; transition: opacity var(--dur); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Модалки и drawer */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; z-index: 40; padding: 20px; animation: fade var(--dur); }
.modal { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-pop); max-height: calc(100vh - 40px); overflow: auto; animation: rise var(--dur) var(--ease); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 15px; }
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 30; animation: fade var(--dur); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface); border-left: 1px solid var(--border-strong); z-index: 31; display: flex; flex-direction: column; animation: slide var(--dur) var(--ease); }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); height: var(--topbar-h); }
.drawer-head h2 { font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.menu { position: fixed; z-index: 50; min-width: 190px; padding: 4px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); animation: rise var(--dur) var(--ease); }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px; border: 0; background: transparent; border-radius: var(--radius-xs); text-align: left; cursor: pointer; font-size: 13px; color: var(--text); }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu button svg { width: 14px; height: 14px; color: var(--text-3); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* Палитра команд */
.palette-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 70; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: fade var(--dur); }
.palette { width: min(640px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-pop); overflow: hidden; animation: rise var(--dur) var(--ease); }
.palette .input { height: 44px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; font-size: 14px; padding: 0 14px; }
.palette .input:focus { border-color: var(--border); }
.palette-list { max-height: 50vh; overflow: auto; padding: 6px; }
.palette-list .group { padding: 8px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--radius-s); cursor: pointer; font-size: 13px; }
.palette-item svg { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.palette-item .sub { margin-left: auto; color: var(--text-3); font-size: 11.5px; }
.palette-item.sel, .palette-item:hover { background: var(--surface-3); }
.palette-foot { display: flex; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }

/* Консоль */
.console { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 120px); min-height: 420px; }
.console-toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.console-toolbar .input { max-width: 240px; }
.level-toggles { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-s); overflow: hidden; }
.level-toggles button { height: 28px; padding: 0 9px; border: 0; border-right: 1px solid var(--border-strong); background: var(--surface); color: var(--text-3); font-size: 11.5px; font-weight: 600; cursor: pointer; letter-spacing: 0.04em; }
.level-toggles button:last-child { border-right: 0; }
.level-toggles button.on { color: var(--text); background: var(--surface-3); }
.level-toggles button.on.WARN { color: var(--warn); } .level-toggles button.on.ERROR { color: var(--danger); } .level-toggles button.on.CHAT { color: var(--accent); }
.console-view { position: relative; flex: 1; min-height: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.console-lines { height: 100%; overflow-y: auto; padding: 8px 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.cl { display: flex; gap: 10px; white-space: pre-wrap; word-break: break-word; padding: 1px 0; min-width: 0; }
.cl .x { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.cl .t { color: var(--text-3); flex: none; }
.cl .lv { flex: none; width: 44px; font-weight: 600; color: var(--text-3); }
.cl.WARN .lv, .cl.WARN .x { color: var(--warn); }
.cl.ERROR .lv, .cl.ERROR .x { color: var(--danger); }
.cl.CHAT .lv { color: var(--accent); }
.cl.CMD .lv { color: var(--info); } .cl.CMD .x { color: var(--info); }
.cl.RES .lv { color: var(--text-2); } .cl.RES .x { color: var(--text-2); }
.cl mark { background: var(--warn-soft); color: var(--text); border-radius: 2px; }
.scroll-down { position: absolute; right: 12px; bottom: 12px; display: none; }
.scroll-down.show { display: inline-flex; }
.console-input { display: flex; gap: 6px; margin-top: 8px; position: relative; }
.console-input .input { font-family: var(--mono); padding-left: 26px; height: 36px; }
.console-input .prompt { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-family: var(--mono); pointer-events: none; }
.suggest { position: absolute; left: 0; bottom: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-s); padding: 4px; max-height: 220px; overflow: auto; z-index: 5; min-width: 320px; box-shadow: var(--shadow-pop); }
.suggest div { height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px; border-radius: var(--radius-xs); font-family: var(--mono); font-size: 12.5px; cursor: pointer; }
.suggest div span { color: var(--text-3); font-family: var(--font); font-size: 12px; }
.suggest div:hover, .suggest div.sel { background: var(--surface-3); }
.mini-console { font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 8px 10px; max-height: 220px; overflow: auto; max-width: 100%; }
.mini-console .cl { white-space: pre-wrap; word-break: break-word; }
.log-view { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 10px; max-height: calc(100vh - 300px); overflow: auto; white-space: pre-wrap; word-break: break-word; }
.log-view mark { background: var(--warn-soft); color: var(--text); border-radius: 2px; }

/* MOTD и форматирование Minecraft */
.mc-preview { font-family: var(--mono); font-size: 13px; line-height: 1.5; background: #1c1c1c; color: #aaa; border-radius: var(--radius-s); padding: 8px 10px; border: 1px solid #333; white-space: pre-wrap; }
.mc-c0 { color: #000 } .mc-c1 { color: #0000aa } .mc-c2 { color: #00aa00 } .mc-c3 { color: #00aaaa } .mc-c4 { color: #aa0000 } .mc-c5 { color: #aa00aa } .mc-c6 { color: #ffaa00 } .mc-c7 { color: #aaa } .mc-c8 { color: #555 } .mc-c9 { color: #5555ff } .mc-ca { color: #55ff55 } .mc-cb { color: #55ffff } .mc-cc { color: #ff5555 } .mc-cd { color: #ff55ff } .mc-ce { color: #ffff55 } .mc-cf { color: #fff }
.mc-bold { font-weight: 700 } .mc-italic { font-style: italic } .mc-underline { text-decoration: underline } .mc-strike { text-decoration: line-through } .mc-obf { opacity: .6 }
.slp { display: flex; gap: 12px; align-items: center; background: #1c1c1c; border: 1px solid #333; border-radius: var(--radius-s); padding: 8px 10px; color: #aaa; }
.slp img { width: 64px; height: 64px; image-rendering: pixelated; border-radius: 4px; background: #111; flex: none; }
.slp .name { color: #fff; font-family: var(--mono); font-size: 13px; }
.slp .motd { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; line-height: 1.4; }
.slp .players { margin-left: auto; color: #aaa; font-family: var(--mono); font-size: 12px; white-space: nowrap; }

/* Игроки */
.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.player-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.player-card .top { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: var(--radius-xs); image-rendering: pixelated; background: var(--surface-3); flex: none; }
.avatar.sm { width: 22px; height: 22px; }
.avatar.lg { width: 56px; height: 56px; }
.player-card .name { font-weight: 600; }
.player-card .acts { display: flex; flex-wrap: wrap; gap: 4px; }
.skin-body { width: 120px; image-rendering: pixelated; display: block; margin: 0 auto; }

/* Файлы */
.files { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.files.with-editor { grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.4fr); }
.crumbs-path { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 13px; font-family: var(--mono); }
.crumbs-path a, .crumbs-path span { padding: 2px 6px; border-radius: var(--radius-xs); }
.crumbs-path a { color: var(--text-2); cursor: pointer; }
.crumbs-path a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.crumbs-path .sep { color: var(--text-3); padding: 0; }
.crumbs-path .cur { color: var(--text); font-weight: 500; }
.file-toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.file-list { border: 1px dashed transparent; border-radius: var(--radius-s); transition: border-color var(--dur), background var(--dur); }
.file-list.drag { border-color: var(--accent); background: var(--accent-soft); }
.file-row { display: grid; grid-template-columns: 22px 20px minmax(0, 1fr) 80px 120px 28px; align-items: center; gap: 8px; height: 34px; padding: 0 8px; border-radius: var(--radius-xs); font-size: 13px; }
.file-row:hover { background: var(--surface-2); }
.file-row.selected { background: var(--accent-soft); }
.file-row .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fname.clickable { cursor: pointer; }
.file-row .fname.clickable:hover { color: var(--accent); }
.file-row .fi { color: var(--text-3); display: inline-flex; }
.file-row .fi svg { width: 15px; height: 15px; }
.file-row .fi.dir { color: var(--warn); } .file-row .fi.jar { color: var(--info); } .file-row .fi.txt { color: var(--text-2); } .file-row .fi.img { color: var(--accent); } .file-row .fi.zip { color: var(--text-2); }
.file-row .fsize, .file-row .fdate { color: var(--text-3); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.editor-card { display: flex; flex-direction: column; min-height: 520px; padding: 0; overflow: hidden; }
.editor-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.editor-head .fname { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.editor-head .dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); display: none; }
.editor-head .dirty.on { display: inline-block; }
.editor-body { flex: 1; min-height: 440px; }
.editor-body .CodeMirror { height: 100%; min-height: 440px; font-family: var(--mono); font-size: 12.5px; background: var(--bg); color: var(--text); }
.CodeMirror-gutters { background: var(--surface) !important; border-right: 1px solid var(--border) !important; }
.CodeMirror-linenumber { color: var(--text-3) !important; }
.cm-s-material-darker.CodeMirror { background: var(--bg); }
[data-theme="light"] .cm-s-material-darker.CodeMirror { background: #fff; color: #222; }
[data-theme="light"] .cm-s-material-darker .cm-string { color: #1a7f37; } [data-theme="light"] .cm-s-material-darker .cm-keyword, [data-theme="light"] .cm-s-material-darker .cm-atom { color: #8250df; } [data-theme="light"] .cm-s-material-darker .cm-number { color: #0550ae; } [data-theme="light"] .cm-s-material-darker .cm-comment { color: #6e7781; } [data-theme="light"] .cm-s-material-darker .cm-property, [data-theme="light"] .cm-s-material-darker .cm-def { color: #953800; }
[data-theme="light"] .cm-s-material-darker .CodeMirror-cursor { border-left-color: #222; }
.upload-progress { margin-top: 8px; }

/* Плагины */
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.plugin-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.plugin-card .top { display: flex; align-items: flex-start; gap: 10px; }
.plugin-card .pi { width: 32px; height: 32px; border-radius: var(--radius-xs); display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.plugin-card .pi svg { width: 16px; height: 16px; }
.plugin-card .pn { font-weight: 600; }
.plugin-card .pd { color: var(--text-2); font-size: 12.5px; }
.plugin-card .pf { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.hangar-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface); }
.hangar-row img, .hangar-row .pi { width: 32px; height: 32px; border-radius: var(--radius-xs); object-fit: cover; background: var(--surface-3); flex: none; }
.hangar-row .hn { font-weight: 600; }
.hangar-row .hd { color: var(--text-2); font-size: 12.5px; }

/* Настройки */
.prop-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(200px, 1.3fr) 200px; gap: 10px; align-items: center; min-height: 40px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.prop-row:last-child { border-bottom: 0; }
.prop-row .pk { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.prop-row .pd { font-size: 12px; color: var(--text-3); }
.prop-row .badge { margin-left: 6px; }
.prop-row .pv { display: flex; align-items: center; gap: 8px; }
.prop-row.changed .pk { color: var(--warn); }
.sticky-save { position: sticky; bottom: 12px; z-index: 2; display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 14px; margin-top: 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.icon-preview { width: 64px; height: 64px; border-radius: var(--radius-s); image-rendering: pixelated; border: 1px solid var(--border); background: var(--surface-3); }
.heatmap { display: grid; grid-template-columns: 40px repeat(24, 1fr); gap: 2px; font-size: 10.5px; color: var(--text-3); }
.heatmap .cell { height: 16px; border-radius: 2px; background: var(--surface-3); }
.chart-card canvas { width: 100% !important; height: 220px !important; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline .ev { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.timeline .ev:last-child { border-bottom: 0; }
.timeline .ev .t { color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; width: 44px; }
.timeline .ev svg { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--text-3); }
.timeline .ev.join svg { color: var(--accent); } .timeline .ev.leave svg { color: var(--text-3); } .timeline .ev.death svg { color: var(--danger); } .timeline .ev.advancement svg { color: var(--warn); }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.quick-actions .btn { justify-content: flex-start; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Адаптив */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 9; }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform 180ms var(--ease); z-index: 10; }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.show { display: block; }
  .brand .sidebar-close { display: inline-flex; }
  .burger { display: inline-flex; }
  .files.with-editor { grid-template-columns: 1fr; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prop-row { grid-template-columns: 1fr; gap: 4px; }
  .crumbs { display: none; }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: var(--topbar-h); flex-wrap: wrap; padding: 8px 12px; gap: 6px; }
  .top-metrics { order: 3; width: 100%; }
  .power { order: 2; }
  .power .btn { padding: 0 8px; }
  .content { padding: 12px 12px 40px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .file-row { grid-template-columns: 22px 20px minmax(0, 1fr) 28px; }
  .file-row .fsize, .file-row .fdate { display: none; }
  .console { height: calc(100vh - 220px); }
  .modal { padding: 16px; }
  .drawer { width: 100vw; }
}
