/* A deliberately touch-first layout for phones. */
@media (max-width: 680px) {
  html { scroll-padding-bottom: 104px; }
  body { padding: 0 0 calc(100px + env(safe-area-inset-bottom, 0px)); overflow-x: clip; }
  .page-view { min-width: 0; }

  /* Fixed, labelled bottom navigation with comfortable touch targets. */
  .navigation-dock {
    position: fixed; z-index: 80; left: 10px; right: 10px; bottom: calc(9px + env(safe-area-inset-bottom, 0px)); top: auto;
    transform: none; width: auto; max-width: none; max-height: none; overflow: visible;
    display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; padding: 7px;
    border: 1px solid #49604d; border-radius: 18px; background: color-mix(in srgb, #101c14 94%, transparent);
    box-shadow: 0 14px 44px #0009; backdrop-filter: blur(22px);
  }
  .navigation-dock .header-main-nav { display: contents; }
  .navigation-dock :is(a,button) { grid-row: 1; }
  .navigation-dock [data-view="catalog"] { grid-column: 1; }
  .navigation-dock [data-view="tools"] { grid-column: 2; }
  .navigation-dock #openSuggest { grid-column: 2; }
  .navigation-dock .header-admin-link { grid-column: 3; }
  .navigation-dock [data-view="match"] { grid-column: 3; }
  .navigation-dock:has(.header-admin-link:not([hidden])) { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .navigation-dock:has(.header-admin-link:not([hidden])) [data-view="match"] { grid-column: 4; }
  .navigation-dock:has(a[href="/ki"]:not([hidden])) { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .navigation-dock a[href="/ki"] { grid-column: 3; }
  .navigation-dock:has(a[href="/ki"]:not([hidden])) .header-admin-link { grid-column: 4; }
  .navigation-dock:has(a[href="/ki"]:not([hidden])) [data-view="match"] { grid-column: 5; }
  .navigation-dock :is(a, button) {
    position: relative; display: flex; flex: 1 1 0; flex-direction: column; justify-content: center; gap: 3px;
    width: auto; height: 56px; min-width: 0; border: 0; border-radius: 12px; background: transparent; color: #9eafa2;
  }
  .navigation-dock :is(a, button):hover,.navigation-dock .active { background: transparent; color: var(--accent); }
  .navigation-dock a>span { position: static; width: auto; height: auto; margin-top:1px; overflow: visible; clip-path: none; color: inherit; font-size: 9px; font-weight: 700; line-height:1; white-space: nowrap; }
  .navigation-dock a>svg { box-sizing:content-box; width: 20px; height: 20px; padding:8px; border:1px solid transparent; border-radius:12px; background:#ffffff05; stroke-width: 1.9; transition:background .15s,border-color .15s,color .15s; }
  .navigation-dock a:hover>svg,.navigation-dock a.active>svg { border-color:#d9ee783d; background:#d9ee7814; }
  .navigation-dock .header-action-icon svg { width: 18px; height: 18px; }
  .navigation-dock #openSuggest {
    justify-self: center; flex: 0 0 48px; width: 48px; height: 48px; margin: 0;
    border: 0; border-radius: 15px; background: var(--accent); color: #142015;
    box-shadow: 0 5px 16px #d9ee782b;
  }
  .navigation-dock #openSuggest:hover { background: #e5f59a; color: #142015; }
  .navigation-dock #openSuggest svg { width: 22px; height: 22px; stroke-width: 2.2; }
  .navigation-dock .header-admin-link { gap: 3px; }
  .navigation-dock .header-admin-link>span { font-size: 9px; }
  .navigation-dock .wawican-button { font-size: 10px; }
  .navigation-dock .header-action-icon[hidden],.navigation-dock [hidden] { display: none !important; }

  /* Stock landing: more breathing room and clear, readable cards. */
  .catalog-page { min-height: auto; padding: 34px 16px 24px; }
  .catalog-title { text-align: left; }
  .catalog-title>div { margin: 0; }
  .catalog-title .eyebrow { margin-bottom: 10px; }
  .catalog-title h1 { font-size: clamp(34px, 10vw, 46px); line-height: 1.02; }
  .catalog-search-stage { margin: 23px 0 14px; }
  .catalog-search { min-height: 58px; gap: 10px; padding: 0 14px; border-width: 1px; border-radius: 15px; box-shadow: none; }
  .catalog-search svg { width: 21px; height: 21px; }
  .catalog-search input { height: 56px; font-size: 16px; }
  .catalog-results-head { margin: 18px 0 11px; padding-top: 14px; }
  .catalog-results-head>span { font-size: 13px; }

  /* Use the same compact, icon-first filter bar as tablet layouts. */
  .inventory-filters { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; margin: 0 0 18px; }
  .inventory-filters>.inventory-filter,
  .inventory-filters>#resetInventoryFilters { position: relative; display: grid; flex: 0 0 42px; place-items: center; width: 42px; height: 42px; min-width: 42px; padding: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
  .inventory-filters>.inventory-filter svg { display: block; width: 17px; height: 17px; margin: auto; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .inventory-filters>.inventory-filter .inventory-filter-trigger { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; border-radius: inherit; background: transparent; color: transparent; font-size: 0; }
  .inventory-filters>.inventory-filter::before,
  .inventory-filters>.inventory-filter::after { display: none; }
  .inventory-filters>.inventory-filter.has-selection { border-color: var(--accent); background: var(--panel2); }
  .inventory-filters>.inventory-filter.has-selection svg { stroke: var(--accent); }
  .inventory-filters>.inventory-filter .inventory-filter-menu { z-index: 90; width: min(320px,calc(100vw - 40px)); max-height: min(55dvh,380px); border-radius: 13px; }
  .inventory-filters>#resetInventoryFilters { overflow: hidden; color: transparent; font-size: 0; }
  .inventory-filters>#resetInventoryFilters::before { display: block; content: "↺"; color: var(--muted); font-size: 22px; line-height: 1; }
  .inventory-filters>#resetInventoryFilters:hover::before { color: var(--accent); }
  .catalog-grid { grid-template-columns: 1fr; gap: 16px; }
  .catalog-card {
    position: relative; height: auto; min-height: 0; padding: 20px; overflow: hidden;
    border: 1px solid #3b5c43; border-radius: 18px; background: linear-gradient(150deg,#14251a 0%,#0d1811 100%);
    box-shadow: 0 12px 28px #0004;
  }
  .catalog-card::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: #8fbe9d; content: ""; opacity: .75; }
  .catalog-card:hover { transform: none; }
  .catalog-card-head { min-height: 30px; gap: 9px; padding-bottom: 0; border: 0; }
  .catalog-card-meta { gap: 6px; }
  .catalog-card-meta small { font-size: 9px; letter-spacing: .06em; }
  .catalog-card h3 { margin: 17px 0 19px; font-size: 22px; line-height: 1.18; overflow-wrap: anywhere; }
  .catalog-card .catalog-values { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 19px; }
  .catalog-card .catalog-values b { padding: 13px; border: 1px solid #294735; border-radius: 12px; background: #0d1b12; font-size: 17px; }
  .catalog-card .catalog-values small { margin-top: 3px; font-size: 9px; letter-spacing: .1em; }
  .catalog-profile-row { display: grid; gap: 13px; margin-bottom: 21px; }
  .catalog-profile-row .pills::before { font-size: 8px; letter-spacing: .11em; }
  .catalog-profile-row .pills { display: flex; gap: 7px; }
  .catalog-card .pill { padding: 6px 9px; border-color: #49604d; background: #101d15; color: #cad5cc; font-size: 10px; }
  .catalog-type { margin: 0; padding: 6px 9px; font-size: 9px; }
  .catalog-card .match-this { min-height: 46px; margin-top: 3px; border-color: #d9ee7859; border-radius: 11px; background: linear-gradient(90deg,#d9ee7816,#d9ee7808); color: var(--accent); font-size: 12px; font-weight: 800; }
  .catalog-card-actions { gap: 5px; }
  .catalog-card-actions button { width: 36px; height: 36px; border-radius: 10px; }
  .catalog-card.archived::before { background: #e17c75; }

  /* Match flow and results become compact, stacked task cards. */
  #matchView .finder,#matchView .results { min-height: 0; padding: 29px 16px 20px; }
  #matchView .finder-head,#matchView .results-head { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 16px; }
  #matchView .finder h2,#matchView .results h2 { margin-top: 5px; font-size: 24px; line-height: 1.15; }
  #matchView .finder-head .eyebrow,#matchView .results-head .eyebrow { font-size: 9px; }
  #matchView .data-count { padding: 6px 10px; font-size: 11px; }
  #matchView .searchbox { min-height: 56px; gap: 10px; padding: 0 13px; border-radius: 13px; }
  #matchView .searchbox input { height: 54px; font-size: 16px; }
  #matchView .searchbox>span { font-size: 21px; }
  #matchView .suggestions { max-height: 55dvh; }
  #matchView .suggestion { gap: 8px; padding: 12px 10px; font-size: 12px; }
  #matchView .selected-strain { grid-template-columns: 1fr; gap: 12px; margin-top: 12px; padding: 16px; border-radius: 14px; }
  #matchView .selected-strain h3 { font-size: 21px; }
  #matchView .selected-strain p { font-size: 11px; line-height: 1.5; }
  #matchView .selected-strain button { width: 100%; min-height: 43px; }
  #matchView .results-head { display: grid; }
  #matchView .match-controls { display: grid; grid-template-columns: 1fr; gap: 9px; width: 100%; }
  #matchView .match-filter-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #matchView .thc-range-rule { min-height: 40px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; font-size: 10px; }
  #matchView .results-summary { align-items: flex-start; flex-direction: column; gap: 9px; margin: 0 0 12px; padding: 11px; }
  #matchView .results-summary-count { font-size: 10px; }
  #matchView .results-summary-count strong { font-size: 18px; }
  #matchView .results-summary-count strong span { font-size: 13px; }
  #matchView .results-summary-filters { justify-content: flex-start; gap: 5px; }
  #matchView .summary-chip { min-height: 26px; padding: 4px 8px; font-size: 10px; }
  #matchView .match-list { gap: 10px; }
  #matchView .match-card { grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 5px 10px; padding: 14px; border-radius: 14px; }
  #matchView .rank { grid-column: 1; grid-row: 1; font-size: 9px; text-align: left; letter-spacing: .12em; }
  #matchView .match-main { grid-column: 1/-1; grid-row: 2; min-width: 0; }
  #matchView .match-main small { font-size: 8px; }
  #matchView .match-main h3 { margin: 4px 0; font-size: 19px; overflow-wrap: anywhere; }
  #matchView .match-main>p { margin-bottom: 9px; font-size: 11px; line-height: 1.45; }
  #matchView .reasons { gap: 5px; }
  #matchView .reason { padding: 5px 7px; font-size: 9px; }
  #matchView .score-wrap { grid-column: 1/-1; grid-row: 3; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
  #matchView .score-ring { width: 54px; height: 54px; }
  #matchView .score-ring:before { inset: 5px; }
  #matchView .score-ring b { font-size: 13px; }
  #matchView .details-button { flex: 1; min-height: 40px; border-radius: 9px; font-size: 11px; }
  #matchView .no-matches { padding: 18px; font-size: 12px; }

  /* Tools, wiki, and admin use the same edge-to-edge rhythm. */
  .tools-page .ww-tools,.tools-page .qr-tools-section { padding: 28px 16px; }
  .tools-page .qr-tools-layout { grid-template-columns: 1fr; gap: 12px; padding: 13px; border-radius: 15px; }
  .tools-page .qr-form,.tools-page .qr-output { min-width: 0; padding: 13px; border-radius: 12px; }
  .tools-page .qr-output { min-height: 280px; }
  .tools-page .qr-canvas-wrap { width: min(100%,260px); }
  .wiki-hero,.wiki-content { padding: 32px 16px; }
  .wiki-hero { gap: 20px; }
  .wiki-hero h1 { font-size: 39px; }
  .wiki-hero>div>p { font-size: 14px; }
  .definition-card { padding: 19px; border-radius: 14px; }
  .wiki-notice { padding: 15px; }
  .wiki-tools { gap: 12px; margin: 24px 0; }
  .wiki-tools>label { min-height: 48px; }
  .wiki-filters { gap: 6px; }
  .wiki-filters button { min-height: 38px; padding: 8px 10px; font-size: 10px; }
  .section-heading { gap: 8px; }
  .terpene-card { min-height: 0; padding: 17px; border-radius: 14px; }
  .special-notes,.wiki-sources,.term-guide { margin-top: 38px; padding-top: 30px; }

  .admin-page { padding: 25px 14px 35px; }
  .admin-page-head { align-items: flex-start; flex-direction: row; gap: 10px; }
  .admin-page-head h1 { font-size: 36px; }
  .admin-page-head p { max-width: 210px; font-size: 11px; }
  .admin-head-actions { width: auto; }
  .admin-session { align-items: flex-end; flex-direction: column; gap: 6px; font-size: 9px; }
  .admin-session>span,.admin-session button { padding: 7px 9px; font-size: 9px; }
  .admin-overview { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .admin-overview article,.admin-overview article:first-child,.admin-overview article:last-child,.admin-overview-feedback { min-height: 82px; padding: 11px; border-radius: 11px; }
  .admin-overview span,.admin-overview-feedback>span { font-size: 8px; }
  .admin-overview strong,.admin-overview-feedback>strong { font-size: 22px; }
  .admin-overview-feedback>small { font-size: 9px; }
  .admin-jump-nav { display: flex; gap: 7px; overflow-x: auto; padding: 13px 1px 8px; scroll-snap-type: x mandatory; }
  .admin-jump-nav a { flex: 0 0 142px; scroll-snap-align: start; padding: 9px; border-radius: 10px; }
  .admin-jump-nav a>i { flex-basis: 25px; width: 25px; height: 25px; font-size: 9px; }
  .admin-jump-nav b { font-size: 10px; }
  .admin-jump-nav small { font-size: 9px; }
  .admin-section-heading { gap: 9px; }
  .admin-section-heading h2 { font-size: 23px; }
  .admin-section-heading p { font-size: 11px; }
  .admin-register,.admin-inline { padding: 13px; border-radius: 12px; }
  .admin-list-tools { grid-template-columns: 1fr; }
  .admin-list-tools input,.admin-list-tools select { height: 42px; }
  .admin-strain-row { gap: 8px; padding: 13px 0; }
  .admin-strain-description h3 { font-size: 15px; }
  .admin-row-actions { display: flex; flex-wrap: wrap; }
  .admin-row-actions button { min-height: 34px; padding: 7px 8px; font-size: 10px; }
  .admin-inline .form-grid,.admin-two-columns { grid-template-columns: 1fr; }
  .admin-inline fieldset { padding: 12px; }
  .admin-inline .choice-grid { max-height: 180px; }
  .admin-inline .form-actions { flex-direction: column; }
  .admin-inline .form-actions button { width: 100%; min-height: 42px; }
  .admin-inline .wawican-note-options { grid-template-columns: 1fr; }
  .terpene-audit-status { align-items: flex-start; }
  .terpene-audit-status>span { font-size: 11px; }
  .audit-checks { grid-template-columns: 1fr; }
  #feedbackInbox article { gap: 12px; }

  /* Footer stacks naturally; floating controls sit above the new nav. */
  body>footer { margin: 0; grid-template-columns: 38px minmax(0,1fr); gap: 10px!important; padding: 16px!important; }
  .footer-brand { width: 36px; height: 36px; }
  .footer-help-tools { grid-column: 2; grid-row: 1; justify-self: start; min-width: 0; padding: 0; border: 0; }
  .footer-help-heading { font-size: 8px; }
  .footer-help-links { flex-wrap: wrap; }
  footer .footer-help-links>:is(.footer-qr-link,.footer-wiki-link,.footer-crm-notes,.tutorial-replay) { min-height: 34px; padding: 0 10px; font-size: 10px; }
  .footer-notice { grid-column: 1/-1; grid-row: 2; padding: 11px 0 0; border: 0; border-top: 1px solid var(--line); }
  footer .footer-notice p { display: block; margin-top: 4px!important; font-size: 10px; line-height: 1.55; }
  .scroll-nav { right: 13px; bottom: calc(96px + env(safe-area-inset-bottom,0px)); }
  .scroll-nav button { width: 38px; height: 38px; }
  .tutorial-launcher { bottom: calc(82px + env(safe-area-inset-bottom,0px)); }
}

@media (max-width: 370px) {
  .navigation-dock { left: 6px; right: 6px; gap: 1px; padding: 5px; }
  .navigation-dock :is(a,button) { height: 52px; }
  .navigation-dock #openSuggest { flex-basis: 44px; width: 44px; height: 44px; }
  .navigation-dock a>span { font-size: 9px; }
  .catalog-card { padding: 13px; }
  .catalog-card h3 { font-size: 18px; }
}

/* Keep the filter icon strip aligned to the full search-field width on tablet and mobile. */
@media (max-width: 1580px) {
  .inventory-filters { display: flex; width: 100%; flex-wrap: nowrap; justify-content: space-between; gap: clamp(4px,1vw,8px); }
  .inventory-filters > .inventory-filter,
  .inventory-filters > #resetInventoryFilters { flex: 1 1 0; width: auto; min-width: 0; max-width: none; }
}

@media (max-width: 680px) {
  .inventory-filters { justify-content: space-between; }
  .inventory-filters > .inventory-filter,
  .inventory-filters > #resetInventoryFilters { height: 42px; min-height: 42px; }
}

/* Main-page filters stay explicit and easy to scan on every screen size. */
@media (min-width: 681px) and (max-width: 1580px) {
  .inventory-filters { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 32px; }
  .inventory-filters>.inventory-filter { display: flex; flex: none; width: 100%; height: 54px; min-width: 0; padding: 0 14px; }
  .inventory-filters>.inventory-filter { justify-content: flex-start; }
  .inventory-filters>.inventory-filter .inventory-filter-trigger { position: static; inset: auto; z-index: auto; width: auto; color: var(--text); font-size: 12px; }
  .inventory-filters>.inventory-filter::after { display: block; }
  .inventory-filters>#resetInventoryFilters { overflow: visible; color: var(--muted); font-size: 12px; }
  .inventory-filters>#resetInventoryFilters::before { display: none; }
}

@media (min-width: 681px) {
  .inventory-filters:not([hidden]) { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 20px; }
  .inventory-filters:not([hidden])>.inventory-filter { height: 56px; }
}

@media (max-width: 680px) {
  .inventory-filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 22px; }
  .inventory-filters>.inventory-filter { display: flex; flex: none; width: 100%; height: 48px; min-width: 0; padding: 0 11px; }
  .inventory-filters>.inventory-filter { justify-content: flex-start; }
  .inventory-filters>.inventory-filter .inventory-filter-trigger { position: static; inset: auto; z-index: auto; width: auto; color: var(--text); font-size: 11px; }
  .inventory-filters>.inventory-filter::after { display: block; }
  .mega-filter-head { flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 2px 2px 14px; }
  .mega-filter-head>div:first-child { flex: 1 0 100%; }
  .mega-filter-head strong { font-size: 17px; }
  .mega-filter-actions { width: 100%; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
}

@media (max-width: 680px) {
  .catalog-filter-toggle { width: 42px; height: 42px; margin-left: 0; border-radius: 11px; }
  .catalog-filter-toggle svg { width: 19px; height: 19px; }
  .inventory-filter-count { top: -6px; right: -6px; min-width: 18px; height: 18px; font-size: 9px; }
  .inventory-filters:not([hidden]) { margin-top: 4px; padding: 12px; border-radius: 15px; }
}

/* In admin mode, move the global navigation from the left rail to a compact top bar. */
@media (min-width: 701px) {
  body:has(#adminView:not([hidden])) { padding-left: 0; padding-right: 0; }
  body:has(#adminView:not([hidden])) .navigation-dock {
    top: 12px; right: auto; left: 50%; transform: translateX(-50%);
    flex-direction: row; align-items: center; gap: 7px; width: auto;
    max-width: calc(100vw - 32px); max-height: none; overflow: visible;
    padding: 7px 9px; border-radius: 999px;
  }
  body:has(#adminView:not([hidden])) .navigation-dock .header-main-nav {
    flex-direction: row; align-items: center; gap: 7px;
  }
  body:has(#adminView:not([hidden])) .admin-page { width: 100%; max-width: none; padding: 86px 12px 90px; }
  body:has(#adminView:not([hidden])) .admin-page-head { width: 100%; align-items: flex-start; justify-content: space-between; }
  body:has(#adminView:not([hidden])) .admin-head-actions { margin-left: auto; }
  body:has(#adminView:not([hidden])) .admin-sidebar { top: 66px; margin-top: -14px; }
  body:has(#adminView:not([hidden])) .admin-head-actions { align-self: flex-start; }
  body:has(#adminView:not([hidden])) .admin-session { align-items: flex-start; }
  body:has(#adminView:not([hidden])) #admin-data .admin-data-layout { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 700px) {
  button,a,[aria-hidden="true"]{font-variant-emoji:text}
  #adminView .admin-jump-nav a { min-height: 42px; }
  #adminView .admin-jump-nav a>span { min-width: 0; }
  #adminView .admin-jump-nav b { display: block; line-height: 1.15; }
}

/* The admin workspace owns its scroll area so the browser page stays still. */
body:has(#adminView:not([hidden])) { display: block; width: 100%; height: 100dvh; min-height: 0; overflow: hidden; padding: 0; }
body:has(#adminView:not([hidden])) #adminView { display: block; width: 100%; height: 100dvh; min-height: 0; max-height: 100dvh; margin: 0; overflow: hidden; flex: none; }
body:has(#adminView:not([hidden]))>footer { display: none; }

@media (min-width: 701px) {
  body:has(#adminView:not([hidden])) .admin-page { box-sizing: border-box; display: flex; width: 100%; height: 100%; min-height: 0; flex-direction: column; overflow: hidden; padding-bottom: 12px; }
  body:has(#adminView:not([hidden])) .admin-page-head { flex: 0 0 auto; padding-bottom: 12px; }
  body:has(#adminView:not([hidden])) .admin-workspace { flex: 1 1 auto; min-height: 0; align-items: stretch; overflow: hidden; }
  body:has(#adminView:not([hidden])) .admin-sidebar { position: relative; top: auto; min-height: 0; max-height: none; margin-top: 0; overflow-y: auto; overscroll-behavior: contain; }
  body:has(#adminView:not([hidden])) .admin-workspace-content { height: 100%; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
}

@media (max-width: 700px) {
  body:has(#adminView:not([hidden])) .admin-page { box-sizing: border-box; display: flex; width: 100%; height: 100%; min-height: 0; flex-direction: column; overflow: hidden; padding: 20px 12px calc(82px + env(safe-area-inset-bottom,0px)); }
  body:has(#adminView:not([hidden])) .admin-page-head { flex: 0 0 auto; padding-bottom: 10px; }
  body:has(#adminView:not([hidden])) .admin-workspace { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  body:has(#adminView:not([hidden])) .admin-sidebar { flex: 0 1 auto; min-height: 0; max-height: 36dvh; overflow-y: auto; overscroll-behavior: contain; }
  body:has(#adminView:not([hidden])) .admin-workspace-content { flex: 1 1 auto; width: 100%; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
}

/* Keep the strain search list compact without nesting a second scroll area. */
#adminView #admin-data .admin-register { max-height: none; overflow: visible; }
#adminView #adminStrainList { max-height: none; overflow: visible; padding-right: 0; scrollbar-gutter: auto; }

/* Lay out the strain editor as a compact two-column form. */
#adminView #admin-create #strainForm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 9px 14px; }
#adminView #admin-create #strainForm > .form-grid { display: contents; }
#adminView #admin-create #strainForm > fieldset,
#adminView #admin-create #strainForm > .form-actions,
#adminView #admin-create #strainForm > #adminSaveStatus { grid-column: 1 / -1; }
#adminView #admin-create #strainForm > fieldset { padding: 10px 12px; }
#adminView #admin-create #strainForm > fieldset .choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); max-height: none; overflow: visible; gap: 5px; }
#adminView #admin-create #strainForm > fieldset .choice span { padding: 6px 8px; font-size: 10px; }
#adminView #admin-create #strainForm label { gap: 5px; font-size: 11px; }
#adminView #admin-create #strainForm input,
#adminView #admin-create #strainForm select { height: 38px; }
#adminView #admin-create #strainForm .derived-flavors { gap: 7px; margin-top: 8px; padding: 9px 11px; }
#adminView #admin-create #strainForm .form-actions { grid-column: 1 / -1; margin-top: 0; }
@media (max-width: 520px) {
  #adminView #admin-create #strainForm { grid-template-columns: minmax(0, 1fr); }
  #adminView #admin-create #strainForm > fieldset,
  #adminView #admin-create #strainForm > .form-actions,
  #adminView #admin-create #strainForm > #adminSaveStatus { grid-column: 1; }
}

/* Remove the unintended separator lines beneath selection rows. */
#adminView .admin-section-heading #analyticsUpdatedAt { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }

@media (prefers-reduced-motion: reduce) {
  .catalog-card,.navigation-dock :is(a,button) { transition: none!important; }
}
