/* ============================================================
   GORAKH.NET — premium UI layer on top of Bootstrap 5
   Mobile-first. Breakpoints: 768px (tablet), 1200px (desktop).
   ============================================================ */

:root {
  --sidebar-w: 264px;
  --grad-a: #667eea;
  --grad-b: #764ba2;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-orange: #ff9800;
  --accent-green: #4CAF50;
  --accent-red: #f44336;
  --radius-card: 20px;
  --radius-btn: 30px;
  --radius-field: 12px;
  --transition: .22s cubic-bezier(.4, 0, .2, 1);
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bs-primary: #667eea;
  --bs-primary-rgb: 102, 126, 234;
  --bs-link-color: #667eea;
  --bs-link-color-rgb: 102, 126, 234;
  --bs-link-hover-color: #764ba2;
  --bs-link-hover-color-rgb: 118, 75, 162;
  --bs-font-monospace: var(--font-mono);
}

/* ---------- Themes ---------- */
[data-bs-theme="light"] {
  --bs-body-bg: #f5f7fa;
  --bs-body-color: #333333;
  --bs-border-color: #e6eaf2;
  --bs-tertiary-bg: #eef1f8;
  --bs-secondary-bg: #e7ebf4;
  --bs-secondary-color: #6b7280;
  --surface: #ffffff;
  --surface-hover: #f8f9fe;
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, .05), 0 4px 14px rgba(17, 24, 39, .05);
  --shadow-md: 0 8px 28px rgba(17, 24, 39, .10);
  --shadow-lg: 0 18px 44px rgba(17, 24, 39, .14);
  --topbar-bg: rgba(245, 247, 250, .82);
  --code-bg: #14172b;
  --code-color: #d6dcff;
}

[data-bs-theme="dark"] {
  --bs-body-bg: #121212;
  --bs-body-color: #eeeeee;
  --bs-border-color: #2a2a30;
  --bs-tertiary-bg: #1a1a1e;
  --bs-secondary-bg: #27272c;
  --bs-secondary-color: #9ca3af;
  --surface: #1e1e1e;
  --surface-hover: #26262c;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .28);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
  --topbar-bg: rgba(18, 18, 18, .82);
  --code-bg: #0d0d14;
  --code-color: #c9d1f5;
}

/* ---------- Base ---------- */
body {
  min-height: 100vh;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(102, 126, 234, .3); }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 700;
  letter-spacing: -.015em;
}

a { transition: color var(--transition); }

@media (min-width: 768px) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--bs-secondary-bg);
    border-radius: 8px;
    border: 2px solid var(--bs-body-bg);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--grad-a); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 992px) { .main { margin-left: var(--sidebar-w); } }

