/* ============================================================
   GRIZMO — дизайн-система
   Тёмная премиальная тема: графит, янтарный акцент, циан и мятный
   ============================================================ */

:root {
  /* Поверхности */
  --bg: #0b0f19;
  --bg-deep: #080b12;
  --surface: #151b2b;
  --surface-2: #1a2233;
  --surface-3: #212b40;

  /* Границы и разделители */
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.11);

  /* Акцент */
  --accent: #f97316;
  --accent-bright: #ff8c00;
  --accent-soft: rgba(249, 115, 22, 0.13);
  --accent-glow: rgba(249, 115, 22, 0.35);

  /* Вторичные */
  --cyan: #00bfff;
  --cyan-soft: rgba(0, 191, 255, 0.13);
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.13);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.13);
  --amber: #f59e0b;

  /* Текст */
  --text: #ffffff;
  --body: #c8d2e0;
  --muted: #6b7688;
  --dim: #4a5468;

  /* Геометрия */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --sidebar-w: 264px;
  --header-h: 72px;

  --font: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.22);
  --shadow-glow: 0 0 0 1px var(--accent-glow), 0 8px 28px var(--accent-glow);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

/* Фоновая подсветка: два мягких пятна, чтобы тёмный фон не был плоским */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(249, 115, 22, 0.07), transparent 60%),
    radial-gradient(800px 500px at 92% 4%, rgba(0, 191, 255, 0.055), transparent 65%);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-bright);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.015em;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  font-weight: 600;
}

h3 {
  font-size: 14px;
  font-weight: 600;
}

p {
  margin: 0;
}

/* ============================================================
   Каркас
   ============================================================ */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, #101725 0%, #0c1220 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 18px;
  color: var(--text);
}

.brand:hover {
  color: var(--text);
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}

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

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav-label {
  padding: 0 10px;
  margin-bottom: 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex: none;
  stroke-width: 1.7;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.035);
  color: var(--body);
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-weight: 600;
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.nav-item.is-disabled {
  color: var(--dim);
  cursor: not-allowed;
}

.nav-item.is-disabled:hover {
  background: transparent;
}

.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* --- Виджет состояния внизу сайдбара --- */

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.health-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--body);
  font-weight: 500;
}

.dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

.dot.is-down {
  background: var(--red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.health-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.uptime-label {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  color: var(--muted);
}

.uptime-value {
  color: var(--green);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Шапка
   ============================================================ */

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: rgba(11, 15, 25, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--body);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.7;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.header-spacer {
  margin-left: auto;
}

.bell {
  position: relative;
}

.bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  color: var(--body);
}

.profile:hover {
  background: var(--surface-2);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.profile-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  text-align: left;
}

.profile-role {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
}

.profile-sub {
  font-size: 10.5px;
  color: var(--muted);
}

.profile-caret {
  width: 14px;
  height: 14px;
  color: var(--muted);
  stroke-width: 2;
}

/* --- Выпадающее меню профиля --- */

.profile-menu {
  position: relative;
}

.profile-menu > summary {
  list-style: none;
  cursor: pointer;
}

.profile-menu > summary::-webkit-details-marker {
  display: none;
}

.profile-menu[open] > summary {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  min-width: 216px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.dropdown-head {
  padding: 8px 11px 7px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--body);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.dropdown-item svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.9;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  text-decoration: none;
}

.sidebar-spark {
  position: relative;
  display: block;
  width: 100%;
  height: 32px;
  margin-top: 10px;
}

/* ============================================================
   Контент
   ============================================================ */

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

.content {
  padding: 26px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.page-sub {
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
}

/* Переключатель периода */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.segmented button,
.segmented a {
  padding: 6px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.segmented button:hover,
.segmented a:hover {
  color: var(--body);
  background: rgba(255, 255, 255, 0.04);
}

.segmented .is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.range-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.card {
  position: relative;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
}

.card-head h2 {
  font-size: 14.5px;
}

.card-head .spacer {
  margin-left: auto;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.card-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

/* --- KPI --- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kpi {
  position: relative;
  padding: 17px 18px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.kpi-top {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.kpi-top svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

.kpi-top .kpi-ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--body);
}

.kpi-value {
  margin-top: 10px;
  font-size: 27px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.kpi-value small {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.kpi-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
}

.trend.up {
  color: var(--green);
}

.trend.down {
  color: var(--red);
}

.trend.flat {
  color: var(--muted);
}

.trend svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}

.kpi-spark {
  position: relative;
  width: 96px;
  height: 34px;
  flex: none;
}

.kpi-spark canvas,
.region-spark canvas,
.sidebar-spark canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* --- Тарифы в личном кабинете --- */

.plan-card {
  padding: 16px;
}

.plan-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.plan-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--bg-deep);
  color: var(--body);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.plan-option:hover {
  border-color: rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.06);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.08);
}

.plan-option-label {
  font-size: 12px;
  color: var(--muted);
}

.plan-option-price {
  grid-row: span 2;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.plan-option-sub {
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* --- Выбор формата файла --- */

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.download-card {
  display: flex;
  flex-direction: column;
}

.download-card.is-disabled {
  opacity: 0.65;
}

.download-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.download-ext {
  display: inline-block;
  padding: 5px 11px;
  border-radius: var(--radius-xs);
  background: var(--bg-deep);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.download-hint {
  margin-top: auto;
  padding-top: 10px;
  color: var(--dim);
}

/* --- QR-коды: карусель --- */

.qr-carousel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.qr-stage {
  position: relative;
  width: min(420px, 100%);
  aspect-ratio: 1 / 1;
  margin: 4px auto 0;
}

.qr-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: scale(0.965);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
}

.qr-slide.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  z-index: 2;
}

.qr-slide img {
  display: block;
  /* Нативный размер: апскейл размывает модули и мешает сканированию */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
}

.qr-counter {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-deep);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.qr-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, 100%);
}

.qr-thumb {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--body);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease,
    box-shadow 0.18s ease, opacity 0.18s ease;
  opacity: 0.62;
}

