.rules-body {
  min-height: 100vh;
  background: #edf2f8;
  color: #14233d;
}

.rules-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 26px 0 56px;
}

.rules-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  padding: 28px;
  border-radius: 8px;
  background: #123f75;
  color: #fff;
  box-shadow: 0 18px 45px rgba(18, 63, 117, .22);
}

.rules-kicker {
  color: #ffd24a;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.rules-hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.55rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.rules-hero p {
  max-width: 760px;
  margin: 12px 0 0;
  color: #d8e6fa;
  font-size: 1rem;
}

.rules-hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.rules-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .09);
  color: #f4f8ff;
  font-weight: 700;
  white-space: nowrap;
}

.rules-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
}

.rules-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid #cbd7e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(27, 50, 86, .08);
}

.rules-search i {
  color: #44638e;
}

.rules-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: #14233d;
  font-size: 1rem;
  background: transparent;
}

.rules-icon-button,
.rules-action-button,
.rules-filter {
  border: 0;
  border-radius: 8px;
  font-weight: 600;
}

.rules-icon-button {
  width: 34px;
  height: 34px;
  color: #506887;
  background: #eef3f8;
}

.rules-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.rules-action-button {
  min-height: 44px;
  padding: 9px 13px;
  color: #123f75;
  background: #fff;
  border: 1px solid #cbd7e7;
  box-shadow: 0 10px 24px rgba(27, 50, 86, .07);
}

.rules-action-button i {
  margin-right: 6px;
}

.rules-ai-toggle.active {
  color: #fff;
  background: #123f75;
  border-color: #123f75;
}

.rules-ai {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(27, 50, 86, .08);
}

.rules-ai-copy h2 {
  margin: 0;
  color: #102b52;
  font-size: 1.12rem;
  line-height: 1.2;
}

.rules-ai-copy p {
  margin: 8px 0 0;
  color: #526985;
  line-height: 1.42;
}

.rules-ai-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.rules-ai-prompt {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #cbd7e7;
  border-radius: 8px;
  color: #123f75;
  background: #f7faff;
  font-size: .88rem;
  font-weight: 700;
  text-align: left;
}

.rules-ai-form {
  display: grid;
  gap: 10px;
}

.rules-ai-form textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 12px;
  border: 1px solid #cbd7e7;
  border-radius: 8px;
  color: #14233d;
  background: #f9fbfe;
  line-height: 1.42;
  outline: 0;
}

.rules-ai-form textarea:focus {
  border-color: #1f4f95;
  box-shadow: 0 0 0 3px rgba(31, 79, 149, .14);
}

.rules-ai-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rules-ai-submit {
  min-height: 44px;
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #c91d1d;
  font-weight: 800;
}

.rules-ai-submit i {
  margin-right: 6px;
}

.rules-ai-answer {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #f7faff;
  color: #203654;
}

.rules-ai-answer h3 {
  margin: 0 0 8px;
  color: #102b52;
  font-size: 1rem;
}

.rules-ai-answer p {
  margin: 0 0 9px;
  line-height: 1.48;
}

.rules-ai-answer ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.rules-ai-answer li {
  margin-top: 5px;
}

.rules-ai-result-button {
  margin-top: 10px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #cbd7e7;
  border-radius: 8px;
  color: #123f75;
  background: #fff;
  font-weight: 800;
}

.rules-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.rules-sidebar,
.rules-content {
  min-width: 0;
}

.rules-sidebar {
  align-self: start;
  position: sticky;
  top: 14px;
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d8e2ef;
  box-shadow: 0 12px 28px rgba(27, 50, 86, .08);
}

.rules-filter-title {
  margin-bottom: 10px;
  color: #61738e;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rules-filter-list {
  display: grid;
  gap: 8px;
}

.rules-filter {
  width: 100%;
  min-height: 42px;
  padding: 9px 9px;
  text-align: left;
  color: #203654;
  background: #eef3f8;
}

.rules-filter.active {
  color: #fff;
  background: #1f4f95;
}

.rules-sources {
  margin-top: 22px;
}

.rules-source {
  padding: 11px 0;
  border-top: 1px solid #e4ebf4;
  color: #4f6380;
  font-size: .9rem;
  line-height: 1.35;
}