.content {
  flex: 1;
  padding: 15px 15px 6rem;          /* room for bottom nav on mobile */
  animation: fadeUp .4s ease both;
}
@media (min-width: 768px) { .content { padding: 20px 20px 2.5rem; } }
@media (min-width: 1200px) { .content { padding: 28px 32px 3rem; max-width: 1320px; margin-inline: auto; width: 100%; } }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 1030;
  background: var(--bs-tertiary-bg);
  border-right: 1px solid var(--bs-border-color);
  padding: .75rem .65rem;
  transition: width var(--transition);
}
.sidebar .brand {
  display: flex; align-items: flex-start; justify-content: flex-start;
  position: relative;
  font-weight: 800; font-size: 1.3rem;
  padding: 1rem .6rem 1.25rem;
  text-decoration: none;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.sidebar .brand .brand-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Shared style for nav links and action items (user, theme, logout, collapse) */
.sidebar .nav-link, .sidebar .sidebar-item {
  display: flex; align-items: center; gap: .65rem;
  width: 100%;
  position: relative;
  color: var(--bs-body-color);
  background: none; border: none; text-align: left;
  padding: .6rem .85rem;
  margin-bottom: .25rem;
  border-radius: var(--radius-field);
  font-weight: 500; font-size: .925rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.sidebar .nav-link i, .sidebar .sidebar-item i {
  flex: 0 0 auto; width: 1.35rem; font-size: 1.05rem; text-align: center;
}
.sidebar .nav-link:hover, .sidebar .sidebar-item:hover {
  background: var(--bs-secondary-bg);
  transform: translateX(3px);
}
.sidebar .nav-link.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 6px 16px rgba(102, 126, 234, .35);
}
.sidebar .sidebar-user-block {
  background: var(--surface);
  border: 1px solid var(--bs-border-color);
}
.sidebar-divider {
  margin: .5rem .25rem .75rem;
  border-color: var(--bs-border-color);
  opacity: 1;
}
.sidebar .label { overflow: hidden; text-overflow: ellipsis; }

/* Collapsed state: icons only */
html.sidebar-collapsed { --sidebar-w: 76px; }
html.sidebar-collapsed .sidebar .label,
html.sidebar-collapsed .sidebar .brand-text { display: none; }
html.sidebar-collapsed .sidebar .brand { justify-content: center; padding-left: 0; padding-right: 0; }
html.sidebar-collapsed .sidebar .nav-link,
html.sidebar-collapsed .sidebar .sidebar-item { justify-content: center; padding: .6rem 0; }
html.sidebar-collapsed .sidebar .nav-link:hover,
html.sidebar-collapsed .sidebar .sidebar-item:hover { transform: none; }
html.sidebar-collapsed .collapse-icon { transform: rotate(180deg); }
.collapse-icon { transition: transform var(--transition); }

/* Tooltips for the collapsed sidebar */
html.sidebar-collapsed .sidebar [data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px); top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: var(--code-bg); color: #fff;
  font-size: .8rem; font-weight: 600;
  padding: .35rem .7rem;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 1040;
}
html.sidebar-collapsed .sidebar [data-tip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ---------- Gold plus (logo mark) ---------- */
.brand-plus {
  display: inline-block;
  position: relative;
  color: #ffd700;
  -webkit-text-fill-color: #ffd700;
  font-size: .72em;
  line-height: 1;
  margin-left: .12em;
  transform: translateY(-.35em);   /* superscript, like an exponent */
  cursor: pointer;
  animation: plusFloat 2.2s ease-in-out infinite, plusPulse 2.2s ease-in-out infinite;
  text-shadow: 0 0 10px rgba(255, 215, 0, .45);
}
@keyframes plusFloat {
  0%, 100% { transform: translateY(-.35em); }
  50% { transform: translateY(-.55em); }
}
@keyframes plusPulse {
  0%, 100% { text-shadow: 0 0 6px rgba(255, 215, 0, .35); opacity: 1; }
  50% { text-shadow: 0 0 14px rgba(255, 215, 0, .75); opacity: .85; }
}
.plus-ripple {
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255, 215, 0, .5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: plusRipple .6s ease-out forwards;
}
@keyframes plusRipple {
  from { opacity: .9; width: 8px; height: 8px; }
  to { opacity: 0; width: 56px; height: 56px; }
}

/* ---------- Topbar ---------- */
.topbar {
  height: 60px;
  position: sticky; top: 0; z-index: 1020;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--bs-border-color);
}
.topbar .brand-sm {
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* Тач-цель бургера ≥44px (гайдлайн для мобильных). */
.topbar .btn[data-bs-toggle="offcanvas"] {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* На тач-экранах крестики закрытия (offcanvas/алерты) получают зону ≥44px. */
@media (pointer: coarse) {
  .btn-close { padding: .75rem; }
}
/* ---------- PULSEx wordmark (бренд сервиса общения) ---------- */
.pulsex-brand {
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 1.02rem;
  padding-left: .55rem;
  margin-left: .1rem;
  border-left: 1px solid var(--bs-border-color);
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pulsex-brand .pulsex-x {
  -webkit-text-fill-color: #ffd700;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, .45);
}
/* Кнопка «Скачать» — компактная скруглённая пилюля справа в шапке.
   Специфичнее глобального .btn (он задаёт padding/min-height напрямую). */
.chat-topbar .chat-dl {
  padding: 3px 12px;
  min-height: 0;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 999px;
}
[data-bs-theme="dark"] .theme-icon-dark { display: none; }
[data-bs-theme="light"] .theme-icon-light { display: none; }

/* ---------- Bottom navigation (mobile) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
  display: flex; justify-content: space-around; align-items: center;
  height: 60px;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--bs-border-color);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  color: var(--bs-secondary-color);
  font-size: 1.35rem;
  padding: .5rem .9rem;
  border-radius: var(--radius-field);
  transition: color var(--transition), transform var(--transition);
}
.bottom-nav a:active { transform: scale(.92); }
.bottom-nav a.active {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Cards ---------- */
.card {
  border-radius: var(--radius-card);
  border: 1px solid var(--bs-border-color);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeUp .45s ease both;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card .card-img-top {
  border-top-left-radius: calc(var(--radius-card) - 1px);
  border-top-right-radius: calc(var(--radius-card) - 1px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--radius-btn);
  font-weight: 600;
  padding: 10px 24px;
  min-height: 42px;
  transition: transform var(--transition), box-shadow var(--transition),
              background var(--transition), filter var(--transition);
}
.btn-sm { padding: 6px 16px; min-height: 34px; font-size: .85rem; }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--gradient);
  border: none;
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--gradient);
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, .4);
  color: #fff;
}
.btn-primary:active { background: var(--gradient); filter: brightness(.95); color: #fff; }

.btn-outline-primary { border-color: var(--grad-a); color: var(--grad-a); }
.btn-outline-primary:hover {
  background: var(--gradient); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(102, 126, 234, .35);
}
.btn-outline-secondary { border-color: var(--bs-border-color); color: var(--bs-body-color); }
.btn-outline-secondary:hover {
  background: var(--bs-secondary-bg); border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: var(--radius-field);
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  background: var(--surface);
  border-color: var(--grad-a);
  box-shadow: 0 0 0 .25rem rgba(102, 126, 234, .18);
  color: var(--bs-body-color);
}
.form-control-sm { min-height: 34px; }
textarea.form-control { min-height: auto; }
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .35rem; }
.form-check-input { cursor: pointer; }
.form-check-input:checked { background-color: var(--grad-a); border-color: var(--grad-a); }
.form-check-input:focus { box-shadow: 0 0 0 .25rem rgba(102, 126, 234, .18); border-color: var(--grad-a); }
.form-check-label { cursor: pointer; }