.qr-thumb img {
  width: 54px;
  height: 54px;
  flex: none;
  padding: 3px;
  border-radius: 8px;
  background: #fff;
  image-rendering: pixelated;
}

.qr-thumb-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.qr-thumb-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.qr-thumb-sub {
  font-size: 11px;
  color: var(--muted);
}

.qr-thumb-mark {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--dim);
}

.qr-thumb-mark svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.qr-thumb:hover {
  opacity: 0.85;
  border-color: var(--border-strong);
}

.qr-thumb.is-active {
  opacity: 1;
  border-color: rgba(249, 115, 22, 0.5);
  background: rgba(249, 115, 22, 0.06);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.08);
}

.qr-thumb.is-active .qr-thumb-mark {
  color: var(--accent);
}

/* --- Два раздела QR: для разных приложений --- */

.qr-section + .qr-section {
  margin-top: 16px;
}

.qr-app-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.qr-app-title {
  min-width: 0;
}

.qr-app-title h2 {
  font-size: 15px;
  margin-bottom: 2px;
}

.qr-app-title .hint {
  margin: 0;
}

.qr-app-head .qr-counter,
.qr-app-head .badge {
  margin-left: auto;
  flex: none;
}

/* Одиночный QR: тот же визуальный язык, что и в карусели */
.qr-single {
  width: min(420px, 100%);
  margin: 4px auto 0;
}

.qr-single .qr-slide {
  position: static;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  aspect-ratio: 1 / 1;
}

/* Автопереключение выключается там, где анимация мешает:
   коды показываются все сразу, крупно и без движения. */
@media (prefers-reduced-motion: reduce) {
  .qr-stage {
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(320px, 100%);
  }

  .qr-slide {
    position: static;
    opacity: 1;
    transform: none;
    transition: none;
    pointer-events: auto;
  }

  .qr-counter {
    display: none;
  }
}

/* На узком экране шапка раздела переносится: иначе заголовок
   ломается посередине фразы и жмётся к значку формата. */
@media (max-width: 560px) {
  .qr-app-head {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .qr-app-head .qr-app-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .qr-app-head .qr-counter,
  .qr-app-head .badge {
    margin-left: 0;
    order: 3;
  }
}

/* --- Сетки --- */

.grid-2-1 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* --- График нагрузки --- */

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.chart-wrap {
  position: relative;
  height: 262px;
}

.chart-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.chart-empty {
  display: grid;
  place-items: center;
  height: 262px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 12.5px;
}

/* --- Карта --- */

.map-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, rgba(0, 191, 255, 0.06), transparent 70%);
}

.map-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.region-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 10px;
}

.region-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto 48px;
  align-items: center;
  gap: 9px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.region-row:last-child {
  border-bottom: 0;
}

