/* Hazard ID uses exclusive, full-page search and selected-profile surfaces. */
.content-area > .view[hidden],
#lookup.view[hidden] { display: none !important; }

#lookup[data-hazard-page-state="chemical-profile"] > #hazard-id-search-hero,
#lookup[data-hazard-page-state="chemical-profile"] > #hazard-id-search-workspace,
#lookup[data-hazard-page-state="chemical-profile"] > #facility-inventory,
#lookup[data-hazard-page-state="hazard-profile"] > #hazard-id-search-hero,
#lookup[data-hazard-page-state="hazard-profile"] > #hazard-id-search-workspace,
#lookup[data-hazard-page-state="hazard-profile"] > #facility-inventory { display: none !important; }

#lookup.view:not([hidden])[data-hazard-page-state="chemical-profile"],
#lookup.view:not([hidden])[data-hazard-page-state="hazard-profile"] {
  display: block !important;
  width: 100% !important;
  padding: 0 !important;
}

#lookup.view[data-hazard-page-state="chemical-profile"] > #chemical-id-results,
#lookup.view[data-hazard-page-state="hazard-profile"] > #hazard-profile-results {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

#lookup[data-hazard-page-state="chemical-profile"] .chemical-profile-shell,
#lookup[data-hazard-page-state="hazard-profile"] .hazard-profile-shell {
  width: 100% !important;
}

#chemical-id-results .chemical-profile-toolbar {
  grid-template-columns: auto minmax(130px, 1fr) auto !important;
}

#chemical-id-results .chemical-profile-toolbar-actions {
  display: flex !important;
  justify-content: flex-end !important;
}

#chemical-id-results #open-chemcompare-btn {
  display: inline-flex !important;
}

/* Header polish: keep the NFPA diamond unboxed while giving the three
   operational identifiers the visual weight their values carry. */
#chemical-id-results .chemical-nfpa-placard {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 6px 0 !important;
}

#chemical-id-results .chemical-profile-meta-item .chemical-profile-meta-title {
  font-size: 0.9rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.055em;
  line-height: 1.15;
}

#chemical-id-results .chemical-profile-meta-item[data-field="un-na"] .chemical-profile-meta-title,
#chemical-id-results .chemical-profile-meta-item[data-field="hazard-class"] .chemical-profile-meta-title {
  color: var(--gold) !important;
}

#chemical-id-results .chemical-profile-meta-item[data-field="erg-guide"] .chemical-profile-meta-title {
  color: #ff8a1c !important;
}

#chemical-id-results .chemical-profile-meta-item[data-field="hazard-class"] .chemical-profile-meta-value {
  color: var(--gold) !important;
  font-size: 1.08rem !important;
  font-weight: 800 !important;
  line-height: 1.25;
  white-space: pre-line;
}

#chemical-id-results .chemical-profile-meta-item[data-field="hazard-class"] .chemical-hazard-class-list {
  font-size: 1.08rem !important;
  font-weight: 800 !important;
  line-height: 1.25;
}

/* Hazard ID is a document-sized profile. The app shell owns no fixed-height
   profile surface; the document grows with the source-backed content. */
