/* =========================================================================
   LogPanel CRMP — стили. Профессиональный минимализм, тёмная/светлая тема.
   ========================================================================= */

/* ---- Темы через CSS-переменные ---- */
:root,
[data-theme="dark"] {
    --bg:        #0f1115;
    --bg-2:      #14161c;
    --surface:   #181b22;
    --surface-2: #1e222b;
    --border:    #272c36;
    --border-2:  #333a46;
    --text:      #e4e7ec;
    --text-dim:  #98a0ad;
    --text-mute: #6a7280;
    --accent:    #3b82f6;
    --accent-2:  #60a5fa;
    --accent-soft: rgba(59,130,246,.12);
    --ok:        #3fb950;
    --warn:      #d29922;
    --danger:    #e5484d;
    --info:      #3b82f6;
    --shadow:    0 6px 20px rgba(0,0,0,.28);
    --radius:    8px;
}

[data-theme="light"] {
    --bg:        #f5f6f8;
    --bg-2:      #ffffff;
    --surface:   #ffffff;
    --surface-2: #f7f8fa;
    --border:    #e6e8ec;
    --border-2:  #d4d8df;
    --text:      #1c2128;
    --text-dim:  #586069;
    --text-mute: #8b949e;
    --accent:    #2563eb;
    --accent-2:  #3b82f6;
    --accent-soft: rgba(37,99,235,.08);
    --ok:        #1a7f37;
    --warn:      #9a6700;
    --danger:    #cf222e;
    --info:      #2563eb;
    --shadow:    0 6px 20px rgba(20,30,60,.07);
    --radius:    8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #fff; }
.icon { flex-shrink: 0; vertical-align: middle; }

/* ---- Скелет приложения ---- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 22px 26px; flex: 1; display: flex; flex-direction: column; gap: 18px; }

/* =========================================================================
   SIDEBAR
   ========================================================================= */
.sidebar {
    width: 248px; flex-shrink: 0;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    transition: width .22s ease;
}
.sidebar__brand {
    display: flex; align-items: center; gap: 11px;
    padding: 18px 18px; border-bottom: 1px solid var(--border);
}
.brand__logo {
    width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
    background: var(--accent);
    display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 14px; letter-spacing: -.02em;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font-size: 15px; }
.brand__text span { font-size: 11px; color: var(--text-mute); }
.sidebar__collapse {
    margin-left: auto; background: none; border: none; color: var(--text-mute);
    cursor: pointer; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
}
.sidebar__collapse:hover { background: var(--surface-2); color: var(--text); }
.sidebar__collapse svg { width: 18px; height: 18px; }

.sidebar__nav { padding: 12px 12px; flex: 1; overflow-y: auto; }
.nav__group-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-mute); padding: 14px 10px 6px; font-weight: 600;
}
.nav__item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; border-radius: 9px; color: var(--text-dim);
    font-weight: 500; margin-bottom: 2px; position: relative;
    transition: background .15s, color .15s;
}
.nav__item:hover { background: var(--surface); color: var(--text); }
.nav__item.is-active { background: var(--surface); color: var(--text); }
.nav__item.is-active::before {
    content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav__icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav__icon svg { width: 20px; height: 20px; }
.nav__item.is-active .nav__icon { color: var(--accent-2); }
.nav__label { white-space: nowrap; }
.nav__badge {
    margin-left: auto; font-size: 9.5px; font-weight: 700; text-transform: uppercase;
    background: rgba(34,197,94,.15); color: var(--ok); padding: 2px 6px; border-radius: 20px;
    letter-spacing: .04em;
}

.sidebar__foot { padding: 12px; border-top: 1px solid var(--border); }
.server-mini { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; background: var(--surface); }
.server-mini strong { font-size: 12.5px; display: block; }
.server-mini small { font-size: 11px; color: var(--text-mute); }

/* Свёрнутый сайдбар */
.sidebar.is-collapsed { width: 68px; }
.sidebar.is-collapsed .brand__text,
.sidebar.is-collapsed .nav__label,
.sidebar.is-collapsed .nav__badge,
.sidebar.is-collapsed .nav__group-label,
.sidebar.is-collapsed .server-mini > div { display: none; }
.sidebar.is-collapsed .nav__item { justify-content: center; }
.sidebar.is-collapsed .sidebar__collapse svg { transform: rotate(180deg); }

/* ---- Индикаторы статуса (точки) ---- */
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; background: var(--text-mute); }
.dot--online { background: var(--ok); }
.dot--idle { background: var(--warn); }
.dot--restart { background: var(--info); }
.dot--offline { background: var(--text-mute); }

