/* ============================================================
   epotos-admin — панель наблюдения
   Стиль: кабинет Б2Б Эпотоса (тёмный сайдбар, светлый контент)
   Палитра и переменные перенесены из дизайн-системы Б2Б:
   /Б2Б/Код и документация/source_of_truth/web/css/admin.css
   ============================================================ */

:root {
  /* фирменные цвета Эпотоса */
  --epo-red-50:  #fde6e7;
  --epo-red-500: #ed1c24;
  --epo-red-600: #ca3737;
  --epo-red-700: #c41920;
  --epo-blue-100: #e6f0f8;
  --epo-blue-400: #5da9dd;
  --epo-blue-600: #2c5282;
  --epo-blue-800: #234169;
  --epo-gray-50:  #f9f9f9;
  --epo-gray-100: #f2f5f8;
  --epo-gray-700: #2b2f36;
  --epo-gray-800: #23272e;
  --epo-gray-900: #191919;
  --epo-white:    #ffffff;
  --epo-emerald-500: #00bb7f;
  --epo-emerald-100: #d8f5eb;
  --epo-amber-500:   #f99c00;
  --epo-amber-100:   #fdf0d9;
  --epo-gray-badge:  #eef1f5;

  --color-text:   #191919;
  --color-text-2: #5b6470;
  --color-text-3: #8b96a3;
  --color-bg:     #f4f6f9;
  --color-surface:#ffffff;
  --color-border: #e6ecf3;
  --color-accent: #ed1c24;
  --color-accent-dark: #c41920;
  --color-accent-soft: #fde6e7;
  --color-secondary: #2c5282;
  --color-success: #00bb7f;
  --color-warning: #f99c00;
  --color-danger:  #ca3737;

  --font-display: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-base:    "Jost", "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, .06);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, .12);
  --sidebar-w: 248px;
  --topbar-h: 62px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-base);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--color-text);
  line-height: 1.2;
  font-weight: 700;
  margin: 0;
}

a { color: var(--color-secondary); text-decoration: none; }
a:hover { color: var(--epo-blue-800); }

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .9em;
  background: var(--epo-gray-100);
  border-radius: 5px;
  padding: 1px 5px;
}

.hidden { display: none !important; }

.muted { color: var(--color-text-3); }

/* ============================================================
   Каркас: сайдбар + контент
   ============================================================ */

.app {
  display: flex;
  min-height: 100vh;
  min-width: 1080px;
}

/* ---------- Сайдбар ---------- */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--epo-gray-900);
  color: #cfd6df;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--epo-gray-700);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--epo-red-500) 0%, var(--epo-red-700) 100%);
  color: #fff;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }

.brand-name {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #fff;
}

