*, *::before, *::after { box-sizing: border-box; }
    :root {
      --header-h: 84px;
      --left-w: 360px;
      --right-w: 420px;
      --primary: #4a7c3f;
      --primary-dark: #35652d;
      --secondary: #0d3d4f;
      --accent: #c8d84b;
      --bg: #f4f7f5;
      --panel: #ffffff;
      --soft: #eef4ef;
      --line: #dfe7e2;
      --text: #1f2a33;
      --muted: #66737d;
      --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    }
    html, body {
      height: 100%; margin: 0; overflow: hidden; background: var(--bg);
      color: var(--text); font-family: var(--font);
    }
    button, input { font: inherit; }
#app { position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: var(--right-w) 1fr var(--left-w); min-height: 0; }
    /* Swapped layout: methods/details on the left, search/lab info on the right */
    #detailsPanel { grid-column: 1; grid-row: 1; }
    #mapWrap { grid-column: 2; grid-row: 1; }
    #leftPanel { grid-column: 3; grid-row: 1; }
    #leftPanel, #detailsPanel { background: var(--panel); min-height: 0; overflow: hidden; display: flex; flex-direction: column; z-index: 10; }
    #leftPanel { border-left: 1px solid var(--line); box-shadow: -4px 0 18px rgba(0,0,0,.06); }
    #detailsPanel { border-right: 1px solid var(--line); box-shadow: 4px 0 18px rgba(0,0,0,.06); }
    .panelHead { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg,#fff,var(--soft)); }
h1, h2, h3 { margin: 0; }
    .panelTitle { font-size: 18px; color: var(--secondary); }
    .panelSubtitle { margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
    #searchWrap { padding: 12px 14px; border-bottom: 1px solid var(--line); }
    #statusRow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
    #labCount { font-size: 12px; color: var(--primary); font-weight: 800; }
    #clearBtn { border: 1px solid var(--line); background: #fff; color: var(--secondary); border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 800; cursor: pointer; }
    #clearBtn:hover { background: var(--soft); }
    #filters { border-bottom: 1px solid var(--line); flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
    #filters > summary { list-style: none; }
    #filters > summary::-webkit-details-marker { display: none; }
    .facetTitle { display: flex; justify-content: space-between; align-items: center; color: #fff; background: var(--primary-dark); font-size: 13px; font-weight: 850; padding: 12px 14px; cursor: pointer; }
    .facetTitle::after { content: "▸"; font-size: 13px; transition: transform .15s; }
    #filters[open] .facetTitle::after { transform: rotate(90deg); }
    .facetActions { display: flex; justify-content: flex-end; gap: 10px; padding: 10px 14px 0; }
    .facetActions button { border: none; background: transparent; color: var(--primary-dark); font-size: 11px; font-weight: 850; cursor: pointer; }
    #filterList { padding: 10px 14px 8px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
    .facetGroup { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
    .facetGroup summary { cursor: pointer; padding: 9px 11px; font-weight: 800; font-size: 12px; color: #fff; background: var(--primary); }
    .facetGroup summary:hover { background: var(--primary-dark); }
    .facetItem { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 12px; }
    .facetItem label { display: flex; align-items: center; gap: 7px; flex: 1; cursor: pointer; }
    .facetCount { color: var(--muted); background: var(--soft); border-radius: 999px; min-width: 28px; text-align: center; padding: 1px 7px; font-size: 11px; font-weight: 800; }
    #labList { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 10px; }
    .labCard { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 12px; margin-bottom: 10px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
    .labCard:hover { border-color: var(--line); box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-1px); }
    .labCard.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,124,63,.14); }
    .labName { font-size: 13.5px; font-weight: 850; color: var(--secondary); line-height: 1.25; margin-bottom: 5px; }
    .labMeta { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
    .chipRow { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
    .chip { background: var(--soft); border: 1px solid var(--line); color: var(--primary); border-radius: 999px; padding: 2px 7px; font-size: 10.5px; font-weight: 800; }
    .viewDetails { margin-top: 10px; display: inline-block; color: var(--primary-dark); font-weight: 850; font-size: 11.5px; }
    #mapWrap { position: relative; min-width: 0; background: #e6ecef; }
    #viewDiv { position: absolute; inset: 0; }
    #detailsContent { flex: 1; overflow: auto; padding: 16px; }
    .emptyState { margin: 18px 0; padding: 18px; background: var(--soft); border: 1px dashed #c8d6cd; border-radius: 16px; color: var(--muted); line-height: 1.55; font-size: 13px; }
    .detailHero { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 14px; background: var(--panel); }
    .detailHero::before { content: ""; display: block; height: 4px; background: var(--primary); }
    .detailHeroBody { padding: 14px; }
    .detailName { color: var(--secondary); font-size: 18px; font-weight: 850; line-height: 1.25; }
    .detailMeta { color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 8px; }
    .detailActions { display: flex; gap: 8px; padding: 0 14px 14px; }
    .primaryBtn, .secondaryBtn { border-radius: 10px; padding: 9px 11px; font-size: 12px; font-weight: 850; cursor: pointer; }
    .primaryBtn { border: none; background: var(--primary); color: #fff; }
    .primaryBtn:hover { background: var(--primary-dark); }
    .secondaryBtn { border: 1px solid var(--line); background: #fff; color: var(--secondary); }
    .secondaryBtn:hover { background: var(--soft); }
    .section { margin-top: 14px; }
    .sectionHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
    .sectionHead h3 { font-size: 14px; color: var(--secondary); }
    .searchHint { font-size: 11px; color: var(--muted); line-height: 1.35; margin: -4px 0 10px; }
    #methodSearch { width: 100%; border: 1px solid #cfd9d2; border-radius: 11px; padding: 10px 11px; font-size: 13px; margin-bottom: 10px; }
    .methodGroup { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 10px; background: var(--panel); }
    .methodGroup summary { padding: 10px 12px; cursor: pointer; background: var(--soft); color: var(--secondary); font-weight: 850; font-size: 13px; }
    .methodCard { padding: 11px 12px; border-top: 1px solid var(--line); }
    .methodTitle { font-weight: 850; color: var(--text); font-size: 13px; margin-bottom: 6px; }
    .methodGrid { display: grid; grid-template-columns: 110px 1fr; gap: 4px 8px; font-size: 11.5px; line-height: 1.45; }
    .methodGrid dt { color: var(--muted); font-weight: 800; }
    .methodGrid dd { margin: 0; color: var(--text); word-break: break-word; }
    .spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #d5ddd7; border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; vertical-align: -2px; margin-right: 5px; }
    @keyframes spin { to { transform: rotate(360deg); } }
    .modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
    .modal.open { display: flex; }
    .modalBox { width: min(760px, 96vw); max-height: 86vh; overflow: hidden; background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.32); display: flex; flex-direction: column; }
    .modalHead { background: var(--secondary); color: #fff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
    .modalHead button { border: none; background: transparent; color: #fff; font-size: 24px; cursor: pointer; }
    .modalBody { padding: 18px; overflow: auto; font-size: 13px; line-height: 1.6; }
    .modalBody h4 { color: var(--secondary); margin: 0 0 8px; }
    @media (max-width: 1100px) {
      :root { --left-w: 320px; --right-w: 380px; }
    }
    @media (max-width: 850px) {
      html, body { overflow: auto; }
      #hdr { position: sticky; top: 0; }
      #app { position: static; display: block; height: auto; }
      #leftPanel, #detailsPanel { min-height: auto; max-height: none; border: none; box-shadow: none; }
      #filters { max-height: 230px; flex: none; }
      #labList, #labList:not(:empty) { max-height: 45vh; flex: none; }
      #mapWrap { height: 42vh; min-height: 300px; }
      #detailsContent { max-height: none; }
}
  

    /* Initial header/widget UI restored */
    #hdr {
      height: var(--header-h); min-height: var(--header-h);
      position: fixed; inset: 0 0 auto 0; z-index: 50;
      display: flex; align-items: center; gap: 10px;
      padding: 4px 12px; background: var(--secondary); color: #fff;
      box-shadow: 0 3px 16px rgba(0,0,0,.22);
    }
    #logo {     display: flex;
    align-items: center;}
    #logo img { height: 5rem; width: auto; max-width: 100%; object-fit: contain; }
    #app-title { color: #fff; font-size: 16px; font-weight: 650; flex: 1; min-width: 180px; line-height: 1.2; }
    .hbtn {
      display: flex; flex-direction: column; align-items: center; gap: 2px;
      background: none; border: none; cursor: pointer; color: #fff;
      font-size: 11px; padding: 6px 8px; border-radius: 6px;
      transition: background .15s; flex-shrink: 0;
    }
    .hbtn:hover { background: rgba(255,255,255,.12); }
    .hbtn svg { width: 20px; height: 20px; fill: var(--accent); }

    .hdr-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; }
    .hdr-overlay.is-open { display: block; }
    #basemapPanel { display: none; position: fixed; top: calc(var(--header-h) + 6px); right: 12px; width: 300px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.22); z-index: 110; overflow: hidden; }
    #basemapPanel.is-open { display: block; }
    .hdr-dropdown-head, .hdr-modal-head { display: flex; align-items: center; justify-content: space-between; background: var(--secondary); padding: 11px 14px; }
    .hdr-dropdown-title, .hdr-modal-title { font-size: 13px; font-weight: 700; color: #fff; }
    .hdr-dropdown-close, .hdr-modal-close { background: none; border: none; color: rgba(255,255,255,.82); font-size: 18px; line-height: 1; padding: 2px 7px; border-radius: 4px; cursor: pointer; }
    .hdr-dropdown-close:hover, .hdr-modal-close:hover { background: rgba(255,255,255,.18); color: #fff; }
    #basemapGalleryContainer { padding: 10px; max-height: 340px; overflow-y: auto; }
    .hdr-modal { display: none; position: fixed; inset: 0; z-index: 110; align-items: center; justify-content: center; padding: 16px; }
    .hdr-modal.is-open { display: flex; }
    .hdr-modal-box { background: #fff; border-radius: 12px; box-shadow: 0 12px 48px rgba(0,0,0,.28); width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 60px); display: flex; flex-direction: column; overflow: hidden; }
    .hdr-modal-body { overflow-y: auto; padding: 18px 20px; }
    .share-intro { font-size: 13px; color: #616775; margin-bottom: 16px; }
    .share-btns { display: flex; gap: 12px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
    .share-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: var(--secondary); font-size: 12px; font-weight: 600; min-width: 86px; background: var(--panel); }
    .share-btn:hover { background: var(--soft); border-color: var(--line); }
    .share-url-row { display: flex; gap: 8px; align-items: center; }
    .share-url-input { flex: 1; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 12px; color: var(--muted); background: var(--soft); outline: none; }
    .share-copy-btn { height: 36px; padding: 0 14px; border-radius: 8px; background: var(--secondary); border: none; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }
    .share-copied { font-size: 12px; color: var(--primary); min-height: 20px; margin-top: 6px; text-align: center; font-weight: 600; }

/* Results use all remaining vertical space in the search panel. */
#labList:empty {
  display: none;
}

/* Three-mode laboratory search */
.searchTabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.searchTab {
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--secondary);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 800;
  cursor: pointer;
}
.searchTab:hover { border-color: var(--primary); }
.searchTab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.searchTabPanel { min-height: 44px; }
.searchTabPanel[hidden] { display: none !important; }

/* Keep the ArcGIS Lab search boxed. */
#unifiedSearchDiv .esri-search {
  width: 100%;
  border: 1px solid #cfd9d2;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: none;
  background: #fff;
}
#unifiedSearchDiv .esri-search__container,
#unifiedSearchDiv .esri-search__input-container,
#unifiedSearchDiv .esri-search__input,
#unifiedSearchDiv .esri-search__sources-button,
#unifiedSearchDiv .esri-search__submit-button {
  min-height: 42px;
}
#unifiedSearchDiv .esri-search__input {
  font-size: 13px;
}
#unifiedSearchDiv .esri-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* Parameter / Method uses the exact same three-part visual pattern:
   source area | input | search button. */
#capabilitySearchPanel .capabilitySearchRow {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 44px;
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd9d2;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: none;
  box-sizing: border-box;
}
#capabilitySearchPanel .capabilitySearchRow:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.capabilitySearchSource {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-right: 1px solid #d6d6d6;
  background: #fff;
}
.capabilityChevron {
  width: 12px;
  height: 12px;
  border-right: 1.8px solid #6f6f6f;
  border-bottom: 1.8px solid #6f6f6f;
  transform: rotate(45deg) translateY(-2px);
  box-sizing: border-box;
}
#capabilitySearchInput {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: #fff;
  box-shadow: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  -webkit-appearance: none;
  appearance: none;
}
#capabilitySearchInput::-webkit-search-cancel-button { display: none; }
#runCapabilitySearchBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-left: 1px solid #d6d6d6;
  border-radius: 0;
  background: #fff;
  color: #666;
  cursor: pointer;
}
#runCapabilitySearchBtn:hover { background: var(--soft); }
#runCapabilitySearchBtn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
#capabilitySearchStatus { display: none !important; }

#categoryFilterPanel #filters {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  max-height: 330px;
  overflow: auto;
}
#categoryFilterPanel .facetActions { padding: 8px 10px; border-bottom: 1px solid var(--line); }
#categoryFilterPanel #filterList { padding: 8px; }
#categoryFilterPanel .facetGroup:last-child { margin-bottom: 0; }
@media (max-width: 950px) {
  .searchTabs { grid-template-columns: 1fr; }
}

