/* Shared sizing for pages that use different shells and component styles. */
html {
  --xh-page-scale: .85;
  zoom: var(--xh-page-scale);
  --xh-layout-vw: calc(1vw / var(--xh-page-scale));
  --xh-layout-vh: calc(1vh / var(--xh-page-scale));
  --xh-layout-svh: calc(1svh / var(--xh-page-scale));
  --xh-layout-dvh: calc(1dvh / var(--xh-page-scale));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* The parent console already scales the embedded skill manager. */
html:has(body.internalSkillsEmbedded) {
  --xh-page-scale: 1;
}

:where(body > main, .consoleMain, .tableWrap) {
  min-inline-size: 0;
}

:where(main img, main video, .modal img) {
  max-inline-size: 100%;
}

:where(pre, .tableWrap) {
  max-inline-size: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

:where(input, select, textarea) {
  min-inline-size: 0;
  max-inline-size: 100%;
}

.adminResponsive .homeSettingsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--home-settings-min, 260px)), 1fr));
  gap: clamp(16px, 3vw, 32px);
  align-items: start;
}

.adminResponsive .homeSettingsGrid > * { min-inline-size: 0; }
.adminResponsive .homeNoticeSettings { --home-settings-min: 440px; }
.adminResponsive .communitySettings { --home-settings-min: 320px; }
.adminResponsive .homeSettingsSave { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-block-start: 22px; }
.adminResponsive .homeSettingsSave .status { overflow-wrap: anywhere; }
.adminResponsive #homeQrPreview { max-width: min(100%, 260px) !important; }

@media (min-width: 981px) {
  .adminResponsive .modelManageCard .tableWrap { overflow-x: auto; }
  .adminResponsive .modelManageCard .dljModelDirectoryReadable { min-width: 850px !important; }
}

.pluginReleasePage > main,
.pluginReleasePage > header {
  width: min(100%, 48rem);
  margin-inline: auto;
  padding: clamp(16px, 4vw, 28px);
}

.pluginReleasePage > main { display: block; padding-block-start: 0; }
.pluginReleasePage > main > section {
  padding: clamp(16px, 4vw, 24px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.pluginReleasePage > main label:first-child { margin-top: 0; }
.pluginReleasePage > header p { margin-block-end: 0; }

@media (max-width: 980px) {
  .docsTop {
    position: static;
    flex-wrap: wrap;
    gap: 6px 16px;
    height: auto;
    min-height: 56px;
    padding-block: 8px;
  }
  .docsTop .docsNav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 16px;
    width: 100%;
    height: auto;
    order: 2;
  }
  .docsTop .docsNav a { height: auto; min-height: 36px; }
  .docsTop .docsTopActions { flex-wrap: wrap; }
  .docsTop .docsTopActions .btn:first-child { display: inline-flex; }
  .docsTop .docsTopActions .btn { min-height: 36px; }
  .docsMain .baseBox code { overflow-wrap: anywhere; }
}

@media (max-width: 760px) {
  body:not(.userConsoleV3, .adminResponsive) > .topbar {
    flex-wrap: wrap;
    gap: 8px 14px;
    height: auto;
    min-height: 56px;
    padding: 10px 14px;
  }
  body:not(.userConsoleV3, .adminResponsive) > .topbar > .nav {
    flex-wrap: wrap;
    gap: 4px 12px;
    min-width: 0;
  }
  body:not(.userConsoleV3, .adminResponsive) > .topbar > .nav > a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
  }

  .unitPricesPage > header { flex-wrap: wrap; align-items: flex-start; }
  .unitPricesPage > header .hint { order: 2; flex-basis: 100%; overflow-wrap: anywhere; }
  .unitPricesPage > main { grid-template-columns: minmax(0, 1fr); }
  .unitPricesPage details pre { overflow-wrap: anywhere; }
}

@media (max-width: 640px) {
  :is(.toolbar, .pageTitle, .filters, .pager, .rowActions, .opsHeading) {
    flex-wrap: wrap;
  }

  :is(.row2, .row3) { grid-template-columns: minmax(0, 1fr); }
  :is(.row2, .row3, .grid2, .formgrid, .runGrid) > * { min-width: 0; }

  :is(input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=hidden]), select, textarea) {
    font-size: max(16px, 1rem);
  }

  .adminResponsive .homeSettingsGrid .input { width: 100%; }
  .adminResponsive .dljNoticeRow { grid-template-columns: minmax(0, 1fr); }

  .caseRow { grid-template-columns: minmax(0, 1fr) minmax(0, .85fr) auto; }
  .editor .steps button { min-height: 42px; }
  .pluginReleasePage #publish { min-height: 44px; max-width: 100%; }
}

@media (max-height: 500px) {
  /* In short windows, the form can scroll its actions into view. */
  .modal > .modalCard .modalFooter,
  .modal > .modalCard .modelQuickActions { position: static !important; }
  .modal > .drawerCard { max-height: calc(100 * var(--xh-layout-dvh)); }
}
