:root {
  --vw-blue: #001e50;
  --vw-blue-mid: #0a3a7a;
  --vw-sky: #00b0f0;
  --surface: #f3f6f9;
  --panel: #ffffff;
  --line: #d7dee8;
  --text: #1a2433;
  --muted: #5c6b7e;
  --sidebar-w: 280px;
  --nav-w: 260px;
  --topbar-h: 72px;
  --tabs-h: 46px;
  --font-ui: "Source Sans 3", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", "Source Sans 3", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(0, 176, 240, 0.18), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(0, 30, 80, 0.12), transparent 50%),
    linear-gradient(180deg, #e8eef5 0%, var(--surface) 40%, #eef2f6 100%);
}

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  height: var(--topbar-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.55rem 1.25rem;
  background: linear-gradient(90deg, var(--vw-blue) 0%, var(--vw-blue-mid) 70%, #0d4a8c 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 30, 80, 0.25);
  position: relative;
  z-index: 30;
}

.topbar-row {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
}

/* Десктоп: бренд | поиск | донат | мета — одна строка */
.topbar-row-main {
  gap: 0.75rem;
  flex-wrap: nowrap;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 0 1 auto;
  order: 1;
}

.top-search {
  position: relative;
  flex: 1 1 auto;
  width: auto;
  min-width: 12rem;
  max-width: 520px;
  order: 2;
}

.top-donate {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  order: 3;
}

.donate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.donate-modal-content {
  overflow: hidden;
}

.donate-modal-body {
  position: relative;
  min-height: 420px;
  background: #f7f8fa;
}

.donate-modal-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #f7f8fa;
  z-index: 1;
}

.donate-modal-loading.is-visible {
  display: flex;
}

.donate-iframe {
  display: block;
  width: 100%;
  height: 420px;
  border: 0;
  background: #fff;
}

.donate-external-link {
  font-size: 0.875rem;
  color: var(--vw-blue);
  text-decoration: none;
}

.donate-external-link:hover,
.donate-external-link:focus-visible {
  text-decoration: underline;
  color: var(--vw-blue-mid);
}

.donate-btn:hover,
.donate-btn:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fff;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.donate-btn:focus-visible {
  outline: 2px solid var(--vw-sky);
  outline-offset: 2px;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid #fff;
  background:
    radial-gradient(circle at 50% 50%, transparent 42%, #fff 43% 52%, transparent 53%),
    linear-gradient(135deg, var(--vw-sky), #fff);
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.8rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-search .input-group-text,
.top-search .form-control {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.top-search .form-control::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.top-search .form-control:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--vw-sky);
  box-shadow: 0 0 0 0.2rem rgba(0, 176, 240, 0.25);
  color: #fff;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: 360px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: 0 12px 28px rgba(0, 30, 80, 0.18);
  z-index: 40;
}

.search-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.85rem;
  color: var(--text);
  border-bottom: 1px solid #eef2f6;
}

.search-item:hover,
.search-item:focus {
  background: #eef6fb;
}

.search-item .si-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.search-item .si-path {
  font-size: 0.75rem;
  color: var(--muted);
}

.top-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  min-width: 0;
  flex: 0 0 auto;
  margin-left: auto;
  order: 4;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 0.35rem;
  overflow: hidden;
}

.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem;
  line-height: 1.3;
  cursor: pointer;
}

.lang-btn + .lang-btn {
  border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.lang-btn.is-active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.lang-btn:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.top-meta .meta-count {
  font-weight: 600;
  font-size: 0.95rem;
}

.top-meta .meta-source {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
  text-decoration: none;
}

.top-meta .meta-source:hover {
  color: #fff;
  text-decoration: underline;
}

.section-tabs {
  height: var(--tabs-h);
  padding: 0 1rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  flex-wrap: nowrap;
}

.section-tabs .nav-link {
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-weight: 600;
  padding: 0.85rem 1.1rem;
  position: relative;
}

.section-tabs .nav-link.active {
  color: var(--vw-blue);
  background: transparent;
}

.section-tabs .nav-link.active::after {
  content: "";
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0;
  height: 3px;
  background: var(--vw-sky);
  border-radius: 2px 2px 0 0;
}

.app-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: calc(100vh - var(--topbar-h) - var(--tabs-h));
}

