.standards-layout {
  display: grid;
  grid-template-columns: 274px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.standards-sidebar {
  position: sticky;
  top: 88px;
  padding: 22px 16px;
}

.standards-sidebar h2 {
  margin: 0 8px 15px;
  color: var(--navy);
  font-size: 18px;
}

.standards-categories,
.standards-trade-list {
  display: grid;
  gap: 4px;
}

.standards-category,
.standards-trade-list button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  text-align: left;
}

.standards-category {
  min-height: 44px;
  padding: 10px 12px;
  background: #eef4fc;
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
}

.standards-category[aria-expanded="true"],
.standards-category[aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
}

.standards-trade-list {
  max-height: min(65vh, 620px);
  overflow-y: auto;
  padding: 8px 5px 14px 0;
  scrollbar-color: #b9cce5 transparent;
}

.standards-trade-list button {
  min-height: 42px;
  padding: 8px 12px;
  background: transparent;
  color: #334863;
  font-size: 14px;
  line-height: 1.45;
}

.standards-trade-list button:hover,
.standards-trade-list button[aria-current="true"] {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
  box-shadow: inset 3px 0 var(--blue);
}

.standards-main { min-width: 0; }
.standards-main .search-panel { margin-bottom: 18px; }
.standards-search-feedback {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
}
.standards-search-feedback:empty { display: none; }

.standards-detail {
  min-height: 360px;
  padding: clamp(22px, 3vw, 38px);
}

.standards-detail-kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.standards-detail h2 {
  margin: 8px 0 28px;
  color: var(--navy);
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.35;
}

.standards-placeholder {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  border: 1px dashed #b8cbe3;
  border-radius: 12px;
  background: #f8fbff;
  text-align: center;
}

.standards-placeholder strong { color: var(--navy); font-size: 17px; }
.standards-placeholder p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.standards-placeholder.has-entries {
  display: grid;
  gap: 16px;
  min-height: 0;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
}

.standards-entry-index {
  padding: 18px 20px;
  border: 1px solid #d7e3f2;
  border-radius: 12px;
  background: #f5f9ff;
}
.standards-entry-index p { margin: 0 0 12px; color: #334863; font-size: 14px; font-weight: 700; }
.standards-entry-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px 12px; }
.standards-entry-links a { padding: 6px 8px; border-radius: 6px; color: #0752b7; font-size: 13px; line-height: 1.4; }
.standards-entry-links a:hover, .standards-entry-links a:focus-visible { background: #e5f0ff; text-decoration: underline; }
.standards-entry-links a[aria-current="true"] { background: #075bd4; color: #fff; font-weight: 700; }
.standards-entry-links a[aria-controls] { min-height: 44px; display: flex; align-items: center; }
[data-trade-group][hidden] { display: none; }

.standards-entry,
.standards-entry-group {
  scroll-margin-top: 92px;
  padding: 22px 24px;
  border: 1px solid #d7e3f2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(22, 57, 104, .04);
}
.standards-entry h3 {
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e4ebf5;
  color: var(--navy);
  font-size: 19px;
  line-height: 1.45;
}
.standards-entry-group > h3 { margin: 0 0 4px; color: var(--navy); font-size: 20px; line-height: 1.45; }
.standards-entry-subitem { padding: 18px 0; border: 0; border-radius: 0; box-shadow: none; }
.standards-entry-subitem + .standards-entry-subitem { border-top: 1px solid #e4ebf5; }
.standards-entry-subitem:last-child { padding-bottom: 0; }
.standards-entry-subitem h4 { margin: 0 0 14px; color: #0752b7; font-size: 17px; line-height: 1.45; }
.standards-entry-subitem.is-withdrawn { padding-inline: 14px; border-radius: 8px; }
.standards-withdrawn-badge { display: inline-block; margin: 0 0 14px; padding: 4px 9px; border-radius: 999px; background: #fff1e9; color: #9a4a17; font-size: 12px; font-weight: 800; }
.standards-entry.is-withdrawn { background: #fffaf7; border-color: #ead4c5; }
.standards-entry-body { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 6px 10px; }
.standards-entry-body p {
  margin: 0;
  padding-left: 15px;
  border-left: 2px solid #c8d9ee;
  color: #263a54;
  font-size: 15px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.standards-entry-body p.standards-entry-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid #dce7f5;
  border-radius: 8px;
  background: #f8fbff;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
  overflow-wrap: normal;
}
.standards-entry-body p.standards-entry-spec { overflow-x: auto; }
.standards-entry-body p.standards-entry-meta strong { display: inline; flex: none; margin: 0; }
.standards-entry-body p:not(.standards-entry-meta) { grid-column: 1 / -1; }
.standards-entry-body strong {
  display: block;
  margin-bottom: 2px;
  color: #0752b7;
  font-size: 14px;
}
.standards-entry-body img { display: block; max-width: 100%; height: auto; margin-top: 10px; }

.allowance-intro {
  padding: 18px 20px;
  border: 1px solid #bdd7fb;
  border-radius: 12px;
  background: #eff6ff;
}
.allowance-intro p { margin: 0 0 8px; color: #263a54; font-size: 14px; line-height: 1.7; }
.allowance-intro a { color: #0752b7; font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.allowance-group {
  scroll-margin-top: 92px;
  padding: 22px 24px;
  border: 1px solid #d7e3f2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(22, 57, 104, .04);
}
.allowance-group > h3 { margin: 0 0 12px; color: var(--navy); font-size: 20px; line-height: 1.45; }
.allowance-list { border-top: 1px solid #dce7f5; }
.allowance-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 14px;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.allowance-entry + .allowance-entry { border-top: 1px solid #edf1f7; }
.allowance-entry h4 {
  display: flex;
  gap: 10px;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
  white-space: nowrap;
}
.allowance-entry > .admin-inline-title-row { min-width: 0; }
.allowance-number { flex: none; color: #0752b7; font-variant-numeric: tabular-nums; }
.allowance-entry .standards-entry-body { display: contents; }
.allowance-entry .standards-entry-body p { padding: 0; border: 0; font-size: 13px; line-height: 1.55; }
.allowance-entry .standards-entry-body p:first-child {
  grid-column: 2;
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: #0752b7;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}
.allowance-entry .standards-entry-body p:first-child strong {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.allowance-entry .standards-entry-body p + p { grid-column: 1 / -1; color: #526884; }
.allowance-entry .standards-entry-body p + p strong { display: inline; margin-right: 7px; font-size: 12px; }

.standards-results { padding: 30px; }
.standards-results h2 { margin: 0 0 18px; color: var(--navy); font-size: 23px; }
.standards-result { padding: 18px 0; border-top: 1px solid var(--line); }
.standards-result span { color: var(--blue); font-size: 12px; font-weight: 800; }
.standards-result h3 { margin: 4px 0 8px; color: var(--navy); font-size: 18px; }
.standards-result-preview {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.standards-no-results { margin: 0; padding: 24px 0; color: var(--muted); }

@media (max-width: 760px) {
  .standards-layout { grid-template-columns: 1fr; gap: 16px; }
  .standards-sidebar { position: static; padding: 18px 14px; }
  .standards-trade-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 290px; }
  .standards-detail { min-height: 280px; padding: 22px; }
  .allowance-group { padding: 18px; }
}

@media (max-width: 420px) {
  .standards-trade-list { grid-template-columns: 1fr; }
  .standards-entry, .standards-entry-group { padding: 18px; }
  .standards-entry-subitem { padding: 18px 0; }
  .allowance-entry { padding: 12px 0; }
  .standards-entry-links { grid-template-columns: 1fr; }
}
