#tax-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
  padding-bottom: 60px;
}

#tax-search-bar {
  position: fixed;
  bottom: 0;
  left: 100px;
  right: 0;
  z-index: 9999;
  display: flex;
  gap: 8px;
  background: #fff;
  padding: 10px 24px;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08);
}

#tax-search {
  flex: 1;
}

#tax-search-btn {
  padding: 8px 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

#tax-search-btn:hover {
  background: #e0e0e0;
}

#tax-nav {
  flex: 0 0 420px;
  min-width: 350px;
  max-width: 420px;

  position: sticky;
  top: 20px;

  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.tax-nav-title {
  font-weight: 700;
  margin-bottom: 12px;
}

#tax-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#tax-nav li {
  margin-bottom: 6px;
}

.nav-section a {
  font-weight: 600;
}

.nav-chapter {
  padding-left: 14px;
  font-size: 14px;
}

#tax-nav a {
  text-decoration: none;
  color: #222;
}

#tax-nav a:hover {
  text-decoration: underline;
}

#tax-content {
  flex: 1 1 auto;
  min-width: 0;
}

#tax-container {
  max-width: 1440px;
  margin: 0 auto;

  display: flex;
  gap: 24px;
  align-items: flex-start;
}

#tax-content [id] {
  scroll-margin-top: 240px;
}

.tax-section,
.tax-chapter {
  scroll-margin-top: 150px;
}

#tax-search {
  width: 100%;
  padding: 8px 10px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.tax-hidden {
  display: none !important;
}

.tax-highlight {
  background: #fff3b0;
}

/* Липкий поиск — десктоп */
@media (min-width: 901px) {
  #tax-search {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }
}

/* ============================= */
/* MOBILE FIXES ONLY */
/* ============================= */

@media (max-width: 900px) {

  #tax-wrapper {
    flex-direction: column;
    padding: 0 12px;
  }

  #tax-container {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  #tax-nav {
    position: static;

    flex: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;

    max-height: none;
    overflow: visible;
  }

  #tax-content {
    width: 100%;
    min-width: 0;
  }

  /* защита от переполнения текста */
  #tax-content * {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* липкий поиск */
  #tax-search {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
  }
}

html, body {
  overflow-x: hidden;
}

/* ДЕСКТОП */
@media (min-width: 901px) {
  #tax-nav {
    position: sticky;
    top: 20px;

    flex: 0 0 420px;
    min-width: 420px;
    max-width: 420px;

    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
}