.rules-source strong {
  display: block;
  color: #203654;
}

.rules-source span {
  display: block;
  margin-top: 2px;
}

.rules-source a {
  display: inline-flex;
  margin-top: 7px;
  color: #1f4f95;
  font-weight: 800;
  text-decoration: none;
}

.rules-result-line {
  min-height: 34px;
  color: #61738e;
  font-weight: 800;
}

.rules-accordion {
  display: grid;
  gap: 12px;
}

.rules-chapter {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #d8e2ef;
  background: #fff;
  box-shadow: 0 12px 28px rgba(27, 50, 86, .07);
}

.rules-chapter-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border: 0;
  color: #102b52;
  background: #fff;
  text-align: left;
}

.rules-chapter-header strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.rules-chapter-header span {
  color: #667a96;
  font-size: .86rem;
  font-weight: 800;
}

.rules-chapter-header i {
  color: #1f4f95;
  transition: transform .16s ease;
}

.rules-chapter.open .rules-chapter-header i {
  transform: rotate(180deg);
}

.rules-chapter-body {
  display: none;
  padding: 0 16px 16px;
}

.rules-chapter.open .rules-chapter-body {
  display: grid;
  gap: 10px;
}

.rules-article {
  border: 1px solid #e0e8f2;
  border-radius: 8px;
  background: #f9fbfe;
}

.rules-article summary {
  cursor: pointer;
  padding: 13px 14px;
  color: #162946;
  font-weight: 600;
  list-style: none;
}

.rules-article summary::-webkit-details-marker {
  display: none;
}

.rules-article summary span {
  display: block;
  color: #647894;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.rules-article-body {
  padding: 0 14px 14px;
  color: #233956;
}

.rules-article-body p {
  margin: 0 0 9px;
  line-height: 1.5;
}

.rules-article-body p:last-child {
  margin-bottom: 0;
}

.rules-figure {
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #fff;
}

.rules-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.rules-image-grid .rules-figure {
  display: grid;
  align-content: space-between;
  margin: 0;
  min-height: 190px;
}

.rules-figure-image {
  display: block;
  width: min(100%, 720px);
  height: auto;
  margin: 0 auto;
}

.rules-figure-small .rules-figure-image {
  max-height: 150px;
  object-fit: contain;
}

.rules-figure figcaption {
  margin-top: 8px;
  color: #61738e;
  font-size: .82rem;
  font-weight: 600;
  text-align: center;
}

.rules-table-wrap {
  overflow-x: auto;
  margin-top: 10px;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #fff;
}

.rules-data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  color: #203654;
}

.rules-data-table th,
.rules-data-table td {
  padding: 10px 12px;
  border: 1px solid #d8e2ef;
  vertical-align: top;
  line-height: 1.38;
}

.rules-data-table th {
  color: #fff;
  background: #c91d1d;
  font-size: .84rem;
  text-align: left;
}

.rules-data-table td:first-child,
.rules-data-table td:last-child {
  font-weight: 800;
  white-space: nowrap;
}

.rules-mark {
  padding: 0 .12em;
  border-radius: 4px;
  background: #ffe58a;
  color: #1d2b3e;
}

.rules-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 46px 18px;
  border-radius: 8px;
  border: 1px dashed #becce0;
  background: #fff;
  color: #61738e;
  text-align: center;
}

.rules-empty i {
  color: #1f4f95;
  font-size: 1.7rem;
}

.rules-empty strong {
  color: #203654;
}

@media (max-width: 900px) {
  .rules-hero,
  .rules-toolbar,
  .rules-ai,
  .rules-layout {
    grid-template-columns: 1fr;
  }

  .rules-hero-meta,
  .rules-actions {
    justify-content: flex-start;
  }

  .rules-sidebar {
    position: static;
  }
}

@media (max-width: 560px) {
  .rules-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 16px;
  }

  .rules-hero {
    padding: 20px;
  }

  .rules-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rules-action-button {
    width: 100%;
    padding-inline: 8px;
  }

  .rules-ai-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rules-ai-submit,
  .rules-ai-controls .rules-action-button {
    width: 100%;
  }
}