/* ---------- Tables ---------- */
.table-responsive { -webkit-overflow-scrolling: touch; }
.table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
}
.table thead th {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--bs-secondary-color);
  border-bottom: 2px solid var(--bs-border-color);
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-hover); }
.table td, .table th { padding: .6rem .75rem; vertical-align: middle; }

.table-card {
  background: var(--surface);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: .5rem .75rem;
  overflow-x: auto;
}

/* ---------- List group ---------- */
.list-group {
  border-radius: var(--radius-field);
  box-shadow: var(--shadow-sm);
}
.list-group-item {
  background: var(--surface);
  border-color: var(--bs-border-color);
  padding: .8rem 1rem;
  transition: background var(--transition), padding-left var(--transition);
}
.list-group-item-action:hover { background: var(--surface-hover); padding-left: 1.25rem; }

/* ---------- Badges, alerts, pagination ---------- */
.badge { font-weight: 600; border-radius: 20px; padding: .4em .75em; }

.alert {
  border-radius: var(--radius-field);
  border: 1px solid var(--bs-border-color);
  box-shadow: var(--shadow-sm);
  animation: fadeUp .35s ease both;
}

.pagination .page-link {
  border-radius: var(--radius-field);
  margin: 0 .2rem;
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  min-width: 42px;
  text-align: center;
  transition: background var(--transition), color var(--transition);
}
.pagination .page-link:hover { background: var(--bs-secondary-bg); }
.pagination .page-item.active .page-link,
.pagination .page-item.disabled .page-link {
  background: var(--bs-tertiary-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-secondary-color);
}

/* ---------- Progress ---------- */
.progress {
  background: var(--bs-secondary-bg);
  border-radius: 20px;
  overflow: hidden;
}
.progress-bar {
  background: var(--gradient);
  border-radius: 20px;
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Offcanvas & modal ---------- */
.offcanvas {
  background: var(--bs-body-bg);
  border-right: 1px solid var(--bs-border-color) !important;
}
.offcanvas .nav-link {
  display: flex; align-items: center; gap: .65rem;
  color: var(--bs-body-color);
  padding: .65rem .85rem;
  margin-bottom: .25rem;
  border-radius: var(--radius-field);
  font-weight: 500;
}
.offcanvas .nav-link:hover { background: var(--bs-secondary-bg); }
.offcanvas .nav-link.active { background: var(--gradient); color: #fff; }
.offcanvas .nav-link i { width: 1.35rem; text-align: center; }
.offcanvas-title {
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-content {
  border-radius: var(--radius-card);
  border: 1px solid var(--bs-border-color);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.modal-backdrop.show {
  /* Простое затемнение без backdrop-filter: размытие фона на части браузеров/GPU
     "залипало" и перекрывало модалку (виден только блюр). */
  background: rgba(0, 0, 0, .55);
  opacity: 1;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--gradient);
  border-radius: 24px;
  color: #fff;
  padding: 2.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 14px 38px rgba(102, 126, 234, .35);
  animation: fadeUp .45s ease both;
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  pointer-events: none;
}
.hero::before { width: 320px; height: 320px; top: -160px; right: -80px; }
.hero::after { width: 200px; height: 200px; bottom: -120px; left: 10%; }
.hero h1 { color: #fff; font-weight: 800; }
.hero p { color: rgba(255, 255, 255, .85); max-width: 560px; margin-bottom: 0; }
@media (min-width: 768px) { .hero { padding: 3rem 2.25rem; } }
@media (min-width: 1200px) { .hero { padding: 3.5rem 3rem; } }

/* ---------- Service cards ---------- */
.service-card {
  display: flex; align-items: center; gap: .9rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--bs-body-color);
  font-weight: 600;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: fadeUp .45s ease both;
}
.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(102, 126, 234, .45);
  color: var(--bs-body-color);
}
.service-card .icon {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--gradient);
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 6px 14px rgba(102, 126, 234, .35);
}

/* ---------- Section headers ---------- */
.section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--bs-secondary-color);
  margin-bottom: .75rem;
}

