/**
 * Critical dashboard fixes — inline-loaded after assets/css/frontend.css
 * (see MLS_Frontend_Router::enqueue_assets()).
 *
 * WHY `!important` IS USED HERE, DELIBERATELY:
 * This stylesheet exists specifically to keep a handful of structural,
 * accessibility- and data-integrity-critical elements (viewport-fixed
 * popovers, the mobile one-record/one-card table layout, and the
 * add/view pane toggle in the role/user manager) correct no matter what
 * the active WordPress theme's own CSS does. Theme stylesheets are
 * arbitrary, unversioned, and load in an order we don't control, so
 * normal specificity is not a reliable guarantee against them — a theme
 * rule as unspecific as `table { display: table }` can otherwise break
 * the mobile card layout. `!important` here is a deliberate compatibility
 * boundary, not a shortcut around fixing something properly upstream.
 *
 * That said, this file grew for several plugin versions by appending a
 * new dated block for each new theme-conflict report rather than editing
 * the existing rule for the same element, which is what produced the
 * scattered, easy-to-duplicate structure this comment is now fixing:
 * duplicate declarations have been merged (see history below), and every
 * remaining block is labelled with what it targets and why it is
 * separate from its neighbours, so a future fix edits the right block
 * instead of appending another one.
 *
 * - v1.10.7 / v1.8.0: base mobile one-record/one-card layout for
 *   `.mls-mobile-compact-table` (two originally-separate patches for the
 *   legacy `.mls-server-mobile-row` markup and the current
 *   `.mls-server-mobile-card-row` markup; both markups can still be
 *   emitted server-side depending on template, so both are kept, but the
 *   container rules they shared have been de-duplicated below).
 * - v1.8.0 (cross-theme hardening): the same card layout re-asserted
 *   under `body.mls-installed-app` / `body.mls-pwa-app-shell` /
 *   `body.mls-ui-skin` specifically, because at least one theme's
 *   higher-specificity table rules were only reachable in those body
 *   contexts. Left intact and unmerged with the base rule on purpose:
 *   collapsing it would lose the extra specificity that made it
 *   necessary in the first place.
 * - v1.8.2: the authoritative `[data-mls-server-mobile-cards="1"]`
 *   desktop/mobile row-visibility switch.
 * - v1.8.7: desktop-viewport placement for the notification popover —
 *   merged into the main notification-popover rule below instead of
 *   living as a second, later block for the same element.
 */

/* Help tooltip and notification popover markup render `[hidden]` by
   default; both then upgrade to a fixed-position portal. */
.mls-help-tooltip-portal[hidden],.mls-dashboard-notification-popover.is-portal[hidden]{display:none!important}

/* Help tooltip: fixed-position portal, positioned via CSS custom
   properties set from JS (--mls-help-left/--mls-help-top/--mls-help-width). */