@media (min-width: 768px) {
  html,
  body { min-height: 100%; overflow-y: auto; }

  .app-shell:has(#lookup.view.active) {
    height: auto !important;
    min-height: 100vh;
    overflow: visible !important;
  }

  .app-shell:has(#lookup.view.active) > .layout,
  .app-shell:has(#lookup.view.active) .content-area {
    height: auto !important;
    min-height: 0;
    overflow: visible !important;
  }

  #lookup.view.active {
    height: auto !important;
    min-height: calc(100vh - 16px);
    min-height: calc(100dvh - 24px) !important;
    align-content: start;
    overflow: visible !important;
  }

  #lookup > #chemical-id-results,
  #lookup > #hazard-profile-results,
  #lookup > .hazard-id-empty-profile {
    height: auto !important;
    min-height: 0;
    overflow: visible !important;
  }

  #lookup .chemical-profile-shell,
  #lookup .hazard-profile-shell {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    grid-template-rows: none !important;
  }

  #lookup .chemical-profile-layout,
  #lookup .chemical-profile-content-card,
  #lookup .hazard-profile-content-card {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #lookup .chemical-profile-content,
  #lookup .hazard-profile-content {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    align-content: start;
  }

  #lookup #chemical-id-results .chemical-profile-content[data-active-tab="overview"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: start !important;
    grid-auto-flow: row;
  }

  #lookup #chemical-id-results .chemical-profile-content[data-active-tab="overview"] > .chemical-profile-overview-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    align-items: start;
    gap: 12px;
    min-width: 0;
    height: auto;
  }

  #lookup #chemical-id-results .chemical-profile-content[data-active-tab="overview"] > .chemical-profile-overview-column > .chemical-profile-section {
    height: auto !important;
    min-height: 0 !important;
  }

  #lookup #chemical-id-results .chemical-profile-content[data-active-tab="overview"] > .chemical-profile-source-summary {
    grid-column: 1 / -1;
  }

  #lookup #chemical-id-results .chemical-profile-content[data-active-tab="properties"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: start !important;
    grid-auto-flow: row;
  }

  #lookup #chemical-id-results .chemical-profile-content[data-active-tab="properties"] > .chemical-profile-section {
    grid-column: auto !important;
    height: auto !important;
    min-height: 0 !important;
  }

  #lookup #chemical-id-results .chemical-profile-content[data-active-tab="properties"] > [data-section="chemical-properties"] {
    grid-column: 1 !important;
  }

  #lookup #chemical-id-results .chemical-profile-content[data-active-tab="properties"] > [data-section="reactivity"] {
    grid-column: 2 !important;
  }

  #lookup #chemical-id-results .chemical-profile-content[data-active-tab="properties"] .chemical-profile-section[data-section="chemical-properties"] .chemical-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #lookup #chemical-id-results .chemical-profile-secondary-details {
    grid-column: 1 / -1;
    margin-top: 4px;
    color: #dce7f2;
  }

  #lookup #chemical-id-results .chemical-profile-secondary-details summary {
    color: #9fc9e5;
    cursor: pointer;
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  #lookup #chemical-id-results .chemical-profile-secondary-details > span {
    display: block;
    margin-top: 6px;
    font-size: .78rem;
    line-height: 1.45;
  }

  #lookup .hazard-profile-limitations {
    display: block !important;
    min-height: 0;
    padding: 9px 11px;
    border: 1px solid var(--gold);
    border-radius: 8px;
    background: rgba(var(--gold-rgb), 0.2);
  }

  #lookup .hazard-profile-limitations:empty { display: none !important; }

  #lookup .hazard-profile-source-footer {
    display: grid !important;
    min-height: 0;
  }
}

@media (max-width: 700px) {
  #chemical-id-results .chemical-profile-toolbar {
    grid-template-columns: 1fr auto !important;
  }

  #chemical-id-results .chemical-profile-toolbar > strong {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

/* CBRN / CWA operational profile. This is the single authoritative layout for
   the populated starter-hazard surface; every panel is content-sized. */