/* =========================================================================
   TOPBAR
   ========================================================================= */
.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 26px; background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
}
.topbar__menu { display: none; background: none; border: none; color: var(--text); cursor: pointer; }
.topbar__menu svg { width: 22px; height: 22px; }
.topbar__title h1 { font-size: 18px; font-weight: 600; line-height: 1.1; }
.topbar__title .crumb { font-size: 11.5px; color: var(--text-mute); }

/* Переключатель серверов */
.server-switch { position: relative; margin-left: 6px; }
.server-switch__btn {
    display: flex; align-items: center; gap: 9px;
    background: var(--surface); border: 1px solid var(--border-2);
    color: var(--text); padding: 8px 12px; border-radius: 10px; cursor: pointer;
    font-weight: 500; font-size: 13px; max-width: 230px;
}
.server-switch__btn:hover { border-color: var(--accent); }
.server-switch__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-switch__btn svg { width: 16px; height: 16px; color: var(--text-mute); }
.server-switch__menu {
    position: absolute; top: calc(100% + 8px); left: 0; width: 320px;
    background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 8px; z-index: 60;
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .16s;
}
.server-switch.is-open .server-switch__menu { opacity: 1; visibility: visible; transform: translateY(0); }
.switch__head { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); padding: 8px 10px 6px; font-weight: 600; }
.switch__item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; }
.switch__item:hover { background: var(--surface-2); }
.switch__item.is-active { background: var(--surface-2); outline: 1px solid var(--accent); }
.switch__info { flex: 1; min-width: 0; }
.switch__info strong { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch__info small { font-size: 11px; color: var(--text-mute); }
.switch__online { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text-dim); }
.switch__add { display: block; text-align: center; padding: 9px; margin-top: 6px; border-top: 1px solid var(--border); color: var(--accent-2); font-weight: 600; font-size: 12.5px; }
.switch__add:hover { background: var(--surface-2); border-radius: 9px; }

/* Поиск */
.topbar__search {
    margin-left: auto; display: flex; align-items: center; gap: 9px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 12px; width: 320px; max-width: 32vw;
}
.topbar__search svg { width: 16px; height: 16px; color: var(--text-mute); flex-shrink: 0; }
.topbar__search input { flex: 1; background: none; border: none; color: var(--text); outline: none; font-size: 13px; min-width: 0; }
.topbar__search kbd {
    font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-mute);
    border: 1px solid var(--border-2); border-radius: 5px; padding: 2px 5px; white-space: nowrap;
}

.topbar__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-dim); cursor: pointer;
    display: grid; place-items: center; position: relative;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.icon-btn svg { width: 19px; height: 19px; }
.ic-moon { display: none; }
[data-theme="light"] .ic-sun { display: none; }
[data-theme="light"] .ic-moon { display: block; }
.badge-dot {
    position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px;
    background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 9px; display: grid; place-items: center; padding: 0 4px;
    border: 2px solid var(--bg-2);
}

.profile { display: flex; align-items: center; gap: 9px; padding: 6px 10px 6px 12px; margin-left: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-family: inherit; }
.profile:hover { border-color: var(--border-2); }
.profile__info { text-align: left; }
.profile__info strong { font-size: 13px; display: block; line-height: 1.15; color: var(--text); }
.profile__info small { font-size: 11px; color: var(--text-mute); }
.profile__caret { width: 15px; height: 15px; color: var(--text-mute); flex-shrink: 0; }