/* ---------- Result / code output ---------- */
.result-output {
  font-family: var(--font-mono);
  font-size: .85rem;
  white-space: pre;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-color);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: var(--radius-field);
  padding: 1.1rem 1.25rem;
  max-height: 460px;
  box-shadow: var(--shadow-sm);
}
.binary { font-family: var(--font-mono); letter-spacing: .05em; }

/* ---------- Calculator result grid ---------- */
.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}
@media (min-width: 768px) { .result-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .result-grid { grid-template-columns: repeat(3, 1fr); } }

.result-tile {
  background: var(--surface);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius-field);
  box-shadow: var(--shadow-sm);
  padding: .85rem 1rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: fadeUp .45s ease both;
  min-width: 0;
}
.result-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(102, 126, 234, .45);
}
.result-tile .label {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--bs-secondary-color);
  display: flex; align-items: center; gap: .4rem;
}
.result-tile .value {
  font-family: var(--font-mono);
  font-size: .95rem; font-weight: 600;
  margin-top: .2rem;
  overflow-wrap: anywhere;
}

/* ---------- Password strength ---------- */
.strength-meter {
  height: 8px;
  border-radius: 20px;
  background: var(--bs-secondary-bg);
  overflow: hidden;
  flex: 1 1 120px;
  max-width: 220px;
}
.strength-meter .fill {
  height: 100%;
  border-radius: 20px;
  transition: width .5s ease;
}
.strength-weak .fill { width: 25%; background: var(--accent-red); }
.strength-medium .fill { width: 50%; background: var(--accent-orange); }
.strength-strong .fill { width: 75%; background: var(--grad-a); }
.strength-very_strong .fill { width: 100%; background: var(--accent-green); }

/* ---------- Preset chips (horizontal scroll) ---------- */
.chip-row {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding-bottom: .35rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chip {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: .4rem 1rem;
  border-radius: var(--radius-btn);
  border: 1px solid var(--bs-border-color);
  background: var(--surface);
  color: var(--bs-body-color);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition);
}
.chip:hover { border-color: var(--grad-a); color: var(--grad-a); }
.chip.active {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 5px 14px rgba(102, 126, 234, .35);
}

/* ---------- Tabs ---------- */
.nav-pills {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: .25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-pills::-webkit-scrollbar, .chip-row::-webkit-scrollbar { display: none; }
.nav-pills .nav-link {
  white-space: nowrap;
  border-radius: var(--radius-btn);
  font-weight: 600;
  color: var(--bs-body-color);
  padding: .5rem 1.25rem;
  transition: background var(--transition), color var(--transition);
}
.nav-pills .nav-link:hover { background: var(--bs-secondary-bg); }
.nav-pills .nav-link.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 5px 14px rgba(102, 126, 234, .35);
}

/* ---------- TOP consumption list ---------- */
.top-list { display: flex; flex-direction: column; gap: .85rem; }
.top-item { display: flex; align-items: flex-start; gap: .65rem; min-width: 0; }
.top-item .rank {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  font-size: .8rem; font-weight: 700;
}
.top-item:first-child .rank { background: var(--gradient); color: #fff; }
.top-main { flex: 1 1 auto; min-width: 0; }
.top-head { display: flex; align-items: baseline; gap: .5rem; }
.top-head .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-head .total {
  margin-left: auto; flex: 0 0 auto;
  font-family: var(--font-mono); font-size: .82rem; font-weight: 600;
}
.top-speed {
  display: flex; align-items: baseline; gap: .6rem;
  font-size: .78rem; white-space: nowrap;
  margin: .15rem 0 .3rem;
}
.top-speed .share { margin-left: auto; color: var(--bs-secondary-color); font-weight: 600; }

/* ---------- LVGW transit channels grid ---------- */
.lvgw-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}
@media (min-width: 576px) { .lvgw-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .lvgw-grid { grid-template-columns: repeat(3, 1fr); } }
.lvgw-item {
  min-width: 0;
  padding: .85rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius-field);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.lvgw-item:hover { border-color: rgba(102, 126, 234, .45); box-shadow: var(--shadow-sm); }