.brand-sub {
  font-size: 10.5px;
  color: #8b96a3;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ---------- Навигация (плитки-разделы) ---------- */

.nav { flex: 1; overflow: auto; padding: 10px 12px; }

.nav-group {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #6b7585;
  margin: 16px 12px 6px;
}
.nav-group:first-child { margin-top: 8px; }

.nav-tile {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #cfd6df;
  font-size: 14.5px;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}

.nav-tile .ic {
  width: 20px;
  text-align: center;
  font-size: 16px;
  opacity: .85;
}

.nav-tile .lbl { flex: 1; }

.nav-tile:hover { background: var(--epo-gray-800); color: #fff; }

.nav-tile.active {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(237, 28, 36, .35);
}
.nav-tile.active .ic { opacity: 1; }

.nav-tile .pill {
  margin-left: auto;
  background: var(--epo-gray-800);
  color: #cfd6df;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  padding: 1px 8px;
}
.nav-tile.active .pill { background: rgba(255, 255, 255, .22); color: #fff; }
.nav-tile .pill.pill-alert { background: var(--epo-gray-800); color: #ff9a9a; }
.nav-tile.active .pill.pill-alert { background: rgba(255, 255, 255, .25); color: #fff; }

/* ---------- Низ сайдбара ---------- */

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--epo-gray-700);
}

.sys {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--epo-gray-800);
  font-size: 12.5px;
}

.sys .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgba(0, 187, 127, .2);
  flex-shrink: 0;
}
.sys .dot.bad { background: var(--color-danger); box-shadow: 0 0 0 3px rgba(202, 55, 55, .25); }
.sys .dot.warn { background: var(--color-warning); box-shadow: 0 0 0 3px rgba(249, 156, 0, .22); }

.sys-text { display: flex; flex-direction: column; line-height: 1.3; }
.sys-text small { color: #8b96a3; font-size: 11px; }

.ver {
  display: block;
  margin-top: 8px;
  text-align: center;
  color: #6b7585;
  font-size: 11px;
}

/* ============================================================
   Верхняя панель
   ============================================================ */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title { display: flex; align-items: baseline; gap: 12px; min-width: 0; }

.topbar-title h1 { font-size: 19px; white-space: nowrap; }

.topbar-sub {
  color: var(--color-text-3);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.freshness {
  font-size: 12.5px;
  color: var(--color-text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.freshness.stale { color: var(--color-warning); }

.btn {
  border: 0;
  background: var(--epo-gray-900);
  color: #fff;
  font-family: var(--font-base);
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--epo-gray-700); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-wide { width: 100%; margin-top: 18px; }

/* ============================================================
   Плашки состояния
   ============================================================ */

.banner {
  margin: 16px 28px -4px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

.banner-error {
  background: var(--epo-red-50);
  border: 1px solid #f3b8bb;
  color: var(--epo-red-700);
}

.banner-demo {
  background: var(--epo-amber-100);
  border: 1px solid #f3d9a8;
  color: #8a6100;
}

/* ============================================================
   Контент и карточки
   ============================================================ */

.content { padding: 24px 28px 40px; }

.view > .grid { margin-bottom: 18px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
  gap: 18px;
  align-items: start;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
}

.card h2 { font-size: 16px; margin-bottom: 10px; }

/* ---------- Карточка хоста ---------- */

.host-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.host-id {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.host-uptime {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--color-text-3);
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgba(0, 187, 127, .18);
  flex-shrink: 0;
}
.status-dot.bad {
  background: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(202, 55, 55, .18);
}

.status-chip {
  font-size: 11.5px;
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  background: var(--epo-emerald-100);
  color: #00795a;
}
.status-chip.bad { background: var(--epo-red-50); color: var(--epo-red-700); }

/* метрики */

.metric { margin-bottom: 13px; }
.metric:last-child { margin-bottom: 0; }

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--color-text-2);
}
.metric-head .num { font-weight: 600; color: var(--color-text); }

.bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--epo-gray-100);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-success);
  transition: width .4s ease;
}
.bar-fill.warn { background: var(--color-warning); }
.bar-fill.danger { background: var(--epo-red-500); }

.host-sub {
  display: flex;
  gap: 18px;
  margin: 2px 0 12px;
  font-size: 13px;
  color: var(--color-text-2);
  flex-wrap: wrap;
}
.host-sub .num { color: var(--color-text); font-weight: 600; }

/* systemd-юниты */

.units { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }

.unit-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: ui-monospace, Consolas, monospace;
  background: var(--epo-gray-badge);
  color: var(--color-text-2);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  max-width: 100%;
}
.unit-chip::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
}
.unit-chip.inactive::before { background: var(--color-text-3); }
.unit-chip.failed::before { background: var(--color-danger); }

.host-note {
  color: var(--color-text-3);
  font-size: 13.5px;
  margin: 4px 0 0;
}

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

.table-card { padding: 6px 0 0; overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }

.table th {
  text-align: left;
  font-family: var(--font-base);
  font-size: 11.5px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--color-text-3);
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--epo-gray-50); }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }
.table th.num { text-align: right; }
.table .muted { color: var(--color-text-3); }

.tbl-domain {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13.5px;
  color: var(--color-secondary);
  white-space: nowrap;
}

/* ---------- Метки-бейджи ---------- */

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  font-weight: 600;
}