/* ---- Выпадающие меню (уведомления / профиль) ---- */
.dropdown { position: relative; }
.dropdown__menu {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 230px;
    background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 6px; z-index: 70;
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .15s;
}
.dropdown__menu--wide { width: 340px; }
.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown__head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mute); font-weight: 600; }
.dropdown__item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 7px; font-size: 13px; color: var(--text-dim); width: 100%; background: none; border: none; font-family: inherit; cursor: pointer; text-align: left; }
.dropdown__item:hover { background: var(--surface-2); color: var(--text); }
.dropdown__item .icon { color: var(--text-mute); }
.dropdown__item--danger:hover { color: var(--danger); }
.dropdown__item--danger:hover .icon { color: var(--danger); }
.dropdown__sep { height: 1px; background: var(--border); margin: 5px 4px; }
.dropdown__foot { display: block; text-align: center; padding: 9px; margin-top: 4px; border-top: 1px solid var(--border); color: var(--accent); font-weight: 600; font-size: 12.5px; }
.dropdown__foot:hover { background: var(--surface-2); border-radius: 7px; }
.link-btn { background: none; border: none; color: var(--accent); font-family: inherit; font-size: 11px; font-weight: 600; cursor: pointer; text-transform: none; letter-spacing: 0; }
.link-btn:hover { text-decoration: underline; }

.notif-feed { list-style: none; max-height: 360px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 11px 10px; border-radius: 8px; align-items: flex-start; }
.notif:hover { background: var(--surface-2); }
.notif.is-read { opacity: .5; }
.notif__mark { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--text-mute); }
.notif.sev-high .notif__mark { background: var(--danger); }
.notif.sev-med .notif__mark { background: var(--warn); }
.notif.sev-low .notif__mark { background: var(--accent); }
.notif strong { font-size: 13px; display: block; }
.notif p { font-size: 12px; color: var(--text-dim); margin: 1px 0 2px; }
.notif small { font-size: 11px; color: var(--text-mute); }

/* =========================================================================
   ПАНЕЛИ / СЕТКИ
   ========================================================================= */
.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
}
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel__head h2 { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-stats--4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2-1 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; }

/* ---- Карточки метрик ---- */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative; overflow: hidden; }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stat-card__label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.stat-card__value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.stat-card__sub { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }
.sparkline { width: 100%; margin-top: 8px; display: block; }
canvas[data-line], canvas[data-bars] { width: 100%; display: block; }
.chip { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.chip--up { background: rgba(63,185,80,.13); color: var(--ok); }
.chip--down { background: rgba(229,72,77,.13); color: var(--danger); }

/* ---- Сегмент-переключатель ---- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg__btn { background: none; border: none; color: var(--text-dim); font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.seg__btn.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.15); }

/* ---- Кнопки ---- */
.btn { font-family: inherit; font-size: 13px; font-weight: 500; padding: 8px 14px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 7px; }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-2); }
.btn--ghost { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }
.btn--ghost:hover { color: var(--text); border-color: var(--border-2); }

/* ---- Графики ---- */
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut-legend { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; flex: 1; }
.donut-legend li { display: flex; align-items: center; gap: 8px; color: var(--text-dim); }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend b { margin-left: auto; color: var(--text); font-weight: 600; }