.region-name {
  color: var(--body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.region-load {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.region-spark {
  position: relative;
  width: 48px;
  height: 20px;
}

.flag {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--body);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* --- Топ по трафику --- */

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.bar-track {
  grid-column: 1 / -1;
  height: 6px;
  margin-top: -6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
}

.bar-value {
  color: var(--body);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* --- Таймлайн событий --- */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.event {
  display: grid;
  grid-template-columns: 44px 8px 1fr;
  align-items: start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.event:last-child {
  border-bottom: 0;
}

.event-time {
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}

.event-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.event-dot.warn {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.event-dot.info {
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 191, 255, 0.6);
}

.event-text {
  color: var(--body);
  font-size: 12.5px;
  line-height: 1.45;
}

.event-meta {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

/* --- Виджет статуса --- */

.status-widget {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(11, 15, 25, 0.05) 0%, rgba(11, 15, 25, 0.86) 62%, #0c1120 100%),
    linear-gradient(160deg, #1d3a5c 0%, #14213a 45%, #0e1524 100%);
  box-shadow: var(--shadow-card);
}

.status-widget::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 220px at 50% 12%, rgba(0, 191, 255, 0.16), transparent 70%);
  pointer-events: none;
}

.status-widget > * {
  position: relative;
  z-index: 1;
}

.status-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.9;
}

.status-art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.shield {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--green-soft);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: var(--green);
  box-shadow: 0 8px 26px rgba(16, 185, 129, 0.22);
}

.shield svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.status-widget h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.status-widget p {
  font-size: 12px;
  color: var(--body);
  margin-bottom: 16px;
}

/* ============================================================
   Кнопки и формы
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 17px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  filter: brightness(1.12);
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-bright) 100%);
  color: #fff;
  box-shadow: 0 6px 22px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 8px 28px var(--accent-glow);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--body);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger {
  background: var(--red-soft);
  color: #ff8f8f;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--bg-deep);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder {
  color: var(--dim);
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(249, 115, 22, 0.55);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.inline-form {
  display: inline;
}

.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.row-form .field {
  flex: 1 1 150px;
  margin-bottom: 0;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--body);
  cursor: pointer;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

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

.table-wrap {
  overflow-x: auto;
  margin: 0 -6px;
}

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

th {
  padding: 8px 10px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.018);
}

td.num {
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge.green {
  background: var(--green-soft);
  border-color: rgba(16, 185, 129, 0.3);
  color: #4ade9f;
}

.badge.orange {
  background: var(--accent-soft);
  border-color: rgba(249, 115, 22, 0.32);
  color: #ffa95c;
}

.badge.red {
  background: var(--red-soft);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ff9090;
}

.badge.cyan {
  background: var(--cyan-soft);
  border-color: rgba(0, 191, 255, 0.28);
  color: #6cd8ff;
}

.badge.gray {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

/* ============================================================
   Уведомления, служебные блоки
   ============================================================ */

.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
}

.flash svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  stroke-width: 2;
}

.flash.ok {
  background: rgba(16, 185, 129, 0.07);
  border-color: rgba(16, 185, 129, 0.28);
  color: #a7f3d0;
}

.flash.ok svg {
  color: var(--green);
}

.flash.err {
  background: rgba(239, 68, 68, 0.07);
  border-color: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}

.flash.err svg {
  color: var(--red);
}

.flash.warn {
  background: rgba(245, 158, 11, 0.07);
  border-color: rgba(245, 158, 11, 0.28);
  color: #fde68a;
}

.flash.warn svg {
  color: var(--amber);
}

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

.hint {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.empty {
  padding: 26px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.divider {
  height: 1px;
  margin: 16px 0;
  background: var(--border);
}

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

.auth-screen {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 404px;
  padding: 30px 28px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
}

.auth-card h1 {
  font-size: 21px;
  margin-bottom: 5px;
}

.auth-card .page-sub {
  margin-bottom: 20px;
}

.auth-alt {
  margin-top: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

/* ============================================================
   Адаптив
   ============================================================ */

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 > :last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(4, 7, 12, 0.6);
    backdrop-filter: blur(2px);
  }

  .grid-2-1 {
    grid-template-columns: minmax(0, 1fr);
  }

  .header {
    padding: 0 16px;
  }

  .content {
    padding: 18px 16px 32px;
  }
}

@media (max-width: 700px) {
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-meta {
    display: none;
  }

  .page-head h1 {
    font-size: 21px;
  }

  .segmented button,
  .segmented a {
    padding: 6px 10px;
    font-size: 12px;
  }
}
