/* Shared desktop module presentation. Each module keeps its own layout and controls. */
html.pem-enterprise-ui {
  --pem-module-title-size: 27px;
  --pem-module-description-size: 14px;
  --pem-module-input-height: 40px;
  --pem-module-total-size: 20px;
  --pem-module-total-background: #eef4f8;
  --pem-module-total-border: #d8e5ed;
  --pem-module-table-heading: #f4f7fa;
}

html.pem-enterprise-ui body :is(main, #view, .pem-global-topbar, .topbar) :is(
  h1, h2, [role="heading"][aria-level="1"], label, input, select, textarea, button, th, td
) {
  font-family: var(--pem-font, Inter, "Segoe UI", Roboto, Arial, sans-serif) !important;
}

html.pem-enterprise-ui body :is(main, #view) :is(h1, [role="heading"][aria-level="1"]),
html.pem-enterprise-ui body #mocWorkspace .moc-ui-heading .moc-ui-title,
html.pem-enterprise-ui body .pem-dossier-workspace .pem-dossier-page-heading h1,
html.pem-enterprise-ui body .wp-shell .wp-hero h1 {
  font-size: var(--pem-module-title-size) !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  letter-spacing: -.02em !important;
  color: var(--pem-color-text, #10233f) !important;
}

html.pem-enterprise-ui body :is(
  .pem-release-page-header, .pem-page-header, .pem-record-header,
  .moc-ui-heading, .pem-dossier-page-heading
) p {
  color: var(--pem-color-muted, #52637a) !important;
  font-size: var(--pem-module-description-size) !important;
  line-height: 1.35 !important;
}

html.pem-enterprise-ui body :is(.topbar, .pem-global-topbar) .pem-global-search input {
  min-height: 42px !important;
  height: 42px !important;
  font-size: 14px !important;
  border-radius: 9px !important;
  background-color: #f8fafc !important;
  border-color: var(--pem-color-border, #dbe5ef) !important;
}
html.pem-enterprise-ui body :is(.topbar, .pem-global-topbar) .pem-global-search input:focus {
  background-color: #fff !important;
  border-color: #95c4f1 !important;
}

html.pem-enterprise-ui body :is(
  .pem-record-filter-bar, .pem-filter-bar, .moc-ui-filters, .wp-filters, .pem-record-search
) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select) {
  min-height: var(--pem-module-input-height) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  background-color: #fff !important;
  border: 1px solid #c8d8e9 !important;
  border-radius: 9px !important;
}

html.pem-enterprise-ui body :is(
  .pem-record-filter-bar, .pem-filter-bar, .moc-ui-filters, .wp-filters, .pem-record-search
) label {
  color: #465d77 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

html.pem-enterprise-ui body :is(
  .pem-risk-period-total, .pem-action-period-total, .moc-ui-total, .wp-period-total
),
html.pem-enterprise-ui body #mocWorkspace .moc-ui-total {
  border: 1px solid var(--pem-module-total-border) !important;
  border-radius: 9px !important;
  background: var(--pem-module-total-background) !important;
  color: #244568 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  font-family: var(--pem-font) !important;
}

html.pem-enterprise-ui body :is(
  .pem-risk-period-total, .pem-action-period-total, .moc-ui-total, .wp-period-total
) > strong,
html.pem-enterprise-ui body #mocWorkspace .moc-ui-total > strong {
  color: #0b73e0 !important;
  font-size: var(--pem-module-total-size) !important;
  font-weight: 800 !important;
  font-variant-numeric: tabular-nums;
  line-height: 1 !important;
}

html.pem-enterprise-ui body :is(.pem-summary-metric, .moc-ui-kpi, #permitSummary > button) {
  font-family: var(--pem-font) !important;
  border-color: #dbe5ef !important;
  border-radius: 12px !important;
}
html.pem-enterprise-ui body :is(.pem-summary-metric, .moc-ui-kpi, #permitSummary > button) :is(b,strong) {
  font-size: 26px !important;
  font-weight: 800 !important;
  font-variant-numeric: tabular-nums;
}

html.pem-enterprise-ui body :is(main, #view) :is(.table-wrap, .wp-table, .moc-ui-table-outer) thead th {
  background-color: var(--pem-module-table-heading) !important;
  color: #425a76 !important;
  font-size: 12px !important;
  font-weight: 750 !important;
}

html.pem-enterprise-ui .pem-record-page {
  width: 100%;
  max-width: var(--pem-content-max, 1720px);
  padding-inline: clamp(14px, 1.2vw, 22px);
}
html.pem-enterprise-ui .pem-record-header {
  padding-bottom: 10px;
  border-bottom: 1px solid #dbe5ef;
}
html.pem-enterprise-ui .pem-record-card > label:has(input[type="search"]) {
  max-width: 460px;
  margin-bottom: 10px;
}
html.pem-enterprise-ui .pem-record-card .record-row :first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media(max-width: 900px) {
  html.pem-enterprise-ui { --pem-module-title-size: 23px; }
  html.pem-enterprise-ui body :is(.topbar, .pem-global-topbar) .pem-global-search input,
  html.pem-enterprise-ui body :is(.pem-record-filter-bar, .moc-ui-filters, .wp-filters) input {
    font-size: 16px !important;
  }
}

html.pem-enterprise-ui body :is(.pem-page-header, .pem-release-page-header) .btn.primary,
html.pem-enterprise-ui body #mocWorkspace .moc-ui-new,
html.pem-enterprise-ui body .pem-record-card button[type="submit"] {
  border-radius: 9px !important;
  font-size: 13px !important;
  font-weight: 750 !important;
}
html.pem-enterprise-ui body :is(.pem-page-header, .pem-release-page-header) .btn.primary:hover,
html.pem-enterprise-ui body #mocWorkspace .moc-ui-new:hover,
html.pem-enterprise-ui body .pem-record-card button[type="submit"]:hover {
  background-color: #235b95 !important;
  color: #fff !important;
}

/* Inicio has its own compact executive heading. */
html.pem-enterprise-ui body.pem-root-view-dashboard #view .pem-dashboard-head h1,
html.pem-enterprise-ui body.pem-root-view-dashboard #view .hero h1 {
  font-size: 19px !important;
}

html.pem-enterprise-ui body :is(#mocWorkspace, .wp-shell, .pem-dossier-workspace, .pem-record-page) {
  font-family: var(--pem-font) !important;
}
html.pem-enterprise-ui body .pem-record-card #filterRecords {
  min-height: var(--pem-module-input-height);
  font-size: 13px;
  border-color: #c8d8e9;
  border-radius: 9px;
}
html.pem-enterprise-ui body .pem-record-back {
  flex: 0 0 auto;
  min-height: 34px;
}