/* ---- Лента событий ---- */
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; flex-shrink: 0; }
.live-badge { font-size: 10.5px; font-weight: 500; color: var(--text-mute); display: inline-flex; align-items: center; gap: 6px; }
.live-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.feed { list-style: none; display: flex; flex-direction: column; }
.feed__item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 8px; border-bottom: 1px solid var(--border); }
.feed__item:last-child { border-bottom: none; }
.feed__cat { width: 32px; height: 32px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; flex-shrink: 0; color: var(--text-dim); }
.feed__cat .icon { display: block; }
.feed__body { flex: 1; min-width: 0; }
.feed__body p { font-size: 13px; }
.feed__meta { font-size: 11px; color: var(--text-mute); font-family: 'JetBrains Mono', monospace; }
.sev-pill { font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.sev-pill.sev-low  { background: var(--accent-soft); color: var(--info); }
.sev-pill.sev-med  { background: rgba(210,153,34,.14); color: var(--warn); }
.sev-pill.sev-high { background: rgba(229,72,77,.13); color: var(--danger); }

/* ---- Health-бары ---- */
.health { list-style: none; display: flex; flex-direction: column; gap: 13px; }
.health li { display: grid; grid-template-columns: 120px 1fr 56px; align-items: center; gap: 12px; font-size: 12.5px; color: var(--text-dim); }
.health b { text-align: right; color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.bar { height: 7px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 20px; }
.bar--inline { width: 110px; }
.muted-note { font-size: 12px; color: var(--text-mute); }
.ret { display: flex; align-items: center; gap: 9px; }
.ret .bar--inline { width: 84px; }
.ret .mono { font-size: 11.5px; color: var(--text-dim); min-width: 34px; }
.table .sparkline { width: 90px; }

.uptime { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.uptime small { font-size: 11px; color: var(--text-mute); display: block; }
.uptime strong { font-size: 14px; }

/* =========================================================================
   ЛОГИ — табы, фильтры, таблица
   ========================================================================= */
.logs-toolbar { display: flex; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
    background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
    font-family: inherit; font-size: 12.5px; font-weight: 500; padding: 8px 12px;
    border-radius: 7px; cursor: pointer; display: flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--text); border-color: var(--border-2); }
.tab.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

.logs-filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.field {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    font-family: inherit; font-size: 13px; padding: 9px 12px; border-radius: 7px; outline: none;
}
.field:focus { border-color: var(--accent); }
.field--search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; }
.field--search svg { width: 16px; height: 16px; color: var(--text-mute); flex-shrink: 0; }
.field--search input { flex: 1; background: none; border: none; color: var(--text); outline: none; font-size: 13px; }
.field--area { width: 100%; min-height: 92px; resize: vertical; font-family: inherit; }
select.field { cursor: pointer; }

/* ---- Таблица ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
    text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-mute); padding: 11px 14px;
    background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .dim { color: var(--text-mute); }
.log-row { position: relative; }
.log-row.sev-high td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.log-row.sev-med td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border); padding: 3px 9px; border-radius: 20px; color: var(--text-dim); white-space: nowrap; }

.table-empty { padding: 30px; text-align: center; color: var(--text-mute); }
.table-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 12.5px; color: var(--text-mute); }
.pager { display: flex; gap: 4px; align-items: center; }
.pager__btn { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); cursor: pointer; font-size: 12.5px; display: inline-grid; place-items: center; }
.pager__btn:hover:not(:disabled) { border-color: var(--border-2); color: var(--text); }
.pager__btn.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager__btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Игроки / админы ячейки ---- */
.player-cell { display: flex; align-items: center; gap: 10px; }
.player-cell strong { font-size: 13px; display: block; }
.player-cell small { font-size: 11px; display: flex; align-items: center; gap: 5px; }
.row-actions { display: flex; gap: 4px; }
.mini-btn { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--text-dim); }
.mini-btn:hover { border-color: var(--border-2); color: var(--text); }
.mini-btn--danger:hover { border-color: var(--danger); color: var(--danger); background: var(--accent-soft); }
.status-text { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; text-transform: capitalize; }
.status--online { color: var(--ok); } .status--idle { color: var(--warn); } .status--offline { color: var(--text-mute); } .status--restart { color: var(--info); }