.mls-help-tooltip-portal{
  position:fixed!important;left:var(--mls-help-left,12px)!important;top:var(--mls-help-top,12px)!important;
  width:var(--mls-help-width,260px)!important;min-width:0!important;max-width:calc(100vw - 20px)!important;
  max-height:min(44vh,340px)!important;overflow:auto!important;margin:0!important;padding:10px 12px!important;
  border:1px solid color-mix(in srgb,var(--mls-primary,#d7a928) 32%,#364152)!important;border-radius:11px!important;
  background:#0b0f14!important;color:#f7edd8!important;-webkit-text-fill-color:#f7edd8!important;
  box-shadow:0 18px 44px rgba(0,0,0,.48)!important;font-size:11px!important;font-weight:600!important;line-height:1.5!important;
  text-align:left!important;white-space:normal!important;overflow-wrap:anywhere!important;word-break:normal!important;
  opacity:0!important;visibility:hidden!important;pointer-events:none!important;transform:none!important;z-index:2147483000!important;
}
.mls-help-tooltip-portal.is-visible{opacity:1!important;visibility:visible!important;pointer-events:auto!important}
.mls-help-tooltip-portal:before{display:none!important}

/* Notification inbox: viewport-fixed popover, never clipped by the
   dashboard hero. `--mls-notify-max-height` (v1.8.7) lets callers tune
   the cap without another override block; default matches the original
   max-height so nothing changes unless the variable is set. The
   min-width:783px block below only repositions it for desktop, where it
   docks under the bell instead of floating near the top-left. */
.mls-dashboard-notification-popover.is-portal{
  position:fixed!important;left:var(--mls-notify-left,12px)!important;top:var(--mls-notify-top,72px)!important;right:auto!important;bottom:auto!important;
  width:var(--mls-notify-width,min(390px,calc(100vw - 24px)))!important;min-width:280px!important;max-width:calc(100vw - 24px)!important;
  max-height:var(--mls-notify-max-height,min(68vh,580px))!important;overflow:hidden!important;border:1px solid color-mix(in srgb,var(--mls-primary,#d7a928) 30%,#334155)!important;
  border-radius:16px!important;background:#0d141d!important;color:#e5e7eb!important;box-shadow:0 28px 78px -24px rgba(0,0,0,.92)!important;
  z-index:2147482900!important;box-sizing:border-box!important;
}
@media(min-width:783px){
  .mls-dashboard-notification-popover.is-portal{top:var(--mls-notify-top,72px)!important;bottom:auto!important;transform:none!important}
}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-head{display:flex!important;align-items:center!important;justify-content:space-between!important;padding:14px 16px!important;border-bottom:1px solid #263244!important;background:#101923!important}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-head strong{color:#f8fafc!important;font-size:14px!important}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-head small{color:#94a3b8!important;font-size:10px!important}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-list{display:block!important;max-height:min(56vh,490px)!important;overflow:auto!important}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-row{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:10px!important;padding:13px 16px!important;border-bottom:1px solid #263244!important;background:#0d141d!important}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-row.is-unread{background:#151b1f!important}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-copy strong{display:block!important;color:#f8fafc!important;font-size:12px!important}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-copy p{display:block!important;margin:4px 0 0!important;color:#d8dee9!important;font-size:10.5px!important;line-height:1.45!important;white-space:normal!important;overflow-wrap:anywhere!important}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-copy time{display:block!important;margin-top:5px!important;color:#94a3b8!important;font-size:9px!important}
.mls-dashboard-notification-popover.is-portal .mls-dashboard-notification-read{align-self:start!important;white-space:nowrap!important;color:var(--mls-primary,#d7a928)!important}

/* Role/user manager: only the active pane (Add vs View) is ever visible,
   even when a theme overrides the plain [hidden] attribute. */
.mls-role-user-manager[data-active-pane="view"]>[data-mls-role-user-pane="add"],
.mls-role-user-manager[data-active-pane="add"]>[data-mls-role-user-pane="view"]{display:none!important}
.mls-role-user-manager[data-active-pane="view"]>[data-mls-role-user-pane="view"],
.mls-role-user-manager[data-active-pane="add"]>[data-mls-role-user-pane="add"]{display:block!important}

/* Generic detail drawer shows only the record title; no DETAIL/DETAILS kicker. */
.mls-generic-detail-drawer .mls-detail-drawer-head span,.mls-generic-detail-drawer .mls-detail-label,.mls-generic-detail-drawer .mls-front-kicker{display:none!important}

/* --- Mobile one-record/one-card table layout ------------------------- */

/* Shared container reset. Applies to both the legacy `.mls-server-mobile-row`
   markup and the current `.mls-server-mobile-card-row` markup below, so it
   is declared once here instead of once per markup variant. */
@media(max-width:782px){
  .mls-mobile-compact-table{display:block!important;width:100%!important;max-width:100%!important;overflow:visible!important;border:0!important;background:transparent!important}
  .mls-mobile-compact-table table,.mls-mobile-compact-table tbody{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
  .mls-mobile-compact-table thead{display:none!important}
}

/* Legacy markup (`.mls-server-mobile-row`): still emitted by a subset of
   templates, kept alongside the current markup below. */
@media(max-width:782px){
  .mls-mobile-compact-table tr.mls-server-mobile-row{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0 0 8px!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important}
  .mls-mobile-compact-table tr.mls-server-mobile-row>td:not(.mls-server-mobile-card-cell){display:none!important}
  .mls-mobile-compact-table tr.mls-server-mobile-row>.mls-server-mobile-card-cell{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;padding:0!important;border:0!important;background:transparent!important;box-sizing:border-box!important}
  .mls-server-mobile-card{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box!important;padding:10px 11px 0!important;border:1px solid color-mix(in srgb,var(--mls-primary,#d7a928) 25%,var(--mls-border,#263244))!important;border-radius:14px!important;background:linear-gradient(145deg,#0d141d,#111710)!important;box-shadow:0 14px 32px -28px rgba(0,0,0,.9)!important;overflow:hidden!important}
  .mls-server-mobile-card-head{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:8px!important;padding-bottom:8px!important;min-width:0!important}
  .mls-server-mobile-card-identity{display:flex!important;align-items:center!important;gap:8px!important;min-width:0!important;flex:1 1 auto!important}
  .mls-server-mobile-card-icon{display:inline-flex!important;align-items:center!important;justify-content:center!important;flex:0 0 36px!important;width:36px!important;height:36px!important;border-radius:10px!important;background:color-mix(in srgb,var(--mls-primary,#d7a928) 16%,transparent)!important;border:1px solid color-mix(in srgb,var(--mls-primary,#d7a928) 38%,var(--mls-border,#263244))!important;color:var(--mls-primary,#d7a928)!important}
  .mls-server-mobile-card-icon svg{display:block!important;width:18px!important;height:18px!important}
  .mls-server-mobile-card-title{min-width:0!important;flex:1 1 auto!important}
  .mls-server-mobile-card-title strong{display:block!important;min-width:0!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;color:var(--mls-heading,#f8fafc)!important;font-size:12px!important;font-weight:850!important;line-height:1.25!important}
  .mls-server-mobile-card-head>.mls-status-badge,.mls-server-mobile-card-head>.mls-pill{flex:0 0 auto!important;min-height:24px!important;max-width:100px!important;padding:3px 8px!important;font-size:8px!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .mls-server-mobile-card-meta{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;min-width:0!important;padding:8px 0!important;border-top:1px solid var(--mls-border,#263244)!important;border-bottom:1px solid var(--mls-border,#263244)!important}
  .mls-server-mobile-card-meta>div{display:grid!important;align-content:start!important;gap:3px!important;min-width:0!important;padding:0 7px!important;border-right:1px solid var(--mls-border,#263244)!important}
  .mls-server-mobile-card-meta>div:first-child{padding-left:0!important}.mls-server-mobile-card-meta>div:last-child{padding-right:0!important;border-right:0!important}
  .mls-server-mobile-card-meta small{display:block!important;color:var(--mls-muted,#94a3b8)!important;font-size:7px!important;font-weight:800!important;letter-spacing:.05em!important;text-transform:uppercase!important;line-height:1.2!important}
  .mls-server-mobile-card-meta strong{display:block!important;min-width:0!important;max-width:100%!important;color:var(--mls-text,#e5e7eb)!important;font-size:8.5px!important;font-weight:650!important;line-height:1.3!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}
  .mls-server-mobile-card-action{display:flex!important;align-items:center!important;justify-content:center!important;min-height:38px!important;padding:3px 0!important}
  .mls-server-mobile-detail{appearance:none!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:5px!important;min-height:30px!important;width:auto!important;margin:0!important;padding:5px 8px!important;border:0!important;background:transparent!important;box-shadow:none!important;color:var(--mls-heading,#f8fafc)!important;font:inherit!important;font-size:9.5px!important;font-weight:800!important;white-space:nowrap!important;cursor:pointer!important}
  .mls-server-mobile-detail:before{content:none!important;display:none!important}
  .mls-server-mobile-detail:after{content:'›'!important;display:inline-block!important;margin-left:1px!important;color:var(--mls-primary,#d7a928)!important;font-size:17px!important;line-height:1!important;font-weight:500!important}
  .mls-server-mobile-detail>.mls-ui-icon,.mls-server-mobile-detail>.mls-icon-svg,.mls-server-mobile-detail>.dashicons,.mls-server-mobile-detail>svg{display:none!important}
  .mls-role-user-list-panel>.mls-section-head{display:none!important}
}
@media(max-width:390px){
  .mls-server-mobile-card{padding:9px 9px 0!important}.mls-server-mobile-card-meta>div{padding-inline:5px!important}.mls-server-mobile-card-meta small{font-size:6.5px!important}.mls-server-mobile-card-meta strong{font-size:8px!important}
}
@media(max-width:782px){.mls-server-mobile-row>.mls-mobile-reference-cell{display:none!important}}

/* Structural kill-switches for markup this stylesheet's card layout fully
   replaces: the in-page "quick find" trigger duplicates the always-visible
   command palette, and the bare `.mls-server-mobile-card-row` (outside a
   `.mls-mobile-compact-table`) is a template fallback that should never
   render on its own. */
.mls-quick-find{display:none!important}
.mls-server-mobile-card-row{display:none!important}

/* Current markup (`.mls-server-mobile-card-row`). */
@media(max-width:782px){
  .mls-mobile-compact-table tr.mls-desktop-data-row{display:none!important}
  .mls-mobile-compact-table tr.mls-server-mobile-card-row{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0 0 10px!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important}
  .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;padding:0!important;border:0!important;background:transparent!important;box-sizing:border-box!important}
  .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell::before,
  .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell::after{content:none!important;display:none!important}
  .mls-server-mobile-card{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;box-sizing:border-box!important}
  #mls-master-vendors,.mls-role-user-list-panel,.mls-role-user-pane[data-mls-role-user-pane="view"]{width:100%!important;max-width:100%!important;min-width:0!important}
  #mls-master-vendors .mls-server-mobile-card-row,#mls-master-vendors .mls-server-mobile-card-cell,#mls-master-vendors .mls-server-mobile-card{width:100%!important;max-width:100%!important;min-width:0!important}
  .mls-server-mobile-card :where(.mls-front-kicker,.mls-kicker,.mls-detail-label,[data-label="Detail"],[data-label="DETAIL"]){display:none!important}
  .mls-server-mobile-card-meta strong{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important;word-break:break-word!important}
}

/* Same current-markup layout, re-asserted at higher specificity under
   `body.mls-installed-app` / `body.mls-pwa-app-shell` / `body.mls-ui-skin`.
   Kept separate from the block above on purpose: at least one theme's own
   table rules were only being beaten in those specific body contexts, so
   collapsing this into the unscoped rule would remove the extra
   specificity that made it necessary. */
@media(max-width:782px){
  body.mls-installed-app .mls-mobile-compact-table tr.mls-server-mobile-card-row,
  body.mls-pwa-app-shell .mls-mobile-compact-table tr.mls-server-mobile-card-row,
  body.mls-ui-skin .mls-mobile-compact-table tr.mls-server-mobile-card-row{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
  body.mls-installed-app .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell,
  body.mls-pwa-app-shell .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell,
  body.mls-ui-skin .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;grid-template-columns:none!important}
  body.mls-installed-app .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell::before,
  body.mls-pwa-app-shell .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell::before,
  body.mls-ui-skin .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell::before{content:none!important;display:none!important}
  body.mls-installed-app .mls-server-mobile-card,body.mls-pwa-app-shell .mls-server-mobile-card,body.mls-ui-skin .mls-server-mobile-card{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important}
}

@media(max-width:782px){
  .mls-mobile-compact-table .mls-mobile-reference-cell{display:none!important}
  .mls-mobile-compact-table tr.mls-mobile-reference-row.mls-desktop-data-row{display:none!important}
  .mls-mobile-compact-table tr.mls-server-mobile-card-row{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
  .mls-mobile-compact-table tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
  .mls-mobile-compact-table .mls-server-mobile-card{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important}
  .mls-server-mobile-card-meta small{display:block!important;visibility:visible!important;opacity:1!important;font-size:8px!important;font-weight:850!important;letter-spacing:.055em!important;text-transform:uppercase!important;color:var(--mls-muted,#b6b0a6)!important;white-space:normal!important}
  .mls-server-mobile-card-meta strong{display:block!important;font-size:9px!important;line-height:1.35!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important}
  .mls-server-mobile-card-cell::before,.mls-server-mobile-card-cell::after{content:none!important;display:none!important}
}

/* Authoritative one-record/one-card responsive visibility switch: when a
   template opts in via `[data-mls-server-mobile-cards="1"]`, the desktop
   table row and the mobile card row are mutually exclusive by viewport,
   with no flash of both. */
.mls-mobile-compact-table[data-mls-server-mobile-cards="1"] tr.mls-server-mobile-card-row{display:none!important}
@media(min-width:783px){
  .mls-mobile-compact-table[data-mls-server-mobile-cards="1"] tr.mls-desktop-data-row{display:table-row!important;visibility:visible!important}
  .mls-mobile-compact-table[data-mls-server-mobile-cards="1"] tr.mls-server-mobile-card-row{display:none!important;visibility:hidden!important}
}
@media(max-width:782px){
  .mls-mobile-compact-table[data-mls-server-mobile-cards="1"] tr.mls-desktop-data-row,
  .mls-mobile-compact-table[data-mls-server-mobile-cards="1"] tr.mls-mobile-reference-row{display:none!important;visibility:hidden!important;height:0!important;min-height:0!important;max-height:0!important;margin:0!important;padding:0!important;border:0!important;overflow:hidden!important}
  .mls-mobile-compact-table[data-mls-server-mobile-cards="1"] tr.mls-desktop-data-row>td,
  .mls-mobile-compact-table[data-mls-server-mobile-cards="1"] tr.mls-mobile-reference-row>td{display:none!important;visibility:hidden!important;height:0!important;min-height:0!important;padding:0!important;border:0!important}
  .mls-mobile-compact-table[data-mls-server-mobile-cards="1"] tr.mls-server-mobile-card-row{display:block!important;visibility:visible!important;width:100%!important;max-width:100%!important;min-width:0!important;height:auto!important;max-height:none!important;margin:0 0 10px!important;padding:0!important;border:0!important;overflow:visible!important}
  .mls-mobile-compact-table[data-mls-server-mobile-cards="1"] tr.mls-server-mobile-card-row>td.mls-server-mobile-card-cell{display:block!important;visibility:visible!important;width:100%!important;max-width:100%!important;min-width:0!important;height:auto!important;padding:0!important;border:0!important}
  .mls-mobile-compact-table[data-mls-server-mobile-cards="1"] .mls-mobile-reference-cell{display:none!important}
}
/* Staff's permission-driven sections must stay reachable after leaving Overview.
   Mobile uses the More sheet; desktop keeps the authorized tab strip visible. */
@media (min-width: 783px) {
    body .mls-role-dashboard nav.mls-staff-tab-controller {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px;
        position: relative !important;
        max-width: 100%;
        margin: 16px 0;
    }
    body .mls-role-dashboard nav.mls-staff-tab-controller a:not([hidden]) {
        display: inline-flex !important;
        align-items: center;
        min-height: 44px;
        padding: 10px 14px;
        white-space: normal;
    }
}
