.rh-docs-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 790px);
  gap: clamp(50px, 8vw, 96px);
  justify-content: center;
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(65px, 8vw, 95px) 0 clamp(70px, 9vw, 110px);
}

.rh-docs-sidebar {
  position: sticky;
  top: 105px;
  height: fit-content;
  padding-top: 4px;
}

.rh-docs-sidebar > p {
  margin: 0 0 13px;
  color: var(--rh-ink);
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rh-docs-sidebar nav {
  display: grid;
  padding-left: 13px;
  border-left: 1px solid var(--rh-line);
}

.rh-docs-sidebar a {
  position: relative;
  padding: 6px 0;
  color: var(--rh-muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.rh-docs-sidebar a::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -14px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
}

.rh-docs-sidebar a:hover,
.rh-docs-sidebar a.active {
  color: var(--rh-ink);
}

.rh-docs-sidebar a.active::before {
  background: var(--rh-green-deep);
}

.rh-docs-content {
  min-width: 0;
  color: var(--rh-ink);
}

.rh-docs-heading {
  padding-bottom: 52px;
  scroll-margin-top: 110px;
}

.rh-docs-label {
  margin: 0 0 11px;
  color: var(--rh-green-deep);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rh-docs-heading h1 {
  margin: 0;
  font-size: clamp(2.8rem, 5.5vw, 4.4rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.rh-docs-heading > p:not(.rh-docs-label) {
  max-width: 690px;
  margin: 18px 0 0;
  color: var(--rh-muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.rh-docs-note {
  margin-top: 24px;
  padding: 14px 16px;
  border-left: 3px solid var(--rh-green);
  background: rgba(117, 216, 47, 0.08);
  color: var(--rh-muted);
  font-size: 0.78rem;
}

.rh-docs-note strong {
  color: var(--rh-ink);
}

#contract-risk {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--rh-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.rh-risk-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.rh-risk-icon {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--rh-line);
  border-radius: 50%;
  background: #f1f4ee;
  color: var(--rh-ink);
  font-size: 1rem;
}

.rh-risk-heading .rh-docs-label {
  margin-bottom: 3px;
  color: var(--rh-muted);
}

.rh-docs-content .rh-risk-heading h2 {
  margin: 0;
}

.rh-docs-content .rh-risk-list {
  display: grid;
  gap: 0;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.rh-risk-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  padding: 7px 0;
}

.rh-risk-list li > span {
  color: var(--rh-green-deep);
  font-weight: 800;
  line-height: 1.72;
}

.rh-docs-content .rh-risk-list p {
  margin: 0;
}

.rh-docs-content .rh-risk-acceptance {
  margin: 16px 0 0;
  padding: 13px 14px;
  border: 1px solid var(--rh-line);
  border-radius: 6px;
  background: #f3f5f1;
  color: #303930;
  font-size: 0.82rem;
}

.rh-docs-content section {
  padding: 49px 0;
  border-top: 1px solid var(--rh-line);
  scroll-margin-top: 105px;
}

.rh-docs-content section h2 {
  margin: 0 0 20px;
  font-size: 1.6rem;
  letter-spacing: -0.025em;
}

.rh-docs-content section h3 {
  margin: 31px 0 9px;
  font-size: 1rem;
}

.rh-docs-content section h4 {
  margin: 22px 0 7px;
  font-size: 0.82rem;
}

.rh-docs-content section p {
  margin: 0 0 16px;
  color: #465047;
  font-size: 0.88rem;
  line-height: 1.72;
}

.rh-docs-content section strong {
  color: var(--rh-ink);
}

.rh-docs-content section > ul,
.rh-primary-contract ul {
  margin: 12px 0 20px;
  padding-left: 21px;
  color: #465047;
  font-size: 0.86rem;
}

.rh-docs-content section li {
  margin: 6px 0;
}

.rh-docs-content code {
  font-family: "Roboto Mono", Consolas, monospace;
  font-size: 0.82em;
}

.rh-docs-content p code,
.rh-docs-content li code {
  padding: 2px 5px;
  border: 1px solid var(--rh-line);
  border-radius: 4px;
  background: #f3f5f1;
}

.rh-architecture-map {
  margin: 27px 0;
  padding: 17px;
  border: 1px solid var(--rh-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.rh-architecture-map figcaption {
  margin-bottom: 13px;
  color: var(--rh-muted);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.rh-map-flow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr) auto) minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.rh-map-flow > div {
  padding: 12px 13px;
  border: 1px solid var(--rh-line);
  border-radius: 6px;
  background: #fff;
}

.rh-map-flow > div.primary {
  border-color: #b7cbaa;
  background: #fbfef9;
}

.rh-map-flow small,
.rh-map-flow strong,
.rh-map-flow span {
  display: block;
}

.rh-map-flow small {
  color: var(--rh-muted);
  font-size: 0.62rem;
}

.rh-map-flow strong {
  margin-top: 2px;
  font-size: 0.8rem;
}

.rh-map-flow span {
  margin-top: 2px;
  color: var(--rh-muted);
  font-size: 0.68rem;
}

.rh-map-flow b,
.rh-map-route b {
  color: #8c958d;
  font-size: 0.82rem;
  text-align: center;
}

.rh-docs-content .rh-map-implementation {
  margin: 9px 0;
  color: var(--rh-muted);
  font-size: 0.67rem;
  text-align: center;
}

.rh-map-route {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--rh-line);
  border-bottom: 0;
  background: #fff;
}

.rh-map-route:first-of-type {
  border-radius: 6px 6px 0 0;
}

.rh-map-route:last-child {
  border-bottom: 1px solid var(--rh-line);
  border-radius: 0 0 6px 6px;
}

.rh-map-route > span {
  flex: 0 0 38px;
  color: var(--rh-green-deep);
  font-family: "Roboto Mono", Consolas, monospace;
  font-size: 0.72rem;
}

.rh-docs-content .rh-map-route p {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  font-size: 0.73rem;
  line-height: 1.3;
}

.rh-map-route p strong,
.rh-map-route p small {
  display: block;
}

.rh-map-route p small {
  margin-top: 2px;
  color: var(--rh-muted);
  font-size: 0.62rem;
}

.rh-primary-contract {
  margin-top: 25px;
  padding: 22px;
  border: 1px solid #b7cbaa;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.rh-contract-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.rh-contract-heading > div > span {
  color: var(--rh-green-deep);
  font-size: 0.63rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.rh-contract-heading h3 {
  margin: 4px 0 0 !important;
  font-size: 1.08rem !important;
}

.rh-contract-heading > small {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf1eb;
  color: var(--rh-muted);
  font-size: 0.61rem;
  font-weight: 700;
}

.rh-primary-contract > p,
.rh-contract-entry > p {
  margin-top: 13px !important;
}

.rh-primary-contract ul {
  columns: 2;
  column-gap: 32px;
  margin-bottom: 0;
}

.rh-primary-contract li {
  break-inside: avoid;
}

.rh-contract-entry {
  padding: 27px 0;
  border-bottom: 1px solid var(--rh-line);
}

.rh-doc-address {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 15px;
  padding: 10px 12px;
  border: 1px solid var(--rh-line);
  border-radius: 6px;
  background: #f3f5f1;
}

.rh-doc-address span {
  color: var(--rh-muted);
  font-size: 0.67rem;
  font-weight: 650;
}

.rh-doc-address code {
  overflow-wrap: anywhere;
  color: var(--rh-ink);
  font-size: 0.7rem;
}

.rh-explorer-link {
  color: var(--rh-green-deep);
  font-size: 0.67rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.rh-explorer-link:hover {
  text-decoration: underline;
}

.rh-docs-content .rh-doc-warning {
  color: #9b5d25;
  font-size: 0.76rem;
}

.rh-external-contract {
  margin-top: 22px;
  padding: 17px 19px;
  border-left: 3px solid var(--rh-line);
  background: #f3f5f1;
}

.rh-external-contract h3 {
  margin-top: 0 !important;
}

.rh-external-contract p {
  margin-bottom: 0 !important;
}

.rh-definition-list {
  margin: 22px 0 0;
  border-top: 1px solid var(--rh-line);
}

.rh-definition-list > div {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(0, 1.25fr);
  gap: 22px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rh-line);
}

.rh-definition-list dt,
.rh-definition-list dd {
  margin: 0;
}

.rh-definition-list dt {
  color: var(--rh-ink);
  font-size: 0.74rem;
}

.rh-definition-list dd {
  color: var(--rh-muted);
  font-size: 0.79rem;
}

.rh-doc-table {
  margin: 23px 0;
  overflow-x: auto;
  border: 1px solid var(--rh-line);
  border-radius: 7px;
}

.rh-doc-table table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.rh-doc-table th,
.rh-doc-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--rh-line);
  text-align: left;
}

.rh-doc-table tr:last-child td {
  border-bottom: 0;
}

.rh-doc-table th {
  background: #f3f5f1;
  color: var(--rh-muted);
  font-size: 0.65rem;
}

.rh-doc-table td {
  color: #465047;
  font-size: 0.76rem;
}

.rh-doc-table td:first-child {
  color: var(--rh-ink);
  font-weight: 650;
}

@media (max-width: 900px) {
  .rh-docs-layout {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 38px;
  }

  .rh-primary-contract ul {
    columns: 1;
  }
}

@media (max-width: 720px) {
  .rh-docs-layout {
    display: block;
    width: min(100% - 32px, 790px);
    padding-top: 38px;
  }

  .rh-docs-sidebar {
    position: sticky;
    top: calc(max(12px, env(safe-area-inset-top)) + 62px);
    z-index: 12;
    display: block;
    margin: 0 -16px 30px;
    padding: 8px 16px;
    border-block: 1px solid var(--rh-line);
    background: rgba(244, 244, 241, 0.94);
    backdrop-filter: blur(14px);
  }

  .rh-docs-sidebar > p {
    display: none;
  }

  .rh-docs-sidebar nav {
    display: flex;
    gap: 6px;
    padding: 0;
    overflow-x: auto;
    border: 0;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .rh-docs-sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .rh-docs-sidebar a {
    display: inline-flex;
    min-height: 44px;
    flex: 0 0 auto;
    align-items: center;
    padding: 8px 11px;
    border: 1px solid var(--rh-line);
    border-radius: 7px;
    background: #fff;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .rh-docs-sidebar a::before {
    display: none;
  }

  .rh-docs-sidebar a.active {
    border-color: #a9c598;
    background: rgba(117, 216, 47, 0.14);
    color: var(--rh-ink);
  }

  .rh-docs-heading {
    padding-bottom: 36px;
    scroll-margin-top: 150px;
  }

  .rh-docs-heading h1 {
    font-size: clamp(2.45rem, 12vw, 3.5rem);
  }

  .rh-docs-content section {
    padding: 36px 0;
    scroll-margin-top: 150px;
  }

  .rh-primary-contract {
    padding: 18px;
  }

  .rh-architecture-map {
    margin: 22px 0;
    padding: 14px;
  }

  .rh-map-flow {
    grid-template-columns: 1fr;
  }

  .rh-map-flow b {
    justify-self: center;
    transform: rotate(90deg);
  }

  .rh-doc-table {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .rh-doc-table table {
    display: table;
    min-width: 480px;
    width: 100%;
  }

  .rh-doc-table thead {
    display: table-header-group;
  }

  .rh-doc-table tbody {
    display: table-row-group;
  }

  .rh-doc-table tr {
    display: table-row;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .rh-doc-table th,
  .rh-doc-table td {
    display: table-cell;
    padding: 10px 12px;
    border-bottom: 1px solid var(--rh-line);
  }

  .rh-doc-table td::before {
    content: none;
  }

  .rh-map-route {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
  }

  .rh-map-route > span {
    grid-row: 1 / span 5;
  }

  .rh-map-route p,
  .rh-map-route b {
    grid-column: 2;
  }

  .rh-map-route b {
    justify-self: start;
    transform: rotate(90deg);
  }
}

@media (max-width: 480px) {
  .rh-map-flow {
    grid-template-columns: 1fr;
  }

  .rh-map-flow b {
    justify-self: center;
    transform: rotate(90deg);
  }

  .rh-contract-heading {
    display: grid;
    gap: 7px;
  }

  .rh-contract-heading > small {
    width: fit-content;
  }

  .rh-doc-address,
  .rh-definition-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