/* ---- Роли / ранги ---- */
.roles { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.roles li { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--surface-2); border-radius: 9px; }
.roles small { color: var(--text-mute); font-size: 11.5px; }
.role-badge { align-self: flex-start; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.mini-rank { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.mini-rank li { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 7px 10px; background: var(--surface-2); border-radius: 8px; }
.mini-rank b { width: 22px; height: 22px; background: var(--accent); color: #fff; border-radius: 6px; display: grid; place-items: center; font-size: 11px; }
.mini-rank span { margin-left: auto; font-family: 'JetBrains Mono', monospace; color: var(--text-dim); }

/* =========================================================================
   УПРАВЛЕНИЕ СЕРВЕРОМ
   ========================================================================= */
.power-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.power-btn { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 18px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); cursor: pointer; transition: border-color .15s, color .15s; }
.power-btn span { font-size: 12.5px; font-weight: 500; color: var(--text); }
.power-btn:hover { border-color: var(--border-2); }
.power--start:hover { border-color: var(--ok); color: var(--ok); }
.power--restart:hover { border-color: var(--info); color: var(--info); }
.power--stop:hover { border-color: var(--danger); color: var(--danger); }
.power--maint:hover { border-color: var(--warn); color: var(--warn); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-dim); }
.fld .field { width: 100%; }
.fld--switch { flex-direction: row; align-items: center; justify-content: space-between; background: var(--surface-2); padding: 11px 13px; border-radius: 9px; border: 1px solid var(--border); color: var(--text); font-size: 13px; }

/* Switch */
.switch { appearance: none; width: 40px; height: 22px; border-radius: 20px; background: var(--border-2); position: relative; cursor: pointer; flex-shrink: 0; transition: background .18s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

.broadcast-row { display: flex; gap: 10px; margin-top: 12px; }
.broadcast-row .field { flex: 1; }

.notify-list { list-style: none; display: flex; flex-direction: column; }
.notify-list li { display: flex; align-items: center; justify-content: space-between; padding: 13px 4px; border-bottom: 1px solid var(--border); }
.notify-list li:last-child { border-bottom: none; }
.notify-list small { display: block; color: var(--text-mute); font-size: 11.5px; }

/* Консоль */
.console { background: #0a0c11; border: 1px solid var(--border); border-radius: 10px; padding: 14px; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; line-height: 1.7; max-height: 240px; overflow-y: auto; color: #c8d0dc; }
.console p { white-space: pre-wrap; word-break: break-word; }
.c-time { color: #5a6577; }
.c-ok { color: #22c55e; } .c-warn { color: #f59e0b; } .c-err { color: #ef4444; }
.c-prompt { color: var(--accent-2); }
.console-input { display: flex; gap: 9px; align-items: center; margin-top: 12px; }
.console-input .field { flex: 1; font-family: 'JetBrains Mono', monospace; }

/* =========================================================================
   FOOTER
   ========================================================================= */
.footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 26px; border-top: 1px solid var(--border); color: var(--text-mute); font-size: 12px; }
.footer__meta { display: flex; align-items: center; gap: 6px; font-family: 'JetBrains Mono', monospace; }

/* =========================================================================
   ТОСТ-УВЕДОМЛЕНИЯ
   ========================================================================= */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--surface); border: 1px solid var(--border-2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 13px; min-width: 240px; animation: toastIn .25s ease; }
.toast--ok { border-left-color: var(--ok); } .toast--warn { border-left-color: var(--warn); } .toast--danger { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* =========================================================================
   АДАПТИВ
   ========================================================================= */
.backdrop { display: none; }

@media (max-width: 1280px) {
    .grid-stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1100px) {
    .grid-stats, .grid-stats--4 { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-2-1 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

/* Планшет / мобильный: сайдбар уезжает в off-canvas */
@media (max-width: 960px) {
    .sidebar { position: fixed; z-index: 100; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow); width: 260px; }
    .sidebar.is-collapsed { width: 260px; }
    .sidebar.is-collapsed .brand__text,
    .sidebar.is-collapsed .nav__label,
    .sidebar.is-collapsed .nav__group-label,
    .sidebar.is-collapsed .server-mini > div { display: block; }
    .sidebar.is-collapsed .nav__item { justify-content: flex-start; }
    .sidebar.is-mobile-open { transform: translateX(0); }
    .sidebar__collapse { display: none; }
    .topbar__menu { display: block; }
    .topbar__search { display: none; }
    .backdrop.is-show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; }
    .profile__info { display: none; }
    .profile { padding: 7px; }
}

@media (max-width: 760px) {
    .topbar { padding: 10px 14px; gap: 10px; }
    .topbar__title { min-width: 0; }
    .topbar__title h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
    .topbar__title .crumb { display: none; }
    .server-switch__name { display: none; }
    .server-switch__btn { padding: 8px 9px; }
    .power-grid { grid-template-columns: repeat(2, 1fr); }
    .content { padding: 14px; gap: 14px; }
    .panel { padding: 14px; }
    .dropdown__menu--wide { width: calc(100vw - 28px); max-width: 360px; }
    .donut-wrap { flex-direction: column; align-items: stretch; }
    .donut-wrap canvas { align-self: center; }
}

@media (max-width: 560px) {
    .grid-stats, .grid-stats--4 { grid-template-columns: 1fr; }
    .topbar__title h1 { max-width: 38vw; }
    .seg { width: 100%; }
    .seg__btn { flex: 1; }
    .logs-filters .field, .logs-filters .btn { flex: 1 1 auto; }
    .stat-card__value { font-size: 24px; }
    .health li { grid-template-columns: 96px 1fr 50px; }
}

@media (max-width: 400px) {
    .topbar__title h1 { max-width: 30vw; }
    .profile__caret { display: none; }
    .server-switch__menu { width: calc(100vw - 24px); }
}
