/* Scoped styles keep the shared reference independent of each page's theme. */
.topbar .actions .inspection-reference-trigger,
.mobile-header .inspection-reference-trigger {
  width: auto;
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid #9ccfd6;
  background: #e9f7f8;
  color: #075a67;
  font-weight: 700;
  white-space: nowrap;
}
.topbar .actions .inspection-reference-trigger:hover,
.mobile-header .inspection-reference-trigger:hover {
  color: #064c57;
  background: #d9eff2;
  border-color: #0f6b7a;
}
.mobile-header .inspection-reference-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.mobile-header .inspection-reference-actions button { width: auto; margin: 0; }
html.inspection-reference-open,
html.inspection-reference-open body { overflow: hidden; }
dialog.inspection-reference {
  box-sizing: border-box;
  width: min(880px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  padding: 0;
  margin: auto;
  border: 1px solid #d4e1e7;
  border-radius: 18px;
  background: #fff;
  color: #213547;
  box-shadow: 0 28px 90px #0c26354d;
  overflow: hidden;
  font: 15px/1.75 "Microsoft JhengHei", "Segoe UI", Arial, sans-serif;
  text-align: left;
}
.inspection-reference::backdrop { background: rgb(14 30 43 / 62%); }
.inspection-reference__shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 50px);
  max-height: calc(100dvh - 50px);
}
.inspection-reference__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 26px 18px;
  background: #f2f9fa;
  flex: 0 0 auto;
}
.inspection-reference .inspection-reference__eyebrow {
  margin: 0 0 3px;
  color: #0f6b7a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}
.inspection-reference h2 { margin: 0; font-size: 23px; line-height: 1.4; letter-spacing: 0; }
.inspection-reference button { font: inherit; cursor: pointer; }
.inspection-reference .inspection-reference__close {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid #d4e1e7;
  border-radius: 50%;
  color: #365362;
  background: #fff;
  font-size: 28px;
  line-height: 1;
  box-shadow: none;
}
.inspection-reference .inspection-reference__close:hover { background: #e1eef0; }
.inspection-reference__tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding: 12px 26px;
  border-bottom: 1px solid #e0e9ed;
}
.inspection-reference__tabs button {
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f1f5f7;
  color: #486171;
  font-weight: 700;
  box-shadow: none;
}
.inspection-reference__tabs button[aria-selected="true"] { background: #0f6b7a; color: #fff; }
.inspection-reference__tabs button:hover { border-color: #0f6b7a; }
.inspection-reference button:focus-visible,
.inspection-reference [role="tabpanel"]:focus-visible,
.inspection-reference-trigger:focus-visible { outline: 3px solid #3981d5; outline-offset: 3px; }
.inspection-reference__body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 20px 26px 26px;
}
.inspection-reference [hidden] { display: none !important; }
.inspection-reference h3 { margin: 0 0 16px; font-size: 15px; font-weight: 500; color: #617581; }
.inspection-reference__list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: inspection-item;
}
.inspection-reference__list > li {
  position: relative;
  margin: 0;
  padding: 16px 18px 16px 52px;
  border: 1px solid #e0e9ed;
  border-radius: 10px;
  background: #fff;
  counter-increment: inspection-item;
  overflow-wrap: anywhere;
}
.inspection-reference__list > li::before {
  content: counter(inspection-item, decimal-leading-zero);
  position: absolute;
  left: 16px;
  top: 17px;
  font-size: 13px;
  font-weight: 700;
  color: #628795;
}
.inspection-reference h4 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 16px; }
.inspection-reference p { margin: 0; }
.inspection-reference strong { font-weight: 700; color: #0c5968; }
.inspection-reference__badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.8;
  color: #0c5968;
  background: #e7f3f5;
  white-space: nowrap;
}
.inspection-reference__badge--required { background: #fff0eb; color: #a13c23; }
.inspection-reference .inspection-reference__exception { margin-top: 9px; padding: 7px 10px; border-left: 3px solid #d88460; background: #fff7f2; border-radius: 0 5px 5px 0; }
.inspection-reference__exception strong { color: #963e27; }
.inspection-reference__footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 6px 16px;
  flex-wrap: wrap;
  padding: 12px 26px;
  border-top: 1px solid #e0e9ed;
  background: #f8fafb;
  color: #617581;
  font-size: 12px;
}
@media (max-width: 600px) {
  .mobile-header { flex-wrap: wrap; gap: 10px; }
  dialog.inspection-reference { width: calc(100vw - 24px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); border-radius: 14px; }
  .inspection-reference__shell { max-height: calc(100vh - 34px); max-height: calc(100dvh - 34px); }
  .inspection-reference__header { padding: 16px; gap: 10px; }
  .inspection-reference h2 { font-size: 20px; }
  .inspection-reference__tabs { padding: 10px 16px; }
  .inspection-reference__tabs button { flex: 1; padding: 8px; }
  .inspection-reference__body { padding: 16px; scrollbar-gutter: auto; }
  .inspection-reference__list > li { padding: 14px 12px 14px 42px; }
  .inspection-reference__list > li::before { left: 12px; top: 16px; }
  .inspection-reference__footer { padding: 10px 16px; }
}