.lvgw-item.is-offline { opacity: .65; }
.lvgw-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.lvgw-head .name { font-weight: 700; }
.lvgw-load { display: flex; align-items: center; gap: .6rem; margin: .6rem 0 .45rem; }
.lvgw-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem .65rem; }
.lvgw-meta > span { white-space: nowrap; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 240px; width: 100%; }
@media (min-width: 768px) { .chart-box { height: 280px; } }

/* ---------- Stat tiles (dashboard) ---------- */
.stat-value { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
@media (min-width: 992px) { .toast-stack { bottom: 24px; right: 24px; } }
.app-toast {
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface);
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  border-left: 4px solid var(--grad-a);
  border-radius: var(--radius-field);
  box-shadow: var(--shadow-lg);
  padding: .7rem 1.1rem;
  font-size: .9rem;
  font-weight: 500;
  max-width: 340px;
  animation: toastIn .3s cubic-bezier(.4, 0, .2, 1) both;
}
.app-toast.success { border-left-color: var(--accent-green); }
.app-toast.error { border-left-color: var(--accent-red); }
.app-toast.warning { border-left-color: var(--accent-orange); }
.app-toast.hide { animation: toastOut .25s ease both; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(8px); }
}

/* ---------- Footer ---------- */
.footer {
  padding: 1.25rem 15px calc(76px + env(safe-area-inset-bottom));
  font-size: .8rem;
  color: var(--bs-secondary-color);
  text-align: center;
}
@media (min-width: 992px) { .footer { padding-bottom: 1.25rem; } }

/* ---------- Blog content ---------- */
.content-body { font-size: 1.02rem; line-height: 1.75; max-width: 760px; }
.content-body img { max-width: 100%; border-radius: var(--radius-field); }

/* ============================================================
   Меню из БД (siteconfig): подменю, группы, бейджи, футер-меню
   ============================================================ */
.nav-sub { margin-left: 14px; padding-left: 8px; border-left: 1px solid var(--bs-border-color, rgba(128,128,128,.25)); }
.nav-group-label {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; opacity: .65;
}
.menu-icon-img { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; }
.nav-link .badge { font-size: 10px; vertical-align: middle; }
html.sidebar-collapsed .sidebar .nav-sub { display: none; }
html.sidebar-collapsed .sidebar .nav-group-label .label { display: none; }
.menu-html { padding: 6px 14px; }
.footer-menu { display: inline-flex; gap: 14px; margin-left: 16px; flex-wrap: wrap; }
.footer-menu .nav-link { display: inline-flex; gap: 6px; padding: 0; font-size: inherit; }
.footer-sep { opacity: .5; }

/* ============================================================
   Конструктор главной (siteconfig): анимации, аватары, партнёры
   ============================================================ */
.gk-home { --gk-anim-duration: .6s; }
.gk-block { border-radius: 16px; }
@keyframes gk-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gk-fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes gk-zoom { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }
.gk-anim-fade { animation: gk-fade var(--gk-anim-duration) ease both; }
.gk-anim-fade-up { animation: gk-fade-up var(--gk-anim-duration) ease both; }
.gk-anim-zoom { animation: gk-zoom var(--gk-anim-duration) ease both; }
@media (prefers-reduced-motion: reduce) {
  .gk-anim-fade, .gk-anim-fade-up, .gk-anim-zoom { animation: none; }
}
.gk-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.gk-avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.gk-partner-logo { max-height: 48px; max-width: 140px; object-fit: contain; }
.gk-richtext img { max-width: 100%; height: auto; border-radius: 12px; }
.gk-seo-text { opacity: .8; }

/* ============================================================
   DNS-зоны: бейдж «Ожидает делегирования» переносится в две
   строки только на мобильных (на десктопе — одна строка).
   ============================================================ */
.dns-status-wrap { white-space: normal; max-width: 10em; }
@media (min-width: 576px) { .dns-status-wrap { white-space: nowrap; max-width: none; } }