.app-sidebar {
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.sidebar-scroll {
  height: 100%;
  overflow: auto;
}

.menu-item-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  border: 0;
  border-bottom: 1px solid #eef2f6;
  background: transparent;
}

.menu-item-btn.active {
  background: #e8f4fb;
  color: var(--vw-blue);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--vw-sky);
}

.menu-thumb {
  width: 2.4rem;
  height: 1.6rem;
  object-fit: cover;
  border-radius: 0.2rem;
  background: #dde5ee;
  flex-shrink: 0;
}

.menu-item-label {
  flex: 1;
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.25;
}

.menu-item-count {
  font-size: 0.72rem;
  color: var(--muted);
  background: #eef2f6;
  border-radius: 0.75rem;
  padding: 0.1rem 0.45rem;
}

.app-content {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.content-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid var(--line);
}

.breadcrumb {
  font-size: 0.85rem;
  --bs-breadcrumb-divider-color: var(--muted);
}

.content-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
}

.article-nav {
  overflow: auto;
  background: rgba(255, 255, 255, 0.88);
  border-right: 1px solid var(--line);
  padding: 0.5rem 0;
}

.article-nav-empty {
  padding: 1rem;
  font-size: 0.88rem;
}

.group-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.65rem 0.9rem 0.25rem;
}

.article-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  color: var(--text);
  border-left: 3px solid transparent;
}

.article-link:hover {
  background: #f0f5fa;
}

.article-link.active {
  background: #e8f4fb;
  border-left-color: var(--vw-sky);
  color: var(--vw-blue);
  font-weight: 600;
}

.article-panel {
  overflow: auto;
  padding: 1.25rem 1.5rem 2.5rem;
  font-family: var(--font-body);
}

.article-welcome {
  max-width: 640px;
  margin: 2rem auto;
  text-align: center;
}

.welcome-car {
  max-width: min(480px, 100%);
  height: auto;
  margin-bottom: 1.25rem;
  filter: drop-shadow(0 12px 24px rgba(0, 30, 80, 0.18));
}

.welcome-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--vw-blue);
  margin-bottom: 0.35rem;
}

.welcome-lead {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.article-loading {
  display: flex;
  justify-content: center;
  padding: 3rem;
}

.article-body {
  max-width: 920px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 8px 24px rgba(0, 30, 80, 0.06);
}

.article-body img {
  max-width: 100%;
  height: auto;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  word-break: break-word;
}

.article-body .header,
.article-body .right-btn {
  display: none !important;
}

@media (max-width: 991.98px) {
  :root {
    --topbar-h: 112px;
  }

  .app-topbar {
    height: auto;
    min-height: var(--topbar-h);
    padding: 0.55rem 0.75rem;
    gap: 0.45rem;
  }

  /* Мобилка: строка 1 — бренд | донат | мета; строка 2 — поиск */
  .topbar-row-main {
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  .brand-block {
    order: 1;
  }

  .top-donate {
    flex: 1 1 0;
    order: 2;
  }

  .top-meta {
    gap: 0;
    order: 3;
    margin-left: 0;
  }

  .top-search {
    order: 4;
    flex: 1 0 100%;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .brand-mark {
    width: 1.55rem;
    height: 1.55rem;
  }

  .brand-name {
    font-size: 1rem;
  }

  .brand-sub {
    font-size: 0.68rem;
    max-width: 7.5rem;
  }

  .donate-btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
  }

  .lang-btn {
    font-size: 0.72rem;
    padding: 0.15rem 0.4rem;
  }

  .app-main {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 160px);
  }

  .app-sidebar {
    display: none;
    position: fixed;
    inset: calc(var(--topbar-h) + var(--tabs-h)) auto 0 0;
    width: min(86vw, 320px);
    z-index: 25;
    box-shadow: 8px 0 24px rgba(0, 30, 80, 0.2);
  }

  .app-sidebar.is-open {
    display: block;
  }

  .content-split {
    grid-template-columns: 1fr;
  }

  .article-nav {
    max-height: 220px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 575.98px) {
  .brand-sub {
    display: none;
  }

  .brand-block {
    gap: 0.4rem;
  }

  .donate-btn {
    font-size: 0.72rem;
    padding: 0.3rem 0.55rem;
  }

  .donate-btn-label {
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .donate-modal-body,
  .donate-iframe {
    min-height: 360px;
    height: min(70vh, 480px);
  }
}