/* A standalone module still needs a return control while its toolbar settles. */
html.pem-enterprise-ui:not(.pem-embedded-module) body:not(:has(.pem-nav-geometry-back:not([hidden]))) :is(.pem-record-back, .pem-dossier-back) {
  display: inline-flex !important;
}

@media (max-width: 900px) {
  html.pem-enterprise-ui body #pemSessionLogout {
    min-width: 44px !important;
    min-height: 36px !important;
    flex: 0 0 auto;
  }
}

@media (max-width: 760px) {
  html.pem-enterprise-ui body .app-shell .main > .topbar {
    gap: 8px !important;
    padding-inline: 12px !important;
  }

  html.pem-enterprise-ui body .app-shell .main > .topbar .mobile-brand {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    overflow: hidden;
  }

  html.pem-enterprise-ui body .app-shell .main > .topbar .mobile-brand :is(b, small) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.pem-enterprise-ui body .app-shell .main > .topbar .search.pem-global-search {
    position: relative !important;
    inset: auto !important;
    flex: 1 0 64px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
  }

  html.pem-enterprise-ui body .app-shell .main > .topbar .search.pem-global-search input {
    min-width: 0 !important;
    width: 100% !important;
    padding-inline: 33px 6px !important;
  }

  html.pem-enterprise-ui body .app-shell .main > .topbar .top-actions {
    flex: 0 0 auto;
    gap: 6px;
    margin: 0 !important;
  }
}

/* Record IDs use the Investigation list as the typography reference. */
html.pem-enterprise-ui body table.pem-record-grid,
html.pem-enterprise-ui body table.pem-record-grid :is(th, td) {
  font-family: var(--pem-font, Inter, "Segoe UI", Roboto, Arial, sans-serif) !important;
}

html.pem-enterprise-ui body table.pem-record-grid > tbody > tr > td:first-child:not([colspan]),
html.pem-enterprise-ui body table.pem-record-grid > tbody > tr > td:first-child:not([colspan]) :is(a, button, strong, b, span) {
  font-family: var(--pem-font, Inter, "Segoe UI", Roboto, Arial, sans-serif) !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  font-style: normal !important;
  line-height: var(--pem-record-grid-id-leading, 1.25) !important;
  letter-spacing: normal !important;
}

@media (max-width: 760px) {
  html.pem-enterprise-ui body table.pem-record-grid {
    --pem-record-grid-id-leading: 1.45;
  }
}