.badge.ok      { background: var(--epo-emerald-100); color: #00795a; }
.badge.warn    { background: var(--epo-amber-100);   color: #8a5c07; }
.badge.down    { background: var(--epo-red-50);      color: var(--epo-red-700); }
.badge.neutral { background: var(--epo-gray-badge);  color: #4a5260; }

/* остановленные контейнеры — приглушаем всю строку */
.table tbody tr.row-muted td.num,
.table tbody tr.row-muted td.tbl-domain { color: var(--color-text-3); }

/* ширина колонок таблиц (Хост, Состояние — фиксированные) */
.table th.col-host, .table td.col-host { width: 90px; }
.table th.col-state, .table td.col-state { width: 170px; }
.table th.col-http, .table td.col-http { width: 110px; }

/* ---------- Чипы-фильтры ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.chip {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-2);
  font-family: var(--font-base);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--epo-blue-400); color: var(--color-secondary); }
.chip.on {
  background: var(--epo-gray-900);
  border-color: var(--epo-gray-900);
  color: #fff;
}

/* ---------- Пользователи ---------- */

.user-row {
  display: grid;
  grid-template-columns: 150px 1fr 110px;
  gap: 14px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border);
}
.user-row:last-child { border-bottom: 0; }

.user-name {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13.5px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-cpu { display: flex; align-items: center; gap: 10px; }
.user-cpu .bar { flex: 1; }

.user-ram {
  font-size: 13px;
  color: var(--color-text-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.host-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

/* ---------- About ---------- */

.about-grid { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); display: grid; gap: 18px; }

.about-card p { margin: 0 0 10px; color: var(--color-text-2); }

.about-list {
  margin: 0;
  padding-left: 18px;
  color: var(--color-text-2);
  font-size: 14px;
}
.about-list li { margin-bottom: 7px; }
.about-list li:last-child { margin-bottom: 0; }

/* ---------- Пустые состояния ---------- */

.empty {
  color: var(--color-text-3);
  font-size: 14px;
  padding: 26px 4px;
  text-align: center;
}

.table-card .empty { padding: 26px 16px 30px; }

/* ============================================================
   Экран входа (/login)
   ============================================================ */

.login-body {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d1515 55%, #a82e2e 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrap { width: 400px; max-width: calc(100vw - 32px); }

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 30px 32px 28px;
}

.login-brand { border-bottom: 1px solid var(--color-border); padding: 0 0 16px; margin-bottom: 18px; }
.login-brand .brand-name { color: var(--color-text); }
.login-brand .brand-sub { color: var(--color-text-3); }

.login-title { font-size: 17px; margin-bottom: 6px; }
.login-sub { color: var(--color-text-2); font-size: 13.5px; margin: 0 0 18px; }

.field { display: block; margin-bottom: 14px; }
.field span {
  display: block;
  font-size: 12.5px;
  color: var(--color-text-2);
  margin-bottom: 5px;
}
.field input {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-base);
  font-size: 14.5px;
  color: var(--color-text);
  background: var(--epo-gray-50);
  outline: none;
  transition: border-color .15s, background .15s;
}
.field input:focus {
  border-color: var(--epo-red-500);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(237, 28, 36, .12);
}

.login-error {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--epo-red-700);
  background: var(--epo-red-50);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
}

.login-foot {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: rgba(255, 255, 255, .55);
  font-size: 12px;
}

/* ============================================================
   Прочее
   ============================================================ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--epo-gray-100); }
::-webkit-scrollbar-thumb { background: #c4c4c4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-3); }

@media (max-width: 1280px) {
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
  .content { padding: 20px 20px 36px; }
  .topbar { padding: 0 20px; }
  .banner { margin-left: 20px; margin-right: 20px; }
}

/* ---------- Модалка подтверждения / кнопки действий ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(25, 25, 25, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}

.modal {
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, .25);
  max-width: 460px; width: 100%;
  padding: 24px;
}

.modal-title { margin: 0 0 10px; font-size: 19px; color: var(--epo-gray-900, #191919); }
.modal-text  { margin: 0 0 20px; font-size: 14px; line-height: 1.55; color: #444; }

.modal-row { display: flex; gap: 10px; justify-content: flex-end; }

.btn {
  border: 1px solid #d6d6d6; background: #fff; color: var(--epo-gray-900, #191919);
  border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #f5f5f5; }

.btn-danger {
  background: var(--epo-red-500, #ed1c24); border-color: var(--epo-red-500, #ed1c24);
  color: #fff;
}
.btn-danger:hover { background: #c5131a; border-color: #c5131a; }

.btn-reboot { width: 100%; margin-top: 14px; }
