:root {
  --bg: #f3f4f6;
  --bg-alt: #ffffff;
  --border-subtle: #e5e7eb;
  --border-strong: #d1d5db;
  --text-main: #111827;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --text-strong: #0f172a;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-strong: #1d4ed8;
  --accent-border: #bfdbfe;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --success: #166534;
  --success-soft: #ecfdf3;
  --success-border: #bbf7d0;
  --warn: #92400e;
  --warn-soft: #fffbeb;
  --warn-border: #fed7aa;
  --badge-bg: #e5e7eb;
  --badge-text: #374151;
  --tag-bg: #eef2ff;
  --tag-text: #3730a3;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius-lg: 18px;
  --radius-full: 999px;
  --page-pad: clamp(10px, 2vw, 20px);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06),
    0 10px 30px rgba(15, 23, 42, 0.06);
  --main-col-width: 760px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: clamp(14px, 0.4vw + 13px, 16px);
  background: radial-gradient(circle at top left, #e5e7eb 0, #f9fafb 38%, #f3f4f6 100%);
  color: var(--text-main);
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  display: block;
}

.page {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  background: linear-gradient(145deg, #f9fafb 0, #ffffff 40%, #f3f4f6 100%);
  border-radius: 0;
  box-shadow: none;
  border: none;
  display: flex;
  flex-direction: column;
}

.page-inner {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.ip-alphabet-levels {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.ip-alphabet {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.ip-alphabet-link {
  flex: 0 0 30px;
  min-width: 0;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: #fff;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.ip-alphabet-link:hover,
.ip-alphabet-link.is-current,
.ip-alphabet-link.is-parent {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
  text-decoration: none;
}

.ip-alphabet-link.is-current {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.ip-alphabet-link.is-disabled {
  color: #94a3b8;
  cursor: default;
  pointer-events: none;
}

.ip-alphabet-link.is-disabled:hover {
  color: #94a3b8;
  text-decoration: none;
}

.okved-search-link.is-disabled {
  color: #94a3b8;
  cursor: default;
  pointer-events: none;
}

.okved-search-link.is-disabled:hover {
  color: #94a3b8;
  text-decoration: none;
}

.ip-alphabet-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
}

.ip-alphabet-selected strong {
  color: var(--text-main);
}

/* ===== ШАПКА (универсальная: top-bar колоночный, top-bar-main горизонтальный) ===== */

.top-bar {
  display: flex;
  flex-direction: column;
  padding-top: 0;
  background: transparent;
}

.top-bar-main {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px var(--page-pad) 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  backdrop-filter: blur(18px);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.86),
    rgba(248, 250, 252, 0.96)
  );
  gap: 10px;
}

.top-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  padding-left: clamp(13px, 1.2vw + 12px, 21px);
}

.top-left-home {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.top-left-home:hover {
  color: inherit;
}

.logo {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
  color: var(--tag-text);
}

.logo svg {
  display: block;
  width: auto;
  height: 46px;
}

.brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.brand-title {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tag-text);
  line-height: 1;
  margin: 0;
}

.brand-sub {
  font-size: clamp(13px, 0.43vw + 12px, 14px);
  color: #6b7280;
  line-height: 1.1;
  margin: 0;
}

/* ===== ПОИСК (общий: brand-search + adv-search) ===== */

.brand-search {
  margin-top: 7px;
  width: auto;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-search-input-wrap {
  position: relative;
}

.brand-search-input {
  width: 100%;
  font-family: inherit;
  font-size: clamp(13px, 0.4vw + 12px, 14px);
  padding: 7px 88px 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(209, 213, 219, 0.9);
  background: #f9fafb;
  outline: none;
}

.brand-search-input::placeholder {
  color: #9ca3af;
}

.brand-search-input:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.35);
}

.brand-search-btn {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 46px;
  border-radius: 0 999px 999px 0;
  border: none;
  background: var(--tag-text);
  color: #eef2ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.brand-search-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
  stroke: none;
  overflow: visible;
}

.brand-search-btn:hover {
  background: #312e81;
}

.brand-search-adv-btn {
  position: absolute;
  top: 50%;
  right: 56px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--tag-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transform: translateY(-50%);
}

.brand-search-adv-btn:hover,
.brand-search-adv-btn:focus-visible,
.brand-search-adv-btn[aria-expanded="true"] {
  background: transparent;
  color: var(--tag-text);
}

.brand-search-adv-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
  stroke: none;
  overflow: visible;
}

