.gov-materials-open {
  overflow: hidden;
}
.gov-materials-dialog {
  width: min(860px, calc(100vw - 40px));
  max-width: none;
  max-height: min(820px, calc(100dvh - 64px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border, #e1e7e7);
  border-radius: 24px;
  background: var(--bg-card, #fff);
  color: var(--fg, #26323c);
  box-shadow: 0 24px 100px rgb(26 44 52 / 16%);
}
.gov-materials-dialog[open] {
  display: flex;
  flex-direction: column;
}
.gov-materials-dialog::backdrop {
  background: rgb(25 43 50 / 24%);
  backdrop-filter: blur(5px);
}
.gov-materials-dialog *,
.gov-materials-dialog *::before,
.gov-materials-dialog *::after {
  box-sizing: border-box;
}
.gov-materials-dialog button,
.gov-materials-dialog input,
.gov-materials-dialog select {
  font: inherit;
  color: inherit;
}
.gov-materials-dialog button {
  cursor: pointer;
}
.gov-materials-dialog button:focus-visible,
.gov-materials-dialog input:focus-visible,
.gov-materials-dialog select:focus-visible,
.gm-panel:focus-visible {
  outline: 2px solid #6c7483;
  outline-offset: 3px;
}
.gm-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 23px 26px 16px;
}
.gm-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
}
.gm-close {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border, #e1e7e7);
  border-radius: 50%;
  background: transparent;
  font-size: 24px !important;
  line-height: 1;
}
.gm-controls {
  flex: none;
  padding: 0 26px 19px;
}
.gm-tabs {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border, #e1e7e7);
  margin-bottom: 16px;
}
.gm-card-actions { flex-wrap: wrap; }
.gm-card-actions .gm-favorite { background: transparent; }
.gm-card-actions .gm-favorite[aria-pressed="true"] { color: #776127; background: #faf5e6; }
.gm-tabs button {
  padding: 12px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  font-size: 14px;
  white-space: nowrap;
  color: var(--fg-muted, #75818b);
}
.gm-tabs button[aria-selected="true"] {
  border-bottom-color: currentColor;
  color: var(--fg, #26323c);
}
.gm-filters {
  display: flex;
  gap: 12px;
}
.gm-filters input,
.gm-filters select {
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border, #e1e7e7);
  border-radius: 11px;
  background: var(--bg-soft, #f3f6f6);
  font-size: 13px;
}
.gm-filters input {
  flex: 1;
  width: 100%;
  min-width: 0;
}
.gm-filters select {
  width: 138px;
  flex: none;
}
.gm-panel {
  flex: 1;
  min-height: 150px;
  padding: 1px 26px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.gm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.gm-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border, #e1e7e7);
  border-radius: 16px;
  background: var(--bg-card, #fff);
}
.gm-image {
  position: relative;
  aspect-ratio: 1.15;
  padding: 14px;
  border-radius: 10px;
  background: var(--bg-soft, #f3f6f6);
}
.gm-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gm-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 8px;
  background: rgb(255 255 255 / 90%);
  font-size: 10px;
  color: #656a73;
}
.gm-card h3 {
  overflow: hidden;
  margin: 12px 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
}
.gm-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.gm-card-actions button {
  flex: 1;
  padding: 8px 5px;
  min-height: 36px;
  border: 1px solid var(--border, #e1e7e7);
  border-radius: 9px;
  background: transparent;
  font-size: 11px;
  white-space: nowrap;
}
.gm-card-actions button[aria-pressed="true"] {
  color: #565f6e;
  background: #eef0f3;
  border-color: #d7dbe2;
}
.gm-card-actions .gm-reference {
  background: var(--bg-soft, #f3f6f6);
}
.gm-card-actions button:hover {
  border-color: #9ca2ad;
}
.gm-empty {
  display: grid;
  place-items: center;
  min-height: 210px;
  color: var(--fg-muted, #75818b);
  font-size: 14px;
}
.gm-notice {
  flex: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 0 26px;
  font-size: 12px;
  color: var(--fg-muted, #75818b);
}
.gm-notice:not(:has([data-gm-status]:empty)) {
  padding-bottom: 12px;
}
.gm-notice button {
  padding: 4px 8px;
  border: 1px solid var(--border, #e1e7e7);
  border-radius: 7px;
  background: transparent;
}
.gm-footer {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 26px 20px;
  border-top: 1px solid var(--border, #e1e7e7);
}
.gm-footer span {
  font-size: 13px;
  color: var(--fg-muted, #75818b);
}
.gm-footer button {
  min-width: 92px;
  min-height: 42px;
  padding: 10px 22px;
  border: 0;
  border-radius: 11px;
  background: var(--fg, #26323c);
  color: var(--bg-card, #fff);
  font-size: 13px;
}
.gov-materials-dialog [hidden] {
  display: none !important;
}
@media (max-width: 600px) {
  .gov-materials-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .gm-header {
    padding: max(18px, env(safe-area-inset-top)) 18px 12px;
  }
  .gm-header h2 {
    font-size: 20px;
  }
  .gm-controls {
    padding: 0 18px 15px;
  }
  .gm-tabs {
    gap: 25px;
    margin-bottom: 13px;
  }
  .gm-tabs button {
    min-height: 44px;
  }
  .gm-filters {
    gap: 8px;
  }
  .gm-filters input,
  .gm-filters select {
    height: 44px;
    font-size: 16px;
  }
  .gm-filters select {
    width: 124px;
    font-size: 13px;
  }
  .gm-panel {
    padding: 0 18px 18px;
  }
  .gm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .gm-card {
    padding: 9px;
    border-radius: 13px;
  }
  .gm-image {
    padding: 8px;
    aspect-ratio: 1;
  }
  .gm-card-actions button {
    min-height: 40px;
    padding-inline: 3px;
  }
  .gm-card h3 {
    margin-block: 10px;
    font-size: 12px;
  }
  .gm-footer {
    padding: 13px 18px max(16px, env(safe-area-inset-bottom));
  }
}
/* Empty-state explanations must remain readable on touch terminals. */
.gm-empty{font-size:16px;line-height:1.8;padding:32px 20px;max-width:620px;margin:auto;text-align:center}
