.hm-equipment-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hm-equipment-rail > li {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background: #f8fafd;
}
.hm-equipment-rail img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
}
.hm-equipment-rail img[src$="/03-test-anvil.webp"] { object-fit: cover; }
.hm-equipment-caption { padding: 14px 16px 18px; }
.hm-equipment-rail .hm-equipment-caption h3 { margin: 0 0 6px; }
.hm-equipment-rail .hm-equipment-caption p { margin: 0; color: #0a152a; }
.hm-equipment-rail:focus-visible { outline: 2px solid #0a152a; outline-offset: 3px; }

.hm-history-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 16px;
}
.hm-history-layout > header { grid-column: 1; }
.hm-history-layout header h2 { margin-bottom: 6px; }
.hm-history-layout .hm-history-period { margin: 0; color: #0a152a; }
.hm-history-toggle, .hm-history-control, .hm-history-list.hm-history-copy { display: none; }
.hm-history-years, .hm-history-common { grid-column: 1 / -1; min-width: 0; }
.hm-history-years {
  max-height: min(48vh, 28rem);
  margin-top: 20px;
  overflow: auto;
  border-block: 1px solid #d7dee8;
}
.hm-history-row {
  display: grid;
  grid-template-columns: clamp(102px, 11vw, 150px) minmax(0, 1fr);
  align-items: baseline;
  column-gap: 12px;
  padding-block: 12px;
}
.hm-history-row + .hm-history-row { border-top: 1px solid #d7dee8; }
.hm-history .hm-history-row h3, .hm-history-common summary {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.5;
}
.hm-history-row small, .hm-history-common small {
  margin-inline-start: 4px;
  color: #0a152a;
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
}
.hm-history-window { min-width: 0; overflow: hidden; }
.hm-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 1.6;
}
.hm-history-list li {
  max-width: 100%;
  padding-inline-end: 1.5em;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
.hm-history-common summary {
  width: fit-content;
  max-width: 100%;
  padding-block: 12px;
  cursor: pointer;
}
.hm-history-common-names {
  max-height: min(40vh, 20rem);
  padding-block: 8px;
  overflow: auto;
}
.hm-history :is(.hm-history-years, summary, .hm-history-common-names):focus-visible,
.hm-history-toggle:focus-visible + .hm-history-control {
  outline: 2px solid #0a152a;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .hm-history-toggle {
    position: absolute;
    display: block;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .hm-history-control {
    grid-column: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    color: #0a152a;
    font-size: .9rem;
    cursor: pointer;
  }
  .hm-history-control::before {
    content: '';
    width: 15px;
    height: 15px;
    border: 1px solid currentColor;
    border-radius: 3px;
  }
  .hm-history-toggle:checked + .hm-history-control::before {
    content: "✓" / "";
    display: grid;
    place-items: center;
    background: #ffffff;
    line-height: 1;
  }
  .hm-history-toggle:not(:checked) ~ .hm-history-years .hm-history-track {
    display: flex;
    width: max-content;
    animation: hm-history-flow var(--hm-history-duration) linear infinite;
    animation-play-state: var(--hm-history-play-state, running);
  }
  .hm-history-toggle:not(:checked) ~ .hm-history-years .hm-history-list {
    display: flex;
    flex: none;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .hm-history:is(:hover, :focus-within) { --hm-history-play-state: paused; }
}
@keyframes hm-history-flow {
  to { transform: translateX(-50%); }
}

@media (max-width: 700px) {
  .hm-equipment-rail {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(78%, 260px);
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .hm-equipment-rail::-webkit-scrollbar { display: none; }
  .hm-equipment-rail > li { scroll-snap-align: start; }
  .hm-history-layout { grid-template-columns: minmax(0, 1fr); }
  .hm-history-control { grid-column: 1; justify-self: start; }
  .hm-history-row { grid-template-columns: 76px minmax(0, 1fr); align-items: start; }
  .hm-history-row small { display: block; margin: 1px 0 0; }
  .hm-history-window { align-self: center; }
  .hm-history-years { margin-top: 12px; }
}

.hm-report-group {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(0, 5fr);
  gap: clamp(14px, 2vw, 28px);
  padding-block: 18px;
  border-top: 1px solid #d7dee8;
}
.hm-report-group:last-child { padding-block-end: 0; }
.hm-report-group > div > p { margin: 6px 0 0; color: #0a152a; font-size: 14px; }
.hm-report-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(12px, 1.7vw, 24px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.hm-report-list li { min-width: 0; }
.hm-material {
  display: block;
  color: inherit;
  text-decoration: none;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.hm-report-list .hm-material { color: #0a152a; text-decoration: none; }
.hm-material-frame { display: block; position: relative; }
.hm-material-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.hm-report-list .hm-material-frame {
  height: clamp(180px, 20vw, 248px);
  padding: 12px;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background: #f8fafd;
}
.hm-material-zoom {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #8d9bb0;
  color: #0a152a;
  background: #ffffff;
  font-size: 17px;
  line-height: 1;
}
.hm-report-list .hm-material:is(:hover, :focus-visible) .hm-material-frame { border-color: #0a152a; }
.hm-material:focus-visible { outline: 2px solid var(--hm-light, #0a152a); outline-offset: 2px; }
.hm-material strong { display: block; margin: 10px 0 2px; font-size: 16px; font-weight: 640; line-height: 1.4; }
.hm-material-caption { display: block; color: #0a152a; font-size: 13px; line-height: 1.5; }

.hm-material-dialog {
  box-sizing: border-box;
  width: min(860px, calc(100% - 24px));
  max-width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--hm-line, #d7dee8);
  border-radius: 8px;
  color: var(--hm-light, #0a152a);
  background: var(--hm-deep, #f8fafd);
}
.hm-material-dialog[open] { display: flex; flex-direction: column; }
.hm-material-dialog::backdrop { background: #050c16dc; }
body:has(.hm-material-dialog[open]) { overflow: hidden; }
.hm-material-dialog header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}
.hm-material-dialog h2 { flex: 1; margin: 0; font-size: 16px; line-height: 1.4; word-break: keep-all; }
.hm-material-dialog button {
  min-height: 44px;
  padding: 4px 12px;
  border: 1px solid var(--hm-line, #d7dee8);
  border-radius: 4px;
  color: white;
  background: #142d5b;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.hm-material-dialog [aria-pressed="true"] { color: #0a152a; background: #ffffff; border-color: #8d9bb0; }
.hm-material-dialog button:focus-visible { outline: 2px solid var(--hm-light, #0a152a); outline-offset: 2px; }
.hm-material-sheet { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.hm-material-sheet:focus-visible { outline: 2px solid #0a152a; outline-offset: -3px; }
.hm-material-sheet img { display: block; width: 100%; max-width: none; height: auto; }
.hm-material-sheet.is-original img { width: auto; }

@media (max-width: 800px) {
  .hm-report-group { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .hm-report-group > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; }
  .hm-report-group > div > :is(h3, p) { margin: 0; }
  .hm-report-list {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: clamp(126px, 36vw, 180px);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding: 4px 4px 10px;
  }
  .hm-report-list li { scroll-snap-align: start; }
  .hm-report-list .hm-material-frame { height: 120px; }
  .hm-material-dialog header { padding: 6px 8px; gap: 6px; }
  .hm-material-dialog h2 { font-size: 15px; }
  .hm-material-dialog button { padding-inline: 9px; }
}

.kh-report-gallery > figure { min-width: 0; }
.kh-report-gallery img { max-width: 100%; height: auto; }

body:not(.home-main) #main .kh-process-line + p, body:not(.home-main) #main .kh-document p + .kh-actions,
body:not(.home-main) #main .fb-evidence + .fb-grid { margin-block-start: var(--detail-block-gap); }
body:not(.home-main) #main .fb-evidence h3 + ol { margin-block-start: var(--detail-heading-gap); }
body:not(.home-main) #main .fb-evidence, body:not(.home-main) #main .kh-report-gallery { row-gap: var(--detail-block-gap); }
body:not(.home-main) #main .hm-report-group + .hm-report-group { padding-block-start: max(18px, calc(var(--detail-block-gap) - 18px)); }
body:not(.home-main) #main .hm-report-group { row-gap: var(--detail-heading-gap); }
