/*
 * AEOS_MASTER_INPUT_LAUNCHER_COLLISION_GUARD_V1
 *
 * UI-only geometry contract.
 * Does not modify authentication, sessions, permissions,
 * approvals, execution authority, providers, or writers.
 */

#aeosStaticHorizontalCommandRow,
#aeos-master-user-launcher-stack-v1,
#aeosMasterEmployeeFullLiveBadgeV1,
#aeos-dashboard-launcher-row-v26 {
    box-sizing: border-box !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

/*
 * Keep the master input in ordinary page flow.
 * Neutralize stale absolute/fixed geometry and transforms.
 */
#aeosStaticHorizontalCommandRow {
    position: relative !important;

    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;

    translate: none !important;
    rotate: none !important;
    scale: none !important;
    transform: none !important;

    float: none !important;
    clear: both !important;

    width: 100% !important;
    height: auto !important;

    margin-top: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 14px !important;
    margin-left: 0 !important;

    overflow: visible !important;
}

/*
 * Keep the complete launcher stack below the input.
 *
 * The JS guard sets --aeos-master-input-collision-offset only
 * when a late governor creates a measurable visual collision.
 */
#aeos-master-user-launcher-stack-v1 {
    position: relative !important;

    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;

    translate: none !important;
    rotate: none !important;
    scale: none !important;
    transform: none !important;

    float: none !important;
    clear: both !important;

    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;

    margin-top:
        var(
            --aeos-master-input-collision-offset,
            0px
        ) !important;

    margin-right: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;

    overflow: visible !important;
}

/*
 * Prevent the live employee badge from becoming a floating
 * overlay between the input and the launcher buttons.
 */
#aeosMasterEmployeeFullLiveBadgeV1 {
    position: relative !important;

    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;

    translate: none !important;
    rotate: none !important;
    scale: none !important;
    transform: none !important;

    float: none !important;
    clear: both !important;

    width: auto !important;
    height: auto !important;
}

/*
 * The launcher row must generate real layout height when the
 * controls wrap. This prevents the following content from
 * moving underneath visually positioned buttons.
 */
#aeos-dashboard-launcher-row-v26 {
    position: relative !important;

    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;

    translate: none !important;
    rotate: none !important;
    scale: none !important;
    transform: none !important;

    float: none !important;
    clear: both !important;

    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;

    overflow: visible !important;
}

/*
 * Desktop layout:
 * - Buttons stay within the available width.
 * - Narrow desktop windows wrap into real grid rows.
 * - Nothing uses negative positioning to preserve one line.
 */
@media (min-width: 901px) {
    #aeos-dashboard-launcher-row-v26 {
        display: grid !important;

        grid-template-columns:
            repeat(
                auto-fit,
                minmax(
                    min(132px, 100%),
                    1fr
                )
            ) !important;

        grid-auto-flow: row !important;
        grid-auto-rows: minmax(42px, auto) !important;

        align-items: stretch !important;
        justify-items: stretch !important;

        column-gap: 8px !important;
        row-gap: 8px !important;
    }

    #aeos-dashboard-launcher-row-v26 > * {
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #aeos-dashboard-launcher-row-v26 button,
    #aeos-dashboard-launcher-row-v26 a,
    #aeos-dashboard-launcher-row-v26 [role="button"] {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        box-sizing: border-box !important;

        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/*
 * Wide desktop keeps the eight-launcher rail on one organized
 * line when sufficient width is actually available.
 */
@media (min-width: 1440px) {
    #aeos-dashboard-launcher-row-v26 {
        grid-template-columns:
            repeat(8, minmax(0, 1fr)) !important;
    }
}

/*
 * AEOS_MASTER_INPUT_INLINE_BUTTON_SEPARATION_V1
 *
 * Scope:
 *   Authenticated master-profile launcher stack only.
 *
 * Purpose:
 *   Preserve a clear visual boundary between the end of
 *   #aeosStaticHorizontalCommandRow and the beginning of
 *   #aeos-master-user-launcher-stack-v1.
 *
 * Authority:
 *   AEOS_MASTER_INPUT_LAUNCHER_COLLISION_GUARD_V1
 *
 * This rule performs no DOM movement, reparenting, ordering,
 * visibility, execution-authority or customer-action change.
 */
body[data-aeos-profile="master"]
#aeos-master-user-launcher-stack-v1[
  data-aeos-master-input-collision-owner=
  "AEOS_MASTER_INPUT_LAUNCHER_COLLISION_GUARD_V1"
],
html[data-aeos-master-governance-profile="master"]
#aeos-master-user-launcher-stack-v1[
  data-aeos-master-input-collision-owner=
  "AEOS_MASTER_INPUT_LAUNCHER_COLLISION_GUARD_V1"
] {
  --aeos-master-input-inline-separation-floor:
    clamp(20px, 2.2vw, 28px);

  margin-block-start:
    var(--aeos-master-input-inline-separation-floor) !important;

  margin-block-start:
    max(
      var(--aeos-master-input-inline-separation-floor),
      var(--aeos-master-input-collision-offset, 0px)
    ) !important;

  padding-block-start: 10px !important;

  border-block-start:
    1px solid rgba(148, 163, 184, 0.28) !important;
}