/* Larger, consistent typography for the updated SCDES logo and header. */
#hdr { gap: 14px; padding: 8px 16px; }
#app-title { font-size: 21px; font-weight: 700; }
.hbtn { font-size: 13px; gap: 5px; padding: 7px 9px; }
.hbtn svg { width: 25px; height: 25px; }
.panelTitle { font-size: 22px; }
.panelSubtitle { font-size: 14px; }
.searchTab { font-size: 13px; min-height: 50px; padding: 9px 7px; }
#labCount { font-size: 15px; }
#clearBtn { font-size: 14px; padding: 7px 13px; }
#unifiedSearchDiv .esri-search__input, #capabilitySearchInput { font-size: 15px; }
#unifiedSearchDiv .esri-search__container,
#unifiedSearchDiv .esri-search__input-container,
#unifiedSearchDiv .esri-search__input,
#unifiedSearchDiv .esri-search__sources-button,
#unifiedSearchDiv .esri-search__submit-button { min-height: 48px; }
#capabilitySearchPanel .capabilitySearchRow,
#capabilitySearchInput, #runCapabilitySearchBtn { min-height: 48px; }
.facetActions button, .facetItem { font-size: 14px; }
@media (max-width: 1100px) {
  #hdr { gap: 8px; padding: 6px 10px; }
  #app-title { font-size: 18px; min-width: 130px; }
  .hbtn { font-size: 12px; padding: 5px; }
}
@media (max-width: 850px) {
  #hdr { position: sticky; flex-wrap: wrap; height: auto; min-height: var(--header-h); }
  #logo img { height: 4rem; }
  #app-title { flex: 1; }
  .hbtn { flex: 1; }
  #app { top: auto; }
}