details.adv-search {
  margin-top: 7px;
  width: 100%;
  max-width: var(--main-col-width);
}

details.adv-search:not([open]) {
  display: none;
}

details.adv-search .adv-search-hidden-summary {
  display: none;
}

details.adv-search summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: clamp(12px, 0.3vw + 11px, 14px);
  color: var(--tag-text);
  padding: 4px 10px 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(199, 210, 254, 0.9);
  background: rgba(238, 242, 255, 0.9);
  user-select: none;
}

details.adv-search[open] summary {
  background: rgba(224, 231, 255, 0.98);
  color: var(--tag-text);
  border-color: rgba(165, 180, 252, 0.9);
}

details.adv-search summary::-webkit-details-marker {
  display: none;
}

.adv-search-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tag-text);
}

.adv-search-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

details.adv-search[open] .adv-search-icon {
  border: none;
  background: transparent;
}

.adv-search-arrow {
  font-size: 18px;
  transition: transform 0.15s ease;
}

details.adv-search[open] .adv-search-arrow {
  transform: rotate(180deg);
}

.adv-search-panel {
  margin-top: 9px;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(209, 213, 219, 0.9);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  width: 100%;
  box-sizing: border-box;
}

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

.adv-search-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: clamp(12px, 0.3vw + 11px, 14px);
}

.adv-search-dates {
  grid-column: 1 / -1;
  display: flex;
  gap: 13px;
  flex-wrap: wrap;
}

.adv-search-dates .adv-search-field {
  flex: 1;
  min-width: 140px;
}

.adv-search-field label {
  color: #6b7280;
}

.adv-search-field input,
.adv-search-field select {
  font-family: inherit;
  font-size: clamp(12px, 0.3vw + 11px, 14px);
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(209, 213, 219, 0.9);
  background: #f9fafb;
  outline: none;
}

.adv-search-field input:focus,
.adv-search-field select:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.35);
}

.adv-search-footer {
  margin-top: 9px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  font-size: clamp(12px, 0.3vw + 11px, 14px);
  flex-wrap: wrap;
}

.adv-search-btn {
  border-radius: 999px;
  border: 1px solid rgba(209, 213, 219, 0.9);
  background: #f9fafb;
  padding: 6px 11px;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

.adv-search-btn.primary {
  background: var(--tag-text);
  border-color: var(--tag-text);
  color: #eff6ff;
}

.adv-search-btn.primary:hover {
  background: #312e81;
  border-color: #312e81;
}

.adv-search-btn:hover {
  background: #f3f4f6;
}

.hero-strip {
  width: 100%;
  background: transparent;
  padding: 14px var(--page-pad);
  color: var(--text-main);
  box-shadow: none;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.hero-strip-inner {
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-inline: max(0px, calc(clamp(16px, 3vw, 44px) - var(--page-pad)));
}

.header-hero-text {
  align-self: center;
  margin: 0;
  font-size: clamp(14px, 0.3vw + 13px, 16px);
  color: #4b5563;
  line-height: 1.5;
  width: min(100%, 1180px);
  max-width: 100%;
  text-align: center;
}

@media (min-width: 1200px) {
  .header-hero-text {
    white-space: nowrap;
  }
}

.hero-strip .brand-search {
  margin-top: 0;
  width: 100%;
  max-width: none;
}

.hero-strip .brand-search-input {
  padding: 9px 94px 9px 14px;
}

.hero-strip .brand-search-btn {
  width: 50px;
}

.hero-strip .brand-search-adv-btn {
  right: 60px;
  width: 22px;
  height: 22px;
}

.hero-strip .brand-search-btn svg {
  width: 22px;
  height: 22px;
}

.hero-strip details.adv-search {
  margin-top: 4px;
  width: 100%;
  max-width: none;
}

/* ===== ВЕРХНЕЕ МЕНЮ ===== */

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(12px, 0.3vw + 11px, 14px);
  margin-top: 4px;
  flex-shrink: 0;
  position: relative;
}

.top-menu {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 15px;
  flex-wrap: wrap;
}

.top-menu-item {
  position: relative;
  text-decoration: none;
  color: #4b5563;
  padding: 4px 0;
  cursor: pointer;
}

.top-menu-item:hover {
  color: #111827;
}

.top-menu-item.active {
  color: #111827;
  font-weight: 500;
}

.top-menu-item.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
}