.hazard-profile-shell {
  display: grid;
  gap: 12px;
  min-height: 0 !important;
  padding: 12px;
  border: 1px solid #24577c;
  border-radius: 12px;
  background: linear-gradient(160deg, #061e33 0%, #031827 72%);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
  color: #e8f3f9;
  font-family: var(--hazmatiq-font-body);
  font-size: 1rem;
  line-height: 1.55;
}

.hazard-profile-load-state {
  padding: 28px;
  border: 1px solid #315f82;
  border-radius: 8px;
  color: #dceffc;
  background: rgba(8, 43, 71, .86);
  font-weight: 800;
  text-align: center;
}

.hazard-profile-shell[data-profile-state="loading"] > :not(#hazard-profile-load-state),
.hazard-profile-shell[data-profile-state="error"] > :not(#hazard-profile-load-state) { display: none !important; }

/* Radiological identities use their own source-backed schema. Chemical and
   CBRNE/CWA cards remain on the existing operational layout. */
.radiological-profile-panel[hidden] { display: none !important; }
.radiological-profile-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #315f82;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(5, 28, 48, .98), rgba(3, 18, 31, .98));
  font-family: var(--hazmatiq-font-body);
  font-size: 1rem;
  line-height: 1.55;
}
.radiological-profile-heading,
.radiological-guided-response > header,
.radiological-scenarios > header,
.radiological-reference-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 2px 2px 8px;
  border-bottom: 1px solid #2b6388;
}
.radiological-profile-heading h2,
.radiological-guided-response h2,
.radiological-scenarios h2,
.radiological-reference-footer h2 { margin: 0; color: #f8fafc; font-size: 1.1rem; font-weight: 850; }
.radiological-profile-heading > span,
.radiological-guided-response > header > span,
.radiological-scenarios > header > span { color: #9fc9e5; font-size: .67rem; font-weight: 800; text-align: right; }
.radiological-profile-section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.radiological-profile-section,
.radiological-response-stage,
.radiological-scenario-card {
  min-width: 0;
  padding: 11px;
  border: 1px solid #2c5d7e;
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(9, 43, 70, .9), rgba(5, 28, 48, .86));
}
.radiological-profile-section h3,
.radiological-response-stage h3,
.radiological-scenario-card h3 { margin: 0 0 8px; color: var(--gold); font-size: 1rem; font-weight: 850; }
.radiological-profile-fields { display: grid; gap: 7px; }
.radiological-profile-field { display: grid; gap: 3px; min-width: 0; padding-bottom: 7px; border-bottom: 1px solid rgba(76, 133, 167, .28); }
.radiological-profile-field:last-child { padding-bottom: 0; border-bottom: 0; }
.radiological-profile-field > strong { color: #dff3ff; font-size: .9rem; font-weight: 850; }
.radiological-profile-field > p { margin: 0; color: #f2f8fc; font-size: 1rem; line-height: 1.55; overflow-wrap: anywhere; }
.radiological-profile-field[data-state="unavailable"] > p { color: #9fb4c3; font-style: italic; }
.radiological-profile-field small,
.radiological-profile-field a,
.radiological-response-stage > small,
.radiological-scenario-card > small { color: #91bdd5; font-size: .78rem; line-height: 1.35; }
.radiological-profile-field a,
.radiological-reference-list a { color: #73d7ff; text-decoration: underline; }
.radiological-source-markers { display: flex; flex-wrap: wrap; gap: 6px; }
.radiological-guided-response,
.radiological-scenarios { display: grid; gap: 9px; }
.radiological-response-stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.radiological-response-stage { display: grid; align-content: start; gap: 7px; border-top: 3px solid var(--gold); }
.radiological-response-stage header { display: flex; align-items: center; gap: 7px; }
.radiological-response-stage header > span { color: var(--gold); font-size: .8rem; font-weight: 850; }
.radiological-response-stage h3 { margin: 0; color: #f8fafc; font-size: 1rem; font-weight: 850; }
.radiological-response-stage ul { display: grid; gap: 6px; margin: 0; padding-left: 15px; }
.radiological-response-stage li { color: #dcecf5; font-size: 1rem; line-height: 1.55; }
.radiological-scenario-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.radiological-scenario-card { display: grid; align-content: start; gap: 6px; }
.radiological-scenario-card > strong { color: var(--gold); font-size: .9rem; line-height: 1.35; }
.radiological-scenario-card > p { margin: 0; color: #dcecf5; font-size: 1rem; line-height: 1.55; }
.radiological-reference-footer { align-items: start; }
.radiological-reference-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; min-width: min(70%, 760px); }
.radiological-reference-list a { font-size: .9rem; line-height: 1.4; }
#lookup #hazard-profile-results[data-hazard-lane="RADIOLOGICAL"] .hazard-profile-action-grid,
#lookup #hazard-profile-results[data-hazard-lane="RADIOLOGICAL"] .hazard-profile-priorities,
#lookup #hazard-profile-results[data-hazard-lane="RADIOLOGICAL"] .hazard-profile-operational-grid { display: none !important; }

@media (max-width: 980px) {
  .radiological-response-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .radiological-scenario-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .radiological-profile-section-grid,
  .radiological-response-stages,
  .radiological-scenario-cards,
  .radiological-reference-list { grid-template-columns: 1fr; }
  .radiological-profile-heading,
  .radiological-guided-response > header,
  .radiological-scenarios > header,
  .radiological-reference-footer { align-items: start; flex-direction: column; }
  .radiological-profile-heading > span,
  .radiological-guided-response > header > span,
  .radiological-scenarios > header > span { text-align: left; }
  .radiological-reference-list { min-width: 0; }
}

.hazard-profile-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}
.hazard-profile-toolbar > strong {
  color: #f8fafc;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .76rem;
}
.hazard-profile-toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.hazard-profile-header-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  grid-template-areas: "emblem identity";
  align-items: start;
  gap: 14px;
  min-height: 0 !important;
  padding: 18px;
  border: 1px solid #2f668d;
  border-radius: 10px;
  background:
    radial-gradient(circle at 80% 12%, rgba(var(--gold-rgb), .12), transparent 25%),
    linear-gradient(135deg, #0b3455, #071f36 78%);
}
.hazard-profile-emblem { grid-area: emblem; display: grid; width: 64px; height: 64px; place-items: center; color: var(--gold); }
.hazard-profile-emblem svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.6; }
.hazard-profile-emblem[data-lane="RADIOLOGICAL"] svg circle:first-child { fill: currentColor; stroke: none; }
.hazard-profile-identity { grid-area: identity; min-width: 0; }
.hazard-profile-title-line { display: flex; align-items: baseline; gap: 12px; }
.hazard-profile-title-line h2 { margin: 0; color: #f8fafc; font: 900 clamp(1.8rem, 3.2vw, 3.2rem) var(--hazmatiq-font-heading); letter-spacing: .04em; line-height: 1.05; }
.hazard-profile-identity > #hazard-profile-category { margin: 4px 0 0; color: #c8e2f3; font-size: 1rem; font-weight: 700; }
.hazard-profile-identifiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 16px; }
.hazard-profile-fact-tile { display: grid; gap: 3px; min-width: 0; padding: 9px 10px; border: 1px solid #3b7196; border-radius: 6px; background: rgba(4, 25, 43, .7); }
.hazard-profile-fact-label { color: #8fb8d1; font-size: .78rem; font-weight: 800; line-height: 1.2; }
.hazard-profile-fact-value { color: #f7fbfd; font-size: 1rem; font-weight: 750; line-height: 1.35; overflow-wrap: anywhere; }

.hazard-profile-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; padding: 2px 2px 8px; border-bottom: 1px solid #326b94; }
.hazard-profile-section-heading h2 { margin: 0; color: #f8fafc; font-size: 1.1rem; font-weight: 850; }
.hazard-profile-section-heading > span { color: #a8c9dc; font-size: .82rem; line-height: 1.35; text-align: right; }
.hazard-profile-priorities { display: grid; gap: 8px; }

.hazard-profile-action-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  min-height: 0 !important;
}
.hazard-action-ribbon-item {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  min-height: 0 !important;
  padding: 13px 14px;
  border: 1px solid #315f82;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #082b47;
}
.hazard-action-ribbon-item h3 { margin: 0; color: #f8fafc; font-size: 1rem; font-weight: 850; line-height: 1.25; }
.hazard-action-ribbon-item p { margin: 0; color: #dcecf5; font-size: 1rem; line-height: 1.55; }
.hazard-action-ribbon-item p strong { color: #fff; font-weight: 850; }
.hazard-action-ribbon-critical { border-left-color: #d9564b; background: linear-gradient(135deg, rgba(105, 28, 31, .52), #082b47 60%); }
.hazard-action-ribbon-warning { border-left-color: var(--gold); }
.hazard-action-ribbon-detection { border-left-color: #32c5ee; background: linear-gradient(135deg, rgba(12, 80, 105, .52), #082b47 60%); }
.hazard-action-ribbon-ppe { border-left-color: #b07cff; background: linear-gradient(135deg, rgba(69, 39, 105, .5), #082b47 60%); }
.hazard-action-ribbon-decon { border-left-color: #2bc7ad; background: linear-gradient(135deg, rgba(10, 91, 86, .5), #082b47 60%); }
.hazard-action-ribbon-medical { border-left-color: #f08bca; background: linear-gradient(135deg, rgba(103, 46, 87, .5), #082b47 60%); }
.hazard-source-marker { display: inline-flex; width: fit-content; color: #79d9f7; font-size: .78rem; font-weight: 850; line-height: 1.2; text-decoration: underline; }
.hazard-source-marker:hover { color: #fff; }

.hazard-profile-operational-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}
.hazard-profile-column { display: grid; align-content: start; align-self: start; gap: 8px; min-width: 0; }
.hazard-profile-column-threat,
.hazard-profile-column-medical { grid-column: 1 / -1; }
.hazard-profile-column-heading { display: flex; align-items: center; gap: 8px; padding: 4px 2px 7px; border-bottom: 1px solid #326b94; }
.hazard-profile-column-heading span { color: var(--gold); font-size: .8rem; font-weight: 850; }
.hazard-profile-column-heading h2 { margin: 0; color: #f8fafc; font-size: 1.1rem; font-weight: 850; }
.hazard-profile-column > div { display: grid; align-content: start; gap: 8px; }
.hazard-profile-column-field { grid-column: 1 / -1; }
.hazard-profile-column-field > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.hazard-operational-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  min-height: 0 !important;
  padding: 14px;
  border: 1px solid #24577c;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: linear-gradient(145deg, #0a304e, #061f34);
}
.hazard-operational-card-critical { border-left-color: #d9564b; }
.hazard-operational-card-detection { border-left-color: #32c5ee; }
.hazard-operational-card-ppe { border-left-color: #b07cff; }
.hazard-operational-card-decon { border-left-color: #2bc7ad; }
.hazard-operational-card-medical { border-left-color: #f08bca; }
.hazard-operational-card-source { border-left-color: #7ba4bc; }
.hazard-operational-card-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.hazard-operational-card h3 { margin: 0; color: #f8fafc; font-size: 1.05rem; font-weight: 850; line-height: 1.25; }
.hazard-operational-facts { display: grid; gap: 6px; margin: 0; }
.hazard-operational-facts > div { display: grid; gap: 2px; min-width: 0; padding-bottom: 6px; border-bottom: 1px solid rgba(61, 125, 170, .4); }
.hazard-operational-facts > div:last-child { padding-bottom: 0; border-bottom: 0; }
.hazard-operational-facts dt { color: #b9d9e9; font-size: .88rem; font-weight: 850; line-height: 1.25; }
.hazard-operational-facts dd { margin: 0; color: #f2f7fb; font-size: 1rem; line-height: 1.55; overflow-wrap: anywhere; }
.hazard-operational-empty { margin: 0; color: #b9cbd5; font-size: 1rem; }

.hazard-profile-detail-drawer { min-width: 0; border: 1px solid #24577c; border-radius: 8px; background: #062239; }
.hazard-profile-detail-drawer > summary,
.hazard-profile-source-drawer > summary,
.radiological-reference-drawer > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 13px 14px; color: var(--gold); cursor: pointer; font-size: 1rem; font-weight: 850; }
.hazard-profile-detail-drawer > summary span,
.hazard-profile-source-drawer > summary span,
.radiological-reference-drawer > summary span { color: #a9c8d9; font-size: .82rem; font-weight: 500; }
.hazard-profile-detail-drawer[open] > summary { border-bottom: 1px solid #24577c; }
.hazard-profile-detail-drawer .hazard-profile-content-card { min-height: 0 !important; padding: 10px; border: 0; border-radius: 0; background: transparent; }
.hazard-profile-detail-drawer .hazard-profile-content { min-height: 0 !important; align-content: start; }
.hazard-profile-detail-drawer .hazard-source-fact-card { min-height: 0; }

.hazard-profile-limitations { min-height: 0 !important; }
.hazard-profile-source-footer { min-height: 0 !important; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hazard-profile-source-drawer,
.radiological-reference-drawer { min-width: 0; border: 1px solid #356b8d; border-radius: 8px; background: #062239; }
.hazard-profile-source-drawer[open] > summary,
.radiological-reference-drawer[open] > summary { border-bottom: 1px solid #356b8d; }
.hazard-profile-source-drawer .hazard-profile-source-footer { display: grid; gap: 14px; padding: 14px; }
.hazard-profile-source-footer > div { display: grid; gap: 4px; min-width: 0; padding: 10px; border-left: 3px solid #5caed0; background: rgba(12, 48, 74, .54); }
.hazard-profile-source-footer > div > span { color: #a9c8d9; font-size: .8rem; font-weight: 850; }
.hazard-profile-source-footer > div > strong { color: #f7fbfd; font-size: 1rem; overflow-wrap: anywhere; }
.hazard-profile-source-footer > div > small { color: #b9d2df; font-size: .82rem; line-height: 1.4; }
.radiological-reference-footer { padding: 14px; border-bottom: 0; }

@media (max-width: 1080px) {
  .hazard-profile-column-field > div { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .hazard-profile-header-card { grid-template-columns: 54px minmax(0, 1fr); }
  .hazard-profile-emblem { width: 48px; height: 48px; }
  .hazard-profile-operational-grid { grid-template-columns: 1fr; }
  .hazard-profile-column-threat,
  .hazard-profile-column-field,
  .hazard-profile-column-medical { grid-column: auto; }
  .hazard-profile-column-field > div { grid-template-columns: 1fr; }
  .hazard-profile-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hazard-profile-toolbar { grid-template-columns: 1fr auto; }
  .hazard-profile-toolbar > strong { grid-column: 1 / -1; grid-row: 1; }
  .hazard-profile-toolbar-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .hazard-profile-detail-drawer > summary,
  .hazard-profile-source-drawer > summary,
  .radiological-reference-drawer > summary { align-items: flex-start; flex-direction: column; gap: 3px; }
}
@media (max-width: 480px) {
  .hazard-profile-shell { padding: 8px; }
  .hazard-profile-header-card { padding: 12px; }
  .hazard-profile-action-grid { grid-template-columns: 1fr; }
  .hazard-profile-identifiers { grid-template-columns: 1fr; }
}

/* Hazard Profile data-sheet hierarchy: section titles carry the panel identity,
   while field labels provide a quick amber scan path through the values. */
#chemical-id-results .chemical-profile-section-heading,
#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0 0 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(105, 169, 214, 0.42);
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.085em;
  line-height: 1.2;
  text-transform: uppercase;
}

#chemical-id-results .chemical-profile-section-heading > .chemical-profile-icon {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-row {
  min-width: 0;
  gap: 6px;
  padding: 11px 13px 12px;
  border: 1px solid rgba(61, 125, 170, 0.62);
  border-left: 3px solid rgba(var(--gold-rgb), 0.82);
  border-radius: 5px;
  background: rgba(6, 31, 52, 0.74);
  box-shadow: none;
}

#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-field-label {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 850;
  letter-spacing: 0.075em;
  line-height: 1.25;
  text-transform: uppercase;
}

#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-field-label::before {
  content: "";
  display: block;
  flex: 0 0 3px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--gold-surface);
  box-shadow: 0 0 8px rgba(var(--gold-rgb), 0.26);
}

#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-row > strong,
#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-row > .chemical-profile-value-list,
#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-row > .chemical-treatment-columns {
  min-width: 0;
  color: #eef7ff;
  font-size: 0.96rem;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-row > .chemical-profile-value-list {
  gap: 5px;
  margin-top: 1px;
}

#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-value-list li {
  min-width: 0;
  padding: 5px 8px;
  border-left-color: rgba(105, 169, 214, 0.72);
  border-radius: 3px;
  background: rgba(8, 42, 69, 0.74);
  overflow-wrap: anywhere;
}

#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-list-row {
  min-width: 0;
  align-items: start;
  gap: 7px 12px;
  padding: 10px 12px !important;
  border-color: rgba(61, 125, 170, 0.62);
  border-left: 3px solid rgba(var(--gold-rgb), 0.82);
  border-radius: 5px;
  background: rgba(6, 31, 52, 0.74);
}

#chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-list-row > span {
  min-width: 0;
  color: #eef7ff;
  font-size: 0.94rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#chemical-id-results .chemical-profile-medical-guidance-description,
#chemical-id-results .chemical-profile-medical-guidance-warning {
  margin: 0;
  color: #cfe3f2;
  line-height: 1.5;
}

#chemical-id-results .chemical-profile-medical-guidance-warning {
  padding: 8px 10px;
  border-left: 3px solid var(--gold);
  background: rgba(var(--gold-rgb), 0.09);
  color: var(--gold);
}

#chemical-id-results .chemical-profile-medical-link {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  margin-top: 2px;
  padding: 9px 13px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--gold), var(--gold));
  color: #071f36;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.25;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

#chemical-id-results .chemical-profile-medical-link::after {
  content: "↗";
  flex: 0 0 auto;
  font-size: 1rem;
}

#chemical-id-results .chemical-profile-medical-link:hover,
#chemical-id-results .chemical-profile-medical-link:focus-visible {
  background: var(--gold);
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--gold-rgb), 0.22), 0 6px 16px rgba(1, 14, 25, 0.24);
  transform: translateY(-1px);
}

@media (max-width: 700px) {
  #chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-list-row {
    grid-template-columns: minmax(0, 1fr);
  }

  #chemical-id-results .chemical-profile-content[data-active-tab] .chemical-profile-section-heading {
    font-size: 0.9rem;
  }
}

/* Reference-only Hazard ID lookup while an incident has a different chemical. */
.hazard-reference-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid #f2b84b;
  border-left-width: 6px;
  border-radius: 10px;
  background: rgba(242, 184, 75, 0.12);
  color: inherit;
}
.hazard-reference-banner[hidden] { display: none; }
.hazard-reference-banner p { margin: 0; font-weight: 600; line-height: 1.4; }
.hazard-reference-banner button { flex: 0 0 auto; min-height: 44px; }
.hazard-reference-banner .chemical-action-button {
  padding: 0 16px;
  border: 1px solid #f2b84b;
  border-radius: 8px;
  background: #f2b84b;
  color: #111827;
  font-weight: 800;
  cursor: pointer;
}
.hazard-reference-banner .chemical-action-button:hover,
.hazard-reference-banner .chemical-action-button:focus-visible { background: #ffd27a; }
@media (max-width: 560px) {
  .hazard-reference-banner { flex-direction: column; align-items: stretch; }
}
#chemical-id-results .chemical-profile-shell:has(> #hazard-reference-banner:not([hidden])) {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto !important;
  grid-template-areas: "profile-toolbar" "profile-reference" "profile-identity" "profile-workspace" "profile-footer" !important;
}
#chemical-id-results .chemical-profile-shell > #hazard-reference-banner { grid-area: profile-reference; margin: 0; }
#hazard-reference-assign-btn {
  background: #f2b84b;
  color: #1a1203;
  border: 1px solid #f2b84b;
  font-weight: 800;
}
#hazard-reference-assign-btn:hover,
#hazard-reference-assign-btn:focus-visible { background: #ffd07a; }

/* Immediate Threat: agent class leads in capitals, statement follows. */
.hazard-action-ribbon-item.hazard-primary-threat .hazard-primary-threat-statement { font-size: 1.05rem; line-height: 1.5; }
.hazard-action-ribbon-item.hazard-primary-threat .hazard-primary-threat-class {
  color: #ff5a4f;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.hazard-primary-threat-source { display: block; margin-top: 6px; color: #9fb4c4; font-size: 0.78rem; }
.hazard-primary-threat-source a { color: #8fd3ff; }
.hazard-primary-threat-agent-fact { margin-top: 8px !important; font-size: 0.92rem !important; color: #c9d8e4 !important; }

/* CBRNE / Rad profile layout parity with chemical profiles: section tabs sit
   directly under the identity header and switch a single content pane. */
#lookup #hazard-profile-results .hazard-profile-tabs {
  display: grid !important;
  grid-template-columns: repeat(var(--hazard-tab-count, 10), minmax(86px, 1fr)) !important;
  margin: 0 0 10px;
}
#lookup #hazard-profile-results[data-profile-pane="overview"] .hazard-profile-detail-pane { display: none !important; }
#lookup #hazard-profile-results[data-profile-pane="detail"] :is(.hazard-profile-priorities, .hazard-profile-operational-grid, .hazard-profile-limitations, .radiological-profile-panel, .hazard-profile-source-drawer),
#lookup #hazard-profile-results[data-profile-pane="sources"] :is(.hazard-profile-priorities, .hazard-profile-operational-grid, .hazard-profile-limitations, .radiological-profile-panel) { display: none !important; }
#lookup #hazard-profile-results .hazard-profile-detail-pane .hazard-profile-content-card { min-height: 0 !important; padding: 10px; border: 1px solid #24577c; border-radius: 8px; background: #062239; }
#lookup #hazard-profile-results .hazard-profile-detail-pane .hazard-profile-content { min-height: 0 !important; align-content: start; }
#lookup #hazard-profile-results .hazard-profile-detail-pane .hazard-source-fact-card { min-height: 0; }
@media (max-width: 980px) {
  #lookup #hazard-profile-results .hazard-profile-tabs { grid-template-columns: repeat(var(--hazard-tab-count, 10), minmax(110px, 1fr)) !important; overflow-x: auto; }
}
#lookup #hazard-profile-results .hazard-profile-shell { grid-template-columns: minmax(0, 1fr) !important; }
#lookup #hazard-profile-results .hazard-profile-shell > * { grid-column: 1 / -1 !important; grid-row: auto !important; }
#lookup #hazard-profile-results .hazard-profile-tabs { height: auto !important; align-self: start; }
#lookup #hazard-profile-results .hazard-profile-detail-pane .hazard-profile-content {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 10px;
}
#lookup #hazard-profile-results .hazard-profile-detail-pane .hazard-source-fact-card {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #315f82;
  border-left: 3px solid var(--gold);
  border-radius: 8px;
}
#lookup #hazard-profile-results .hazard-profile-detail-pane .hazard-source-fact-card > * { margin: 0; }
#lookup #hazard-profile-results .hazard-profile-detail-pane .hazard-fact-status {
  justify-self: start;
  padding: 1px 8px;
  border: 1px solid #4b7aa0;
  border-radius: 999px;
  color: #dceffc;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
@media (max-width: 760px) {
  #lookup #hazard-profile-results .hazard-profile-detail-pane .hazard-profile-content { grid-template-columns: 1fr; }
}
#lookup #hazard-profile-results .hazard-erg-distance-lead { margin: 0 0 6px; color: #fff; font-size: 1.02rem; font-weight: 800; line-height: 1.4; }
#lookup #hazard-profile-results .hazard-erg-distance-lead strong { color: var(--gold); }
#lookup #hazard-profile-results .hazard-erg-distance-lead a { font-size: .8rem; }

/* Hazard Profile identity boxes: ONE shared color map for every profile
   (Chemical, CBRNE/CWA, Radiological). Same field = same color everywhere.
   Follows ERG book page colors: yellow = ID numbers, blue = names,
   orange = guides, green = isolation/protective-action tables. */
.hazard-profile-identifiers { gap: 10px; }
.hazard-profile-fact-tile,
#chemical-id-results .chemical-profile-meta-item {
  --fact-accent: #5b8fb3; --fact-title: #b9d6e8;
  position: relative;
  border: 1.5px solid color-mix(in srgb, var(--fact-accent) 70%, transparent) !important;
  border-top: 4px solid var(--fact-accent) !important;
  border-radius: 7px !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--fact-accent) 14%, #06223a) 0%, rgba(4, 25, 43, .85) 70%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.hazard-profile-fact-tile { gap: 6px; padding: 12px 12px 11px; align-content: start; }
.hazard-profile-fact-tile .hazard-profile-fact-label { color: var(--fact-title); font-size: .8rem; font-weight: 850; letter-spacing: .02em; line-height: 1.2; }
.hazard-profile-fact-tile .hazard-profile-fact-value { overflow-wrap: anywhere; }
#chemical-id-results .chemical-profile-meta-item .chemical-profile-meta-title { color: var(--fact-title) !important; text-transform: none !important; letter-spacing: .02em !important; }
#chemical-id-results .chemical-profile-meta-item[data-accent="un"] .chemical-profile-meta-value,
#chemical-id-results .chemical-profile-meta-item[data-accent="erg-guide"] .chemical-profile-meta-value,
#chemical-id-results .chemical-profile-meta-item[data-accent="hazard"] .chemical-profile-meta-value { color: var(--fact-title) !important; }

:is(.hazard-profile-fact-tile, #chemical-id-results .chemical-profile-meta-item)[data-accent="un"]            { --fact-accent: #eab308; --fact-title: #fde047; } /* UN/NA Number - ERG yellow pages */
:is(.hazard-profile-fact-tile, #chemical-id-results .chemical-profile-meta-item)[data-accent="name"]          { --fact-accent: #3b82f6; --fact-title: #93c5fd; } /* Names - ERG blue pages */
:is(.hazard-profile-fact-tile, #chemical-id-results .chemical-profile-meta-item)[data-accent="erg-guide"]     { --fact-accent: #f97316; --fact-title: #fdba74; } /* ERG Guide - ERG orange pages */
:is(.hazard-profile-fact-tile, #chemical-id-results .chemical-profile-meta-item)[data-accent="erg-isolation"] { --fact-accent: #22c55e; --fact-title: #86efac; } /* ERG Isolation - ERG green pages */
:is(.hazard-profile-fact-tile, #chemical-id-results .chemical-profile-meta-item)[data-accent="cas"]           { --fact-accent: #14b8a6; --fact-title: #5eead4; } /* CAS Number */
:is(.hazard-profile-fact-tile, #chemical-id-results .chemical-profile-meta-item)[data-accent="designation"]   { --fact-accent: #d946ef; --fact-title: #f0abfc; } /* Agent Code, Isotope Symbol, Mass Number */
:is(.hazard-profile-fact-tile, #chemical-id-results .chemical-profile-meta-item)[data-accent="treaty"]        { --fact-accent: #8b5cf6; --fact-title: #c4b5fd; } /* CWC Classification */
:is(.hazard-profile-fact-tile, #chemical-id-results .chemical-profile-meta-item)[data-accent="hazard"]        { --fact-accent: #ef4444; --fact-title: #fca5a5; } /* Hazard Class */