/* Header widget accent and compact CELMapp Help window. */
.hbtn { color: #b9bd33; }
.hbtn svg { fill: #b9bd33; }
.hbtn:hover { background: rgba(185,189,51,.14); }
#infoModal .modalBox { width: min(650px, 94vw); max-height: 82vh; background: var(--secondary); }
#infoModal .modalHead { background: var(--secondary); color: #fff; justify-content: center; position: relative; padding: 14px 42px 8px; text-align: center; }
#infoModal .modalHead strong { font-size: 18px; line-height: 1.25; }
#infoModal .modalHead button { color: #fff; position: absolute; right: 14px; top: 12px; }
#infoModal .modalBody { background: var(--secondary); color: #fff; padding: 12px 26px 20px; font-size: 14px; line-height: 1.45; }
.celmInfo { color: #fff; }
.celmInfoLogo { display: block; width: 210px; max-width: 90%; height: 76px; object-fit: contain; margin: 0 auto 10px; background: transparent; }
.celmInfo h2 { font-size: 18px; line-height: 1.3; margin: 8px 0; color: #fff; }
.celmInfo h3 { font-size: 16px; margin: 14px 0 6px; padding-bottom: 4px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.25); }
.celmInfo p { margin: 6px 0; }
.celmInfo ol, .celmInfo ul { margin: 6px 0; padding-left: 22px; }
.celmInfo li { margin-bottom: 4px; }
.celmConfirm { display: block; margin: 14px 0 0 auto; padding: 9px 24px; background: #b9bd33; color: #0d3d4f; border: 0; border-radius: 6px; font-size: 16px; font-weight: 700; cursor: pointer; }
@media (max-width: 600px) {
  #infoModal .modalBox { width: 96vw; max-height: 88vh; }
  #infoModal .modalBody { padding: 10px 16px 16px; }
  #infoModal .modalHead strong { font-size: 16px; }
}

/* Contact Us: compact layout matching the dark teal Help window */
#infoModal:has(.contactInfo) .modalBox { width: min(510px, 94vw); }
#infoModal:has(.contactInfo) .modalBody { padding: 8px 24px 24px; }
.contactInfo { font-size: 14px; line-height: 1.5; }
.contactIntro { margin: 6px 0 18px; color: #fff; }
.contactItem { padding: 14px 0; border-top: 1px solid rgba(255,255,255,.25); }
.contactItem strong { display: block; font-size: 16px; margin-bottom: 5px; }
.contactItem span { display: block; margin-bottom: 8px; color: #e2ebed; }
.contactItem a { color: #dbe577; font-weight: 700; overflow-wrap: anywhere; }
.contactItem a:hover { color: #fff; }