.top-menu-toggle {
  display: none;
  border: none;
  background: transparent;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--tag-text);
  padding: 0;
}

.top-menu-toggle:hover {
  background: rgba(226, 232, 240, 0.8);
  color: var(--tag-text);
}

.top-menu-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
  stroke: none;
}

/* ===== БАЗОВАЯ КАРТОЧКА СЕКЦИИ ===== */

.section {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  padding: 13px 14px 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  position: relative;
  overflow: hidden;
  font-size: clamp(12px, 0.3vw + 11px, 14px);
}

.main .section,
.home-grid .section,
.grid .section,
.section-stack .section,
.card,
.sidebar-small-card {
  background: #ffffff;
}

.section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
  opacity: 0;
  pointer-events: none;
}

.main .section::before,
.home-grid .section::before,
.grid .section::before,
.section-stack .section::before,
.card::before,
.sidebar-small-card::before {
  display: none;
}

.section h2 {
  margin: 0 0 9px;
  font-size: clamp(13px, 0.5vw + 12px, 17px);
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  position: relative;
}

/* ===== ФУТЕР ===== */

.footer {
  margin-top: auto;
  padding: 9px var(--page-pad) 11px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  font-size: clamp(11px, 0.2vw + 10px, 12px);
  color: #9ca3af;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(
    90deg,
    rgba(15, 23, 42, 0.03),
    rgba(248, 250, 252, 0.8)
  );
  backdrop-filter: blur(12px);
  gap: 8px;
  flex-wrap: wrap;
}

.footer span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.footer strong {
  color: #6b7280;
  font-weight: 500;
}

.bottom-meta-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #9ca3af;
}

/* ===== АДАПТИВ ШАПКИ/МЕНЮ/ФУТЕРА ===== */

.content-error {
  padding: 48px var(--page-pad) 72px;
}

.content-error .main {
  max-width: 760px;
  margin: 0 auto;
}

.error-page {
  padding: 56px clamp(22px, 5vw, 64px);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  text-align: center;
}

.error-code {
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.error-page h1 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.18;
  color: var(--text-main);
}

.error-page p {
  max-width: 520px;
  margin: 0 auto 24px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.error-action-primary,
.error-action-secondary {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-decoration: none;
}

.error-action-primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.error-action-primary:hover {
  background: var(--accent-strong);
  color: #ffffff;
  text-decoration: none;
}

.error-action-secondary {
  border: 1px solid rgba(199, 210, 254, 0.9);
  background: rgba(238, 242, 255, 0.9);
  color: var(--text-main);
}

.error-action-secondary:hover {
  border-color: var(--accent-border);
  color: var(--accent-strong);
  text-decoration: none;
}

@media (max-width: 1200px) {
  .adv-search-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .top-menu {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    background: #ffffff;
    padding: 8px 10px;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    min-width: 170px;
    z-index: 20;
  }

  .top-right.menu-open .top-menu {
    display: flex;
  }

  .top-menu-toggle {
    display: inline-flex;
  }
}

@media (max-width: 880px) {
  .top-right {
    margin-left: 0;
  }

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

@media (max-width: 1024px) {
  .hero-strip {
    padding-inline: 12px;
  }

  .hero-strip-inner {
    margin-inline: 0;
  }
}

@media (max-width: 640px) {
  .hero-strip {
    padding-inline: 8px;
  }

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

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  .top-bar-main {
    padding-inline: 12px;
  }

  .hero-strip {
    padding-inline: 8px;
  }

  .hero-strip-inner {
    margin-inline: 0;
  }
}
